[PR #8413] [MERGED] feat(capability): let a package register a service only the Engine can read #8585

Closed
opened 2026-11-07 16:45:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8413
Author: @Promansis
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @Promansis

Base: staging ← Head: feature(capability)/host-only-service


📝 Commits (1)

  • 943d43a feat(capability): let a package register a service only the Engine can read (#8408)

📊 Changes

7 files changed (+68 additions, -17 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+16 -1)
📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+14 -7)
📝 packages/server/src/services/capability-packages/capability-service-registry.service.ts (+12 -2)
📝 packages/shared/src/schemas/capability-package.schema.ts (+3 -1)
📝 packages/shared/src/types/capability-runtime.ts (+2 -1)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+6 -5)
📝 scripts/regressions/capability-runtime-host-services.regression.ts (+15 -0)

📄 Description

Linked issue

Closes #8408

Why this change

Packages share services through one registry, and any package can read any key with runtime.services.get. Only the agent-runtime: and mari-actions: prefixes were host-only. Long-Term Memory registers long-term-memory:runtime for the Engine's generation recall and profile restore, so any installed package could also take it. It could run recall for any chat (skipping the "Other Agents can read memories" switch), call recordPromptAccepted, or hold the vault lock.

What changed

  • api.registerService(key, service, { hostOnly: true }): the Engine's getCapabilityService(key) still returns the service, while runtime.services.get(key) returns null for every package, including the owner. This is the rule the two prefixes already follow.
  • The registry records host-only keys in a Set beside the map. Releasing the service clears the flag under the existing identity check, and resetCapabilityServices clears the set. A duplicate registration throws before the flag is set.
  • Capability API 1.388: schema changelog line and supportedCapabilityApi, the lifecycle regression's supported-minor assertions (the unsupported-minor probe moves to 1.389), and a 1.388 section in docs/development/optional-agent-packages.md.
  • Older Engines ignore the third argument, so a package can pass it without a version check. The service stays readable there, which the docs say.
  • Regression: capability-runtime-host-services registers a hidden service. The Engine reads it, while the reader and the owner both get null. After the hidden service is released, the same key registered without the flag is visible.
  • Not changed: the Engine's readers of long-term-memory:runtime, hierarchical-maps:* and conversation-calls:*, and the key-namespace gap the issue lists as out of scope. Long-Term Memory adopting the flag is a follow-up in Marinara-Agents.

Security note: this narrows what packages can read and adds no permission.

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 locally on the pushed HEAD: build:shared; regressions capability-runtime-host-services, capability-package-lifecycle, capability-agent-runtime, mari-package-service, world-one-place, spatial-context; format:check; lint; tsc --noEmit in packages/server; git diff --check. The new regression fails without the server changes. A full pnpm check was not run locally.

Manual verification notes

  • Needs manual verification: with a package that registers a service with hostOnly: true installed, another package's runtime.services.get for that key returns null, and the Engine feature that reads it still works.

Docs and release impact

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

UI evidence (if applicable)

None; no UI change.

🤖 Generated with Claude Code


🔄 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/8413 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `feature(capability)/host-only-service` --- ### 📝 Commits (1) - [`943d43a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/943d43ab93e680fd3e1390645788a505f9ae3048) feat(capability): let a package register a service only the Engine can read (#8408) ### 📊 Changes **7 files changed** (+68 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+16 -1) 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+14 -7) 📝 `packages/server/src/services/capability-packages/capability-service-registry.service.ts` (+12 -2) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+3 -1) 📝 `packages/shared/src/types/capability-runtime.ts` (+2 -1) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+6 -5) 📝 `scripts/regressions/capability-runtime-host-services.regression.ts` (+15 -0) </details> ### 📄 Description ## Linked issue Closes #8408 ## Why this change Packages share services through one registry, and any package can read any key with `runtime.services.get`. Only the `agent-runtime:` and `mari-actions:` prefixes were host-only. Long-Term Memory registers `long-term-memory:runtime` for the Engine's generation recall and profile restore, so any installed package could also take it. It could run `recall` for any chat (skipping the "Other Agents can read memories" switch), call `recordPromptAccepted`, or hold the vault lock. ## What changed - `api.registerService(key, service, { hostOnly: true })`: the Engine's `getCapabilityService(key)` still returns the service, while `runtime.services.get(key)` returns `null` for every package, including the owner. This is the rule the two prefixes already follow. - The registry records host-only keys in a `Set` beside the map. Releasing the service clears the flag under the existing identity check, and `resetCapabilityServices` clears the set. A duplicate registration throws before the flag is set. - Capability API 1.388: schema changelog line and `supportedCapabilityApi`, the lifecycle regression's supported-minor assertions (the unsupported-minor probe moves to 1.389), and a 1.388 section in `docs/development/optional-agent-packages.md`. - Older Engines ignore the third argument, so a package can pass it without a version check. The service stays readable there, which the docs say. - Regression: `capability-runtime-host-services` registers a hidden service. The Engine reads it, while the reader and the owner both get `null`. After the hidden service is released, the same key registered without the flag is visible. - Not changed: the Engine's readers of `long-term-memory:runtime`, `hierarchical-maps:*` and `conversation-calls:*`, and the key-namespace gap the issue lists as out of scope. Long-Term Memory adopting the flag is a follow-up in Marinara-Agents. Security note: this narrows what packages can read and adds no permission. ## 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 locally on the pushed HEAD: `build:shared`; regressions `capability-runtime-host-services`, `capability-package-lifecycle`, `capability-agent-runtime`, `mari-package-service`, `world-one-place`, `spatial-context`; `format:check`; `lint`; `tsc --noEmit` in `packages/server`; `git diff --check`. The new regression fails without the server changes. A full `pnpm check` was not run locally. ### Manual verification notes - Needs manual verification: with a package that registers a service with `hostOnly: true` installed, another package's `runtime.services.get` for that key returns `null`, and the Engine feature that reads it still works. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) ## UI evidence (if applicable) None; no UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:45:47 +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#8585
No description provided.