[PR #230] [MERGED] Feature: Add scene fork roleplay actions #4517

Closed
opened 2026-10-22 04:08:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/230
Author: @OnlyJimmy
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @LukaTheHero

Base: main ← Head: scene-fork-roleplay


📝 Commits (8)

  • 9e58c66 Add scene fork roleplay actions
  • 05f36ae Address scene fork review feedback
  • 3a49fa6 Clarify scene fork swipe metadata copy
  • b683d03 Hide scene fork context and tighten fork validation
  • 2eb93bc Avoid message metadata fallback for copied swipe
  • 3f52540 Document scene fork behavior
  • d7bdaaf Address scene fork review feedback
  • 4e5d5ce Preserve scene fork message swipes

📊 Changes

9 files changed (+491 additions, -17 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+13 -1)
📝 packages/client/src/components/chat/ChatMessage.tsx (+22 -0)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+23 -1)
📝 packages/client/src/components/chat/SceneBanner.tsx (+34 -2)
📝 packages/client/src/hooks/use-scene.ts (+60 -2)
📝 packages/server/src/routes/scene.routes.ts (+254 -0)
📝 packages/server/src/services/storage/chats.storage.ts (+52 -11)
📝 packages/shared/src/types/chat.ts (+2 -0)
📝 packages/shared/src/types/scene.ts (+31 -0)

📄 Description

Why this change

Active scenes could be concluded or abandoned, but there was no way to preserve a scene as an independent roleplay thread. This adds a focused fork flow so users can keep narrative continuity without carrying over scene lifecycle behavior.

What changed

What changed

  • Added POST /api/scene/fork with clone and convert modes.
  • Added shared scene fork request/response types.
  • Added Clone from here to active scene message actions, copying scene continuity and messages up to the selected message into a standalone roleplay chat.
  • Added Convert beside the scene discard controls, with confirmation, to detach the active scene into a standalone roleplay.
  • Added hidden narrator continuity context so forked chats preserve useful pre-scene context without showing scene setup in the transcript.
  • Preserved copied message metadata, timestamps, active swipe state, and all message swipes during fork creation.
  • Preserved normal roleplay metadata such as characters, persona, group, preset, connection, lorebook metadata, settings, and background where applicable.
  • Ensured forked roleplay chats strip scene lifecycle metadata and do not write scene summaries or character memory during convert cleanup.
  • Added fork in-flight guards and disabled clone/convert actions while scene generation is streaming.
  • Added best-effort cleanup for partially-created fork chats if message copying or convert cleanup fails.
  • Updated forked chat names to distinguish cloned and converted chats.

Validation

  • pnpm check
  • Manual verification completed (describe below)

Manual verification notes

  • Manually tested functionality with Prof. Mari
  • Scenes remain disconnected from their clones
  • Context is available to the AI, but hidden from the user
  • Conversations are not impacted by cloned or converted roleplays
  • Lorebooks travel with cloned and converted scenes
  • Swipes and Attachments now transfer to cloned and converted roleplays
  • Convert and Clone disable during streaming to prevent errors
  • Cloning or Converting from the very first message of a scene functions as expected

Docs and release impact

  • No docs changes needed

UI evidence

Clone Button
shot1

Clone Result
shot2

Convert Button
shot3

Confirmation Prompt
shot4

Summary by CodeRabbit

  • New Features

    • "Clone from here" to create a new scene starting at a selected message (supports cloning up to a point and including scene context).
    • "Convert" to turn an active scene into a standalone roleplay chat.
    • Messages marked hidden are omitted from the visible chat transcript.
  • UX Improvements

    • Action buttons show contextually in scene UIs, disable during fork operations, and surface success/error feedback.

