@try-works/dsh-tool-mode 0.0.0-stage → 0.5.45
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/LICENSE +205 -0
- package/README.md +303 -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 +4158 -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 +2552 -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 +5273 -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/model-runtime-lane.d.ts +69 -0
- package/lib/model-runtime-lane.d.ts.map +1 -0
- package/lib/model-runtime-lane.js +122 -0
- package/lib/model-runtime-recipe.d.ts +132 -0
- package/lib/model-runtime-recipe.d.ts.map +1 -0
- package/lib/model-runtime-recipe.js +291 -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,459 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MCP 2026-07-28 wire core.
|
|
3
|
+
*
|
|
4
|
+
* The published `@modelcontextprotocol/sdk` (1.32.1) declares
|
|
5
|
+
* `LATEST_PROTOCOL_VERSION = 2025-11-25` and does not list `2026-07-28` among its
|
|
6
|
+
* supported revisions, so this is the "separately reviewed, schema-conformant
|
|
7
|
+
* adaptation" MCP-01 permits where SDK support is incomplete. It is written
|
|
8
|
+
* against the revision's own requirements rather than by changing a version string
|
|
9
|
+
* on legacy behaviour, which MCP-01 explicitly says does not satisfy the
|
|
10
|
+
* requirement.
|
|
11
|
+
*
|
|
12
|
+
* What makes this revision different, and what this module exists to enforce:
|
|
13
|
+
*
|
|
14
|
+
* - **No handshake.** `tools/list` and `tools/call` must work as the FIRST
|
|
15
|
+
* application request. There is no `initialize`, no
|
|
16
|
+
* `notifications/initialized`, no prior discovery call and no `Mcp-Session-Id`
|
|
17
|
+
* (P26-01). So there is no session state here to get wrong.
|
|
18
|
+
* - **Per-request metadata.** Version and capabilities travel in `params._meta` on
|
|
19
|
+
* EVERY request, and are never inferred from an earlier one (P26-02). That is
|
|
20
|
+
* why `_meta` is parsed per request and not cached.
|
|
21
|
+
* - **Server identity in results.** Every result envelope carries `resultType`,
|
|
22
|
+
* and the revision's guidance puts `serverInfo` in result metadata.
|
|
23
|
+
* - **Errors stay in their lanes** (P26-04): a malformed protocol request is a
|
|
24
|
+
* JSON-RPC error, while an application tool failure is a tool-error RESULT. A
|
|
25
|
+
* failure wrapped as a successful payload is the specific mistake this prevents.
|
|
26
|
+
*
|
|
27
|
+
* @module @try-works/dsh-tool-mode/mcp/protocol
|
|
28
|
+
*/
|
|
29
|
+
/** The revision this server speaks. */
|
|
30
|
+
export const PROTOCOL_VERSION = '2026-07-28';
|
|
31
|
+
/**
|
|
32
|
+
* Revisions this server can also serve.
|
|
33
|
+
*
|
|
34
|
+
* Kept explicit and short. P26-03 requires an unsupported version to be answered
|
|
35
|
+
* with the supported list, so the list must be a fact rather than a guess.
|
|
36
|
+
*/
|
|
37
|
+
export const SUPPORTED_PROTOCOL_VERSIONS = [PROTOCOL_VERSION];
|
|
38
|
+
/** The `_meta` keys the revision defines. */
|
|
39
|
+
export const META_KEYS = {
|
|
40
|
+
protocolVersion: 'io.modelcontextprotocol/protocolVersion',
|
|
41
|
+
clientInfo: 'io.modelcontextprotocol/clientInfo',
|
|
42
|
+
clientCapabilities: 'io.modelcontextprotocol/clientCapabilities',
|
|
43
|
+
serverInfo: 'io.modelcontextprotocol/serverInfo',
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Error codes.
|
|
47
|
+
*
|
|
48
|
+
* The reserved range belongs to the protocol. P26-03 is explicit that custom
|
|
49
|
+
* errors must not be allocated there, and the pinned revision partitions the
|
|
50
|
+
* bands: `-32768..-32000` is JSON-RPC's own predefined-error allocation,
|
|
51
|
+
* `-32020..-32099` is reserved for MCP-defined codes (allocated sequentially,
|
|
52
|
+
* and this module declares exactly those the revision defines), while
|
|
53
|
+
* `-32000..-32019` is the IMPLEMENTATION-DEFINED sub-range — the specification
|
|
54
|
+
* will never define codes there, and receivers must not assume cross-
|
|
55
|
+
* implementation semantics. `rateLimited` lives in that sub-range deliberately:
|
|
56
|
+
* it is a documented implementation allocation, never a minted code in the
|
|
57
|
+
* reserved band.
|
|
58
|
+
*/
|
|
59
|
+
export const ERROR_CODES = {
|
|
60
|
+
/** Standard JSON-RPC. */
|
|
61
|
+
parseError: -32700,
|
|
62
|
+
invalidRequest: -32600,
|
|
63
|
+
methodNotFound: -32601,
|
|
64
|
+
invalidParams: -32602,
|
|
65
|
+
internalError: -32603,
|
|
66
|
+
/** MCP-reserved. */
|
|
67
|
+
headerMismatch: -32020,
|
|
68
|
+
unsupportedClientCapability: -32021,
|
|
69
|
+
unsupportedProtocolVersion: -32022,
|
|
70
|
+
/**
|
|
71
|
+
* Implementation-defined (-32000..-32019, never allocated by the specification).
|
|
72
|
+
*
|
|
73
|
+
* The revision defines NO rate-limit error, so a refusal uses this documented
|
|
74
|
+
* implementation code rather than pretending the request was invalid (-32600) or
|
|
75
|
+
* minting a code in the MCP-reserved band. The HTTP 429 status carries the
|
|
76
|
+
* semantics; receivers that do not know this code still get a conformant
|
|
77
|
+
* `JSONRPCErrorResponse` envelope and a `Retry-After` header.
|
|
78
|
+
*/
|
|
79
|
+
rateLimited: -32001,
|
|
80
|
+
};
|
|
81
|
+
/** Raised for a request that must be answered with a JSON-RPC error. */
|
|
82
|
+
export class WireError extends Error {
|
|
83
|
+
name = 'WireError';
|
|
84
|
+
code;
|
|
85
|
+
/** Structured detail, as the revision's schema defines for the code. */
|
|
86
|
+
data;
|
|
87
|
+
constructor(code, message, data) {
|
|
88
|
+
super(message);
|
|
89
|
+
this.code = code;
|
|
90
|
+
if (data !== undefined)
|
|
91
|
+
this.data = data;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Whether a numeric code lies in the range reserved for the protocol. */
|
|
95
|
+
export function isReservedErrorCode(code) {
|
|
96
|
+
// JSON-RPC's own band plus MCP's -32000..-32099 allocation.
|
|
97
|
+
return (code >= -32768 && code <= -32000);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Parse `params._meta` from a request (P26-02).
|
|
101
|
+
*
|
|
102
|
+
* Missing required metadata is `invalid params`, not a defaulted value: inferring
|
|
103
|
+
* a version or a capability from a preceding request is exactly what P26-02
|
|
104
|
+
* forbids, and defaulting is inference with extra steps.
|
|
105
|
+
*
|
|
106
|
+
* The REQUIRED set is taken from the pinned revision schema's `RequestMetaObject`,
|
|
107
|
+
* which requires `clientCapabilities` and `protocolVersion` — and NOT `clientInfo`.
|
|
108
|
+
* Requiring `clientInfo` here would reject a request the schema admits, which is a
|
|
109
|
+
* conformance failure in the opposite direction from accepting too much.
|
|
110
|
+
*
|
|
111
|
+
* @param params - the request parameters.
|
|
112
|
+
* @returns the parsed metadata.
|
|
113
|
+
* @throws WireError `-32602` when a required key is absent or malformed.
|
|
114
|
+
*/
|
|
115
|
+
export function parseRequestMetadata(params) {
|
|
116
|
+
const meta = params?._meta;
|
|
117
|
+
if (typeof meta !== 'object' || meta === null || Array.isArray(meta)) {
|
|
118
|
+
throw new WireError(ERROR_CODES.invalidParams, 'params._meta is required on every modern request and must be an object');
|
|
119
|
+
}
|
|
120
|
+
const record = meta;
|
|
121
|
+
const protocolVersion = record[META_KEYS.protocolVersion];
|
|
122
|
+
if (typeof protocolVersion !== 'string' || protocolVersion.length === 0) {
|
|
123
|
+
throw new WireError(ERROR_CODES.invalidParams, `params._meta["${META_KEYS.protocolVersion}"] is required and must be a string`);
|
|
124
|
+
}
|
|
125
|
+
const capabilities = record[META_KEYS.clientCapabilities];
|
|
126
|
+
if (typeof capabilities !== 'object' || capabilities === null || Array.isArray(capabilities)) {
|
|
127
|
+
throw new WireError(ERROR_CODES.invalidParams, `params._meta["${META_KEYS.clientCapabilities}"] is required and must be an object`);
|
|
128
|
+
}
|
|
129
|
+
// Optional in the schema, so absent is admitted; present-but-malformed is not,
|
|
130
|
+
// because a client that sends half an Implementation has sent a broken one.
|
|
131
|
+
const clientInfo = record[META_KEYS.clientInfo];
|
|
132
|
+
let info = { name: 'unknown', version: 'unknown' };
|
|
133
|
+
if (clientInfo !== undefined) {
|
|
134
|
+
if (typeof clientInfo !== 'object' || clientInfo === null) {
|
|
135
|
+
throw new WireError(ERROR_CODES.invalidParams, `params._meta["${META_KEYS.clientInfo}"], when present, must be an object`);
|
|
136
|
+
}
|
|
137
|
+
const candidate = clientInfo;
|
|
138
|
+
if (typeof candidate.name !== 'string' || typeof candidate.version !== 'string') {
|
|
139
|
+
throw new WireError(ERROR_CODES.invalidParams, 'clientInfo needs a name and a version');
|
|
140
|
+
}
|
|
141
|
+
info = { name: candidate.name, version: candidate.version };
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
protocolVersion,
|
|
145
|
+
// Self-reported and therefore for DIAGNOSTICS only: P26-02 is explicit that
|
|
146
|
+
// clientInfo is not authentication, so nothing here is ever used to authorize.
|
|
147
|
+
clientInfo: info,
|
|
148
|
+
clientCapabilities: capabilities,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Negotiate the protocol version for one request (P26-03).
|
|
153
|
+
*
|
|
154
|
+
* @param metadata - the request metadata.
|
|
155
|
+
* @returns the negotiated version.
|
|
156
|
+
* @throws WireError `-32022` carrying the official `supported` and `requested` data.
|
|
157
|
+
*/
|
|
158
|
+
export function negotiateVersion(metadata) {
|
|
159
|
+
if (!SUPPORTED_PROTOCOL_VERSIONS.includes(metadata.protocolVersion)) {
|
|
160
|
+
throw new WireError(ERROR_CODES.unsupportedProtocolVersion, `unsupported protocol version ${metadata.protocolVersion}`,
|
|
161
|
+
// The revision defines this data shape; a bare message would leave the client
|
|
162
|
+
// unable to choose a version it can speak.
|
|
163
|
+
{ supported: [...SUPPORTED_PROTOCOL_VERSIONS], requested: metadata.protocolVersion });
|
|
164
|
+
}
|
|
165
|
+
return metadata.protocolVersion;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The advertised-feature matrix (P26-12).
|
|
169
|
+
*
|
|
170
|
+
* P26-12 forbids advertising Tasks, sampling, resource subscriptions, prompts or
|
|
171
|
+
* UI extensions merely because an SDK exports their types. Declaring the matrix as
|
|
172
|
+
* data — with `implemented: false` where that is the truth — means the server
|
|
173
|
+
* cannot advertise a feature it does not have by accident.
|
|
174
|
+
*/
|
|
175
|
+
export const ADVERTISED_FEATURES = [
|
|
176
|
+
{ feature: 'tools', implemented: true },
|
|
177
|
+
{ feature: 'server/discover', implemented: true },
|
|
178
|
+
/**
|
|
179
|
+
* Implemented for TOOL-catalog changes only, and ONLY when a registry is composed.
|
|
180
|
+
*
|
|
181
|
+
* This row is re-decided by dvertisedFeatures(), which defaults it to alse:
|
|
182
|
+
* the production transport passes no registry, so the row as written here is the
|
|
183
|
+
* capability's SHAPE rather than a claim about the deployment. Declaring it true
|
|
184
|
+
* statically is what let an unservable feature be advertised.
|
|
185
|
+
*/
|
|
186
|
+
{ feature: 'subscriptions/listen', implemented: true },
|
|
187
|
+
{ feature: 'tasks', implemented: false },
|
|
188
|
+
{ feature: 'sampling', implemented: false },
|
|
189
|
+
{ feature: 'elicitation', implemented: false },
|
|
190
|
+
{ feature: 'roots', implemented: false },
|
|
191
|
+
{ feature: 'prompts', implemented: false },
|
|
192
|
+
{ feature: 'resources/subscribe', implemented: false },
|
|
193
|
+
{ feature: 'logging', implemented: false },
|
|
194
|
+
];
|
|
195
|
+
/**
|
|
196
|
+
* What the server may advertise, given what is ACTUALLY WIRED (P26-12).
|
|
197
|
+
*
|
|
198
|
+
* The static matrix declared `subscriptions/listen` as implemented unconditionally — while
|
|
199
|
+
* the only production transport never received a registry and therefore answered `-32601`
|
|
200
|
+
* for it. An advertised feature that no client can obtain is worse than an absent one: a
|
|
201
|
+
* client plans around it and fails later.
|
|
202
|
+
*
|
|
203
|
+
* The feature is now conditional on the wiring, and the DEFAULT is `false` because that is
|
|
204
|
+
* the production reality. A caller that has genuinely composed a subscription registry says
|
|
205
|
+
* so; nothing else can make the claim true by declaring it.
|
|
206
|
+
*
|
|
207
|
+
* @param wiring - which optional surfaces are composed.
|
|
208
|
+
* @returns the advertised-feature matrix for this deployment.
|
|
209
|
+
*/
|
|
210
|
+
export function advertisedFeatures(wiring = {}) {
|
|
211
|
+
return ADVERTISED_FEATURES.map(entry =>
|
|
212
|
+
// Only the composed feature is re-decided; everything else keeps its declared truth.
|
|
213
|
+
entry.feature === 'subscriptions/listen'
|
|
214
|
+
? { feature: entry.feature, implemented: wiring.subscriptions === true }
|
|
215
|
+
: entry);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The capabilities object this server may advertise.
|
|
219
|
+
*
|
|
220
|
+
* Derived from the matrix rather than written twice, so the two cannot disagree.
|
|
221
|
+
* @param wiring - which optional surfaces are composed.
|
|
222
|
+
* @returns the capability names that are genuinely implemented HERE.
|
|
223
|
+
*/
|
|
224
|
+
export function implementedCapabilities(wiring = {}) {
|
|
225
|
+
return advertisedFeatures(wiring).filter(entry => entry.implemented).map(entry => entry.feature);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Whether a client's REQUIRED capability is one this server supports (P26-03).
|
|
229
|
+
*
|
|
230
|
+
* @param required - capability names the client declared as required.
|
|
231
|
+
* @returns the unsupported names, empty when all are supported.
|
|
232
|
+
*/
|
|
233
|
+
export function unsupportedRequiredCapabilities(required, wiring = {}) {
|
|
234
|
+
const implemented = new Set(implementedCapabilities(wiring));
|
|
235
|
+
// The supported set is deployment-specific: `subscriptions/listen` is available only
|
|
236
|
+
// when the caller composed a subscription registry. A static default here rejected a
|
|
237
|
+
// capability that the very same dispatch call could serve.
|
|
238
|
+
return required.filter(name => !implemented.has(name));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Validate and normalize an operator-configured catalog cache policy (P26-14).
|
|
242
|
+
*
|
|
243
|
+
* The default is the unchanged safe behavior: `{ cacheScope: 'private', ttlMs: 0 }`.
|
|
244
|
+
* Invalid configuration is REFUSED with a named error rather than silently rewritten:
|
|
245
|
+
* emitting a non-private scope would understate the authorization boundary, and a
|
|
246
|
+
* negative/non-finite TTL is not a cache policy at all.
|
|
247
|
+
* @param policy - the configured TTL/scope, both optional.
|
|
248
|
+
* @returns the validated policy.
|
|
249
|
+
* @throws Error named `INVALID_CATALOG_CACHE_TTL` or `INVALID_CATALOG_CACHE_SCOPE`.
|
|
250
|
+
*/
|
|
251
|
+
export function normalizeCachePolicy(policy) {
|
|
252
|
+
const ttlMs = policy?.ttlMs ?? 0;
|
|
253
|
+
if (typeof ttlMs !== 'number' || !Number.isFinite(ttlMs) || ttlMs < 0) {
|
|
254
|
+
throw new Error('INVALID_CATALOG_CACHE_TTL: catalog cache ttlMs must be a finite, non-negative '
|
|
255
|
+
+ `number of milliseconds; received ${String(ttlMs)}`);
|
|
256
|
+
}
|
|
257
|
+
const cacheScope = policy?.cacheScope ?? 'private';
|
|
258
|
+
if (cacheScope !== 'private') {
|
|
259
|
+
throw new Error('INVALID_CATALOG_CACHE_SCOPE: catalog cacheScope must be "private" because '
|
|
260
|
+
+ 'tools/list and server/discover are authorization-filtered; received '
|
|
261
|
+
+ `${JSON.stringify(cacheScope)}`);
|
|
262
|
+
}
|
|
263
|
+
return { cacheScope: 'private', ttlMs };
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The caching fields every cacheable result must carry (P26-14).
|
|
267
|
+
*
|
|
268
|
+
* Taken from the pinned schema's `CacheableResult`, which REQUIRES `cacheScope` and
|
|
269
|
+
* `ttlMs` on `DiscoverResult` and `ListToolsResult` alike. The policy defaults to
|
|
270
|
+
* private/0 and can carry an operator-configured non-zero TTL; the scope itself is
|
|
271
|
+
* validated to stay `private` ({@link normalizeCachePolicy}).
|
|
272
|
+
* @param policy - the catalog cache policy, or undefined for private/0.
|
|
273
|
+
* @returns the caching fields.
|
|
274
|
+
*/
|
|
275
|
+
export function cacheableResultFields(policy) {
|
|
276
|
+
return normalizeCachePolicy(policy);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Build a successful result envelope (P26-04).
|
|
280
|
+
*
|
|
281
|
+
* Every modern result carries `resultType`, and `serverInfo` rides in result
|
|
282
|
+
* metadata per the revision's guidance — `ResultMetaObject` admits exactly that
|
|
283
|
+
* one key, which is what this writes.
|
|
284
|
+
* @param result - the method-specific fields.
|
|
285
|
+
* @param serverInfo - this server's identity.
|
|
286
|
+
* @returns the result object, including `resultType` and `_meta`.
|
|
287
|
+
*/
|
|
288
|
+
export function successResult(result, serverInfo) {
|
|
289
|
+
// The metadata is MERGED rather than replaced. A method-specific result may carry
|
|
290
|
+
// its own `_meta` members that the revision requires —
|
|
291
|
+
// `SubscriptionsListenResult` must contain
|
|
292
|
+
// `io.modelcontextprotocol/subscriptionId` — and overwriting the object dropped
|
|
293
|
+
// it, sending a result with a required field missing. A subscription test caught
|
|
294
|
+
// this; the pinned schema would have caught it too, and did not only because the
|
|
295
|
+
// fixture corpus has no subscription case yet.
|
|
296
|
+
const existing = typeof result._meta === 'object' && result._meta !== null
|
|
297
|
+
? result._meta
|
|
298
|
+
: {};
|
|
299
|
+
return {
|
|
300
|
+
...result,
|
|
301
|
+
resultType: 'complete',
|
|
302
|
+
_meta: {
|
|
303
|
+
...existing,
|
|
304
|
+
[META_KEYS.serverInfo]: { name: serverInfo.name, version: serverInfo.version },
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Build a tool-error RESULT (P26-04).
|
|
310
|
+
*
|
|
311
|
+
* The distinction this preserves is the whole point: an application failure is a
|
|
312
|
+
* successful protocol exchange carrying `isError`, while a malformed request is a
|
|
313
|
+
* JSON-RPC error. Wrapping a domain failure as protocol success, or an
|
|
314
|
+
* infrastructure failure as a successful domain payload, are both forbidden.
|
|
315
|
+
* @param message - a bounded, model-readable explanation.
|
|
316
|
+
* @returns the tool-error result.
|
|
317
|
+
*/
|
|
318
|
+
export function toolErrorResult(message) {
|
|
319
|
+
return {
|
|
320
|
+
// Truncated because a stack trace or an unbounded message would be neither
|
|
321
|
+
// model-readable nor safe to return.
|
|
322
|
+
isError: true,
|
|
323
|
+
content: [{ type: 'text', text: message.length > 2000 ? `${message.slice(0, 2000)}…` : message }],
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Build a JSON-RPC error response.
|
|
328
|
+
*
|
|
329
|
+
* When the request id is UNKNOWN the `id` member is omitted rather than set to
|
|
330
|
+
* `null`. JSON-RPC 2.0 conventionally allows `id: null` for an undeterminable id,
|
|
331
|
+
* but the pinned revision schema types `RequestId` as `string | integer` and does
|
|
332
|
+
* not admit null — while `id` itself is optional. Omitting it is therefore the
|
|
333
|
+
* conformant way to say "unknown", and the independent probe caught this by
|
|
334
|
+
* rejecting a captured 401 whose id was null.
|
|
335
|
+
*
|
|
336
|
+
* @param id - the request id, or null when it could not be determined.
|
|
337
|
+
* @param error - the failure.
|
|
338
|
+
* @returns the response envelope.
|
|
339
|
+
*/
|
|
340
|
+
export function errorResponse(id, error) {
|
|
341
|
+
const data = 'data' in error ? error.data : undefined;
|
|
342
|
+
return {
|
|
343
|
+
jsonrpc: '2.0',
|
|
344
|
+
...id === null ? {} : { id },
|
|
345
|
+
error: {
|
|
346
|
+
code: error.code,
|
|
347
|
+
message: error.message,
|
|
348
|
+
...data === undefined ? {} : { data },
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Decode the revision's Base64 sentinel encoding (P26-05).
|
|
354
|
+
*
|
|
355
|
+
* A header value may be encoded with the official `=?base64?…?=` sentinel, and it
|
|
356
|
+
* must be decoded BEFORE comparison. Comparing the encoded form would let a client
|
|
357
|
+
* present a value that decodes to something else entirely.
|
|
358
|
+
* @param value - the raw header value.
|
|
359
|
+
* @returns the decoded value.
|
|
360
|
+
*/
|
|
361
|
+
export function decodeHeaderValue(value) {
|
|
362
|
+
const match = /^=\?base64\?(.*)\?=$/s.exec(value);
|
|
363
|
+
if (match === null)
|
|
364
|
+
return value;
|
|
365
|
+
try {
|
|
366
|
+
return Buffer.from(match[1], 'base64').toString('utf8');
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
// A malformed sentinel is left as-is so the comparison against the body fails
|
|
370
|
+
// and reports a mismatch, rather than being silently accepted as something.
|
|
371
|
+
return value;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Check the required headers against the body (P26-05).
|
|
376
|
+
*
|
|
377
|
+
* Headers are checked against BODY FIELDS, so a request cannot claim one method in
|
|
378
|
+
* a header and another in its body. Every mismatch is `HeaderMismatch` (-32020),
|
|
379
|
+
* which the HTTP layer reports as 400.
|
|
380
|
+
* @param headers - the relevant request headers.
|
|
381
|
+
* @param body - the parsed request.
|
|
382
|
+
* @returns nothing when the headers agree.
|
|
383
|
+
* @throws WireError `-32020` naming the first disagreement.
|
|
384
|
+
*/
|
|
385
|
+
export function assertHeadersMatch(headers, body) {
|
|
386
|
+
const fail = (detail) => {
|
|
387
|
+
throw new WireError(ERROR_CODES.headerMismatch, detail);
|
|
388
|
+
};
|
|
389
|
+
const version = headers.protocolVersion === undefined ? undefined : decodeHeaderValue(headers.protocolVersion);
|
|
390
|
+
if (version === undefined) {
|
|
391
|
+
return fail('the MCP-Protocol-Version header is required');
|
|
392
|
+
}
|
|
393
|
+
const bodyVersion = body.params?._meta?.[META_KEYS.protocolVersion];
|
|
394
|
+
if (typeof bodyVersion === 'string' && version !== bodyVersion) {
|
|
395
|
+
return fail(`the MCP-Protocol-Version header (${version}) does not match the request body (${bodyVersion})`);
|
|
396
|
+
}
|
|
397
|
+
const method = headers.method === undefined ? undefined : decodeHeaderValue(headers.method);
|
|
398
|
+
// Pinned Streamable HTTP: Mcp-Method is REQUIRED for every request, not
|
|
399
|
+
// merely checked when supplied. Never synthesize a missing authority header.
|
|
400
|
+
if (body.id !== undefined && method === undefined)
|
|
401
|
+
return fail('the Mcp-Method header is required');
|
|
402
|
+
if (method !== undefined && method !== body.method) {
|
|
403
|
+
return fail(`the Mcp-Method header (${method}) does not match the request method (${body.method})`);
|
|
404
|
+
}
|
|
405
|
+
// `Mcp-Name` is required only for a named call. Requiring it universally would
|
|
406
|
+
// reject a correct `tools/list`, which has no name.
|
|
407
|
+
if (body.method === 'tools/call') {
|
|
408
|
+
const name = headers.name === undefined ? undefined : decodeHeaderValue(headers.name);
|
|
409
|
+
if (name === undefined)
|
|
410
|
+
return fail('the Mcp-Name header is required for tools/call');
|
|
411
|
+
const bodyName = body.params?.name;
|
|
412
|
+
if (typeof bodyName === 'string' && name !== bodyName) {
|
|
413
|
+
return fail(`the Mcp-Name header (${name}) does not match the request name (${bodyName})`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Parse a newline-delimited stdio frame (P26-08).
|
|
419
|
+
*
|
|
420
|
+
* Stdio carries protocol traffic on stdout and diagnostics on stderr, so a line
|
|
421
|
+
* that is not a JSON object is a protocol error rather than something to log and
|
|
422
|
+
* skip: silently dropping it would leave a client waiting for a response that
|
|
423
|
+
* never comes.
|
|
424
|
+
* @param line - one line of input.
|
|
425
|
+
* @returns the parsed request, or undefined for a blank line.
|
|
426
|
+
* @throws WireError `-32700` when the line is not a JSON object.
|
|
427
|
+
*/
|
|
428
|
+
export function parseStdioLine(line) {
|
|
429
|
+
const trimmed = line.trim();
|
|
430
|
+
if (trimmed.length === 0)
|
|
431
|
+
return undefined;
|
|
432
|
+
let parsed;
|
|
433
|
+
try {
|
|
434
|
+
parsed = JSON.parse(trimmed);
|
|
435
|
+
}
|
|
436
|
+
catch {
|
|
437
|
+
throw new WireError(ERROR_CODES.parseError, 'the frame is not valid JSON');
|
|
438
|
+
}
|
|
439
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
440
|
+
throw new WireError(ERROR_CODES.invalidRequest, 'the frame is not a JSON-RPC object');
|
|
441
|
+
}
|
|
442
|
+
const request = parsed;
|
|
443
|
+
if (request.jsonrpc !== '2.0' || typeof request.method !== 'string') {
|
|
444
|
+
throw new WireError(ERROR_CODES.invalidRequest, 'the frame is not a JSON-RPC 2.0 request');
|
|
445
|
+
}
|
|
446
|
+
return request;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Serialize one stdio frame.
|
|
450
|
+
* @param message - the response or notification.
|
|
451
|
+
* @returns the line, newline-terminated.
|
|
452
|
+
*/
|
|
453
|
+
export function serializeStdioFrame(message) {
|
|
454
|
+
// A newline inside the JSON would produce two frames and desynchronise the
|
|
455
|
+
// stream, so the compact form is used and embedded newlines are escaped by
|
|
456
|
+
// JSON.stringify itself.
|
|
457
|
+
return `${JSON.stringify(message)}\n`;
|
|
458
|
+
}
|
|
459
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-client request rate limiting for the MCP HTTP transport (AT-12).
|
|
3
|
+
*
|
|
4
|
+
* AT-12's named gap was that the host had ZERO rate limiting: an authenticated client could
|
|
5
|
+
* drive unbounded inference traffic, and nothing anywhere counted it. This module is the
|
|
6
|
+
* counter. Its discipline is deliberate:
|
|
7
|
+
*
|
|
8
|
+
* - **Keyed on the AUTHENTICATED client identity, never the socket.** The remote address is
|
|
9
|
+
* caller-forgeable (proxies, NAT, header tricks) and the endpoint is loopback-only anyway,
|
|
10
|
+
* so every client would share one address and one bucket. The identity comes from the
|
|
11
|
+
* transport's resolved authentication — the static-token `clientId` or the OAuth subject —
|
|
12
|
+
* which is the one thing the transport already proved.
|
|
13
|
+
* - **Fixed-window buckets.** One counter per client per window. Simpler to reason about than
|
|
14
|
+
* a token bucket, and its boundary semantics are exactly testable: a client that exhausted
|
|
15
|
+
* a window is admitted again when the next window opens, with `retryAfterMs` naming when.
|
|
16
|
+
* - **Bounded in-memory state, never persisted.** Entries carry only a window, a count and a
|
|
17
|
+
* last-seen timestamp; when the map is at capacity a NEW client evicts the longest-idle
|
|
18
|
+
* entry, so a deployment cannot be grown without limit by many short-lived clients. A
|
|
19
|
+
* restart forgets everything, which is correct for a burst guard: persistence would turn
|
|
20
|
+
* a request limiter into an availability policy.
|
|
21
|
+
* - **Counting is not an auth oracle.** The HTTP layer admits a client only AFTER the
|
|
22
|
+
* credential was accepted; an unauthenticated or malformed-credential request is refused
|
|
23
|
+
* before any counter moves. Counting authentication failures would let a caller learn
|
|
24
|
+
* whether a credential exists from the timing of a 429, which is the leak this refuses.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/dsh-tool-mode/mcp/rate-limit
|
|
27
|
+
*/
|
|
28
|
+
/** The policy one deployment enforces. */
|
|
29
|
+
export interface RateLimitPolicy {
|
|
30
|
+
/** Requests admitted per window for ONE client. */
|
|
31
|
+
readonly maxRequests: number;
|
|
32
|
+
/** Window length in milliseconds. */
|
|
33
|
+
readonly windowMs: number;
|
|
34
|
+
/** Most clients tracked; a new client at capacity evicts the longest-idle entry. */
|
|
35
|
+
readonly maxClients: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The default policy: 60 requests per client per minute, 10 000 tracked clients.
|
|
39
|
+
*
|
|
40
|
+
* Sensible for a loopback single-user endpoint while still bounding a runaway client; an
|
|
41
|
+
* operator overrides it through the transport configuration.
|
|
42
|
+
*/
|
|
43
|
+
export declare const DEFAULT_RATE_LIMIT_POLICY: RateLimitPolicy;
|
|
44
|
+
/** The verdict of one admission. */
|
|
45
|
+
export type RateLimitDecision = {
|
|
46
|
+
readonly admitted: true;
|
|
47
|
+
} | {
|
|
48
|
+
readonly admitted: false;
|
|
49
|
+
readonly retryAfterMs: number;
|
|
50
|
+
};
|
|
51
|
+
/** A per-client limiter. */
|
|
52
|
+
export interface RateLimiter {
|
|
53
|
+
/** Consume one request for a client, refusing it when the window is exhausted. */
|
|
54
|
+
admit(clientId: string): RateLimitDecision;
|
|
55
|
+
/** Requests still available to this client in the current window. */
|
|
56
|
+
remaining(clientId: string): number;
|
|
57
|
+
/** How many clients are currently tracked. */
|
|
58
|
+
trackedClients(): number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a per-client fixed-window rate limiter.
|
|
62
|
+
* @param policy - the enforced policy; fields are validated at construction so a broken
|
|
63
|
+
* configuration fails when the transport starts, not on the first request.
|
|
64
|
+
* @param now - a clock, injectable so window boundaries are testable.
|
|
65
|
+
* @returns the limiter.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createRateLimiter(policy: RateLimitPolicy, now?: () => number): RateLimiter;
|
|
68
|
+
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/mcp/rate-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/D,4BAA4B;AAC5B,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAAA;IAC1C,qEAAqE;IACrE,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACnC,8CAA8C;IAC9C,cAAc,IAAI,MAAM,CAAA;CACzB;AAmBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,EACvB,GAAG,GAAE,MAAM,MAAiB,GAC3B,WAAW,CA8Db"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-client request rate limiting for the MCP HTTP transport (AT-12).
|
|
3
|
+
*
|
|
4
|
+
* AT-12's named gap was that the host had ZERO rate limiting: an authenticated client could
|
|
5
|
+
* drive unbounded inference traffic, and nothing anywhere counted it. This module is the
|
|
6
|
+
* counter. Its discipline is deliberate:
|
|
7
|
+
*
|
|
8
|
+
* - **Keyed on the AUTHENTICATED client identity, never the socket.** The remote address is
|
|
9
|
+
* caller-forgeable (proxies, NAT, header tricks) and the endpoint is loopback-only anyway,
|
|
10
|
+
* so every client would share one address and one bucket. The identity comes from the
|
|
11
|
+
* transport's resolved authentication — the static-token `clientId` or the OAuth subject —
|
|
12
|
+
* which is the one thing the transport already proved.
|
|
13
|
+
* - **Fixed-window buckets.** One counter per client per window. Simpler to reason about than
|
|
14
|
+
* a token bucket, and its boundary semantics are exactly testable: a client that exhausted
|
|
15
|
+
* a window is admitted again when the next window opens, with `retryAfterMs` naming when.
|
|
16
|
+
* - **Bounded in-memory state, never persisted.** Entries carry only a window, a count and a
|
|
17
|
+
* last-seen timestamp; when the map is at capacity a NEW client evicts the longest-idle
|
|
18
|
+
* entry, so a deployment cannot be grown without limit by many short-lived clients. A
|
|
19
|
+
* restart forgets everything, which is correct for a burst guard: persistence would turn
|
|
20
|
+
* a request limiter into an availability policy.
|
|
21
|
+
* - **Counting is not an auth oracle.** The HTTP layer admits a client only AFTER the
|
|
22
|
+
* credential was accepted; an unauthenticated or malformed-credential request is refused
|
|
23
|
+
* before any counter moves. Counting authentication failures would let a caller learn
|
|
24
|
+
* whether a credential exists from the timing of a 429, which is the leak this refuses.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/dsh-tool-mode/mcp/rate-limit
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The default policy: 60 requests per client per minute, 10 000 tracked clients.
|
|
30
|
+
*
|
|
31
|
+
* Sensible for a loopback single-user endpoint while still bounding a runaway client; an
|
|
32
|
+
* operator overrides it through the transport configuration.
|
|
33
|
+
*/
|
|
34
|
+
export const DEFAULT_RATE_LIMIT_POLICY = {
|
|
35
|
+
maxRequests: 60,
|
|
36
|
+
windowMs: 60_000,
|
|
37
|
+
maxClients: 10_000,
|
|
38
|
+
};
|
|
39
|
+
/** Read a positive integer policy field, refusing a value that would mis-count. */
|
|
40
|
+
function positiveInteger(value, name) {
|
|
41
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
42
|
+
throw new Error(`rate limit ${name} must be a positive integer, not ${String(value)}`);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a per-client fixed-window rate limiter.
|
|
48
|
+
* @param policy - the enforced policy; fields are validated at construction so a broken
|
|
49
|
+
* configuration fails when the transport starts, not on the first request.
|
|
50
|
+
* @param now - a clock, injectable so window boundaries are testable.
|
|
51
|
+
* @returns the limiter.
|
|
52
|
+
*/
|
|
53
|
+
export function createRateLimiter(policy, now = Date.now) {
|
|
54
|
+
const maxRequests = positiveInteger(policy.maxRequests, 'maxRequests');
|
|
55
|
+
const windowMs = positiveInteger(policy.windowMs, 'windowMs');
|
|
56
|
+
const maxClients = positiveInteger(policy.maxClients, 'maxClients');
|
|
57
|
+
const buckets = new Map();
|
|
58
|
+
/** Evict the longest-idle client, so the map stays bounded while new clients arrive. */
|
|
59
|
+
const evictIdle = () => {
|
|
60
|
+
let oldest;
|
|
61
|
+
for (const [id, bucket] of buckets) {
|
|
62
|
+
if (oldest === undefined || bucket.lastSeen < oldest.lastSeen) {
|
|
63
|
+
oldest = { id, lastSeen: bucket.lastSeen };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (oldest !== undefined)
|
|
67
|
+
buckets.delete(oldest.id);
|
|
68
|
+
};
|
|
69
|
+
const bucketFor = (clientId, at) => {
|
|
70
|
+
const existing = buckets.get(clientId);
|
|
71
|
+
if (existing !== undefined)
|
|
72
|
+
return existing;
|
|
73
|
+
if (buckets.size >= maxClients)
|
|
74
|
+
evictIdle();
|
|
75
|
+
const created = { window: 0, count: 0, lastSeen: at };
|
|
76
|
+
buckets.set(clientId, created);
|
|
77
|
+
return created;
|
|
78
|
+
};
|
|
79
|
+
const currentWindow = (at) => Math.floor(at / windowMs);
|
|
80
|
+
return {
|
|
81
|
+
admit(clientId) {
|
|
82
|
+
const at = now();
|
|
83
|
+
const bucket = bucketFor(clientId, at);
|
|
84
|
+
bucket.lastSeen = at;
|
|
85
|
+
const window = currentWindow(at);
|
|
86
|
+
// A NEW WINDOW RESETS the count: the client exhausted the PREVIOUS window, not all time.
|
|
87
|
+
if (bucket.window !== window) {
|
|
88
|
+
bucket.window = window;
|
|
89
|
+
bucket.count = 0;
|
|
90
|
+
}
|
|
91
|
+
if (bucket.count >= maxRequests) {
|
|
92
|
+
return {
|
|
93
|
+
admitted: false,
|
|
94
|
+
// The client is admitted again at the next window boundary.
|
|
95
|
+
retryAfterMs: windowMs - (at % windowMs),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
bucket.count += 1;
|
|
99
|
+
return { admitted: true };
|
|
100
|
+
},
|
|
101
|
+
remaining(clientId) {
|
|
102
|
+
const bucket = buckets.get(clientId);
|
|
103
|
+
if (bucket === undefined)
|
|
104
|
+
return maxRequests;
|
|
105
|
+
if (bucket.window !== currentWindow(now()))
|
|
106
|
+
return maxRequests;
|
|
107
|
+
return Math.max(0, maxRequests - bucket.count);
|
|
108
|
+
},
|
|
109
|
+
trackedClients() {
|
|
110
|
+
return buckets.size;
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExternalCaller } from './client-grant.ts';
|
|
2
|
+
import type { McpHost } from './server.ts';
|
|
3
|
+
import { type WireRequest } from './protocol.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Construct official serving around a caller already verified by the transport.
|
|
6
|
+
* No credentials or grants are accepted from JSON-RPC params. Each factory call
|
|
7
|
+
* reads the LIVE surface and creates a fresh server; business execution and its
|
|
8
|
+
* accounting remain exclusively in host.callTool / createMcpHost.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createSdkV2Handler(host: McpHost, caller: ExternalCaller, incoming?: WireRequest): import("@modelcontextprotocol/server").McpHttpHandler;
|
|
11
|
+
/**
|
|
12
|
+
* Live Fetch face. The per-request SDK handler belongs to the response body:
|
|
13
|
+
* close it on drain, cancellation, abort or error, never when fetch returns SSE.
|
|
14
|
+
* Linking a controller also makes a Web reader's cancel abort business execution.
|
|
15
|
+
*/
|
|
16
|
+
export declare function serveSdkV2Request(host: McpHost, caller: ExternalCaller, request: Request, token: string): Promise<Response>;
|
|
17
|
+
//# sourceMappingURL=sdk-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-v2.d.ts","sourceRoot":"","sources":["../../src/mcp/sdk-v2.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAEjE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,WAAW,yDAgG/F;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,QAAQ,CAAC,CA+DnB"}
|