@try-works/dsh-tool-mode 0.0.0-stage → 0.5.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +205 -0
- package/README.md +303 -2
- package/bin/dsh-tool-mode-credentials.mjs +20 -0
- package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
- package/bin/dsh-tool-mode.mjs +211 -0
- package/builtins.lock.json +26 -0
- package/catalog/desert-ant-models.json +693 -0
- package/catalog/playbooks.json +531 -0
- package/client/client.model-tools.js +1910 -0
- package/client/index.js +4158 -0
- package/cordis.patch.yml +39 -0
- package/lib/adapters/index.d.ts +61 -0
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/index.js +82 -0
- package/lib/adapters/types.d.ts +106 -0
- package/lib/adapters/types.d.ts.map +1 -0
- package/lib/adapters/types.js +85 -0
- package/lib/approval.d.ts +189 -0
- package/lib/approval.d.ts.map +1 -0
- package/lib/approval.js +510 -0
- package/lib/asset-acquisition.d.ts +149 -0
- package/lib/asset-acquisition.d.ts.map +1 -0
- package/lib/asset-acquisition.js +175 -0
- package/lib/authority.d.ts +185 -0
- package/lib/authority.d.ts.map +1 -0
- package/lib/authority.js +223 -0
- package/lib/bindings.d.ts +144 -0
- package/lib/bindings.d.ts.map +1 -0
- package/lib/bindings.js +314 -0
- package/lib/builtins.d.ts +27 -0
- package/lib/builtins.d.ts.map +1 -0
- package/lib/builtins.js +37 -0
- package/lib/capability.d.ts +58 -0
- package/lib/capability.d.ts.map +1 -0
- package/lib/capability.js +192 -0
- package/lib/capture-path.d.ts +97 -0
- package/lib/capture-path.d.ts.map +1 -0
- package/lib/capture-path.js +152 -0
- package/lib/catalog.d.ts +37 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +274 -0
- package/lib/contract-payload.d.ts +39 -0
- package/lib/contract-payload.d.ts.map +1 -0
- package/lib/contract-payload.js +56 -0
- package/lib/custom-tools/compile.d.ts +25 -0
- package/lib/custom-tools/compile.d.ts.map +1 -0
- package/lib/custom-tools/compile.js +61 -0
- package/lib/custom-tools/composite-executor.d.ts +42 -0
- package/lib/custom-tools/composite-executor.d.ts.map +1 -0
- package/lib/custom-tools/composite-executor.js +113 -0
- package/lib/custom-tools/dispatch.d.ts +28 -0
- package/lib/custom-tools/dispatch.d.ts.map +1 -0
- package/lib/custom-tools/dispatch.js +34 -0
- package/lib/custom-tools/http-executor.d.ts +48 -0
- package/lib/custom-tools/http-executor.d.ts.map +1 -0
- package/lib/custom-tools/http-executor.js +241 -0
- package/lib/custom-tools/index.d.ts +12 -0
- package/lib/custom-tools/index.d.ts.map +1 -0
- package/lib/custom-tools/index.js +12 -0
- package/lib/custom-tools/mcp-surface.d.ts +14 -0
- package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
- package/lib/custom-tools/mcp-surface.js +41 -0
- package/lib/custom-tools/prompt-executor.d.ts +39 -0
- package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
- package/lib/custom-tools/prompt-executor.js +59 -0
- package/lib/custom-tools/registry.d.ts +69 -0
- package/lib/custom-tools/registry.d.ts.map +1 -0
- package/lib/custom-tools/registry.js +130 -0
- package/lib/custom-tools/schema.d.ts +26 -0
- package/lib/custom-tools/schema.d.ts.map +1 -0
- package/lib/custom-tools/schema.js +375 -0
- package/lib/custom-tools/service.d.ts +90 -0
- package/lib/custom-tools/service.d.ts.map +1 -0
- package/lib/custom-tools/service.js +203 -0
- package/lib/custom-tools/store.d.ts +61 -0
- package/lib/custom-tools/store.d.ts.map +1 -0
- package/lib/custom-tools/store.js +240 -0
- package/lib/custom-tools/types.d.ts +131 -0
- package/lib/custom-tools/types.d.ts.map +1 -0
- package/lib/custom-tools/types.js +11 -0
- package/lib/decision-combine.d.ts +113 -0
- package/lib/decision-combine.d.ts.map +1 -0
- package/lib/decision-combine.js +156 -0
- package/lib/decision-evaluate.d.ts +185 -0
- package/lib/decision-evaluate.d.ts.map +1 -0
- package/lib/decision-evaluate.js +227 -0
- package/lib/deployment-coordinator.d.ts +213 -0
- package/lib/deployment-coordinator.d.ts.map +1 -0
- package/lib/deployment-coordinator.js +274 -0
- package/lib/diagnostics.d.ts +169 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +136 -0
- package/lib/discovery-contracts.d.ts +14 -0
- package/lib/discovery-contracts.d.ts.map +1 -0
- package/lib/discovery-contracts.js +90 -0
- package/lib/discovery-describe.d.ts +35 -0
- package/lib/discovery-describe.d.ts.map +1 -0
- package/lib/discovery-describe.js +99 -0
- package/lib/embedding-index.d.ts +55 -0
- package/lib/embedding-index.d.ts.map +1 -0
- package/lib/embedding-index.js +126 -0
- package/lib/extension-dependencies.d.ts +355 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +987 -0
- package/lib/extension-dispatch.d.ts +150 -0
- package/lib/extension-dispatch.d.ts.map +1 -0
- package/lib/extension-dispatch.js +178 -0
- package/lib/extension-page-state.d.ts +69 -0
- package/lib/extension-page-state.d.ts.map +1 -0
- package/lib/extension-page-state.js +82 -0
- package/lib/extension-registrar.d.ts +116 -0
- package/lib/extension-registrar.d.ts.map +1 -0
- package/lib/extension-registrar.js +144 -0
- package/lib/extensions-api.d.ts +346 -0
- package/lib/extensions-api.d.ts.map +1 -0
- package/lib/extensions-api.js +17 -0
- package/lib/extensions-remote.d.ts +57 -0
- package/lib/extensions-remote.d.ts.map +1 -0
- package/lib/extensions-remote.js +69 -0
- package/lib/extensions-service.d.ts +568 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +2552 -0
- package/lib/harness-budgets.d.ts +158 -0
- package/lib/harness-budgets.d.ts.map +1 -0
- package/lib/harness-budgets.js +152 -0
- package/lib/harness-llm.d.ts +138 -0
- package/lib/harness-llm.d.ts.map +1 -0
- package/lib/harness-llm.js +218 -0
- package/lib/harness-serving.d.ts +115 -0
- package/lib/harness-serving.d.ts.map +1 -0
- package/lib/harness-serving.js +176 -0
- package/lib/headless.d.ts +97 -0
- package/lib/headless.d.ts.map +1 -0
- package/lib/headless.js +407 -0
- package/lib/http-acquisition.d.ts +27 -0
- package/lib/http-acquisition.d.ts.map +1 -0
- package/lib/http-acquisition.js +140 -0
- package/lib/index.d.ts +546 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5273 -0
- package/lib/invocation-accounting.d.ts +169 -0
- package/lib/invocation-accounting.d.ts.map +1 -0
- package/lib/invocation-accounting.js +148 -0
- package/lib/jev.d.ts +218 -0
- package/lib/jev.d.ts.map +1 -0
- package/lib/jev.js +366 -0
- package/lib/legacy-migration.d.ts +95 -0
- package/lib/legacy-migration.d.ts.map +1 -0
- package/lib/legacy-migration.js +429 -0
- package/lib/license-basis.d.ts +29 -0
- package/lib/license-basis.d.ts.map +1 -0
- package/lib/license-basis.js +58 -0
- package/lib/managed-workers.d.ts +158 -0
- package/lib/managed-workers.d.ts.map +1 -0
- package/lib/managed-workers.js +269 -0
- package/lib/mcp/auth-selection.d.ts +35 -0
- package/lib/mcp/auth-selection.d.ts.map +1 -0
- package/lib/mcp/auth-selection.js +64 -0
- package/lib/mcp/client-grant.d.ts +89 -0
- package/lib/mcp/client-grant.d.ts.map +1 -0
- package/lib/mcp/client-grant.js +63 -0
- package/lib/mcp/credential-cli.d.ts +38 -0
- package/lib/mcp/credential-cli.d.ts.map +1 -0
- package/lib/mcp/credential-cli.js +148 -0
- package/lib/mcp/credential-store.d.ts +143 -0
- package/lib/mcp/credential-store.d.ts.map +1 -0
- package/lib/mcp/credential-store.js +461 -0
- package/lib/mcp/export-policy.d.ts +25 -0
- package/lib/mcp/export-policy.d.ts.map +1 -0
- package/lib/mcp/export-policy.js +31 -0
- package/lib/mcp/host-binding.d.ts +144 -0
- package/lib/mcp/host-binding.d.ts.map +1 -0
- package/lib/mcp/host-binding.js +280 -0
- package/lib/mcp/http.d.ts +180 -0
- package/lib/mcp/http.d.ts.map +1 -0
- package/lib/mcp/http.js +602 -0
- package/lib/mcp/oauth.d.ts +149 -0
- package/lib/mcp/oauth.d.ts.map +1 -0
- package/lib/mcp/oauth.js +396 -0
- package/lib/mcp/protocol.d.ts +329 -0
- package/lib/mcp/protocol.d.ts.map +1 -0
- package/lib/mcp/protocol.js +459 -0
- package/lib/mcp/rate-limit.d.ts +68 -0
- package/lib/mcp/rate-limit.d.ts.map +1 -0
- package/lib/mcp/rate-limit.js +114 -0
- package/lib/mcp/sdk-v2.d.ts +17 -0
- package/lib/mcp/sdk-v2.d.ts.map +1 -0
- package/lib/mcp/sdk-v2.js +204 -0
- package/lib/mcp/server.d.ts +149 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +302 -0
- package/lib/mcp/stdio.d.ts +80 -0
- package/lib/mcp/stdio.d.ts.map +1 -0
- package/lib/mcp/stdio.js +184 -0
- package/lib/mcp/subscriptions.d.ts +177 -0
- package/lib/mcp/subscriptions.d.ts.map +1 -0
- package/lib/mcp/subscriptions.js +288 -0
- package/lib/mcp-status.d.ts +96 -0
- package/lib/mcp-status.d.ts.map +1 -0
- package/lib/mcp-status.js +70 -0
- package/lib/mcp-usage.d.ts +110 -0
- package/lib/mcp-usage.d.ts.map +1 -0
- package/lib/mcp-usage.js +189 -0
- package/lib/model-qualification.d.ts +192 -0
- package/lib/model-qualification.d.ts.map +1 -0
- package/lib/model-qualification.js +178 -0
- package/lib/model-runtime-lane.d.ts +69 -0
- package/lib/model-runtime-lane.d.ts.map +1 -0
- package/lib/model-runtime-lane.js +122 -0
- package/lib/model-runtime-recipe.d.ts +132 -0
- package/lib/model-runtime-recipe.d.ts.map +1 -0
- package/lib/model-runtime-recipe.js +291 -0
- package/lib/planning.d.ts +256 -0
- package/lib/planning.d.ts.map +1 -0
- package/lib/planning.js +471 -0
- package/lib/playbook.d.ts +42 -0
- package/lib/playbook.d.ts.map +1 -0
- package/lib/playbook.js +65 -0
- package/lib/prepared-assets.d.ts +269 -0
- package/lib/prepared-assets.d.ts.map +1 -0
- package/lib/prepared-assets.js +471 -0
- package/lib/provider-bridge.d.ts +107 -0
- package/lib/provider-bridge.d.ts.map +1 -0
- package/lib/provider-bridge.js +423 -0
- package/lib/ptc-authority.d.ts +154 -0
- package/lib/ptc-authority.d.ts.map +1 -0
- package/lib/ptc-authority.js +242 -0
- package/lib/ptc-confinement.d.ts +60 -0
- package/lib/ptc-confinement.d.ts.map +1 -0
- package/lib/ptc-confinement.js +212 -0
- package/lib/ptc-runtime.d.ts +166 -0
- package/lib/ptc-runtime.d.ts.map +1 -0
- package/lib/ptc-runtime.js +231 -0
- package/lib/publication.d.ts +161 -0
- package/lib/publication.d.ts.map +1 -0
- package/lib/publication.js +181 -0
- package/lib/receipt-store.d.ts +57 -0
- package/lib/receipt-store.d.ts.map +1 -0
- package/lib/receipt-store.js +143 -0
- package/lib/receipt.d.ts +231 -0
- package/lib/receipt.d.ts.map +1 -0
- package/lib/receipt.js +165 -0
- package/lib/registrar.d.ts +75 -0
- package/lib/registrar.d.ts.map +1 -0
- package/lib/registrar.js +152 -0
- package/lib/resource-governance.d.ts +204 -0
- package/lib/resource-governance.d.ts.map +1 -0
- package/lib/resource-governance.js +213 -0
- package/lib/server-lifecycle.d.ts +175 -0
- package/lib/server-lifecycle.d.ts.map +1 -0
- package/lib/server-lifecycle.js +269 -0
- package/lib/skills.d.ts +31 -0
- package/lib/skills.d.ts.map +1 -0
- package/lib/skills.js +170 -0
- package/lib/speech-bridge.d.ts +74 -0
- package/lib/speech-bridge.d.ts.map +1 -0
- package/lib/speech-bridge.js +115 -0
- package/lib/state.d.ts +100 -0
- package/lib/state.d.ts.map +1 -0
- package/lib/state.js +160 -0
- package/lib/title-proposal.d.ts +194 -0
- package/lib/title-proposal.d.ts.map +1 -0
- package/lib/title-proposal.js +244 -0
- package/lib/tool-inventory.d.ts +90 -0
- package/lib/tool-inventory.d.ts.map +1 -0
- package/lib/tool-inventory.js +102 -0
- package/lib/tool-mode-run.d.ts +310 -0
- package/lib/tool-mode-run.d.ts.map +1 -0
- package/lib/tool-mode-run.js +411 -0
- package/lib/tool-sources.d.ts +80 -0
- package/lib/tool-sources.d.ts.map +1 -0
- package/lib/tool-sources.js +123 -0
- package/lib/tool-usage-projection.d.ts +390 -0
- package/lib/tool-usage-projection.d.ts.map +1 -0
- package/lib/tool-usage-projection.js +1038 -0
- package/lib/tool-usage-report.d.ts +153 -0
- package/lib/tool-usage-report.d.ts.map +1 -0
- package/lib/tool-usage-report.js +274 -0
- package/lib/transport.d.ts +158 -0
- package/lib/transport.d.ts.map +1 -0
- package/lib/transport.js +332 -0
- package/lib/types.d.ts +134 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +8 -0
- package/lib/update-surface.d.ts +79 -0
- package/lib/update-surface.d.ts.map +1 -0
- package/lib/update-surface.js +224 -0
- package/lib/version.d.ts +3 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +27 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
- package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
- package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
- package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
- package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
- package/package.json +127 -4
- package/remote/spec.mjs +993 -0
- package/remote/typert.host.mjs +14 -0
- package/remote/typert.remote-client.mjs +16 -0
package/lib/jev.js
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote Jev (TypeSafe System One) adapter (TOOL-02, DEC-07).
|
|
3
|
+
*
|
|
4
|
+
* Jev is a remote typed-question service, not a local checkpoint and not a chat
|
|
5
|
+
* endpoint. This module speaks its native `systemOne` request/response shape and
|
|
6
|
+
* converts a choice answer onto the standard `decision.choose` result. The
|
|
7
|
+
* conversion is VERSIONED and tested; an invalid probability set or an unknown
|
|
8
|
+
* choice is an error, never an abstention.
|
|
9
|
+
*
|
|
10
|
+
* @module @try-works/dsh-tool-mode/jev
|
|
11
|
+
*/
|
|
12
|
+
/** The version of the native-to-standard conversion this build implements. */
|
|
13
|
+
export const JEV_CONVERSION_VERSION = '1.0.0';
|
|
14
|
+
/** A configuration or transport failure; never carries the API key or response body. */
|
|
15
|
+
export class JevError extends Error {
|
|
16
|
+
/** Stable failure class. */
|
|
17
|
+
code;
|
|
18
|
+
/** HTTP status, when the failure came from a response. */
|
|
19
|
+
status;
|
|
20
|
+
constructor(code, message, status) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'JevError';
|
|
23
|
+
this.code = code;
|
|
24
|
+
if (status !== undefined)
|
|
25
|
+
this.status = status;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The default TypeSafe API root (the `/v1/systemone` path is appended). */
|
|
29
|
+
export const JEV_DEFAULT_BASE_URL = 'https://api.typesafe.ai';
|
|
30
|
+
/** The default pinned model; callers may pin another documented model. */
|
|
31
|
+
export const JEV_DEFAULT_MODEL = 'jev-1.14';
|
|
32
|
+
/** Convert a probability mass to the standard bucket. */
|
|
33
|
+
export function confidenceBucket(mass) {
|
|
34
|
+
if (!Number.isFinite(mass))
|
|
35
|
+
throw new JevError('invalid_response', 'the answer carries no finite confidence');
|
|
36
|
+
const clamped = Math.max(0, Math.min(1, mass));
|
|
37
|
+
return clamped >= 0.6 ? 'confident' : clamped >= 0.35 ? 'likely' : 'tentative';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the native request for a choice.
|
|
41
|
+
* @param decision - the decision text.
|
|
42
|
+
* @param options - 2–16 distinct nonempty labels.
|
|
43
|
+
* @param model - the pinned model id.
|
|
44
|
+
* @returns the native request body.
|
|
45
|
+
*/
|
|
46
|
+
export function buildJevChoiceRequest(decision, options, model = JEV_DEFAULT_MODEL) {
|
|
47
|
+
if (decision.trim().length === 0)
|
|
48
|
+
throw new JevError('invalid_request', 'the decision must not be empty');
|
|
49
|
+
if (options.length < 2 || options.length > 16)
|
|
50
|
+
throw new JevError('invalid_request', 'a choice needs 2–16 options');
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
const criteria = {};
|
|
53
|
+
for (let index = 0; index < options.length; index += 1) {
|
|
54
|
+
const label = options[index];
|
|
55
|
+
if (label.trim().length === 0)
|
|
56
|
+
throw new JevError('invalid_request', 'an option label must not be empty');
|
|
57
|
+
if (seen.has(label))
|
|
58
|
+
throw new JevError('invalid_request', 'option labels must be distinct');
|
|
59
|
+
seen.add(label);
|
|
60
|
+
criteria[`option_${index}`] = label;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
model,
|
|
64
|
+
state: { decision },
|
|
65
|
+
questions: {
|
|
66
|
+
choice: {
|
|
67
|
+
type: 'choice',
|
|
68
|
+
instructions: decision,
|
|
69
|
+
criteria,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Convert a native response payload to the standard result.
|
|
76
|
+
* @param payload - the parsed JSON response.
|
|
77
|
+
* @param options - the caller's option labels, in order.
|
|
78
|
+
* @returns the standard result.
|
|
79
|
+
*/
|
|
80
|
+
export function convertJevChoiceResponse(payload, options) {
|
|
81
|
+
if (typeof payload !== 'object' || payload === null)
|
|
82
|
+
throw new JevError('invalid_response', 'the response is not an object');
|
|
83
|
+
const answers = payload.answers;
|
|
84
|
+
if (typeof answers !== 'object' || answers === null)
|
|
85
|
+
throw new JevError('invalid_response', 'the response has no answers object');
|
|
86
|
+
const answer = answers.choice;
|
|
87
|
+
if (typeof answer !== 'object' || answer === null)
|
|
88
|
+
throw new JevError('invalid_response', 'the response has no choice answer');
|
|
89
|
+
if (answer.type !== 'choice')
|
|
90
|
+
throw new JevError('invalid_response', 'the choice answer has the wrong type');
|
|
91
|
+
if (typeof answer.choice !== 'string')
|
|
92
|
+
throw new JevError('invalid_response', 'the choice answer has no chosen id');
|
|
93
|
+
const match = /^option_(\d+)$/.exec(answer.choice);
|
|
94
|
+
if (match === null)
|
|
95
|
+
throw new JevError('invalid_response', 'the chosen id is not a supplied option id');
|
|
96
|
+
const chosen = Number(match[1]);
|
|
97
|
+
if (!Number.isInteger(chosen) || chosen < 0 || chosen >= options.length) {
|
|
98
|
+
throw new JevError('invalid_response', 'the chosen option is outside the supplied option set');
|
|
99
|
+
}
|
|
100
|
+
const probabilities = answer.probabilities;
|
|
101
|
+
if (typeof probabilities !== 'object' || probabilities === null || Array.isArray(probabilities)) {
|
|
102
|
+
throw new JevError('invalid_response', 'the answer carries no probability map');
|
|
103
|
+
}
|
|
104
|
+
const map = probabilities;
|
|
105
|
+
const expected = new Set(options.map((_, index) => `option_${index}`));
|
|
106
|
+
const actual = Object.keys(map);
|
|
107
|
+
if (actual.length !== expected.size || actual.some(key => !expected.has(key))) {
|
|
108
|
+
throw new JevError('invalid_response', 'the probability map does not match the supplied options');
|
|
109
|
+
}
|
|
110
|
+
let sum = 0;
|
|
111
|
+
for (const key of actual) {
|
|
112
|
+
const value = map[key];
|
|
113
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {
|
|
114
|
+
throw new JevError('invalid_response', 'the probability map contains an invalid value');
|
|
115
|
+
}
|
|
116
|
+
sum += value;
|
|
117
|
+
}
|
|
118
|
+
if (Math.abs(sum - 1) > 1e-6)
|
|
119
|
+
throw new JevError('invalid_response', 'the probability mass is not normalized');
|
|
120
|
+
const mass = chosen === undefined ? Number.NaN : Number(map[`option_${chosen}`]);
|
|
121
|
+
const reported = answer.confidence ?? answer.answer_confidence;
|
|
122
|
+
if (typeof reported !== 'number' || !Number.isFinite(reported) || reported < 0 || reported > 1) {
|
|
123
|
+
throw new JevError('invalid_response', 'the answer carries no finite confidence in [0,1]');
|
|
124
|
+
}
|
|
125
|
+
// The reported confidence is the provider's own value; the probability mass is
|
|
126
|
+
// retained in the map and named in the reason. Both are UNCALIBRATED (DEC-08).
|
|
127
|
+
const label = options[chosen];
|
|
128
|
+
return {
|
|
129
|
+
chosen,
|
|
130
|
+
confidence: confidenceBucket(reported),
|
|
131
|
+
reason: `Chose ${JSON.stringify(label)} (Jev uncalibrated probability ${mass.toFixed(4)}, conversion ${JEV_CONVERSION_VERSION}).`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Ask Jev one choice question through its native API.
|
|
136
|
+
* @param decision - the decision text.
|
|
137
|
+
* @param options - the caller's labels.
|
|
138
|
+
* @param config - API key, base URL, model and optional transport.
|
|
139
|
+
* @param signal - cancellation.
|
|
140
|
+
* @returns the standard result.
|
|
141
|
+
*/
|
|
142
|
+
export async function chooseWithJev(decision, options, config, signal) {
|
|
143
|
+
if (typeof config.apiKey !== 'string' || config.apiKey.trim().length === 0) {
|
|
144
|
+
throw new JevError('api_key_missing', 'no Jev API key is configured');
|
|
145
|
+
}
|
|
146
|
+
const request = buildJevChoiceRequest(decision, options, config.model ?? JEV_DEFAULT_MODEL);
|
|
147
|
+
const transport = config.fetch ?? fetch;
|
|
148
|
+
const base = (config.baseURL ?? JEV_DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
149
|
+
const controller = new AbortController();
|
|
150
|
+
const timeout = setTimeout(() => controller.abort(), config.timeoutMs ?? 30_000);
|
|
151
|
+
const forwardAbort = () => controller.abort();
|
|
152
|
+
signal?.addEventListener('abort', forwardAbort, { once: true });
|
|
153
|
+
let response;
|
|
154
|
+
try {
|
|
155
|
+
response = await transport(`${base}/v1/systemone`, {
|
|
156
|
+
method: 'POST',
|
|
157
|
+
headers: {
|
|
158
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
159
|
+
'Content-Type': 'application/json',
|
|
160
|
+
},
|
|
161
|
+
body: JSON.stringify(request),
|
|
162
|
+
signal: controller.signal,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
if (controller.signal.aborted)
|
|
167
|
+
throw new JevError('aborted', 'the Jev call was aborted');
|
|
168
|
+
throw new JevError('connection', 'the Jev request failed before a response arrived');
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
clearTimeout(timeout);
|
|
172
|
+
signal?.removeEventListener('abort', forwardAbort);
|
|
173
|
+
}
|
|
174
|
+
if (!response.ok)
|
|
175
|
+
throw new JevError('http', `the Jev service returned HTTP ${response.status}`, response.status);
|
|
176
|
+
let payload;
|
|
177
|
+
try {
|
|
178
|
+
payload = await response.json();
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
throw new JevError('invalid_response', 'the Jev response is not JSON');
|
|
182
|
+
}
|
|
183
|
+
return convertJevChoiceResponse(payload, options);
|
|
184
|
+
}
|
|
185
|
+
/** Build the native multi-question request. */
|
|
186
|
+
export function buildJevJudgmentsRequest(state, questions, model = JEV_DEFAULT_MODEL) {
|
|
187
|
+
if (!Array.isArray(questions) || questions.length === 0 || questions.length > 16) {
|
|
188
|
+
throw new JevError('invalid_request', 'a judgment batch needs 1–16 questions');
|
|
189
|
+
}
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
const native = {};
|
|
192
|
+
for (const question of questions) {
|
|
193
|
+
if (typeof question.id !== 'string' || question.id.length === 0 || question.id.length > 64) {
|
|
194
|
+
throw new JevError('invalid_request', 'every question needs a 1–64 character id');
|
|
195
|
+
}
|
|
196
|
+
if (seen.has(question.id))
|
|
197
|
+
throw new JevError('invalid_request', `question id ${JSON.stringify(question.id)} is duplicated`);
|
|
198
|
+
seen.add(question.id);
|
|
199
|
+
if (question.type === 'boolean') {
|
|
200
|
+
if (typeof question.proposition !== 'string' || question.proposition.trim().length === 0) {
|
|
201
|
+
throw new JevError('invalid_request', `question ${question.id} needs a non-empty proposition`);
|
|
202
|
+
}
|
|
203
|
+
native[question.id] = { type: 'noul', instructions: question.proposition };
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (question.type !== 'choice')
|
|
207
|
+
throw new JevError('invalid_request', `question ${question.id} has an unknown type`);
|
|
208
|
+
if (typeof question.instructions !== 'string' || question.instructions.trim().length === 0) {
|
|
209
|
+
throw new JevError('invalid_request', `question ${question.id} needs non-empty instructions`);
|
|
210
|
+
}
|
|
211
|
+
const entries = Object.entries(question.criteria ?? {});
|
|
212
|
+
if (entries.length < 2 || entries.length > 32)
|
|
213
|
+
throw new JevError('invalid_request', `question ${question.id} needs 2–32 criteria`);
|
|
214
|
+
for (const [key, description] of entries) {
|
|
215
|
+
if (key.length === 0 || typeof description !== 'string' || description.length === 0) {
|
|
216
|
+
throw new JevError('invalid_request', `question ${question.id} has an invalid criterion`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
native[question.id] = { type: 'choice', instructions: question.instructions, criteria: question.criteria };
|
|
220
|
+
}
|
|
221
|
+
return { model, state, questions: native };
|
|
222
|
+
}
|
|
223
|
+
/** Convert the native batch response; missing or invalid answers are errors. */
|
|
224
|
+
export function convertJevJudgmentsResponse(payload, questions) {
|
|
225
|
+
if (typeof payload !== 'object' || payload === null)
|
|
226
|
+
throw new JevError('invalid_response', 'the response is not an object');
|
|
227
|
+
const root = payload;
|
|
228
|
+
if (typeof root.answers !== 'object' || root.answers === null)
|
|
229
|
+
throw new JevError('invalid_response', 'the response has no answers object');
|
|
230
|
+
const answers = root.answers;
|
|
231
|
+
const judgments = {};
|
|
232
|
+
for (const question of questions) {
|
|
233
|
+
const raw = answers[question.id];
|
|
234
|
+
if (typeof raw !== 'object' || raw === null)
|
|
235
|
+
throw new JevError('invalid_response', `the response is missing question ${question.id}`);
|
|
236
|
+
const answer = raw;
|
|
237
|
+
if (question.type === 'boolean') {
|
|
238
|
+
if (answer.type !== 'noul')
|
|
239
|
+
throw new JevError('invalid_response', `question ${question.id} is not a noul answer`);
|
|
240
|
+
const probability = answer.noul;
|
|
241
|
+
if (typeof probability !== 'number' || !Number.isFinite(probability) || probability < 0 || probability > 1) {
|
|
242
|
+
throw new JevError('invalid_response', `question ${question.id} has no probability in [0,1]`);
|
|
243
|
+
}
|
|
244
|
+
judgments[question.id] = { type: 'boolean', probability };
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
if (answer.type !== 'choice')
|
|
248
|
+
throw new JevError('invalid_response', `question ${question.id} is not a choice answer`);
|
|
249
|
+
const chosen = answer.choice;
|
|
250
|
+
if (chosen !== null && typeof chosen !== 'string')
|
|
251
|
+
throw new JevError('invalid_response', `question ${question.id} has an invalid chosen value`);
|
|
252
|
+
if (typeof chosen === 'string' && !Object.hasOwn(question.criteria, chosen)) {
|
|
253
|
+
throw new JevError('invalid_response', `question ${question.id} chose ${JSON.stringify(chosen)}, not a supplied criterion`);
|
|
254
|
+
}
|
|
255
|
+
const probabilities = answer.probabilities;
|
|
256
|
+
if (typeof probabilities !== 'object' || probabilities === null || Array.isArray(probabilities)) {
|
|
257
|
+
throw new JevError('invalid_response', `question ${question.id} has no probability map`);
|
|
258
|
+
}
|
|
259
|
+
const map = probabilities;
|
|
260
|
+
const expected = Object.keys(question.criteria);
|
|
261
|
+
if (Object.keys(map).length !== expected.length || expected.some(key => !Object.hasOwn(map, key))) {
|
|
262
|
+
throw new JevError('invalid_response', `question ${question.id} probability keys do not match its criteria`);
|
|
263
|
+
}
|
|
264
|
+
let sum = 0;
|
|
265
|
+
for (const key of expected) {
|
|
266
|
+
const value = map[key];
|
|
267
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {
|
|
268
|
+
throw new JevError('invalid_response', `question ${question.id} has an invalid probability`);
|
|
269
|
+
}
|
|
270
|
+
sum += value;
|
|
271
|
+
}
|
|
272
|
+
if (Math.abs(sum - 1) > 1e-6)
|
|
273
|
+
throw new JevError('invalid_response', `question ${question.id} probabilities are not normalized`);
|
|
274
|
+
const confidence = answer.confidence;
|
|
275
|
+
if (typeof confidence !== 'number' || !Number.isFinite(confidence) || confidence < 0 || confidence > 1) {
|
|
276
|
+
throw new JevError('invalid_response', `question ${question.id} has no finite confidence`);
|
|
277
|
+
}
|
|
278
|
+
judgments[question.id] = { type: 'choice', chosen, probabilities: map, confidence };
|
|
279
|
+
}
|
|
280
|
+
return { model: typeof root.model === 'string' ? root.model : 'unknown', judgments };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Ask independent atomic judgments in ONE native request.
|
|
284
|
+
* @param state - the same state for every question.
|
|
285
|
+
* @param questions - 1–16 independent questions.
|
|
286
|
+
* @param config - API key, base URL, model and optional transport.
|
|
287
|
+
* @param signal - cancellation.
|
|
288
|
+
* @returns native judgments keyed by question id.
|
|
289
|
+
*/
|
|
290
|
+
export async function judgeWithJev(state, questions, config, signal) {
|
|
291
|
+
if (typeof config.apiKey !== 'string' || config.apiKey.trim().length === 0) {
|
|
292
|
+
throw new JevError('api_key_missing', 'no Jev API key is configured');
|
|
293
|
+
}
|
|
294
|
+
const request = buildJevJudgmentsRequest(state, questions, config.model ?? JEV_DEFAULT_MODEL);
|
|
295
|
+
const transport = config.fetch ?? fetch;
|
|
296
|
+
const base = (config.baseURL ?? JEV_DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
297
|
+
const controller = new AbortController();
|
|
298
|
+
const timeout = setTimeout(() => controller.abort(), config.timeoutMs ?? 30_000);
|
|
299
|
+
const forwardAbort = () => controller.abort();
|
|
300
|
+
signal?.addEventListener('abort', forwardAbort, { once: true });
|
|
301
|
+
let response;
|
|
302
|
+
try {
|
|
303
|
+
response = await transport(`${base}/v1/systemone`, {
|
|
304
|
+
method: 'POST',
|
|
305
|
+
headers: { Authorization: `Bearer ${config.apiKey}`, 'Content-Type': 'application/json' },
|
|
306
|
+
body: JSON.stringify(request),
|
|
307
|
+
signal: controller.signal,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
if (controller.signal.aborted)
|
|
312
|
+
throw new JevError('aborted', 'the Jev call was aborted');
|
|
313
|
+
throw new JevError('connection', 'the Jev request failed before a response arrived');
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
clearTimeout(timeout);
|
|
317
|
+
signal?.removeEventListener('abort', forwardAbort);
|
|
318
|
+
}
|
|
319
|
+
if (!response.ok)
|
|
320
|
+
throw new JevError('http', `the Jev service returned HTTP ${response.status}`, response.status);
|
|
321
|
+
let payload;
|
|
322
|
+
try {
|
|
323
|
+
payload = await response.json();
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
throw new JevError('invalid_response', 'the Jev response is not JSON');
|
|
327
|
+
}
|
|
328
|
+
return convertJevJudgmentsResponse(payload, questions);
|
|
329
|
+
}
|
|
330
|
+
/** The MCP contract for the atomic judgment batch. */
|
|
331
|
+
export const JEV_JUDGMENTS_CONTRACT = {
|
|
332
|
+
contract: 'decision.judgments.jev',
|
|
333
|
+
version: '1.0.0',
|
|
334
|
+
toolName: 'decision_judgments_jev',
|
|
335
|
+
description: 'Ask independent atomic boolean/choice questions through Jev in one native request.',
|
|
336
|
+
inputSchema: {
|
|
337
|
+
type: 'object',
|
|
338
|
+
additionalProperties: false,
|
|
339
|
+
required: ['state', 'questions'],
|
|
340
|
+
properties: {
|
|
341
|
+
state: { type: 'object', additionalProperties: true },
|
|
342
|
+
questions: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
outputSchema: {
|
|
346
|
+
type: 'object',
|
|
347
|
+
additionalProperties: false,
|
|
348
|
+
required: ['model', 'judgments'],
|
|
349
|
+
properties: {
|
|
350
|
+
model: { type: 'string' },
|
|
351
|
+
judgments: { type: 'object', additionalProperties: true },
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
semantics: { deterministic: false, readsInputs: true },
|
|
355
|
+
limits: {},
|
|
356
|
+
unsupported: ['no local Jev weights', 'no chat schema'],
|
|
357
|
+
};
|
|
358
|
+
/** The MCP contract for the single-choice Jev tool. */
|
|
359
|
+
export const JEV_CHOOSE_CONTRACT = {
|
|
360
|
+
contract: 'decision.choose.jev', version: '1.0.0', toolName: 'decision_choose_jev',
|
|
361
|
+
description: 'Choose 2–16 options through the remote Jev typed-question API on the standard decision result.',
|
|
362
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['decision', 'options'], properties: { decision: { type: 'string' }, options: { type: 'array', items: { type: 'string' } } } },
|
|
363
|
+
outputSchema: { type: 'object', additionalProperties: false, required: ['chosen', 'confidence', 'reason'], properties: { chosen: { type: 'integer' }, confidence: { type: 'string', enum: ['confident', 'likely', 'tentative'] }, reason: { type: 'string' } } },
|
|
364
|
+
semantics: { deterministic: false, readsInputs: true }, limits: {},
|
|
365
|
+
};
|
|
366
|
+
//# sourceMappingURL=jev.js.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The startup hook that migrates a legacy model-id era `state.json` into the
|
|
3
|
+
* versioned world (BASE-09, BASE-10), ONCE per profile — as a REAL
|
|
4
|
+
* transaction with crash recovery, not a read-then-overwrite.
|
|
5
|
+
*
|
|
6
|
+
* Before this module the migration table existed only as an SDK library with
|
|
7
|
+
* tests: nothing in the host's production startup ever ran it, so a real
|
|
8
|
+
* upgrade kept reading the old-world document forever. This module is the
|
|
9
|
+
* production caller. Its guarantees:
|
|
10
|
+
*
|
|
11
|
+
* - ONCE-ANCHOR + COMMIT: a non-secret sidecar marker
|
|
12
|
+
* (`<stateFile>.migrated.json`) is the commit record, written ATOMICALLY
|
|
13
|
+
* (temp + fsync + rename) as the LAST step of the transaction. The host's
|
|
14
|
+
* own state document keeps its exact shape — the store's writes are
|
|
15
|
+
* untouched and no parallel format is written. A marker is VALIDATED on
|
|
16
|
+
* every read (parse + exact version + list shape): a corrupt or
|
|
17
|
+
* foreign-version marker FAILS CLOSED instead of silently counting the
|
|
18
|
+
* profile as migrated;
|
|
19
|
+
* - IMMUTABLE JOURNAL: before ANY mutation, the original legacy document is
|
|
20
|
+
* journaled to `<stateFile>.legacy-backup.json` with EXCLUSIVE creation
|
|
21
|
+
* (`wx`). The journal is the legacy INPUT for every recovery. Its
|
|
22
|
+
* first-write-wins behavior is guaranteed BY THE TRANSACTION LOCK (the
|
|
23
|
+
* exists-check before the rename is advisory, not a lock);
|
|
24
|
+
* - RECOVERY: a crash between the host write and the marker leaves a journal
|
|
25
|
+
* WITHOUT a committed marker. The next boot detects that state and re-runs
|
|
26
|
+
* the transaction FROM THE VALIDATED JOURNAL — never from the already-
|
|
27
|
+
* rewritten state file, which has lost the staged enables, provider picks
|
|
28
|
+
* and prepared-asset facts. The host write MERGES with the current
|
|
29
|
+
* document (current enables are operator-era facts and are preserved;
|
|
30
|
+
* legacy disables are added), so an operator change after the crash is
|
|
31
|
+
* never discarded. A corrupt journal with no marker FAILS CLOSED;
|
|
32
|
+
* - TRANSACTION LOCK: the whole transaction runs under an exclusive lock
|
|
33
|
+
* file with an ownership token and pid. A stale lock is NEVER taken over
|
|
34
|
+
* automatically — the read-then-remove sequence is not atomic and two
|
|
35
|
+
* concurrent reapers could delete a successor's fresh lock — so a held lock
|
|
36
|
+
* FAILS CLOSED at the deadline and the operator removes it deliberately;
|
|
37
|
+
* release removes only a token-owned lock (the same discipline as the
|
|
38
|
+
* credential store);
|
|
39
|
+
* - the SDK profile half runs THROUGH the SDK's own
|
|
40
|
+
* `migrateLegacyProfileState` (its lock, idempotence, version gate) BEFORE
|
|
41
|
+
* the host document is written;
|
|
42
|
+
* - DISABLED legacy choices are preserved — ALL of them, mapped or not: an
|
|
43
|
+
* unmapped disabled id that vanished from the host state would let a later
|
|
44
|
+
* package restore silently enable what the operator turned off. Unresolved
|
|
45
|
+
* ids are REPORTED separately, never enabled;
|
|
46
|
+
* - legacy ENABLES are STAGED, never granted (BASE-10: a legacy enable is
|
|
47
|
+
* not consent to install, activate or prepare third-party code);
|
|
48
|
+
* - every persisted artifact (marker, journal, lock) is NON-SECRET by
|
|
49
|
+
* construction: model ids, provider identifiers and counts, never a secret.
|
|
50
|
+
*
|
|
51
|
+
* @module @try-works/dsh-tool-mode/legacy-migration
|
|
52
|
+
*/
|
|
53
|
+
import { type PersistedState, type StateStore } from './state.ts';
|
|
54
|
+
/** The marker version this host writes; equality, never a lower bound. */
|
|
55
|
+
export declare const MIGRATION_MARKER_VERSION: 1;
|
|
56
|
+
/** What the startup hook did. */
|
|
57
|
+
export interface LegacyStartupOutcome {
|
|
58
|
+
/** False when there was nothing to migrate (marker present, or fresh profile). */
|
|
59
|
+
readonly ran: boolean;
|
|
60
|
+
/** The host choices to adopt after the run (the caller replaces its persisted copy). */
|
|
61
|
+
readonly hostState: PersistedState;
|
|
62
|
+
/** Legacy model ids that were ENABLED and are therefore STAGED, never granted. */
|
|
63
|
+
readonly staged: readonly string[];
|
|
64
|
+
/** Legacy ids the table could not map; reported, never enabled. */
|
|
65
|
+
readonly unresolved: readonly string[];
|
|
66
|
+
/** A non-secret one-line summary for the startup log, when anything happened. */
|
|
67
|
+
readonly logLine: string | undefined;
|
|
68
|
+
/** True when this run RECOVERED an interrupted transaction from the journal. */
|
|
69
|
+
readonly recovered: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** The marker path for one state file. */
|
|
72
|
+
export declare function migrationMarkerPath(stateFile: string): string;
|
|
73
|
+
/** The backup path for one state file. */
|
|
74
|
+
export declare function legacyBackupPath(stateFile: string): string;
|
|
75
|
+
/** The transaction lock path for one state file. */
|
|
76
|
+
export declare function migrationLockPath(stateFile: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Run the one-time legacy startup migration (with crash recovery).
|
|
79
|
+
*
|
|
80
|
+
* @param options.stateFile - the host's configured isolated state path.
|
|
81
|
+
* @param options.store - the host's state store over that path.
|
|
82
|
+
* @param options.extensionStoreDir - when the deployment mounts an extension
|
|
83
|
+
* store, the SDK profile migration runs there too.
|
|
84
|
+
* @param options.log - a non-secret log sink (the host's logger).
|
|
85
|
+
* @returns the outcome; the caller ALWAYS adopts `hostState` (the hook returns
|
|
86
|
+
* a fresh post-lock read on every path, so adopting it never re-applies a
|
|
87
|
+
* pre-hook snapshot).
|
|
88
|
+
*/
|
|
89
|
+
export declare function runLegacyStartupMigration(options: {
|
|
90
|
+
readonly stateFile: string;
|
|
91
|
+
readonly store: StateStore;
|
|
92
|
+
readonly extensionStoreDir?: string;
|
|
93
|
+
readonly log?: (line: string) => void;
|
|
94
|
+
}): Promise<LegacyStartupOutcome>;
|
|
95
|
+
//# sourceMappingURL=legacy-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-migration.d.ts","sourceRoot":"","sources":["../src/legacy-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAqBH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAGjE,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,EAAG,CAAU,CAAA;AAElD,iCAAiC;AACjC,MAAM,WAAW,oBAAoB;IACnC,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB,wFAAwF;IACxF,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;IAClC,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AA2BD,0CAA0C;AAC1C,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AA+ND;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAWhC"}
|