@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
package/remote/spec.mjs
ADDED
|
@@ -0,0 +1,993 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for the `modelTools` Remote namespace.
|
|
3
|
+
*
|
|
4
|
+
* Three artifacts are built from this module and must never drift:
|
|
5
|
+
* - `typert.host.mjs`: the Host Loader face the `typert-loader` registers as
|
|
6
|
+
* strict invocation descriptors (`./typert` package export);
|
|
7
|
+
* - `typert.remote-client.mjs`: the mountable Client contribution (`./remote`);
|
|
8
|
+
* - `client/client.model-tools.js`: the package-local lazy-CJS chunk the
|
|
9
|
+
* plugin's browser half loads with `require.async('./client.model-tools.js')`
|
|
10
|
+
* (the client module system serves only `./client`, so the contribution the
|
|
11
|
+
* page mounts travels as a sibling chunk).
|
|
12
|
+
*
|
|
13
|
+
* The wire method for install is `installExtension`, not `install`: DSH's
|
|
14
|
+
* client RemoteNamespaceService owns a private method `install` and refuses a
|
|
15
|
+
* descriptor method that collides with it. The Host service keeps its member
|
|
16
|
+
* name `install`; the descriptor's `implementation` maps the two.
|
|
17
|
+
*
|
|
18
|
+
* These functions stay dependency-free and self-contained because
|
|
19
|
+
* `scripts/gen-remote-artifacts.mjs` inlines their source into the browser
|
|
20
|
+
* chunk; changing one to reference an enclosing binding breaks the chunk.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** npm package that owns the namespace. */
|
|
24
|
+
export const PACKAGE = '@try-works/dsh-tool-mode'
|
|
25
|
+
/** Cordis service key the Host dispatch resolves. */
|
|
26
|
+
export const SERVICE = 'modelTools'
|
|
27
|
+
/** Wire namespace exposed as `ctx.remote.modelTools`. */
|
|
28
|
+
export const NAMESPACE = 'modelTools'
|
|
29
|
+
/** Browser-facing install method (see the collision note above). */
|
|
30
|
+
export const INSTALL_WIRE_METHOD = 'installExtension'
|
|
31
|
+
|
|
32
|
+
/** Structural validators for the JSON values the wire carries. */
|
|
33
|
+
const STRING = { kind: 'string' }
|
|
34
|
+
const BOOLEAN = { kind: 'boolean' }
|
|
35
|
+
const NULLABLE_STRING = { kind: 'nullable', of: STRING }
|
|
36
|
+
const STRING_LIST = { kind: 'array', of: STRING }
|
|
37
|
+
const INTEGRITY = {
|
|
38
|
+
kind: 'union',
|
|
39
|
+
of: [
|
|
40
|
+
{ kind: 'literal', value: 'unchanged' },
|
|
41
|
+
{ kind: 'literal', value: 'changed' },
|
|
42
|
+
{ kind: 'literal', value: 'unknown' },
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
/** The preflight prerequisite vocabulary (`extensions-api.ts` task-92). */
|
|
46
|
+
const REQUIREMENT_KIND = {
|
|
47
|
+
kind: 'union',
|
|
48
|
+
of: [
|
|
49
|
+
'store',
|
|
50
|
+
'source',
|
|
51
|
+
'dependencies',
|
|
52
|
+
'runtime',
|
|
53
|
+
'assets',
|
|
54
|
+
'executable',
|
|
55
|
+
'harness-model',
|
|
56
|
+
'platform',
|
|
57
|
+
'integrity',
|
|
58
|
+
'activation',
|
|
59
|
+
].map(value => ({ kind: 'literal', value })),
|
|
60
|
+
}
|
|
61
|
+
/** The action that clears an unmet requirement. */
|
|
62
|
+
const REQUIREMENT_ACTION = {
|
|
63
|
+
kind: 'union',
|
|
64
|
+
of: ['install', 'prepare', 'enable', 'config', 'none'].map(value => ({ kind: 'literal', value })),
|
|
65
|
+
}
|
|
66
|
+
const EXTENSION_REQUIREMENT = {
|
|
67
|
+
kind: 'object',
|
|
68
|
+
fields: {
|
|
69
|
+
kind: REQUIREMENT_KIND,
|
|
70
|
+
satisfied: BOOLEAN,
|
|
71
|
+
reason: STRING,
|
|
72
|
+
action: REQUIREMENT_ACTION,
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One extension row.
|
|
77
|
+
*
|
|
78
|
+
* `requirements` and `blocked` are ADDITIVE against the older row shape: both
|
|
79
|
+
* are optional here so a Host that predates the requirements model still
|
|
80
|
+
* validates. The browser half treats an absent `requirements` as "the host did
|
|
81
|
+
* not check" (no invented rows) and an absent `blocked` as false.
|
|
82
|
+
*/
|
|
83
|
+
const EXTENSION_STATE = {
|
|
84
|
+
kind: 'object',
|
|
85
|
+
fields: {
|
|
86
|
+
id: STRING,
|
|
87
|
+
package: NULLABLE_STRING,
|
|
88
|
+
version: NULLABLE_STRING,
|
|
89
|
+
installed: BOOLEAN,
|
|
90
|
+
active: BOOLEAN,
|
|
91
|
+
disabled: BOOLEAN,
|
|
92
|
+
integrity: INTEGRITY,
|
|
93
|
+
tools: STRING_LIST,
|
|
94
|
+
reason: NULLABLE_STRING,
|
|
95
|
+
requirements: { kind: 'optional', of: { kind: 'array', of: EXTENSION_REQUIREMENT } },
|
|
96
|
+
blocked: { kind: 'optional', of: BOOLEAN },
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
const DESCRIBE_RESULT = {
|
|
100
|
+
kind: 'object',
|
|
101
|
+
fields: {
|
|
102
|
+
store: NULLABLE_STRING,
|
|
103
|
+
writable: BOOLEAN,
|
|
104
|
+
sourceDir: NULLABLE_STRING,
|
|
105
|
+
extensions: { kind: 'array', of: EXTENSION_STATE },
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The install result.
|
|
110
|
+
*
|
|
111
|
+
* `source` and `resolvedVersion` are ADDITIVE against the older result shape:
|
|
112
|
+
* a Host that predates registry installs omits them and still validates. When
|
|
113
|
+
* present the route is exactly `registry` or `directory`, and the resolved
|
|
114
|
+
* version is the exact version the request resolved to.
|
|
115
|
+
*/
|
|
116
|
+
const INSTALL_RESULT = {
|
|
117
|
+
kind: 'object',
|
|
118
|
+
fields: {
|
|
119
|
+
id: STRING,
|
|
120
|
+
version: STRING,
|
|
121
|
+
active: BOOLEAN,
|
|
122
|
+
source: {
|
|
123
|
+
kind: 'optional',
|
|
124
|
+
of: {
|
|
125
|
+
kind: 'union',
|
|
126
|
+
of: [
|
|
127
|
+
{ kind: 'literal', value: 'registry' },
|
|
128
|
+
{ kind: 'literal', value: 'directory' },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
resolvedVersion: { kind: 'optional', of: STRING },
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
const TOGGLE_RESULT = {
|
|
136
|
+
kind: 'object',
|
|
137
|
+
fields: { id: STRING, active: BOOLEAN, disabled: BOOLEAN },
|
|
138
|
+
}
|
|
139
|
+
const TOOL_TOGGLE_RESULT = {
|
|
140
|
+
kind: 'object',
|
|
141
|
+
fields: { id: STRING, toolName: STRING, enabled: BOOLEAN, active: BOOLEAN },
|
|
142
|
+
}
|
|
143
|
+
const UNINSTALL_RESULT = {
|
|
144
|
+
kind: 'object',
|
|
145
|
+
fields: { id: STRING, removed: BOOLEAN, active: BOOLEAN },
|
|
146
|
+
}
|
|
147
|
+
const OPTIONAL_STRING = { kind: 'optional', of: STRING }
|
|
148
|
+
const NUMBER = { kind: 'number' }
|
|
149
|
+
/** The readiness vocabulary from `extensions-api.ts` (EXT-25 / RES-04). */
|
|
150
|
+
const MODEL_READINESS = {
|
|
151
|
+
kind: 'union',
|
|
152
|
+
of: ['unavailable', 'needs-preparation', 'preparing', 'prepared-cold', 'loading', 'ready', 'busy', 'failed']
|
|
153
|
+
.map(value => ({ kind: 'literal', value })),
|
|
154
|
+
}
|
|
155
|
+
const PREPARATION_ASSET = {
|
|
156
|
+
kind: 'object',
|
|
157
|
+
fields: { assetId: STRING, bytes: NUMBER, source: STRING, executable: BOOLEAN },
|
|
158
|
+
}
|
|
159
|
+
const PREPARATION_LICENSE = {
|
|
160
|
+
kind: 'object',
|
|
161
|
+
fields: { name: STRING, url: STRING },
|
|
162
|
+
}
|
|
163
|
+
const PREPARATION_PLAN = {
|
|
164
|
+
kind: 'object',
|
|
165
|
+
fields: {
|
|
166
|
+
modelId: STRING,
|
|
167
|
+
modelRevision: STRING,
|
|
168
|
+
assets: { kind: 'array', of: PREPARATION_ASSET },
|
|
169
|
+
totalBytes: NUMBER,
|
|
170
|
+
storageBytes: NUMBER,
|
|
171
|
+
requiresExecutableApproval: BOOLEAN,
|
|
172
|
+
license: PREPARATION_LICENSE,
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
const PREPARE_RESULT = {
|
|
176
|
+
kind: 'object',
|
|
177
|
+
fields: {
|
|
178
|
+
id: STRING,
|
|
179
|
+
prepared: BOOLEAN,
|
|
180
|
+
reason: NULLABLE_STRING,
|
|
181
|
+
plan: { kind: 'nullable', of: PREPARATION_PLAN },
|
|
182
|
+
readiness: { kind: 'record', of: MODEL_READINESS },
|
|
183
|
+
groups: STRING_LIST,
|
|
184
|
+
activationReady: BOOLEAN,
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Tool Insights additions (task-13): additive methods on the same namespace. */
|
|
189
|
+
const NULLABLE_NUMBER = { kind: 'nullable', of: NUMBER }
|
|
190
|
+
const NULLABLE_BOOLEAN = { kind: 'nullable', of: BOOLEAN }
|
|
191
|
+
const OPTIONAL_NUMBER = { kind: 'optional', of: NUMBER }
|
|
192
|
+
const OPTIONAL_STRING_FIELD = { kind: 'optional', of: STRING }
|
|
193
|
+
const TOOL_KIND = {
|
|
194
|
+
kind: 'union',
|
|
195
|
+
of: ['built-in', 'extension', 'tool-mode', 'mcp', 'unknown'].map(value => ({ kind: 'literal', value })),
|
|
196
|
+
}
|
|
197
|
+
const TOOL_ORIGIN = {
|
|
198
|
+
kind: 'union',
|
|
199
|
+
of: ['dsh-core', 'extension', 'tool-mode', 'mcp', 'unknown'].map(value => ({ kind: 'literal', value })),
|
|
200
|
+
}
|
|
201
|
+
const INVENTORY_STATE = {
|
|
202
|
+
kind: 'union',
|
|
203
|
+
of: ['active', 'prepared-cold', 'failed'].map(value => ({ kind: 'literal', value })),
|
|
204
|
+
}
|
|
205
|
+
const TOOL_SOURCE = {
|
|
206
|
+
kind: 'object',
|
|
207
|
+
fields: { name: STRING, description: STRING, owner: STRING, kind: TOOL_KIND, origin: TOOL_ORIGIN },
|
|
208
|
+
}
|
|
209
|
+
const TOOL_SOURCES_RESULT = { kind: 'object', fields: { tools: { kind: 'array', of: TOOL_SOURCE } } }
|
|
210
|
+
const TOOL_INVENTORY_ROW = {
|
|
211
|
+
kind: 'object',
|
|
212
|
+
fields: {
|
|
213
|
+
name: STRING,
|
|
214
|
+
description: STRING,
|
|
215
|
+
owner: STRING,
|
|
216
|
+
kind: TOOL_KIND,
|
|
217
|
+
origin: TOOL_ORIGIN,
|
|
218
|
+
state: INVENTORY_STATE,
|
|
219
|
+
extension: NULLABLE_STRING,
|
|
220
|
+
version: NULLABLE_STRING,
|
|
221
|
+
extensionVersion: NULLABLE_STRING,
|
|
222
|
+
contractVersion: NULLABLE_STRING,
|
|
223
|
+
argumentCount: NUMBER,
|
|
224
|
+
lastRegistered: NULLABLE_NUMBER,
|
|
225
|
+
mcpExposed: BOOLEAN,
|
|
226
|
+
calls: NUMBER,
|
|
227
|
+
success: NUMBER,
|
|
228
|
+
lastUsed: NULLABLE_NUMBER,
|
|
229
|
+
},
|
|
230
|
+
}
|
|
231
|
+
const TOOL_INVENTORY_RESULT = { kind: 'object', fields: { tools: { kind: 'array', of: TOOL_INVENTORY_ROW } } }
|
|
232
|
+
const USAGE_RANGE = {
|
|
233
|
+
kind: 'union',
|
|
234
|
+
of: ['24h', '7d', '30d', 'all'].map(value => ({ kind: 'literal', value })),
|
|
235
|
+
}
|
|
236
|
+
const RECENT_CALL = {
|
|
237
|
+
kind: 'object',
|
|
238
|
+
fields: {
|
|
239
|
+
time: NUMBER,
|
|
240
|
+
name: STRING,
|
|
241
|
+
owner: STRING,
|
|
242
|
+
model: STRING,
|
|
243
|
+
ms: NULLABLE_NUMBER,
|
|
244
|
+
ok: NULLABLE_BOOLEAN,
|
|
245
|
+
errorCode: NULLABLE_STRING,
|
|
246
|
+
kind: { kind: 'union', of: [{ kind: 'literal', value: 'direct' }, { kind: 'literal', value: 'code' }] },
|
|
247
|
+
callId: STRING,
|
|
248
|
+
parentCallId: NULLABLE_STRING,
|
|
249
|
+
sessionId: STRING,
|
|
250
|
+
workspace: NULLABLE_STRING,
|
|
251
|
+
},
|
|
252
|
+
}
|
|
253
|
+
const USAGE_TOOL_ROW = {
|
|
254
|
+
kind: 'object',
|
|
255
|
+
fields: {
|
|
256
|
+
name: STRING,
|
|
257
|
+
owner: STRING,
|
|
258
|
+
calls: NUMBER,
|
|
259
|
+
errors: NUMBER,
|
|
260
|
+
unsettled: NUMBER,
|
|
261
|
+
codeCalls: NUMBER,
|
|
262
|
+
directCalls: NUMBER,
|
|
263
|
+
totalMs: NUMBER,
|
|
264
|
+
maxMs: NUMBER,
|
|
265
|
+
p50: NULLABLE_NUMBER,
|
|
266
|
+
p95: NULLABLE_NUMBER,
|
|
267
|
+
firstUsed: NULLABLE_NUMBER,
|
|
268
|
+
lastUsed: NULLABLE_NUMBER,
|
|
269
|
+
argsBytes: NUMBER,
|
|
270
|
+
resultBytes: NUMBER,
|
|
271
|
+
},
|
|
272
|
+
}
|
|
273
|
+
const USAGE_MODEL_ROW = {
|
|
274
|
+
kind: 'object',
|
|
275
|
+
fields: { model: STRING, calls: NUMBER, errors: NUMBER, tools: NUMBER, ms: NUMBER, p50: NULLABLE_NUMBER, p95: NULLABLE_NUMBER },
|
|
276
|
+
}
|
|
277
|
+
const USAGE_WORKSPACE_ROW = {
|
|
278
|
+
kind: 'object',
|
|
279
|
+
fields: { workspace: STRING, sessions: NUMBER, calls: NUMBER, errors: NUMBER, ms: NUMBER },
|
|
280
|
+
}
|
|
281
|
+
const USAGE_DAY_ROW = {
|
|
282
|
+
kind: 'object',
|
|
283
|
+
fields: { day: STRING, calls: NUMBER, errors: NUMBER, ms: NUMBER, unsettled: NUMBER },
|
|
284
|
+
}
|
|
285
|
+
const USAGE_ERROR_CODE_ROW = { kind: 'object', fields: { code: STRING, calls: NUMBER } }
|
|
286
|
+
const USAGE_REPORT = {
|
|
287
|
+
kind: 'object',
|
|
288
|
+
fields: {
|
|
289
|
+
range: USAGE_RANGE,
|
|
290
|
+
from: NUMBER,
|
|
291
|
+
to: NUMBER,
|
|
292
|
+
calls: NUMBER,
|
|
293
|
+
errors: NUMBER,
|
|
294
|
+
unsettled: NUMBER,
|
|
295
|
+
toolMs: NUMBER,
|
|
296
|
+
codeCalls: NUMBER,
|
|
297
|
+
sessions: NUMBER,
|
|
298
|
+
uniqueTools: NUMBER,
|
|
299
|
+
successRate: NULLABLE_NUMBER,
|
|
300
|
+
p50: NULLABLE_NUMBER,
|
|
301
|
+
p95: NULLABLE_NUMBER,
|
|
302
|
+
tools: { kind: 'array', of: USAGE_TOOL_ROW },
|
|
303
|
+
models: { kind: 'array', of: USAGE_MODEL_ROW },
|
|
304
|
+
days: { kind: 'array', of: USAGE_DAY_ROW },
|
|
305
|
+
workspaces: { kind: 'array', of: USAGE_WORKSPACE_ROW },
|
|
306
|
+
errorCodes: { kind: 'array', of: USAGE_ERROR_CODE_ROW },
|
|
307
|
+
recentCalls: { kind: 'array', of: RECENT_CALL },
|
|
308
|
+
histogramScope: { kind: 'literal', value: 'retained' },
|
|
309
|
+
},
|
|
310
|
+
}
|
|
311
|
+
const USAGE_REPORT_QUERY = {
|
|
312
|
+
kind: 'object',
|
|
313
|
+
fields: {
|
|
314
|
+
range: { kind: 'optional', of: USAGE_RANGE },
|
|
315
|
+
from: OPTIONAL_NUMBER,
|
|
316
|
+
to: OPTIONAL_NUMBER,
|
|
317
|
+
},
|
|
318
|
+
}
|
|
319
|
+
const MCP_CALL = {
|
|
320
|
+
kind: 'object',
|
|
321
|
+
fields: {
|
|
322
|
+
time: NUMBER,
|
|
323
|
+
tool: STRING,
|
|
324
|
+
clientId: STRING,
|
|
325
|
+
grantId: NULLABLE_STRING,
|
|
326
|
+
totalMs: NUMBER,
|
|
327
|
+
queuedMs: NUMBER,
|
|
328
|
+
loadMs: NUMBER,
|
|
329
|
+
inferenceMs: NUMBER,
|
|
330
|
+
failureClass: STRING,
|
|
331
|
+
reason: NULLABLE_STRING,
|
|
332
|
+
inputBytes: NUMBER,
|
|
333
|
+
outputBytes: NUMBER,
|
|
334
|
+
receiptId: STRING,
|
|
335
|
+
},
|
|
336
|
+
}
|
|
337
|
+
const MCP_CALLS_RESULT = {
|
|
338
|
+
kind: 'object',
|
|
339
|
+
fields: {
|
|
340
|
+
calls: { kind: 'array', of: MCP_CALL },
|
|
341
|
+
total: NUMBER,
|
|
342
|
+
page: NUMBER,
|
|
343
|
+
pageSize: NUMBER,
|
|
344
|
+
clients: STRING_LIST,
|
|
345
|
+
},
|
|
346
|
+
}
|
|
347
|
+
const MCP_CALLS_QUERY = {
|
|
348
|
+
kind: 'object',
|
|
349
|
+
fields: {
|
|
350
|
+
clientId: OPTIONAL_STRING_FIELD,
|
|
351
|
+
page: OPTIONAL_NUMBER,
|
|
352
|
+
pageSize: OPTIONAL_NUMBER,
|
|
353
|
+
},
|
|
354
|
+
}
|
|
355
|
+
const MCP_ENDPOINT = { kind: 'object', fields: { host: STRING, port: NUMBER, path: STRING, url: STRING } }
|
|
356
|
+
const MCP_CONFIGURED = { kind: 'object', fields: { host: STRING, port: NUMBER, path: STRING } }
|
|
357
|
+
const MCP_AUTH_MODE = {
|
|
358
|
+
kind: 'union',
|
|
359
|
+
of: ['static-token', 'oauth-resource-server', 'none'].map(value => ({ kind: 'literal', value })),
|
|
360
|
+
}
|
|
361
|
+
const MCP_STATUS_RESULT = {
|
|
362
|
+
kind: 'object',
|
|
363
|
+
fields: {
|
|
364
|
+
enabled: BOOLEAN,
|
|
365
|
+
listening: BOOLEAN,
|
|
366
|
+
endpoint: { kind: 'nullable', of: MCP_ENDPOINT },
|
|
367
|
+
configured: { kind: 'nullable', of: MCP_CONFIGURED },
|
|
368
|
+
transport: { kind: 'literal', value: 'http' },
|
|
369
|
+
auth: { kind: 'object', fields: { scheme: MCP_AUTH_MODE, mode: MCP_AUTH_MODE, tokenFile: NULLABLE_STRING } },
|
|
370
|
+
uptimeMs: NUMBER,
|
|
371
|
+
clients: {
|
|
372
|
+
kind: 'array',
|
|
373
|
+
of: {
|
|
374
|
+
kind: 'object',
|
|
375
|
+
fields: {
|
|
376
|
+
clientId: STRING,
|
|
377
|
+
id: STRING,
|
|
378
|
+
label: STRING,
|
|
379
|
+
grantId: NULLABLE_STRING,
|
|
380
|
+
calls: NUMBER,
|
|
381
|
+
errors: NUMBER,
|
|
382
|
+
lastSeen: NULLABLE_NUMBER,
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
exposed: STRING_LIST,
|
|
387
|
+
withheld: STRING_LIST,
|
|
388
|
+
exposedCount: NUMBER,
|
|
389
|
+
withheldCount: NUMBER,
|
|
390
|
+
},
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const CUSTOM_TOOL_SUMMARY = {
|
|
394
|
+
kind: 'object',
|
|
395
|
+
fields: {
|
|
396
|
+
id: STRING,
|
|
397
|
+
name: STRING,
|
|
398
|
+
title: STRING,
|
|
399
|
+
description: STRING,
|
|
400
|
+
kind: { kind: 'union', of: ['http', 'prompt', 'composite'].map(value => ({ kind: 'literal', value })) },
|
|
401
|
+
version: NUMBER,
|
|
402
|
+
enabled: BOOLEAN,
|
|
403
|
+
agentExpose: BOOLEAN,
|
|
404
|
+
mcpExpose: BOOLEAN,
|
|
405
|
+
updatedAt: STRING,
|
|
406
|
+
},
|
|
407
|
+
}
|
|
408
|
+
const CUSTOM_TOOLS_SNAPSHOT = {
|
|
409
|
+
kind: 'object',
|
|
410
|
+
fields: {
|
|
411
|
+
store: STRING,
|
|
412
|
+
writable: BOOLEAN,
|
|
413
|
+
tools: { kind: 'array', of: CUSTOM_TOOL_SUMMARY },
|
|
414
|
+
},
|
|
415
|
+
}
|
|
416
|
+
const CUSTOM_TOOL_TEST_RESULT = {
|
|
417
|
+
kind: 'object',
|
|
418
|
+
fields: {
|
|
419
|
+
ok: BOOLEAN,
|
|
420
|
+
value: { kind: 'optional', of: { kind: 'json' } },
|
|
421
|
+
error: {
|
|
422
|
+
kind: 'optional',
|
|
423
|
+
of: { kind: 'object', fields: { code: STRING, message: STRING } },
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Validate one boundary value against the declarative schema.
|
|
430
|
+
* @param schema - schema node from the METHOD_SPECS data.
|
|
431
|
+
* @param value - untrusted boundary value.
|
|
432
|
+
* @returns the validated value; objects are rebuilt without undeclared fields.
|
|
433
|
+
* @throws TypeError when the value does not match.
|
|
434
|
+
*/
|
|
435
|
+
export function parseModelToolsValue(schema, value) {
|
|
436
|
+
switch (schema.kind) {
|
|
437
|
+
case 'string':
|
|
438
|
+
if (typeof value !== 'string') throw new TypeError('expected a string')
|
|
439
|
+
return value
|
|
440
|
+
case 'boolean':
|
|
441
|
+
if (typeof value !== 'boolean') throw new TypeError('expected a boolean')
|
|
442
|
+
return value
|
|
443
|
+
case 'number':
|
|
444
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) throw new TypeError('expected a finite number')
|
|
445
|
+
return value
|
|
446
|
+
case 'json':
|
|
447
|
+
return value
|
|
448
|
+
case 'null':
|
|
449
|
+
if (value !== null) throw new TypeError('expected null')
|
|
450
|
+
return null
|
|
451
|
+
case 'literal':
|
|
452
|
+
if (value !== schema.value) throw new TypeError('expected ' + JSON.stringify(schema.value))
|
|
453
|
+
return value
|
|
454
|
+
case 'optional':
|
|
455
|
+
return value === undefined ? undefined : parseModelToolsValue(schema.of, value)
|
|
456
|
+
case 'nullable':
|
|
457
|
+
return value === null ? null : parseModelToolsValue(schema.of, value)
|
|
458
|
+
case 'array':
|
|
459
|
+
if (!Array.isArray(value)) throw new TypeError('expected an array')
|
|
460
|
+
return value.map((item) => parseModelToolsValue(schema.of, item))
|
|
461
|
+
case 'record': {
|
|
462
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
463
|
+
throw new TypeError('expected a string-keyed record')
|
|
464
|
+
}
|
|
465
|
+
const parsed = {}
|
|
466
|
+
for (const [key, item] of Object.entries(value)) parsed[key] = parseModelToolsValue(schema.of, item)
|
|
467
|
+
return parsed
|
|
468
|
+
}
|
|
469
|
+
case 'object': {
|
|
470
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
471
|
+
throw new TypeError('expected an object')
|
|
472
|
+
}
|
|
473
|
+
const parsed = {}
|
|
474
|
+
for (const [key, field] of Object.entries(schema.fields)) {
|
|
475
|
+
const raw = value[key]
|
|
476
|
+
if (field.kind === 'optional') {
|
|
477
|
+
const item = parseModelToolsValue(field, raw)
|
|
478
|
+
if (item !== undefined) parsed[key] = item
|
|
479
|
+
continue
|
|
480
|
+
}
|
|
481
|
+
if (raw === undefined) throw new TypeError('missing field ' + JSON.stringify(key))
|
|
482
|
+
parsed[key] = parseModelToolsValue(field, raw)
|
|
483
|
+
}
|
|
484
|
+
return parsed
|
|
485
|
+
}
|
|
486
|
+
case 'union': {
|
|
487
|
+
let last
|
|
488
|
+
for (const variant of schema.of) {
|
|
489
|
+
try {
|
|
490
|
+
return parseModelToolsValue(variant, value)
|
|
491
|
+
} catch (error) {
|
|
492
|
+
last = error
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
throw new TypeError('value matched no union variant: ' + last.message)
|
|
496
|
+
}
|
|
497
|
+
default:
|
|
498
|
+
throw new TypeError('unknown schema kind ' + JSON.stringify(schema.kind))
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Build one strict boundary codec from a declarative schema.
|
|
504
|
+
* @param typeSymbol - stable type identity recorded on the codec.
|
|
505
|
+
* @param schema - declarative schema the parser enforces.
|
|
506
|
+
* @returns strict codec with a cached parser factory.
|
|
507
|
+
*/
|
|
508
|
+
export function codecForModelToolsValue(typeSymbol, schema) {
|
|
509
|
+
let parser
|
|
510
|
+
return {
|
|
511
|
+
mode: 'strict',
|
|
512
|
+
typeSymbol,
|
|
513
|
+
create: () => (parser ??= { parse: (value) => parseModelToolsValue(schema, value) }),
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Turn the static method specs into Host/client invocation descriptors.
|
|
519
|
+
* @param packageName - owning npm package.
|
|
520
|
+
* @param serviceKey - Cordis service key the Host dispatch resolves.
|
|
521
|
+
* @param namespace - wire namespace (also the Client Remote service suffix).
|
|
522
|
+
* @param specs - METHOD_SPECS.
|
|
523
|
+
* @returns fresh descriptors both the Host registry and the Client mount accept.
|
|
524
|
+
*/
|
|
525
|
+
export function descriptorsFromModelToolsSpecs(packageName, serviceKey, namespace, specs) {
|
|
526
|
+
return specs.map((spec) => {
|
|
527
|
+
const descriptor = {
|
|
528
|
+
id: packageName + '#' + namespace + '/' + spec.method,
|
|
529
|
+
service: serviceKey,
|
|
530
|
+
namespace,
|
|
531
|
+
method: spec.method,
|
|
532
|
+
description: spec.description,
|
|
533
|
+
invocation: { kind: 'direct' },
|
|
534
|
+
parameters: spec.parameters.map((parameter) => {
|
|
535
|
+
const entry = {
|
|
536
|
+
name: parameter.name,
|
|
537
|
+
wire: parameter.wire,
|
|
538
|
+
source: 'json',
|
|
539
|
+
codec: codecForModelToolsValue(parameter.typeSymbol, parameter.schema),
|
|
540
|
+
strictCodec: codecForModelToolsValue(parameter.strictTypeSymbol, parameter.schema),
|
|
541
|
+
}
|
|
542
|
+
if (parameter.description !== undefined) entry.description = parameter.description
|
|
543
|
+
if (parameter.acceptsUndefined === true) entry.acceptsUndefined = true
|
|
544
|
+
return entry
|
|
545
|
+
}),
|
|
546
|
+
cancellation: { parameter: 'signal' },
|
|
547
|
+
result: {
|
|
548
|
+
mode: 'strict',
|
|
549
|
+
typeSymbol: spec.result.typeSymbol,
|
|
550
|
+
create: codecForModelToolsValue(spec.result.typeSymbol, spec.result.schema).create,
|
|
551
|
+
description: spec.result.description,
|
|
552
|
+
},
|
|
553
|
+
}
|
|
554
|
+
if (spec.implementation !== undefined) descriptor.implementation = spec.implementation
|
|
555
|
+
return descriptor
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** Static method specs. JSON-safe so the browser chunk can embed them verbatim. */
|
|
560
|
+
export const METHOD_SPECS = [
|
|
561
|
+
{
|
|
562
|
+
method: 'describe',
|
|
563
|
+
description: 'Read the current extension state; the page calls it on mount and after each action.',
|
|
564
|
+
parameters: [],
|
|
565
|
+
result: {
|
|
566
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/describe:result',
|
|
567
|
+
description: 'the extension surface as the host currently sees it.',
|
|
568
|
+
schema: DESCRIBE_RESULT,
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
method: INSTALL_WIRE_METHOD,
|
|
573
|
+
implementation: 'install',
|
|
574
|
+
description: 'Install one extension from `source`, or the configured first-party source.',
|
|
575
|
+
parameters: [
|
|
576
|
+
{
|
|
577
|
+
name: 'id',
|
|
578
|
+
wire: 'id',
|
|
579
|
+
description: 'the extension id, for example `@try-works/extension-laya`.',
|
|
580
|
+
acceptsUndefined: false,
|
|
581
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/install:id',
|
|
582
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/install:id',
|
|
583
|
+
schema: STRING,
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'source',
|
|
587
|
+
wire: 'source',
|
|
588
|
+
description: 'an explicit install directory; absent means the configured first-party source.',
|
|
589
|
+
acceptsUndefined: true,
|
|
590
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/install:source',
|
|
591
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/install:source',
|
|
592
|
+
schema: OPTIONAL_STRING,
|
|
593
|
+
},
|
|
594
|
+
],
|
|
595
|
+
result: {
|
|
596
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/install:result',
|
|
597
|
+
description: 'the installed extension; installation is not activation.',
|
|
598
|
+
schema: INSTALL_RESULT,
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
method: 'enable',
|
|
603
|
+
description: 'Activate an installed extension (removes it from `disabledExtensions`).',
|
|
604
|
+
parameters: [
|
|
605
|
+
{
|
|
606
|
+
name: 'id',
|
|
607
|
+
wire: 'id',
|
|
608
|
+
description: 'the extension id to activate.',
|
|
609
|
+
acceptsUndefined: false,
|
|
610
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/enable:id',
|
|
611
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/enable:id',
|
|
612
|
+
schema: STRING,
|
|
613
|
+
},
|
|
614
|
+
],
|
|
615
|
+
result: {
|
|
616
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/enable:result',
|
|
617
|
+
description: 'the extension state after activation.',
|
|
618
|
+
schema: TOGGLE_RESULT,
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
method: 'disable',
|
|
623
|
+
description: 'Deactivate an extension (adds it to `disabledExtensions`).',
|
|
624
|
+
parameters: [
|
|
625
|
+
{
|
|
626
|
+
name: 'id',
|
|
627
|
+
wire: 'id',
|
|
628
|
+
description: 'the extension id to deactivate.',
|
|
629
|
+
acceptsUndefined: false,
|
|
630
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/disable:id',
|
|
631
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/disable:id',
|
|
632
|
+
schema: STRING,
|
|
633
|
+
},
|
|
634
|
+
],
|
|
635
|
+
result: {
|
|
636
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/disable:result',
|
|
637
|
+
description: 'the extension state after deactivation.',
|
|
638
|
+
schema: TOGGLE_RESULT,
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
method: 'prepare',
|
|
643
|
+
description: 'Acquire and verify the installed extension\'s model assets, then record the readiness a following enable needs.',
|
|
644
|
+
parameters: [
|
|
645
|
+
{
|
|
646
|
+
name: 'id',
|
|
647
|
+
wire: 'id',
|
|
648
|
+
description: 'the installed extension id to prepare.',
|
|
649
|
+
acceptsUndefined: false,
|
|
650
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/prepare:id',
|
|
651
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/prepare:id',
|
|
652
|
+
schema: STRING,
|
|
653
|
+
},
|
|
654
|
+
],
|
|
655
|
+
result: {
|
|
656
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/prepare:result',
|
|
657
|
+
description: 'the preparation outcome, its RES-02 disclosure, and the readiness recorded for each declared model.',
|
|
658
|
+
schema: PREPARE_RESULT,
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
method: 'setToolEnabled',
|
|
663
|
+
description: 'Enable or disable ONE tool of an installed extension through the running host.',
|
|
664
|
+
parameters: [
|
|
665
|
+
{
|
|
666
|
+
name: 'id',
|
|
667
|
+
wire: 'id',
|
|
668
|
+
description: 'the extension id.',
|
|
669
|
+
acceptsUndefined: false,
|
|
670
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:id',
|
|
671
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:id',
|
|
672
|
+
schema: STRING,
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: 'toolName',
|
|
676
|
+
wire: 'toolName',
|
|
677
|
+
description: 'the caller-facing tool name to toggle.',
|
|
678
|
+
acceptsUndefined: false,
|
|
679
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:toolName',
|
|
680
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:toolName',
|
|
681
|
+
schema: STRING,
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'enabled',
|
|
685
|
+
wire: 'enabled',
|
|
686
|
+
description: 'the desired enabled state.',
|
|
687
|
+
acceptsUndefined: false,
|
|
688
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:enabled',
|
|
689
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:enabled',
|
|
690
|
+
schema: BOOLEAN,
|
|
691
|
+
},
|
|
692
|
+
],
|
|
693
|
+
result: {
|
|
694
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/setToolEnabled:result',
|
|
695
|
+
description: 'the extension, tool and state after the toggle.',
|
|
696
|
+
schema: TOOL_TOGGLE_RESULT,
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
method: 'uninstall',
|
|
701
|
+
description: 'Uninstall an extension through the running host; an active extension requires explicit deactivation.',
|
|
702
|
+
parameters: [
|
|
703
|
+
{
|
|
704
|
+
name: 'id',
|
|
705
|
+
wire: 'id',
|
|
706
|
+
description: 'the extension id.',
|
|
707
|
+
acceptsUndefined: false,
|
|
708
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/uninstall:id',
|
|
709
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/uninstall:id',
|
|
710
|
+
schema: STRING,
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
name: 'deactivate',
|
|
714
|
+
wire: 'deactivate',
|
|
715
|
+
description: 'whether to deactivate first; absent means false.',
|
|
716
|
+
acceptsUndefined: true,
|
|
717
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/uninstall:deactivate',
|
|
718
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/uninstall:deactivate',
|
|
719
|
+
schema: { kind: 'optional', of: BOOLEAN },
|
|
720
|
+
},
|
|
721
|
+
],
|
|
722
|
+
result: {
|
|
723
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/uninstall:result',
|
|
724
|
+
description: 'the extension removed and its resulting active state.',
|
|
725
|
+
schema: UNINSTALL_RESULT,
|
|
726
|
+
},
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
method: 'toolSources',
|
|
730
|
+
description: 'List the registered tools with owner attribution (extension, Tool Mode, MCP, pinned first party, unknown).',
|
|
731
|
+
parameters: [],
|
|
732
|
+
result: {
|
|
733
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/toolSources:result',
|
|
734
|
+
description: 'the tool catalog with owner attribution.',
|
|
735
|
+
schema: TOOL_SOURCES_RESULT,
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
method: 'toolInventory',
|
|
740
|
+
description: 'Read the live tool inventory: registered tools plus installed extension tools, with state, kind and usage.',
|
|
741
|
+
parameters: [],
|
|
742
|
+
result: {
|
|
743
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/toolInventory:result',
|
|
744
|
+
description: 'every inventory row, including tools that were never called.',
|
|
745
|
+
schema: TOOL_INVENTORY_RESULT,
|
|
746
|
+
},
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
method: 'mcpStatus',
|
|
750
|
+
description: 'Read the MCP surface status: the bound endpoint, auth mode, clients, and exposed/withheld tools.',
|
|
751
|
+
parameters: [],
|
|
752
|
+
result: {
|
|
753
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/mcpStatus:result',
|
|
754
|
+
description: 'the MCP status derived from the bound endpoint, identities, surface and ledger.',
|
|
755
|
+
schema: MCP_STATUS_RESULT,
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
method: 'mcpCalls',
|
|
760
|
+
description: 'Read the external MCP call log, newest first, from the persisted ledger.',
|
|
761
|
+
parameters: [
|
|
762
|
+
{
|
|
763
|
+
name: 'query',
|
|
764
|
+
wire: 'query',
|
|
765
|
+
description: 'an optional client filter and page; absent means page 1 with the default size.',
|
|
766
|
+
acceptsUndefined: true,
|
|
767
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/mcpCalls:query',
|
|
768
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/mcpCalls:query',
|
|
769
|
+
schema: { kind: 'optional', of: MCP_CALLS_QUERY },
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
result: {
|
|
773
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/mcpCalls:result',
|
|
774
|
+
description: 'one page of external calls plus the matching total and ledger client identities.',
|
|
775
|
+
schema: MCP_CALLS_RESULT,
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
method: 'toolUsageReport',
|
|
780
|
+
description: 'Aggregate tool usage over an explicit range from the session projection detail.',
|
|
781
|
+
parameters: [
|
|
782
|
+
{
|
|
783
|
+
name: 'query',
|
|
784
|
+
wire: 'query',
|
|
785
|
+
description: 'an optional named range or explicit from/to epoch milliseconds.',
|
|
786
|
+
acceptsUndefined: true,
|
|
787
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/toolUsageReport:query',
|
|
788
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/toolUsageReport:query',
|
|
789
|
+
schema: { kind: 'optional', of: USAGE_REPORT_QUERY },
|
|
790
|
+
},
|
|
791
|
+
],
|
|
792
|
+
result: {
|
|
793
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/toolUsageReport:result',
|
|
794
|
+
description: 'the range rollups: totals, by tool/model/owner/workspace/day/error code, and recent calls.',
|
|
795
|
+
schema: USAGE_REPORT,
|
|
796
|
+
},
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
method: 'customToolsDescribe',
|
|
800
|
+
description: 'List the profile-scoped custom tools and their enabled/exposure state.',
|
|
801
|
+
parameters: [],
|
|
802
|
+
result: {
|
|
803
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDescribe:result',
|
|
804
|
+
description: 'the custom-tool store and its active records.',
|
|
805
|
+
schema: CUSTOM_TOOLS_SNAPSHOT,
|
|
806
|
+
},
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
method: 'customToolsGet',
|
|
810
|
+
description: 'Read one full custom-tool record for editing; credential values are never included.',
|
|
811
|
+
parameters: [{
|
|
812
|
+
name: 'id', wire: 'id', description: 'custom-tool id.', acceptsUndefined: false,
|
|
813
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsGet:id',
|
|
814
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsGet:id', schema: STRING,
|
|
815
|
+
}],
|
|
816
|
+
result: {
|
|
817
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsGet:result',
|
|
818
|
+
description: 'the active record, or null when it is not present.',
|
|
819
|
+
schema: { kind: 'nullable', of: { kind: 'json' } },
|
|
820
|
+
},
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
method: 'customToolsDraft',
|
|
824
|
+
description: 'Ask the host model to draft a custom tool from a description; never saves or executes it.',
|
|
825
|
+
parameters: [{
|
|
826
|
+
name: 'description', wire: 'description', description: 'natural-language description.', acceptsUndefined: false,
|
|
827
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDraft:description',
|
|
828
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDraft:description', schema: STRING,
|
|
829
|
+
}],
|
|
830
|
+
result: {
|
|
831
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDraft:result',
|
|
832
|
+
description: 'a validated draft or a named failure; the draft is not saved.',
|
|
833
|
+
schema: { kind: 'json' },
|
|
834
|
+
},
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
method: 'customToolsValidate',
|
|
838
|
+
description: 'Validate a custom-tool draft without persisting or executing it.',
|
|
839
|
+
parameters: [{
|
|
840
|
+
name: 'draft',
|
|
841
|
+
wire: 'draft',
|
|
842
|
+
description: 'the user-authored draft.',
|
|
843
|
+
acceptsUndefined: false,
|
|
844
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsValidate:draft',
|
|
845
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsValidate:draft',
|
|
846
|
+
schema: { kind: 'json' },
|
|
847
|
+
}],
|
|
848
|
+
result: {
|
|
849
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsValidate:result',
|
|
850
|
+
description: 'the validation verdict and field issues.',
|
|
851
|
+
schema: { kind: 'object', fields: { ok: BOOLEAN, issues: { kind: 'array', of: { kind: 'object', fields: { path: STRING, message: STRING } } } } },
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
method: 'customToolsTest',
|
|
856
|
+
description: 'Execute a custom-tool draft once with sample arguments; never persists or registers it.',
|
|
857
|
+
parameters: [
|
|
858
|
+
{
|
|
859
|
+
name: 'draft', wire: 'draft', description: 'the draft to execute.', acceptsUndefined: false,
|
|
860
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsTest:draft',
|
|
861
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsTest:draft', schema: { kind: 'json' },
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
name: 'args', wire: 'args', description: 'sample arguments.', acceptsUndefined: false,
|
|
865
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsTest:args',
|
|
866
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsTest:args', schema: { kind: 'json' },
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
result: {
|
|
870
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsTest:result',
|
|
871
|
+
description: 'the test value or a named failure.',
|
|
872
|
+
schema: CUSTOM_TOOL_TEST_RESULT,
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
method: 'customToolsSave',
|
|
877
|
+
description: 'Validate, persist and register a new immutable custom-tool version.',
|
|
878
|
+
parameters: [{
|
|
879
|
+
name: 'draft', wire: 'draft', description: 'the draft to save.', acceptsUndefined: false,
|
|
880
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSave:draft',
|
|
881
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSave:draft', schema: { kind: 'json' },
|
|
882
|
+
}],
|
|
883
|
+
result: {
|
|
884
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSave:result',
|
|
885
|
+
description: 'the persisted record.',
|
|
886
|
+
schema: { kind: 'json' },
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
method: 'customToolsSetEnabled',
|
|
891
|
+
description: 'Enable or disable a saved custom tool and reconcile its registration.',
|
|
892
|
+
parameters: [
|
|
893
|
+
{
|
|
894
|
+
name: 'id', wire: 'id', description: 'custom-tool id.', acceptsUndefined: false,
|
|
895
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSetEnabled:id',
|
|
896
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSetEnabled:id', schema: STRING,
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
name: 'enabled', wire: 'enabled', description: 'desired state.', acceptsUndefined: false,
|
|
900
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSetEnabled:enabled',
|
|
901
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSetEnabled:enabled', schema: BOOLEAN,
|
|
902
|
+
},
|
|
903
|
+
],
|
|
904
|
+
result: {
|
|
905
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsSetEnabled:result',
|
|
906
|
+
description: 'the updated record.',
|
|
907
|
+
schema: { kind: 'json' },
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
method: 'customToolsDelete',
|
|
912
|
+
description: 'Delete the active pointer for a custom tool and remove its registration.',
|
|
913
|
+
parameters: [{
|
|
914
|
+
name: 'id', wire: 'id', description: 'custom-tool id.', acceptsUndefined: false,
|
|
915
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDelete:id',
|
|
916
|
+
strictTypeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDelete:id', schema: STRING,
|
|
917
|
+
}],
|
|
918
|
+
result: {
|
|
919
|
+
typeSymbol: PACKAGE + '#' + NAMESPACE + '/customToolsDelete:result',
|
|
920
|
+
description: 'whether an active record was removed.',
|
|
921
|
+
schema: BOOLEAN,
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
]
|
|
925
|
+
|
|
926
|
+
/** The mountable Client contribution (and the Host artifact's invocation source). */
|
|
927
|
+
export function buildContribution() {
|
|
928
|
+
return {
|
|
929
|
+
package: PACKAGE,
|
|
930
|
+
descriptors: descriptorsFromModelToolsSpecs(PACKAGE, SERVICE, NAMESPACE, METHOD_SPECS),
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/** Host documentation for the methods, kept beside their specs. */
|
|
935
|
+
const METHOD_SIGNATURES = {
|
|
936
|
+
describe: 'describe(signal?: AbortSignal): Promise<ExtensionsDescribeResult>',
|
|
937
|
+
installExtension: 'install(id: string, source?: string, signal?: AbortSignal): Promise<ExtensionInstallResult>',
|
|
938
|
+
enable: 'enable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>',
|
|
939
|
+
disable: 'disable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>',
|
|
940
|
+
prepare: 'prepare(id: string, signal?: AbortSignal): Promise<ExtensionPrepareResult>',
|
|
941
|
+
setToolEnabled: 'setToolEnabled(id: string, toolName: string, enabled: boolean, signal?: AbortSignal): Promise<ExtensionToolToggleResult>',
|
|
942
|
+
uninstall: 'uninstall(id: string, deactivate?: boolean, signal?: AbortSignal): Promise<ExtensionUninstallResult>',
|
|
943
|
+
toolSources: 'toolSources(signal?: AbortSignal): Promise<ToolSourcesResult>',
|
|
944
|
+
toolInventory: 'toolInventory(signal?: AbortSignal): Promise<ToolInventoryResult>',
|
|
945
|
+
mcpStatus: 'mcpStatus(signal?: AbortSignal): Promise<McpStatusView>',
|
|
946
|
+
mcpCalls: 'mcpCalls(query?: McpCallsQuery, signal?: AbortSignal): Promise<McpCallsPage>',
|
|
947
|
+
toolUsageReport: 'toolUsageReport(query?: UsageReportQuery, signal?: AbortSignal): Promise<UsageReport>',
|
|
948
|
+
customToolsDescribe: 'customToolsDescribe(signal?: AbortSignal): Promise<CustomToolsSnapshot>',
|
|
949
|
+
customToolsGet: 'customToolsGet(id: string, signal?: AbortSignal): Promise<unknown | null>',
|
|
950
|
+
customToolsDraft: 'customToolsDraft(description: string, signal?: AbortSignal): Promise<unknown>',
|
|
951
|
+
customToolsValidate: 'customToolsValidate(draft: unknown, signal?: AbortSignal): Promise<CustomToolValidation>',
|
|
952
|
+
customToolsTest: 'customToolsTest(draft: unknown, args: unknown, signal?: AbortSignal): Promise<CustomToolTestResult>',
|
|
953
|
+
customToolsSave: 'customToolsSave(draft: unknown, signal?: AbortSignal): Promise<unknown>',
|
|
954
|
+
customToolsSetEnabled: 'customToolsSetEnabled(id: string, enabled: boolean, signal?: AbortSignal): Promise<unknown>',
|
|
955
|
+
customToolsDelete: 'customToolsDelete(id: string, signal?: AbortSignal): Promise<boolean>',
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
const SERVICE_MODEL = {
|
|
959
|
+
description: 'Host service backing the generated `ctx.remote.modelTools` namespace. It reports the extension store truthfully (store null when unconfigured), performs staged installs, persisted enable/disable, and model-asset preparation with the RES-02 disclosure. The ADDITIVE Tool Insights methods (toolSources/toolInventory/mcpStatus/mcpCalls/toolUsageReport) may be absent on an older host.',
|
|
960
|
+
summary: 'Host service backing the generated `ctx.remote.modelTools` namespace.',
|
|
961
|
+
tags: [],
|
|
962
|
+
jsDoc: '/** Host service backing the generated `ctx.remote.modelTools` namespace. */',
|
|
963
|
+
key: SERVICE,
|
|
964
|
+
exportName: 'ExtensionsService',
|
|
965
|
+
members: METHOD_SPECS.map((spec) => ({
|
|
966
|
+
kind: 'method',
|
|
967
|
+
name: spec.implementation ?? spec.method,
|
|
968
|
+
signature: METHOD_SIGNATURES[spec.method],
|
|
969
|
+
description: spec.description,
|
|
970
|
+
jsDoc: `/** ${spec.description} */`,
|
|
971
|
+
})),
|
|
972
|
+
types: [],
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Build the Host Loader manifest the `typert-loader` validates and registers.
|
|
977
|
+
* @returns `TYPERT` host-face contribution.
|
|
978
|
+
*/
|
|
979
|
+
export function buildHostManifest() {
|
|
980
|
+
return {
|
|
981
|
+
package: PACKAGE,
|
|
982
|
+
face: 'host',
|
|
983
|
+
schemas: [],
|
|
984
|
+
get invocations() {
|
|
985
|
+
return buildContribution().descriptors
|
|
986
|
+
},
|
|
987
|
+
model: {
|
|
988
|
+
services: [SERVICE_MODEL],
|
|
989
|
+
events: [],
|
|
990
|
+
objects: [],
|
|
991
|
+
},
|
|
992
|
+
}
|
|
993
|
+
}
|