[PR #7488] [MERGED] feat(capability): give packages the agent view of a message, with whispers #7758

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

📋 Pull Request Information

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

Base: staging ← Head: feat/7443-capability-agent-content


📝 Commits (4)

  • 8c4be39 feat(capability): give packages the agent view of a message, with whispers
  • fed59c8 Merge staging into the agent-content branch; agentContent is capability API 1.71
  • 70f6a31 fix(capability): build agentContent as the generate route's agents read it
  • 55a24a6 fix(capability): keep listMessages working when whisper names cannot be read

📊 Changes

6 files changed (+204 additions, -8 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+24 -0)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+47 -2)
📝 packages/shared/src/schemas/capability-package.schema.ts (+4 -1)
📝 packages/shared/src/types/capability-runtime.ts (+7 -0)
📝 scripts/regressions/agents-see-whispers.regression.ts (+118 -1)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)

📄 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 #7443

Package side (not in this PR): Pasta-Devs/Marinara-Agents#1309.
Translation follow-up: #7487.

Why this change

Since #7437, every agent the Engine runs reads Roleplay whispers. Packages that read the chat themselves, today Relationship Tracker and Memory Nag, still only get a message's public content, because whispers live in extra. They need the same text Engine agents get, without parsing extra themselves.

What changed

Nothing that worked before stops working: the new field is optional, and content is unchanged.

  • Messages from persistence.listMessages(chatId) now carry agentContent in Roleplay chats: the message as Engine agents read it. Each live whisper sits at its saved place as [Private whisper to <name>: …], and a whisper-only message reads as its whispers. A document a character hands over, such as a letter, follows the reply, and leftover private tags such as [notes: …] in a user turn are left out. It is built with the same helpers (parseRoleplayUserCommands, conversationPromptHistoryContent, roleplayAgentText) and the same recipient names (chat characters plus the chat's persona) as the generate route's agents.
  • agentContent is left out outside Roleplay and in hosted multiplayer rooms, using the same gate as Engine agents (roleplayAgentsSeeWhispers).
  • Capability API is now 1.71 (staging already used 1.69 and 1.70 for #7470). It is a soft seam: packages read agentContent ?? content, so they don't need to declare 1.71.
  • New section in docs/development/optional-agent-packages.md: "Capability API 1.71: read messages as agents read them". It also says that extra is unchanged and still holds every whisper in every mode, so packages must not show text built from it to anyone a whisper was not for.

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

Commands run by the agent, with results (local CodeRabbit review coderabbit review --agent --committed --base-commit 30e46104b on head 70f6a3180: 0 findings across all 6 changed files):

  • pnpm check: passed (exit 0: impeccable, localization, format, lint, e2e and token-estimation types, full build) on head 70f6a3180
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/agents-see-whispers.regression.ts: passed. It now also proves agentContent for a message with a whisper, a whisper-only message, a reply with a persona whisper, a message with no whisper, a user turn with a leftover [notes: …] tag (left out), a reply with a whisper and a letter (letter follows), a Conversation chat (field absent), an active hosted room (field absent) and the same room once ended (field present). With the old roleplayAgentText(row.content, …) call it fails on the leftover note.
  • node ./scripts/run-regressions.mjs --filter capability: 19 of 19 passed on head 70f6a3180
  • node ./scripts/run-regressions.mjs --filter for chat-branch-lineage, experience-state-imported-anchors and spatial-location-reference (other listMessages readers): passed on head 70f6a3180.

Manual verification notes

Manual verification needed:

  • In a Roleplay chat with two characters, write [whisper: character="<name>" text="test secret"] in a message, then call api.runtime.persistence.listMessages(chatId) from a package (or a package's debug log). Check that the message's agentContent shows [Private whisper to <name>: test secret] at the whisper's place and that content does not.
  • Send a message that is only a whisper. Check that its content is empty and its agentContent is the whisper.
  • Have a character hand over a letter with [document: …]. Check that the reply's agentContent ends with Document: <title> and the letter's text, as the Engine's own post-generation agents read it.
  • Repeat in a Conversation chat and in a hosted multiplayer room. Check that agentContent is missing on every message.

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)

Notes:

  • Updated docs/development/optional-agent-packages.md. Translation follow-up: #7487.
  • docs/roleplay/getting-started.md still says Relationship Tracker and Memory Nag don't see whispers yet. That stays true until the package side (Pasta-Devs/Marinara-Agents#1309) ships, so it is not changed here.
  • No CHANGELOG.md entry, per the current release-notes policy. Release notes come from "What changed".

UI evidence (if applicable)

No UI changes.

Summary by CodeRabbit

  • New Features
    • Capability API 1.71 adds an optional agent-facing message view for Roleplay chats, with whispers and character-delivered documents rendered alongside message text. Player notes are excluded; public message content remains unchanged.
    • When the agent-facing view is unavailable, clients can fall back to the existing message content.
  • Documentation
    • Documented availability, permissions, compatibility, and privacy considerations for the new message view.
  • Tests
    • Added coverage for Roleplay messages, hosted rooms, and cases where supporting data cannot be loaded.

🔄 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/7488 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/7443-capability-agent-content` --- ### 📝 Commits (4) - [`8c4be39`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8c4be39230fafa532c3e32788f3a0d8ff091ca97) feat(capability): give packages the agent view of a message, with whispers - [`fed59c8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fed59c8b0666e9cd17ffa6888e6caac4fd15b118) Merge staging into the agent-content branch; agentContent is capability API 1.71 - [`70f6a31`](https://github.com/Pasta-Devs/Marinara-Engine/commit/70f6a3180b59d623eaf22aafd01c528c74340128) fix(capability): build agentContent as the generate route's agents read it - [`55a24a6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/55a24a658e66ebba1a90f9b66ad6a9c5f8ca0415) fix(capability): keep listMessages working when whisper names cannot be read ### 📊 Changes **6 files changed** (+204 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+24 -0) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+47 -2) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+4 -1) 📝 `packages/shared/src/types/capability-runtime.ts` (+7 -0) 📝 `scripts/regressions/agents-see-whispers.regression.ts` (+118 -1) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) </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 #7443 Package side (not in this PR): Pasta-Devs/Marinara-Agents#1309. Translation follow-up: #7487. ## Why this change Since #7437, every agent the Engine runs reads Roleplay whispers. Packages that read the chat themselves, today Relationship Tracker and Memory Nag, still only get a message's public `content`, because whispers live in `extra`. They need the same text Engine agents get, without parsing `extra` themselves. ## What changed Nothing that worked before stops working: the new field is optional, and `content` is unchanged. - Messages from `persistence.listMessages(chatId)` now carry `agentContent` in Roleplay chats: the message as Engine agents read it. Each live whisper sits at its saved place as `[Private whisper to <name>: …]`, and a whisper-only message reads as its whispers. A document a character hands over, such as a letter, follows the reply, and leftover private tags such as `[notes: …]` in a user turn are left out. It is built with the same helpers (`parseRoleplayUserCommands`, `conversationPromptHistoryContent`, `roleplayAgentText`) and the same recipient names (chat characters plus the chat's persona) as the generate route's agents. - `agentContent` is left out outside Roleplay and in hosted multiplayer rooms, using the same gate as Engine agents (`roleplayAgentsSeeWhispers`). - Capability API is now 1.71 (staging already used 1.69 and 1.70 for #7470). It is a soft seam: packages read `agentContent ?? content`, so they don't need to declare 1.71. - New section in `docs/development/optional-agent-packages.md`: "Capability API 1.71: read messages as agents read them". It also says that `extra` is unchanged and still holds every whisper in every mode, so packages must not show text built from it to anyone a whisper was not for. ## 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` Commands run by the agent, with results (local CodeRabbit review `coderabbit review --agent --committed --base-commit 30e46104b` on head 70f6a3180: 0 findings across all 6 changed files): - `pnpm check`: passed (exit 0: impeccable, localization, format, lint, e2e and token-estimation types, full build) on head 70f6a3180 - `node ./scripts/run-regressions.mjs --filter scripts/regressions/agents-see-whispers.regression.ts`: passed. It now also proves `agentContent` for a message with a whisper, a whisper-only message, a reply with a persona whisper, a message with no whisper, a user turn with a leftover `[notes: …]` tag (left out), a reply with a whisper and a letter (letter follows), a Conversation chat (field absent), an active hosted room (field absent) and the same room once ended (field present). With the old `roleplayAgentText(row.content, …)` call it fails on the leftover note. - `node ./scripts/run-regressions.mjs --filter capability`: 19 of 19 passed on head 70f6a3180 - `node ./scripts/run-regressions.mjs --filter` for `chat-branch-lineage`, `experience-state-imported-anchors` and `spatial-location-reference` (other `listMessages` readers): passed on head 70f6a3180. ### Manual verification notes Manual verification needed: - In a Roleplay chat with two characters, write `[whisper: character="<name>" text="test secret"]` in a message, then call `api.runtime.persistence.listMessages(chatId)` from a package (or a package's debug log). Check that the message's `agentContent` shows `[Private whisper to <name>: test secret]` at the whisper's place and that `content` does not. - Send a message that is only a whisper. Check that its `content` is empty and its `agentContent` is the whisper. - Have a character hand over a letter with `[document: …]`. Check that the reply's `agentContent` ends with `Document: <title>` and the letter's text, as the Engine's own post-generation agents read it. - Repeat in a Conversation chat and in a hosted multiplayer room. Check that `agentContent` is missing on every message. ## 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) Notes: - Updated `docs/development/optional-agent-packages.md`. Translation follow-up: #7487. - `docs/roleplay/getting-started.md` still says Relationship Tracker and Memory Nag don't see whispers yet. That stays true until the package side (Pasta-Devs/Marinara-Agents#1309) ships, so it is not changed here. - No `CHANGELOG.md` entry, per the current release-notes policy. Release notes come from "What changed". ## UI evidence (if applicable) No UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Capability API 1.71 adds an optional agent-facing message view for Roleplay chats, with whispers and character-delivered documents rendered alongside message text. Player notes are excluded; public message content remains unchanged. * When the agent-facing view is unavailable, clients can fall back to the existing message content. * **Documentation** * Documented availability, permissions, compatibility, and privacy considerations for the new message view. * **Tests** * Added coverage for Roleplay messages, hosted rooms, and cases where supporting data cannot be loaded. <!-- 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:07:13 +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#7758
No description provided.