mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #8408] [Feature]: Capability packages: let a package register a service only the Engine can read #8344
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#8344
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 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8408
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
Packages share services through one registry:
api.registerService(key, service)stores it, and any package reads it withruntime.services.get(key). Two kinds of key are already host-only:agent-runtime:andmari-actions:(HOST_ONLY_SERVICE_PREFIXES,capability-module-runtime.service.ts~106). Every other key is open to every package.Some services are meant only for the Engine. Long-Term Memory registers
long-term-memory:runtimefor the Engine's generation recall (services/generation/long-term-memory-runtime.ts~12) and for profile restore (routes/backup.routes.ts~1383). Because the lookup is open, any installed package can also take it and:recallfor any chat id, bypassing the user's "Other Agents can read memories" switch, which only guards the separatelong-term-memory:recallservice;recordPromptAcceptedand change what Long-Term Memory believes was sent;withVaultMutation.Proposed solution
A host-only flag on registration:
api.registerService(key, service, { hostOnly: true }). The Engine's owngetCapabilityService(key)still returns the service, whileruntime.services.get(key)returnsnullfor every package, including the owner. This is the same rule the two prefixes follow today. Older Engines ignore the third argument, so a package can pass it without a version check, and the Engine's existing reads keep the same key.Minimal fix
packages/server/src/services/capability-packages/capability-service-registry.service.ts:registerCapabilityService(key, service, options?: { hostOnly?: boolean })records host-only keys in aSetbeside the map. The cleanup removes the key from both, under the same identity check as today.getCapabilityServiceis unchanged; addisHostOnlyCapabilityService(key).resetCapabilityServicesalso clears the set.packages/server/src/services/capability-packages/capability-module-runtime.service.ts:api.registerServicetype (~87) gains the optional third argument;registerService(~399) passes the options through;services.get(~165): returnnullwhen the key has a host-only prefix orisHostOnlyCapabilityService(key)is true.packages/shared/src/types/capability-runtime.ts: theCapabilityServiceLookupHost.getdoc comment (~29) adds "or for a service registered withhostOnly".packages/shared/src/schemas/capability-package.schema.ts(~1487): a changelog line for the next Capability API minor and thesupportedCapabilityApibump (~1489).long-term-memory:runtime,hierarchical-maps:*orconversation-calls:*; they usegetCapabilityService.Regression, in
scripts/regressions/capability-runtime-host-services.regression.tsnext to the existing host-only loop (~146):host-services-full:hiddenwith{ hostOnly: true }:getCapabilityServicereturns it;reader.services.getandfull.services.getboth returnnull.Alternatives considered
long-term-memory:keys toHOST_ONLY_SERVICE_PREFIXES. It names one package in the Engine, and it would also hidelong-term-memory:recall, which other packages are meant to read.<id>:host:*. It would renamelong-term-memory:runtime, so the Engine would have to read both names until every install updates. The flag keeps the key.Additional context
{ hostOnly: true }when it registerslong-term-memory:runtime(server-entry.ts~44). It needs noengine.minbump, because older Engines ignore the argument.hierarchical-maps:*andconversation-calls:*services are also read only by the Engine. Their owners can adopt the flag separately; this issue doesn't change them.registerServicechecks key ownership only for the two host-only prefixes, so a package can register a key in another package's namespace. If it activates first, the Engine passes generation recall input (the chat messages) to that package, and the real owner's registration fails with "already registered". A rule that keys start with the package id would close it. It is not part of this issue because Engine fixtures register bare or mismatched keys (externals-probe,${id},readiness:successfrom packagereadiness-success), and packages outside the catalog may too.runtime.services.getreturns to packages.Template check