@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,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain-neutral confidence routing and evaluation for judgment tools.
|
|
3
|
+
*
|
|
4
|
+
* Two general lessons are drawn from a published identity-resolution evaluation
|
|
5
|
+
* (Hightouch, 2026-11-04); that domain is provenance, not scope:
|
|
6
|
+
* - a fixed 50% cutoff is arbitrary; thresholds trade false positives for false negatives;
|
|
7
|
+
* - a well-calibrated cheap judge can escalate only its uncertain band to an expensive
|
|
8
|
+
* evaluator and approach frontier accuracy at much lower cost.
|
|
9
|
+
*
|
|
10
|
+
* These functions are pure. They never call a model; the caller supplies the primary
|
|
11
|
+
* probability (and, when escalations happen, the secondary one).
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Route a primary judgment by a two-sided confidence band.
|
|
15
|
+
*
|
|
16
|
+
* The defaults are the article's shape (middle band escalated), but NOT a claim
|
|
17
|
+
* that these thresholds are calibrated for our models: pass reviewed thresholds.
|
|
18
|
+
* @param probability - the primary judge's probability that the condition is true.
|
|
19
|
+
* @param acceptAt - at or above this, accept true (default 0.9).
|
|
20
|
+
* @param rejectAt - at or below this, accept false (default 0.1).
|
|
21
|
+
* @returns the route, decision and band.
|
|
22
|
+
*/
|
|
23
|
+
export function routeConfidence(probability, acceptAt = 0.9, rejectAt = 0.1) {
|
|
24
|
+
if (typeof probability !== 'number' || !Number.isFinite(probability) || probability < 0 || probability > 1) {
|
|
25
|
+
throw new Error('probability must be a finite number in [0,1]');
|
|
26
|
+
}
|
|
27
|
+
if (!Number.isFinite(acceptAt) || !Number.isFinite(rejectAt) || rejectAt < 0 || acceptAt > 1 || rejectAt >= acceptAt) {
|
|
28
|
+
throw new Error('thresholds must satisfy 0 <= rejectAt < acceptAt <= 1');
|
|
29
|
+
}
|
|
30
|
+
if (probability >= acceptAt) {
|
|
31
|
+
return { route: 'accept', decision: true, band: 'high', reason: `p=${probability.toFixed(4)} >= acceptAt=${acceptAt}` };
|
|
32
|
+
}
|
|
33
|
+
if (probability <= rejectAt) {
|
|
34
|
+
return { route: 'reject', decision: false, band: 'low', reason: `p=${probability.toFixed(4)} <= rejectAt=${rejectAt}` };
|
|
35
|
+
}
|
|
36
|
+
return { route: 'escalate', decision: null, band: 'middle', reason: `p=${probability.toFixed(4)} lies in (${rejectAt}, ${acceptAt})` };
|
|
37
|
+
}
|
|
38
|
+
function validCase(raw, index) {
|
|
39
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
40
|
+
throw new Error(`cases[${index}] must be an object`);
|
|
41
|
+
const c = raw;
|
|
42
|
+
if (typeof c.expected !== 'boolean')
|
|
43
|
+
throw new Error(`cases[${index}].expected must be a boolean`);
|
|
44
|
+
if (typeof c.probability !== 'number' || !Number.isFinite(c.probability) || c.probability < 0 || c.probability > 1) {
|
|
45
|
+
throw new Error(`cases[${index}].probability must be a finite number in [0,1]`);
|
|
46
|
+
}
|
|
47
|
+
if (c.escalatedProbability !== undefined && (typeof c.escalatedProbability !== 'number' || !Number.isFinite(c.escalatedProbability) || c.escalatedProbability < 0 || c.escalatedProbability > 1)) {
|
|
48
|
+
throw new Error(`cases[${index}].escalatedProbability must be a finite number in [0,1]`);
|
|
49
|
+
}
|
|
50
|
+
for (const [key, value] of [['costUsd', c.costUsd], ['latencyMs', c.latencyMs]]) {
|
|
51
|
+
if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value) || value < 0)) {
|
|
52
|
+
throw new Error(`cases[${index}].${key} must be a non-negative finite number`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
...(typeof c.id === 'string' ? { id: c.id } : {}),
|
|
57
|
+
expected: c.expected,
|
|
58
|
+
probability: c.probability,
|
|
59
|
+
...c.escalatedProbability === undefined ? {} : { escalatedProbability: c.escalatedProbability },
|
|
60
|
+
...c.costUsd === undefined ? {} : { costUsd: c.costUsd },
|
|
61
|
+
...c.latencyMs === undefined ? {} : { latencyMs: c.latencyMs },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function metrics(cases, decide) {
|
|
65
|
+
let correct = 0;
|
|
66
|
+
let tp = 0;
|
|
67
|
+
let tn = 0;
|
|
68
|
+
let fp = 0;
|
|
69
|
+
let fn = 0;
|
|
70
|
+
let brier = 0;
|
|
71
|
+
const bins = Array.from({ length: 10 }, () => ({ count: 0, predicted: 0, observed: 0 }));
|
|
72
|
+
for (const c of cases) {
|
|
73
|
+
const predicted = decide(c);
|
|
74
|
+
if (predicted === c.expected)
|
|
75
|
+
correct += 1;
|
|
76
|
+
if (predicted && c.expected)
|
|
77
|
+
tp += 1;
|
|
78
|
+
else if (!predicted && !c.expected)
|
|
79
|
+
tn += 1;
|
|
80
|
+
else if (predicted && !c.expected)
|
|
81
|
+
fp += 1;
|
|
82
|
+
else
|
|
83
|
+
fn += 1;
|
|
84
|
+
brier += (c.probability - (c.expected ? 1 : 0)) ** 2;
|
|
85
|
+
const bin = Math.min(9, Math.floor(c.probability * 10));
|
|
86
|
+
const slot = bins[bin];
|
|
87
|
+
slot.count += 1;
|
|
88
|
+
slot.predicted += c.probability;
|
|
89
|
+
slot.observed += c.expected ? 1 : 0;
|
|
90
|
+
}
|
|
91
|
+
let ece = 0;
|
|
92
|
+
for (const slot of bins) {
|
|
93
|
+
if (slot.count === 0)
|
|
94
|
+
continue;
|
|
95
|
+
ece += (slot.count / cases.length) * Math.abs(slot.predicted / slot.count - slot.observed / slot.count);
|
|
96
|
+
}
|
|
97
|
+
const positives = cases.filter(c => c.expected).length;
|
|
98
|
+
const negatives = cases.length - positives;
|
|
99
|
+
return {
|
|
100
|
+
count: cases.length,
|
|
101
|
+
correct,
|
|
102
|
+
accuracy: cases.length === 0 ? 0 : correct / cases.length,
|
|
103
|
+
truePositives: tp,
|
|
104
|
+
trueNegatives: tn,
|
|
105
|
+
falsePositives: fp,
|
|
106
|
+
falseNegatives: fn,
|
|
107
|
+
falsePositiveRate: negatives === 0 ? 0 : fp / negatives,
|
|
108
|
+
falseNegativeRate: positives === 0 ? 0 : fn / positives,
|
|
109
|
+
brier: cases.length === 0 ? 0 : brier / cases.length,
|
|
110
|
+
expectedCalibrationError: cases.length === 0 ? 0 : ece,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Evaluate a labeled set: fixed threshold, best observed threshold, calibration bins,
|
|
115
|
+
* and an optional hybrid arm that sends the middle band to the secondary probability.
|
|
116
|
+
* @param rawCases - labeled observations.
|
|
117
|
+
* @param threshold - the primary cutoff (default 0.5).
|
|
118
|
+
* @param escalation - optional `{rejectAt, acceptAt}` hybrid band.
|
|
119
|
+
* @returns metrics, sweep and optional hybrid metrics.
|
|
120
|
+
*/
|
|
121
|
+
export function evaluateDecisions(rawCases, threshold = 0.5, escalation) {
|
|
122
|
+
if (!Array.isArray(rawCases) || rawCases.length === 0 || rawCases.length > 10_000)
|
|
123
|
+
throw new Error('cases must be 1–10,000 observations');
|
|
124
|
+
if (!Number.isFinite(threshold) || threshold < 0 || threshold > 1)
|
|
125
|
+
throw new Error('threshold must be a finite number in [0,1]');
|
|
126
|
+
if (escalation !== undefined && (!Number.isFinite(escalation.rejectAt) || !Number.isFinite(escalation.acceptAt) || escalation.rejectAt < 0 || escalation.acceptAt > 1 || escalation.rejectAt >= escalation.acceptAt)) {
|
|
127
|
+
throw new Error('escalation thresholds must satisfy 0 <= rejectAt < acceptAt <= 1');
|
|
128
|
+
}
|
|
129
|
+
const cases = rawCases.map(validCase);
|
|
130
|
+
const base = metrics(cases, c => c.probability >= threshold);
|
|
131
|
+
let bestThreshold = threshold;
|
|
132
|
+
let bestAccuracy = base.accuracy;
|
|
133
|
+
const sweep = [];
|
|
134
|
+
for (let step = 0; step <= 100; step += 1) {
|
|
135
|
+
const candidate = step / 100;
|
|
136
|
+
const result = metrics(cases, c => c.probability >= candidate);
|
|
137
|
+
sweep.push({ threshold: candidate, accuracy: result.accuracy });
|
|
138
|
+
if (result.accuracy > bestAccuracy) {
|
|
139
|
+
bestAccuracy = result.accuracy;
|
|
140
|
+
bestThreshold = candidate;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const calibration = Array.from({ length: 10 }, (_, index) => {
|
|
144
|
+
const low = index / 10;
|
|
145
|
+
const high = (index + 1) / 10;
|
|
146
|
+
const bucket = cases.filter(c => c.probability >= low && (index === 9 ? c.probability <= high : c.probability < high));
|
|
147
|
+
return {
|
|
148
|
+
low,
|
|
149
|
+
high,
|
|
150
|
+
count: bucket.length,
|
|
151
|
+
meanPredicted: bucket.length === 0 ? null : bucket.reduce((sum, c) => sum + c.probability, 0) / bucket.length,
|
|
152
|
+
observedRate: bucket.length === 0 ? null : bucket.filter(c => c.expected).length / bucket.length,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
if (escalation === undefined)
|
|
156
|
+
return { threshold, base, bestThreshold, bestAccuracy, sweep, calibration };
|
|
157
|
+
let escalated = 0;
|
|
158
|
+
let escalatedCostUsd = 0;
|
|
159
|
+
let escalatedLatencyMs = 0;
|
|
160
|
+
const hybridDecisions = cases.map(c => {
|
|
161
|
+
const route = routeConfidence(c.probability, escalation.acceptAt, escalation.rejectAt);
|
|
162
|
+
if (route.route !== 'escalate')
|
|
163
|
+
return c.probability >= escalation.acceptAt;
|
|
164
|
+
escalated += 1;
|
|
165
|
+
escalatedCostUsd += c.costUsd ?? 0;
|
|
166
|
+
escalatedLatencyMs += c.latencyMs ?? 0;
|
|
167
|
+
return (c.escalatedProbability ?? c.probability) >= threshold;
|
|
168
|
+
});
|
|
169
|
+
let tp = 0;
|
|
170
|
+
let tn = 0;
|
|
171
|
+
let fp = 0;
|
|
172
|
+
let fn = 0;
|
|
173
|
+
for (let index = 0; index < cases.length; index += 1) {
|
|
174
|
+
const c = cases[index];
|
|
175
|
+
const predicted = hybridDecisions[index];
|
|
176
|
+
if (predicted && c.expected)
|
|
177
|
+
tp += 1;
|
|
178
|
+
else if (!predicted && !c.expected)
|
|
179
|
+
tn += 1;
|
|
180
|
+
else if (predicted)
|
|
181
|
+
fp += 1;
|
|
182
|
+
else
|
|
183
|
+
fn += 1;
|
|
184
|
+
}
|
|
185
|
+
const positives = cases.filter(c => c.expected).length;
|
|
186
|
+
const negatives = cases.length - positives;
|
|
187
|
+
return {
|
|
188
|
+
threshold,
|
|
189
|
+
base,
|
|
190
|
+
bestThreshold,
|
|
191
|
+
bestAccuracy,
|
|
192
|
+
sweep,
|
|
193
|
+
calibration,
|
|
194
|
+
hybrid: {
|
|
195
|
+
rejectAt: escalation.rejectAt,
|
|
196
|
+
acceptAt: escalation.acceptAt,
|
|
197
|
+
escalated,
|
|
198
|
+
escalationRate: cases.length === 0 ? 0 : escalated / cases.length,
|
|
199
|
+
accuracy: (tp + tn) / cases.length,
|
|
200
|
+
truePositives: tp,
|
|
201
|
+
trueNegatives: tn,
|
|
202
|
+
falsePositives: fp,
|
|
203
|
+
falseNegatives: fn,
|
|
204
|
+
falsePositiveRate: negatives === 0 ? 0 : fp / negatives,
|
|
205
|
+
falseNegativeRate: positives === 0 ? 0 : fn / positives,
|
|
206
|
+
escalatedCostUsd,
|
|
207
|
+
escalatedLatencyMs,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/** The MCP contract for confidence routing. */
|
|
212
|
+
export const DECISION_ROUTE_CONTRACT = {
|
|
213
|
+
contract: 'decision.route', version: '1.0.0', toolName: 'decision_route',
|
|
214
|
+
description: 'Route a primary judgment probability into accept, reject or the escalate band.',
|
|
215
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['probability'], properties: { probability: { type: 'number' }, acceptAt: { type: 'number' }, rejectAt: { type: 'number' } } },
|
|
216
|
+
outputSchema: { type: 'object', additionalProperties: false, required: ['route', 'decision', 'band', 'reason'], properties: { route: { type: 'string' }, decision: { type: ['boolean', 'null'] }, band: { type: 'string' }, reason: { type: 'string' } } },
|
|
217
|
+
semantics: { deterministic: true, readsInputs: true }, limits: {},
|
|
218
|
+
};
|
|
219
|
+
/** The MCP contract for decision evaluation. */
|
|
220
|
+
export const DECISION_EVALUATE_CONTRACT = {
|
|
221
|
+
contract: 'decision.evaluate', version: '1.0.0', toolName: 'decision_evaluate',
|
|
222
|
+
description: 'Evaluate labeled decision probabilities: accuracy, FPR/FNR, Brier, calibration and an optional escalation arm.',
|
|
223
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['cases'], properties: { cases: { type: 'array' }, threshold: { type: 'number' }, escalation: { type: 'object' } } },
|
|
224
|
+
outputSchema: { type: 'object', additionalProperties: true },
|
|
225
|
+
semantics: { deterministic: true, readsInputs: true }, limits: {},
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=decision-evaluate.js.map
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment coordination: preparation, single-flight loading and reference counting
|
|
3
|
+
* (RES-02, RES-03, RES-05).
|
|
4
|
+
*
|
|
5
|
+
* This is the module that makes readiness states PRODUCED rather than assigned. Before
|
|
6
|
+
* it, `prepared-cold` and `ready` were values a test could write; here they are values
|
|
7
|
+
* this coordinator derives from what actually happened.
|
|
8
|
+
*
|
|
9
|
+
* Three rules shape the design:
|
|
10
|
+
*
|
|
11
|
+
* - **One operation per EXACT deployment** (RES-05). The key that identifies a
|
|
12
|
+
* deployment includes the model revision, engine version, quantization and
|
|
13
|
+
* preprocessing recipe, not just a model name — two builds of "the same model" that
|
|
14
|
+
* differ in quantization are different deployments and loading one must not satisfy
|
|
15
|
+
* a request for the other.
|
|
16
|
+
* - **Concurrent callers JOIN** (RES-05). A second caller during a load awaits the
|
|
17
|
+
* same promise rather than starting a second load, which is the difference between
|
|
18
|
+
* sharing 349 MB and allocating it twice.
|
|
19
|
+
* - **A failed or interrupted preparation cannot become ready** (RES-03). Failure is
|
|
20
|
+
* recorded as failure, and a later caller retries rather than inheriting a
|
|
21
|
+
* half-prepared deployment that reports success.
|
|
22
|
+
*
|
|
23
|
+
* @module @try-works/dsh-tool-mode/deployment-coordinator
|
|
24
|
+
*/
|
|
25
|
+
import type { ModelReadiness } from '@try-works/tool-mode-extension-sdk';
|
|
26
|
+
/**
|
|
27
|
+
* The identity of an EXACT provider deployment (RES-02, RES-05).
|
|
28
|
+
*
|
|
29
|
+
* Every field participates in the deployment key. Pinning only the model name would
|
|
30
|
+
* let a caller be served by a differently-quantized build than the one it requested.
|
|
31
|
+
*/
|
|
32
|
+
export interface DeploymentIdentity {
|
|
33
|
+
/** The extension package that provides it. */
|
|
34
|
+
readonly extensionId: string;
|
|
35
|
+
/** The model inside that package. */
|
|
36
|
+
readonly modelId: string;
|
|
37
|
+
/** The exact model revision, not a branch or a floating tag. */
|
|
38
|
+
readonly modelRevision: string;
|
|
39
|
+
/** The engine or SDK version the assets were converted for. */
|
|
40
|
+
readonly engineVersion: string;
|
|
41
|
+
/** The quantization, which changes outputs and is therefore part of identity. */
|
|
42
|
+
readonly quantization: string;
|
|
43
|
+
/** The tokenizer identity. */
|
|
44
|
+
readonly tokenizer: string;
|
|
45
|
+
/** The preprocessing recipe version. */
|
|
46
|
+
readonly preprocessingRecipe: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The stable key for an exact deployment (RES-05).
|
|
50
|
+
*
|
|
51
|
+
* A delimiter that cannot appear in a component, so two different field combinations
|
|
52
|
+
* cannot collide into one key.
|
|
53
|
+
* @param identity - the deployment identity.
|
|
54
|
+
* @returns the key.
|
|
55
|
+
*/
|
|
56
|
+
export declare function deploymentKey(identity: DeploymentIdentity): string;
|
|
57
|
+
/** One asset a preparation must obtain (RES-02, RES-03). */
|
|
58
|
+
export interface PlannedAsset {
|
|
59
|
+
/** The asset id from the lock file. */
|
|
60
|
+
readonly assetId: string;
|
|
61
|
+
/** The download size in bytes, for the pre-approval disclosure. */
|
|
62
|
+
readonly bytes: number;
|
|
63
|
+
/** The pinned source. */
|
|
64
|
+
readonly source: string;
|
|
65
|
+
/** The expected content digest. */
|
|
66
|
+
readonly digest: string;
|
|
67
|
+
/**
|
|
68
|
+
* Whether this asset is an EXECUTABLE.
|
|
69
|
+
*
|
|
70
|
+
* RES-02: prebuilt engine downloads count as executable installation, so they
|
|
71
|
+
* require the separate executable-preparation approval rather than riding along
|
|
72
|
+
* with a model download.
|
|
73
|
+
*/
|
|
74
|
+
readonly executable: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** What a preparation would do, shown before approval (RES-02). */
|
|
77
|
+
export interface PreparationPlan {
|
|
78
|
+
readonly identity: DeploymentIdentity;
|
|
79
|
+
readonly assets: readonly PlannedAsset[];
|
|
80
|
+
/** Total download size, so an operator approves a number rather than a hope. */
|
|
81
|
+
readonly totalBytes: number;
|
|
82
|
+
/** Total bytes retained after installation. */
|
|
83
|
+
readonly storageBytes: number;
|
|
84
|
+
/** Whether any asset is executable, which changes which approval is needed. */
|
|
85
|
+
readonly requiresExecutableApproval: boolean;
|
|
86
|
+
/** The pinned license terms, surfaced before the download rather than after. */
|
|
87
|
+
readonly license: {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly url: string;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build the pre-approval disclosure (RES-02).
|
|
94
|
+
*
|
|
95
|
+
* An operator approving a preparation is approving a specific download of a specific
|
|
96
|
+
* size under specific terms, so all three are computed here rather than discovered
|
|
97
|
+
* during the install.
|
|
98
|
+
* @param identity - the exact deployment.
|
|
99
|
+
* @param assets - the assets the lock resolves to.
|
|
100
|
+
* @param license - the pinned license.
|
|
101
|
+
* @returns the plan.
|
|
102
|
+
*/
|
|
103
|
+
export declare function planPreparation(identity: DeploymentIdentity, assets: readonly PlannedAsset[], license: {
|
|
104
|
+
readonly name: string;
|
|
105
|
+
readonly url: string;
|
|
106
|
+
}): PreparationPlan;
|
|
107
|
+
/** A preparation that has not yet completed. */
|
|
108
|
+
export interface DeploymentRecord {
|
|
109
|
+
/** The exact deployment key. */
|
|
110
|
+
readonly key: string;
|
|
111
|
+
/** The identity it belongs to. */
|
|
112
|
+
readonly identity: DeploymentIdentity;
|
|
113
|
+
/** The current state, using the RES-04 vocabulary. */
|
|
114
|
+
readiness: ModelReadiness;
|
|
115
|
+
/** How many callers currently hold a reference. */
|
|
116
|
+
activeUsers: number;
|
|
117
|
+
/** When the current load began, if one is in progress. */
|
|
118
|
+
loadingSince: number | null;
|
|
119
|
+
/** Why it failed, when it did. */
|
|
120
|
+
failureReason: string | null;
|
|
121
|
+
}
|
|
122
|
+
/** What a caller receives when it acquires a deployment. */
|
|
123
|
+
export interface DeploymentLease {
|
|
124
|
+
/** The deployment key. */
|
|
125
|
+
readonly key: string;
|
|
126
|
+
/** The state at acquisition. */
|
|
127
|
+
readonly readiness: ModelReadiness;
|
|
128
|
+
/** Whether the caller waited for a load to finish. */
|
|
129
|
+
readonly joined: boolean;
|
|
130
|
+
/** Release this caller's reference. Idempotent. */
|
|
131
|
+
release(): void;
|
|
132
|
+
}
|
|
133
|
+
/** Raised when a deployment cannot be prepared. */
|
|
134
|
+
export declare class DeploymentError extends Error {
|
|
135
|
+
readonly name = "DeploymentError";
|
|
136
|
+
readonly key: string;
|
|
137
|
+
constructor(key: string, message: string);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Coordinates preparation, loading and reference counting per exact deployment.
|
|
141
|
+
*
|
|
142
|
+
* Not thread-safe in the language sense — Node is single-threaded — but
|
|
143
|
+
* single-flight with respect to `await`: two callers that reach `acquire` before the
|
|
144
|
+
* load settles both await ONE promise.
|
|
145
|
+
*/
|
|
146
|
+
export declare class DeploymentCoordinator {
|
|
147
|
+
#private;
|
|
148
|
+
/** Every tracked deployment, for diagnostics. */
|
|
149
|
+
get deployments(): readonly DeploymentRecord[];
|
|
150
|
+
/** One deployment's record. */
|
|
151
|
+
record(key: string): DeploymentRecord | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* The state to report for a deployment that has not been touched yet.
|
|
154
|
+
* @param identity - the exact deployment.
|
|
155
|
+
* @returns the readiness.
|
|
156
|
+
*/
|
|
157
|
+
readinessOf(identity: DeploymentIdentity): ModelReadiness;
|
|
158
|
+
/**
|
|
159
|
+
* Prepare and load a deployment, joining an in-flight load if there is one.
|
|
160
|
+
*
|
|
161
|
+
* RES-05: "One preparation/load operation per exact provider deployment; concurrent
|
|
162
|
+
* callers join or queue."
|
|
163
|
+
* @param identity - the exact deployment.
|
|
164
|
+
* @param load - performs the load. Called AT MOST ONCE per concurrent group.
|
|
165
|
+
* @param options - cancellation for THIS caller.
|
|
166
|
+
* @returns the lease.
|
|
167
|
+
* @throws DeploymentError when the load fails.
|
|
168
|
+
*/
|
|
169
|
+
acquire(identity: DeploymentIdentity, load: () => Promise<void>, options?: {
|
|
170
|
+
readonly signal?: AbortSignal;
|
|
171
|
+
}): Promise<DeploymentLease>;
|
|
172
|
+
/**
|
|
173
|
+
* Unload a deployment, but only when it is IDLE (RES-05).
|
|
174
|
+
*
|
|
175
|
+
* "Unload only idle resources or an explicitly revoked deployment after coordinated
|
|
176
|
+
* cleanup." Unloading a busy deployment would discard another caller's work.
|
|
177
|
+
* @param key - the deployment key.
|
|
178
|
+
* @param force - set only for an explicitly revoked deployment.
|
|
179
|
+
* @returns whether it was unloaded, and why not when it was not.
|
|
180
|
+
*/
|
|
181
|
+
unload(key: string, force?: boolean): {
|
|
182
|
+
readonly unloaded: boolean;
|
|
183
|
+
readonly reason?: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Revoke a deployment, discarding in-flight work after coordinated cleanup (RES-05).
|
|
187
|
+
* @param key - the deployment key.
|
|
188
|
+
* @returns whether it was revoked.
|
|
189
|
+
*/
|
|
190
|
+
revoke(key: string): boolean;
|
|
191
|
+
}
|
|
192
|
+
/** An asset ownership record (RES-03). */
|
|
193
|
+
export interface AssetOwnership {
|
|
194
|
+
/** The content digest, which is what makes sharing safe. */
|
|
195
|
+
readonly digest: string;
|
|
196
|
+
/** The holders of this asset, by owner id. */
|
|
197
|
+
readonly owners: readonly string[];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Decide which assets may be deleted (RES-03).
|
|
201
|
+
*
|
|
202
|
+
* RES-03: "Package uninstall and asset purge are separate operations; delete only
|
|
203
|
+
* unreferenced host-owned assets." So removing an owner does not delete anything, and
|
|
204
|
+
* an asset with another owner is never deleted.
|
|
205
|
+
* @param ownership - the current records.
|
|
206
|
+
* @param removedOwner - the owner being uninstalled.
|
|
207
|
+
* @returns the digests that are now unreferenced, and those still held.
|
|
208
|
+
*/
|
|
209
|
+
export declare function purgeCandidates(ownership: readonly AssetOwnership[], removedOwner: string): {
|
|
210
|
+
readonly deletable: readonly string[];
|
|
211
|
+
readonly retained: readonly string[];
|
|
212
|
+
};
|
|
213
|
+
//# sourceMappingURL=deployment-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-coordinator.d.ts","sourceRoot":"","sources":["../src/deployment-coordinator.ts"],"names":[],"mappings":"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"}
|