@try-works/dsh-tool-mode 0.0.0-stage → 0.5.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +299 -2
- package/bin/dsh-tool-mode-credentials.mjs +20 -0
- package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
- package/bin/dsh-tool-mode.mjs +211 -0
- package/builtins.lock.json +26 -0
- package/catalog/desert-ant-models.json +693 -0
- package/catalog/playbooks.json +531 -0
- package/client/client.model-tools.js +1910 -0
- package/client/index.js +4039 -0
- package/cordis.patch.yml +39 -0
- package/lib/adapters/index.d.ts +61 -0
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/index.js +82 -0
- package/lib/adapters/types.d.ts +106 -0
- package/lib/adapters/types.d.ts.map +1 -0
- package/lib/adapters/types.js +85 -0
- package/lib/approval.d.ts +189 -0
- package/lib/approval.d.ts.map +1 -0
- package/lib/approval.js +510 -0
- package/lib/asset-acquisition.d.ts +149 -0
- package/lib/asset-acquisition.d.ts.map +1 -0
- package/lib/asset-acquisition.js +175 -0
- package/lib/authority.d.ts +185 -0
- package/lib/authority.d.ts.map +1 -0
- package/lib/authority.js +223 -0
- package/lib/bindings.d.ts +144 -0
- package/lib/bindings.d.ts.map +1 -0
- package/lib/bindings.js +314 -0
- package/lib/builtins.d.ts +27 -0
- package/lib/builtins.d.ts.map +1 -0
- package/lib/builtins.js +37 -0
- package/lib/capability.d.ts +58 -0
- package/lib/capability.d.ts.map +1 -0
- package/lib/capability.js +192 -0
- package/lib/capture-path.d.ts +97 -0
- package/lib/capture-path.d.ts.map +1 -0
- package/lib/capture-path.js +152 -0
- package/lib/catalog.d.ts +37 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +274 -0
- package/lib/contract-payload.d.ts +39 -0
- package/lib/contract-payload.d.ts.map +1 -0
- package/lib/contract-payload.js +56 -0
- package/lib/custom-tools/compile.d.ts +25 -0
- package/lib/custom-tools/compile.d.ts.map +1 -0
- package/lib/custom-tools/compile.js +61 -0
- package/lib/custom-tools/composite-executor.d.ts +42 -0
- package/lib/custom-tools/composite-executor.d.ts.map +1 -0
- package/lib/custom-tools/composite-executor.js +113 -0
- package/lib/custom-tools/dispatch.d.ts +28 -0
- package/lib/custom-tools/dispatch.d.ts.map +1 -0
- package/lib/custom-tools/dispatch.js +34 -0
- package/lib/custom-tools/http-executor.d.ts +48 -0
- package/lib/custom-tools/http-executor.d.ts.map +1 -0
- package/lib/custom-tools/http-executor.js +241 -0
- package/lib/custom-tools/index.d.ts +12 -0
- package/lib/custom-tools/index.d.ts.map +1 -0
- package/lib/custom-tools/index.js +12 -0
- package/lib/custom-tools/mcp-surface.d.ts +14 -0
- package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
- package/lib/custom-tools/mcp-surface.js +41 -0
- package/lib/custom-tools/prompt-executor.d.ts +39 -0
- package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
- package/lib/custom-tools/prompt-executor.js +59 -0
- package/lib/custom-tools/registry.d.ts +69 -0
- package/lib/custom-tools/registry.d.ts.map +1 -0
- package/lib/custom-tools/registry.js +130 -0
- package/lib/custom-tools/schema.d.ts +26 -0
- package/lib/custom-tools/schema.d.ts.map +1 -0
- package/lib/custom-tools/schema.js +375 -0
- package/lib/custom-tools/service.d.ts +90 -0
- package/lib/custom-tools/service.d.ts.map +1 -0
- package/lib/custom-tools/service.js +203 -0
- package/lib/custom-tools/store.d.ts +61 -0
- package/lib/custom-tools/store.d.ts.map +1 -0
- package/lib/custom-tools/store.js +240 -0
- package/lib/custom-tools/types.d.ts +131 -0
- package/lib/custom-tools/types.d.ts.map +1 -0
- package/lib/custom-tools/types.js +11 -0
- package/lib/decision-combine.d.ts +113 -0
- package/lib/decision-combine.d.ts.map +1 -0
- package/lib/decision-combine.js +156 -0
- package/lib/decision-evaluate.d.ts +185 -0
- package/lib/decision-evaluate.d.ts.map +1 -0
- package/lib/decision-evaluate.js +227 -0
- package/lib/deployment-coordinator.d.ts +213 -0
- package/lib/deployment-coordinator.d.ts.map +1 -0
- package/lib/deployment-coordinator.js +274 -0
- package/lib/diagnostics.d.ts +169 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +136 -0
- package/lib/discovery-contracts.d.ts +14 -0
- package/lib/discovery-contracts.d.ts.map +1 -0
- package/lib/discovery-contracts.js +90 -0
- package/lib/discovery-describe.d.ts +35 -0
- package/lib/discovery-describe.d.ts.map +1 -0
- package/lib/discovery-describe.js +99 -0
- package/lib/embedding-index.d.ts +55 -0
- package/lib/embedding-index.d.ts.map +1 -0
- package/lib/embedding-index.js +126 -0
- package/lib/extension-dependencies.d.ts +355 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +987 -0
- package/lib/extension-dispatch.d.ts +150 -0
- package/lib/extension-dispatch.d.ts.map +1 -0
- package/lib/extension-dispatch.js +178 -0
- package/lib/extension-page-state.d.ts +69 -0
- package/lib/extension-page-state.d.ts.map +1 -0
- package/lib/extension-page-state.js +82 -0
- package/lib/extension-registrar.d.ts +116 -0
- package/lib/extension-registrar.d.ts.map +1 -0
- package/lib/extension-registrar.js +144 -0
- package/lib/extensions-api.d.ts +346 -0
- package/lib/extensions-api.d.ts.map +1 -0
- package/lib/extensions-api.js +17 -0
- package/lib/extensions-remote.d.ts +57 -0
- package/lib/extensions-remote.d.ts.map +1 -0
- package/lib/extensions-remote.js +69 -0
- package/lib/extensions-service.d.ts +568 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +2507 -0
- package/lib/harness-budgets.d.ts +158 -0
- package/lib/harness-budgets.d.ts.map +1 -0
- package/lib/harness-budgets.js +152 -0
- package/lib/harness-llm.d.ts +138 -0
- package/lib/harness-llm.d.ts.map +1 -0
- package/lib/harness-llm.js +218 -0
- package/lib/harness-serving.d.ts +115 -0
- package/lib/harness-serving.d.ts.map +1 -0
- package/lib/harness-serving.js +176 -0
- package/lib/headless.d.ts +97 -0
- package/lib/headless.d.ts.map +1 -0
- package/lib/headless.js +407 -0
- package/lib/http-acquisition.d.ts +27 -0
- package/lib/http-acquisition.d.ts.map +1 -0
- package/lib/http-acquisition.js +140 -0
- package/lib/index.d.ts +546 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5197 -0
- package/lib/invocation-accounting.d.ts +169 -0
- package/lib/invocation-accounting.d.ts.map +1 -0
- package/lib/invocation-accounting.js +148 -0
- package/lib/jev.d.ts +218 -0
- package/lib/jev.d.ts.map +1 -0
- package/lib/jev.js +366 -0
- package/lib/legacy-migration.d.ts +95 -0
- package/lib/legacy-migration.d.ts.map +1 -0
- package/lib/legacy-migration.js +429 -0
- package/lib/license-basis.d.ts +29 -0
- package/lib/license-basis.d.ts.map +1 -0
- package/lib/license-basis.js +58 -0
- package/lib/managed-workers.d.ts +158 -0
- package/lib/managed-workers.d.ts.map +1 -0
- package/lib/managed-workers.js +269 -0
- package/lib/mcp/auth-selection.d.ts +35 -0
- package/lib/mcp/auth-selection.d.ts.map +1 -0
- package/lib/mcp/auth-selection.js +64 -0
- package/lib/mcp/client-grant.d.ts +89 -0
- package/lib/mcp/client-grant.d.ts.map +1 -0
- package/lib/mcp/client-grant.js +63 -0
- package/lib/mcp/credential-cli.d.ts +38 -0
- package/lib/mcp/credential-cli.d.ts.map +1 -0
- package/lib/mcp/credential-cli.js +148 -0
- package/lib/mcp/credential-store.d.ts +143 -0
- package/lib/mcp/credential-store.d.ts.map +1 -0
- package/lib/mcp/credential-store.js +461 -0
- package/lib/mcp/export-policy.d.ts +25 -0
- package/lib/mcp/export-policy.d.ts.map +1 -0
- package/lib/mcp/export-policy.js +31 -0
- package/lib/mcp/host-binding.d.ts +144 -0
- package/lib/mcp/host-binding.d.ts.map +1 -0
- package/lib/mcp/host-binding.js +280 -0
- package/lib/mcp/http.d.ts +180 -0
- package/lib/mcp/http.d.ts.map +1 -0
- package/lib/mcp/http.js +602 -0
- package/lib/mcp/oauth.d.ts +149 -0
- package/lib/mcp/oauth.d.ts.map +1 -0
- package/lib/mcp/oauth.js +396 -0
- package/lib/mcp/protocol.d.ts +329 -0
- package/lib/mcp/protocol.d.ts.map +1 -0
- package/lib/mcp/protocol.js +459 -0
- package/lib/mcp/rate-limit.d.ts +68 -0
- package/lib/mcp/rate-limit.d.ts.map +1 -0
- package/lib/mcp/rate-limit.js +114 -0
- package/lib/mcp/sdk-v2.d.ts +17 -0
- package/lib/mcp/sdk-v2.d.ts.map +1 -0
- package/lib/mcp/sdk-v2.js +204 -0
- package/lib/mcp/server.d.ts +149 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +302 -0
- package/lib/mcp/stdio.d.ts +80 -0
- package/lib/mcp/stdio.d.ts.map +1 -0
- package/lib/mcp/stdio.js +184 -0
- package/lib/mcp/subscriptions.d.ts +177 -0
- package/lib/mcp/subscriptions.d.ts.map +1 -0
- package/lib/mcp/subscriptions.js +288 -0
- package/lib/mcp-status.d.ts +96 -0
- package/lib/mcp-status.d.ts.map +1 -0
- package/lib/mcp-status.js +70 -0
- package/lib/mcp-usage.d.ts +110 -0
- package/lib/mcp-usage.d.ts.map +1 -0
- package/lib/mcp-usage.js +189 -0
- package/lib/model-qualification.d.ts +192 -0
- package/lib/model-qualification.d.ts.map +1 -0
- package/lib/model-qualification.js +178 -0
- package/lib/planning.d.ts +256 -0
- package/lib/planning.d.ts.map +1 -0
- package/lib/planning.js +471 -0
- package/lib/playbook.d.ts +42 -0
- package/lib/playbook.d.ts.map +1 -0
- package/lib/playbook.js +65 -0
- package/lib/prepared-assets.d.ts +269 -0
- package/lib/prepared-assets.d.ts.map +1 -0
- package/lib/prepared-assets.js +471 -0
- package/lib/provider-bridge.d.ts +107 -0
- package/lib/provider-bridge.d.ts.map +1 -0
- package/lib/provider-bridge.js +423 -0
- package/lib/ptc-authority.d.ts +154 -0
- package/lib/ptc-authority.d.ts.map +1 -0
- package/lib/ptc-authority.js +242 -0
- package/lib/ptc-confinement.d.ts +60 -0
- package/lib/ptc-confinement.d.ts.map +1 -0
- package/lib/ptc-confinement.js +212 -0
- package/lib/ptc-runtime.d.ts +166 -0
- package/lib/ptc-runtime.d.ts.map +1 -0
- package/lib/ptc-runtime.js +231 -0
- package/lib/publication.d.ts +161 -0
- package/lib/publication.d.ts.map +1 -0
- package/lib/publication.js +181 -0
- package/lib/receipt-store.d.ts +57 -0
- package/lib/receipt-store.d.ts.map +1 -0
- package/lib/receipt-store.js +143 -0
- package/lib/receipt.d.ts +231 -0
- package/lib/receipt.d.ts.map +1 -0
- package/lib/receipt.js +165 -0
- package/lib/registrar.d.ts +75 -0
- package/lib/registrar.d.ts.map +1 -0
- package/lib/registrar.js +152 -0
- package/lib/resource-governance.d.ts +204 -0
- package/lib/resource-governance.d.ts.map +1 -0
- package/lib/resource-governance.js +213 -0
- package/lib/server-lifecycle.d.ts +175 -0
- package/lib/server-lifecycle.d.ts.map +1 -0
- package/lib/server-lifecycle.js +269 -0
- package/lib/skills.d.ts +31 -0
- package/lib/skills.d.ts.map +1 -0
- package/lib/skills.js +170 -0
- package/lib/speech-bridge.d.ts +74 -0
- package/lib/speech-bridge.d.ts.map +1 -0
- package/lib/speech-bridge.js +115 -0
- package/lib/state.d.ts +100 -0
- package/lib/state.d.ts.map +1 -0
- package/lib/state.js +160 -0
- package/lib/title-proposal.d.ts +194 -0
- package/lib/title-proposal.d.ts.map +1 -0
- package/lib/title-proposal.js +244 -0
- package/lib/tool-inventory.d.ts +90 -0
- package/lib/tool-inventory.d.ts.map +1 -0
- package/lib/tool-inventory.js +102 -0
- package/lib/tool-mode-run.d.ts +310 -0
- package/lib/tool-mode-run.d.ts.map +1 -0
- package/lib/tool-mode-run.js +411 -0
- package/lib/tool-sources.d.ts +80 -0
- package/lib/tool-sources.d.ts.map +1 -0
- package/lib/tool-sources.js +123 -0
- package/lib/tool-usage-projection.d.ts +390 -0
- package/lib/tool-usage-projection.d.ts.map +1 -0
- package/lib/tool-usage-projection.js +1038 -0
- package/lib/tool-usage-report.d.ts +153 -0
- package/lib/tool-usage-report.d.ts.map +1 -0
- package/lib/tool-usage-report.js +274 -0
- package/lib/transport.d.ts +158 -0
- package/lib/transport.d.ts.map +1 -0
- package/lib/transport.js +332 -0
- package/lib/types.d.ts +134 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +8 -0
- package/lib/update-surface.d.ts +79 -0
- package/lib/update-surface.d.ts.map +1 -0
- package/lib/update-surface.js +224 -0
- package/lib/version.d.ts +3 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +27 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
- package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
- package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
- package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
- package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
- package/package.json +127 -4
- package/remote/spec.mjs +993 -0
- package/remote/typert.host.mjs +14 -0
- package/remote/typert.remote-client.mjs +16 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stdio bridge (MCP-03, P26-05, P26-06, P26-08).
|
|
3
|
+
*
|
|
4
|
+
* `P26-05` is explicit that the bridge IS AN HTTP CLIENT, not a second protocol
|
|
5
|
+
* implementation: it must generate the modern per-request headers correctly and
|
|
6
|
+
* talk to the same endpoint a network client uses. So there is no second
|
|
7
|
+
* interpretation of the protocol here to drift out of step with the first.
|
|
8
|
+
*
|
|
9
|
+
* What P26-08 requires, and how each is met:
|
|
10
|
+
*
|
|
11
|
+
* - **Stdout is exclusively protocol traffic; diagnostics go to stderr.** The two
|
|
12
|
+
* sinks are separate parameters, so a diagnostic cannot reach stdout by being
|
|
13
|
+
* written to "the output" — there is no single output to confuse.
|
|
14
|
+
* - **Request IDs and per-request metadata are preserved.** The body is forwarded
|
|
15
|
+
* verbatim; the bridge regenerates only the HEADERS, which is the one thing the
|
|
16
|
+
* transport requires it to derive.
|
|
17
|
+
* - **One stdio process is not one conversation.** Nothing is retained between
|
|
18
|
+
* requests except in-flight cancellation state, which is keyed by request id and
|
|
19
|
+
* removed when the request settles.
|
|
20
|
+
* - **EOF shuts down bridge-owned requests without killing the host.** Closing
|
|
21
|
+
* aborts what this bridge has in flight; the host is a separate process.
|
|
22
|
+
* - **Cancellation is per request.** `notifications/cancelled` aborts exactly the
|
|
23
|
+
* referenced request, so cancelling one call cannot cancel another sharing the
|
|
24
|
+
* worker.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/dsh-tool-mode/mcp/stdio
|
|
27
|
+
*/
|
|
28
|
+
import { type WireRequest } from './protocol.ts';
|
|
29
|
+
/** Where the bridge writes. Two sinks, deliberately not one. */
|
|
30
|
+
export interface BridgeIo {
|
|
31
|
+
/** Protocol traffic. Newline-delimited JSON and nothing else. */
|
|
32
|
+
protocol(line: string): void;
|
|
33
|
+
/** Diagnostics. Never protocol traffic. */
|
|
34
|
+
diagnostic(line: string): void;
|
|
35
|
+
}
|
|
36
|
+
/** How the bridge reaches the endpoint. */
|
|
37
|
+
export interface BridgeEndpoint {
|
|
38
|
+
/** The URL to POST to. */
|
|
39
|
+
readonly url: string;
|
|
40
|
+
/** The bearer token, from the operator's configuration and never from a client. */
|
|
41
|
+
readonly token: string;
|
|
42
|
+
/**
|
|
43
|
+
* The request function. Injected so a test can drive the bridge without a socket
|
|
44
|
+
* and without a real host.
|
|
45
|
+
*/
|
|
46
|
+
readonly fetch: (url: string, init: {
|
|
47
|
+
method: string;
|
|
48
|
+
headers: Record<string, string>;
|
|
49
|
+
body: string;
|
|
50
|
+
signal: AbortSignal;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
status: number;
|
|
53
|
+
headers: Record<string, string>;
|
|
54
|
+
body: string;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
/** A running bridge. */
|
|
58
|
+
export interface StdioBridge {
|
|
59
|
+
/**
|
|
60
|
+
* Handle one line of stdin.
|
|
61
|
+
* @param line - the raw line, with or without its newline.
|
|
62
|
+
* @returns the protocol line to emit, or undefined when none is due.
|
|
63
|
+
*/
|
|
64
|
+
handleLine(line: string): Promise<string | undefined>;
|
|
65
|
+
/** Abort every request this bridge owns, as EOF does. */
|
|
66
|
+
close(): void;
|
|
67
|
+
/** How many requests this bridge currently owns in flight. */
|
|
68
|
+
readonly inFlight: number;
|
|
69
|
+
}
|
|
70
|
+
/** Build the headers for one request (P26-05). */
|
|
71
|
+
export declare function headersFor(request: WireRequest, token: string): Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Create a bridge to a running MCP endpoint.
|
|
74
|
+
*
|
|
75
|
+
* @param endpoint - the endpoint and its injected request function.
|
|
76
|
+
* @param io - the protocol and diagnostic sinks.
|
|
77
|
+
* @returns the bridge.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createStdioBridge(endpoint: BridgeEndpoint, io: BridgeIo): StdioBridge;
|
|
80
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/mcp/stdio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAElE,gEAAgE;AAChE,MAAM,WAAW,QAAQ;IACvB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,2CAA2C;IAC3C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,KACzF,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAChF;AAED,wBAAwB;AACxB,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrD,yDAAyD;IACzD,KAAK,IAAI,IAAI,CAAA;IACb,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBtF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,GAAG,WAAW,CAiHrF"}
|
package/lib/mcp/stdio.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stdio bridge (MCP-03, P26-05, P26-06, P26-08).
|
|
3
|
+
*
|
|
4
|
+
* `P26-05` is explicit that the bridge IS AN HTTP CLIENT, not a second protocol
|
|
5
|
+
* implementation: it must generate the modern per-request headers correctly and
|
|
6
|
+
* talk to the same endpoint a network client uses. So there is no second
|
|
7
|
+
* interpretation of the protocol here to drift out of step with the first.
|
|
8
|
+
*
|
|
9
|
+
* What P26-08 requires, and how each is met:
|
|
10
|
+
*
|
|
11
|
+
* - **Stdout is exclusively protocol traffic; diagnostics go to stderr.** The two
|
|
12
|
+
* sinks are separate parameters, so a diagnostic cannot reach stdout by being
|
|
13
|
+
* written to "the output" — there is no single output to confuse.
|
|
14
|
+
* - **Request IDs and per-request metadata are preserved.** The body is forwarded
|
|
15
|
+
* verbatim; the bridge regenerates only the HEADERS, which is the one thing the
|
|
16
|
+
* transport requires it to derive.
|
|
17
|
+
* - **One stdio process is not one conversation.** Nothing is retained between
|
|
18
|
+
* requests except in-flight cancellation state, which is keyed by request id and
|
|
19
|
+
* removed when the request settles.
|
|
20
|
+
* - **EOF shuts down bridge-owned requests without killing the host.** Closing
|
|
21
|
+
* aborts what this bridge has in flight; the host is a separate process.
|
|
22
|
+
* - **Cancellation is per request.** `notifications/cancelled` aborts exactly the
|
|
23
|
+
* referenced request, so cancelling one call cannot cancel another sharing the
|
|
24
|
+
* worker.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/dsh-tool-mode/mcp/stdio
|
|
27
|
+
*/
|
|
28
|
+
import { PROTOCOL_VERSION } from "./protocol.js";
|
|
29
|
+
/** Build the headers for one request (P26-05). */
|
|
30
|
+
export function headersFor(request, token) {
|
|
31
|
+
// The version comes from the BODY, not from a constant, so a request declaring an
|
|
32
|
+
// unsupported version is refused by the endpoint's header check rather than being
|
|
33
|
+
// silently relabelled by the bridge.
|
|
34
|
+
const bodyVersion = request.params?._meta?.['io.modelcontextprotocol/protocolVersion'];
|
|
35
|
+
const headers = {
|
|
36
|
+
'content-type': 'application/json',
|
|
37
|
+
accept: 'application/json',
|
|
38
|
+
authorization: `Bearer ${token}`,
|
|
39
|
+
'mcp-protocol-version': typeof bodyVersion === 'string' ? bodyVersion : PROTOCOL_VERSION,
|
|
40
|
+
'mcp-method': request.method,
|
|
41
|
+
};
|
|
42
|
+
// `Mcp-Name` is required for a named call and must match the body, so it is
|
|
43
|
+
// derived from the body rather than guessed.
|
|
44
|
+
if (request.method === 'tools/call' && typeof request.params?.name === 'string') {
|
|
45
|
+
headers['mcp-name'] = request.params.name;
|
|
46
|
+
}
|
|
47
|
+
return headers;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a bridge to a running MCP endpoint.
|
|
51
|
+
*
|
|
52
|
+
* @param endpoint - the endpoint and its injected request function.
|
|
53
|
+
* @param io - the protocol and diagnostic sinks.
|
|
54
|
+
* @returns the bridge.
|
|
55
|
+
*/
|
|
56
|
+
export function createStdioBridge(endpoint, io) {
|
|
57
|
+
/** In-flight requests, keyed by request id, so cancellation is per request. */
|
|
58
|
+
const inFlight = new Map();
|
|
59
|
+
return {
|
|
60
|
+
get inFlight() {
|
|
61
|
+
return inFlight.size;
|
|
62
|
+
},
|
|
63
|
+
async handleLine(line) {
|
|
64
|
+
const trimmed = line.trim();
|
|
65
|
+
// A blank line is a keep-alive, not a malformed frame: skipping it is correct
|
|
66
|
+
// and reporting it would spam a diagnostic channel for no reason.
|
|
67
|
+
if (trimmed.length === 0)
|
|
68
|
+
return undefined;
|
|
69
|
+
let request;
|
|
70
|
+
try {
|
|
71
|
+
request = JSON.parse(trimmed);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// A malformed frame is answered on the PROTOCOL channel, because the client
|
|
75
|
+
// is waiting for a response and a diagnostic would not reach it.
|
|
76
|
+
/**
|
|
77
|
+
* The `id` is OMITTED rather than set to `null`, which is the rule `protocol.ts`
|
|
78
|
+
* documents three hundred lines away and this site contradicted.
|
|
79
|
+
*
|
|
80
|
+
* JSON-RPC 2.0 conventionally allows `id: null` for an undeterminable id, but the
|
|
81
|
+
* pinned revision types `RequestId` as `string | integer` and does not admit null,
|
|
82
|
+
* while `id` itself is OPTIONAL. A frame that failed to parse has no id to echo, so
|
|
83
|
+
* omitting it is the conformant way to say "unknown".
|
|
84
|
+
*/
|
|
85
|
+
return frame({
|
|
86
|
+
jsonrpc: '2.0',
|
|
87
|
+
error: { code: -32700, message: 'the frame is not valid JSON' },
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// P26-06: a cancellation names the request it cancels and nothing else.
|
|
91
|
+
if (request.method === 'notifications/cancelled') {
|
|
92
|
+
const target = request.params?.requestId;
|
|
93
|
+
const key = target === undefined ? undefined : String(target);
|
|
94
|
+
if (key !== undefined) {
|
|
95
|
+
const controller = inFlight.get(key);
|
|
96
|
+
if (controller === undefined) {
|
|
97
|
+
// Reported, not ignored: a cancellation for an unknown request usually
|
|
98
|
+
// means the client and bridge disagree about what is in flight.
|
|
99
|
+
io.diagnostic(`cancellation for unknown request ${key}`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
controller.abort(new Error('cancelled by the client'));
|
|
103
|
+
inFlight.delete(key);
|
|
104
|
+
io.diagnostic(`cancelled request ${key}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// A notification is acknowledged with nothing at all.
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const controller = new AbortController();
|
|
111
|
+
const key = request.id === undefined || request.id === null ? undefined : String(request.id);
|
|
112
|
+
if (key !== undefined)
|
|
113
|
+
inFlight.set(key, controller);
|
|
114
|
+
try {
|
|
115
|
+
const response = await endpoint.fetch(endpoint.url, {
|
|
116
|
+
method: 'POST',
|
|
117
|
+
headers: headersFor(request, endpoint.token),
|
|
118
|
+
// The body is forwarded VERBATIM: ids and per-request metadata survive
|
|
119
|
+
// exactly, because the bridge regenerates only the headers.
|
|
120
|
+
body: trimmed,
|
|
121
|
+
signal: controller.signal,
|
|
122
|
+
});
|
|
123
|
+
if (response.status === 202 || response.body.length === 0) {
|
|
124
|
+
// A notification has no response to forward.
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
if (response.status >= 400 && !looksLikeJsonRpc(response.body)) {
|
|
128
|
+
// A transport-level failure has no JSON-RPC body to forward, so it is
|
|
129
|
+
// reported as a diagnostic AND as a protocol error: a client waiting for a
|
|
130
|
+
// response must not be left waiting because the failure was transport.
|
|
131
|
+
io.diagnostic(`the endpoint returned HTTP ${response.status}`);
|
|
132
|
+
return frame({
|
|
133
|
+
jsonrpc: '2.0',
|
|
134
|
+
id: request.id ?? null,
|
|
135
|
+
error: { code: -32603, message: `the endpoint returned HTTP ${response.status}` },
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return frame(JSON.parse(response.body));
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (controller.signal.aborted) {
|
|
142
|
+
// Cancellation is not a failure to report: the client asked for it.
|
|
143
|
+
io.diagnostic(`request ${key ?? '(unknown)'} ended by cancellation`);
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
147
|
+
io.diagnostic(`the request to the endpoint failed: ${message}`);
|
|
148
|
+
return frame({
|
|
149
|
+
jsonrpc: '2.0',
|
|
150
|
+
id: request.id ?? null,
|
|
151
|
+
error: { code: -32603, message: `the bridge could not reach the endpoint: ${message}` },
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
if (key !== undefined)
|
|
156
|
+
inFlight.delete(key);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
close() {
|
|
160
|
+
// P26-08: EOF shuts down BRIDGE-OWNED requests. The host is a separate
|
|
161
|
+
// process and is not touched here.
|
|
162
|
+
for (const [key, controller] of inFlight) {
|
|
163
|
+
controller.abort(new Error('the bridge is closing'));
|
|
164
|
+
io.diagnostic(`aborted in-flight request ${key} on close`);
|
|
165
|
+
}
|
|
166
|
+
inFlight.clear();
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** Serialize one protocol frame. */
|
|
171
|
+
function frame(message) {
|
|
172
|
+
return JSON.stringify(message);
|
|
173
|
+
}
|
|
174
|
+
/** Whether a body is a JSON-RPC message rather than a transport error page. */
|
|
175
|
+
function looksLikeJsonRpc(body) {
|
|
176
|
+
try {
|
|
177
|
+
const parsed = JSON.parse(body);
|
|
178
|
+
return parsed.jsonrpc === '2.0';
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog subscriptions (P26-09, P26-10).
|
|
3
|
+
*
|
|
4
|
+
* The rules that make this more than an event emitter, each of which a naive
|
|
5
|
+
* implementation gets wrong:
|
|
6
|
+
*
|
|
7
|
+
* - **Acknowledge first, and acknowledge only what is SUPPORTED.** The ack carries
|
|
8
|
+
* the filter the server will actually honour, not the one the client asked for. A
|
|
9
|
+
* client that requested four notification types and is sent back one is being told
|
|
10
|
+
* the truth; echoing all four and then sending one is a silent lie the client
|
|
11
|
+
* cannot detect until it waits forever.
|
|
12
|
+
* - **No event before the acknowledgement.** So the ack is emitted synchronously as
|
|
13
|
+
* part of establishing the subscription, and the subscription only becomes
|
|
14
|
+
* eligible for real events afterwards.
|
|
15
|
+
* - **Every event carries the subscription id** in the revision's notification
|
|
16
|
+
* metadata, because a client with several subscriptions cannot otherwise tell
|
|
17
|
+
* which one an event belongs to.
|
|
18
|
+
* - **Filter per caller.** Each subscription belongs to one client and sees only its
|
|
19
|
+
* own catalog. One client's private package changes are never delivered to
|
|
20
|
+
* another, which is the leakage the requirement names.
|
|
21
|
+
* - **Teardown is announced.** Revoking a grant sends `notifications/cancelled`
|
|
22
|
+
* referencing the subscription request BEFORE the stream closes, so a client can
|
|
23
|
+
* distinguish "your access ended" from "the connection dropped".
|
|
24
|
+
* - **Progress does not travel here** (P26-10). Progress belongs on the response
|
|
25
|
+
* stream of the call that produced it; routing it onto the catalog stream would
|
|
26
|
+
* deliver one call's progress to every subscriber.
|
|
27
|
+
*
|
|
28
|
+
* @module @try-works/dsh-tool-mode/mcp/subscriptions
|
|
29
|
+
*/
|
|
30
|
+
import { type WireRequest } from './protocol.ts';
|
|
31
|
+
/** The notification types the revision defines for catalog changes. */
|
|
32
|
+
export type SubscriptionFilterKey = 'toolsListChanged' | 'promptsListChanged' | 'resourcesListChanged' | 'resourceSubscriptions';
|
|
33
|
+
/** The filter a client requested, or the subset the server acknowledged. */
|
|
34
|
+
export type SubscriptionFilter = Partial<Record<SubscriptionFilterKey, boolean>> & {
|
|
35
|
+
readonly resourceSubscriptions?: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The notification types this server actually emits.
|
|
39
|
+
*
|
|
40
|
+
* Only tool-catalog changes exist, because only tools are published. Declaring the
|
|
41
|
+
* others unsupported is what makes the acknowledgement honest.
|
|
42
|
+
*/
|
|
43
|
+
export declare const SUPPORTED_FILTERS: readonly SubscriptionFilterKey[];
|
|
44
|
+
/** The official metadata key carrying the subscription's request id. */
|
|
45
|
+
export declare const SUBSCRIPTION_ID_KEY = "io.modelcontextprotocol/subscriptionId";
|
|
46
|
+
/** One active subscription. */
|
|
47
|
+
export interface Subscription {
|
|
48
|
+
/** The id of the `subscriptions/listen` request that established it. */
|
|
49
|
+
readonly subscriptionId: string;
|
|
50
|
+
/** The client it belongs to. Every event is filtered through this. */
|
|
51
|
+
readonly clientId: string;
|
|
52
|
+
/** The filter the server ACKNOWLEDGED, which is the supported subset. */
|
|
53
|
+
readonly acknowledged: SubscriptionFilter;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the acknowledgement has been emitted.
|
|
56
|
+
*
|
|
57
|
+
* Nothing is published before it is true, which is how P26-09 requirement that no
|
|
58
|
+
* event precede the acknowledgement is enforced rather than remembered.
|
|
59
|
+
*/
|
|
60
|
+
announced: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** A message the transport should deliver to one client. */
|
|
63
|
+
export interface SubscriptionMessage {
|
|
64
|
+
/** The client it is for. */
|
|
65
|
+
readonly clientId: string;
|
|
66
|
+
/** The notification to send. */
|
|
67
|
+
readonly notification: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Narrow a requested filter to what this server supports.
|
|
71
|
+
*
|
|
72
|
+
* P26-09 says to acknowledge only supported requested filters. A requested type
|
|
73
|
+
* that is not supported is DROPPED rather than acknowledged-and-ignored: an
|
|
74
|
+
* acknowledged type that never fires is indistinguishable from a broken server.
|
|
75
|
+
* @param requested - the filter the client asked for.
|
|
76
|
+
* @returns the acknowledged filter.
|
|
77
|
+
*/
|
|
78
|
+
export declare function acknowledgeFilter(requested: SubscriptionFilter): SubscriptionFilter;
|
|
79
|
+
/** Manages the active catalog subscriptions. */
|
|
80
|
+
export declare class SubscriptionRegistry {
|
|
81
|
+
#private;
|
|
82
|
+
/** Counter for ids this server issues, so an id is never caller-chosen. */
|
|
83
|
+
/** Active subscriptions, for diagnostics. */
|
|
84
|
+
get active(): readonly Subscription[];
|
|
85
|
+
/**
|
|
86
|
+
* Establish a subscription.
|
|
87
|
+
*
|
|
88
|
+
* The acknowledgement notification is returned as part of the result and is
|
|
89
|
+
* marked sent before anything can be published, so no event can precede it.
|
|
90
|
+
* @param request - the `subscriptions/listen` request.
|
|
91
|
+
* @param clientId - the authenticated client, which the subscription is bound to.
|
|
92
|
+
* @returns the result envelope, the acknowledgement, and the subscription id.
|
|
93
|
+
*/
|
|
94
|
+
listen(request: WireRequest, clientId: string): {
|
|
95
|
+
readonly result: Record<string, unknown>;
|
|
96
|
+
readonly acknowledgement: Record<string, unknown>;
|
|
97
|
+
readonly subscriptionId: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Publish a tool-catalog change.
|
|
101
|
+
*
|
|
102
|
+
* @param generation - the catalog generation that changed, carried so a client
|
|
103
|
+
* can tell a real change from a duplicate delivery.
|
|
104
|
+
* @returns one message per eligible subscriber, and nothing for anyone else.
|
|
105
|
+
*/
|
|
106
|
+
publishToolListChanged(generation: number): readonly SubscriptionMessage[];
|
|
107
|
+
/**
|
|
108
|
+
* Revoke every subscription belonging to a client, announcing each first.
|
|
109
|
+
*
|
|
110
|
+
* P26-09 requires the teardown notification BEFORE the stream closes, so the
|
|
111
|
+
* client learns its access ended rather than inferring it from a dropped socket.
|
|
112
|
+
* @param clientId - the client whose grant was revoked.
|
|
113
|
+
* @returns the teardown messages, already ordered cancellation-first.
|
|
114
|
+
*/
|
|
115
|
+
revoke(clientId: string): readonly SubscriptionMessage[];
|
|
116
|
+
/**
|
|
117
|
+
* Close one subscription at the client's request.
|
|
118
|
+
* @param subscriptionId - the subscription to close.
|
|
119
|
+
* @param clientId - the caller, which must own it.
|
|
120
|
+
* @returns whether it was closed.
|
|
121
|
+
*/
|
|
122
|
+
close(subscriptionId: string, clientId: string): boolean;
|
|
123
|
+
/** Every subscription belonging to one client. */
|
|
124
|
+
forClient(clientId: string): readonly Subscription[];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Build the `notifications/cancelled` a client sends to stop a subscription.
|
|
128
|
+
*
|
|
129
|
+
* `CancelledNotificationParams` requires only `requestId`, so the notification
|
|
130
|
+
* carries exactly that: adding a `_meta` with an undefined version would put a
|
|
131
|
+
* meaningless member on the wire.
|
|
132
|
+
* @param subscriptionId - the subscription to cancel.
|
|
133
|
+
* @returns the notification.
|
|
134
|
+
*/
|
|
135
|
+
export declare function cancelSubscription(subscriptionId: string): Record<string, unknown>;
|
|
136
|
+
/**
|
|
137
|
+
* The DELIVERY half of P26-09 (task-73): what a streaming transport
|
|
138
|
+
* implements. The registry owns the subscriptions and the filtering; the sink
|
|
139
|
+
* owns the per-client open streams. A production SSE transport provides its
|
|
140
|
+
* writer here; the tests inject a collecting sink that exercises the SAME
|
|
141
|
+
* consumer path end to end.
|
|
142
|
+
*/
|
|
143
|
+
export interface SubscriptionDeliverySink {
|
|
144
|
+
/** Deliver one addressed notification to its client's open stream. */
|
|
145
|
+
deliver(message: SubscriptionMessage): void;
|
|
146
|
+
/** Close every stream belonging to one client (teardown-cancelled first). */
|
|
147
|
+
closeClient(clientId: string, reason: string): void;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Run one catalog-change publication through the delivery consumer: the
|
|
151
|
+
* registry's per-caller filtering decides WHO gets the event, and the sink
|
|
152
|
+
* carries it to each client's stream. Acknowledgement ordering is the
|
|
153
|
+
* registry's own guarantee — an acknowledgement is marked sent before any
|
|
154
|
+
* publish can run, so no event can precede it.
|
|
155
|
+
* @param registry - the subscription state.
|
|
156
|
+
* @param generation - the catalog generation that changed.
|
|
157
|
+
* @param sink - the delivery transport.
|
|
158
|
+
* @returns how many subscribers received the change.
|
|
159
|
+
*/
|
|
160
|
+
export declare function deliverCatalogChange(registry: SubscriptionRegistry, generation: number, sink: SubscriptionDeliverySink): number;
|
|
161
|
+
/**
|
|
162
|
+
* The memory sink: one per-client queue, used by the tests to exercise the
|
|
163
|
+
* consumer and by the host as the transport seam until a streaming endpoint
|
|
164
|
+
* injects its writer. It honours the same contract a real transport must:
|
|
165
|
+
* delivery only to the addressed client, and closeClient stops that client's
|
|
166
|
+
* queue entirely.
|
|
167
|
+
*/
|
|
168
|
+
export declare class MemoryDeliverySink implements SubscriptionDeliverySink {
|
|
169
|
+
#private;
|
|
170
|
+
/** The delivered messages for one client, in delivery order. */
|
|
171
|
+
forClient(clientId: string): readonly SubscriptionMessage[];
|
|
172
|
+
/** Whether the sink closed a client, and why. */
|
|
173
|
+
closeReason(clientId: string): string | undefined;
|
|
174
|
+
deliver(message: SubscriptionMessage): void;
|
|
175
|
+
closeClient(clientId: string, reason: string): void;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/mcp/subscriptions.ts"],"names":[],"mappings":"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"}
|