deadbyte-mcp 0.8.10 → 0.10.0
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/CONTEXT.md +41 -0
- package/MANIFEST.SHA256 +386 -94
- package/R34-BASELINE.json +9 -0
- package/README.txt +141 -10
- package/bench/fixtures/corpus.json +36 -0
- package/bench/fixtures/r36/case-map.json +8 -0
- package/bin/WORKER-REGISTRY.txt +3 -3
- package/bin/appcontainer-stage.exe +0 -0
- package/bin/appcontainer-stage.obj +0 -0
- package/bin/bootstrap-advapi32.exe +0 -0
- package/bin/bootstrap-advapi32.obj +0 -0
- package/bin/bootstrap-exitcode.exe +0 -0
- package/bin/bootstrap-exitcode.obj +0 -0
- package/bin/bootstrap-kernel32.exe +0 -0
- package/bin/bootstrap-kernel32.obj +0 -0
- package/bin/child-control-probe.exe +0 -0
- package/bin/child-control-probe.obj +0 -0
- package/bin/child-control-stage.exe +0 -0
- package/bin/child-control-stage.obj +0 -0
- package/bin/contained-reverse-worker.exe +0 -0
- package/bin/contained-reverse-worker.obj +0 -0
- package/bin/contained-transform-worker.exe +0 -0
- package/bin/contained-transform-worker.obj +0 -0
- package/bin/containment-probe.exe +0 -0
- package/bin/containment-probe.obj +0 -0
- package/bin/deadbyte-contain.exe +0 -0
- package/bin/deadbyte-contain.obj +0 -0
- package/bin/deadbyte-exec.exe +0 -0
- package/bin/deadbyte-exec.obj +0 -0
- package/bin/deadbyte-process-host.exe +0 -0
- package/bin/deadbyte-process-host.obj +0 -0
- package/bin/deadbyte-tunnel-host.exe +0 -0
- package/bin/deadbyte-tunnel-host.obj +0 -0
- package/controller/README.TXT +12 -4
- package/controller/deadbyte-controller.config.psd1.example +14 -0
- package/controller/deadbyte-controller.ps1 +191 -20
- package/controller/deadbyte-process-policy.json +5 -5
- package/controller/deadbyte-semantic-lsp-config.json +95 -0
- package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
- package/docs/ARCHITECTURE.md +6 -5
- package/docs/R36-CAPABILITY-EVIDENCE.md +43 -0
- package/docs/superpowers/plans/2026-09-16-deadbyte-loop-engine.md +846 -0
- package/docs/superpowers/plans/2026-09-17-r35-production-successor.md +408 -0
- package/docs/superpowers/plans/2026-09-18-r36-zero-loss-autonomy.md +739 -0
- package/docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md +435 -0
- package/docs/superpowers/specs/2026-09-17-r35-production-successor-design.md +220 -0
- package/docs/superpowers/specs/2026-09-18-r36-zero-loss-autonomy-design.md +640 -0
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +50 -0
- package/node_modules/typescript/SECURITY.md +41 -0
- package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/typescript/bin/tsc +2 -0
- package/node_modules/typescript/bin/tsserver +2 -0
- package/node_modules/typescript/lib/_tsc.js +133818 -0
- package/node_modules/typescript/lib/_tsserver.js +659 -0
- package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/lib.d.ts +22 -0
- package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tsc.js +8 -0
- package/node_modules/typescript/lib/tsserver.js +8 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/node_modules/typescript/lib/typesMap.json +497 -0
- package/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/node_modules/typescript/lib/typescript.js +200276 -0
- package/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/node_modules/typescript/lib/watchGuard.js +53 -0
- package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/package.json +120 -0
- package/package.json +5 -3
- package/proof/CONTAINMENT-BUILD.txt +6 -6
- package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +29 -0
- package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +28 -0
- package/scripts/capability-benchmark.mjs +27 -0
- package/scripts/deferred-slot-operation.mjs +56 -16
- package/scripts/final-closure-verify.mjs +88 -39
- package/scripts/final-closure.mjs +63 -56
- package/scripts/gate-windows.ps1 +3 -3
- package/scripts/release-parity-tests.ps1 +9 -0
- package/scripts/release-parity.mjs +149 -139
- package/scripts/semantic-preflight.ps1 +73 -0
- package/scripts/tool-surface-snapshot.mjs +73 -0
- package/scripts/windows-gate-evidence.mjs +5 -5
- package/src/audit-verify.mjs +6 -2
- package/src/autonomous-action-reconcile.mjs +142 -0
- package/src/autonomous-context-engine.mjs +256 -0
- package/src/autonomous-live-state.mjs +17 -0
- package/src/autonomous-local-supervisor.mjs +249 -0
- package/src/autonomous-loop-state.mjs +304 -0
- package/src/autonomous-mcp-tools.mjs +5 -1
- package/src/autonomous-output-contracts.mjs +26 -7
- package/src/autonomous-plan.mjs +181 -0
- package/src/autonomous-planner-contracts.mjs +79 -0
- package/src/autonomous-planner.mjs +113 -6
- package/src/autonomous-policy.mjs +15 -2
- package/src/autonomous-progress.mjs +127 -0
- package/src/autonomous-runtime.mjs +785 -62
- package/src/autonomous-supervisor-host.mjs +70 -0
- package/src/autonomous-supervisor.mjs +31 -8
- package/src/capability-benchmark-runner.mjs +193 -0
- package/src/capability-benchmark.mjs +95 -0
- package/src/capability-ledger.mjs +158 -0
- package/src/coding-mcp-tools.mjs +65 -8
- package/src/coding-output-contracts.mjs +91 -8
- package/src/coding-plane.mjs +45 -9
- package/src/coding-search.mjs +130 -47
- package/src/compact-gateway-mcp-tools.mjs +128 -0
- package/src/compact-gateway-output-contracts.mjs +16 -0
- package/src/context-provenance.mjs +86 -0
- package/src/deadbyte-cli.mjs +145 -30
- package/src/document-adapter.mjs +43 -0
- package/src/lsp-stdio-client.mjs +112 -0
- package/src/machine-fs-smoke-client.mjs +2 -1
- package/src/machine-fs.mjs +51 -8
- package/src/mcp-server.mjs +46 -9
- package/src/native-diff-v2.mjs +337 -0
- package/src/native-diff.mjs +50 -2
- package/src/observation-smoke-client.mjs +3 -2
- package/src/operator-surface.mjs +43 -0
- package/src/process-runtime.mjs +98 -11
- package/src/process-smoke-client.mjs +11 -3
- package/src/provider-circuit.mjs +125 -0
- package/src/r36-compact-disarmed-probe.mjs +50 -0
- package/src/r36-full-surface-probe.mjs +56 -0
- package/src/release-generation.mjs +44 -5
- package/src/remote-live-log.mjs +76 -0
- package/src/remote-mcp-autonomous-smoke-client.mjs +58 -15
- package/src/remote-mcp-coding-smoke-client.mjs +5 -4
- package/src/remote-mcp-r24-disarmed-smoke-client.mjs +4 -2
- package/src/remote-mcp-r34-parity-client.mjs +177 -0
- package/src/remote-mcp-r36-parity-client.mjs +175 -0
- package/src/remote-mcp-smoke-client.mjs +113 -56
- package/src/remote-result-journal.mjs +114 -0
- package/src/runtime-update.mjs +109 -9
- package/src/search-cursor.mjs +45 -0
- package/src/semantic-backend-registry.mjs +39 -0
- package/src/semantic-code.mjs +246 -0
- package/src/semantic-lsp-backend.mjs +219 -0
- package/src/semantic-lsp-config.mjs +112 -0
- package/src/tool-surface-ledger.mjs +92 -0
- package/src/version.mjs +1 -1
- package/test/audit-verify.test.mjs +1 -1
- package/test/autonomous-action-reconcile.test.mjs +106 -0
- package/test/autonomous-adversarial.test.mjs +149 -6
- package/test/autonomous-capability-r36.test.mjs +151 -0
- package/test/autonomous-context-engine.test.mjs +181 -0
- package/test/autonomous-live-state.test.mjs +27 -0
- package/test/autonomous-local-supervisor.test.mjs +403 -0
- package/test/autonomous-loop-state.test.mjs +126 -0
- package/test/autonomous-loop-v2.test.mjs +105 -0
- package/test/autonomous-loop.test.mjs +79 -1
- package/test/autonomous-output-contract.test.mjs +54 -0
- package/test/autonomous-plan.test.mjs +101 -0
- package/test/autonomous-progress.test.mjs +106 -0
- package/test/autonomous-r34-e2e.test.mjs +338 -0
- package/test/autonomous-runtime.test.mjs +3 -3
- package/test/autonomous-supervisor-integration.test.mjs +48 -3
- package/test/capability-benchmark-r36.test.mjs +107 -0
- package/test/capability-benchmark-runner.test.mjs +49 -0
- package/test/capability-benchmark-semantic-r36.test.mjs +52 -0
- package/test/capability-benchmark.test.mjs +47 -0
- package/test/capability-claims-r36.test.mjs +23 -0
- package/test/capability-ledger-r36.test.mjs +102 -0
- package/test/cli-entrypoint.test.mjs +12 -0
- package/test/coding-catalog-consistency.test.mjs +24 -0
- package/test/coding-plane.test.mjs +3 -3
- package/test/coding-runtime.test.mjs +16 -0
- package/test/coding-search-r36.test.mjs +90 -0
- package/test/compact-catalog-r36.test.mjs +37 -0
- package/test/compact-gateway-r36.test.mjs +66 -0
- package/test/contained.test.mjs +1 -1
- package/test/context-provenance.test.mjs +61 -0
- package/test/controller-r27.test.mjs +4 -3
- package/test/controller.test.mjs +52 -0
- package/test/core.test.mjs +1 -1
- package/test/deferred-slot-operation-behavior.test.mjs +5 -1
- package/test/deferred-slot-operation.test.mjs +11 -1
- package/test/document-adapter.test.mjs +23 -0
- package/test/fixtures/lsp-framed-server.mjs +35 -0
- package/test/fixtures/semantic/cpp/compile_commands.json +4 -0
- package/test/fixtures/semantic/cpp/lib.cpp +2 -0
- package/test/fixtures/semantic/cpp/lib.hpp +2 -0
- package/test/fixtures/semantic/cpp/main.cpp +2 -0
- package/test/fixtures/semantic/python/lib.py +2 -0
- package/test/fixtures/semantic/python/main.py +2 -0
- package/test/fixtures/semantic/rust/Cargo.lock +7 -0
- package/test/fixtures/semantic/rust/Cargo.toml +8 -0
- package/test/fixtures/semantic/rust/src/lib.rs +3 -0
- package/test/fixtures/semantic/rust/src/main.rs +5 -0
- package/test/fixtures/semantic/rust/src/math.rs +3 -0
- package/test/fixtures/semantic/rust/target/.rustc_info.json +1 -0
- package/test/fixtures/semantic/rust/target/CACHEDIR.TAG +3 -0
- package/test/fixtures/semantic/rust/target/debug/.cargo-lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/dep-test-lib-semantic_rust +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/dep-test-bin-semantic_rust_bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/dep-lib-semantic_rust +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/dep-bin-semantic_rust_bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-4c168fa33c79d09c.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-6212ccd976aa3808.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-5dcd474439c54a26.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-d741378dccdef61c.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-4c168fa33c79d09c.d +5 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-6212ccd976aa3808.d +5 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-5dcd474439c54a26.d +6 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-d741378dccdef61c.d +6 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/metadata.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt.lock +0 -0
- package/test/fixtures/semantic/rust/target/flycheck0/stderr +1 -0
- package/test/fixtures/semantic/rust/target/flycheck0/stdout +5 -0
- package/test/fixtures/semantic/typescript/lib.ts +3 -0
- package/test/fixtures/semantic/typescript/main.ts +2 -0
- package/test/fixtures/tool-surface-stdio-server.mjs +14 -0
- package/test/helpers/autonomous-r34-fixture.mjs +122 -0
- package/test/lsp-stdio-client.test.mjs +72 -0
- package/test/multi-file-read.test.mjs +44 -0
- package/test/native-diff-topology-r36.test.mjs +105 -0
- package/test/observation-integration.test.mjs +3 -3
- package/test/package-boundary.test.mjs +6 -0
- package/test/process-longrun-r36.test.mjs +82 -0
- package/test/process-release-gate.test.mjs +9 -0
- package/test/production-docs.test.mjs +48 -0
- package/test/prompts-resources.test.mjs +41 -0
- package/test/provider-circuit.test.mjs +93 -0
- package/test/public-autonomous-ingress-budget.test.mjs +28 -0
- package/test/r33-closeout-regression.test.mjs +4 -3
- package/test/r33-finalization.test.mjs +26 -18
- package/test/r36-finalization.test.mjs +104 -0
- package/test/r36-release-identity.test.mjs +52 -0
- package/test/release-generation.test.mjs +23 -2
- package/test/release-version.test.mjs +27 -17
- package/test/remote-live-log-r36.test.mjs +37 -0
- package/test/remote-live-log-recovery-r36.test.mjs +41 -0
- package/test/remote-r24-catalog.test.mjs +18 -4
- package/test/remote-result-journal.test.mjs +58 -0
- package/test/remote-session-cli.test.mjs +135 -30
- package/test/runtime-self-update.test.mjs +121 -1
- package/test/semantic-backend-registry.test.mjs +29 -0
- package/test/semantic-code.test.mjs +66 -0
- package/test/semantic-lsp-backend.test.mjs +108 -0
- package/test/semantic-lsp-config.test.mjs +81 -0
- package/test/semantic-lsp-readiness.test.mjs +34 -0
- package/test/semantic-lsp-transient-empty.test.mjs +32 -0
- package/test/semantic-lsp-transient-null.test.mjs +31 -0
- package/test/semantic-multilang.test.mjs +72 -0
- package/test/semantic-r36-rename.test.mjs +82 -0
- package/test/semantic-runtime-routing.test.mjs +32 -0
- package/test/semantic-server-config-integration.test.mjs +66 -0
- package/test/tool-surface-ledger.test.mjs +59 -0
- package/test/tool-surface-snapshot.test.mjs +17 -0
- package/test/tracer-bullet.test.mjs +77 -0
- package/deadbyte-mcp-0.8.9.tgz +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
export const CAPABILITY_LEDGER_SCHEMA='deadbyte.capability-ledger.v1';
|
|
4
|
+
const AUTHORITIES=new Set(['none','process','coding','autonomous','host']);
|
|
5
|
+
const PROFILE_ENV='DEADBYTE_CAPABILITY_PROFILE';
|
|
6
|
+
const COMPACT_TOOL_LIMIT=42;
|
|
7
|
+
|
|
8
|
+
function sha256(text){return createHash('sha256').update(text,'utf8').digest('hex');}
|
|
9
|
+
function canonicalJson(value){
|
|
10
|
+
if(value===null||typeof value!=='object') return JSON.stringify(value);
|
|
11
|
+
if(Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;
|
|
12
|
+
return `{${Object.keys(value).sort((a,b)=>a.localeCompare(b,'en')).map(key=>`${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(',')}}`;
|
|
13
|
+
}
|
|
14
|
+
function nonEmpty(value,label){if(typeof value!=='string'||value.length<1) throw new Error(`${label} must be non-empty`); return value;}
|
|
15
|
+
function nullableRoute(value,label){if(value===null) return null; return nonEmpty(value,label);}
|
|
16
|
+
function normalizedEntry(raw){
|
|
17
|
+
if(!raw||typeof raw!=='object'||Array.isArray(raw)) throw new Error('capability entry must be an object');
|
|
18
|
+
const authority=nonEmpty(raw.authority,'capability authority');
|
|
19
|
+
if(!AUTHORITIES.has(authority)) throw new Error(`unknown capability authority: ${authority}`);
|
|
20
|
+
const entry={
|
|
21
|
+
id:nonEmpty(raw.id,'capability id'),
|
|
22
|
+
full_tool:nonEmpty(raw.full_tool,'capability full_tool'),
|
|
23
|
+
compact_tool:nullableRoute(raw.compact_tool??null,'capability compact_tool'),
|
|
24
|
+
compact_op:nullableRoute(raw.compact_op??null,'capability compact_op'),
|
|
25
|
+
runtime_flag:raw.runtime_flag===null?null:nonEmpty(raw.runtime_flag,'capability runtime_flag'),
|
|
26
|
+
authority,
|
|
27
|
+
mutating:raw.mutating===true,
|
|
28
|
+
receipt_class:raw.receipt_class===null?null:nonEmpty(raw.receipt_class,'capability receipt_class'),
|
|
29
|
+
production:raw.production===true,
|
|
30
|
+
host_only:raw.host_only===true
|
|
31
|
+
};
|
|
32
|
+
if((entry.compact_tool===null)!==(entry.compact_op===null)) throw new Error(`capability ${entry.id} compact route requires both tool and op`);
|
|
33
|
+
if(entry.host_only&&entry.authority!=='host') throw new Error(`capability ${entry.id} host_only requires host authority`);
|
|
34
|
+
return Object.freeze(entry);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createCapabilityLedger(entries){
|
|
38
|
+
if(!Array.isArray(entries)) throw new Error('capability entries must be an array');
|
|
39
|
+
const seen=new Set();
|
|
40
|
+
const normalized=entries.map(normalizedEntry);
|
|
41
|
+
for(const item of normalized){
|
|
42
|
+
if(seen.has(item.id)) throw new Error(`duplicate capability id: ${item.id}`);
|
|
43
|
+
seen.add(item.id);
|
|
44
|
+
}
|
|
45
|
+
normalized.sort((a,b)=>a.id.localeCompare(b.id,'en'));
|
|
46
|
+
const frozenEntries=Object.freeze(normalized.slice());
|
|
47
|
+
const body={schema:CAPABILITY_LEDGER_SCHEMA,entries:frozenEntries};
|
|
48
|
+
return Object.freeze({...body,ledger_sha256:sha256(canonicalJson(body))});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function capabilityProfileFromEnv(env=process.env){
|
|
52
|
+
const value=env?.[PROFILE_ENV]??'full';
|
|
53
|
+
if(value!=='full'&&value!=='compact') throw new Error(`${PROFILE_ENV} must be full or compact`);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function toolNames(snapshot,label){
|
|
58
|
+
if(!snapshot||typeof snapshot!=='object'||!Array.isArray(snapshot.tools)) throw new Error(`${label} tool surface snapshot invalid`);
|
|
59
|
+
const names=snapshot.tools.map(tool=>tool?.name);
|
|
60
|
+
if(names.some(name=>typeof name!=='string'||name.length<1)) throw new Error(`${label} tool surface contains invalid name`);
|
|
61
|
+
return new Set(names);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function assertCapabilityClosure({ledger,fullToolSnapshot,compactToolSnapshot}){
|
|
65
|
+
if(!ledger||ledger.schema!==CAPABILITY_LEDGER_SCHEMA||!Array.isArray(ledger.entries)) throw new Error('capability ledger invalid');
|
|
66
|
+
const full=toolNames(fullToolSnapshot,'full');
|
|
67
|
+
const compact=toolNames(compactToolSnapshot,'compact');
|
|
68
|
+
if(compact.size>COMPACT_TOOL_LIMIT) throw new Error(`compact surface exceeds ${COMPACT_TOOL_LIMIT}-tool limit: ${compact.size}`);
|
|
69
|
+
for(const capability of ledger.entries){
|
|
70
|
+
if(!full.has(capability.full_tool)) throw new Error(`capability ${capability.id} full tool missing: ${capability.full_tool}`);
|
|
71
|
+
if(capability.production&&!capability.host_only){
|
|
72
|
+
if(!capability.compact_tool||!capability.compact_op) throw new Error(`capability ${capability.id} compact route missing`);
|
|
73
|
+
if(!compact.has(capability.compact_tool)) throw new Error(`capability ${capability.id} compact tool missing: ${capability.compact_tool}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const direct=(id,tool,runtime_flag,authority,{mutating=false,receipt_class='direct',production=true,host_only=false}={})=>({id,full_tool:tool,compact_tool:tool,compact_op:'direct',runtime_flag,authority,mutating,receipt_class,production,host_only});
|
|
80
|
+
const gateway=(id,full_tool,compact_tool,compact_op,runtime_flag,authority,{mutating=false,receipt_class='direct',production=true}={})=>({id,full_tool,compact_tool,compact_op,runtime_flag,authority,mutating,receipt_class,production,host_only:false});
|
|
81
|
+
|
|
82
|
+
export const R36_CAPABILITY_ENTRIES=Object.freeze([
|
|
83
|
+
direct('evidence.verify','evidence_verify',null,'none',{receipt_class:'verification'}),
|
|
84
|
+
gateway('machine.list','machine_list','machine_observe','machine_list','DEADBYTE_MACHINE_RUNTIME','none',{receipt_class:'machine'}),
|
|
85
|
+
gateway('machine.status','machine_status','machine_observe','machine_status','DEADBYTE_MACHINE_RUNTIME','none',{receipt_class:'machine'}),
|
|
86
|
+
gateway('machine.ping','machine_ping','machine_observe','machine_ping','DEADBYTE_MACHINE_RUNTIME','none',{receipt_class:'machine'}),
|
|
87
|
+
direct('machine.revoke','machine_revoke','DEADBYTE_MACHINE_RUNTIME','host',{mutating:true,receipt_class:'machine',production:false,host_only:true}),
|
|
88
|
+
|
|
89
|
+
gateway('process.start','process_session_start','process_session','start','DEADBYTE_PROCESS_RUNTIME','process',{mutating:true,receipt_class:'process'}),
|
|
90
|
+
gateway('process.read','process_session_read','process_session','read','DEADBYTE_PROCESS_RUNTIME','process',{receipt_class:'process'}),
|
|
91
|
+
gateway('process.status','process_session_status','process_session','status','DEADBYTE_PROCESS_RUNTIME','process',{receipt_class:'process'}),
|
|
92
|
+
gateway('process.list','process_session_list','process_session','list','DEADBYTE_PROCESS_RUNTIME','process',{receipt_class:'process'}),
|
|
93
|
+
gateway('process.action','process_session_action','process_session','action','DEADBYTE_PROCESS_RUNTIME','process',{mutating:true,receipt_class:'process'}),
|
|
94
|
+
gateway('process.terminate','process_session_terminate','process_session','terminate','DEADBYTE_PROCESS_RUNTIME','process',{mutating:true,receipt_class:'process'}),
|
|
95
|
+
|
|
96
|
+
direct('coding.session_status','coding_session_status','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
97
|
+
direct('coding.tree','coding_tree','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
98
|
+
gateway('coding.stat','coding_stat','coding_inspect','stat','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
99
|
+
gateway('coding.search','coding_search','coding_inspect','search','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
100
|
+
gateway('coding.files_read','coding_files_read','coding_inspect','files_read','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
101
|
+
gateway('semantic.outline','coding_symbol_outline','coding_inspect','symbol_outline','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'semantic'}),
|
|
102
|
+
gateway('semantic.definition','coding_symbol_definition','coding_inspect','symbol_definition','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'semantic'}),
|
|
103
|
+
gateway('semantic.references','coding_symbol_references','coding_inspect','symbol_references','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'semantic'}),
|
|
104
|
+
gateway('semantic.diagnostics','coding_symbol_diagnostics','coding_inspect','symbol_diagnostics','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'semantic'}),
|
|
105
|
+
gateway('semantic.implementations','coding_symbol_implementations','coding_inspect','symbol_implementations','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'semantic'}),
|
|
106
|
+
gateway('semantic.rename_preview','coding_symbol_rename_preview','coding_inspect','symbol_rename_preview','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'native_diff'}),
|
|
107
|
+
direct('semantic.replace','coding_symbol_replace','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'coding'}),
|
|
108
|
+
direct('coding.file_read','coding_file_read','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'coding'}),
|
|
109
|
+
direct('coding.file_write','coding_file_write','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'coding'}),
|
|
110
|
+
direct('coding.text_replace','coding_text_replace','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'coding'}),
|
|
111
|
+
direct('coding.command_run','coding_command_run','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'coding'}),
|
|
112
|
+
direct('coding.benchmark_run','coding_benchmark_run','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'coding'}),
|
|
113
|
+
direct('coding.receipt_verify','coding_receipt_verify','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'verification'}),
|
|
114
|
+
direct('coding.task_submit','coding_task_submit','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'task'}),
|
|
115
|
+
direct('coding.task_run','coding_task_run','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'task'}),
|
|
116
|
+
direct('coding.task_status','coding_task_status','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'task'}),
|
|
117
|
+
direct('coding.task_events','coding_task_events','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'task'}),
|
|
118
|
+
direct('coding.task_cancel','coding_task_cancel','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'task'}),
|
|
119
|
+
direct('coding.task_approve','coding_task_approve','DEADBYTE_CODING_RUNTIME','coding',{mutating:true,receipt_class:'task'}),
|
|
120
|
+
direct('coding.task_verify','coding_task_verify','DEADBYTE_CODING_RUNTIME','coding',{receipt_class:'verification'}),
|
|
121
|
+
|
|
122
|
+
gateway('machine_fs.stat','machine_fs_stat','machine_fs','stat','DEADBYTE_MACHINE_FS_RUNTIME','coding',{receipt_class:'machine_fs'}),
|
|
123
|
+
gateway('machine_fs.list','machine_fs_list','machine_fs','list','DEADBYTE_MACHINE_FS_RUNTIME','coding',{receipt_class:'machine_fs'}),
|
|
124
|
+
gateway('machine_fs.read','machine_fs_read','machine_fs','read','DEADBYTE_MACHINE_FS_RUNTIME','coding',{receipt_class:'machine_fs'}),
|
|
125
|
+
gateway('machine_fs.write','machine_fs_write','machine_fs','write','DEADBYTE_MACHINE_FS_RUNTIME','coding',{mutating:true,receipt_class:'machine_fs'}),
|
|
126
|
+
gateway('machine_fs.edit_exact','machine_fs_edit_exact','machine_fs','edit_exact','DEADBYTE_MACHINE_FS_RUNTIME','coding',{mutating:true,receipt_class:'machine_fs'}),
|
|
127
|
+
gateway('machine_fs.mkdir','machine_fs_mkdir','machine_fs','mkdir','DEADBYTE_MACHINE_FS_RUNTIME','coding',{mutating:true,receipt_class:'machine_fs'}),
|
|
128
|
+
gateway('machine_fs.move','machine_fs_move','machine_fs','move','DEADBYTE_MACHINE_FS_RUNTIME','coding',{mutating:true,receipt_class:'machine_fs'}),
|
|
129
|
+
gateway('machine_fs.delete','machine_fs_delete','machine_fs','delete','DEADBYTE_MACHINE_FS_RUNTIME','coding',{mutating:true,receipt_class:'machine_fs'}),
|
|
130
|
+
|
|
131
|
+
gateway('observation.search_start','machine_search_start','machine_observe','search_start','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
132
|
+
gateway('observation.search_page','machine_search_page','machine_observe','search_page','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
133
|
+
gateway('observation.search_status','machine_search_status','machine_observe','search_status','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
134
|
+
gateway('observation.search_cancel','machine_search_cancel','machine_observe','search_cancel','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
135
|
+
gateway('observation.process_list','machine_process_list','machine_observe','process_list','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
136
|
+
gateway('observation.system_status','machine_system_status','machine_observe','system_status','DEADBYTE_OBSERVATION_RUNTIME','none',{receipt_class:'observation'}),
|
|
137
|
+
|
|
138
|
+
direct('autonomous.session_status','autonomous_session_status','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'autonomous'}),
|
|
139
|
+
direct('native_diff.preview','native_diff_preview','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'native_diff'}),
|
|
140
|
+
direct('native_diff.apply','native_diff_apply','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'native_diff'}),
|
|
141
|
+
direct('native_diff.verify','native_diff_verify','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'verification'}),
|
|
142
|
+
direct('autonomous.goal_submit','autonomous_goal_submit','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'autonomous'}),
|
|
143
|
+
direct('autonomous.goal_run','autonomous_goal_run','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'autonomous'}),
|
|
144
|
+
direct('autonomous.goal_status','autonomous_goal_status','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'autonomous'}),
|
|
145
|
+
direct('autonomous.goal_events','autonomous_goal_events','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'autonomous'}),
|
|
146
|
+
direct('autonomous.goal_cancel','autonomous_goal_cancel','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'autonomous'}),
|
|
147
|
+
direct('autonomous.goal_approve','autonomous_goal_approve','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'autonomous'}),
|
|
148
|
+
direct('autonomous.goal_verify','autonomous_goal_verify','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{receipt_class:'verification'}),
|
|
149
|
+
direct('autonomous.release_gate','autonomous_release_gate','DEADBYTE_AUTONOMOUS_RUNTIME','autonomous',{mutating:true,receipt_class:'release'}),
|
|
150
|
+
|
|
151
|
+
direct('host.file_read','host_file_read','DEADBYTE_PRIVILEGED_POLICY','host',{receipt_class:'host',production:false,host_only:true}),
|
|
152
|
+
direct('host.file_write','host_file_write','DEADBYTE_PRIVILEGED_POLICY','host',{mutating:true,receipt_class:'host',production:false,host_only:true}),
|
|
153
|
+
direct('host.exec','host_exec','DEADBYTE_PRIVILEGED_POLICY','host',{mutating:true,receipt_class:'host',production:false,host_only:true})
|
|
154
|
+
]);
|
|
155
|
+
export const R36_CAPABILITY_LEDGER=createCapabilityLedger(R36_CAPABILITY_ENTRIES);
|
|
156
|
+
|
|
157
|
+
export const CAPABILITY_PROFILE_ENV=PROFILE_ENV;
|
|
158
|
+
export const COMPACT_SURFACE_TOOL_LIMIT=COMPACT_TOOL_LIMIT;
|
package/src/coding-mcp-tools.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import * as z from 'zod/v4';
|
|
|
2
2
|
import { CODING_TASK_ID_RE, CODING_STEP_ID_RE } from './coding-task-runtime.mjs';
|
|
3
3
|
import {
|
|
4
4
|
codingBenchmarkRunOutputSchema, codingCommandRunOutputSchema,
|
|
5
|
-
codingFileReadOutputSchema, codingFileWriteOutputSchema,
|
|
5
|
+
codingFileReadOutputSchema, codingFilesReadOutputSchema, codingFileWriteOutputSchema,
|
|
6
6
|
codingReceiptVerifyOutputSchema, codingSearchOutputSchema, codingSessionStatusOutputSchema, codingStatOutputSchema,
|
|
7
|
+
codingSymbolOutlineOutputSchema, codingSymbolDefinitionOutputSchema, codingSymbolReferencesOutputSchema,
|
|
8
|
+
codingSymbolDiagnosticsOutputSchema, codingSymbolImplementationsOutputSchema, codingSymbolRenamePreviewOutputSchema, codingSymbolReplaceOutputSchema,
|
|
7
9
|
codingTaskApproveOutputSchema, codingTaskCancelOutputSchema,
|
|
8
10
|
codingTaskEventsOutputSchema, codingTaskRunOutputSchema,
|
|
9
11
|
codingTaskStatusOutputSchema, codingTaskSubmitOutputSchema,
|
|
@@ -45,8 +47,8 @@ const taskStep = z.union([
|
|
|
45
47
|
|
|
46
48
|
function result(schema, value, isError = false) { return codingStructuredResult(schema, value, isError); }
|
|
47
49
|
function fail(schema, error) { return result(schema, { status: 'failed', error: String(error) }, true); }
|
|
48
|
-
export function registerCodingTools(server, { codingRuntime, taskRuntime }) {
|
|
49
|
-
if (!codingRuntime || !taskRuntime) throw new Error('coding tool registration requires runtimes');
|
|
50
|
+
export function registerCodingTools(server, { codingRuntime, taskRuntime, semanticRuntime }) {
|
|
51
|
+
if (!codingRuntime || !taskRuntime || !semanticRuntime) throw new Error('coding tool registration requires runtimes');
|
|
50
52
|
|
|
51
53
|
server.registerTool('coding_session_status', {
|
|
52
54
|
description: 'Read coding-plane policy/lease status. This never arms or renews authority.',
|
|
@@ -66,16 +68,71 @@ export function registerCodingTools(server, { codingRuntime, taskRuntime }) {
|
|
|
66
68
|
}, async ({ root_id, path, hash }) => { try { return result(codingStatOutputSchema, await codingRuntime.stat({ rootId: root_id, relativePath: path, hash })); } catch (error) { return fail(codingStatOutputSchema, error); } });
|
|
67
69
|
|
|
68
70
|
server.registerTool('coding_search', {
|
|
69
|
-
description: 'Deterministic
|
|
71
|
+
description: 'Deterministic bounded content/path search with literal or regex mode, signed cursor paging, and observed file identities.',
|
|
70
72
|
inputSchema: z.strictObject({ root_id: rootId, path: relPath.default('.'), pattern: z.string().min(1).max(256),
|
|
71
|
-
mode: z.
|
|
72
|
-
max_results: z.number().int().min(1).max(1000).default(200), max_file_bytes: z.number().int().min(1).max(4194304).default(262144)
|
|
73
|
+
target: z.enum(['content','path']).default('content'), mode: z.enum(['literal','regex']).default('literal'), case_sensitive: z.boolean().default(false),
|
|
74
|
+
max_results: z.number().int().min(1).max(1000).default(200), max_file_bytes: z.number().int().min(1).max(4194304).default(262144),
|
|
75
|
+
max_scan_bytes: z.number().int().min(1).max(67108864).default(4194304), page_size: z.number().int().min(1).max(500).default(100),
|
|
76
|
+
cursor: z.string().max(8192).nullable().default(null) }),
|
|
73
77
|
outputSchema: codingSearchOutputSchema
|
|
74
|
-
}, async ({ root_id, path, pattern, mode, case_sensitive, max_results, max_file_bytes }) => {
|
|
75
|
-
try { return result(codingSearchOutputSchema, await codingRuntime.search({ rootId: root_id, path, pattern, mode, caseSensitive: case_sensitive,
|
|
78
|
+
}, async ({ root_id, path, pattern, target, mode, case_sensitive, max_results, max_file_bytes, max_scan_bytes, page_size, cursor }) => {
|
|
79
|
+
try { return result(codingSearchOutputSchema, await codingRuntime.search({ rootId: root_id, path, pattern, target, mode, caseSensitive: case_sensitive,
|
|
80
|
+
maxResults: max_results, maxFileBytes: max_file_bytes, maxScanBytes: max_scan_bytes, pageSize: page_size, cursor })); }
|
|
76
81
|
catch (error) { return fail(codingSearchOutputSchema, error); }
|
|
77
82
|
});
|
|
78
83
|
|
|
84
|
+
server.registerTool('coding_symbol_outline', {
|
|
85
|
+
description: 'Return a bounded JS/TS symbol outline using the bundled TypeScript language service. Results are rooted in the active coding-policy source tree.',
|
|
86
|
+
inputSchema: z.strictObject({ root_id: rootId, path: relPath, max_symbols: z.number().int().min(1).max(500).default(200) }),
|
|
87
|
+
outputSchema: codingSymbolOutlineOutputSchema
|
|
88
|
+
}, async ({ root_id, path, max_symbols }) => { try { return result(codingSymbolOutlineOutputSchema, await semanticRuntime.outline({ rootId: root_id, relativePath: path, maxSymbols: max_symbols })); } catch (error) { return fail(codingSymbolOutlineOutputSchema, error); } });
|
|
89
|
+
|
|
90
|
+
server.registerTool('coding_symbol_definition', {
|
|
91
|
+
description: 'Resolve JS/TS definitions at a zero-based line/column using the bundled TypeScript language service.',
|
|
92
|
+
inputSchema: z.strictObject({ root_id: rootId, path: relPath, line: z.number().int().min(0), column: z.number().int().min(0), max_results: z.number().int().min(1).max(200).default(50) }),
|
|
93
|
+
outputSchema: codingSymbolDefinitionOutputSchema
|
|
94
|
+
}, async ({ root_id, path, line, column, max_results }) => { try { return result(codingSymbolDefinitionOutputSchema, await semanticRuntime.definition({ rootId: root_id, relativePath: path, line, column, maxResults: max_results })); } catch (error) { return fail(codingSymbolDefinitionOutputSchema, error); } });
|
|
95
|
+
|
|
96
|
+
server.registerTool('coding_symbol_references', {
|
|
97
|
+
description: 'Find bounded JS/TS references at a zero-based line/column using the bundled TypeScript language service.',
|
|
98
|
+
inputSchema: z.strictObject({ root_id: rootId, path: relPath, line: z.number().int().min(0), column: z.number().int().min(0), max_results: z.number().int().min(1).max(500).default(200) }),
|
|
99
|
+
outputSchema: codingSymbolReferencesOutputSchema
|
|
100
|
+
}, async ({ root_id, path, line, column, max_results }) => { try { return result(codingSymbolReferencesOutputSchema, await semanticRuntime.references({ rootId: root_id, relativePath: path, line, column, maxResults: max_results })); } catch (error) { return fail(codingSymbolReferencesOutputSchema, error); } });
|
|
101
|
+
|
|
102
|
+
server.registerTool('coding_symbol_diagnostics', {
|
|
103
|
+
description: 'Return bounded normalized semantic diagnostics with target and result identities.',
|
|
104
|
+
inputSchema: z.strictObject({ root_id: rootId, path: relPath, max_results: z.number().int().min(1).max(500).default(200) }),
|
|
105
|
+
outputSchema: codingSymbolDiagnosticsOutputSchema
|
|
106
|
+
}, async ({ root_id, path, max_results }) => { try { const value=await semanticRuntime.diagnostics({ rootId:root_id, relativePath:path, maxResults:max_results }); return result(codingSymbolDiagnosticsOutputSchema,value,value.status==='failed'); } catch(error){ return fail(codingSymbolDiagnosticsOutputSchema,error); } });
|
|
107
|
+
|
|
108
|
+
server.registerTool('coding_symbol_implementations', {
|
|
109
|
+
description: 'Resolve bounded semantic implementations at a zero-based line/column. Unsupported backends report an explicit typed status.',
|
|
110
|
+
inputSchema: z.strictObject({ root_id:rootId, path:relPath, line:z.number().int().min(0), column:z.number().int().min(0), max_results:z.number().int().min(1).max(500).default(200) }),
|
|
111
|
+
outputSchema: codingSymbolImplementationsOutputSchema
|
|
112
|
+
}, async ({ root_id, path, line, column, max_results }) => { try { const value=await semanticRuntime.implementations({rootId:root_id,relativePath:path,line,column,maxResults:max_results}); return result(codingSymbolImplementationsOutputSchema,value,false); } catch(error){ return fail(codingSymbolImplementationsOutputSchema,error); } });
|
|
113
|
+
|
|
114
|
+
server.registerTool('coding_symbol_rename_preview', {
|
|
115
|
+
description: 'Preview one semantic rename as a content-addressed Native Diff. This tool never mutates source bytes.',
|
|
116
|
+
inputSchema: z.strictObject({ root_id:rootId, path:relPath, line:z.number().int().min(0), column:z.number().int().min(0), new_name:z.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/) }),
|
|
117
|
+
outputSchema: codingSymbolRenamePreviewOutputSchema
|
|
118
|
+
}, async ({ root_id, path, line, column, new_name }) => { try { const value=await semanticRuntime.renamePreview({rootId:root_id,relativePath:path,line,column,newName:new_name}); return result(codingSymbolRenamePreviewOutputSchema,value,false); } catch(error){ return fail(codingSymbolRenamePreviewOutputSchema,error); } });
|
|
119
|
+
|
|
120
|
+
server.registerTool('coding_symbol_replace', {
|
|
121
|
+
description: 'Replace one current JS/TS symbol body by symbol_id under exact file SHA-256 precondition. The commit reuses the coding plane signed surgical-edit receipt path.',
|
|
122
|
+
inputSchema: z.strictObject({ root_id: rootId, path: relPath, symbol_id: hex64, new_body: z.string().max(524288), expected_sha256: hex64 }),
|
|
123
|
+
outputSchema: codingSymbolReplaceOutputSchema
|
|
124
|
+
}, async ({ root_id, path, symbol_id, new_body, expected_sha256 }) => { try { return result(codingSymbolReplaceOutputSchema, await semanticRuntime.replaceSymbol({ rootId: root_id, relativePath: path, symbolId: symbol_id, newBody: new_body, expectedSha256: expected_sha256 })); } catch (error) { return fail(codingSymbolReplaceOutputSchema, error); } });
|
|
125
|
+
|
|
126
|
+
server.registerTool('coding_files_read', {
|
|
127
|
+
description: 'Read up to 32 bounded files under one coding lease and return an aggregate observation identity over ordered file metadata.',
|
|
128
|
+
inputSchema: z.strictObject({ root_id: rootId, files: z.array(z.strictObject({ path: relPath, encoding: z.enum(['utf8','base64']).default('utf8') })).min(1).max(32),
|
|
129
|
+
max_total_bytes: z.number().int().min(1).max(2097152).default(1048576) }),
|
|
130
|
+
outputSchema: codingFilesReadOutputSchema
|
|
131
|
+
}, async ({ root_id, files, max_total_bytes }) => {
|
|
132
|
+
try { return result(codingFilesReadOutputSchema,await codingRuntime.filesRead({rootId:root_id,files,maxTotalBytes:max_total_bytes})); }
|
|
133
|
+
catch(error){ return fail(codingFilesReadOutputSchema,error); }
|
|
134
|
+
});
|
|
135
|
+
|
|
79
136
|
server.registerTool('coding_file_read', {
|
|
80
137
|
description: 'Read one bounded file inside an active coding lease.',
|
|
81
138
|
inputSchema: z.strictObject({ root_id: rootId, path: relPath, encoding: z.enum(['utf8','base64']).default('utf8') }), outputSchema: codingFileReadOutputSchema
|
|
@@ -70,18 +70,101 @@ export const codingTreeOutputSchema = statusContract({
|
|
|
70
70
|
export const codingStatOutputSchema = statusContract({
|
|
71
71
|
statuses: ['ok', 'failed'],
|
|
72
72
|
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(),
|
|
73
|
-
type: z.enum(['file','directory','symlink','other']).optional(),
|
|
74
|
-
mtime_utc: z.string().min(1).optional(), sha256: hex64.nullable().optional()
|
|
75
|
-
|
|
73
|
+
normalized_path: z.string().min(1).max(512).optional(), type: z.enum(['file','directory','symlink','other']).optional(),
|
|
74
|
+
bytes: z.number().int().min(0).optional(), mtime_utc: z.string().min(1).optional(), sha256: hex64.nullable().optional(),
|
|
75
|
+
reparse_state: z.enum(['none','symlink']).optional(), object_identity_sha256: hex64.optional(),
|
|
76
|
+
policy_root_id: z.string().min(1).max(64).optional(), observation_sha256: hex64.optional() },
|
|
77
|
+
successStatuses: ['ok'], successRequired: ['root_id','path','normalized_path','type','bytes','mtime_utc','sha256','reparse_state','object_identity_sha256','policy_root_id','observation_sha256']
|
|
76
78
|
});
|
|
77
79
|
export const codingSearchOutputSchema = statusContract({
|
|
78
80
|
statuses: ['ok', 'failed'],
|
|
79
81
|
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(),
|
|
80
|
-
pattern: z.string().min(1).max(256).optional(),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
pattern: z.string().min(1).max(256).optional(), target: z.enum(['content','path']).optional(),
|
|
83
|
+
mode: z.enum(['literal','regex']).optional(), case_sensitive: z.boolean().optional(),
|
|
84
|
+
matches: z.array(z.strictObject({ path: z.string().min(1).max(512), line: z.number().int().min(1).nullable(),
|
|
85
|
+
column: z.number().int().min(1).nullable(), preview: z.string().max(512), file_sha256: hex64.nullable() })).max(500).optional(),
|
|
86
|
+
files_scanned: z.number().int().min(0).optional(), bytes_scanned: z.number().int().min(0).optional(),
|
|
87
|
+
binary_files_skipped: z.number().int().min(0).optional(), truncated: z.boolean().optional(),
|
|
88
|
+
truncation_reason: z.enum(['tree_limit','scan_byte_limit','max_results']).nullable().optional(),
|
|
89
|
+
query_sha256: hex64.optional(), snapshot_sha256: hex64.optional(), page_sha256: hex64.optional(),
|
|
90
|
+
next_cursor: z.string().max(8192).nullable().optional() },
|
|
91
|
+
successStatuses: ['ok'], successRequired: ['root_id','path','pattern','target','mode','case_sensitive','matches','files_scanned','bytes_scanned','binary_files_skipped','truncated','truncation_reason','query_sha256','snapshot_sha256','page_sha256','next_cursor']
|
|
92
|
+
});
|
|
93
|
+
const semanticLocationSchema = z.strictObject({
|
|
94
|
+
path: z.string().min(1).max(512), name: z.string().max(256), kind: z.string().min(1).max(64),
|
|
95
|
+
start_line: z.number().int().min(0), start_column: z.number().int().min(0),
|
|
96
|
+
end_line: z.number().int().min(0), end_column: z.number().int().min(0)
|
|
97
|
+
});
|
|
98
|
+
const semanticSymbolSchema = semanticLocationSchema.extend({
|
|
99
|
+
symbol_id: hex64, container_name: z.string().max(256),
|
|
100
|
+
name_start_line: z.number().int().min(0), name_start_column: z.number().int().min(0)
|
|
101
|
+
});
|
|
102
|
+
export const codingSymbolOutlineOutputSchema = statusContract({
|
|
103
|
+
statuses: ['ok','failed'],
|
|
104
|
+
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(),
|
|
105
|
+
file_sha256: hex64.optional(), engine: z.string().min(1).max(64).optional(),
|
|
106
|
+
symbols: z.array(semanticSymbolSchema).max(500).optional(), truncated: z.boolean().optional() },
|
|
107
|
+
successStatuses: ['ok'], successRequired: ['root_id','path','file_sha256','engine','symbols','truncated']
|
|
108
|
+
});
|
|
109
|
+
export const codingSymbolDefinitionOutputSchema = statusContract({
|
|
110
|
+
statuses: ['ok','failed'],
|
|
111
|
+
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(),
|
|
112
|
+
line: z.number().int().min(0).optional(), column: z.number().int().min(0).optional(), engine: z.string().min(1).max(64).optional(),
|
|
113
|
+
locations: z.array(semanticLocationSchema).max(200).optional(), truncated: z.boolean().optional() },
|
|
114
|
+
successStatuses: ['ok'], successRequired: ['root_id','path','line','column','engine','locations','truncated']
|
|
115
|
+
});
|
|
116
|
+
export const codingSymbolReferencesOutputSchema = statusContract({
|
|
117
|
+
statuses: ['ok','failed'],
|
|
118
|
+
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(),
|
|
119
|
+
line: z.number().int().min(0).optional(), column: z.number().int().min(0).optional(), engine: z.string().min(1).max(64).optional(),
|
|
120
|
+
locations: z.array(semanticLocationSchema).max(500).optional(), truncated: z.boolean().optional() },
|
|
121
|
+
successStatuses: ['ok'], successRequired: ['root_id','path','line','column','engine','locations','truncated']
|
|
122
|
+
});
|
|
123
|
+
export const codingSymbolDiagnosticsOutputSchema = z.strictObject({
|
|
124
|
+
status:z.enum(['ok','unsupported','failed']), error:z.string().optional(), capability:z.string().max(64).optional(),
|
|
125
|
+
root_id:z.string().min(1).max(64).optional(), path:z.string().min(1).max(512).optional(), file_sha256:hex64.optional(),
|
|
126
|
+
engine:z.string().min(1).max(128).optional(), diagnostics:z.array(z.strictObject({message:z.string().max(4096),code:z.string().max(256),severity:z.string().min(1).max(64),location:semanticLocationSchema.optional()})).max(500).optional(),
|
|
127
|
+
truncated:z.boolean().optional(), result_sha256:hex64.optional()
|
|
128
|
+
}).superRefine((value,ctx)=>{
|
|
129
|
+
if(value.status==='failed'){requireFields(value,ctx,['error']);return;}
|
|
130
|
+
if(value.status==='unsupported'){requireFields(value,ctx,['capability','engine']);return;}
|
|
131
|
+
requireFields(value,ctx,['root_id','path','file_sha256','engine','diagnostics','truncated','result_sha256']);
|
|
132
|
+
});
|
|
133
|
+
export const codingSymbolImplementationsOutputSchema = z.strictObject({
|
|
134
|
+
status:z.enum(['ok','unsupported','failed']), error:z.string().optional(), capability:z.string().max(64).optional(),
|
|
135
|
+
root_id:z.string().min(1).max(64).optional(), path:z.string().min(1).max(512).optional(), line:z.number().int().min(0).optional(), column:z.number().int().min(0).optional(),
|
|
136
|
+
file_sha256:hex64.optional(), engine:z.string().min(1).max(128).optional(), locations:z.array(semanticLocationSchema).max(500).optional(),
|
|
137
|
+
truncated:z.boolean().optional(), result_sha256:hex64.optional()
|
|
138
|
+
}).superRefine((value,ctx)=>{
|
|
139
|
+
if(value.status==='failed'){requireFields(value,ctx,['error']);return;}
|
|
140
|
+
if(value.status==='unsupported'){requireFields(value,ctx,['capability','engine']);return;}
|
|
141
|
+
requireFields(value,ctx,['root_id','path','line','column','file_sha256','engine','locations','truncated','result_sha256']);
|
|
142
|
+
});
|
|
143
|
+
export const codingSymbolRenamePreviewOutputSchema = z.strictObject({
|
|
144
|
+
status:z.enum(['ready','unsupported','failed']), error:z.string().optional(), capability:z.string().max(64).optional(), engine:z.string().min(1).max(128).optional(),
|
|
145
|
+
diff_id:hex64.optional(), affected_files:z.number().int().min(1).max(32).optional(), edit_count:z.number().int().min(1).optional(), backend:z.string().min(1).max(128).optional(),
|
|
146
|
+
preimages:z.array(z.strictObject({path:z.string().min(1).max(512),sha256:hex64})).max(32).optional()
|
|
147
|
+
}).superRefine((value,ctx)=>{
|
|
148
|
+
if(value.status==='failed'){requireFields(value,ctx,['error']);return;}
|
|
149
|
+
if(value.status==='unsupported'){requireFields(value,ctx,['capability','engine']);return;}
|
|
150
|
+
requireFields(value,ctx,['diff_id','affected_files','edit_count','backend','preimages']);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export const codingSymbolReplaceOutputSchema = statusContract({
|
|
154
|
+
statuses: ['committed','failed'],
|
|
155
|
+
shape: { root_id: z.string().min(1).max(64).optional(), path: z.string().min(1).max(512).optional(), previous_sha256: hex64.optional(),
|
|
156
|
+
sha256: hex64.optional(), bytes: z.number().int().min(0).optional(), replacements: z.literal(1).optional(),
|
|
157
|
+
receipt_id: receiptId.optional(), receipt_sha256: hex64.optional(), request_sha256: hex64.optional(),
|
|
158
|
+
symbol_id: hex64.optional(), symbol_name: z.string().min(1).max(256).optional(), engine: z.string().min(1).max(64).optional() },
|
|
159
|
+
successStatuses: ['committed'], successRequired: ['root_id','path','previous_sha256','sha256','bytes','replacements','receipt_id','receipt_sha256','request_sha256','symbol_id','symbol_name','engine']
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export const codingFilesReadOutputSchema = statusContract({
|
|
163
|
+
statuses: ['ok','failed'],
|
|
164
|
+
shape: { root_id: z.string().min(1).max(64).optional(), total_bytes: z.number().int().min(0).optional(),
|
|
165
|
+
files: z.array(z.strictObject({ path: z.string().min(1).max(512), encoding: z.enum(['utf8','base64']), bytes: z.number().int().min(0), sha256: hex64, content: z.string() })).max(32).optional(),
|
|
166
|
+
observation_sha256: hex64.optional() },
|
|
167
|
+
successStatuses: ['ok'], successRequired: ['root_id','total_bytes','files','observation_sha256']
|
|
85
168
|
});
|
|
86
169
|
export const codingFileReadOutputSchema = statusContract({
|
|
87
170
|
statuses: ['ok', 'failed'],
|
package/src/coding-plane.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { decodeUtf8Strict } from './text-policy.mjs';
|
|
|
9
9
|
import { isInside, validatePortableRelativePath } from './path-policy.mjs';
|
|
10
10
|
import { loadPrivateSigningKey, loadPublicVerifyKey } from './trust.mjs';
|
|
11
11
|
import { createCodingSearch } from './coding-search.mjs';
|
|
12
|
+
import { createSearchCursorCodec } from './search-cursor.mjs';
|
|
12
13
|
|
|
13
14
|
export const CODING_POLICY_SCHEMA = 'deadbyte.coding-policy.v1';
|
|
14
15
|
export const CODING_LEASE_SCHEMA = 'deadbyte.coding-lease.v1';
|
|
@@ -613,18 +614,52 @@ export function createCodingRuntime({ policy, signingKeyPath, verifyKeyPath }) {
|
|
|
613
614
|
async function statPath({ rootId, relativePath = '.', hash = false }) {
|
|
614
615
|
const lease = await assertCodingArmed(policy, rootId);
|
|
615
616
|
const root = getRoot(policy, rootId, 'read');
|
|
616
|
-
let
|
|
617
|
+
let lexical = root.real_path;
|
|
617
618
|
let reported = '.';
|
|
618
619
|
if (relativePath !== '.') {
|
|
619
|
-
|
|
620
|
-
|
|
620
|
+
validatePortableRelativePath(relativePath);
|
|
621
|
+
if (!lease.root_ids.includes(rootId)) throw new Error(`coding root '${rootId}' is outside active lease`);
|
|
622
|
+
assertNotDenied(root, relativePath);
|
|
623
|
+
lexical = path.resolve(root.real_path, relativePath);
|
|
624
|
+
if (!isInside(root.real_path, lexical)) throw new Error('coding stat path escapes allowed root');
|
|
621
625
|
reported = relativePath.replaceAll('\\', '/');
|
|
622
626
|
}
|
|
623
|
-
const info = await lstat(
|
|
627
|
+
const info = await lstat(lexical);
|
|
624
628
|
const type = info.isFile() ? 'file' : info.isDirectory() ? 'directory' : info.isSymbolicLink() ? 'symlink' : 'other';
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
|
|
629
|
+
const reparseState = info.isSymbolicLink() ? 'symlink' : 'none';
|
|
630
|
+
if (type !== 'symlink') {
|
|
631
|
+
const resolved = await realpath(lexical);
|
|
632
|
+
if (!isInside(root.real_path, resolved) && resolved !== root.real_path) throw new Error('coding stat path resolves outside allowed root');
|
|
633
|
+
}
|
|
634
|
+
const contentSha = type === 'file' ? await sha256File(lexical) : null;
|
|
635
|
+
const objectIdentitySha = sha256Object({
|
|
636
|
+
schema:'deadbyte.coding-object-identity.v1',type,bytes:type==='file'?info.size:0,
|
|
637
|
+
content_sha256:contentSha,device:Number(info.dev),inode:Number(info.ino),reparse_state:reparseState
|
|
638
|
+
});
|
|
639
|
+
const result = {
|
|
640
|
+
status:'ok',root_id:rootId,path:reported,normalized_path:reported,type,
|
|
641
|
+
bytes:type==='file'?info.size:0,mtime_utc:info.mtime.toISOString(),
|
|
642
|
+
sha256:hash&&type==='file'?contentSha:null,reparse_state:reparseState,
|
|
643
|
+
object_identity_sha256:objectIdentitySha,policy_root_id:rootId
|
|
644
|
+
};
|
|
645
|
+
return {...result,observation_sha256:sha256Object({schema:'deadbyte.coding-stat-observation.v1',...result})};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
async function filesRead({ rootId, files, maxTotalBytes = 1048576 }) {
|
|
649
|
+
if (!Array.isArray(files) || files.length < 1 || files.length > 32) throw new Error('coding multi-read requires 1-32 files');
|
|
650
|
+
if (!Number.isInteger(maxTotalBytes) || maxTotalBytes < 1 || maxTotalBytes > 2097152) throw new Error('coding multi-read max_total_bytes must be in [1, 2097152]');
|
|
651
|
+
const values=[]; let total=0;
|
|
652
|
+
for(const item of files){
|
|
653
|
+
if(!item||typeof item.path!=='string'||!['utf8','base64'].includes(item.encoding??'utf8')) throw new Error('coding multi-read file entry invalid');
|
|
654
|
+
const encoding=item.encoding??'utf8';
|
|
655
|
+
const read=await fileRead({rootId,relativePath:item.path,encoding});
|
|
656
|
+
total+=read.bytes;
|
|
657
|
+
if(total>maxTotalBytes) throw new Error(`coding multi-read exceeds ${maxTotalBytes} byte total limit`);
|
|
658
|
+
values.push({path:item.path,encoding,bytes:read.bytes,sha256:read.sha256,content:read.content});
|
|
659
|
+
}
|
|
660
|
+
const identity=values.map(item=>({path:item.path,encoding:item.encoding,bytes:item.bytes,sha256:item.sha256}));
|
|
661
|
+
return {status:'ok',root_id:rootId,total_bytes:total,files:values,
|
|
662
|
+
observation_sha256:sha256Object({schema:'deadbyte.coding-files-read-observation.v1',root_id:rootId,files:identity})};
|
|
628
663
|
}
|
|
629
664
|
|
|
630
665
|
async function fileState({ rootId, relativePath }) {
|
|
@@ -651,7 +686,8 @@ export function createCodingRuntime({ policy, signingKeyPath, verifyKeyPath }) {
|
|
|
651
686
|
return verifyCodingReceiptFile(policy, verifyKeyPath, receiptId);
|
|
652
687
|
}
|
|
653
688
|
|
|
654
|
-
const
|
|
655
|
-
|
|
689
|
+
const cursorCodec = createSearchCursorCodec({ signingKeyPath, verifyKeyPath });
|
|
690
|
+
const search = createCodingSearch({ tree, fileRead, cursorCodec });
|
|
691
|
+
return Object.freeze({ policy, sessionStatus, tree, stat: statPath, search, filesRead, fileRead, fileWrite, fileDelete, textReplace, commandRun, benchmarkRun, receiptVerify,
|
|
656
692
|
fileState, verifyReceiptById: receiptVerify, verifyReceiptDetailed, requestSha });
|
|
657
693
|
}
|