mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #8491] [Feature]: Capability packages: let a package hide or show chat messages from the AI #8379
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8379
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8491
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
The Engine's chat summary can hide the messages it summarised from the AI ("Hide summarised messages"), so the prompt carries the summary instead of the full history. A package that keeps its own memory of a chat can't do the same. The package persistence host can read chats and messages (
listChats,getChat,listMessages), and withchat-writeit can append messages and patch chat metadata. But it has no way to change a message'shiddenFromAIflag.The first user is Long-Term Memory. When it imports a chat's messages into memory, it would like to optionally hide those messages from the AI, as the summary does (Agents issue to follow, linked below).
Proposed solution
Add one optional host method for packages:
It is optional on
CapabilityPersistenceHost, likeappendMessages(1.341), so packages feature-detect it and keep working on older Engines. (listChatSummariessits on the transaction-scopedCapabilityPersistenceSession; this method writes through host chat storage likeappendMessages, so it belongs on the host.)Minimal fix
packages/shared/src/types/capability-runtime.ts: add the method toCapabilityPersistenceHost(~440), afterappendMessages(~456), with the doc comment above.packages/shared/src/schemas/capability-package.schema.ts(~1487–1489): add the// 1.388:line and setsupportedCapabilityApitominor: 388.scripts/regressions/capability-package-lifecycle.regression.ts: the five hard-coded387s (~107, ~143, ~147, ~209, ~226) move to 388: thesupportedCapabilityApiassert, the two "this Engine supports 1.387" messages, a new[388, "hide messages from the AI"]row insupportedMinors, and the unsupported-minor probe becomes 1.389.docs/development/optional-agent-packages.md(~1790): a "### Capability API 1.388: hide or show messages from the AI" section above the 1.387 one, in its shape (permission, what is skipped, what is returned, feature-detect).packages/server/src/services/capability-packages/capability-persistence.service.ts,createCapabilityPersistenceHost(~732):assertPermission("chat-write");appendMessages;hostChats().listMessages(chatId)(~2309) and drop the ids whoseextra.visibilityManual === true(bulkSetHiddenFromAIdoes not skip them itself);hostChats().bulkSetHiddenFromAI(chatId, ids, hidden)(chats.storage.ts~3048) with noextraargument, so the package never setsvisibilityManual. That call already runs one transaction behind the message patch queues, updates every swipe, ignores ids from other chats (its where clause is scoped by chat), and returns only the ids it flipped.visibilityManualfilter is the only logic the host adds. No lock: the helper takes the same queues the Engine's own routes do.hiddenFromAImessages.Regression in
scripts/regressions/capability-runtime-host-services.regression.ts, next to theappendMessageschecks (~252–310), with itsfull(chat-write) andreader(chat-read only) fixtures:chat-writethe call rejects, and with onlychat-readit still rejects.[].hiddenFromAI: true.visibilityManual: trueis unchanged and not returned.Alternatives considered
messageIds, so the summary's own hiding runs. That puts the package's text into the chat's summary prompt and its summary list, which a memory package doesn't want, and the hiding path is in the summary route, not the host.patchMessageExtra. It is broader than needed: a package could then change any message field. Hiding is the one thing a memory package needs.Additional context
hiddenMessageIdson each entry) and later shows only those again (summaryHidingPatch,generate-route-utils.ts~867). Returning the flipped ids lets a package keep the same kind of ownership.chat-write, which packages already have to declare in their manifest.visibilityManualfollows Advanced Memory (visibilitySettled,advanced-memory.ts~968, #7192), the Engine's other automatic hider. The summary's owncomputeSummaryHideIdsdoes not skip it; a package is an automatic writer, so it follows the stricter rule. No other code lists host methods: adding it to the objectcreateCapabilityPersistenceHostreturns is what exposes it.Template check