[PR #8001] [MERGED] feat(video): Roleplay /video and the storyteller's [video] command #8050

Closed
opened 2026-10-24 04:09:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8001
Author: @JamesMowery
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/roleplay-videos


📝 Commits (10+)

  • 1f45d67 feat(video): Roleplay /video makes a clip of the latest reply
  • 3f182df fix(video): Roleplay clips without a picture are written as text to video
  • 120acc5 fix(video): Roleplay /video clips show in the persona's gallery
  • d24de7a fix(video): review fixes for Roleplay /video
  • 4492d40 fix(video): localize the Roleplay video review title
  • 219f650 fix(video): Roleplay /video names its reply only when the clip landed
  • 294059b fix(video): give the Roleplay clip director room to think
  • 6177a3c fix(video): file Roleplay /video clips under the people they show
  • 87499b1 fix(video): Roleplay /video and Animate use the shared clip writer
  • 5f9ed0a feat(video): Roleplay [video] command for the storyteller

📊 Changes

24 files changed (+1261 additions, -195 deletions)

View changed files

📝 docs/chats/slash-commands.md (+1 -0)
📝 docs/media/illustrator-agent.md (+3 -3)
📝 docs/media/scene-video.md (+13 -5)
📝 docs/roleplay/getting-started.md (+6 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+139 -1)
📝 packages/client/src/components/chat/ChatInput.tsx (+4 -0)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+3 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+32 -34)
📝 packages/client/src/components/chat/RoleplayCommandsSettings.tsx (+2 -2)
📝 packages/client/src/hooks/use-generate.ts (+15 -2)
📝 packages/client/src/lib/slash-commands.ts (+23 -3)
📝 packages/client/src/localization/locales/en.json (+5 -1)
📝 packages/server/src/routes/gallery.routes.ts (+327 -107)
📝 packages/server/src/routes/generate.routes.ts (+175 -26)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+21 -2)
📝 packages/server/src/services/generation/conversation-video-runtime.ts (+5 -2)
📝 packages/server/src/services/generation/illustrator-manual-prompt-generation.ts (+3 -1)
📝 packages/server/src/services/generation/roleplay-commands.ts (+22 -0)
📝 packages/server/src/services/video/roleplay-clip-writer.ts (+3 -4)
📝 packages/shared/src/types/roleplay-command.ts (+2 -0)

...and 4 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Note

Depends on #7993 (item 6). This branch is #7993's head (d6be94a30) with the current staging merged in, so until #7993 merges GitHub also shows its commits here. This PR's own changes are the commits from 1f45d6794 (Roleplay /video) to the tip, not counting the staging merge.

Linked issue

Closes #8000
Part of #7545 (item 7 of 8). @SpicyMarinara

Why this change

  • Roleplay had no /video, and the Gallery's Video button animated the newest picture, which could come from a reply several messages back. Clips should show what is happening now, as /illustrate does.
  • A clip made without a picture (First frame on the avatar or no picture) was written as if it continued a picture that didn't exist.
  • The storyteller could ask for a picture with [illustrate], but not for a clip, so moments that are about motion (a fight, a chase, something breaking) only ever became stills.

What changed

Nothing that worked before changes except the Gallery's Video button in Roleplay (below). Video clips starts off.

