@try-works/dsh-tool-mode 0.0.0-stage → 0.5.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +205 -0
- package/README.md +303 -2
- package/bin/dsh-tool-mode-credentials.mjs +20 -0
- package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
- package/bin/dsh-tool-mode.mjs +211 -0
- package/builtins.lock.json +26 -0
- package/catalog/desert-ant-models.json +693 -0
- package/catalog/playbooks.json +531 -0
- package/client/client.model-tools.js +1910 -0
- package/client/index.js +4158 -0
- package/cordis.patch.yml +39 -0
- package/lib/adapters/index.d.ts +61 -0
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/index.js +82 -0
- package/lib/adapters/types.d.ts +106 -0
- package/lib/adapters/types.d.ts.map +1 -0
- package/lib/adapters/types.js +85 -0
- package/lib/approval.d.ts +189 -0
- package/lib/approval.d.ts.map +1 -0
- package/lib/approval.js +510 -0
- package/lib/asset-acquisition.d.ts +149 -0
- package/lib/asset-acquisition.d.ts.map +1 -0
- package/lib/asset-acquisition.js +175 -0
- package/lib/authority.d.ts +185 -0
- package/lib/authority.d.ts.map +1 -0
- package/lib/authority.js +223 -0
- package/lib/bindings.d.ts +144 -0
- package/lib/bindings.d.ts.map +1 -0
- package/lib/bindings.js +314 -0
- package/lib/builtins.d.ts +27 -0
- package/lib/builtins.d.ts.map +1 -0
- package/lib/builtins.js +37 -0
- package/lib/capability.d.ts +58 -0
- package/lib/capability.d.ts.map +1 -0
- package/lib/capability.js +192 -0
- package/lib/capture-path.d.ts +97 -0
- package/lib/capture-path.d.ts.map +1 -0
- package/lib/capture-path.js +152 -0
- package/lib/catalog.d.ts +37 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +274 -0
- package/lib/contract-payload.d.ts +39 -0
- package/lib/contract-payload.d.ts.map +1 -0
- package/lib/contract-payload.js +56 -0
- package/lib/custom-tools/compile.d.ts +25 -0
- package/lib/custom-tools/compile.d.ts.map +1 -0
- package/lib/custom-tools/compile.js +61 -0
- package/lib/custom-tools/composite-executor.d.ts +42 -0
- package/lib/custom-tools/composite-executor.d.ts.map +1 -0
- package/lib/custom-tools/composite-executor.js +113 -0
- package/lib/custom-tools/dispatch.d.ts +28 -0
- package/lib/custom-tools/dispatch.d.ts.map +1 -0
- package/lib/custom-tools/dispatch.js +34 -0
- package/lib/custom-tools/http-executor.d.ts +48 -0
- package/lib/custom-tools/http-executor.d.ts.map +1 -0
- package/lib/custom-tools/http-executor.js +241 -0
- package/lib/custom-tools/index.d.ts +12 -0
- package/lib/custom-tools/index.d.ts.map +1 -0
- package/lib/custom-tools/index.js +12 -0
- package/lib/custom-tools/mcp-surface.d.ts +14 -0
- package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
- package/lib/custom-tools/mcp-surface.js +41 -0
- package/lib/custom-tools/prompt-executor.d.ts +39 -0
- package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
- package/lib/custom-tools/prompt-executor.js +59 -0
- package/lib/custom-tools/registry.d.ts +69 -0
- package/lib/custom-tools/registry.d.ts.map +1 -0
- package/lib/custom-tools/registry.js +130 -0
- package/lib/custom-tools/schema.d.ts +26 -0
- package/lib/custom-tools/schema.d.ts.map +1 -0
- package/lib/custom-tools/schema.js +375 -0
- package/lib/custom-tools/service.d.ts +90 -0
- package/lib/custom-tools/service.d.ts.map +1 -0
- package/lib/custom-tools/service.js +203 -0
- package/lib/custom-tools/store.d.ts +61 -0
- package/lib/custom-tools/store.d.ts.map +1 -0
- package/lib/custom-tools/store.js +240 -0
- package/lib/custom-tools/types.d.ts +131 -0
- package/lib/custom-tools/types.d.ts.map +1 -0
- package/lib/custom-tools/types.js +11 -0
- package/lib/decision-combine.d.ts +113 -0
- package/lib/decision-combine.d.ts.map +1 -0
- package/lib/decision-combine.js +156 -0
- package/lib/decision-evaluate.d.ts +185 -0
- package/lib/decision-evaluate.d.ts.map +1 -0
- package/lib/decision-evaluate.js +227 -0
- package/lib/deployment-coordinator.d.ts +213 -0
- package/lib/deployment-coordinator.d.ts.map +1 -0
- package/lib/deployment-coordinator.js +274 -0
- package/lib/diagnostics.d.ts +169 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +136 -0
- package/lib/discovery-contracts.d.ts +14 -0
- package/lib/discovery-contracts.d.ts.map +1 -0
- package/lib/discovery-contracts.js +90 -0
- package/lib/discovery-describe.d.ts +35 -0
- package/lib/discovery-describe.d.ts.map +1 -0
- package/lib/discovery-describe.js +99 -0
- package/lib/embedding-index.d.ts +55 -0
- package/lib/embedding-index.d.ts.map +1 -0
- package/lib/embedding-index.js +126 -0
- package/lib/extension-dependencies.d.ts +355 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +987 -0
- package/lib/extension-dispatch.d.ts +150 -0
- package/lib/extension-dispatch.d.ts.map +1 -0
- package/lib/extension-dispatch.js +178 -0
- package/lib/extension-page-state.d.ts +69 -0
- package/lib/extension-page-state.d.ts.map +1 -0
- package/lib/extension-page-state.js +82 -0
- package/lib/extension-registrar.d.ts +116 -0
- package/lib/extension-registrar.d.ts.map +1 -0
- package/lib/extension-registrar.js +144 -0
- package/lib/extensions-api.d.ts +346 -0
- package/lib/extensions-api.d.ts.map +1 -0
- package/lib/extensions-api.js +17 -0
- package/lib/extensions-remote.d.ts +57 -0
- package/lib/extensions-remote.d.ts.map +1 -0
- package/lib/extensions-remote.js +69 -0
- package/lib/extensions-service.d.ts +568 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +2552 -0
- package/lib/harness-budgets.d.ts +158 -0
- package/lib/harness-budgets.d.ts.map +1 -0
- package/lib/harness-budgets.js +152 -0
- package/lib/harness-llm.d.ts +138 -0
- package/lib/harness-llm.d.ts.map +1 -0
- package/lib/harness-llm.js +218 -0
- package/lib/harness-serving.d.ts +115 -0
- package/lib/harness-serving.d.ts.map +1 -0
- package/lib/harness-serving.js +176 -0
- package/lib/headless.d.ts +97 -0
- package/lib/headless.d.ts.map +1 -0
- package/lib/headless.js +407 -0
- package/lib/http-acquisition.d.ts +27 -0
- package/lib/http-acquisition.d.ts.map +1 -0
- package/lib/http-acquisition.js +140 -0
- package/lib/index.d.ts +546 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5273 -0
- package/lib/invocation-accounting.d.ts +169 -0
- package/lib/invocation-accounting.d.ts.map +1 -0
- package/lib/invocation-accounting.js +148 -0
- package/lib/jev.d.ts +218 -0
- package/lib/jev.d.ts.map +1 -0
- package/lib/jev.js +366 -0
- package/lib/legacy-migration.d.ts +95 -0
- package/lib/legacy-migration.d.ts.map +1 -0
- package/lib/legacy-migration.js +429 -0
- package/lib/license-basis.d.ts +29 -0
- package/lib/license-basis.d.ts.map +1 -0
- package/lib/license-basis.js +58 -0
- package/lib/managed-workers.d.ts +158 -0
- package/lib/managed-workers.d.ts.map +1 -0
- package/lib/managed-workers.js +269 -0
- package/lib/mcp/auth-selection.d.ts +35 -0
- package/lib/mcp/auth-selection.d.ts.map +1 -0
- package/lib/mcp/auth-selection.js +64 -0
- package/lib/mcp/client-grant.d.ts +89 -0
- package/lib/mcp/client-grant.d.ts.map +1 -0
- package/lib/mcp/client-grant.js +63 -0
- package/lib/mcp/credential-cli.d.ts +38 -0
- package/lib/mcp/credential-cli.d.ts.map +1 -0
- package/lib/mcp/credential-cli.js +148 -0
- package/lib/mcp/credential-store.d.ts +143 -0
- package/lib/mcp/credential-store.d.ts.map +1 -0
- package/lib/mcp/credential-store.js +461 -0
- package/lib/mcp/export-policy.d.ts +25 -0
- package/lib/mcp/export-policy.d.ts.map +1 -0
- package/lib/mcp/export-policy.js +31 -0
- package/lib/mcp/host-binding.d.ts +144 -0
- package/lib/mcp/host-binding.d.ts.map +1 -0
- package/lib/mcp/host-binding.js +280 -0
- package/lib/mcp/http.d.ts +180 -0
- package/lib/mcp/http.d.ts.map +1 -0
- package/lib/mcp/http.js +602 -0
- package/lib/mcp/oauth.d.ts +149 -0
- package/lib/mcp/oauth.d.ts.map +1 -0
- package/lib/mcp/oauth.js +396 -0
- package/lib/mcp/protocol.d.ts +329 -0
- package/lib/mcp/protocol.d.ts.map +1 -0
- package/lib/mcp/protocol.js +459 -0
- package/lib/mcp/rate-limit.d.ts +68 -0
- package/lib/mcp/rate-limit.d.ts.map +1 -0
- package/lib/mcp/rate-limit.js +114 -0
- package/lib/mcp/sdk-v2.d.ts +17 -0
- package/lib/mcp/sdk-v2.d.ts.map +1 -0
- package/lib/mcp/sdk-v2.js +204 -0
- package/lib/mcp/server.d.ts +149 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +302 -0
- package/lib/mcp/stdio.d.ts +80 -0
- package/lib/mcp/stdio.d.ts.map +1 -0
- package/lib/mcp/stdio.js +184 -0
- package/lib/mcp/subscriptions.d.ts +177 -0
- package/lib/mcp/subscriptions.d.ts.map +1 -0
- package/lib/mcp/subscriptions.js +288 -0
- package/lib/mcp-status.d.ts +96 -0
- package/lib/mcp-status.d.ts.map +1 -0
- package/lib/mcp-status.js +70 -0
- package/lib/mcp-usage.d.ts +110 -0
- package/lib/mcp-usage.d.ts.map +1 -0
- package/lib/mcp-usage.js +189 -0
- package/lib/model-qualification.d.ts +192 -0
- package/lib/model-qualification.d.ts.map +1 -0
- package/lib/model-qualification.js +178 -0
- package/lib/model-runtime-lane.d.ts +69 -0
- package/lib/model-runtime-lane.d.ts.map +1 -0
- package/lib/model-runtime-lane.js +122 -0
- package/lib/model-runtime-recipe.d.ts +132 -0
- package/lib/model-runtime-recipe.d.ts.map +1 -0
- package/lib/model-runtime-recipe.js +291 -0
- package/lib/planning.d.ts +256 -0
- package/lib/planning.d.ts.map +1 -0
- package/lib/planning.js +471 -0
- package/lib/playbook.d.ts +42 -0
- package/lib/playbook.d.ts.map +1 -0
- package/lib/playbook.js +65 -0
- package/lib/prepared-assets.d.ts +269 -0
- package/lib/prepared-assets.d.ts.map +1 -0
- package/lib/prepared-assets.js +471 -0
- package/lib/provider-bridge.d.ts +107 -0
- package/lib/provider-bridge.d.ts.map +1 -0
- package/lib/provider-bridge.js +423 -0
- package/lib/ptc-authority.d.ts +154 -0
- package/lib/ptc-authority.d.ts.map +1 -0
- package/lib/ptc-authority.js +242 -0
- package/lib/ptc-confinement.d.ts +60 -0
- package/lib/ptc-confinement.d.ts.map +1 -0
- package/lib/ptc-confinement.js +212 -0
- package/lib/ptc-runtime.d.ts +166 -0
- package/lib/ptc-runtime.d.ts.map +1 -0
- package/lib/ptc-runtime.js +231 -0
- package/lib/publication.d.ts +161 -0
- package/lib/publication.d.ts.map +1 -0
- package/lib/publication.js +181 -0
- package/lib/receipt-store.d.ts +57 -0
- package/lib/receipt-store.d.ts.map +1 -0
- package/lib/receipt-store.js +143 -0
- package/lib/receipt.d.ts +231 -0
- package/lib/receipt.d.ts.map +1 -0
- package/lib/receipt.js +165 -0
- package/lib/registrar.d.ts +75 -0
- package/lib/registrar.d.ts.map +1 -0
- package/lib/registrar.js +152 -0
- package/lib/resource-governance.d.ts +204 -0
- package/lib/resource-governance.d.ts.map +1 -0
- package/lib/resource-governance.js +213 -0
- package/lib/server-lifecycle.d.ts +175 -0
- package/lib/server-lifecycle.d.ts.map +1 -0
- package/lib/server-lifecycle.js +269 -0
- package/lib/skills.d.ts +31 -0
- package/lib/skills.d.ts.map +1 -0
- package/lib/skills.js +170 -0
- package/lib/speech-bridge.d.ts +74 -0
- package/lib/speech-bridge.d.ts.map +1 -0
- package/lib/speech-bridge.js +115 -0
- package/lib/state.d.ts +100 -0
- package/lib/state.d.ts.map +1 -0
- package/lib/state.js +160 -0
- package/lib/title-proposal.d.ts +194 -0
- package/lib/title-proposal.d.ts.map +1 -0
- package/lib/title-proposal.js +244 -0
- package/lib/tool-inventory.d.ts +90 -0
- package/lib/tool-inventory.d.ts.map +1 -0
- package/lib/tool-inventory.js +102 -0
- package/lib/tool-mode-run.d.ts +310 -0
- package/lib/tool-mode-run.d.ts.map +1 -0
- package/lib/tool-mode-run.js +411 -0
- package/lib/tool-sources.d.ts +80 -0
- package/lib/tool-sources.d.ts.map +1 -0
- package/lib/tool-sources.js +123 -0
- package/lib/tool-usage-projection.d.ts +390 -0
- package/lib/tool-usage-projection.d.ts.map +1 -0
- package/lib/tool-usage-projection.js +1038 -0
- package/lib/tool-usage-report.d.ts +153 -0
- package/lib/tool-usage-report.d.ts.map +1 -0
- package/lib/tool-usage-report.js +274 -0
- package/lib/transport.d.ts +158 -0
- package/lib/transport.d.ts.map +1 -0
- package/lib/transport.js +332 -0
- package/lib/types.d.ts +134 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +8 -0
- package/lib/update-surface.d.ts +79 -0
- package/lib/update-surface.d.ts.map +1 -0
- package/lib/update-surface.js +224 -0
- package/lib/version.d.ts +3 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +27 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
- package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
- package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
- package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
- package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
- package/package.json +127 -4
- package/remote/spec.mjs +993 -0
- package/remote/typert.host.mjs +14 -0
- package/remote/typert.remote-client.mjs +16 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The authorized tool bindings a PTC program may call (CODE-03, ARCH-01, SEC-03).
|
|
3
|
+
*
|
|
4
|
+
* The directive is specific about this, and about what NOT to do:
|
|
5
|
+
*
|
|
6
|
+
* "ONE authorized-tool-pipeline function feeding both native PTC and external
|
|
7
|
+
* `tool_mode_run` — intersect requested names with the grant and the visible tool set,
|
|
8
|
+
* REJECT unknown/forbidden rather than omit."
|
|
9
|
+
*
|
|
10
|
+
* **Reject rather than omit** is the whole design. A program that asks for a tool it may
|
|
11
|
+
* not have must fail loudly: silently handing it a smaller namespace produces a program
|
|
12
|
+
* that runs, quietly does something other than what it says, and reports success. That is
|
|
13
|
+
* worse than a refusal, because the caller cannot tell the difference.
|
|
14
|
+
*
|
|
15
|
+
* The bindings themselves are built with a **null prototype**, so a program cannot reach
|
|
16
|
+
* `Object.prototype` through a binding name — `toString`, `constructor` and `__proto__`
|
|
17
|
+
* stop being reachable as if they were tools.
|
|
18
|
+
*
|
|
19
|
+
* @module @try-works/dsh-tool-mode/ptc-authority
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Generate TypeScript bindings for EXACTLY the names a program was authorized to call
|
|
23
|
+
* (CODE-03). The generated source is descriptive metadata, not executable code.
|
|
24
|
+
* @param names - the bound names, after the grant/visibility intersection.
|
|
25
|
+
* @returns a TypeScript interface declaration.
|
|
26
|
+
*/
|
|
27
|
+
export function generateProgramTypes(names) {
|
|
28
|
+
const members = [...names]
|
|
29
|
+
.sort((left, right) => left.localeCompare(right))
|
|
30
|
+
.map(name => ` readonly ${name}: (args: Record<string, unknown>) => Promise<unknown>`);
|
|
31
|
+
return [
|
|
32
|
+
'/** TypeScript bindings for exactly the tools this program was authorized to call. */',
|
|
33
|
+
'export interface ToolProgramBindings {',
|
|
34
|
+
...members,
|
|
35
|
+
'}',
|
|
36
|
+
].join('\n');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether a name is usable as a binding.
|
|
40
|
+
*
|
|
41
|
+
* A generated program references bindings as identifiers, so a name that is not a plain
|
|
42
|
+
* identifier cannot be bound — and `__proto__` in particular must never become a key on
|
|
43
|
+
* the map, since assigning it would change the object's prototype rather than add a field.
|
|
44
|
+
* @param name - the candidate name.
|
|
45
|
+
* @returns whether it is usable.
|
|
46
|
+
*/
|
|
47
|
+
export function isBindableName(name) {
|
|
48
|
+
if (name.length === 0 || name.length > 64)
|
|
49
|
+
return false;
|
|
50
|
+
if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name))
|
|
51
|
+
return false;
|
|
52
|
+
// Reserved words would produce a program that cannot be generated.
|
|
53
|
+
if (RESERVED_WORDS.has(name))
|
|
54
|
+
return false;
|
|
55
|
+
// Globals a binding must never shadow, because the runtime supplies them.
|
|
56
|
+
if (RESERVED_BINDING_GLOBALS.has(name))
|
|
57
|
+
return false;
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
/** Words that cannot appear as bindings in the generated language. */
|
|
61
|
+
const RESERVED_WORDS = new Set([
|
|
62
|
+
'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default',
|
|
63
|
+
'delete', 'do', 'else', 'enum', 'export', 'extends', 'false', 'finally', 'for',
|
|
64
|
+
'function', 'if', 'import', 'in', 'instanceof', 'new', 'null', 'return', 'super',
|
|
65
|
+
'switch', 'this', 'throw', 'true', 'try', 'typeof', 'var', 'void', 'while', 'with',
|
|
66
|
+
'yield', 'let', 'static', 'implements', 'interface', 'package', 'private', 'protected',
|
|
67
|
+
'public',
|
|
68
|
+
]);
|
|
69
|
+
/** Globals the runtime supplies, which a binding must not replace. */
|
|
70
|
+
const RESERVED_BINDING_GLOBALS = new Set([
|
|
71
|
+
'console', 'globalThis', 'process', 'require', 'module', 'exports', 'JSON', 'Math',
|
|
72
|
+
'Promise', 'Object', 'Array', 'String', 'Number', 'Boolean', 'Date', 'RegExp', 'Error',
|
|
73
|
+
'Map', 'Set', 'Symbol', 'BigInt', 'Reflect', 'Proxy', 'undefined', 'NaN', 'Infinity',
|
|
74
|
+
'eval', 'Function', 'arguments', 'prototype', 'constructor', '__proto__',
|
|
75
|
+
/**
|
|
76
|
+
* EVERY `Object.prototype` member, named explicitly.
|
|
77
|
+
*
|
|
78
|
+
* These are not globals and not reserved words, so a check for those two categories
|
|
79
|
+
* alone lets them through — and they are exactly the names a program probes for. Even
|
|
80
|
+
* with a null-prototype map, refusing them BY NAME means a name that resolves to
|
|
81
|
+
* inherited behaviour can never be bound, rather than depending on the map's prototype
|
|
82
|
+
* staying null forever.
|
|
83
|
+
*/
|
|
84
|
+
'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf',
|
|
85
|
+
'propertyIsEnumerable', '__defineGetter__', '__defineSetter__', '__lookupGetter__',
|
|
86
|
+
'__lookupSetter__',
|
|
87
|
+
]);
|
|
88
|
+
/**
|
|
89
|
+
* Tool names a program binding must NEVER expose, regardless of grant (CODE-07).
|
|
90
|
+
*
|
|
91
|
+
* `tool_mode_run` is the recursive composition door: a program could nest programs, which
|
|
92
|
+
* the requirement forbids in v1. The management surface (`model_tools` and the extension
|
|
93
|
+
* install/activation controls) is operator territory: EXT-32 excludes installer and
|
|
94
|
+
* administration bindings from Code Mode, and SEC-09 keeps installation approval separate
|
|
95
|
+
* from tool-use permission, so a program that could reach them would hold the management
|
|
96
|
+
* grant by proxy.
|
|
97
|
+
*
|
|
98
|
+
* EXPORTED so the planning surface (NDL-02) reuses the SAME names: a `tools_plan`
|
|
99
|
+
* proposal must never target the composition door or the management surface either, and a
|
|
100
|
+
* second, independently maintained copy of this list would drift the first time one of
|
|
101
|
+
* them was edited. One set, two consumers, both refused by name.
|
|
102
|
+
*
|
|
103
|
+
* SEALED AS A FROZEN ARRAY, deliberately not a frozen `Set`: freezing a `Set` does NOT
|
|
104
|
+
* prevent `add`/`delete` (those methods mutate internal slots without consulting
|
|
105
|
+
* extensibility), so a frozen Set would only LOOK immutable. A frozen array throws on
|
|
106
|
+
* every mutation in strict mode, so neither consumer — nor any code holding a
|
|
107
|
+
* reference — can add or remove a name at runtime and silently desynchronize the two
|
|
108
|
+
* surfaces that depend on it.
|
|
109
|
+
*/
|
|
110
|
+
export const EXCLUDED_BINDINGS = Object.freeze(['tool_mode_run', 'model_tools', 'model_tools_manage', 'tool_mode_list', 'tool_mode_describe']);
|
|
111
|
+
/**
|
|
112
|
+
* Build the bindings a program may call (CODE-03, SEC-03).
|
|
113
|
+
*
|
|
114
|
+
* Intersects the requested names with BOTH the grant and the visible set, and refuses the
|
|
115
|
+
* whole request if anything is unattainable — so a program never runs against a smaller
|
|
116
|
+
* namespace than it declared.
|
|
117
|
+
*
|
|
118
|
+
* @param request - what the program asked for.
|
|
119
|
+
* @param authority - what is granted and what is available.
|
|
120
|
+
* @param resolve - resolves one bound name to its implementation.
|
|
121
|
+
* @returns the bindings, or every rejection.
|
|
122
|
+
*/
|
|
123
|
+
export function authorizeProgramTools(request, authority, resolve) {
|
|
124
|
+
const granted = new Set(authority.granted);
|
|
125
|
+
const visible = new Set(authority.visible);
|
|
126
|
+
const confidential = new Set(authority.confidential ?? []);
|
|
127
|
+
const rejections = [];
|
|
128
|
+
const seen = new Set();
|
|
129
|
+
const bound = [];
|
|
130
|
+
for (const name of request.requested) {
|
|
131
|
+
if (!isBindableName(name)) {
|
|
132
|
+
rejections.push({
|
|
133
|
+
name,
|
|
134
|
+
reason: 'invalid-name',
|
|
135
|
+
remedy: 'A binding name must be a plain identifier that is not a reserved word, a runtime global or __proto__.',
|
|
136
|
+
});
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (seen.has(name)) {
|
|
140
|
+
rejections.push({
|
|
141
|
+
name,
|
|
142
|
+
reason: 'duplicate',
|
|
143
|
+
remedy: 'Request each tool once; a repeated name makes the generated bindings ambiguous.',
|
|
144
|
+
});
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
seen.add(name);
|
|
148
|
+
/**
|
|
149
|
+
* CODE-07 EXCLUSIONS ARE CHECKED FIRST.
|
|
150
|
+
*
|
|
151
|
+
* These names are un-bindable by policy, not by grant state: whether the caller's
|
|
152
|
+
* grant admits them is irrelevant, because a program must never hold the composition
|
|
153
|
+
* door or the management surface regardless of who authorizes it.
|
|
154
|
+
*/
|
|
155
|
+
if (EXCLUDED_BINDINGS.includes(name)) {
|
|
156
|
+
rejections.push({
|
|
157
|
+
name,
|
|
158
|
+
reason: 'excluded',
|
|
159
|
+
remedy: `"${name}" cannot be called from a program: recursive composition and management bindings are excluded from Code Mode (CODE-07).`,
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (confidential.has(name)) {
|
|
164
|
+
rejections.push({
|
|
165
|
+
name,
|
|
166
|
+
reason: 'confidential',
|
|
167
|
+
remedy: `"${name}" is blocked by the operator confidentiality policy; its canonical value cannot cross the program boundary (MCP-11).`,
|
|
168
|
+
});
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* FORBIDDEN IS CHECKED BEFORE UNKNOWN, deliberately.
|
|
173
|
+
*
|
|
174
|
+
* A caller probing for names it has no grant for must be told "forbidden" rather than
|
|
175
|
+
* "unknown": telling it a tool does not exist would let it infer the difference
|
|
176
|
+
* between a name that is absent and a name it may not use, and the second is
|
|
177
|
+
* information the caller has not earned.
|
|
178
|
+
*/
|
|
179
|
+
if (!granted.has(name)) {
|
|
180
|
+
rejections.push({
|
|
181
|
+
name,
|
|
182
|
+
reason: 'forbidden',
|
|
183
|
+
remedy: 'Request only tools this invocation is authorized for; the grant is not widened by asking.',
|
|
184
|
+
});
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (!visible.has(name)) {
|
|
188
|
+
rejections.push({
|
|
189
|
+
name,
|
|
190
|
+
reason: 'unknown',
|
|
191
|
+
remedy: 'The tool is authorized but not currently registered; its owning extension may be deactivated.',
|
|
192
|
+
});
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (resolve(name) === undefined) {
|
|
196
|
+
rejections.push({
|
|
197
|
+
name,
|
|
198
|
+
reason: 'unknown',
|
|
199
|
+
remedy: 'No implementation is bound for this name.',
|
|
200
|
+
});
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
bound.push(name);
|
|
204
|
+
}
|
|
205
|
+
if (rejections.length > 0) {
|
|
206
|
+
// ALL OR NOTHING. Binding the reachable subset would run a program that does not do
|
|
207
|
+
// what it declares, which is the failure mode this refusal exists to prevent.
|
|
208
|
+
return { ok: false, rejections };
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A NULL-PROTOTYPE map, built with `defineProperty`.
|
|
212
|
+
*
|
|
213
|
+
* A plain object literal would inherit `toString`, `constructor` and friends, so a
|
|
214
|
+
* program referencing `toString()` would reach `Object.prototype` instead of failing.
|
|
215
|
+
* A null prototype removes that path entirely rather than filtering the names that use
|
|
216
|
+
* it.
|
|
217
|
+
*/
|
|
218
|
+
const bindings = Object.create(null);
|
|
219
|
+
for (const name of bound) {
|
|
220
|
+
const binding = resolve(name);
|
|
221
|
+
Object.defineProperty(bindings, name, {
|
|
222
|
+
value: binding,
|
|
223
|
+
enumerable: true,
|
|
224
|
+
writable: false,
|
|
225
|
+
configurable: false,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return { ok: true, bindings, bound };
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Describe a refusal for a caller (CODE-03).
|
|
232
|
+
*
|
|
233
|
+
* Names every rejection and why, because a program author who is told only that the
|
|
234
|
+
* request failed cannot fix it.
|
|
235
|
+
* @param rejections - the refusals.
|
|
236
|
+
* @returns a readable summary.
|
|
237
|
+
*/
|
|
238
|
+
export function describeRejections(rejections) {
|
|
239
|
+
const lines = rejections.map(entry => ` ${entry.name}: ${entry.reason} — ${entry.remedy}`);
|
|
240
|
+
return `the program requested tools it may not use:\n${lines.join('\n')}`;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=ptc-authority.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** The environment variable naming the evidence artifact. */
|
|
2
|
+
export declare const CONFINEMENT_EVIDENCE_ENV = "DSH_PTC_CONFINEMENT_EVIDENCE";
|
|
3
|
+
/** The artifact's discriminator. */
|
|
4
|
+
export declare const CONFINEMENT_EVIDENCE_KIND = "ptc-confinement-evidence";
|
|
5
|
+
/** The artifact's schema version. */
|
|
6
|
+
export declare const CONFINEMENT_EVIDENCE_VERSION = 1;
|
|
7
|
+
/** The validated shape the recorder writes. */
|
|
8
|
+
export interface ConfinementEvidence {
|
|
9
|
+
readonly kind: typeof CONFINEMENT_EVIDENCE_KIND;
|
|
10
|
+
readonly version: number;
|
|
11
|
+
readonly passed: boolean;
|
|
12
|
+
/** ISO timestamp of the run. */
|
|
13
|
+
readonly generatedAt: string;
|
|
14
|
+
/** The package version the suite ran against. */
|
|
15
|
+
readonly packageVersion: string;
|
|
16
|
+
/** `process.platform` of the machine that ran it. */
|
|
17
|
+
readonly platform: string;
|
|
18
|
+
/** `process.version` of the machine that ran it. */
|
|
19
|
+
readonly node: string;
|
|
20
|
+
/** The suite files that were run. */
|
|
21
|
+
readonly tests: readonly string[];
|
|
22
|
+
/** The exact command line, so the run is reproducible. */
|
|
23
|
+
readonly command: string;
|
|
24
|
+
}
|
|
25
|
+
/** The result of reading the artifact. */
|
|
26
|
+
export type ConfinementEvidenceCheck = {
|
|
27
|
+
readonly ok: true;
|
|
28
|
+
readonly path: string;
|
|
29
|
+
readonly evidence: ConfinementEvidence;
|
|
30
|
+
} | {
|
|
31
|
+
readonly ok: false;
|
|
32
|
+
readonly present: boolean;
|
|
33
|
+
readonly path?: string;
|
|
34
|
+
readonly reason: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Read and validate the evidence artifact.
|
|
38
|
+
*
|
|
39
|
+
* The path is the operator's `DSH_PTC_CONFINEMENT_EVIDENCE` when set, otherwise the
|
|
40
|
+
* standard local artifact `~/.dsh/ptc-confinement-evidence.json` that the recorder writes.
|
|
41
|
+
* The default matters because a host started normally never carries that variable, and a
|
|
42
|
+
* gate whose only release path requires a wrapper launcher is still effectively closed.
|
|
43
|
+
* The default is not a bypass: the artifact is validated exactly like an explicit one —
|
|
44
|
+
* kind, schema, pass, package version, platform, timestamp, test list, command and counts.
|
|
45
|
+
*
|
|
46
|
+
* Failures are VALUES with a reason, never exceptions: a gate that throws on a malformed
|
|
47
|
+
* file would crash the host, and one that silently treats a malformed file as evidence
|
|
48
|
+
* would open the gate. Both are refused here with the reason spelled out.
|
|
49
|
+
* @param options - the environment, the expected package version, and the platform.
|
|
50
|
+
* @returns the check outcome.
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkConfinementEvidence(options: {
|
|
53
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
54
|
+
readonly expectedVersion: string;
|
|
55
|
+
readonly platform?: string;
|
|
56
|
+
readonly readFile?: (path: string) => string;
|
|
57
|
+
/** Fallback path when the environment names none; the runtime supplies the home file. */
|
|
58
|
+
readonly defaultPath?: string;
|
|
59
|
+
}): ConfinementEvidenceCheck;
|
|
60
|
+
//# sourceMappingURL=ptc-confinement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ptc-confinement.d.ts","sourceRoot":"","sources":["../src/ptc-confinement.ts"],"names":[],"mappings":"AAwBA,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,iCAAiC,CAAA;AACtE,oCAAoC;AACpC,eAAO,MAAM,yBAAyB,6BAA6B,CAAA;AACnE,qCAAqC;AACrC,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAAA;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,gCAAgC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,0CAA0C;AAC1C,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAOtG;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC5C,yFAAyF;IACzF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,GAAG,wBAAwB,CA+J3B"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CODE-09 evidence artifact: a durable record that the confinement acceptance
|
|
3
|
+
* suite passed on THIS build.
|
|
4
|
+
*
|
|
5
|
+
* Why an artifact instead of a module flag: the flag shipped false and only a test-only
|
|
6
|
+
* setter (armed by an environment marker) could move it, so a real deployment could never
|
|
7
|
+
* serve `tool_mode_run` — not by configuration, not by running the very tests the
|
|
8
|
+
* specification names. That is a release gate with no release path.
|
|
9
|
+
*
|
|
10
|
+
* This module gives the gate an operator path that stays auditable:
|
|
11
|
+
*
|
|
12
|
+
* 1. the operator runs `scripts/record-confinement-evidence.mjs`, which runs the
|
|
13
|
+
* confinement suite (`tests/ptc-sandbox.test.ts`, on the real Node backend) and writes
|
|
14
|
+
* the artifact ONLY when the suite passes;
|
|
15
|
+
* 2. the operator starts the host with `DSH_PTC_CONFINEMENT_EVIDENCE=<artifact path>`;
|
|
16
|
+
* 3. the runtime reads and VALIDATES the artifact (kind, version, pass, package version,
|
|
17
|
+
* platform, non-empty test list) — a malformed, stale or failed artifact is refused
|
|
18
|
+
* with the reason, never treated as "some evidence exists".
|
|
19
|
+
*
|
|
20
|
+
* The conjunction is unchanged: CODE-10's operator grant AND this evidence. External MCP
|
|
21
|
+
* exposure keeps its own additional gate.
|
|
22
|
+
*/
|
|
23
|
+
import { readFileSync } from 'node:fs';
|
|
24
|
+
/** The environment variable naming the evidence artifact. */
|
|
25
|
+
export const CONFINEMENT_EVIDENCE_ENV = 'DSH_PTC_CONFINEMENT_EVIDENCE';
|
|
26
|
+
/** The artifact's discriminator. */
|
|
27
|
+
export const CONFINEMENT_EVIDENCE_KIND = 'ptc-confinement-evidence';
|
|
28
|
+
/** The artifact's schema version. */
|
|
29
|
+
export const CONFINEMENT_EVIDENCE_VERSION = 1;
|
|
30
|
+
/** One well-formedness question about a parsed value. */
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Read and validate the evidence artifact.
|
|
36
|
+
*
|
|
37
|
+
* The path is the operator's `DSH_PTC_CONFINEMENT_EVIDENCE` when set, otherwise the
|
|
38
|
+
* standard local artifact `~/.dsh/ptc-confinement-evidence.json` that the recorder writes.
|
|
39
|
+
* The default matters because a host started normally never carries that variable, and a
|
|
40
|
+
* gate whose only release path requires a wrapper launcher is still effectively closed.
|
|
41
|
+
* The default is not a bypass: the artifact is validated exactly like an explicit one —
|
|
42
|
+
* kind, schema, pass, package version, platform, timestamp, test list, command and counts.
|
|
43
|
+
*
|
|
44
|
+
* Failures are VALUES with a reason, never exceptions: a gate that throws on a malformed
|
|
45
|
+
* file would crash the host, and one that silently treats a malformed file as evidence
|
|
46
|
+
* would open the gate. Both are refused here with the reason spelled out.
|
|
47
|
+
* @param options - the environment, the expected package version, and the platform.
|
|
48
|
+
* @returns the check outcome.
|
|
49
|
+
*/
|
|
50
|
+
export function checkConfinementEvidence(options) {
|
|
51
|
+
const env = options.env ?? process.env;
|
|
52
|
+
const configured = env[CONFINEMENT_EVIDENCE_ENV];
|
|
53
|
+
const path = configured !== undefined && configured.trim().length > 0 ? configured : options.defaultPath;
|
|
54
|
+
if (path === undefined || path.trim().length === 0) {
|
|
55
|
+
return {
|
|
56
|
+
ok: false,
|
|
57
|
+
present: false,
|
|
58
|
+
reason: `no confinement evidence is configured (set ${CONFINEMENT_EVIDENCE_ENV} to the `
|
|
59
|
+
+ 'artifact written by scripts/record-confinement-evidence.mjs)',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
let text;
|
|
63
|
+
try {
|
|
64
|
+
text = (options.readFile ?? (file => readFileSync(file, 'utf8')))(path);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
present: true,
|
|
70
|
+
path,
|
|
71
|
+
reason: `the confinement evidence at ${path} cannot be read: `
|
|
72
|
+
+ `${error instanceof Error ? error.message : String(error)}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
let parsed;
|
|
76
|
+
try {
|
|
77
|
+
parsed = JSON.parse(text);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return {
|
|
81
|
+
ok: false,
|
|
82
|
+
present: true,
|
|
83
|
+
path,
|
|
84
|
+
reason: `the confinement evidence at ${path} is not JSON: `
|
|
85
|
+
+ `${error instanceof Error ? error.message : String(error)}`,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (!isRecord(parsed)) {
|
|
89
|
+
return { ok: false, present: true, path, reason: `the confinement evidence at ${path} is not an object` };
|
|
90
|
+
}
|
|
91
|
+
if (parsed['kind'] !== CONFINEMENT_EVIDENCE_KIND) {
|
|
92
|
+
return {
|
|
93
|
+
ok: false,
|
|
94
|
+
present: true,
|
|
95
|
+
path,
|
|
96
|
+
reason: `the confinement evidence at ${path} has kind ${JSON.stringify(parsed['kind'])}, `
|
|
97
|
+
+ `expected ${JSON.stringify(CONFINEMENT_EVIDENCE_KIND)}`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (parsed['version'] !== CONFINEMENT_EVIDENCE_VERSION) {
|
|
101
|
+
return {
|
|
102
|
+
ok: false,
|
|
103
|
+
present: true,
|
|
104
|
+
path,
|
|
105
|
+
reason: `the confinement evidence at ${path} is schema version ${String(parsed['version'])}, `
|
|
106
|
+
+ `expected ${String(CONFINEMENT_EVIDENCE_VERSION)}`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (parsed['passed'] !== true) {
|
|
110
|
+
return {
|
|
111
|
+
ok: false,
|
|
112
|
+
present: true,
|
|
113
|
+
path,
|
|
114
|
+
reason: `the confinement evidence at ${path} does not record a passing run`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const expectedVersion = options.expectedVersion;
|
|
118
|
+
if (parsed['packageVersion'] !== expectedVersion) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
present: true,
|
|
122
|
+
path,
|
|
123
|
+
reason: `the confinement evidence at ${path} was recorded for package version `
|
|
124
|
+
+ `${JSON.stringify(parsed['packageVersion'])}, but this host is ${JSON.stringify(expectedVersion)}; `
|
|
125
|
+
+ 're-run scripts/record-confinement-evidence.mjs against this build',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const platform = options.platform ?? process.platform;
|
|
129
|
+
if (parsed['platform'] !== platform) {
|
|
130
|
+
return {
|
|
131
|
+
ok: false,
|
|
132
|
+
present: true,
|
|
133
|
+
path,
|
|
134
|
+
reason: `the confinement evidence at ${path} was recorded on ${JSON.stringify(parsed['platform'])}, `
|
|
135
|
+
+ `not ${JSON.stringify(platform)}`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (typeof parsed['generatedAt'] !== 'string' || Number.isNaN(Date.parse(parsed['generatedAt']))) {
|
|
139
|
+
return {
|
|
140
|
+
ok: false,
|
|
141
|
+
present: true,
|
|
142
|
+
path,
|
|
143
|
+
reason: `the confinement evidence at ${path} has no valid generatedAt timestamp`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (!Array.isArray(parsed['tests']) || parsed['tests'].length === 0
|
|
147
|
+
|| parsed['tests'].some(entry => typeof entry !== 'string' || entry.length === 0)) {
|
|
148
|
+
return {
|
|
149
|
+
ok: false,
|
|
150
|
+
present: true,
|
|
151
|
+
path,
|
|
152
|
+
reason: `the confinement evidence at ${path} names no test file`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* COUNTS are validated, not decorative.
|
|
157
|
+
*
|
|
158
|
+
* "2 pass, 3 skipped" is not evidence that the workspace-write arms are confined — a
|
|
159
|
+
* skip is an arm that never ran. The recorder refuses to write such an artifact, and the
|
|
160
|
+
* runtime refuses one anyway: a hand-edited or older artifact must not open a gate the
|
|
161
|
+
* suite did not earn.
|
|
162
|
+
*/
|
|
163
|
+
const counts = parsed['counts'];
|
|
164
|
+
if (!isRecord(counts)
|
|
165
|
+
|| typeof counts['tests'] !== 'number' || typeof counts['pass'] !== 'number'
|
|
166
|
+
|| typeof counts['fail'] !== 'number' || typeof counts['skipped'] !== 'number') {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
present: true,
|
|
170
|
+
path,
|
|
171
|
+
reason: `the confinement evidence at ${path} carries no test counts`,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const testsCount = counts['tests'];
|
|
175
|
+
const passCount = counts['pass'];
|
|
176
|
+
const failCount = counts['fail'];
|
|
177
|
+
const skippedCount = counts['skipped'];
|
|
178
|
+
if (testsCount <= 0 || passCount !== testsCount || failCount !== 0 || skippedCount !== 0) {
|
|
179
|
+
return {
|
|
180
|
+
ok: false,
|
|
181
|
+
present: true,
|
|
182
|
+
path,
|
|
183
|
+
reason: `the confinement evidence at ${path} records ${String(testsCount)} tests, `
|
|
184
|
+
+ `${String(passCount)} passed, ${String(failCount)} failed, ${String(skippedCount)} skipped; `
|
|
185
|
+
+ 'every confinement arm must pass with none skipped',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (typeof parsed['command'] !== 'string' || parsed['command'].length === 0) {
|
|
189
|
+
return {
|
|
190
|
+
ok: false,
|
|
191
|
+
present: true,
|
|
192
|
+
path,
|
|
193
|
+
reason: `the confinement evidence at ${path} has no command line`,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
ok: true,
|
|
198
|
+
path,
|
|
199
|
+
evidence: {
|
|
200
|
+
kind: CONFINEMENT_EVIDENCE_KIND,
|
|
201
|
+
version: CONFINEMENT_EVIDENCE_VERSION,
|
|
202
|
+
passed: true,
|
|
203
|
+
generatedAt: parsed['generatedAt'],
|
|
204
|
+
packageVersion: expectedVersion,
|
|
205
|
+
platform,
|
|
206
|
+
node: typeof parsed['node'] === 'string' ? parsed['node'] : '',
|
|
207
|
+
tests: parsed['tests'],
|
|
208
|
+
command: parsed['command'],
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=ptc-confinement.js.map
|