@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
package/lib/mcp-usage.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bounded external-MCP call ledger (plan §3.4).
|
|
3
|
+
*
|
|
4
|
+
* External MCP `tools/call`s are not session events, so the only honest way to answer
|
|
5
|
+
* "MCP was used, by whom, how often" is to persist them. One JSONL row per call, trimmed
|
|
6
|
+
* at a bound, written beside the host state.
|
|
7
|
+
*
|
|
8
|
+
* The record TYPE is the privacy boundary: it has identity, timings, failure class,
|
|
9
|
+
* sizes and the receipt id, and deliberately nowhere to put arguments, results,
|
|
10
|
+
* credentials or the bearer token. A future change cannot start logging payloads by
|
|
11
|
+
* accident without changing this type.
|
|
12
|
+
*
|
|
13
|
+
* @module @try-works/dsh-tool-mode/mcp-usage
|
|
14
|
+
*/
|
|
15
|
+
import { appendFileSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { dirname } from 'node:path';
|
|
17
|
+
/** How many rows the ledger retains. */
|
|
18
|
+
export const MCP_USAGE_MAX_ROWS = 5_000;
|
|
19
|
+
/** The default page size for a call-log request. */
|
|
20
|
+
export const MCP_USAGE_DEFAULT_PAGE_SIZE = 50;
|
|
21
|
+
/** What the accounting hook supplies, plus the tool name it now carries. */
|
|
22
|
+
export function recordFromAccounting(toolName, accounting, time = Date.now()) {
|
|
23
|
+
return {
|
|
24
|
+
time,
|
|
25
|
+
tool: toolName,
|
|
26
|
+
clientId: accounting.clientId ?? 'unknown',
|
|
27
|
+
grantId: accounting.grantId ?? null,
|
|
28
|
+
totalMs: accounting.timings.totalMs,
|
|
29
|
+
queuedMs: accounting.timings.queuedMs,
|
|
30
|
+
loadMs: accounting.timings.loadMs,
|
|
31
|
+
inferenceMs: accounting.timings.inferenceMs,
|
|
32
|
+
failureClass: accounting.failureClass,
|
|
33
|
+
reason: accounting.reason,
|
|
34
|
+
inputBytes: accounting.sizes.inputBytes,
|
|
35
|
+
outputBytes: accounting.sizes.outputBytes,
|
|
36
|
+
receiptId: accounting.receiptId,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** A finite number, else null. */
|
|
40
|
+
function numberOrNull(value) {
|
|
41
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
42
|
+
}
|
|
43
|
+
/** Read one raw ledger line as a record, or null when it is not one. */
|
|
44
|
+
function readRecord(raw) {
|
|
45
|
+
let parsed;
|
|
46
|
+
try {
|
|
47
|
+
parsed = JSON.parse(raw);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
53
|
+
return null;
|
|
54
|
+
// SAFETY: the guard above proved a non-null, non-array object; every field the record
|
|
55
|
+
// needs is type-checked below before it is copied into the typed result.
|
|
56
|
+
const record = parsed;
|
|
57
|
+
const time = numberOrNull(record['time']);
|
|
58
|
+
const totalMs = numberOrNull(record['totalMs']);
|
|
59
|
+
if (time === null || totalMs === null)
|
|
60
|
+
return null;
|
|
61
|
+
if (typeof record['tool'] !== 'string' || typeof record['clientId'] !== 'string')
|
|
62
|
+
return null;
|
|
63
|
+
if (typeof record['receiptId'] !== 'string' || typeof record['failureClass'] !== 'string')
|
|
64
|
+
return null;
|
|
65
|
+
return {
|
|
66
|
+
time,
|
|
67
|
+
tool: record['tool'],
|
|
68
|
+
clientId: record['clientId'],
|
|
69
|
+
grantId: typeof record['grantId'] === 'string' ? record['grantId'] : null,
|
|
70
|
+
totalMs,
|
|
71
|
+
queuedMs: numberOrNull(record['queuedMs']) ?? 0,
|
|
72
|
+
loadMs: numberOrNull(record['loadMs']) ?? 0,
|
|
73
|
+
inferenceMs: numberOrNull(record['inferenceMs']) ?? 0,
|
|
74
|
+
failureClass: record['failureClass'],
|
|
75
|
+
reason: typeof record['reason'] === 'string' ? record['reason'] : null,
|
|
76
|
+
inputBytes: numberOrNull(record['inputBytes']) ?? 0,
|
|
77
|
+
outputBytes: numberOrNull(record['outputBytes']) ?? 0,
|
|
78
|
+
receiptId: record['receiptId'],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A bounded JSONL ledger over one file.
|
|
83
|
+
*
|
|
84
|
+
* Operations are synchronous and defensive: an unreadable or corrupt line contributes
|
|
85
|
+
* nothing, and a rotated file keeps the newest rows rather than failing the append.
|
|
86
|
+
*/
|
|
87
|
+
export class McpUsageLedger {
|
|
88
|
+
#file;
|
|
89
|
+
#maxRows;
|
|
90
|
+
/**
|
|
91
|
+
* @param file - the JSONL path.
|
|
92
|
+
* @param options - `maxRows` defaults to {@link MCP_USAGE_MAX_ROWS}.
|
|
93
|
+
*/
|
|
94
|
+
constructor(file, options = {}) {
|
|
95
|
+
this.#file = file;
|
|
96
|
+
this.#maxRows = Math.max(2, options.maxRows ?? MCP_USAGE_MAX_ROWS);
|
|
97
|
+
}
|
|
98
|
+
/** The ledger path (the MCP status surface names it, never its contents). */
|
|
99
|
+
get file() {
|
|
100
|
+
return this.#file;
|
|
101
|
+
}
|
|
102
|
+
/** All readable rows, oldest first. */
|
|
103
|
+
#rows() {
|
|
104
|
+
let text;
|
|
105
|
+
try {
|
|
106
|
+
text = readFileSync(this.#file, 'utf8');
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
const rows = [];
|
|
112
|
+
for (const line of text.split('\n')) {
|
|
113
|
+
if (line.trim().length === 0)
|
|
114
|
+
continue;
|
|
115
|
+
const record = readRecord(line);
|
|
116
|
+
if (record !== null)
|
|
117
|
+
rows.push(record);
|
|
118
|
+
}
|
|
119
|
+
return rows;
|
|
120
|
+
}
|
|
121
|
+
/** Atomically replace the file with exactly these rows. */
|
|
122
|
+
#write(rows) {
|
|
123
|
+
mkdirSync(dirname(this.#file), { recursive: true });
|
|
124
|
+
const temporary = `${this.#file}.${process.pid}.${Date.now().toString(36)}.tmp`;
|
|
125
|
+
writeFileSync(temporary, rows.map(row => `${JSON.stringify(row)}\n`).join(''), 'utf8');
|
|
126
|
+
renameSync(temporary, this.#file);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Append one call, trimming at the bound.
|
|
130
|
+
* @param call - the record to persist.
|
|
131
|
+
*/
|
|
132
|
+
record(call) {
|
|
133
|
+
mkdirSync(dirname(this.#file), { recursive: true });
|
|
134
|
+
const existing = this.#rows();
|
|
135
|
+
if (existing.length >= this.#maxRows) {
|
|
136
|
+
// Rotation: keep the newest (bound - 1) rows, then append the new one.
|
|
137
|
+
this.#write([...existing.slice(existing.length - (this.#maxRows - 1)), call]);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
appendFileSync(this.#file, `${JSON.stringify(call)}\n`, 'utf8');
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Read one page, newest first.
|
|
144
|
+
* @param query - optional client filter and 1-based page.
|
|
145
|
+
* @returns the page plus the matching total and the ledger's client identities.
|
|
146
|
+
*/
|
|
147
|
+
read(query = {}) {
|
|
148
|
+
const all = this.#rows();
|
|
149
|
+
const clients = [...new Set(all.map(row => row.clientId))].sort((left, right) => left.localeCompare(right));
|
|
150
|
+
const matching = query.clientId === undefined ? all : all.filter(row => row.clientId === query.clientId);
|
|
151
|
+
const page = Math.max(1, Math.trunc(query.page ?? 1));
|
|
152
|
+
const pageSize = Math.min(200, Math.max(1, Math.trunc(query.pageSize ?? MCP_USAGE_DEFAULT_PAGE_SIZE)));
|
|
153
|
+
const newestFirst = [...matching].reverse();
|
|
154
|
+
const start = (page - 1) * pageSize;
|
|
155
|
+
return {
|
|
156
|
+
calls: newestFirst.slice(start, start + pageSize),
|
|
157
|
+
total: matching.length,
|
|
158
|
+
page,
|
|
159
|
+
pageSize,
|
|
160
|
+
clients,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Aggregate the ledger by client and tool. */
|
|
164
|
+
summarize() {
|
|
165
|
+
const rows = this.#rows();
|
|
166
|
+
const clients = new Map();
|
|
167
|
+
const tools = new Map();
|
|
168
|
+
for (const row of rows) {
|
|
169
|
+
const client = clients.get(row.clientId) ?? { calls: 0, errors: 0, lastSeen: 0, grantId: null };
|
|
170
|
+
clients.set(row.clientId, {
|
|
171
|
+
calls: client.calls + 1,
|
|
172
|
+
errors: client.errors + (row.failureClass === 'none' ? 0 : 1),
|
|
173
|
+
lastSeen: Math.max(client.lastSeen, row.time),
|
|
174
|
+
grantId: row.grantId ?? client.grantId,
|
|
175
|
+
});
|
|
176
|
+
tools.set(row.tool, (tools.get(row.tool) ?? 0) + 1);
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
total: rows.length,
|
|
180
|
+
clients: [...clients.entries()]
|
|
181
|
+
.map(([clientId, client]) => ({ clientId, ...client }))
|
|
182
|
+
.sort((left, right) => left.clientId.localeCompare(right.clientId)),
|
|
183
|
+
tools: [...tools.entries()]
|
|
184
|
+
.map(([tool, calls]) => ({ tool, calls }))
|
|
185
|
+
.sort((left, right) => right.calls - left.calls || left.tool.localeCompare(right.tool)),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=mcp-usage.js.map
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model qualification and capability resolution (MODEL-01, MODEL-04, MODEL-05, MODEL-06).
|
|
3
|
+
*
|
|
4
|
+
* Four rules, each guarding a way of claiming more than is known:
|
|
5
|
+
*
|
|
6
|
+
* - **A platform table is not proof of correct inference** (MODEL-05). A record is
|
|
7
|
+
* qualified only when the exact revision, artifact hash, tokenizer, processor, engine
|
|
8
|
+
* version, ABI and execution provider are all recorded. A missing field is a GAP, and
|
|
9
|
+
* a gap is not a qualification.
|
|
10
|
+
* - **A model's modality list is not an adapter's** (MODEL-05). A model can support
|
|
11
|
+
* video while the selected adapter does not, so what is ADVERTISED is the INTERSECTION
|
|
12
|
+
* of the two, described as such.
|
|
13
|
+
* - **A model name is not a capability test** (MODEL-06). Capability comes from the
|
|
14
|
+
* resolved model, never from recognising a brand.
|
|
15
|
+
* - **Unknown is not unsupported** (MODEL-06). The requirement says to record them
|
|
16
|
+
* separately, because collapsing them lets an unevaluated capability be reported as a
|
|
17
|
+
* known absence — or, worse, the reverse.
|
|
18
|
+
*
|
|
19
|
+
* @module @try-works/dsh-tool-mode/model-qualification
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* What is known about one capability.
|
|
23
|
+
*
|
|
24
|
+
* Three states rather than two, because MODEL-06 requires unknown and unsupported to be
|
|
25
|
+
* recorded separately.
|
|
26
|
+
*/
|
|
27
|
+
export type CapabilityState =
|
|
28
|
+
/** Evaluated, and it works. */
|
|
29
|
+
'supported'
|
|
30
|
+
/** Evaluated, and it does not. */
|
|
31
|
+
| 'unsupported'
|
|
32
|
+
/** NOT evaluated. Reporting this as either of the others is the defect. */
|
|
33
|
+
| 'unknown';
|
|
34
|
+
/** A capability of a model or an adapter. */
|
|
35
|
+
export type Modality = 'text' | 'code' | 'image' | 'audio' | 'video' | 'embedding';
|
|
36
|
+
/**
|
|
37
|
+
* The exact path a model is executed through (MODEL-05).
|
|
38
|
+
*
|
|
39
|
+
* Every field is required for qualification, because each one has been the difference
|
|
40
|
+
* between "the package imports" and "inference is correct".
|
|
41
|
+
*/
|
|
42
|
+
export interface QualificationRecord {
|
|
43
|
+
/** The model revision, not a branch or floating tag. */
|
|
44
|
+
readonly modelRevision: string;
|
|
45
|
+
/** The SHA of the exported artifact that is actually loaded. */
|
|
46
|
+
readonly artifactSha: string;
|
|
47
|
+
/** The tokenizer identity. */
|
|
48
|
+
readonly tokenizer: string;
|
|
49
|
+
/** The processor or preprocessing recipe identity. */
|
|
50
|
+
readonly processor: string;
|
|
51
|
+
/** The engine or package version. */
|
|
52
|
+
readonly engineVersion: string;
|
|
53
|
+
/** The Node ABI. */
|
|
54
|
+
readonly nodeAbi: string;
|
|
55
|
+
/** The CPU architecture, e.g. `x64`. */
|
|
56
|
+
readonly architecture: string;
|
|
57
|
+
/** The execution provider, e.g. `cpu` or `wasm`. */
|
|
58
|
+
readonly executionProvider: string;
|
|
59
|
+
}
|
|
60
|
+
/** The fields a qualification record must carry. */
|
|
61
|
+
export declare const QUALIFICATION_FIELDS: readonly (keyof QualificationRecord)[];
|
|
62
|
+
/**
|
|
63
|
+
* Report which qualification fields are missing (MODEL-05).
|
|
64
|
+
*
|
|
65
|
+
* A platform table, a successful package import or a runnable base model is not proof of
|
|
66
|
+
* correct inference, so a record with gaps is not a qualification however well it runs.
|
|
67
|
+
* @param record - the partial record.
|
|
68
|
+
* @returns the missing fields.
|
|
69
|
+
*/
|
|
70
|
+
export declare function qualificationGaps(record: Partial<QualificationRecord>): readonly (keyof QualificationRecord)[];
|
|
71
|
+
/**
|
|
72
|
+
* Whether a record qualifies a path (MODEL-05).
|
|
73
|
+
* @param record - the partial record.
|
|
74
|
+
* @returns whether every required field is present.
|
|
75
|
+
*/
|
|
76
|
+
export declare function isQualified(record: Partial<QualificationRecord>): record is QualificationRecord;
|
|
77
|
+
/** What a model supports, and what an adapter supports. */
|
|
78
|
+
export interface ModalityClaim {
|
|
79
|
+
readonly modelSupports: readonly Modality[];
|
|
80
|
+
readonly adapterSupports: readonly Modality[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The capabilities that may be ADVERTISED (MODEL-05).
|
|
84
|
+
*
|
|
85
|
+
* The intersection, because a model can support a modality while the selected adapter
|
|
86
|
+
* does not. Advertising the model's list would promise something the adapter cannot do.
|
|
87
|
+
* @param claim - what each side supports.
|
|
88
|
+
* @returns the advertisable modalities.
|
|
89
|
+
*/
|
|
90
|
+
export declare function advertisableModalities(claim: ModalityClaim): readonly Modality[];
|
|
91
|
+
/**
|
|
92
|
+
* Describe a model's capability as the INTERSECTION (MODEL-05).
|
|
93
|
+
*
|
|
94
|
+
* The description names what is not advertisable and why, so a reader is not left to
|
|
95
|
+
* infer that the model lacks the modality when in fact the adapter does.
|
|
96
|
+
* @param claim - what each side supports.
|
|
97
|
+
* @returns a description that is true of the pairing.
|
|
98
|
+
*/
|
|
99
|
+
export declare function describeCapability(claim: ModalityClaim): string;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve one capability (MODEL-06).
|
|
102
|
+
*
|
|
103
|
+
* A capability is resolved from what was EVALUATED. A model name is never consulted,
|
|
104
|
+
* because a brand is not a capability test, and an unevaluated capability returns
|
|
105
|
+
* `unknown` rather than being inferred from a sibling.
|
|
106
|
+
* @param evidence - the observed result, or undefined when not evaluated.
|
|
107
|
+
* @returns the state.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveCapability(evidence: boolean | undefined): CapabilityState;
|
|
110
|
+
/**
|
|
111
|
+
* Whether a model name may be used to infer a capability (MODEL-06).
|
|
112
|
+
*
|
|
113
|
+
* It may not. Returns false so the prohibition is asserted rather than merely intended:
|
|
114
|
+
* a rule that lives only in a comment is one a future branch will not read.
|
|
115
|
+
* @returns always false.
|
|
116
|
+
*/
|
|
117
|
+
export declare function modelNameImpliesCapability(): boolean;
|
|
118
|
+
/** How a candidate implementation executes (MODEL-04). */
|
|
119
|
+
export type ExecutionMode =
|
|
120
|
+
/** Pure JavaScript or WASM usable in plain Node. */
|
|
121
|
+
'js-wasm-node'
|
|
122
|
+
/** Prebuilt ONNX Runtime for Node. */
|
|
123
|
+
| 'onnxruntime-node'
|
|
124
|
+
/** A managed native Windows executable with pinned assets. */
|
|
125
|
+
| 'managed-native-windows'
|
|
126
|
+
/** Requires Python on the end user's machine. */
|
|
127
|
+
| 'python-required'
|
|
128
|
+
/** Requires WSL. */
|
|
129
|
+
| 'wsl-required'
|
|
130
|
+
/** Requires Docker. */
|
|
131
|
+
| 'docker-required'
|
|
132
|
+
/** Requires a GPU. */
|
|
133
|
+
| 'gpu-required'
|
|
134
|
+
/** Only works in a browser. */
|
|
135
|
+
| 'browser-only'
|
|
136
|
+
/** Requires a consumer-side compile step. */
|
|
137
|
+
| 'consumer-compile';
|
|
138
|
+
/** Why a mode was refused. */
|
|
139
|
+
export interface ModeVerdict {
|
|
140
|
+
readonly acceptable: boolean;
|
|
141
|
+
readonly reason?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Whether an execution mode is acceptable for the end user (MODEL-04).
|
|
145
|
+
*
|
|
146
|
+
* Python, WSL, Docker, a GPU and a consumer compile step are all refused: maintainers may
|
|
147
|
+
* use Python to export artifacts, but it MUST NOT be required on an end user's Windows
|
|
148
|
+
* machine. A browser-only API does not establish Node support.
|
|
149
|
+
* @param mode - the mode.
|
|
150
|
+
* @returns the verdict, with a reason when refused.
|
|
151
|
+
*/
|
|
152
|
+
export declare function executionModeVerdict(mode: ExecutionMode): ModeVerdict;
|
|
153
|
+
/** An embedding space identity (MODEL-01, BASE-12). */
|
|
154
|
+
export interface EmbeddingSpace {
|
|
155
|
+
/** The model that produces it. */
|
|
156
|
+
readonly modelId: string;
|
|
157
|
+
/** The dimensionality of the vectors it produces. */
|
|
158
|
+
readonly dimensions: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Whether one embedding space may silently stand in for another (BASE-12).
|
|
162
|
+
*
|
|
163
|
+
* Only when the dimensions MATCH. EmbeddingGemma 2 is 768-dimensional and MiniLM is
|
|
164
|
+
* 384-dimensional, so substituting one for the other silently would compare vectors of
|
|
165
|
+
* different widths and produce meaningless similarity.
|
|
166
|
+
* @param from - the space in use.
|
|
167
|
+
* @param to - the proposed replacement.
|
|
168
|
+
* @returns whether the substitution is safe without an explicit migration.
|
|
169
|
+
*/
|
|
170
|
+
export declare function maySubstituteSilently(from: EmbeddingSpace, to: EmbeddingSpace): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Describe an embedding substitution (BASE-12).
|
|
173
|
+
* @param from - the space in use.
|
|
174
|
+
* @param to - the proposed replacement.
|
|
175
|
+
* @returns a description naming the incompatibility when there is one.
|
|
176
|
+
*/
|
|
177
|
+
export declare function describeSubstitution(from: EmbeddingSpace, to: EmbeddingSpace): string;
|
|
178
|
+
/**
|
|
179
|
+
* The reduced dimensionalities EmbeddingGemma 2 supports (MODEL-01).
|
|
180
|
+
*
|
|
181
|
+
* The model card describes 768 reducible to 512, 256 and 128. Recorded rather than
|
|
182
|
+
* assumed, because a reduction that is not applied consistently produces vectors that
|
|
183
|
+
* cannot be compared with each other.
|
|
184
|
+
*/
|
|
185
|
+
export declare const EMBEDDINGGEMMA2_DIMENSIONS: readonly number[];
|
|
186
|
+
/**
|
|
187
|
+
* Whether a stated dimensionality is one EmbeddingGemma 2 can produce (MODEL-01).
|
|
188
|
+
* @param dimensions - the stated width.
|
|
189
|
+
* @returns whether it is a documented width.
|
|
190
|
+
*/
|
|
191
|
+
export declare function isEmbeddingGemma2Width(dimensions: number): boolean;
|
|
192
|
+
//# sourceMappingURL=model-qualification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-qualification.d.ts","sourceRoot":"","sources":["../src/model-qualification.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model qualification and capability resolution (MODEL-01, MODEL-04, MODEL-05, MODEL-06).
|
|
3
|
+
*
|
|
4
|
+
* Four rules, each guarding a way of claiming more than is known:
|
|
5
|
+
*
|
|
6
|
+
* - **A platform table is not proof of correct inference** (MODEL-05). A record is
|
|
7
|
+
* qualified only when the exact revision, artifact hash, tokenizer, processor, engine
|
|
8
|
+
* version, ABI and execution provider are all recorded. A missing field is a GAP, and
|
|
9
|
+
* a gap is not a qualification.
|
|
10
|
+
* - **A model's modality list is not an adapter's** (MODEL-05). A model can support
|
|
11
|
+
* video while the selected adapter does not, so what is ADVERTISED is the INTERSECTION
|
|
12
|
+
* of the two, described as such.
|
|
13
|
+
* - **A model name is not a capability test** (MODEL-06). Capability comes from the
|
|
14
|
+
* resolved model, never from recognising a brand.
|
|
15
|
+
* - **Unknown is not unsupported** (MODEL-06). The requirement says to record them
|
|
16
|
+
* separately, because collapsing them lets an unevaluated capability be reported as a
|
|
17
|
+
* known absence — or, worse, the reverse.
|
|
18
|
+
*
|
|
19
|
+
* @module @try-works/dsh-tool-mode/model-qualification
|
|
20
|
+
*/
|
|
21
|
+
/** The fields a qualification record must carry. */
|
|
22
|
+
export const QUALIFICATION_FIELDS = [
|
|
23
|
+
'modelRevision', 'artifactSha', 'tokenizer', 'processor',
|
|
24
|
+
'engineVersion', 'nodeAbi', 'architecture', 'executionProvider',
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Report which qualification fields are missing (MODEL-05).
|
|
28
|
+
*
|
|
29
|
+
* A platform table, a successful package import or a runnable base model is not proof of
|
|
30
|
+
* correct inference, so a record with gaps is not a qualification however well it runs.
|
|
31
|
+
* @param record - the partial record.
|
|
32
|
+
* @returns the missing fields.
|
|
33
|
+
*/
|
|
34
|
+
export function qualificationGaps(record) {
|
|
35
|
+
return QUALIFICATION_FIELDS.filter(field => {
|
|
36
|
+
const value = record[field];
|
|
37
|
+
return typeof value !== 'string' || value.length === 0;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether a record qualifies a path (MODEL-05).
|
|
42
|
+
* @param record - the partial record.
|
|
43
|
+
* @returns whether every required field is present.
|
|
44
|
+
*/
|
|
45
|
+
export function isQualified(record) {
|
|
46
|
+
return qualificationGaps(record).length === 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The capabilities that may be ADVERTISED (MODEL-05).
|
|
50
|
+
*
|
|
51
|
+
* The intersection, because a model can support a modality while the selected adapter
|
|
52
|
+
* does not. Advertising the model's list would promise something the adapter cannot do.
|
|
53
|
+
* @param claim - what each side supports.
|
|
54
|
+
* @returns the advertisable modalities.
|
|
55
|
+
*/
|
|
56
|
+
export function advertisableModalities(claim) {
|
|
57
|
+
const adapter = new Set(claim.adapterSupports);
|
|
58
|
+
return claim.modelSupports.filter(modality => adapter.has(modality));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Describe a model's capability as the INTERSECTION (MODEL-05).
|
|
62
|
+
*
|
|
63
|
+
* The description names what is not advertisable and why, so a reader is not left to
|
|
64
|
+
* infer that the model lacks the modality when in fact the adapter does.
|
|
65
|
+
* @param claim - what each side supports.
|
|
66
|
+
* @returns a description that is true of the pairing.
|
|
67
|
+
*/
|
|
68
|
+
export function describeCapability(claim) {
|
|
69
|
+
const advertisable = advertisableModalities(claim);
|
|
70
|
+
const adapter = new Set(claim.adapterSupports);
|
|
71
|
+
// Named rather than omitted: the model supports these, this adapter does not.
|
|
72
|
+
const modelOnly = claim.modelSupports.filter(modality => !adapter.has(modality));
|
|
73
|
+
const base = advertisable.length === 0
|
|
74
|
+
? 'no modality is advertisable through this adapter'
|
|
75
|
+
: `advertisable: ${advertisable.join(', ')}`;
|
|
76
|
+
return modelOnly.length === 0
|
|
77
|
+
? base
|
|
78
|
+
: `${base} (the model also supports ${modelOnly.join(', ')}, which this adapter does not)`;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolve one capability (MODEL-06).
|
|
82
|
+
*
|
|
83
|
+
* A capability is resolved from what was EVALUATED. A model name is never consulted,
|
|
84
|
+
* because a brand is not a capability test, and an unevaluated capability returns
|
|
85
|
+
* `unknown` rather than being inferred from a sibling.
|
|
86
|
+
* @param evidence - the observed result, or undefined when not evaluated.
|
|
87
|
+
* @returns the state.
|
|
88
|
+
*/
|
|
89
|
+
export function resolveCapability(evidence) {
|
|
90
|
+
if (evidence === undefined)
|
|
91
|
+
return 'unknown';
|
|
92
|
+
return evidence ? 'supported' : 'unsupported';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Whether a model name may be used to infer a capability (MODEL-06).
|
|
96
|
+
*
|
|
97
|
+
* It may not. Returns false so the prohibition is asserted rather than merely intended:
|
|
98
|
+
* a rule that lives only in a comment is one a future branch will not read.
|
|
99
|
+
* @returns always false.
|
|
100
|
+
*/
|
|
101
|
+
export function modelNameImpliesCapability() {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether an execution mode is acceptable for the end user (MODEL-04).
|
|
106
|
+
*
|
|
107
|
+
* Python, WSL, Docker, a GPU and a consumer compile step are all refused: maintainers may
|
|
108
|
+
* use Python to export artifacts, but it MUST NOT be required on an end user's Windows
|
|
109
|
+
* machine. A browser-only API does not establish Node support.
|
|
110
|
+
* @param mode - the mode.
|
|
111
|
+
* @returns the verdict, with a reason when refused.
|
|
112
|
+
*/
|
|
113
|
+
export function executionModeVerdict(mode) {
|
|
114
|
+
switch (mode) {
|
|
115
|
+
case 'js-wasm-node':
|
|
116
|
+
case 'onnxruntime-node':
|
|
117
|
+
case 'managed-native-windows':
|
|
118
|
+
return { acceptable: true };
|
|
119
|
+
case 'python-required':
|
|
120
|
+
return {
|
|
121
|
+
acceptable: false,
|
|
122
|
+
reason: 'Python may be used by maintainers to export and verify artifacts, but must not be required on an end user machine',
|
|
123
|
+
};
|
|
124
|
+
case 'wsl-required':
|
|
125
|
+
return { acceptable: false, reason: 'WSL must not be required on an end user machine' };
|
|
126
|
+
case 'docker-required':
|
|
127
|
+
return { acceptable: false, reason: 'Docker must not be required on an end user machine' };
|
|
128
|
+
case 'gpu-required':
|
|
129
|
+
return { acceptable: false, reason: 'no GPU requirement is permitted' };
|
|
130
|
+
case 'browser-only':
|
|
131
|
+
return { acceptable: false, reason: 'browser-only APIs do not establish Node support' };
|
|
132
|
+
case 'consumer-compile':
|
|
133
|
+
return { acceptable: false, reason: 'no consumer-side compile is permitted' };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Whether one embedding space may silently stand in for another (BASE-12).
|
|
138
|
+
*
|
|
139
|
+
* Only when the dimensions MATCH. EmbeddingGemma 2 is 768-dimensional and MiniLM is
|
|
140
|
+
* 384-dimensional, so substituting one for the other silently would compare vectors of
|
|
141
|
+
* different widths and produce meaningless similarity.
|
|
142
|
+
* @param from - the space in use.
|
|
143
|
+
* @param to - the proposed replacement.
|
|
144
|
+
* @returns whether the substitution is safe without an explicit migration.
|
|
145
|
+
*/
|
|
146
|
+
export function maySubstituteSilently(from, to) {
|
|
147
|
+
return from.dimensions === to.dimensions;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Describe an embedding substitution (BASE-12).
|
|
151
|
+
* @param from - the space in use.
|
|
152
|
+
* @param to - the proposed replacement.
|
|
153
|
+
* @returns a description naming the incompatibility when there is one.
|
|
154
|
+
*/
|
|
155
|
+
export function describeSubstitution(from, to) {
|
|
156
|
+
if (maySubstituteSilently(from, to)) {
|
|
157
|
+
return `${to.modelId} produces ${to.dimensions}-dimensional vectors, matching ${from.modelId}`;
|
|
158
|
+
}
|
|
159
|
+
return `${to.modelId} produces ${to.dimensions}-dimensional vectors and ${from.modelId} produces `
|
|
160
|
+
+ `${from.dimensions}; existing vectors are not comparable and require an explicit re-index`;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The reduced dimensionalities EmbeddingGemma 2 supports (MODEL-01).
|
|
164
|
+
*
|
|
165
|
+
* The model card describes 768 reducible to 512, 256 and 128. Recorded rather than
|
|
166
|
+
* assumed, because a reduction that is not applied consistently produces vectors that
|
|
167
|
+
* cannot be compared with each other.
|
|
168
|
+
*/
|
|
169
|
+
export const EMBEDDINGGEMMA2_DIMENSIONS = [768, 512, 256, 128];
|
|
170
|
+
/**
|
|
171
|
+
* Whether a stated dimensionality is one EmbeddingGemma 2 can produce (MODEL-01).
|
|
172
|
+
* @param dimensions - the stated width.
|
|
173
|
+
* @returns whether it is a documented width.
|
|
174
|
+
*/
|
|
175
|
+
export function isEmbeddingGemma2Width(dimensions) {
|
|
176
|
+
return EMBEDDINGGEMMA2_DIMENSIONS.includes(dimensions);
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=model-qualification.js.map
|