@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,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exact-range Tool Insights report (plan §3.1, S2; client contract in
|
|
3
|
+
* `docs/tool-insights/host-contract.md`).
|
|
4
|
+
*
|
|
5
|
+
* The projection keeps the detail; this module filters it to a window and produces the
|
|
6
|
+
* rollups the page renders. Range filtering uses the PER-DAY counters the projection
|
|
7
|
+
* records, so call/error/duration totals are exact for the window.
|
|
8
|
+
*
|
|
9
|
+
* Percentiles come from the retained 16-bucket histograms. The histograms are not split
|
|
10
|
+
* by day, so p50/p95 are an approximation over the retained settled calls while `maxMs`
|
|
11
|
+
* is exact for the window. `histogramScope: 'retained'` states this.
|
|
12
|
+
*
|
|
13
|
+
* @module @try-works/dsh-tool-mode/tool-usage-report
|
|
14
|
+
*/
|
|
15
|
+
import { type ToolUsageState } from './tool-usage-projection.ts';
|
|
16
|
+
/** The ranges the page offers. */
|
|
17
|
+
export type UsageRange = '24h' | '7d' | '30d' | 'all';
|
|
18
|
+
/** One resolved window. `from` is inclusive, `to` exclusive (milliseconds). */
|
|
19
|
+
export interface UsageWindow {
|
|
20
|
+
readonly range: UsageRange;
|
|
21
|
+
readonly from: number;
|
|
22
|
+
readonly to: number;
|
|
23
|
+
/** Host-local day key of `from` (inclusive). */
|
|
24
|
+
readonly fromDay: string;
|
|
25
|
+
/** Host-local day key of `to` (inclusive). */
|
|
26
|
+
readonly toDay: string;
|
|
27
|
+
}
|
|
28
|
+
/** One session's detail state joined with the workspace it belongs to. */
|
|
29
|
+
export interface SessionUsageInput {
|
|
30
|
+
readonly sessionId: string;
|
|
31
|
+
readonly workspace: string | null;
|
|
32
|
+
readonly state: ToolUsageState;
|
|
33
|
+
}
|
|
34
|
+
/** One tool's performance over the window (flat client contract). */
|
|
35
|
+
export interface UsageToolRow {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly owner: string;
|
|
38
|
+
readonly calls: number;
|
|
39
|
+
readonly errors: number;
|
|
40
|
+
readonly unsettled: number;
|
|
41
|
+
readonly codeCalls: number;
|
|
42
|
+
readonly directCalls: number;
|
|
43
|
+
readonly totalMs: number;
|
|
44
|
+
readonly maxMs: number;
|
|
45
|
+
readonly p50: number | null;
|
|
46
|
+
readonly p95: number | null;
|
|
47
|
+
readonly firstUsed: number | null;
|
|
48
|
+
readonly lastUsed: number | null;
|
|
49
|
+
readonly argsBytes: number;
|
|
50
|
+
readonly resultBytes: number;
|
|
51
|
+
}
|
|
52
|
+
/** One model row. */
|
|
53
|
+
export interface UsageModelRow {
|
|
54
|
+
readonly model: string;
|
|
55
|
+
readonly calls: number;
|
|
56
|
+
readonly errors: number;
|
|
57
|
+
readonly tools: number;
|
|
58
|
+
readonly ms: number;
|
|
59
|
+
readonly p50: number | null;
|
|
60
|
+
readonly p95: number | null;
|
|
61
|
+
}
|
|
62
|
+
/** One day row. */
|
|
63
|
+
export interface UsageDayRow {
|
|
64
|
+
readonly day: string;
|
|
65
|
+
readonly calls: number;
|
|
66
|
+
readonly errors: number;
|
|
67
|
+
readonly ms: number;
|
|
68
|
+
readonly unsettled: number;
|
|
69
|
+
}
|
|
70
|
+
/** One workspace row. */
|
|
71
|
+
export interface UsageWorkspaceRow {
|
|
72
|
+
readonly workspace: string;
|
|
73
|
+
readonly sessions: number;
|
|
74
|
+
readonly calls: number;
|
|
75
|
+
readonly errors: number;
|
|
76
|
+
readonly ms: number;
|
|
77
|
+
}
|
|
78
|
+
/** One recent call, in the client's flat vocabulary. */
|
|
79
|
+
export interface UsageRecentCall {
|
|
80
|
+
readonly time: number;
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly owner: string;
|
|
83
|
+
readonly model: string;
|
|
84
|
+
readonly ms: number | null;
|
|
85
|
+
readonly ok: boolean | null;
|
|
86
|
+
readonly errorCode: string | null;
|
|
87
|
+
readonly kind: 'direct' | 'code';
|
|
88
|
+
readonly callId: string;
|
|
89
|
+
readonly parentCallId: string | null;
|
|
90
|
+
readonly sessionId: string;
|
|
91
|
+
readonly workspace: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** One error-code row. */
|
|
94
|
+
export interface UsageErrorCodeRow {
|
|
95
|
+
readonly code: string;
|
|
96
|
+
readonly calls: number;
|
|
97
|
+
}
|
|
98
|
+
/** The whole report (flat totals plus rollups; the client contract). */
|
|
99
|
+
export interface UsageReport {
|
|
100
|
+
readonly range: UsageRange;
|
|
101
|
+
readonly from: number;
|
|
102
|
+
readonly to: number;
|
|
103
|
+
readonly calls: number;
|
|
104
|
+
readonly errors: number;
|
|
105
|
+
readonly unsettled: number;
|
|
106
|
+
readonly toolMs: number;
|
|
107
|
+
readonly codeCalls: number;
|
|
108
|
+
readonly sessions: number;
|
|
109
|
+
readonly uniqueTools: number;
|
|
110
|
+
/** Successes over SETTLED calls; null when nothing settled in the window. */
|
|
111
|
+
readonly successRate: number | null;
|
|
112
|
+
readonly p50: number | null;
|
|
113
|
+
readonly p95: number | null;
|
|
114
|
+
readonly tools: readonly UsageToolRow[];
|
|
115
|
+
readonly models: readonly UsageModelRow[];
|
|
116
|
+
readonly days: readonly UsageDayRow[];
|
|
117
|
+
readonly workspaces: readonly UsageWorkspaceRow[];
|
|
118
|
+
readonly errorCodes: readonly UsageErrorCodeRow[];
|
|
119
|
+
readonly recentCalls: readonly UsageRecentCall[];
|
|
120
|
+
readonly histogramScope: 'retained';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Resolve one range to a window.
|
|
124
|
+
* @param range - the selected range.
|
|
125
|
+
* @param now - the current time in milliseconds.
|
|
126
|
+
* @returns the window with host-local day keys.
|
|
127
|
+
*/
|
|
128
|
+
export declare function rangeWindow(range: UsageRange, now: number): UsageWindow;
|
|
129
|
+
/**
|
|
130
|
+
* The percentile an aggregated 16-bucket histogram implies.
|
|
131
|
+
*
|
|
132
|
+
* Each bucket answers with its UPPER edge; the open-ended last bucket answers with the
|
|
133
|
+
* exact retained maximum. An empty histogram has no percentile.
|
|
134
|
+
* @param histogram - bucket counts.
|
|
135
|
+
* @param percentile - 1..100.
|
|
136
|
+
* @param maxMs - the exact maximum observed duration.
|
|
137
|
+
* @returns the derived duration, or null for an empty histogram.
|
|
138
|
+
*/
|
|
139
|
+
export declare function percentileFromHistogram(histogram: readonly number[], percentile: number, maxMs: number): number | null;
|
|
140
|
+
/** The owner resolver the host supplies (live extension store), with a static fallback. */
|
|
141
|
+
export type UsageOwnerResolver = (name: string) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Aggregate the sessions' detail states over one window.
|
|
144
|
+
* @param sessions - the sessions' detail states and workspaces.
|
|
145
|
+
* @param window - the resolved window.
|
|
146
|
+
* @param options - `recentLimit` bounds recent calls; `resolveOwner` supplies live owners.
|
|
147
|
+
* @returns the client-contract report.
|
|
148
|
+
*/
|
|
149
|
+
export declare function buildUsageReport(sessions: readonly SessionUsageInput[], window: UsageWindow, options?: {
|
|
150
|
+
readonly recentLimit?: number;
|
|
151
|
+
readonly resolveOwner?: UsageOwnerResolver;
|
|
152
|
+
}): UsageReport;
|
|
153
|
+
//# sourceMappingURL=tool-usage-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-usage-report.d.ts","sourceRoot":"","sources":["../src/tool-usage-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAA;AAGnC,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAA;AAIrD,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB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AC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAA;IAChD,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAA;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAGvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAatH;AAmBD,2FAA2F;AAC3F,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAczD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,iBAAiB,EAAE,EACtC,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAA;CAAO,GAC1F,WAAW,CAyKb"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exact-range Tool Insights report (plan §3.1, S2; client contract in
|
|
3
|
+
* `docs/tool-insights/host-contract.md`).
|
|
4
|
+
*
|
|
5
|
+
* The projection keeps the detail; this module filters it to a window and produces the
|
|
6
|
+
* rollups the page renders. Range filtering uses the PER-DAY counters the projection
|
|
7
|
+
* records, so call/error/duration totals are exact for the window.
|
|
8
|
+
*
|
|
9
|
+
* Percentiles come from the retained 16-bucket histograms. The histograms are not split
|
|
10
|
+
* by day, so p50/p95 are an approximation over the retained settled calls while `maxMs`
|
|
11
|
+
* is exact for the window. `histogramScope: 'retained'` states this.
|
|
12
|
+
*
|
|
13
|
+
* @module @try-works/dsh-tool-mode/tool-usage-report
|
|
14
|
+
*/
|
|
15
|
+
import { DURATION_BUCKETS_MS, TOOL_USAGE_CAPS, toolUsageDayKey, } from "./tool-usage-projection.js";
|
|
16
|
+
import { staticToolOwner } from "./tool-sources.js";
|
|
17
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve one range to a window.
|
|
20
|
+
* @param range - the selected range.
|
|
21
|
+
* @param now - the current time in milliseconds.
|
|
22
|
+
* @returns the window with host-local day keys.
|
|
23
|
+
*/
|
|
24
|
+
export function rangeWindow(range, now) {
|
|
25
|
+
const from = range === 'all' ? 0 : now - (range === '24h' ? DAY_MS : range === '7d' ? 7 * DAY_MS : 30 * DAY_MS);
|
|
26
|
+
return { range, from, to: now, fromDay: toolUsageDayKey(from), toDay: toolUsageDayKey(now) };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The percentile an aggregated 16-bucket histogram implies.
|
|
30
|
+
*
|
|
31
|
+
* Each bucket answers with its UPPER edge; the open-ended last bucket answers with the
|
|
32
|
+
* exact retained maximum. An empty histogram has no percentile.
|
|
33
|
+
* @param histogram - bucket counts.
|
|
34
|
+
* @param percentile - 1..100.
|
|
35
|
+
* @param maxMs - the exact maximum observed duration.
|
|
36
|
+
* @returns the derived duration, or null for an empty histogram.
|
|
37
|
+
*/
|
|
38
|
+
export function percentileFromHistogram(histogram, percentile, maxMs) {
|
|
39
|
+
const total = histogram.reduce((sum, count) => sum + count, 0);
|
|
40
|
+
if (total <= 0)
|
|
41
|
+
return null;
|
|
42
|
+
if (percentile >= 100)
|
|
43
|
+
return maxMs;
|
|
44
|
+
const rank = Math.max(1, Math.ceil((Math.max(1, percentile) / 100) * total));
|
|
45
|
+
let seen = 0;
|
|
46
|
+
for (let index = 0; index < histogram.length; index += 1) {
|
|
47
|
+
seen += histogram[index] ?? 0;
|
|
48
|
+
if (seen < rank)
|
|
49
|
+
continue;
|
|
50
|
+
if (index >= DURATION_BUCKETS_MS.length - 1)
|
|
51
|
+
return maxMs;
|
|
52
|
+
return DURATION_BUCKETS_MS[index] ?? maxMs;
|
|
53
|
+
}
|
|
54
|
+
return maxMs;
|
|
55
|
+
}
|
|
56
|
+
/** Whether a day key falls inside the window's inclusive day span. */
|
|
57
|
+
function dayInWindow(day, window) {
|
|
58
|
+
return day >= window.fromDay && day <= window.toDay;
|
|
59
|
+
}
|
|
60
|
+
/** The retained minimum time when it falls inside the window, else null. */
|
|
61
|
+
function minTime(current, candidate, window) {
|
|
62
|
+
const values = [current, candidate].filter((value) => value !== null && value >= window.from && value < window.to);
|
|
63
|
+
return values.length === 0 ? null : Math.min(...values);
|
|
64
|
+
}
|
|
65
|
+
/** The retained maximum time when it falls inside the window, else null. */
|
|
66
|
+
function maxTime(current, candidate, window) {
|
|
67
|
+
const values = [current, candidate].filter((value) => value !== null && value >= window.from && value < window.to);
|
|
68
|
+
return values.length === 0 ? null : Math.max(...values);
|
|
69
|
+
}
|
|
70
|
+
/** The default owner resolution: pinned map, Tool Mode, MCP grammar, else `unattributed`. */
|
|
71
|
+
function defaultOwner(name) {
|
|
72
|
+
return staticToolOwner(name).owner;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Aggregate the sessions' detail states over one window.
|
|
76
|
+
* @param sessions - the sessions' detail states and workspaces.
|
|
77
|
+
* @param window - the resolved window.
|
|
78
|
+
* @param options - `recentLimit` bounds recent calls; `resolveOwner` supplies live owners.
|
|
79
|
+
* @returns the client-contract report.
|
|
80
|
+
*/
|
|
81
|
+
export function buildUsageReport(sessions, window, options = {}) {
|
|
82
|
+
const recentLimit = options.recentLimit ?? TOOL_USAGE_CAPS.recent;
|
|
83
|
+
const resolveOwner = options.resolveOwner ?? defaultOwner;
|
|
84
|
+
let calls = 0;
|
|
85
|
+
let errors = 0;
|
|
86
|
+
let unsettled = 0;
|
|
87
|
+
let toolMs = 0;
|
|
88
|
+
let codeCalls = 0;
|
|
89
|
+
let sessionsWithCalls = 0;
|
|
90
|
+
const overallHistogram = Array.from({ length: TOOL_USAGE_CAPS.buckets }, () => 0);
|
|
91
|
+
const days = new Map();
|
|
92
|
+
const tools = new Map();
|
|
93
|
+
const models = new Map();
|
|
94
|
+
const workspaces = new Map();
|
|
95
|
+
const errorCodes = new Map();
|
|
96
|
+
const recentCalls = [];
|
|
97
|
+
for (const session of sessions) {
|
|
98
|
+
let sessionCalls = 0;
|
|
99
|
+
let sessionErrors = 0;
|
|
100
|
+
let sessionMs = 0;
|
|
101
|
+
for (const [day, usage] of Object.entries(session.state.byDay)) {
|
|
102
|
+
if (!dayInWindow(day, window))
|
|
103
|
+
continue;
|
|
104
|
+
sessionCalls += usage.calls;
|
|
105
|
+
sessionErrors += usage.errors;
|
|
106
|
+
sessionMs += usage.ms;
|
|
107
|
+
const current = days.get(day) ?? { day, calls: 0, errors: 0, ms: 0, unsettled: 0 };
|
|
108
|
+
days.set(day, { day, calls: current.calls + usage.calls, errors: current.errors + usage.errors, ms: current.ms + usage.ms, unsettled: current.unsettled + usage.unsettled });
|
|
109
|
+
for (const [code, count] of Object.entries(usage.byCode))
|
|
110
|
+
errorCodes.set(code, (errorCodes.get(code) ?? 0) + count);
|
|
111
|
+
}
|
|
112
|
+
calls += sessionCalls;
|
|
113
|
+
errors += sessionErrors;
|
|
114
|
+
toolMs += sessionMs;
|
|
115
|
+
if (sessionCalls === 0)
|
|
116
|
+
continue;
|
|
117
|
+
sessionsWithCalls += 1;
|
|
118
|
+
const workspaceLabel = session.workspace ?? '(no workspace)';
|
|
119
|
+
const workspace = workspaces.get(workspaceLabel) ?? { workspace: workspaceLabel, sessions: 0, calls: 0, errors: 0, ms: 0 };
|
|
120
|
+
workspaces.set(workspaceLabel, { ...workspace, sessions: workspace.sessions + 1, calls: workspace.calls + sessionCalls, errors: workspace.errors + sessionErrors, ms: workspace.ms + sessionMs });
|
|
121
|
+
for (const [name, bucket] of Object.entries(session.state.byTool)) {
|
|
122
|
+
let rowCalls = 0;
|
|
123
|
+
let rowErrors = 0;
|
|
124
|
+
let rowMs = 0;
|
|
125
|
+
let rowMax = 0;
|
|
126
|
+
let rowUnsettled = 0;
|
|
127
|
+
let rowCode = 0;
|
|
128
|
+
let rowDirect = 0;
|
|
129
|
+
for (const [day, count] of Object.entries(bucket.byDay)) {
|
|
130
|
+
if (!dayInWindow(day, window))
|
|
131
|
+
continue;
|
|
132
|
+
rowCalls += count.calls;
|
|
133
|
+
rowErrors += count.errors;
|
|
134
|
+
rowMs += count.ms;
|
|
135
|
+
rowMax = Math.max(rowMax, count.maxMs);
|
|
136
|
+
rowUnsettled += count.unsettled;
|
|
137
|
+
rowCode += count.codeCalls;
|
|
138
|
+
rowDirect += count.calls - count.codeCalls;
|
|
139
|
+
}
|
|
140
|
+
if (rowCalls === 0 && rowUnsettled === 0)
|
|
141
|
+
continue;
|
|
142
|
+
codeCalls += rowCode;
|
|
143
|
+
const current = tools.get(name) ?? {
|
|
144
|
+
calls: 0, errors: 0, unsettled: 0, codeCalls: 0, directCalls: 0, totalMs: 0, maxMs: 0,
|
|
145
|
+
histogram: Array.from({ length: TOOL_USAGE_CAPS.buckets }, () => 0), firstUsed: null, lastUsed: null,
|
|
146
|
+
argsBytes: 0, resultBytes: 0,
|
|
147
|
+
};
|
|
148
|
+
const histogram = current.histogram.map((count, index) => count + (bucket.histogram[index] ?? 0));
|
|
149
|
+
for (let index = 0; index < histogram.length; index += 1)
|
|
150
|
+
overallHistogram[index] = (overallHistogram[index] ?? 0) + (bucket.histogram[index] ?? 0);
|
|
151
|
+
tools.set(name, {
|
|
152
|
+
calls: current.calls + rowCalls,
|
|
153
|
+
errors: current.errors + rowErrors,
|
|
154
|
+
unsettled: current.unsettled + rowUnsettled,
|
|
155
|
+
codeCalls: current.codeCalls + rowCode,
|
|
156
|
+
directCalls: current.directCalls + rowDirect,
|
|
157
|
+
totalMs: current.totalMs + rowMs,
|
|
158
|
+
maxMs: Math.max(current.maxMs, rowMax),
|
|
159
|
+
histogram,
|
|
160
|
+
firstUsed: minTime(current.firstUsed, bucket.firstUsed, window),
|
|
161
|
+
lastUsed: maxTime(current.lastUsed, bucket.lastUsed, window),
|
|
162
|
+
argsBytes: current.argsBytes + bucket.argsBytes,
|
|
163
|
+
resultBytes: current.resultBytes + bucket.resultBytes,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
for (const [model, usage] of Object.entries(session.state.byModel)) {
|
|
167
|
+
let rowCalls = 0;
|
|
168
|
+
let rowErrors = 0;
|
|
169
|
+
let rowMs = 0;
|
|
170
|
+
let rowMax = 0;
|
|
171
|
+
const rowHistogram = Array.from({ length: TOOL_USAGE_CAPS.buckets }, () => 0);
|
|
172
|
+
for (const [day, count] of Object.entries(usage.byDay)) {
|
|
173
|
+
if (!dayInWindow(day, window))
|
|
174
|
+
continue;
|
|
175
|
+
rowCalls += count.calls;
|
|
176
|
+
rowErrors += count.errors;
|
|
177
|
+
rowMs += count.ms;
|
|
178
|
+
rowMax = Math.max(rowMax, count.maxMs);
|
|
179
|
+
}
|
|
180
|
+
if (rowCalls === 0)
|
|
181
|
+
continue;
|
|
182
|
+
for (let index = 0; index < rowHistogram.length; index += 1)
|
|
183
|
+
rowHistogram[index] = (rowHistogram[index] ?? 0) + (usage.histogram[index] ?? 0);
|
|
184
|
+
const current = models.get(model) ?? { model, calls: 0, errors: 0, ms: 0, tools: 0, histogram: Array.from({ length: TOOL_USAGE_CAPS.buckets }, () => 0), maxMs: 0 };
|
|
185
|
+
models.set(model, {
|
|
186
|
+
model,
|
|
187
|
+
calls: current.calls + rowCalls,
|
|
188
|
+
errors: current.errors + rowErrors,
|
|
189
|
+
ms: current.ms + rowMs,
|
|
190
|
+
tools: Math.max(current.tools, usage.tools.length),
|
|
191
|
+
histogram: current.histogram.map((count, index) => count + (rowHistogram[index] ?? 0)),
|
|
192
|
+
maxMs: Math.max(current.maxMs, rowMax),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
for (const entry of session.state.recent) {
|
|
196
|
+
if (entry.time < window.from || entry.time >= window.to)
|
|
197
|
+
continue;
|
|
198
|
+
recentCalls.push(recentProjection(entry, resolveOwner(entry.name), session.sessionId, session.workspace));
|
|
199
|
+
}
|
|
200
|
+
for (const [day, usage] of Object.entries(session.state.byDay)) {
|
|
201
|
+
if (dayInWindow(day, window))
|
|
202
|
+
unsettled += usage.unsettled;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const toolRows = [...tools.entries()].map(([name, tool]) => ({
|
|
206
|
+
name,
|
|
207
|
+
owner: resolveOwner(name),
|
|
208
|
+
calls: tool.calls,
|
|
209
|
+
errors: tool.errors,
|
|
210
|
+
unsettled: tool.unsettled,
|
|
211
|
+
codeCalls: tool.codeCalls,
|
|
212
|
+
directCalls: tool.directCalls,
|
|
213
|
+
totalMs: tool.totalMs,
|
|
214
|
+
maxMs: tool.maxMs,
|
|
215
|
+
p50: percentileFromHistogram(tool.histogram, 50, tool.maxMs),
|
|
216
|
+
p95: percentileFromHistogram(tool.histogram, 95, tool.maxMs),
|
|
217
|
+
firstUsed: tool.firstUsed,
|
|
218
|
+
lastUsed: tool.lastUsed,
|
|
219
|
+
argsBytes: tool.argsBytes,
|
|
220
|
+
resultBytes: tool.resultBytes,
|
|
221
|
+
}));
|
|
222
|
+
const modelRows = [...models.values()].map(model => ({
|
|
223
|
+
model: model.model,
|
|
224
|
+
calls: model.calls,
|
|
225
|
+
errors: model.errors,
|
|
226
|
+
tools: model.tools,
|
|
227
|
+
ms: model.ms,
|
|
228
|
+
p50: percentileFromHistogram(model.histogram, 50, model.maxMs),
|
|
229
|
+
p95: percentileFromHistogram(model.histogram, 95, model.maxMs),
|
|
230
|
+
}));
|
|
231
|
+
const settled = calls - unsettled;
|
|
232
|
+
return {
|
|
233
|
+
range: window.range,
|
|
234
|
+
from: window.from,
|
|
235
|
+
to: window.to,
|
|
236
|
+
calls,
|
|
237
|
+
errors,
|
|
238
|
+
unsettled,
|
|
239
|
+
toolMs,
|
|
240
|
+
codeCalls,
|
|
241
|
+
sessions: sessionsWithCalls,
|
|
242
|
+
uniqueTools: toolRows.length,
|
|
243
|
+
successRate: settled <= 0 ? null : (settled - errors) / settled,
|
|
244
|
+
p50: percentileFromHistogram(overallHistogram, 50, Math.max(0, ...toolRows.map(row => row.maxMs))),
|
|
245
|
+
p95: percentileFromHistogram(overallHistogram, 95, Math.max(0, ...toolRows.map(row => row.maxMs))),
|
|
246
|
+
tools: toolRows.sort((left, right) => right.calls - left.calls || left.name.localeCompare(right.name)),
|
|
247
|
+
models: modelRows.sort((left, right) => right.calls - left.calls || left.model.localeCompare(right.model)),
|
|
248
|
+
days: [...days.values()].sort((left, right) => left.day.localeCompare(right.day)),
|
|
249
|
+
workspaces: [...workspaces.values()].sort((left, right) => right.calls - left.calls || left.workspace.localeCompare(right.workspace)),
|
|
250
|
+
errorCodes: [...errorCodes.entries()]
|
|
251
|
+
.map(([code, count]) => ({ code, calls: count }))
|
|
252
|
+
.sort((left, right) => right.calls - left.calls || left.code.localeCompare(right.code)),
|
|
253
|
+
recentCalls: recentCalls.sort((left, right) => left.time - right.time).slice(-recentLimit),
|
|
254
|
+
histogramScope: 'retained',
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/** Project one detail recent call onto the client's flat vocabulary. */
|
|
258
|
+
function recentProjection(entry, owner, sessionId, workspace) {
|
|
259
|
+
return {
|
|
260
|
+
time: entry.time,
|
|
261
|
+
name: entry.name,
|
|
262
|
+
owner,
|
|
263
|
+
model: entry.model,
|
|
264
|
+
ms: entry.ms,
|
|
265
|
+
ok: entry.ok,
|
|
266
|
+
errorCode: entry.code,
|
|
267
|
+
kind: entry.kind,
|
|
268
|
+
callId: entry.callId,
|
|
269
|
+
parentCallId: entry.parentCallId ?? null,
|
|
270
|
+
sessionId,
|
|
271
|
+
workspace,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=tool-usage-report.js.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command transports: reaching a model that is not an in-process npm package.
|
|
3
|
+
*
|
|
4
|
+
* Two transports share one shape:
|
|
5
|
+
*
|
|
6
|
+
* - **cli** — runs the Desert Ant CLI (`desertant`/`da`), which exposes every
|
|
7
|
+
* shipping model as `desertant <verb> … --json` and runs on macOS and Linux.
|
|
8
|
+
* - **remote** — POSTs to a bridge the user runs on a machine that can execute
|
|
9
|
+
* the model. This is what makes an Apple-only model such as Title reachable
|
|
10
|
+
* from a Windows host.
|
|
11
|
+
*
|
|
12
|
+
* Both are injected with their side-effecting primitive (`CommandRunner`,
|
|
13
|
+
* `HttpPost`) so behaviour is testable without spawning a process or opening a
|
|
14
|
+
* socket, and so a deployment can substitute its own runner.
|
|
15
|
+
*
|
|
16
|
+
* @module @try-works/dsh-tool-mode/transport
|
|
17
|
+
*/
|
|
18
|
+
import type { ModelCatalogEntry } from './types.ts';
|
|
19
|
+
import { type JsonValue } from './adapters/types.ts';
|
|
20
|
+
/** One invocation to route through a transport. */
|
|
21
|
+
export interface TransportRequest {
|
|
22
|
+
/** The catalog entry being invoked. */
|
|
23
|
+
readonly entry: ModelCatalogEntry;
|
|
24
|
+
/** Validated tool arguments; the first declared parameter is the primary input. */
|
|
25
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
26
|
+
/** Caller cancellation. */
|
|
27
|
+
readonly signal: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
/** Outcome of running one command. */
|
|
30
|
+
export interface CommandOutcome {
|
|
31
|
+
readonly code: number;
|
|
32
|
+
readonly stdout: string;
|
|
33
|
+
readonly stderr: string;
|
|
34
|
+
}
|
|
35
|
+
/** Run a command to completion. Injectable so tests need no real process. */
|
|
36
|
+
export type CommandRunner = (command: string, argv: readonly string[], signal: AbortSignal) => Promise<CommandOutcome>;
|
|
37
|
+
/** Post a JSON body and read the response. Injectable for the same reason. */
|
|
38
|
+
export type HttpPost = (url: string, body: unknown, headers: Readonly<Record<string, string>>, signal: AbortSignal) => Promise<{
|
|
39
|
+
readonly status: number;
|
|
40
|
+
readonly body: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** A model invoked out-of-process. */
|
|
43
|
+
export interface CommandTransport {
|
|
44
|
+
readonly kind: 'cli' | 'remote';
|
|
45
|
+
invoke(request: TransportRequest): Promise<Record<string, JsonValue>>;
|
|
46
|
+
}
|
|
47
|
+
/** The Desert Ant CLI's exit codes, as documented for agents. */
|
|
48
|
+
export declare const CLI_EXIT_RUNTIME_ERROR = 1;
|
|
49
|
+
export declare const CLI_EXIT_USAGE_ERROR = 64;
|
|
50
|
+
/**
|
|
51
|
+
* Default command name. `da` is the short alias the CLI installs.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_CLI_COMMAND = "desertant";
|
|
54
|
+
/** The path every bridge must serve. */
|
|
55
|
+
export declare const BRIDGE_PATH = "/invoke";
|
|
56
|
+
/**
|
|
57
|
+
* Whether a command is on PATH.
|
|
58
|
+
*
|
|
59
|
+
* Probed by scanning PATH rather than by running the command, because this runs
|
|
60
|
+
* at plugin load and a capability probe must not start a process (or pay a
|
|
61
|
+
* CLI's startup cost) just to decide what to advertise.
|
|
62
|
+
* @param command - command name or an absolute path.
|
|
63
|
+
* @param pathValue - the PATH to search; defaults to the process environment.
|
|
64
|
+
* @returns whether an executable file of that name exists.
|
|
65
|
+
*/
|
|
66
|
+
export declare function commandExists(command: string, pathValue?: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Split the tool arguments into the CLI's positional inputs and its
|
|
69
|
+
* `--option key=value` flags.
|
|
70
|
+
*
|
|
71
|
+
* The first declared catalog parameter is the primary input, matching how the
|
|
72
|
+
* registrar marks it required. A file model accepts several paths positionally
|
|
73
|
+
* (the CLI loads the model once for all of them), so a primary declared as a
|
|
74
|
+
* string list becomes several positionals. Everything else becomes an option,
|
|
75
|
+
* with lists comma-joined because the CLI's option syntax is `key=value`.
|
|
76
|
+
* @param entry - the catalog entry being invoked.
|
|
77
|
+
* @param args - validated tool arguments.
|
|
78
|
+
* @returns the positional inputs and the option list.
|
|
79
|
+
*/
|
|
80
|
+
export declare function splitArguments(entry: ModelCatalogEntry, args: Readonly<Record<string, unknown>>): {
|
|
81
|
+
positionals: string[];
|
|
82
|
+
options: [string, string][];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Build the CLI argv for one invocation.
|
|
86
|
+
*
|
|
87
|
+
* `--json` is what makes stdout a single JSON value, and it also implies
|
|
88
|
+
* `--no-color`, so no escape sequences have to be stripped.
|
|
89
|
+
* @param entry - the catalog entry being invoked.
|
|
90
|
+
* @param args - validated tool arguments.
|
|
91
|
+
* @returns the argv to run, after the command itself.
|
|
92
|
+
*/
|
|
93
|
+
export declare function buildArgv(entry: ModelCatalogEntry, args: Readonly<Record<string, unknown>>): string[];
|
|
94
|
+
/**
|
|
95
|
+
* Parse the CLI's stdout into a canonical value.
|
|
96
|
+
*
|
|
97
|
+
* The CLI writes exactly one JSON value to stdout under `--json` and keeps every
|
|
98
|
+
* diagnostic on stderr, so a parse failure means the command did not behave as
|
|
99
|
+
* documented rather than that output needs cleaning.
|
|
100
|
+
* @param entry - the model, for error messages.
|
|
101
|
+
* @param outcome - the completed command.
|
|
102
|
+
* @returns the parsed value.
|
|
103
|
+
* @throws when the exit code is non-zero or stdout is not a single JSON value.
|
|
104
|
+
*/
|
|
105
|
+
export declare function parseCliOutcome(entry: ModelCatalogEntry, outcome: CommandOutcome): Record<string, JsonValue>;
|
|
106
|
+
/** Spawn a command and capture its output. */
|
|
107
|
+
export declare const spawnRunner: CommandRunner;
|
|
108
|
+
/** POST JSON with the global fetch and read the response as text. */
|
|
109
|
+
export declare const fetchPost: HttpPost;
|
|
110
|
+
/** Options shared by both out-of-process transports. */
|
|
111
|
+
export interface TransportOptions {
|
|
112
|
+
/** Command name or path for the CLI transport. */
|
|
113
|
+
readonly cliCommand?: string;
|
|
114
|
+
/** Bridge base URL for the remote transport. */
|
|
115
|
+
readonly endpoint?: string;
|
|
116
|
+
/** Optional bearer token sent to the bridge. */
|
|
117
|
+
readonly token?: string;
|
|
118
|
+
/** Injected command runner. */
|
|
119
|
+
readonly run?: CommandRunner;
|
|
120
|
+
/** Injected HTTP poster. */
|
|
121
|
+
readonly post?: HttpPost;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build the CLI transport for one model.
|
|
125
|
+
* @param entry - the catalog entry, which must declare a CLI verb.
|
|
126
|
+
* @param options - command name and injected runner.
|
|
127
|
+
* @returns the transport.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createCliTransport(entry: ModelCatalogEntry, options?: TransportOptions): CommandTransport;
|
|
130
|
+
/**
|
|
131
|
+
* Build the remote transport for one model.
|
|
132
|
+
*
|
|
133
|
+
* The bridge contract is deliberately small so a user can implement it in a few
|
|
134
|
+
* lines on a machine that can run the model:
|
|
135
|
+
*
|
|
136
|
+
* ```
|
|
137
|
+
* POST <endpoint>/invoke
|
|
138
|
+
* { "model": "title", "verb": "title", "input": "<primary>", "options": { "max-tokens": "96" } }
|
|
139
|
+
* → 200 { "ok": true, "result": <the model's JSON> }
|
|
140
|
+
* → 4xx { "ok": false, "error": "<message>" }
|
|
141
|
+
* ```
|
|
142
|
+
* @param entry - the catalog entry to reach.
|
|
143
|
+
* @param options - endpoint, optional token, injected poster.
|
|
144
|
+
* @returns the transport.
|
|
145
|
+
*/
|
|
146
|
+
export declare function createRemoteTransport(entry: ModelCatalogEntry, options?: TransportOptions): CommandTransport;
|
|
147
|
+
/**
|
|
148
|
+
* Interpret one bridge response.
|
|
149
|
+
* @param entry - the model, for error messages.
|
|
150
|
+
* @param response - the HTTP status and body.
|
|
151
|
+
* @returns the model's result as a canonical value.
|
|
152
|
+
* @throws when the bridge reports a failure or an unreadable body.
|
|
153
|
+
*/
|
|
154
|
+
export declare function parseBridgeResponse(entry: ModelCatalogEntry, response: {
|
|
155
|
+
readonly status: number;
|
|
156
|
+
readonly body: string;
|
|
157
|
+
}): Record<string, JsonValue>;
|
|
158
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRo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