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
|
@@ -28,8 +28,9 @@ const agentTools = [
|
|
|
28
28
|
'agent_task_status', 'agent_task_submit', 'agent_task_verify'
|
|
29
29
|
];
|
|
30
30
|
const codingTools = [
|
|
31
|
-
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write',
|
|
31
|
+
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write', 'coding_files_read',
|
|
32
32
|
'coding_receipt_verify', 'coding_search', 'coding_session_status', 'coding_stat',
|
|
33
|
+
'coding_symbol_definition', 'coding_symbol_diagnostics', 'coding_symbol_implementations', 'coding_symbol_outline', 'coding_symbol_references', 'coding_symbol_rename_preview', 'coding_symbol_replace',
|
|
33
34
|
'coding_task_approve', 'coding_task_cancel', 'coding_task_events', 'coding_task_run',
|
|
34
35
|
'coding_task_status', 'coding_task_submit', 'coding_task_verify', 'coding_text_replace', 'coding_tree'
|
|
35
36
|
];
|
|
@@ -38,6 +39,18 @@ const autonomousTools = [
|
|
|
38
39
|
'autonomous_goal_status', 'autonomous_goal_submit', 'autonomous_goal_verify', 'autonomous_release_gate',
|
|
39
40
|
'autonomous_session_status', 'native_diff_apply', 'native_diff_preview', 'native_diff_verify'
|
|
40
41
|
];
|
|
42
|
+
const r36CompactTools = [
|
|
43
|
+
'autonomous_goal_approve','autonomous_goal_cancel','autonomous_goal_events','autonomous_goal_run','autonomous_goal_status','autonomous_goal_submit','autonomous_goal_verify','autonomous_release_gate','autonomous_session_status',
|
|
44
|
+
'capability_manifest',
|
|
45
|
+
'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_inspect','coding_receipt_verify','coding_session_status','coding_symbol_replace',
|
|
46
|
+
'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run','coding_task_status','coding_task_submit','coding_task_verify','coding_text_replace','coding_tree',
|
|
47
|
+
'evidence_verify',
|
|
48
|
+
'host_exec','host_file_read','host_file_write',
|
|
49
|
+
'machine_fs','machine_list','machine_observe','machine_ping','machine_revoke','machine_status',
|
|
50
|
+
'native_diff_apply','native_diff_preview','native_diff_verify',
|
|
51
|
+
'process_session'
|
|
52
|
+
].sort();
|
|
53
|
+
if (r36CompactTools.length !== 41) throw new Error(`R36 compact catalog constant drift: ${r36CompactTools.length}`);
|
|
41
54
|
const allowedCatalogs = [];
|
|
42
55
|
for (const machine of [false, true]) for (const host of [false, true]) for (const agent of [false, true]) {
|
|
43
56
|
for (const processPlane of [false, true]) for (const machineFs of [false, true]) for (const observation of [false, true]) for (const codingMode of ['none', 'coding', 'autonomous']) {
|
|
@@ -67,13 +80,21 @@ function structured(result, label) {
|
|
|
67
80
|
if (!result.structuredContent || typeof result.structuredContent !== 'object') throw new Error(`${label} returned no structured object`);
|
|
68
81
|
return result.structuredContent;
|
|
69
82
|
}
|
|
83
|
+
function gateway(result, label) {
|
|
84
|
+
const value = structured(result, label);
|
|
85
|
+
if (value.status !== 'ok' || !value.result || typeof value.result !== 'object') {
|
|
86
|
+
throw new Error(`${label} gateway status=${String(value.status)} error=${String(value.error ?? '')}`);
|
|
87
|
+
}
|
|
88
|
+
return value.result;
|
|
89
|
+
}
|
|
70
90
|
|
|
71
91
|
try {
|
|
72
92
|
await client.connect(transport);
|
|
73
93
|
if (client.getProtocolEra() !== 'modern') throw new Error(`expected modern MCP era, got ${String(client.getProtocolEra())}`);
|
|
74
94
|
const listed = await client.listTools();
|
|
75
95
|
const names = listed.tools.map(t => t.name).sort();
|
|
76
|
-
const
|
|
96
|
+
const compactProfile = JSON.stringify(names) === JSON.stringify(r36CompactTools);
|
|
97
|
+
const catalogOk = compactProfile || allowedCatalogs.some(expected => JSON.stringify(names) === JSON.stringify(expected));
|
|
77
98
|
if (!catalogOk) throw new Error(`tool catalog mismatch: ${JSON.stringify(names)}`);
|
|
78
99
|
for (const tool of listed.tools) {
|
|
79
100
|
if (tool.outputSchema?.type !== 'object' || tool.outputSchema?.additionalProperties !== false || !tool.outputSchema?.properties) {
|
|
@@ -89,72 +110,108 @@ try {
|
|
|
89
110
|
const codingRuntime = codingTools.every(name => names.includes(name));
|
|
90
111
|
const autonomousRuntime = autonomousTools.every(name => names.includes(name));
|
|
91
112
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const proofOutput = `remote-proof.${randomBytes(8).toString('hex')}.txt`;
|
|
96
|
-
const proof = structured(await client.callTool({
|
|
97
|
-
name: 'proof_execute', arguments: { workspace_id: 'demo', input: 'input.txt', output: proofOutput }
|
|
98
|
-
}), 'proof_execute');
|
|
99
|
-
if (proof.status !== 'passed' || !/^[0-9a-f]{64}$/.test(proof.request_sha256)) throw new Error('remote proof request identity missing');
|
|
100
|
-
const proofVerify = structured(await client.callTool({
|
|
101
|
-
name: 'evidence_verify', arguments: { workspace_id: 'demo', receipt_path: proof.receipt_path }
|
|
102
|
-
}), 'evidence_verify proof');
|
|
103
|
-
if (proofVerify.ok !== true || proofVerify.signature_valid !== true || proofVerify.receipt_schema !== 'deadbyte.receipt.v2' ||
|
|
104
|
-
proofVerify.request_sha256 !== proof.request_sha256) throw new Error(`remote proof verify failed: ${JSON.stringify(proofVerify)}`);
|
|
105
|
-
|
|
113
|
+
let compact = null;
|
|
114
|
+
let proofOutput = null;
|
|
115
|
+
let proof = null;
|
|
106
116
|
let contained = null;
|
|
107
|
-
if (mode === 'full') {
|
|
108
|
-
const output = `remote-contained.${randomBytes(8).toString('hex')}.txt`;
|
|
109
|
-
const exec = structured(await client.callTool({
|
|
110
|
-
name: 'contained_transform',
|
|
111
|
-
arguments: { workspace_id: 'demo', input: 'input.txt', output, operation: 'uppercase_ascii' }
|
|
112
|
-
}), 'contained_transform');
|
|
113
|
-
if (exec.status !== 'passed' || exec.output_sha256 !== '3e740f6fcf2c6659bc5f99e0706b09f3c127407bbabe74d05285d2e3276946c2' ||
|
|
114
|
-
!/^[0-9a-f]{64}$/.test(exec.request_sha256)) throw new Error(`remote contained result mismatch: ${JSON.stringify(exec)}`);
|
|
115
|
-
const verify = structured(await client.callTool({
|
|
116
|
-
name: 'evidence_verify', arguments: { workspace_id: 'demo', receipt_path: exec.receipt_path }
|
|
117
|
-
}), 'evidence_verify contained');
|
|
118
|
-
if (verify.ok !== true || verify.signature_valid !== true || verify.containment_verified !== true ||
|
|
119
|
-
verify.active_network_denial_verified !== true || verify.receipt_schema !== 'deadbyte.receipt.v2' ||
|
|
120
|
-
verify.request_sha256 !== exec.request_sha256) throw new Error(`remote contained verification failed: ${JSON.stringify(verify)}`);
|
|
121
|
-
contained = { output, receipt_sha256: exec.receipt_sha256, request_sha256: exec.request_sha256, output_sha256: exec.output_sha256 };
|
|
122
|
-
}
|
|
123
117
|
let agent = null;
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
if (compactProfile) {
|
|
119
|
+
const manifest = gateway(await client.callTool({ name: 'capability_manifest', arguments: {} }), 'capability_manifest');
|
|
120
|
+
if (manifest.schema !== 'deadbyte.capability-manifest.v1' || manifest.profile !== 'compact' ||
|
|
121
|
+
!Array.isArray(manifest.capabilities) || !/^[0-9a-f]{64}$/.test(String(manifest.ledger_sha256 ?? ''))) {
|
|
122
|
+
throw new Error('R36 compact capability manifest malformed');
|
|
123
|
+
}
|
|
124
|
+
const required = manifest.capabilities.filter(item => item?.production === true && item?.host_only !== true);
|
|
125
|
+
for (const item of required) {
|
|
126
|
+
if (typeof item.compact_tool !== 'string' || !names.includes(item.compact_tool)) {
|
|
127
|
+
throw new Error(`R36 compact capability route missing: ${String(item.id)}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const machine = gateway(await client.callTool({ name: 'machine_observe', arguments: { op: 'machine_status' } }), 'machine_status');
|
|
131
|
+
const nonce = `remote-smoke-${randomBytes(16).toString('hex')}`;
|
|
132
|
+
const ping = gateway(await client.callTool({ name: 'machine_observe', arguments: { op: 'machine_ping', nonce } }), 'machine_ping');
|
|
133
|
+
if (ping.nonce !== nonce || ping.machine_id !== machine.machine_id ||
|
|
134
|
+
ping.release_id !== machine.release_id || ping.release_manifest_sha256 !== machine.release_manifest_sha256) {
|
|
135
|
+
throw new Error('R36 compact machine ping binding mismatch');
|
|
136
|
+
}
|
|
137
|
+
compact = {
|
|
138
|
+
profile: 'compact',
|
|
139
|
+
ledger_sha256: manifest.ledger_sha256,
|
|
140
|
+
capability_count: manifest.capabilities.length,
|
|
141
|
+
production_non_host_capabilities: required.length,
|
|
142
|
+
capability_closure: true,
|
|
143
|
+
machine_id: machine.machine_id,
|
|
144
|
+
release_id: machine.release_id,
|
|
145
|
+
release_manifest_sha256: machine.release_manifest_sha256,
|
|
146
|
+
ping_signature_valid: ping.signature_valid === true
|
|
147
|
+
};
|
|
148
|
+
} else {
|
|
149
|
+
const opened = structured(await client.callTool({ name: 'workspace_open', arguments: { workspace_id: 'demo' } }), 'workspace_open');
|
|
150
|
+
if (opened.status !== 'ok') throw new Error(`workspace_open status=${String(opened.status)}`);
|
|
151
|
+
|
|
152
|
+
proofOutput = `remote-proof.${randomBytes(8).toString('hex')}.txt`;
|
|
153
|
+
proof = structured(await client.callTool({
|
|
154
|
+
name: 'proof_execute', arguments: { workspace_id: 'demo', input: 'input.txt', output: proofOutput }
|
|
155
|
+
}), 'proof_execute');
|
|
156
|
+
if (proof.status !== 'passed' || !/^[0-9a-f]{64}$/.test(proof.request_sha256)) throw new Error('remote proof request identity missing');
|
|
157
|
+
const proofVerify = structured(await client.callTool({
|
|
158
|
+
name: 'evidence_verify', arguments: { workspace_id: 'demo', receipt_path: proof.receipt_path }
|
|
159
|
+
}), 'evidence_verify proof');
|
|
160
|
+
if (proofVerify.ok !== true || proofVerify.signature_valid !== true || proofVerify.receipt_schema !== 'deadbyte.receipt.v2' ||
|
|
161
|
+
proofVerify.request_sha256 !== proof.request_sha256) throw new Error(`remote proof verify failed: ${JSON.stringify(proofVerify)}`);
|
|
162
|
+
|
|
163
|
+
if (mode === 'full') {
|
|
164
|
+
const output = `remote-contained.${randomBytes(8).toString('hex')}.txt`;
|
|
165
|
+
const exec = structured(await client.callTool({
|
|
166
|
+
name: 'contained_transform',
|
|
167
|
+
arguments: { workspace_id: 'demo', input: 'input.txt', output, operation: 'uppercase_ascii' }
|
|
168
|
+
}), 'contained_transform');
|
|
169
|
+
if (exec.status !== 'passed' || exec.output_sha256 !== '3e740f6fcf2c6659bc5f99e0706b09f3c127407bbabe74d05285d2e3276946c2' ||
|
|
170
|
+
!/^[0-9a-f]{64}$/.test(exec.request_sha256)) throw new Error(`remote contained result mismatch: ${JSON.stringify(exec)}`);
|
|
171
|
+
const verify = structured(await client.callTool({
|
|
172
|
+
name: 'evidence_verify', arguments: { workspace_id: 'demo', receipt_path: exec.receipt_path }
|
|
173
|
+
}), 'evidence_verify contained');
|
|
174
|
+
if (verify.ok !== true || verify.signature_valid !== true || verify.containment_verified !== true ||
|
|
175
|
+
verify.active_network_denial_verified !== true || verify.receipt_schema !== 'deadbyte.receipt.v2' ||
|
|
176
|
+
verify.request_sha256 !== exec.request_sha256) throw new Error(`remote contained verification failed: ${JSON.stringify(verify)}`);
|
|
177
|
+
contained = { output, receipt_sha256: exec.receipt_sha256, request_sha256: exec.request_sha256, output_sha256: exec.output_sha256 };
|
|
178
|
+
}
|
|
179
|
+
if (mode === 'full' && agentRuntime) {
|
|
180
|
+
const submissionId = `remote-gate-${randomBytes(8).toString('hex')}`;
|
|
181
|
+
const submitted = structured(await client.callTool({
|
|
182
|
+
name: 'agent_task_submit', arguments: {
|
|
183
|
+
workspace_id: 'demo', submission_id: submissionId, title: 'remote R22 gate',
|
|
184
|
+
steps: [
|
|
185
|
+
{ step_id: 'proof', kind: 'proof_execute', input: { kind: 'workspace', path: 'input.txt' }, retry_limit: 0 },
|
|
186
|
+
{ step_id: 'contained', kind: 'contained_transform', operation: 'uppercase_ascii', input: { kind: 'step_output', step_id: 'proof' }, retry_limit: 0 }
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}), 'agent_task_submit');
|
|
190
|
+
const run = structured(await client.callTool({
|
|
191
|
+
name: 'agent_task_run', arguments: { workspace_id: 'demo', task_id: submitted.task_id, max_steps: 8 }
|
|
192
|
+
}), 'agent_task_run');
|
|
193
|
+
if (run.state !== 'succeeded' || run.completed_steps !== 2) throw new Error(`agent task run failed: ${JSON.stringify(run)}`);
|
|
194
|
+
const verified = structured(await client.callTool({
|
|
195
|
+
name: 'agent_task_verify', arguments: { workspace_id: 'demo', task_id: submitted.task_id }
|
|
196
|
+
}), 'agent_task_verify');
|
|
197
|
+
if (verified.ok !== true || verified.signature_valid !== true || verified.step_receipts_verified !== 2) {
|
|
198
|
+
throw new Error(`agent task verify failed: ${JSON.stringify(verified)}`);
|
|
133
199
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
name: 'agent_task_run', arguments: { workspace_id: 'demo', task_id: submitted.task_id, max_steps: 8 }
|
|
137
|
-
}), 'agent_task_run');
|
|
138
|
-
if (run.state !== 'succeeded' || run.completed_steps !== 2) throw new Error(`agent task run failed: ${JSON.stringify(run)}`);
|
|
139
|
-
const verified = structured(await client.callTool({
|
|
140
|
-
name: 'agent_task_verify', arguments: { workspace_id: 'demo', task_id: submitted.task_id }
|
|
141
|
-
}), 'agent_task_verify');
|
|
142
|
-
if (verified.ok !== true || verified.signature_valid !== true || verified.step_receipts_verified !== 2) {
|
|
143
|
-
throw new Error(`agent task verify failed: ${JSON.stringify(verified)}`);
|
|
200
|
+
agent = { task_id: submitted.task_id, plan_sha256: submitted.plan_sha256,
|
|
201
|
+
task_receipt_sha256: verified.task_receipt_sha256, step_receipts_verified: verified.step_receipts_verified };
|
|
144
202
|
}
|
|
145
|
-
agent = { task_id: submitted.task_id, plan_sha256: submitted.plan_sha256,
|
|
146
|
-
task_receipt_sha256: verified.task_receipt_sha256, step_receipts_verified: verified.step_receipts_verified };
|
|
147
203
|
}
|
|
148
204
|
console.log(JSON.stringify({
|
|
149
|
-
status: 'passed', mode,
|
|
205
|
+
status: 'passed', mode, profile: compactProfile ? 'compact' : 'legacy-full',
|
|
150
206
|
protocol_revision: '2026-07-28', protocol_era: 'modern', tools: names,
|
|
151
207
|
output_schemas_strict: true,
|
|
152
208
|
machine_runtime: machineRuntime, privileged_host_plane: privilegedHostPlane,
|
|
153
209
|
agent_runtime: agentRuntime, process_runtime: processRuntime,
|
|
154
210
|
machine_fs_runtime: machineFsRuntime, observation_runtime: observationRuntime,
|
|
155
211
|
coding_runtime: codingRuntime, autonomous_runtime: autonomousRuntime,
|
|
156
|
-
|
|
157
|
-
|
|
212
|
+
compact,
|
|
213
|
+
proof: proof ? { output: proofOutput, receipt_sha256: proof.receipt_sha256,
|
|
214
|
+
request_sha256: proof.request_sha256, signature_valid: true } : null,
|
|
158
215
|
contained, agent
|
|
159
216
|
}, null, 2));
|
|
160
217
|
} finally {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
export const REMOTE_RESULT_JOURNAL_SCHEMA='deadbyte.remote-result-journal.v1';
|
|
5
|
+
const SESSION=/^[0-9a-f]{24}$/;
|
|
6
|
+
const HASH=/^[0-9a-f]{64}$/;
|
|
7
|
+
const STATUS=new Set(['ok','error']);
|
|
8
|
+
|
|
9
|
+
function text(value,label,max){
|
|
10
|
+
if(typeof value!=='string'||value.length<1||value.length>max||value.includes('\0')) throw new Error(`${label} invalid`);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function iso(value,label){
|
|
14
|
+
const parsed=Date.parse(value);
|
|
15
|
+
if(typeof value!=='string'||!Number.isFinite(parsed)) throw new Error(`${label} invalid`);
|
|
16
|
+
return new Date(parsed).toISOString();
|
|
17
|
+
}
|
|
18
|
+
function validateSession(value){
|
|
19
|
+
if(typeof value!=='string'||!SESSION.test(value)) throw new Error('remote result session_id invalid');
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function validateEvent(raw,index=null){
|
|
23
|
+
if(!raw||typeof raw!=='object'||Array.isArray(raw)) throw new Error('remote result event invalid');
|
|
24
|
+
const seq=raw.seq;
|
|
25
|
+
if(!Number.isSafeInteger(seq)||seq<1) throw new Error('remote result seq invalid');
|
|
26
|
+
const sessionId=validateSession(raw.session_id);
|
|
27
|
+
const requestId=text(raw.request_id,'remote result request_id',256);
|
|
28
|
+
const tool=text(raw.tool,'remote result tool',128);
|
|
29
|
+
if(!STATUS.has(raw.status)) throw new Error('remote result status invalid');
|
|
30
|
+
const observed=iso(raw.observed_at_utc,'remote result observed_at_utc');
|
|
31
|
+
if(typeof raw.payload_sha256!=='string'||!HASH.test(raw.payload_sha256)) throw new Error('remote result payload_sha256 invalid');
|
|
32
|
+
if(index!==null&&seq!==index) throw new Error('remote result sequence mismatch');
|
|
33
|
+
return Object.freeze({session_id:sessionId,seq,request_id:requestId,tool,status:raw.status,
|
|
34
|
+
observed_at_utc:observed,payload_sha256:raw.payload_sha256});
|
|
35
|
+
}
|
|
36
|
+
function identity(item){return `${item.request_id}\0${item.status}\0${item.payload_sha256}`;}
|
|
37
|
+
export function parseRemoteResultCursor(cursor){
|
|
38
|
+
if(typeof cursor!=='string') throw new Error('remote result cursor invalid');
|
|
39
|
+
const match=/^r1:([0-9a-f]{24}):(0|[1-9][0-9]{0,15})$/.exec(cursor);
|
|
40
|
+
if(!match) throw new Error('remote result cursor invalid');
|
|
41
|
+
const seq=Number(match[2]);
|
|
42
|
+
if(!Number.isSafeInteger(seq)||seq<0) throw new Error('remote result cursor invalid');
|
|
43
|
+
return {session_id:match[1],seq};
|
|
44
|
+
}
|
|
45
|
+
function cursorFor(sessionId,seq){return `r1:${sessionId}:${seq}`;}
|
|
46
|
+
async function requireRegularIfExists(file){
|
|
47
|
+
try{
|
|
48
|
+
const info=await lstat(file);
|
|
49
|
+
if(!info.isFile()||info.isSymbolicLink()) throw new Error('remote result journal must be regular non-symlink file');
|
|
50
|
+
return true;
|
|
51
|
+
}catch(error){if(error?.code==='ENOENT') return false;throw error;}
|
|
52
|
+
}
|
|
53
|
+
function validateStored(value,sessionId){
|
|
54
|
+
if(!value||typeof value!=='object'||Array.isArray(value)||value.schema!==REMOTE_RESULT_JOURNAL_SCHEMA) throw new Error('remote result journal schema invalid');
|
|
55
|
+
if(value.session_id!==sessionId) throw new Error('remote result journal session mismatch');
|
|
56
|
+
if(!Array.isArray(value.events)) throw new Error('remote result journal events invalid');
|
|
57
|
+
let prior=0;
|
|
58
|
+
const events=value.events.map(raw=>{
|
|
59
|
+
const event=validateEvent(raw);
|
|
60
|
+
if(event.session_id!==sessionId||event.seq<=prior) throw new Error('remote result journal sequence invalid');
|
|
61
|
+
prior=event.seq;return event;
|
|
62
|
+
});
|
|
63
|
+
if(!Number.isSafeInteger(value.next_seq)||value.next_seq<1||value.next_seq!==(events.at(-1)?.seq??0)+1) throw new Error('remote result journal next_seq invalid');
|
|
64
|
+
return {schema:REMOTE_RESULT_JOURNAL_SCHEMA,session_id:sessionId,next_seq:value.next_seq,events};
|
|
65
|
+
}
|
|
66
|
+
async function atomicWrite(file,value){
|
|
67
|
+
await mkdir(path.dirname(file),{recursive:true});
|
|
68
|
+
const temp=`${file}.tmp-${process.pid}-${Math.random().toString(16).slice(2)}`;
|
|
69
|
+
await writeFile(temp,`${JSON.stringify(value)}\n`,{encoding:'utf8',flag:'wx'});
|
|
70
|
+
await rename(temp,file);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function openRemoteResultJournal({filePath,sessionId,maxEntries=2048}={}){
|
|
74
|
+
const file=path.resolve(text(filePath,'remote result journal path',1024));
|
|
75
|
+
const sid=validateSession(sessionId);
|
|
76
|
+
if(!Number.isInteger(maxEntries)||maxEntries<1||maxEntries>100000) throw new Error('remote result maxEntries invalid');
|
|
77
|
+
let state;
|
|
78
|
+
if(await requireRegularIfExists(file)){
|
|
79
|
+
let raw;try{raw=JSON.parse(await readFile(file,'utf8'));}catch{throw new Error('remote result journal JSON invalid');}
|
|
80
|
+
state=validateStored(raw,sid);
|
|
81
|
+
}else{
|
|
82
|
+
state={schema:REMOTE_RESULT_JOURNAL_SCHEMA,session_id:sid,next_seq:1,events:[]};
|
|
83
|
+
await atomicWrite(file,state);
|
|
84
|
+
}
|
|
85
|
+
async function persist(){
|
|
86
|
+
state.events=state.events.slice(-maxEntries);
|
|
87
|
+
await atomicWrite(file,state);
|
|
88
|
+
}
|
|
89
|
+
return Object.freeze({
|
|
90
|
+
file_path:file,session_id:sid,
|
|
91
|
+
cursor(){return cursorFor(sid,state.next_seq-1);},
|
|
92
|
+
async recordTerminal(input){
|
|
93
|
+
const candidate=validateEvent({session_id:sid,seq:state.next_seq,...input});
|
|
94
|
+
const key=identity(candidate);
|
|
95
|
+
const existing=state.events.find(event=>identity(event)===key);
|
|
96
|
+
if(existing) return {duplicate:true,event:existing,cursor:cursorFor(sid,state.next_seq-1)};
|
|
97
|
+
const event=candidate;
|
|
98
|
+
state.events.push(event);state.next_seq+=1;await persist();
|
|
99
|
+
return {duplicate:false,event,cursor:cursorFor(sid,event.seq)};
|
|
100
|
+
},
|
|
101
|
+
async replayAfter(cursor,{limit=100}={}){
|
|
102
|
+
if(!Number.isInteger(limit)||limit<1||limit>500) throw new Error('remote result replay limit invalid');
|
|
103
|
+
const parsed=parseRemoteResultCursor(cursor);
|
|
104
|
+
if(parsed.session_id!==sid) throw new Error('remote result cursor session mismatch');
|
|
105
|
+
const first=state.events[0]?.seq??state.next_seq;
|
|
106
|
+
const last=state.next_seq-1;
|
|
107
|
+
if(parsed.seq<first-1) throw new Error('cursor_outside_retention');
|
|
108
|
+
if(parsed.seq>last) throw new Error('remote result cursor ahead of journal');
|
|
109
|
+
const events=state.events.filter(event=>event.seq>parsed.seq).slice(0,limit);
|
|
110
|
+
const nextSeq=events.at(-1)?.seq??parsed.seq;
|
|
111
|
+
return {events:events.map(event=>({...event})),next_cursor:cursorFor(sid,nextSeq),has_more:state.events.some(event=>event.seq>nextSeq)};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
package/src/runtime-update.mjs
CHANGED
|
@@ -45,29 +45,33 @@ function normalizePersistentPublicOrigin(value){
|
|
|
45
45
|
return publicOrigin.origin;
|
|
46
46
|
}
|
|
47
47
|
export function parseUpdateArgs(argv){
|
|
48
|
-
const out={stage:null,developmentRoot:null,expectedVersion:null,expectedManifest:null,sourceRoot:null,restoreStandingGrants:false,recoverOfflinePredecessor:false,enableMachineFs:false,enableObservation:false,cloudTransport:null,bridgeBootstrap:null,processPolicyBootstrap:null,hostCommandPins:[]};
|
|
49
|
-
const cloud={},bridge={},processPolicy={},seen=new Set(),hostPinIds=new Set();
|
|
48
|
+
const out={stage:null,developmentRoot:null,expectedVersion:null,expectedManifest:null,sourceRoot:null,restoreStandingGrants:false,recoverOfflinePredecessor:false,enableMachineFs:false,enableObservation:false,enableAutonomousSupervisor:false,cloudTransport:null,bridgeBootstrap:null,processPolicyBootstrap:null,semanticLspBootstrap:null,hostCommandPins:[]};
|
|
49
|
+
const cloud={},bridge={},processPolicy={},semanticLsp={},seen=new Set(),hostPinIds=new Set();
|
|
50
50
|
const bridgeFlags=new Map([
|
|
51
51
|
['--bridge-root','root'],['--bridge-script-sha256','scriptSha256']
|
|
52
52
|
]);
|
|
53
53
|
const processPolicyFlags=new Map([
|
|
54
54
|
['--process-policy','path'],['--process-policy-sha256','sha256']
|
|
55
55
|
]);
|
|
56
|
+
const semanticLspFlags=new Map([
|
|
57
|
+
['--semantic-lsp-config','path'],['--semantic-lsp-config-sha256','sha256']
|
|
58
|
+
]);
|
|
56
59
|
const cloudFlags=new Map([
|
|
57
60
|
['--cloud-cloudflared','cloudflaredPath'],['--cloud-cloudflared-sha256','cloudflaredSha256'],
|
|
58
61
|
['--cloud-token-file','tokenFilePath'],['--cloud-token-sha256','tokenFileSha256'],
|
|
59
62
|
['--cloud-child-working-directory','childWorkingDirectory'],['--cloud-public-origin','publicOrigin']
|
|
60
63
|
]);
|
|
61
|
-
const valued=new Set(['--stage','--development-root','--expected-version','--expected-manifest','--source-root','--host-command-pin',...bridgeFlags.keys(),...processPolicyFlags.keys(),...cloudFlags.keys()]);
|
|
64
|
+
const valued=new Set(['--stage','--development-root','--expected-version','--expected-manifest','--source-root','--host-command-pin',...bridgeFlags.keys(),...processPolicyFlags.keys(),...semanticLspFlags.keys(),...cloudFlags.keys()]);
|
|
62
65
|
for(let index=0;index<argv.length;index++){
|
|
63
66
|
const arg=argv[index];
|
|
64
|
-
if(arg==='--restore-standing-grants'||arg==='--recover-offline-predecessor'||arg==='--enable-machine-fs'||arg==='--enable-observation'){
|
|
67
|
+
if(arg==='--restore-standing-grants'||arg==='--recover-offline-predecessor'||arg==='--enable-machine-fs'||arg==='--enable-observation'||arg==='--enable-autonomous-supervisor'){
|
|
65
68
|
if(seen.has(arg)) throw new Error(`duplicate self-update argument '${arg}'`);
|
|
66
69
|
seen.add(arg);
|
|
67
70
|
if(arg==='--restore-standing-grants') out.restoreStandingGrants=true;
|
|
68
71
|
else if(arg==='--recover-offline-predecessor') out.recoverOfflinePredecessor=true;
|
|
69
72
|
else if(arg==='--enable-machine-fs') out.enableMachineFs=true;
|
|
70
|
-
else out.enableObservation=true;
|
|
73
|
+
else if(arg==='--enable-observation') out.enableObservation=true;
|
|
74
|
+
else out.enableAutonomousSupervisor=true;
|
|
71
75
|
continue;
|
|
72
76
|
}
|
|
73
77
|
if(arg==='--host-command-pin'){
|
|
@@ -91,6 +95,7 @@ export function parseUpdateArgs(argv){
|
|
|
91
95
|
else if(arg==='--source-root') out.sourceRoot=path.resolve(value);
|
|
92
96
|
else if(bridgeFlags.has(arg)) bridge[bridgeFlags.get(arg)]=value;
|
|
93
97
|
else if(processPolicyFlags.has(arg)) processPolicy[processPolicyFlags.get(arg)]=value;
|
|
98
|
+
else if(semanticLspFlags.has(arg)) semanticLsp[semanticLspFlags.get(arg)]=value;
|
|
94
99
|
else cloud[cloudFlags.get(arg)]=value;
|
|
95
100
|
}
|
|
96
101
|
if(!out.stage) throw new Error('--stage is required');
|
|
@@ -111,6 +116,13 @@ export function parseUpdateArgs(argv){
|
|
|
111
116
|
if(!HEX64.test(sha256)) throw new Error('process policy SHA-256 must be lowercase hex');
|
|
112
117
|
out.processPolicyBootstrap={path:path.resolve(processPolicy.path),sha256};
|
|
113
118
|
}
|
|
119
|
+
const semanticLspFields=[...semanticLspFlags.values()],semanticLspPresent=semanticLspFields.filter(key=>semanticLsp[key]!==undefined);
|
|
120
|
+
if(semanticLspPresent.length!==0&&semanticLspPresent.length!==semanticLspFields.length) throw new Error('semantic LSP config bootstrap requires path plus SHA-256 as one pair');
|
|
121
|
+
if(semanticLspPresent.length===semanticLspFields.length){
|
|
122
|
+
const sha256=String(semanticLsp.sha256).toLowerCase();
|
|
123
|
+
if(!HEX64.test(sha256)) throw new Error('semantic LSP config SHA-256 must be lowercase hex');
|
|
124
|
+
out.semanticLspBootstrap={path:path.resolve(semanticLsp.path),sha256};
|
|
125
|
+
}
|
|
114
126
|
const cloudFields=[...cloudFlags.values()],present=cloudFields.filter(key=>cloud[key]!==undefined);
|
|
115
127
|
if(present.length!==0&&present.length!==cloudFields.length) throw new Error('named tunnel bootstrap requires cloud path/hash/token/workdir plus persistent public origin');
|
|
116
128
|
if(present.length===cloudFields.length){
|
|
@@ -262,6 +274,30 @@ export async function prepareBridgeSpec(config,bootstrap){
|
|
|
262
274
|
return next;
|
|
263
275
|
}
|
|
264
276
|
|
|
277
|
+
export async function prepareAutonomousSupervisorSpec(config,{releaseRoot,enable=false}={}){
|
|
278
|
+
const next=structuredClone(config);
|
|
279
|
+
if(!enable) return next;
|
|
280
|
+
if(next.AutonomousRuntimeEnabled!==true) throw new Error('autonomous supervisor bootstrap requires AutonomousRuntimeEnabled');
|
|
281
|
+
if(typeof releaseRoot!=='string'||!path.isAbsolute(releaseRoot)) throw new Error('autonomous supervisor release root must be absolute');
|
|
282
|
+
const release=path.resolve(releaseRoot),script=path.join(release,'src','autonomous-supervisor-host.mjs');
|
|
283
|
+
const scriptStat=await lstat(script);
|
|
284
|
+
if(!scriptStat.isFile()||scriptStat.isSymbolicLink()) throw new Error('autonomous supervisor script must be a regular release file');
|
|
285
|
+
const bridge=next.Bridge;
|
|
286
|
+
if(!bridge||typeof bridge.FilePath!=='string'||!path.isAbsolute(bridge.FilePath)||!HEX64.test(String(bridge.FileSha256??''))) {
|
|
287
|
+
throw new Error('autonomous supervisor bootstrap requires pinned Bridge executable identity');
|
|
288
|
+
}
|
|
289
|
+
const executable=path.resolve(bridge.FilePath),exeStat=await lstat(executable);
|
|
290
|
+
if(!exeStat.isFile()||exeStat.isSymbolicLink()) throw new Error('autonomous supervisor executable must be a regular file');
|
|
291
|
+
const executableSha256=await sha256File(executable);
|
|
292
|
+
if(executableSha256!==String(bridge.FileSha256)) throw new Error('autonomous supervisor executable pin drift detected');
|
|
293
|
+
next.AutonomousSupervisorEnabled=true;
|
|
294
|
+
next.Supervisor={
|
|
295
|
+
FilePath:executable,FileSha256:executableSha256,Arguments:'src\\autonomous-supervisor-host.mjs',WorkingDirectory:release,
|
|
296
|
+
ScriptPath:script,ScriptSha256:await sha256File(script)
|
|
297
|
+
};
|
|
298
|
+
return next;
|
|
299
|
+
}
|
|
300
|
+
|
|
265
301
|
function quoteWindowsArgument(value){
|
|
266
302
|
const text=String(value??'');
|
|
267
303
|
if(text.length<1||/["\r\n\0]/.test(text)) throw new Error('named tunnel argument contains unsafe characters');
|
|
@@ -285,6 +321,14 @@ export async function prepareProcessPolicyBootstrap(bootstrap){
|
|
|
285
321
|
return {...pinned,policy};
|
|
286
322
|
}
|
|
287
323
|
|
|
324
|
+
export async function prepareSemanticLspConfigBootstrap(bootstrap){
|
|
325
|
+
if(!bootstrap) return null;
|
|
326
|
+
const pinned=await verifyPinnedRegularFile(bootstrap.path,bootstrap.sha256,'semantic LSP config');
|
|
327
|
+
const config=await readJson(pinned.path);
|
|
328
|
+
if(config?.schema!=='deadbyte.semantic-lsp-config.v1'||!Array.isArray(config.servers)) throw new Error('semantic LSP config schema invalid');
|
|
329
|
+
return {...pinned,config};
|
|
330
|
+
}
|
|
331
|
+
|
|
288
332
|
async function preparePinnedCommandPolicy(policy,{commandPins=[],schema,label}={}){
|
|
289
333
|
if(!policy) return {policy:null,repinned:[],matchedCommandIds:[]};
|
|
290
334
|
if(policy.schema!==schema||policy.enabled!==true||!policy.commands||typeof policy.commands!=='object'||Array.isArray(policy.commands)) {
|
|
@@ -453,6 +497,34 @@ export function runControllerStartNoCapture(ctx,timeoutMs=45000){
|
|
|
453
497
|
const call=controllerInvocation(ctx,'start');
|
|
454
498
|
return controlResult(call.exe,call.args,{cwd:call.cwd,timeoutMs,stdio:'ignore'});
|
|
455
499
|
}
|
|
500
|
+
export async function readControllerStartFailure(ctx){
|
|
501
|
+
const file=path.join(ctx.runtime_root,'controller-start-failure.json');
|
|
502
|
+
let bytes;
|
|
503
|
+
try { bytes=await readFile(file); }
|
|
504
|
+
catch(error){ if(error?.code==='ENOENT') return null; throw error; }
|
|
505
|
+
const text=bytes.toString('utf8').replace(/^\uFEFF/,'');
|
|
506
|
+
let value;
|
|
507
|
+
try { value=JSON.parse(text); } catch(error){ throw new Error(`controller start failure evidence JSON invalid: ${error.message}`); }
|
|
508
|
+
if(value?.schema!=='deadbyte.controller-start-failure.v1'||!['start','resume','restart'].includes(String(value?.command??''))||
|
|
509
|
+
typeof value?.message!=='string'||value.message.length<1||typeof value?.failed_at_utc!=='string') {
|
|
510
|
+
throw new Error('controller start failure evidence schema invalid');
|
|
511
|
+
}
|
|
512
|
+
return {path:file,sha256:sha256Bytes(bytes),...value};
|
|
513
|
+
}
|
|
514
|
+
export async function preserveControllerStartFailure(ctx,evidenceDir){
|
|
515
|
+
const evidence=await readControllerStartFailure(ctx);
|
|
516
|
+
if(!evidence) return null;
|
|
517
|
+
const source=path.join(ctx.runtime_root,'controller-start-failure.json');
|
|
518
|
+
const bytes=await readFile(source);
|
|
519
|
+
const sourceSha256=sha256Bytes(bytes);
|
|
520
|
+
if(sourceSha256!==evidence.sha256) throw new Error('controller start failure evidence changed before preservation');
|
|
521
|
+
const destination=path.join(path.resolve(evidenceDir),'controller-start-failure.json');
|
|
522
|
+
await atomicBytes(destination,bytes);
|
|
523
|
+
const persistedSha256=sha256Bytes(await readFile(destination));
|
|
524
|
+
if(persistedSha256!==sourceSha256) throw new Error('preserved controller start failure evidence SHA-256 mismatch');
|
|
525
|
+
return {path:destination,sha256:persistedSha256,schema:evidence.schema,command:evidence.command,
|
|
526
|
+
failed_at_utc:evidence.failed_at_utc,message:evidence.message};
|
|
527
|
+
}
|
|
456
528
|
async function readLedger(ctx,name){
|
|
457
529
|
const file=path.join(ctx.runtime_root,`${name}.instance.json`);
|
|
458
530
|
const value=JSON.parse((await readFile(file,'utf8')).replace(/^\uFEFF/,''));
|
|
@@ -510,12 +582,20 @@ async function waitCoreGone(runtime,timeoutMs=10000){
|
|
|
510
582
|
}
|
|
511
583
|
async function startAndVerify(ctx,oldRuntime){
|
|
512
584
|
let start=null;
|
|
585
|
+
await rm(path.join(ctx.runtime_root,'controller-start-failure.json'),{force:true});
|
|
513
586
|
for(let attempt=1;attempt<=3;attempt+=1){
|
|
514
587
|
start=runControllerStartNoCapture(ctx,45000);
|
|
515
588
|
if(!start.error&&start.status===0) break;
|
|
516
589
|
if(attempt<3) await sleep(1500);
|
|
517
590
|
}
|
|
518
|
-
if(start.error||start.status!==0)
|
|
591
|
+
if(start.error||start.status!==0){
|
|
592
|
+
let detail='';
|
|
593
|
+
try {
|
|
594
|
+
const evidence=await readControllerStartFailure(ctx);
|
|
595
|
+
if(evidence) detail=` controller=${evidence.message} evidence_sha256=${evidence.sha256}`;
|
|
596
|
+
} catch(error) { detail=` controller_evidence_error=${error.message}`; }
|
|
597
|
+
throw new Error(`controller start transport failed status=${start.status} error=${start.error?.message??'none'}${detail}`);
|
|
598
|
+
}
|
|
519
599
|
let statusText=''; let status=null;
|
|
520
600
|
const started=Date.now();
|
|
521
601
|
while(Date.now()-started<45000){
|
|
@@ -715,7 +795,7 @@ function publicPointer(pointer){
|
|
|
715
795
|
release_root:pointer.release_root,generation_root:pointer.generation_root,generation_manifest_sha256:pointer.generation_manifest_sha256,
|
|
716
796
|
launcher_sha256:pointer.launcher_sha256,config_path:pointer.config_path};
|
|
717
797
|
}
|
|
718
|
-
export async function performSlotUpdate({stage,developmentRoot,expectedVersion,expectedManifest,sourceRoot=null,stateRoot=DEFAULT_STATE_ROOT,restoreStandingGrants=false,recoverOfflinePredecessor=false,cloudTransport=null,bridgeBootstrap=null,processPolicyBootstrap=null,enableMachineFs=false,enableObservation=false,hostCommandPins=[]}){
|
|
798
|
+
export async function performSlotUpdate({stage,developmentRoot,expectedVersion,expectedManifest,sourceRoot=null,stateRoot=DEFAULT_STATE_ROOT,restoreStandingGrants=false,recoverOfflinePredecessor=false,cloudTransport=null,bridgeBootstrap=null,processPolicyBootstrap=null,semanticLspBootstrap=null,enableMachineFs=false,enableObservation=false,enableAutonomousSupervisor=false,hostCommandPins=[]}){
|
|
719
799
|
if(process.platform!=='win32') throw new Error('R27 slot update is Windows-only');
|
|
720
800
|
const state=path.resolve(stateRoot),stageRoot=path.resolve(stage),development=assertDevelopmentRootSafe(developmentRoot,state);
|
|
721
801
|
const key=await loadUpdateKey(state); const updateId=`r27-${expectedManifest.slice(0,16)}-${Date.now().toString(36)}-${randomBytes(4).toString('hex')}`;
|
|
@@ -740,6 +820,11 @@ export async function performSlotUpdate({stage,developmentRoot,expectedVersion,e
|
|
|
740
820
|
control.processPolicy=processBootstrap.policy;
|
|
741
821
|
control.config.ProcessRuntimeEnabled=true;
|
|
742
822
|
}
|
|
823
|
+
const semanticBootstrap=await prepareSemanticLspConfigBootstrap(semanticLspBootstrap);
|
|
824
|
+
if(semanticBootstrap){
|
|
825
|
+
control.config.SemanticLspConfigFile=semanticBootstrap.path;
|
|
826
|
+
control.config.SemanticLspConfigSha256=semanticBootstrap.sha256;
|
|
827
|
+
}
|
|
743
828
|
if(enableMachineFs){
|
|
744
829
|
if(control.config.CodingRuntimeEnabled!==true) throw new Error('MachineFsRuntimeEnabled requires CodingRuntimeEnabled');
|
|
745
830
|
control.config.MachineFsRuntimeEnabled=true;
|
|
@@ -751,6 +836,7 @@ export async function performSlotUpdate({stage,developmentRoot,expectedVersion,e
|
|
|
751
836
|
}
|
|
752
837
|
control.config=await prepareBridgeSpec(control.config,bridgeBootstrap);
|
|
753
838
|
control.config=await prepareNamedTunnelCloudSpec(control.config,{releaseRoot:slot.release_root,bootstrap:cloudTransport});
|
|
839
|
+
control.config=await prepareAutonomousSupervisorSpec(control.config,{releaseRoot:slot.release_root,enable:enableAutonomousSupervisor});
|
|
754
840
|
authorityPreparation=await prepareAuthorityPolicies({hostPolicy:control.hostPolicy,codingPolicy:control.codingPolicy},{commandPins:hostCommandPins});
|
|
755
841
|
control.hostPolicy=authorityPreparation.hostPolicy;
|
|
756
842
|
control.codingPolicy=authorityPreparation.codingPolicy;
|
|
@@ -829,6 +915,18 @@ export async function performSlotUpdate({stage,developmentRoot,expectedVersion,e
|
|
|
829
915
|
return {ok:true,update_id:updateId,state_path:statePath,receipt_path:receiptPath,receipt_sha256:receipt.receipt_sha256,
|
|
830
916
|
pointer:newPointer,new_runtime:newRuntime,final_authority:finalAuthority,workspace_root:workspace.target};
|
|
831
917
|
} catch(error){
|
|
918
|
+
let controllerStartFailure=null,controllerStartFailurePreservationError=null;
|
|
919
|
+
if(pointerCommitted&&newCtx){
|
|
920
|
+
try {
|
|
921
|
+
controllerStartFailure=await preserveControllerStartFailure(newCtx,evidenceDir);
|
|
922
|
+
const claimed=/evidence_sha256=([0-9a-f]{64})/.exec(String(error?.message??error));
|
|
923
|
+
if(claimed&&(!controllerStartFailure||controllerStartFailure.sha256!==claimed[1])) {
|
|
924
|
+
controllerStartFailurePreservationError=`controller start failure evidence claim mismatch expected=${claimed[1]} preserved=${controllerStartFailure?.sha256??'missing'}`;
|
|
925
|
+
}
|
|
926
|
+
} catch(preserveError) {
|
|
927
|
+
controllerStartFailurePreservationError=String(preserveError?.message??preserveError);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
832
930
|
const rollback={attempted:false,new_runtime_stopped:false,pointer_restored:false,launchers_restored:false,workspace_restored:false,
|
|
833
931
|
mcp_url_restored:false,old_runtime_restarted:false,authority_restored:false,errors:[]};
|
|
834
932
|
try {
|
|
@@ -866,6 +964,8 @@ export async function performSlotUpdate({stage,developmentRoot,expectedVersion,e
|
|
|
866
964
|
} catch(rollbackError){ rollback.errors.push(`rollback:${rollbackError.message}`); }
|
|
867
965
|
const failure={schema:FAILURE_SCHEMA,update_id:updateId,release_version:expectedVersion,candidate_manifest_sha256:expectedManifest,
|
|
868
966
|
failed_at_utc:new Date().toISOString(),phase:journal.phase??'unknown',error:{name:error?.name??'Error',code:error?.code??null,message:String(error?.message??error)},
|
|
967
|
+
controller_start_failure:controllerStartFailure,
|
|
968
|
+
controller_start_failure_preservation_error:controllerStartFailurePreservationError,
|
|
869
969
|
predecessor_mode:predecessor?.mode??null,prior_pointer:publicPointer(pointerInfo?.pointer??null),attempted_pointer:publicPointer(newPointer),old_runtime:generationTuple(oldRuntime),rollback};
|
|
870
970
|
await writeState(statePath,journal,'failed',{failure,rollback}).catch(()=>{});
|
|
871
971
|
let failureReceipt=null;
|
|
@@ -942,8 +1042,8 @@ export async function runSlotUpdateCli(argv=process.argv.slice(2),{stateRoot=DEF
|
|
|
942
1042
|
const args=parseUpdateArgs(argv);
|
|
943
1043
|
const result=await performSlotUpdate({stage:args.stage,developmentRoot:args.developmentRoot,expectedVersion:args.expectedVersion,
|
|
944
1044
|
expectedManifest:args.expectedManifest,sourceRoot:args.sourceRoot,stateRoot,restoreStandingGrants:args.restoreStandingGrants,recoverOfflinePredecessor:args.recoverOfflinePredecessor,
|
|
945
|
-
cloudTransport:args.cloudTransport,bridgeBootstrap:args.bridgeBootstrap,processPolicyBootstrap:args.processPolicyBootstrap,enableMachineFs:args.enableMachineFs,
|
|
946
|
-
enableObservation:args.enableObservation,hostCommandPins:args.hostCommandPins});
|
|
1045
|
+
cloudTransport:args.cloudTransport,bridgeBootstrap:args.bridgeBootstrap,processPolicyBootstrap:args.processPolicyBootstrap,semanticLspBootstrap:args.semanticLspBootstrap,enableMachineFs:args.enableMachineFs,
|
|
1046
|
+
enableObservation:args.enableObservation,enableAutonomousSupervisor:args.enableAutonomousSupervisor,hostCommandPins:args.hostCommandPins});
|
|
947
1047
|
console.log(`R27_SLOT_UPDATE_PASS version=${args.expectedVersion}`);
|
|
948
1048
|
console.log(`UPDATE_ID ${result.update_id}`); console.log(`RECEIPT_SHA256 ${result.receipt_sha256}`);
|
|
949
1049
|
console.log(`STATE_PATH ${result.state_path}`); console.log(`ACTIVE_RELEASE ${result.pointer.release_id}`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { sign as cryptoSign, verify as cryptoVerify } from 'node:crypto';
|
|
2
|
+
import { canonicalJson } from './canonical-json.mjs';
|
|
3
|
+
import { loadPrivateSigningKey, loadPublicVerifyKey } from './trust.mjs';
|
|
4
|
+
|
|
5
|
+
const DOMAIN=Buffer.from('DEADBYTE-SEARCH-CURSOR-V1\0','utf8');
|
|
6
|
+
const HEX64=/^[0-9a-f]{64}$/;
|
|
7
|
+
const SCHEMA='deadbyte.search-cursor.v1';
|
|
8
|
+
|
|
9
|
+
function validateBody(body){
|
|
10
|
+
if(!body||typeof body!=='object'||Array.isArray(body)||body.schema!==SCHEMA) throw new Error('search cursor body invalid');
|
|
11
|
+
if(!HEX64.test(body.query_sha256??'')) throw new Error('search cursor query identity invalid');
|
|
12
|
+
if(!HEX64.test(body.snapshot_sha256??'')) throw new Error('search cursor snapshot identity invalid');
|
|
13
|
+
if(!Number.isInteger(body.offset)||body.offset<0||body.offset>1_000_000) throw new Error('search cursor offset invalid');
|
|
14
|
+
return {schema:SCHEMA,query_sha256:body.query_sha256,snapshot_sha256:body.snapshot_sha256,offset:body.offset};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createSearchCursorCodec({signingKeyPath,verifyKeyPath}){
|
|
18
|
+
if(!signingKeyPath||!verifyKeyPath) throw new Error('search cursor codec requires signing and verify keys');
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
async encode(input){
|
|
21
|
+
const body=validateBody({...input,schema:SCHEMA});
|
|
22
|
+
const signing=await loadPrivateSigningKey(signingKeyPath);
|
|
23
|
+
const bytes=Buffer.from(canonicalJson(body),'utf8');
|
|
24
|
+
const signature=cryptoSign(null,Buffer.concat([DOMAIN,bytes]),signing.privateKey).toString('base64');
|
|
25
|
+
const envelope={body,attestation:{algorithm:'ed25519',key_id:signing.keyId,signature_base64:signature}};
|
|
26
|
+
return Buffer.from(canonicalJson(envelope),'utf8').toString('base64url');
|
|
27
|
+
},
|
|
28
|
+
async decode(cursor){
|
|
29
|
+
if(typeof cursor!=='string'||cursor.length<1||cursor.length>8192) throw new Error('search cursor invalid');
|
|
30
|
+
let envelope;
|
|
31
|
+
try{envelope=JSON.parse(Buffer.from(cursor,'base64url').toString('utf8'));}catch{throw new Error('search cursor invalid');}
|
|
32
|
+
const body=validateBody(envelope?.body);
|
|
33
|
+
const verifyKey=await loadPublicVerifyKey(verifyKeyPath);
|
|
34
|
+
const att=envelope?.attestation;
|
|
35
|
+
if(att?.algorithm!=='ed25519'||att?.key_id!==verifyKey.keyId||typeof att?.signature_base64!=='string') throw new Error('search cursor attestation invalid');
|
|
36
|
+
const signature=Buffer.from(att.signature_base64,'base64');
|
|
37
|
+
if(signature.length!==64||signature.toString('base64')!==att.signature_base64) throw new Error('search cursor signature encoding invalid');
|
|
38
|
+
const bytes=Buffer.from(canonicalJson(body),'utf8');
|
|
39
|
+
if(!cryptoVerify(null,Buffer.concat([DOMAIN,bytes]),verifyKey.publicKey,signature)) throw new Error('search cursor signature invalid');
|
|
40
|
+
return body;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const SEARCH_CURSOR_SCHEMA=SCHEMA;
|