@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,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving a declarative package's recipes through a deployment-supplied harness provider.
|
|
3
|
+
*
|
|
4
|
+
* THE LAST LINK OF SLICE 3, and the reason it is a module rather than a few lines in the host:
|
|
5
|
+
* this is where a resolved RECIPE becomes a callable TOOL, and the pieces have to be joined in a
|
|
6
|
+
* specific order for the authorization to mean anything.
|
|
7
|
+
*
|
|
8
|
+
* WHAT THIS DELIBERATELY IS NOT. It does not construct an `LlmProvider`. Which model answers a
|
|
9
|
+
* harness call is a deployment's business, and this plugin holds no model-specific code — that
|
|
10
|
+
* is an architectural rule the repository enforces with a gate. Instead a deployment SUPPLIES a
|
|
11
|
+
* provider and this module does the joining: authorize the recipe's tool name, run through the
|
|
12
|
+
* broker, and refuse honestly when no provider was supplied.
|
|
13
|
+
*
|
|
14
|
+
* WHY THE REFUSAL IS STILL THE DEFAULT. A declarative package resolves and its recipes parse,
|
|
15
|
+
* and without a provider nothing can call a model. Serving the tool anyway would present a tool
|
|
16
|
+
* that fails at invocation, so the refusal happens at RESOLUTION — where a reader can see why —
|
|
17
|
+
* rather than at the first call.
|
|
18
|
+
*
|
|
19
|
+
* @module @try-works/dsh-tool-mode/harness-serving
|
|
20
|
+
*/
|
|
21
|
+
import { type BrokerErrorCode, type BrokerHostPolicy, type BrokerRecord, type LlmProvider } from '@try-works/tool-mode-recipes';
|
|
22
|
+
/** A deployment's harness composition. */
|
|
23
|
+
export interface HarnessComposition {
|
|
24
|
+
/**
|
|
25
|
+
* The provider that answers harness calls, supplied by the DEPLOYMENT.
|
|
26
|
+
*
|
|
27
|
+
* Absent when a deployment composes none — which is the state this plugin ships in, and the
|
|
28
|
+
* state the refusal exists for.
|
|
29
|
+
*/
|
|
30
|
+
readonly provider?: LlmProvider;
|
|
31
|
+
/**
|
|
32
|
+
* Where invocation records go.
|
|
33
|
+
*
|
|
34
|
+
* The broker REFUSES TO CONSTRUCT without one, because a broker that records nothing cannot be
|
|
35
|
+
* audited. Making it required here means a caller cannot compose a harness path that silently
|
|
36
|
+
* reports nothing — the failure is at construction rather than at audit time.
|
|
37
|
+
*/
|
|
38
|
+
readonly journal: (record: BrokerRecord) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Operator-bound logical executor profiles (HLM-02/RCP-05). A recipe selecting
|
|
41
|
+
* `approved-profile` resolves ONLY through this map; the version is visible so a
|
|
42
|
+
* profile change is auditable.
|
|
43
|
+
*/
|
|
44
|
+
readonly profiles?: Readonly<Record<string, {
|
|
45
|
+
readonly provider: LlmProvider;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
}>>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A harness call the caller CANCELLED.
|
|
51
|
+
*
|
|
52
|
+
* Distinct from `HarnessFailedError` on purpose: a caller who walked away is not a malfunction,
|
|
53
|
+
* and conflating the two makes every cancellation look like a fault. The same discipline the
|
|
54
|
+
* invocation accounting applies to `cancelled`.
|
|
55
|
+
*/
|
|
56
|
+
export declare class HarnessCancelledError extends Error {
|
|
57
|
+
readonly toolName: string;
|
|
58
|
+
readonly reason: string;
|
|
59
|
+
readonly name = "HarnessCancelledError";
|
|
60
|
+
constructor(toolName: string, reason: string);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A harness call that FAILED, carrying the broker's machine-readable code.
|
|
64
|
+
*
|
|
65
|
+
* The code is preserved rather than flattened into a message, so a caller branches on the CAUSE
|
|
66
|
+
* instead of matching prose.
|
|
67
|
+
*/
|
|
68
|
+
export declare class HarnessFailedError extends Error {
|
|
69
|
+
readonly toolName: string;
|
|
70
|
+
readonly code: BrokerErrorCode;
|
|
71
|
+
readonly reason: string;
|
|
72
|
+
readonly name = "HarnessFailedError";
|
|
73
|
+
constructor(toolName: string, code: BrokerErrorCode, reason: string);
|
|
74
|
+
}
|
|
75
|
+
/** A recipe made callable. */
|
|
76
|
+
export interface ServedRecipe {
|
|
77
|
+
readonly implementationId: string;
|
|
78
|
+
/** The operator-bound profile used, when the recipe selected one. */
|
|
79
|
+
readonly providerProfile?: {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly version: string;
|
|
82
|
+
};
|
|
83
|
+
readonly contractId: string;
|
|
84
|
+
readonly toolName: string;
|
|
85
|
+
/** DECL-08: sha256 of the installed recipe bytes. */
|
|
86
|
+
readonly recipeDigest?: string;
|
|
87
|
+
/** Run the recipe. Throws with the broker's own reason when it cannot. */
|
|
88
|
+
readonly invoke: (args: Record<string, unknown>, signal?: AbortSignal, grantOptions?: {
|
|
89
|
+
readonly policy?: BrokerHostPolicy;
|
|
90
|
+
readonly deadlineMs?: number;
|
|
91
|
+
}) => Promise<unknown>;
|
|
92
|
+
}
|
|
93
|
+
/** The outcome of preparing a declarative package's recipes. */
|
|
94
|
+
export type ServeOutcome = {
|
|
95
|
+
readonly ok: true;
|
|
96
|
+
readonly served: readonly ServedRecipe[];
|
|
97
|
+
} | {
|
|
98
|
+
readonly ok: false;
|
|
99
|
+
readonly code: 'no-provider' | 'recipe-rejected';
|
|
100
|
+
readonly detail: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Prepare a declarative package's resolved recipes for serving.
|
|
104
|
+
*
|
|
105
|
+
* @param composition - the deployment's harness composition.
|
|
106
|
+
* @param resolved - the recipes resolved through the convention.
|
|
107
|
+
* @returns the served recipes, or the reason none can be served.
|
|
108
|
+
*/
|
|
109
|
+
export declare function prepareDeclarative(composition: HarnessComposition, resolved: readonly {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly contractId: string;
|
|
112
|
+
readonly recipe: unknown;
|
|
113
|
+
readonly recipeDigest?: string;
|
|
114
|
+
}[]): ServeOutcome;
|
|
115
|
+
//# sourceMappingURL=harness-serving.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-serving.d.ts","sourceRoot":"","sources":["../src/harness-serving.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEjB,MAAM,8BAA8B,CAAA;AAErC,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;IAChD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;CAC3G;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAElC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAD9D,SAAkB,IAAI,2BAA0B;gBAC3B,QAAQ,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM;CAG/D;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAE/B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAD9F,SAAkB,IAAI,wBAAu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,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAClI,YAAY,CAgHd"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving a declarative package's recipes through a deployment-supplied harness provider.
|
|
3
|
+
*
|
|
4
|
+
* THE LAST LINK OF SLICE 3, and the reason it is a module rather than a few lines in the host:
|
|
5
|
+
* this is where a resolved RECIPE becomes a callable TOOL, and the pieces have to be joined in a
|
|
6
|
+
* specific order for the authorization to mean anything.
|
|
7
|
+
*
|
|
8
|
+
* WHAT THIS DELIBERATELY IS NOT. It does not construct an `LlmProvider`. Which model answers a
|
|
9
|
+
* harness call is a deployment's business, and this plugin holds no model-specific code — that
|
|
10
|
+
* is an architectural rule the repository enforces with a gate. Instead a deployment SUPPLIES a
|
|
11
|
+
* provider and this module does the joining: authorize the recipe's tool name, run through the
|
|
12
|
+
* broker, and refuse honestly when no provider was supplied.
|
|
13
|
+
*
|
|
14
|
+
* WHY THE REFUSAL IS STILL THE DEFAULT. A declarative package resolves and its recipes parse,
|
|
15
|
+
* and without a provider nothing can call a model. Serving the tool anyway would present a tool
|
|
16
|
+
* that fails at invocation, so the refusal happens at RESOLUTION — where a reader can see why —
|
|
17
|
+
* rather than at the first call.
|
|
18
|
+
*
|
|
19
|
+
* @module @try-works/dsh-tool-mode/harness-serving
|
|
20
|
+
*/
|
|
21
|
+
import { HarnessBroker, parseRecipe, } from '@try-works/tool-mode-recipes';
|
|
22
|
+
/**
|
|
23
|
+
* A harness call the caller CANCELLED.
|
|
24
|
+
*
|
|
25
|
+
* Distinct from `HarnessFailedError` on purpose: a caller who walked away is not a malfunction,
|
|
26
|
+
* and conflating the two makes every cancellation look like a fault. The same discipline the
|
|
27
|
+
* invocation accounting applies to `cancelled`.
|
|
28
|
+
*/
|
|
29
|
+
export class HarnessCancelledError extends Error {
|
|
30
|
+
toolName;
|
|
31
|
+
reason;
|
|
32
|
+
name = 'HarnessCancelledError';
|
|
33
|
+
constructor(toolName, reason) {
|
|
34
|
+
super(`the harness recipe ${toolName} was cancelled: ${reason}`);
|
|
35
|
+
this.toolName = toolName;
|
|
36
|
+
this.reason = reason;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A harness call that FAILED, carrying the broker's machine-readable code.
|
|
41
|
+
*
|
|
42
|
+
* The code is preserved rather than flattened into a message, so a caller branches on the CAUSE
|
|
43
|
+
* instead of matching prose.
|
|
44
|
+
*/
|
|
45
|
+
export class HarnessFailedError extends Error {
|
|
46
|
+
toolName;
|
|
47
|
+
code;
|
|
48
|
+
reason;
|
|
49
|
+
name = 'HarnessFailedError';
|
|
50
|
+
constructor(toolName, code, reason) {
|
|
51
|
+
super(`the harness recipe ${toolName} failed (${code}): ${reason}`);
|
|
52
|
+
this.toolName = toolName;
|
|
53
|
+
this.code = code;
|
|
54
|
+
this.reason = reason;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Prepare a declarative package's resolved recipes for serving.
|
|
59
|
+
*
|
|
60
|
+
* @param composition - the deployment's harness composition.
|
|
61
|
+
* @param resolved - the recipes resolved through the convention.
|
|
62
|
+
* @returns the served recipes, or the reason none can be served.
|
|
63
|
+
*/
|
|
64
|
+
export function prepareDeclarative(composition, resolved) {
|
|
65
|
+
/**
|
|
66
|
+
* NO PROVIDER MEANS NO SERVING, and the refusal names the composition rather than the package.
|
|
67
|
+
* A reader who is told "the package is declarative" would look in the wrong place: the package
|
|
68
|
+
* is complete and its recipes resolve.
|
|
69
|
+
*/
|
|
70
|
+
if (composition.provider === undefined && composition.profiles === undefined) {
|
|
71
|
+
return {
|
|
72
|
+
ok: false,
|
|
73
|
+
code: 'no-provider',
|
|
74
|
+
detail: 'this deployment composes no harness LlmProvider, so a declarative package\'s recipes '
|
|
75
|
+
+ 'cannot be executed. The recipes resolved and the broker is available; what is absent '
|
|
76
|
+
+ 'is the provider that would answer a model call.',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const broker = new HarnessBroker({ record: composition.journal });
|
|
80
|
+
const served = [];
|
|
81
|
+
for (const entry of resolved) {
|
|
82
|
+
/**
|
|
83
|
+
* THE RECIPE IS VALIDATED HERE, and it previously was not — a HIGH-severity gap found by
|
|
84
|
+
* adversarial review.
|
|
85
|
+
*
|
|
86
|
+
* This line used to be a bare cast: `entry.recipe as RecipeManifest`. The production resolver
|
|
87
|
+
* hands over raw `JSON.parse` output, so NOTHING validated the file between disk and
|
|
88
|
+
* execution. The review took `text-title.json` and applied one mutation at a time — an
|
|
89
|
+
* unexpected `tools` array, a `systemPrompt`, a `${process.env.SECRET_KEY}` interpolation, an
|
|
90
|
+
* uppercase or path-like tool name, `__proto__`, an absurd `maxOutputTokens`, a missing
|
|
91
|
+
* `policy`, a missing `inputs`. `parseRecipe` REFUSED ALL TEN; `prepareDeclarative` SERVED ALL
|
|
92
|
+
* TEN, and they executed. The validator was available and imported by the test that was
|
|
93
|
+
* supposed to cover this path — and bypassed by the only path that runs a recipe.
|
|
94
|
+
*
|
|
95
|
+
* A cast is a claim about a value the compiler cannot check, and here the claim was false for
|
|
96
|
+
* exactly the inputs an untrusted package would supply.
|
|
97
|
+
*/
|
|
98
|
+
const parsed = parseRecipe(entry.recipe);
|
|
99
|
+
if (!parsed.ok) {
|
|
100
|
+
return {
|
|
101
|
+
ok: false,
|
|
102
|
+
code: 'recipe-rejected',
|
|
103
|
+
detail: `${entry.id}: the recipe did not validate: ${JSON.stringify(parsed).slice(0, 300)}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const recipe = parsed.recipe;
|
|
107
|
+
/**
|
|
108
|
+
* AUTHORIZATION IS PER TOOL NAME, and it happens BEFORE anything is served. A recipe whose
|
|
109
|
+
* name was never authorized must not become callable, or the broker would refuse at
|
|
110
|
+
* invocation — a failure far from its cause.
|
|
111
|
+
*/
|
|
112
|
+
const toolName = recipe.tool.name;
|
|
113
|
+
let recipeProvider = composition.provider;
|
|
114
|
+
let providerProfile;
|
|
115
|
+
if (recipe.modelSelection?.strategy === 'approved-profile') {
|
|
116
|
+
const binding = composition.profiles?.[recipe.modelSelection.profile];
|
|
117
|
+
// An unresolved logical profile makes the tool UNAVAILABLE, never routable to
|
|
118
|
+
// another provider and never a silent fallback (RCP-05/HLM-02).
|
|
119
|
+
if (binding === undefined)
|
|
120
|
+
continue;
|
|
121
|
+
recipeProvider = binding.provider;
|
|
122
|
+
providerProfile = { name: recipe.modelSelection.profile, version: binding.version };
|
|
123
|
+
}
|
|
124
|
+
if (recipeProvider === undefined)
|
|
125
|
+
continue;
|
|
126
|
+
try {
|
|
127
|
+
broker.authorize(toolName, recipeProvider);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
return {
|
|
131
|
+
ok: false,
|
|
132
|
+
code: 'recipe-rejected',
|
|
133
|
+
detail: `${entry.id}: the broker refused to authorize ${toolName}: `
|
|
134
|
+
+ `${error instanceof Error ? error.message : String(error)}`,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
served.push({
|
|
138
|
+
implementationId: entry.id,
|
|
139
|
+
contractId: entry.contractId,
|
|
140
|
+
toolName,
|
|
141
|
+
...providerProfile === undefined ? {} : { providerProfile },
|
|
142
|
+
...entry.recipeDigest === undefined ? {} : { recipeDigest: entry.recipeDigest },
|
|
143
|
+
async invoke(args, signal, grantOptions) {
|
|
144
|
+
const outcome = await broker.run(recipe, args, {
|
|
145
|
+
...signal === undefined ? {} : { signal },
|
|
146
|
+
...grantOptions?.policy === undefined ? {} : { policy: grantOptions.policy },
|
|
147
|
+
...grantOptions?.deadlineMs === undefined ? {} : { deadlineMs: grantOptions.deadlineMs },
|
|
148
|
+
});
|
|
149
|
+
if (outcome.kind === 'completed')
|
|
150
|
+
return outcome.text;
|
|
151
|
+
/**
|
|
152
|
+
* THE BROKER'S NON-COMPLETED VARIANTS ARE `failed` AND `cancelled` — and an earlier
|
|
153
|
+
* version of this comment named `refused`, `truncated` and `tool_call` instead.
|
|
154
|
+
*
|
|
155
|
+
* Those are variants of `LlmCompletion`, the PROVIDER's reply, not of `BrokerOutcome`,
|
|
156
|
+
* what `run` returns. They were plausible and wrong, and the difference is not academic:
|
|
157
|
+
* a reader trusting the comment would handle cases that cannot occur here and miss the
|
|
158
|
+
* one that can.
|
|
159
|
+
*
|
|
160
|
+
* CANCELLATION IS NOT A FAILURE, and it used to be thrown as an indistinguishable Error.
|
|
161
|
+
* The same discipline applies here as in the invocation accounting: a caller who walked
|
|
162
|
+
* away must be able to tell that from a malfunction, or every cancellation inflates the
|
|
163
|
+
* error rate. `HarnessCancelledError` exists so it can.
|
|
164
|
+
*/
|
|
165
|
+
if (outcome.kind === 'cancelled') {
|
|
166
|
+
throw new HarnessCancelledError(toolName, outcome.reason);
|
|
167
|
+
}
|
|
168
|
+
// `failed` carries the broker's own machine-readable code, so a caller can branch on the
|
|
169
|
+
// CAUSE rather than matching on a message.
|
|
170
|
+
throw new HarnessFailedError(toolName, outcome.code, outcome.reason);
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return { ok: true, served };
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=harness-serving.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The REAL headless `serve` composition entry (RUN-03, task-74).
|
|
3
|
+
*
|
|
4
|
+
* Composes the host services the plugin needs WITHOUT the DSH CLI context:
|
|
5
|
+
* config load (file/env), the extension-store-less operator surface, the model
|
|
6
|
+
* catalog with capability resolution, the standard-contract bindings with the
|
|
7
|
+
* SAME selection rule the plugin applies (providers override, else the first
|
|
8
|
+
* eligible implementation), the MCP host over those bindings plus `model_tools`
|
|
9
|
+
* and the `tool_mode_run` contract, and a bounded graceful shutdown on
|
|
10
|
+
* SIGINT/SIGTERM.
|
|
11
|
+
*
|
|
12
|
+
* Two boundaries are deliberate and named, not faked:
|
|
13
|
+
* - `tool_mode_run` is REGISTERED (its contract appears on tools/list) but its
|
|
14
|
+
* execution refuses: a headless process composes no DSH hosted-code runtime
|
|
15
|
+
* (the plugin's ProgramRunner needs the DSH PtcHostContext), and pretending
|
|
16
|
+
* otherwise would claim a confinement the deployment does not have.
|
|
17
|
+
* - Extension-routed models resolve through the same bridge as the plugin; a
|
|
18
|
+
* model the headless deployment cannot run simply has no tool, exactly like
|
|
19
|
+
* the plugin.
|
|
20
|
+
*
|
|
21
|
+
* @module @try-works/dsh-tool-mode/headless
|
|
22
|
+
*/
|
|
23
|
+
/** The headless config document (the same Config surface, parsed loosely). */
|
|
24
|
+
interface HeadlessConfig {
|
|
25
|
+
readonly catalogFile?: string;
|
|
26
|
+
readonly allowNpm?: boolean;
|
|
27
|
+
readonly providers?: Record<string, string>;
|
|
28
|
+
readonly grantId?: string;
|
|
29
|
+
readonly recordReceipts?: boolean;
|
|
30
|
+
readonly approvedRoots?: string[];
|
|
31
|
+
readonly cli?: {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
command?: string;
|
|
34
|
+
};
|
|
35
|
+
readonly remote?: {
|
|
36
|
+
endpoint?: string;
|
|
37
|
+
token?: string;
|
|
38
|
+
};
|
|
39
|
+
readonly registerControlTool?: boolean;
|
|
40
|
+
readonly mcpV3?: {
|
|
41
|
+
host?: string;
|
|
42
|
+
port?: number;
|
|
43
|
+
path?: string;
|
|
44
|
+
};
|
|
45
|
+
readonly repairAttempts?: number;
|
|
46
|
+
readonly harnessExecutorV3?: {
|
|
47
|
+
defaultRepairAttempts?: number;
|
|
48
|
+
};
|
|
49
|
+
readonly [key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
/** A named headless-configuration error. */
|
|
52
|
+
export declare class HeadlessConfigError extends Error {
|
|
53
|
+
readonly name = "HeadlessConfigError";
|
|
54
|
+
}
|
|
55
|
+
/** Read and validate the headless config document. */
|
|
56
|
+
export declare function readHeadlessConfig(configPath: string | undefined, env: NodeJS.ProcessEnv): {
|
|
57
|
+
config: HeadlessConfig;
|
|
58
|
+
path: string;
|
|
59
|
+
};
|
|
60
|
+
/** One started headless serve, with its shutdown. */
|
|
61
|
+
export interface HeadlessServe {
|
|
62
|
+
/** The URL clients should use. */
|
|
63
|
+
readonly url: string;
|
|
64
|
+
/** The host/port actually bound. */
|
|
65
|
+
readonly host: string;
|
|
66
|
+
readonly port: number;
|
|
67
|
+
/** Close the server and settle owned resources (bounded). */
|
|
68
|
+
close(): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start the headless serve composition (RUN-03).
|
|
72
|
+
*
|
|
73
|
+
* @param configPath - the config file path; falls back to DSH_TOOL_MODE_CONFIG
|
|
74
|
+
* then ./tool-mode.json.
|
|
75
|
+
* @returns the bound endpoint and a shutdown handle.
|
|
76
|
+
* @throws HeadlessConfigError for a missing/invalid configuration.
|
|
77
|
+
*/
|
|
78
|
+
export declare function startHeadlessServe(configPath?: string): Promise<HeadlessServe>;
|
|
79
|
+
/**
|
|
80
|
+
* Run the headless serve as a PROCESS (the launcher entry): prints the bound
|
|
81
|
+
* endpoint and waits for SIGINT/SIGTERM, then exits 0 after a bounded shutdown.
|
|
82
|
+
*
|
|
83
|
+
* @param options - the config path and the JSON-mode flag.
|
|
84
|
+
* @param io - output sinks (injected for tests).
|
|
85
|
+
* @returns the process exit code.
|
|
86
|
+
*/
|
|
87
|
+
export declare function runHeadlessServe(options: {
|
|
88
|
+
readonly configPath?: string;
|
|
89
|
+
readonly json?: boolean;
|
|
90
|
+
}, io: {
|
|
91
|
+
readonly out: (line: string) => void;
|
|
92
|
+
readonly err: (line: string) => void;
|
|
93
|
+
}, signals?: {
|
|
94
|
+
once(name: 'SIGINT' | 'SIGTERM', handler: () => void): void;
|
|
95
|
+
}): Promise<number>;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=headless.d.ts.map
|
|
@@ -0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