@try-works/dsh-tool-mode 0.0.0-stage → 0.5.44
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/README.md +299 -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 +4039 -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 +2507 -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 +5197 -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/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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECL-07 read-only discovery contracts.
|
|
3
|
+
*
|
|
4
|
+
* These tools were registered natively but withheld from MCP, so an authorized
|
|
5
|
+
* external caller could not read the catalogue or per-tool schemas. Their contracts
|
|
6
|
+
* are published independently of any model package; the execution path is the ordinary
|
|
7
|
+
* DSH tool runtime, not a private MCP-only handler.
|
|
8
|
+
*/
|
|
9
|
+
/** The result shape both discovery tools return. */
|
|
10
|
+
const discoveryOutputSchema = {
|
|
11
|
+
type: 'object',
|
|
12
|
+
additionalProperties: false,
|
|
13
|
+
required: ['catalogRevision', 'tools'],
|
|
14
|
+
properties: {
|
|
15
|
+
catalogRevision: { type: 'string' },
|
|
16
|
+
tools: {
|
|
17
|
+
type: 'array',
|
|
18
|
+
items: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
additionalProperties: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* `tool_mode_describe` advertises the two contract facts its result already carries.
|
|
27
|
+
*
|
|
28
|
+
* `tool_mode_list` has a different per-tool shape (readiness, no semantics), so the
|
|
29
|
+
* two tools do not share one open item schema. Both fields are declared here so an
|
|
30
|
+
* MCP client can rely on them; the item stays open for implementation-specific facts.
|
|
31
|
+
*/
|
|
32
|
+
const describeOutputSchema = {
|
|
33
|
+
type: 'object',
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
required: ['catalogRevision', 'tools'],
|
|
36
|
+
properties: {
|
|
37
|
+
catalogRevision: { type: 'string' },
|
|
38
|
+
tools: {
|
|
39
|
+
type: 'array',
|
|
40
|
+
items: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
additionalProperties: true,
|
|
43
|
+
properties: {
|
|
44
|
+
name: { type: 'string' },
|
|
45
|
+
semantics: { type: 'object', additionalProperties: true },
|
|
46
|
+
unsupported: { type: 'array', items: { type: 'string' }, maxItems: 64 },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/** `tool_mode_list` — permitted tools, readiness and catalog revision. */
|
|
53
|
+
export const TOOL_MODE_LIST_CONTRACT = {
|
|
54
|
+
contract: 'host.tool_mode_list',
|
|
55
|
+
version: '1.0.0',
|
|
56
|
+
toolName: 'tool_mode_list',
|
|
57
|
+
description: 'List the tools this caller is permitted to use, with readiness summaries and the current catalog '
|
|
58
|
+
+ 'revision. Read-only discovery (DECL-07): it never installs, prepares, activates or changes anything.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
properties: {},
|
|
63
|
+
required: [],
|
|
64
|
+
},
|
|
65
|
+
outputSchema: discoveryOutputSchema,
|
|
66
|
+
semantics: { readOnly: true, sideEffects: false },
|
|
67
|
+
limits: {},
|
|
68
|
+
unsupported: ['Mutating the catalog or model selection.'],
|
|
69
|
+
};
|
|
70
|
+
/** `tool_mode_describe` — schemas, model facts, limits and catalog revision. */
|
|
71
|
+
export const TOOL_MODE_DESCRIBE_CONTRACT = {
|
|
72
|
+
contract: 'host.tool_mode_describe',
|
|
73
|
+
version: '1.0.0',
|
|
74
|
+
toolName: 'tool_mode_describe',
|
|
75
|
+
description: 'Describe one or more tools by name: the selected input/output schemas, the resolved model, limits and '
|
|
76
|
+
+ 'the catalog revision. Read-only discovery (DECL-07): it never installs, prepares, activates or changes anything.',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
additionalProperties: false,
|
|
80
|
+
required: ['tools'],
|
|
81
|
+
properties: {
|
|
82
|
+
tools: { type: 'array', minItems: 1, items: { type: 'string', minLength: 1 } },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
outputSchema: describeOutputSchema,
|
|
86
|
+
semantics: { readOnly: true, sideEffects: false },
|
|
87
|
+
limits: { maxTools: 64 },
|
|
88
|
+
unsupported: ['Mutating the catalog or model selection.'],
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=discovery-contracts.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECL-07 describe helpers: turn a tool's selected JSON schemas into the TypeScript
|
|
3
|
+
* bindings, examples and skill instructions a tool-only MCP client can consume.
|
|
4
|
+
*
|
|
5
|
+
* The helpers are deliberately small and schema-driven: the described tool's own
|
|
6
|
+
* schemas are the source, so a changed schema changes the binding and example rather
|
|
7
|
+
* than leaving hand-written prose to drift.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Render TypeScript bindings for one schema.
|
|
11
|
+
* @param name - the tool name.
|
|
12
|
+
* @param suffix - `Input` or `Output`.
|
|
13
|
+
* @param schema - the selected JSON schema.
|
|
14
|
+
* @returns an exported interface/type declaration.
|
|
15
|
+
*/
|
|
16
|
+
export declare function typescriptBindings(name: string, suffix: 'Input' | 'Output', schema: unknown): string;
|
|
17
|
+
/** Build one example value from a JSON schema (required and optional fields included). */
|
|
18
|
+
export declare function exampleFromSchema(schema: unknown): unknown;
|
|
19
|
+
/** The skill facts a model-backed tool advertises (DECL-07). */
|
|
20
|
+
export interface DescribeSkill {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly whenToUse: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Project a catalog skill declaration into the describe payload.
|
|
27
|
+
* @param skill - the declaration, if the tool has one.
|
|
28
|
+
* @returns the skill facts, or undefined.
|
|
29
|
+
*/
|
|
30
|
+
export declare function describeSkill(skill: {
|
|
31
|
+
readonly name?: unknown;
|
|
32
|
+
readonly description?: unknown;
|
|
33
|
+
readonly whenToUse?: unknown;
|
|
34
|
+
} | undefined): DescribeSkill | undefined;
|
|
35
|
+
//# sourceMappingURL=discovery-describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery-describe.d.ts","sourceRoot":"","sources":["../src/discovery-describe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsCH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAMpG;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAoB1D;AAED,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAOxC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECL-07 describe helpers: turn a tool's selected JSON schemas into the TypeScript
|
|
3
|
+
* bindings, examples and skill instructions a tool-only MCP client can consume.
|
|
4
|
+
*
|
|
5
|
+
* The helpers are deliberately small and schema-driven: the described tool's own
|
|
6
|
+
* schemas are the source, so a changed schema changes the binding and example rather
|
|
7
|
+
* than leaving hand-written prose to drift.
|
|
8
|
+
*/
|
|
9
|
+
/** Convert a JSON-schema type to a TypeScript type expression. */
|
|
10
|
+
function schemaType(schema) {
|
|
11
|
+
if (schema === null || typeof schema !== 'object')
|
|
12
|
+
return 'unknown';
|
|
13
|
+
const value = schema;
|
|
14
|
+
if (Array.isArray(value.enum) && value.enum.length > 0) {
|
|
15
|
+
return value.enum.map(entry => JSON.stringify(entry)).join(' | ');
|
|
16
|
+
}
|
|
17
|
+
if (value.const !== undefined)
|
|
18
|
+
return JSON.stringify(value.const);
|
|
19
|
+
const type = value.type;
|
|
20
|
+
if (Array.isArray(type))
|
|
21
|
+
return type.map(single => schemaType({ ...value, type: single })).join(' | ');
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'string': return 'string';
|
|
24
|
+
case 'integer':
|
|
25
|
+
case 'number': return 'number';
|
|
26
|
+
case 'boolean': return 'boolean';
|
|
27
|
+
case 'null': return 'null';
|
|
28
|
+
case 'array': return `Array<${schemaType(value.items)}>`;
|
|
29
|
+
case 'object': {
|
|
30
|
+
const properties = value.properties;
|
|
31
|
+
if (properties === null || typeof properties !== 'object')
|
|
32
|
+
return 'Record<string, unknown>';
|
|
33
|
+
const required = new Set(Array.isArray(value.required) ? value.required : []);
|
|
34
|
+
const fields = Object.entries(properties)
|
|
35
|
+
.map(([key, property]) => `${JSON.stringify(key)}${required.has(key) ? '' : '?'}: ${schemaType(property)}`);
|
|
36
|
+
return fields.length === 0 ? 'Record<string, never>' : `{ ${fields.join('; ')} }`;
|
|
37
|
+
}
|
|
38
|
+
default: return 'unknown';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Pascal-case a tool name for an interface identifier. */
|
|
42
|
+
function pascalCase(name) {
|
|
43
|
+
return name.split(/[^A-Za-z0-9]+/).filter(Boolean)
|
|
44
|
+
.map(part => `${part[0].toUpperCase()}${part.slice(1)}`)
|
|
45
|
+
.join('') || 'Tool';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Render TypeScript bindings for one schema.
|
|
49
|
+
* @param name - the tool name.
|
|
50
|
+
* @param suffix - `Input` or `Output`.
|
|
51
|
+
* @param schema - the selected JSON schema.
|
|
52
|
+
* @returns an exported interface/type declaration.
|
|
53
|
+
*/
|
|
54
|
+
export function typescriptBindings(name, suffix, schema) {
|
|
55
|
+
const identifier = `${pascalCase(name)}${suffix}`;
|
|
56
|
+
if (schema === null || typeof schema !== 'object' || schema.type !== 'object') {
|
|
57
|
+
return `export type ${identifier} = ${schemaType(schema)}`;
|
|
58
|
+
}
|
|
59
|
+
return `export interface ${identifier} ${schemaType(schema)}`;
|
|
60
|
+
}
|
|
61
|
+
/** Build one example value from a JSON schema (required and optional fields included). */
|
|
62
|
+
export function exampleFromSchema(schema) {
|
|
63
|
+
if (schema === null || typeof schema !== 'object')
|
|
64
|
+
return null;
|
|
65
|
+
const value = schema;
|
|
66
|
+
if (Array.isArray(value.enum) && value.enum.length > 0)
|
|
67
|
+
return value.enum[0];
|
|
68
|
+
if (value.const !== undefined)
|
|
69
|
+
return value.const;
|
|
70
|
+
switch (value.type) {
|
|
71
|
+
case 'object': {
|
|
72
|
+
const properties = value.properties;
|
|
73
|
+
if (properties === null || typeof properties !== 'object')
|
|
74
|
+
return {};
|
|
75
|
+
return Object.fromEntries(Object.entries(properties).map(([key, property]) => [key, exampleFromSchema(property)]));
|
|
76
|
+
}
|
|
77
|
+
case 'array': return [exampleFromSchema(value.items)];
|
|
78
|
+
case 'string': return 'example';
|
|
79
|
+
case 'integer':
|
|
80
|
+
case 'number': return 1;
|
|
81
|
+
case 'boolean': return true;
|
|
82
|
+
default: return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Project a catalog skill declaration into the describe payload.
|
|
87
|
+
* @param skill - the declaration, if the tool has one.
|
|
88
|
+
* @returns the skill facts, or undefined.
|
|
89
|
+
*/
|
|
90
|
+
export function describeSkill(skill) {
|
|
91
|
+
if (skill === undefined || typeof skill.name !== 'string' || skill.name.length === 0)
|
|
92
|
+
return undefined;
|
|
93
|
+
return {
|
|
94
|
+
name: skill.name,
|
|
95
|
+
description: typeof skill.description === 'string' ? skill.description : '',
|
|
96
|
+
whenToUse: typeof skill.whenToUse === 'string' ? skill.whenToUse : '',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=discovery-describe.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AT-52 — a persistent embedding index that records its space and model identity.
|
|
3
|
+
*
|
|
4
|
+
* There was no vector store in this repository, so a consumer had no safe way to
|
|
5
|
+
* persist vectors across an upgrade. This index is deliberately small but it makes
|
|
6
|
+
* the compatibility rule structural instead of documentary:
|
|
7
|
+
* - the space id, dimensions, model id and model generation are persisted;
|
|
8
|
+
* - a record whose space differs is refused (no 384→768 reuse);
|
|
9
|
+
* - an upgrade bumps the index schema and keeps every vector and its space;
|
|
10
|
+
* - a memory-only index is explicit and never writes.
|
|
11
|
+
*/
|
|
12
|
+
export interface EmbeddingSpaceIdentity {
|
|
13
|
+
readonly spaceId: string;
|
|
14
|
+
readonly dimensions: number;
|
|
15
|
+
readonly modelId: string;
|
|
16
|
+
readonly modelGeneration: number | string;
|
|
17
|
+
}
|
|
18
|
+
export interface EmbeddingRecord {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly vector: readonly number[];
|
|
21
|
+
readonly metadata?: Readonly<Record<string, string | number | boolean>>;
|
|
22
|
+
}
|
|
23
|
+
export interface EmbeddingIndexFile {
|
|
24
|
+
readonly schemaVersion: number;
|
|
25
|
+
readonly space: EmbeddingSpaceIdentity;
|
|
26
|
+
readonly records: Readonly<Record<string, EmbeddingRecord>>;
|
|
27
|
+
}
|
|
28
|
+
export declare class IncompatibleEmbeddingSpace extends Error {
|
|
29
|
+
readonly code = "INCOMPATIBLE_EMBEDDING_SPACE";
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A file-backed embedding index. `open` adopts the persisted space; it never
|
|
34
|
+
* silently reinterprets existing vectors in a different space.
|
|
35
|
+
*/
|
|
36
|
+
export declare class EmbeddingIndex {
|
|
37
|
+
#private;
|
|
38
|
+
private constructor();
|
|
39
|
+
static open(file: string | null, expected?: EmbeddingSpaceIdentity): EmbeddingIndex;
|
|
40
|
+
get space(): EmbeddingSpaceIdentity;
|
|
41
|
+
get size(): number;
|
|
42
|
+
upsert(record: EmbeddingRecord): void;
|
|
43
|
+
get(id: string): EmbeddingRecord | undefined;
|
|
44
|
+
all(): readonly EmbeddingRecord[];
|
|
45
|
+
/** Persist with the current schema version and the SAME space. */
|
|
46
|
+
save(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Upgrade the index schema without touching the space or the vectors.
|
|
49
|
+
* A target space is refused unless it is identical.
|
|
50
|
+
*/
|
|
51
|
+
upgrade(targetSchemaVersion: number, targetSpace?: EmbeddingSpaceIdentity): void;
|
|
52
|
+
}
|
|
53
|
+
/** A memory-only index: explicit, bounded to the process, never writes. */
|
|
54
|
+
export declare function openMemoryEmbeddingIndex(space: EmbeddingSpaceIdentity): EmbeddingIndex;
|
|
55
|
+
//# sourceMappingURL=embedding-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-index.d.ts","sourceRoot":"","sources":["../src/embedding-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;CACxE;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAA;IACtC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;CAC5D;AAED,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,kCAAiC;gBAClC,OAAO,EAAE,MAAM;CAI5B;AA+BD;;;GAGG;AACH,qBAAa,cAAc;;IAMzB,OAAO;IAOP,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,sBAAsB,GAAG,cAAc;IAyBnF,IAAI,KAAK,IAAI,sBAAsB,CAAuB;IAC1D,IAAI,IAAI,IAAI,MAAM,CAA8B;IAEhD,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAKrC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAC5C,GAAG,IAAI,SAAS,eAAe,EAAE;IAEjC,kEAAkE;IAClE,IAAI,IAAI,IAAI;IAYZ;;;OAGG;IACH,OAAO,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,GAAE,sBAAoC,GAAG,IAAI;CAY9F;AAED,2EAA2E;AAC3E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,cAAc,CAEtF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AT-52 — a persistent embedding index that records its space and model identity.
|
|
3
|
+
*
|
|
4
|
+
* There was no vector store in this repository, so a consumer had no safe way to
|
|
5
|
+
* persist vectors across an upgrade. This index is deliberately small but it makes
|
|
6
|
+
* the compatibility rule structural instead of documentary:
|
|
7
|
+
* - the space id, dimensions, model id and model generation are persisted;
|
|
8
|
+
* - a record whose space differs is refused (no 384→768 reuse);
|
|
9
|
+
* - an upgrade bumps the index schema and keeps every vector and its space;
|
|
10
|
+
* - a memory-only index is explicit and never writes.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
13
|
+
export class IncompatibleEmbeddingSpace extends Error {
|
|
14
|
+
code = 'INCOMPATIBLE_EMBEDDING_SPACE';
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'IncompatibleEmbeddingSpace';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const INDEX_SCHEMA_VERSION = 2;
|
|
21
|
+
function sameSpace(left, right) {
|
|
22
|
+
return left.spaceId === right.spaceId
|
|
23
|
+
&& left.dimensions === right.dimensions
|
|
24
|
+
&& left.modelId === right.modelId
|
|
25
|
+
&& String(left.modelGeneration) === String(right.modelGeneration);
|
|
26
|
+
}
|
|
27
|
+
function validateSpace(space) {
|
|
28
|
+
if (space.spaceId.trim() === '')
|
|
29
|
+
throw new IncompatibleEmbeddingSpace('the embedding space id is empty');
|
|
30
|
+
if (!Number.isInteger(space.dimensions) || space.dimensions <= 0) {
|
|
31
|
+
throw new IncompatibleEmbeddingSpace(`invalid embedding dimensions: ${space.dimensions}`);
|
|
32
|
+
}
|
|
33
|
+
if (space.modelId.trim() === '')
|
|
34
|
+
throw new IncompatibleEmbeddingSpace('the model id is empty');
|
|
35
|
+
}
|
|
36
|
+
function validateRecord(record, space) {
|
|
37
|
+
if (record.id.trim() === '')
|
|
38
|
+
throw new IncompatibleEmbeddingSpace('the record id is empty');
|
|
39
|
+
if (record.vector.length !== space.dimensions) {
|
|
40
|
+
throw new IncompatibleEmbeddingSpace(`record ${record.id} has ${record.vector.length} dimensions, but space ${space.spaceId} is ${space.dimensions}-dimensional`);
|
|
41
|
+
}
|
|
42
|
+
if (!record.vector.every(value => Number.isFinite(value))) {
|
|
43
|
+
throw new IncompatibleEmbeddingSpace(`record ${record.id} contains a non-finite value`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A file-backed embedding index. `open` adopts the persisted space; it never
|
|
48
|
+
* silently reinterprets existing vectors in a different space.
|
|
49
|
+
*/
|
|
50
|
+
export class EmbeddingIndex {
|
|
51
|
+
#file;
|
|
52
|
+
#space;
|
|
53
|
+
#schemaVersion;
|
|
54
|
+
#records = new Map();
|
|
55
|
+
constructor(file, space, schemaVersion = INDEX_SCHEMA_VERSION) {
|
|
56
|
+
validateSpace(space);
|
|
57
|
+
this.#file = file;
|
|
58
|
+
this.#space = space;
|
|
59
|
+
this.#schemaVersion = schemaVersion;
|
|
60
|
+
}
|
|
61
|
+
static open(file, expected) {
|
|
62
|
+
if (file === null) {
|
|
63
|
+
if (expected === undefined)
|
|
64
|
+
throw new IncompatibleEmbeddingSpace('a memory-only index needs an explicit space');
|
|
65
|
+
return new EmbeddingIndex(null, expected);
|
|
66
|
+
}
|
|
67
|
+
if (!existsSync(file)) {
|
|
68
|
+
if (expected === undefined)
|
|
69
|
+
throw new IncompatibleEmbeddingSpace(`the index ${file} does not exist and no space was given`);
|
|
70
|
+
return new EmbeddingIndex(file, expected);
|
|
71
|
+
}
|
|
72
|
+
const parsed = JSON.parse(readFileSync(file, 'utf8'));
|
|
73
|
+
if (parsed.space === undefined)
|
|
74
|
+
throw new IncompatibleEmbeddingSpace(`the index ${file} has no recorded embedding space`);
|
|
75
|
+
if (expected !== undefined && !sameSpace(parsed.space, expected)) {
|
|
76
|
+
throw new IncompatibleEmbeddingSpace(`the index ${file} records space ${parsed.space.spaceId}/${parsed.space.dimensions} model ${parsed.space.modelId}#${parsed.space.modelGeneration}, `
|
|
77
|
+
+ `not ${expected.spaceId}/${expected.dimensions} model ${expected.modelId}#${expected.modelGeneration}`);
|
|
78
|
+
}
|
|
79
|
+
const index = new EmbeddingIndex(file, parsed.space, parsed.schemaVersion ?? 1);
|
|
80
|
+
for (const [id, record] of Object.entries(parsed.records ?? {})) {
|
|
81
|
+
validateRecord(record, parsed.space);
|
|
82
|
+
index.#records.set(id, record);
|
|
83
|
+
}
|
|
84
|
+
return index;
|
|
85
|
+
}
|
|
86
|
+
get space() { return this.#space; }
|
|
87
|
+
get size() { return this.#records.size; }
|
|
88
|
+
upsert(record) {
|
|
89
|
+
validateRecord(record, this.#space);
|
|
90
|
+
this.#records.set(record.id, record);
|
|
91
|
+
}
|
|
92
|
+
get(id) { return this.#records.get(id); }
|
|
93
|
+
all() { return [...this.#records.values()]; }
|
|
94
|
+
/** Persist with the current schema version and the SAME space. */
|
|
95
|
+
save() {
|
|
96
|
+
if (this.#file === null)
|
|
97
|
+
return;
|
|
98
|
+
const payload = {
|
|
99
|
+
schemaVersion: this.#schemaVersion,
|
|
100
|
+
space: this.#space,
|
|
101
|
+
records: Object.fromEntries(this.#records),
|
|
102
|
+
};
|
|
103
|
+
const temporary = `${this.#file}.tmp`;
|
|
104
|
+
writeFileSync(temporary, `${JSON.stringify(payload, null, 2)}\n`);
|
|
105
|
+
renameSync(temporary, this.#file);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Upgrade the index schema without touching the space or the vectors.
|
|
109
|
+
* A target space is refused unless it is identical.
|
|
110
|
+
*/
|
|
111
|
+
upgrade(targetSchemaVersion, targetSpace = this.#space) {
|
|
112
|
+
if (!sameSpace(targetSpace, this.#space)) {
|
|
113
|
+
throw new IncompatibleEmbeddingSpace(`refusing to upgrade a ${this.#space.spaceId}/${this.#space.dimensions} index to ${targetSpace.spaceId}/${targetSpace.dimensions}`);
|
|
114
|
+
}
|
|
115
|
+
if (!Number.isInteger(targetSchemaVersion) || targetSchemaVersion < 1) {
|
|
116
|
+
throw new IncompatibleEmbeddingSpace(`invalid index schema version: ${targetSchemaVersion}`);
|
|
117
|
+
}
|
|
118
|
+
this.#schemaVersion = targetSchemaVersion;
|
|
119
|
+
this.save();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** A memory-only index: explicit, bounded to the process, never writes. */
|
|
123
|
+
export function openMemoryEmbeddingIndex(space) {
|
|
124
|
+
return EmbeddingIndex.open(null, space);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=embedding-index.js.map
|