mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6290] [MERGED] feat: let capability packages contribute tools the model can call #7127
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#7127
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6290
Author: @BiBoBaBe
Created: 9/17/2026
Status: ✅ Merged
Merged: 9/17/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/capability-tools📝 Commits (10+)
ad64851feat: let capability packages contribute tools the model can call6a34791fix: resolve review findings on package-contributed tools1363f9afix: enforce the capability API floor for the tools permissionad97d80fix: bound package tools in time, size and lifetime16c9652fix: bound package tool contracts and preserve activation ownership609f40bfix: reserve custom tool names when chat tools are disabledbd0c51efix: keep enabled custom tool ownership while schemas are repaired64de526test: handle an empty resolved tool set in collision prooff6441ebfix(tools): keep turns without tools free of custom-tool readsa03b64adocs(capabilities): clarify cooperative deadline limits📊 Changes
11 files changed (+931 additions, -46 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/optional-agent-packages.md(+82 -0)📝
packages/server/src/services/capability-packages/capability-module-runtime.service.ts(+43 -5)➕
packages/server/src/services/capability-packages/capability-tool-registry.service.ts(+214 -0)📝
packages/server/src/services/generation/tool-resolution-runtime.ts(+63 -4)➕
packages/server/src/services/tools/tool-arguments-validator.ts(+38 -0)📝
packages/server/src/services/tools/tool-executor.ts(+27 -31)📝
packages/shared/src/schemas/capability-package.schema.ts(+20 -1)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+5 -5)➕
scripts/regressions/capability-tool-runtime.regression.ts(+366 -0)📝
scripts/regressions/game-mode-dice-tool.regression.ts(+71 -0)📄 Description
Linked issue
Closes #6292. Original contribution by @BiBoBaBe; maintainer follow-up by @SpicyMarinara with Codex.
Why this change
Packages that manage a world, clock or inventory need structured model actions. They can now register tools with JSON Schema arguments, receive validated calls and return results while narration continues to stream.
What changed
api.registerToolbehind the explicittoolspermission, manifest schema v2 and Capability API 1.19. Reuse the existing argument validator and tool executor.Maintainer decisions: registration is global while the package is active, consistent with prompt-context contributions. Handlers receive
chatIdand must check their own state. The verified server entrypoint already pins the registration code; this change adds no second declarative manifest. Descriptions and results are trusted package content; results are limited to 64 KiB. A timed-out handler continues running, although the turn stops waiting.Validation
Combined staging candidate
44b7363f4: all 290/290 Node regressions passed, with final server type/lint checks passing. The package-tool regression found by the full suite is fixed with the existing early return when no tools need loading. The schedule browser flow passes on desktop Chromium, mobile Chromium and mobile WebKit.Executed:
pnpm check, subsequent server type/lint checks, package lifecycle, tool execution and Game tool resolution regressions. New cases cover schema mutation, provider capability, custom/package collisions with tools enabled and disabled, invalid custom schemas, lifecycle cleanup and result limits. The schema mutation and unsupported-provider cases reproduced failures before the fixes.Local CodeRabbit completed the combined feature review. The remaining GitHub suggestion requests synchronous package isolation; the documented trusted in-process contract is retained. Its asynchronous deadlines cannot interrupt an event-loop-blocking callback. The code comment and API documentation now state that ceiling explicitly, including all ten translated packs. A worker/process RPC redesign is outside this tool-registration feature and the maintainer’s minimal-change request.
Contributor checklist retained from the original submission
These are the contributor's existing checkbox states, retained unchanged. They are not new maintainer attestations. Current maintainer verification is described above; the unchecked maintainer checklist remains below.
pnpm checkpasses locallyCONTRIBUTING.mdMaintainer checklist
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Manually verify a real package with a native-tool provider: narration, valid and invalid arguments, deactivation and a chat without installed package tools. Runtime tests use synthetic handlers; they do not exercise a live model provider.
Docs and release impact
Canonical API documentation and CHANGELOG are updated. All ten translated packs are in #6297, resolving #6296. No product version bump.
UI evidence (if applicable)
No client UI changes.
Final local review
CodeRabbit reviewed all 36 files of the combined staging candidate. This PR had no substantive findings. Its suggestion to replace narrow source guards for private activation wiring is deferred: runtime registration, execution, collisions and lifecycle behavior already have runnable coverage, and changing the fixture architecture would broaden this feature. Final
pnpm checkand all 290 Node regressions passed on the combined candidate.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.