[PR #7317] [MERGED] feat(chat): add CYOA choices to the message box without sending #7680

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7317
Author: @stonebystone
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/cyoa-add-to-message


📝 Commits (9)

📊 Changes

10 files changed (+170 additions, -26 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/built-in-agents.md (+1 -1)
📝 docs/roleplay/getting-started.md (+1 -1)
📝 e2e/core-flows.e2e.ts (+52 -0)
📝 packages/client/src/components/chat/CyoaChoices.tsx (+61 -23)
📝 packages/client/src/components/chat/cyoa-choice-submission.ts (+14 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+17 -0)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/client/src/stores/ui.store.ts (+7 -0)
📝 scripts/regressions/spatial-context.regression.ts (+15 -1)

📄 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.

Linked issue

Closes #7315

Why this change

  • Users often combine parts of several CYOA choices into their own reply, but clicking a choice sends it immediately and clears the list. The only workaround was copying each choice's text by hand.

What changed

Reworked per review: a setting instead of a per-choice button.

  • New Add CYOA choices to the message box instead of sending them toggle in Settings > General > Input & Editing, next to Keep guidance after regenerating (persisted UI setting addCyoaChoicesToMessage, off by default, synced like impersonateCyoaChoices). When on, clicking a choice appends its text to the message box with a blank line, focuses it with the cursor at the end, and keeps the choices on screen. Nothing is sent and no generation starts. When off, clicking a choice works exactly as before, including impersonate mode.
  • resolveCyoaChoiceAction picks the path (add / impersonate / send); adding takes priority over Use CYOA as direction. The CYOA header's send/impersonate pill is hidden while the setting is on, since it would have no effect.
  • The draft update reuses the pattern ChatArea already uses for guided-regeneration drafts: write to the active chat's textarea[data-chat-composer], dispatch an input event so the uncontrolled composer runs its own sizing and draft saving, then setInputDraft. If the composer isn't mounted, only the stored draft is updated.
  • cyoa-choice-submission.ts: appendCyoaChoiceToDraft and resolveCyoaChoiceAction, both covered in scripts/regressions/spatial-context.regression.ts next to the existing CYOA payload checks.
  • One English localization key for the toggle label. Other locales fall back to English.
  • CHANGELOG.md [Unreleased] entry.
  • Docs: docs/roleplay/getting-started.md and docs/agents/built-in-agents.md point to the setting. Translations are tracked in the [docs-i18n] follow-up #7316.

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

Agent-run checks on commit 21ab7d920 (branched from origin/staging at 85b85d676):

  • pnpm check: passed (clean:stale-client, impeccable:check, localization:check, format:check, lint, check:e2e-types, check:token-estimation-types, build).
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/spatial-context.regression.ts: 1/1 passed.
  • Local CodeRabbit: not run. The CodeRabbit CLI is not installed on this Windows machine, so this PR relies on the GitHub CodeRabbit review.

Manual verification notes

To verify in a browser:

  • Manually verify that with the setting off, clicking a choice sends it (and impersonates when Use CYOA as direction is on) exactly as before.
  • Manually verify that with it on, clicking a choice puts its text in the message box, does not send, and leaves the choices visible.
  • Manually verify that clicking two choices puts both in the message box, separated by a blank line, with the cursor at the end.
  • Manually verify that with both settings on, clicking a choice adds it to the message box rather than impersonating.
  • Manually verify the send/impersonate pill above the choices is hidden while the setting is on and returns when it's off.
  • Manually verify the toggle appears in Settings > General > Input & Editing, can be found with the settings search ("cyoa"), and survives a page reload.
  • Manually verify the added text survives switching to another chat and back, on desktop and a mobile viewport.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

Optional follow-up in Pasta-Devs/Marinara-Agents: the CYOA package description says "Click one to send it as your reply"; it could mention the new button.

UI evidence (if applicable)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a setting under Settings → General → Input & Editing to add CYOA choices to the message box instead of sending them. Selected choices are added to the draft, separated by blank lines, and remain onscreen so you can combine or edit them before sending. This setting takes priority over Use CYOA as direction.
  • Documentation
    • Updated CYOA choices guidance to explain the setting and clarify that the CYOA Choices agent works only in Roleplay Mode.

🔄 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/7317 **Author:** [@stonebystone](https://github.com/stonebystone) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/cyoa-add-to-message` --- ### 📝 Commits (9) - [`bfd5347`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bfd5347bd34d3cce8c2c571a490625fd14b18657) feat(chat): add CYOA choices to the composer without sending - [`b406cdc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b406cdc006f7c01746abcf6be3edf1b6543584d6) docs(roleplay): mention CYOA Add to message - [`b38a457`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b38a457d7a87dafa3120a637eee45f99ac74a4db) feat(chat): make CYOA add-to-message a setting instead of a per-choice button - [`21ab7d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21ab7d920b2555e3fc3705a2f1e0310beb2fe1da) feat(chat): move CYOA add-to-message toggle to Settings > Input & Editing - [`dc18c12`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dc18c121dd361f4d57d5d93cf5c9181d5c1a4426) test(e2e): cover CYOA choices going to the message box - [`d3d5d70`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3d5d706773539bf7412cc1c58e38b6fb57b8b4d) Merge branch 'staging' of https://github.com/Pasta-Devs/Marinara-Engine into feat/cyoa-add-to-message - [`c639485`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c6394859cc642ec06b0fa19942a9c5070e231255) Merge branch 'staging' of https://github.com/Pasta-Devs/Marinara-Engine into feat/cyoa-add-to-message - [`c0f33a8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0f33a8781203ad17e14e5328161935797d2104b) Merge branch 'staging' of https://github.com/Pasta-Devs/Marinara-Engine into feat/cyoa-add-to-message - [`357712d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/357712d2b9976a7072a454c35a7aac8d41c45583) docs(changelog): spell out CYOA add-to-message priority over impersonation ### 📊 Changes **10 files changed** (+170 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/built-in-agents.md` (+1 -1) 📝 `docs/roleplay/getting-started.md` (+1 -1) 📝 `e2e/core-flows.e2e.ts` (+52 -0) 📝 `packages/client/src/components/chat/CyoaChoices.tsx` (+61 -23) 📝 `packages/client/src/components/chat/cyoa-choice-submission.ts` (+14 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+17 -0) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/client/src/stores/ui.store.ts` (+7 -0) 📝 `scripts/regressions/spatial-context.regression.ts` (+15 -1) </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. --> ## Linked issue Closes #7315 ## Why this change - Users often combine parts of several CYOA choices into their own reply, but clicking a choice sends it immediately and clears the list. The only workaround was copying each choice's text by hand. ## What changed Reworked per review: a setting instead of a per-choice button. - New **Add CYOA choices to the message box instead of sending them** toggle in **Settings > General > Input & Editing**, next to **Keep guidance after regenerating** (persisted UI setting `addCyoaChoicesToMessage`, off by default, synced like `impersonateCyoaChoices`). When on, clicking a choice appends its text to the message box with a blank line, focuses it with the cursor at the end, and keeps the choices on screen. Nothing is sent and no generation starts. When off, clicking a choice works exactly as before, including impersonate mode. - `resolveCyoaChoiceAction` picks the path (add / impersonate / send); adding takes priority over **Use CYOA as direction**. The CYOA header's send/impersonate pill is hidden while the setting is on, since it would have no effect. - The draft update reuses the pattern `ChatArea` already uses for guided-regeneration drafts: write to the active chat's `textarea[data-chat-composer]`, dispatch an `input` event so the uncontrolled composer runs its own sizing and draft saving, then `setInputDraft`. If the composer isn't mounted, only the stored draft is updated. - `cyoa-choice-submission.ts`: `appendCyoaChoiceToDraft` and `resolveCyoaChoiceAction`, both covered in `scripts/regressions/spatial-context.regression.ts` next to the existing CYOA payload checks. - One English localization key for the toggle label. Other locales fall back to English. - `CHANGELOG.md` `[Unreleased]` entry. - Docs: `docs/roleplay/getting-started.md` and `docs/agents/built-in-agents.md` point to the setting. Translations are tracked in the `[docs-i18n]` follow-up #7316. ## 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) - [x] Read and followed `CONTRIBUTING.md` Agent-run checks on commit `21ab7d920` (branched from `origin/staging` at `85b85d676`): - `pnpm check`: passed (clean:stale-client, impeccable:check, localization:check, format:check, lint, check:e2e-types, check:token-estimation-types, build). - `node ./scripts/run-regressions.mjs --filter scripts/regressions/spatial-context.regression.ts`: 1/1 passed. - Local CodeRabbit: not run. The CodeRabbit CLI is not installed on this Windows machine, so this PR relies on the GitHub CodeRabbit review. ### Manual verification notes To verify in a browser: - Manually verify that with the setting off, clicking a choice sends it (and impersonates when **Use CYOA as direction** is on) exactly as before. - Manually verify that with it on, clicking a choice puts its text in the message box, does not send, and leaves the choices visible. - Manually verify that clicking two choices puts both in the message box, separated by a blank line, with the cursor at the end. - Manually verify that with both settings on, clicking a choice adds it to the message box rather than impersonating. - Manually verify the send/impersonate pill above the choices is hidden while the setting is on and returns when it's off. - Manually verify the toggle appears in Settings > General > Input & Editing, can be found with the settings search ("cyoa"), and survives a page reload. - Manually verify the added text survives switching to another chat and back, on desktop and a mobile viewport. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) Optional follow-up in Pasta-Devs/Marinara-Agents: the CYOA package description says "Click one to send it as your reply"; it could mention the new button. ## UI evidence (if applicable) <!-- Screenshot of the choice row with the new button, attached on GitHub --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a setting under **Settings → General → Input & Editing** to add CYOA choices to the message box instead of sending them. Selected choices are added to the draft, separated by blank lines, and remain onscreen so you can combine or edit them before sending. This setting takes priority over **Use CYOA as direction**. * **Documentation** * Updated CYOA choices guidance to explain the setting and clarify that the CYOA Choices agent works only in Roleplay Mode. <!-- 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-24 04:06:28 +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#7680
No description provided.