🔄 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/230 **Author:** [@OnlyJimmy](https://github.com/OnlyJimmy) **Created:** 4/25/2026 **Status:** ✅ Merged **Merged:** 4/27/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `scene-fork-roleplay` --- ### 📝 Commits (8) - [`9e58c66`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9e58c66bc45367e86636dea7602a8b7df0244d29) Add scene fork roleplay actions - [`05f36ae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/05f36ae48ac566bf825050da4b9fc3ffbb929748) Address scene fork review feedback - [`3a49fa6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3a49fa610a000804dbf54c6f7652054a727f47b8) Clarify scene fork swipe metadata copy - [`b683d03`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b683d0333f3b910d0d2f422e3d47193c3252935d) Hide scene fork context and tighten fork validation - [`2eb93bc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2eb93bc896003269e6ee5658eee3f82c719e2e34) Avoid message metadata fallback for copied swipe - [`3f52540`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3f525401c4502e49d4718745898451d2619c0e43) Document scene fork behavior - [`d7bdaaf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7bdaaff8cf1bc41ca13683ded19a5cb09072d34) Address scene fork review feedback - [`4e5d5ce`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e5d5ce9bfb7a1095b06881a3bd78f74113c68a7) Preserve scene fork message swipes ### 📊 Changes **9 files changed** (+491 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+13 -1) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+22 -0) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+23 -1) 📝 `packages/client/src/components/chat/SceneBanner.tsx` (+34 -2) 📝 `packages/client/src/hooks/use-scene.ts` (+60 -2) 📝 `packages/server/src/routes/scene.routes.ts` (+254 -0) 📝 `packages/server/src/services/storage/chats.storage.ts` (+52 -11) 📝 `packages/shared/src/types/chat.ts` (+2 -0) 📝 `packages/shared/src/types/scene.ts` (+31 -0) </details> ### 📄 Description ## Why this change Active scenes could be concluded or abandoned, but there was no way to preserve a scene as an independent roleplay thread. This adds a focused fork flow so users can keep narrative continuity without carrying over scene lifecycle behavior. ## What changed ## What changed - Added `POST /api/scene/fork` with `clone` and `convert` modes. - Added shared scene fork request/response types. - Added `Clone from here` to active scene message actions, copying scene continuity and messages up to the selected message into a standalone roleplay chat. - Added `Convert` beside the scene discard controls, with confirmation, to detach the active scene into a standalone roleplay. - Added hidden narrator continuity context so forked chats preserve useful pre-scene context without showing scene setup in the transcript. - Preserved copied message metadata, timestamps, active swipe state, and all message swipes during fork creation. - Preserved normal roleplay metadata such as characters, persona, group, preset, connection, lorebook metadata, settings, and background where applicable. - Ensured forked roleplay chats strip scene lifecycle metadata and do not write scene summaries or character memory during convert cleanup. - Added fork in-flight guards and disabled clone/convert actions while scene generation is streaming. - Added best-effort cleanup for partially-created fork chats if message copying or convert cleanup fails. - Updated forked chat names to distinguish cloned and converted chats. ## Validation - [x] `pnpm check` - [x] Manual verification completed (describe below) ### Manual verification notes - Manually tested functionality with Prof. Mari - Scenes remain disconnected from their clones - Context is available to the AI, but hidden from the user - Conversations are not impacted by cloned or converted roleplays - Lorebooks travel with cloned and converted scenes - Swipes and Attachments now transfer to cloned and converted roleplays - Convert and Clone disable during streaming to prevent errors - Cloning or Converting from the very first message of a scene functions as expected ## Docs and release impact - [x] No docs changes needed ## UI evidence Clone Button <img width="998" height="185" alt="shot1" src="https://github.com/user-attachments/assets/80c4f3f1-0325-41f2-a604-9b5d7e32a7a4" /> Clone Result <img width="1905" height="894" alt="shot2" src="https://github.com/user-attachments/assets/2e17f3c1-9922-4f8d-9abe-74e7b97fe72e" /> Convert Button <img width="561" height="151" alt="shot3" src="https://github.com/user-attachments/assets/248913e1-3db5-4ff7-bd16-383682932cb6" /> Confirmation Prompt <img width="1053" height="643" alt="shot4" src="https://github.com/user-attachments/assets/d9bcf26e-c4b4-4fb1-a07f-e3b822a8913e" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * "Clone from here" to create a new scene starting at a selected message (supports cloning up to a point and including scene context). * "Convert" to turn an active scene into a standalone roleplay chat. * Messages marked hidden are omitted from the visible chat transcript. * **UX Improvements** * Action buttons show contextually in scene UIs, disable during fork operations, and surface success/error feedback. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:20 +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#4517
No description provided.