[PR #1653] [MERGED] [codex] Wire roleplay direct-message commands #5185

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1653
Author: @Xelvanis
Created: 5/30/2026
Status: ✅ Merged
Merged: 5/30/2026
Merged by: @Xelvanis

Base: refactor ← Head: codex/roleplay-dm-commands


📝 Commits (3)

  • 7e49211 Wire roleplay direct-message commands
  • 1156a35 Suppress blank roleplay DM source messages
  • d2b0e87 Handle blank failed DM command output

📊 Changes

7 files changed (+452 additions, -21 deletions)

View changed files

📝 src/engine/generation/connected-commands.test.ts (+265 -3)
📝 src/engine/generation/connected-commands.ts (+87 -14)
📝 src/engine/generation/prompt-assembly.test.ts (+41 -0)
📝 src/engine/generation/prompt-assembly.ts (+23 -1)
📝 src/engine/modes/chat/commands/character-commands.test.ts (+27 -1)
📝 src/engine/modes/chat/commands/character-commands.ts (+5 -1)
📝 src/features/runtime/generation/hooks/use-generate.ts (+4 -1)

📄 Description

Linked issue

No linked issue.

Why this change

  • Knip triage found the roleplay [dm: character="Name" message="text"] parser, chat metadata toggle, and settings UI already existed, but the parser was not wired into generation.
  • The feature had an exposed settings surface without runtime behavior, and the existing dm executor could only post into an already-existing conversation.

What changed

  • Gate direct-message command parsing to roleplay chats with metadata.roleplayDmCommandsEnabled === true.
  • Strip successful hidden [dm:] tags from roleplay output and post the message into the matching Conversation DM.
  • Create a Conversation DM for the target character when none exists yet.
  • Emit command_error events when parsed DM commands cannot find a character or resolve a target conversation, instead of silently losing the hidden command.
  • Suppress the source roleplay assistant save when a successful DM command leaves no visible source text.
  • Add a roleplay-only prompt reminder for the hidden DM command when the setting is enabled.
  • Refresh the target chat cache and include the target name in the OOC-posted toast.

Refactor impact

Primary owner:

  • Engine generation and roleplay command post-processing.

Impact areas reviewed:

  • Roleplay generation prompt assembly.
  • Connected command parsing/execution.
  • Conversation DM chat creation and message writes.
  • Runtime generation event handling and chat cache invalidation.
  • Sibling mode gating for conversation/game so [dm:] does not become a general command.

Boundary notes:

  • Product behavior stays in src/engine.
  • React runtime handling stays in src/features/runtime.
  • No shared API, Tauri, Rust, or remote-runtime boundary changes.

Pressure points touched:

  • persistConnectedCommandTags in engine generation.
  • assembleGenerationPrompt prompt insertion.
  • Runtime generation event handling for ooc_posted.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Agent-run: pnpm vitest run src/engine/generation/connected-commands.test.ts src/engine/modes/chat/commands/character-commands.test.ts src/engine/generation/prompt-assembly.test.ts passed with 71 tests.
  • Agent-run: pnpm typecheck passed.
  • Agent-run: pnpm check:architecture passed.
  • Agent-run: pnpm build passed with the existing Vite large chunk warning.
  • Agent-run: git diff --check origin/refactor...HEAD passed.
  • Not run: native Tauri/manual model QA. Model obedience to the hidden [dm:] reminder still needs in-app spot-checking.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs or release files changed. No active changelog/changeset file was found for this slice.

UI evidence

No screenshots or recordings. This change uses the existing settings UI and changes generation/runtime behavior.

Summary by CodeRabbit

  • New Features
    • Added direct message command support for roleplay mode, allowing characters to send private messages when enabled. Automatically creates new conversation chats as needed and provides enhanced notifications showing destination chat details for posted messages.

Review Change Stack


🔄 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/1653 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/30/2026 **Status:** ✅ Merged **Merged:** 5/30/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `codex/roleplay-dm-commands` --- ### 📝 Commits (3) - [`7e49211`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7e4921197a121562e2e4c5810ad9dcd0ef8b5c9a) Wire roleplay direct-message commands - [`1156a35`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1156a35c21a34b36e0ddec3698fee9ac355c9c8f) Suppress blank roleplay DM source messages - [`d2b0e87`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d2b0e87337829c76c45d1f212eca686c53ca7ad9) Handle blank failed DM command output ### 📊 Changes **7 files changed** (+452 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/connected-commands.test.ts` (+265 -3) 📝 `src/engine/generation/connected-commands.ts` (+87 -14) 📝 `src/engine/generation/prompt-assembly.test.ts` (+41 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+23 -1) 📝 `src/engine/modes/chat/commands/character-commands.test.ts` (+27 -1) 📝 `src/engine/modes/chat/commands/character-commands.ts` (+5 -1) 📝 `src/features/runtime/generation/hooks/use-generate.ts` (+4 -1) </details> ### 📄 Description ## Linked issue No linked issue. ## Why this change - Knip triage found the roleplay `[dm: character="Name" message="text"]` parser, chat metadata toggle, and settings UI already existed, but the parser was not wired into generation. - The feature had an exposed settings surface without runtime behavior, and the existing `dm` executor could only post into an already-existing conversation. ## What changed - Gate direct-message command parsing to roleplay chats with `metadata.roleplayDmCommandsEnabled === true`. - Strip successful hidden `[dm:]` tags from roleplay output and post the message into the matching Conversation DM. - Create a Conversation DM for the target character when none exists yet. - Emit `command_error` events when parsed DM commands cannot find a character or resolve a target conversation, instead of silently losing the hidden command. - Suppress the source roleplay assistant save when a successful DM command leaves no visible source text. - Add a roleplay-only prompt reminder for the hidden DM command when the setting is enabled. - Refresh the target chat cache and include the target name in the OOC-posted toast. ## Refactor impact Primary owner: - Engine generation and roleplay command post-processing. Impact areas reviewed: - Roleplay generation prompt assembly. - Connected command parsing/execution. - Conversation DM chat creation and message writes. - Runtime generation event handling and chat cache invalidation. - Sibling mode gating for conversation/game so `[dm:]` does not become a general command. Boundary notes: - Product behavior stays in `src/engine`. - React runtime handling stays in `src/features/runtime`. - No shared API, Tauri, Rust, or remote-runtime boundary changes. Pressure points touched: - `persistConnectedCommandTags` in engine generation. - `assembleGenerationPrompt` prompt insertion. - Runtime generation event handling for `ooc_posted`. ## Validation <!-- Checkboxes intentionally left for human verification per the repo template. Agent-run checks are listed below. --> - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Agent-run: `pnpm vitest run src/engine/generation/connected-commands.test.ts src/engine/modes/chat/commands/character-commands.test.ts src/engine/generation/prompt-assembly.test.ts` passed with 71 tests. - Agent-run: `pnpm typecheck` passed. - Agent-run: `pnpm check:architecture` passed. - Agent-run: `pnpm build` passed with the existing Vite large chunk warning. - Agent-run: `git diff --check origin/refactor...HEAD` passed. - Not run: native Tauri/manual model QA. Model obedience to the hidden `[dm:]` reminder still needs in-app spot-checking. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims No docs or release files changed. No active changelog/changeset file was found for this slice. ## UI evidence No screenshots or recordings. This change uses the existing settings UI and changes generation/runtime behavior. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added direct message command support for roleplay mode, allowing characters to send private messages when enabled. Automatically creates new conversation chats as needed and provides enhanced notifications showing destination chat details for posted messages. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1653?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:14:01 +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#5185
No description provided.