Roleplay /video (POST /api/gallery/:chatId/roleplay-video)

  • /video [description] and the Gallery's Video button make a clip of the latest reply (or of the description) under the newest reply, following the chat's First frame. With a picture first frame, the latest reply is illustrated first and that picture is animated.
  • Behavior change: in Roleplay the Gallery's Video button no longer animates the newest picture; Animate illustration on a picture still does.
  • The AI writing the clip reads as many recent messages as Illustrator does (its Context Size). Animating a specific picture now reads the messages up to that picture's reply, instead of one exchange.
  • With no picture to start from, a new Roleplay Clip Director prompt (Settings, Generations, Video Generation Prompt Overrides) describes the scene itself for text-to-video. Animating a picture keeps the Gallery animation director.
  • The Avatar first frame starts from whoever the description names first, your persona included. A whole word only ("brambles" doesn't name Bram), and a unique, capitalised part of a name counts ("Bram" for "Captain Bram Holloway"), with the rule Conversation clips use.
  • Clips are filed under the people they show, the persona included; a clip that names no one belongs to the whole chat.
  • Expose media prompts before sending covers /video and Video (previewOnly / promptOverride), and the review closes once read (as #7733 does).
  • The writer has room to think (8,192 tokens) and says when it ran out. Closing the tab or the client's timeout stops the clip, as Conversation /video and Animate already do.
  • The Roleplay First frame setting is always shown, since /video uses it in every Illustrator mode.

Roleplay [video] command

  • A Video clips Roleplay Command (off by default; needs Illustrator in the chat and a video connection) lets the storyteller write [video: subject="…" motion="…" characters="…"], preferred over [illustrate] when the moment is about motion.
  • It is offered only while a clip may be made now (the Video Run Interval, counted over the whole chat), re-checked as the clip starts, and counts toward Videos per reply; Stop reaches it. A clip that starts from the avatar or no picture tells the client it is pending (video_started), so the next message can start while it renders.
  • It follows First frame: from the avatar or no picture, the Clip Director writes it from the storyteller's subject and motion; with a new Illustrator picture, Illustrator draws the moment and the picture is animated with that motion (shown instead if the clip fails).
  • With Pictures and clips, a storyteller's [illustrate] is offered the clip fields too, through the shared formatOptionalVideoOffer.

Every clip

  • /video, Video, Animate and [video] go through the shared clip writer (services/video/roleplay-clip-writer.ts), so they follow Video Prompting Instructions like Illustrator's clips. With Attach Card Appearance for videos and instructions that speak to appearance, the writer builds the appearance in.
  • A saved clip always counts as made: a reply that was deleted or can't be updated reports the clip with no message and no error.

Docs: docs/chats/slash-commands.md, docs/media/illustrator-agent.md, docs/media/scene-video.md, docs/roleplay/getting-started.md.

Review notes from #7860 / #7863 applied here

  • Avatar first frame with short names: /video now uses the shared name-part rule (regression with a multi-word card name).
  • Stop reaching clips: [video] passes the agent signal; /video passes its request signal to the writer and the clip.
  • Model-written tags are paced: [video] goes through claimRoleplayClip (interval with the allowed check, plus Videos per reply), and a refused one is logged.
  • The composer isn't held for a whole render: [video] sends video_started.
  • A stopped clip shows no video_error.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated runs on 2026-10-21, Node 24.21.0:

  • On the staging merge (staging bcdfb51d1 into the PR rebased on #7993 d6be94a30, no conflicts): pnpm check passes (its one lint warning, in HomeProfessorMariChat.tsx, is not from this PR); pnpm localization:check passes; full pnpm regression: 965/965 pass.
  • On 23758cf33: pnpm check; roleplay-video-command, roleplay-video-tag and convo-video-command pass. The two new checks (a short name finding its card's avatar; video_started for a [video] with no picture) fail without their fixes.
  • Regressions added by this PR, through the real routes with fake text, image and ComfyUI services:
    • roleplay-video-command: the director's window when animating a picture; /video (newest reply, description, context size, Prompt only, Avatar by name, short name, persona and whole words, needsPicture, not in Conversation); filing; the preview and reviewed prompt; the director's budget; appearance built in.
    • roleplay-video-tag: parsing and offering [video], both first-frame paths end to end, the command off, [illustrate] becoming a clip, a saved-but-unattached clip, a deleted reply.
  • Playwright, each project on its own (--workers=1): roleplay-commands, illustrator-manual-cadence, conversation-video-gallery, private-note-narrator, atlas-cloud-options, assigned-chat-sweep. desktop-chromium 46 passed, 1 skipped; mobile-chromium 46 passed, 1 skipped; mobile-webkit 45 passed, 2 skipped (two assigned-chat-sweep tests that failed when the local test server restarted mid-run pass on a rerun of that spec).
  • Local CodeRabbit (CLI), on this PR's commits against #7993's head: 1 finding, fixed in 23758cf33 (/video now passes its request signal to the clip, not only the writer). A review of that commit: 1 finding, the [docs-i18n] follow-up, which is #8002.
  • Not run: the rest of pnpm regression:ui and pnpm smoke:ui.

Manual verification notes

  • Manually verify Roleplay /video with First frame Prompt only: a clip of the latest reply appears under the newest reply, and no picture is drawn.
  • Manually verify /video Lena runs with First frame Avatar and a character named "Dr. Lena Kowalski": the clip starts from her avatar.
  • Manually verify First frame New Illustrator picture: /video illustrates the latest reply first, then animates that picture.
  • Manually verify the Gallery's Video button in Roleplay does the same as /video, and Animate illustration on an older picture still animates that picture.
  • Manually verify Expose media prompts before sending shows the /video prompt for review, and an edited prompt is the one sent.
  • Manually verify Video clips on: an action moment gets a [video] clip in the reply; with Video Run Interval 0 no [video] is offered.
  • Manually verify you can send the next message while a [video] clip is still rendering.
  • Manually verify Stop during a [video] clip that is waiting or being written cancels it with no error toast.
  • Manually verify the new settings at phone width and in light and dark mode.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

English docs updated: docs/chats/slash-commands.md, docs/media/illustrator-agent.md, docs/media/scene-video.md, docs/roleplay/getting-started.md. Translations: #8002

UI evidence (if applicable)

Screenshot from 2026-10-19 17-21-01 Screenshot from 2026-10-19 17-21-38

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8001 **Author:** [@JamesMowery](https://github.com/JamesMowery) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/roleplay-videos` --- ### 📝 Commits (10+) - [`1f45d67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1f45d67945fce7ce129f6588ac09d88f4bf43682) feat(video): Roleplay /video makes a clip of the latest reply - [`3f182df`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3f182df871e873cd8385e6eee024c7cabed7f2b8) fix(video): Roleplay clips without a picture are written as text to video - [`120acc5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/120acc547d2ef1c3554bf92d12b337088f1c12bc) fix(video): Roleplay /video clips show in the persona's gallery - [`d24de7a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d24de7a1ec20e7159b54eaf2885a82b8beef138f) fix(video): review fixes for Roleplay /video - [`4492d40`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4492d40f3d27b967d9bbaaf9cdb32e54c418e783) fix(video): localize the Roleplay video review title - [`219f650`](https://github.com/Pasta-Devs/Marinara-Engine/commit/219f650992e2eb86d81a71cd919364e589a6fd5e) fix(video): Roleplay /video names its reply only when the clip landed - [`294059b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/294059bb12fb35ffc4cc78755b9060d808bb0c8d) fix(video): give the Roleplay clip director room to think - [`6177a3c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6177a3c29cebf193036362ef80184c1b4e350d70) fix(video): file Roleplay /video clips under the people they show - [`87499b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/87499b155bdb68171f8dc9a0a61b900340d7fb30) fix(video): Roleplay /video and Animate use the shared clip writer - [`5f9ed0a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5f9ed0a22847091df9b619c90d018e6654ce51d3) feat(video): Roleplay [video] command for the storyteller ### 📊 Changes **24 files changed** (+1261 additions, -195 deletions) <details> <summary>View changed files</summary> 📝 `docs/chats/slash-commands.md` (+1 -0) 📝 `docs/media/illustrator-agent.md` (+3 -3) 📝 `docs/media/scene-video.md` (+13 -5) 📝 `docs/roleplay/getting-started.md` (+6 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+139 -1) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+4 -0) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+3 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+32 -34) 📝 `packages/client/src/components/chat/RoleplayCommandsSettings.tsx` (+2 -2) 📝 `packages/client/src/hooks/use-generate.ts` (+15 -2) 📝 `packages/client/src/lib/slash-commands.ts` (+23 -3) 📝 `packages/client/src/localization/locales/en.json` (+5 -1) 📝 `packages/server/src/routes/gallery.routes.ts` (+327 -107) 📝 `packages/server/src/routes/generate.routes.ts` (+175 -26) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+21 -2) 📝 `packages/server/src/services/generation/conversation-video-runtime.ts` (+5 -2) 📝 `packages/server/src/services/generation/illustrator-manual-prompt-generation.ts` (+3 -1) 📝 `packages/server/src/services/generation/roleplay-commands.ts` (+22 -0) 📝 `packages/server/src/services/video/roleplay-clip-writer.ts` (+3 -4) 📝 `packages/shared/src/types/roleplay-command.ts` (+2 -0) _...and 4 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> > [!NOTE] > **Depends on #7993 (item 6).** This branch is #7993's head (`d6be94a30`) with the current `staging` merged in, so until #7993 merges GitHub also shows its commits here. This PR's own changes are the commits from `1f45d6794` (Roleplay `/video`) to the tip, not counting the `staging` merge. ## Linked issue Closes #8000 Part of #7545 (item 7 of 8). @SpicyMarinara ## Why this change - Roleplay had no `/video`, and the Gallery's **Video** button animated the newest picture, which could come from a reply several messages back. Clips should show what is happening now, as `/illustrate` does. - A clip made without a picture (First frame on the avatar or no picture) was written as if it continued a picture that didn't exist. - The storyteller could ask for a picture with `[illustrate]`, but not for a clip, so moments that are about motion (a fight, a chase, something breaking) only ever became stills. ## What changed Nothing that worked before changes except the Gallery's **Video** button in Roleplay (below). **Video clips** starts off. **Roleplay `/video`** (`POST /api/gallery/:chatId/roleplay-video`) - `/video [description]` and the Gallery's **Video** button make a clip of the latest reply (or of the description) under the newest reply, following the chat's **First frame**. With a picture first frame, the latest reply is illustrated first and that picture is animated. - **Behavior change:** in Roleplay the Gallery's **Video** button no longer animates the newest picture; **Animate illustration** on a picture still does. - The AI writing the clip reads as many recent messages as Illustrator does (its **Context Size**). Animating a specific picture now reads the messages up to that picture's reply, instead of one exchange. - With no picture to start from, a new **Roleplay Clip Director** prompt (Settings, Generations, Video Generation Prompt Overrides) describes the scene itself for text-to-video. Animating a picture keeps the Gallery animation director. - The **Avatar** first frame starts from whoever the description names first, your persona included. A whole word only ("brambles" doesn't name Bram), and a unique, capitalised part of a name counts ("Bram" for "Captain Bram Holloway"), with the rule Conversation clips use. - Clips are filed under the people they show, the persona included; a clip that names no one belongs to the whole chat. - **Expose media prompts before sending** covers `/video` and **Video** (`previewOnly` / `promptOverride`), and the review closes once read (as #7733 does). - The writer has room to think (8,192 tokens) and says when it ran out. Closing the tab or the client's timeout stops the clip, as Conversation `/video` and **Animate** already do. - The Roleplay **First frame** setting is always shown, since `/video` uses it in every Illustrator mode. **Roleplay `[video]` command** - A **Video clips** Roleplay Command (off by default; needs Illustrator in the chat and a video connection) lets the storyteller write `[video: subject="…" motion="…" characters="…"]`, preferred over `[illustrate]` when the moment is about motion. - It is offered only while a clip may be made now (the **Video Run Interval**, counted over the whole chat), re-checked as the clip starts, and counts toward **Videos per reply**; **Stop** reaches it. A clip that starts from the avatar or no picture tells the client it is pending (`video_started`), so the next message can start while it renders. - It follows **First frame**: from the avatar or no picture, the Clip Director writes it from the storyteller's subject and motion; with a new Illustrator picture, Illustrator draws the moment and the picture is animated with that motion (shown instead if the clip fails). - With **Pictures and clips**, a storyteller's `[illustrate]` is offered the clip fields too, through the shared `formatOptionalVideoOffer`. **Every clip** - `/video`, **Video**, **Animate** and `[video]` go through the shared clip writer (`services/video/roleplay-clip-writer.ts`), so they follow **Video Prompting Instructions** like Illustrator's clips. With Attach Card Appearance for videos and instructions that speak to appearance, the writer builds the appearance in. - A saved clip always counts as made: a reply that was deleted or can't be updated reports the clip with no message and no error. **Docs**: `docs/chats/slash-commands.md`, `docs/media/illustrator-agent.md`, `docs/media/scene-video.md`, `docs/roleplay/getting-started.md`. ### Review notes from #7860 / #7863 applied here - Avatar first frame with short names: `/video` now uses the shared name-part rule (regression with a multi-word card name). - Stop reaching clips: `[video]` passes the agent signal; `/video` passes its request signal to the writer and the clip. - Model-written tags are paced: `[video]` goes through `claimRoleplayClip` (interval with the `allowed` check, plus Videos per reply), and a refused one is logged. - The composer isn't held for a whole render: `[video]` sends `video_started`. - A stopped clip shows no `video_error`. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Automated runs on 2026-10-21, Node 24.21.0: - On the `staging` merge (`staging` `bcdfb51d1` into the PR rebased on #7993 `d6be94a30`, no conflicts): `pnpm check` passes (its one lint warning, in `HomeProfessorMariChat.tsx`, is not from this PR); `pnpm localization:check` passes; full `pnpm regression`: 965/965 pass. - On `23758cf33`: `pnpm check`; `roleplay-video-command`, `roleplay-video-tag` and `convo-video-command` pass. The two new checks (a short name finding its card's avatar; `video_started` for a `[video]` with no picture) fail without their fixes. - Regressions added by this PR, through the real routes with fake text, image and ComfyUI services: - `roleplay-video-command`: the director's window when animating a picture; `/video` (newest reply, description, context size, Prompt only, Avatar by name, short name, persona and whole words, needsPicture, not in Conversation); filing; the preview and reviewed prompt; the director's budget; appearance built in. - `roleplay-video-tag`: parsing and offering `[video]`, both first-frame paths end to end, the command off, `[illustrate]` becoming a clip, a saved-but-unattached clip, a deleted reply. - Playwright, each project on its own (`--workers=1`): `roleplay-commands`, `illustrator-manual-cadence`, `conversation-video-gallery`, `private-note-narrator`, `atlas-cloud-options`, `assigned-chat-sweep`. `desktop-chromium` 46 passed, 1 skipped; `mobile-chromium` 46 passed, 1 skipped; `mobile-webkit` 45 passed, 2 skipped (two `assigned-chat-sweep` tests that failed when the local test server restarted mid-run pass on a rerun of that spec). - Local CodeRabbit (CLI), on this PR's commits against #7993's head: 1 finding, fixed in `23758cf33` (`/video` now passes its request signal to the clip, not only the writer). A review of that commit: 1 finding, the `[docs-i18n]` follow-up, which is #8002. - Not run: the rest of `pnpm regression:ui` and `pnpm smoke:ui`. ### Manual verification notes - Manually verify Roleplay `/video` with First frame **Prompt only**: a clip of the latest reply appears under the newest reply, and no picture is drawn. - Manually verify `/video Lena runs` with First frame **Avatar** and a character named "Dr. Lena Kowalski": the clip starts from her avatar. - Manually verify First frame **New Illustrator picture**: `/video` illustrates the latest reply first, then animates that picture. - Manually verify the Gallery's **Video** button in Roleplay does the same as `/video`, and **Animate illustration** on an older picture still animates that picture. - Manually verify **Expose media prompts before sending** shows the `/video` prompt for review, and an edited prompt is the one sent. - Manually verify **Video clips** on: an action moment gets a `[video]` clip in the reply; with Video Run Interval **0** no `[video]` is offered. - Manually verify you can send the next message while a `[video]` clip is still rendering. - Manually verify **Stop** during a `[video]` clip that is waiting or being written cancels it with no error toast. - Manually verify the new settings at phone width and in light and dark mode. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) English docs updated: `docs/chats/slash-commands.md`, `docs/media/illustrator-agent.md`, `docs/media/scene-video.md`, `docs/roleplay/getting-started.md`. Translations: #8002 ## UI evidence (if applicable) <img width="1058" height="850" alt="Screenshot from 2026-10-19 17-21-01" src="https://github.com/user-attachments/assets/2acea0a1-8ec3-43a8-abac-28a02acdb745" /> <img width="1058" height="850" alt="Screenshot from 2026-10-19 17-21-38" src="https://github.com/user-attachments/assets/7ae9abec-bcdf-4987-adff-25112398e1e9" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #8001] feat(video): Roleplay /video and the storyteller's [video] command to [PR #8001] [MERGED] feat(video): Roleplay /video and the storyteller's [video] command 2026-10-25 04:03:41 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8050
No description provided.