deadbyte-mcp 0.8.9 → 0.9.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 +348 -83
- package/R34-BASELINE.json +9 -0
- package/README.txt +135 -9
- package/bench/fixtures/corpus.json +17 -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 +10 -4
- package/controller/deadbyte-controller.config.psd1.example +14 -0
- package/controller/deadbyte-controller.ps1 +144 -19
- package/controller/deadbyte-process-policy.json +5 -5
- package/controller/deadbyte-semantic-lsp-config.json +95 -0
- package/deadbyte-mcp-0.8.9.tgz +0 -0
- package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
- package/docs/ARCHITECTURE.md +6 -5
- 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/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/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 +4 -2
- package/scripts/final-closure-verify.mjs +10 -10
- package/scripts/final-closure.mjs +11 -11
- package/scripts/gate-windows.ps1 +3 -3
- package/scripts/release-parity.mjs +14 -14
- 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 +255 -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-output-contracts.mjs +22 -3
- package/src/autonomous-plan.mjs +181 -0
- package/src/autonomous-planner-contracts.mjs +44 -0
- package/src/autonomous-planner.mjs +91 -6
- package/src/autonomous-policy.mjs +15 -2
- package/src/autonomous-progress.mjs +127 -0
- package/src/autonomous-runtime.mjs +601 -48
- package/src/autonomous-supervisor-host.mjs +70 -0
- package/src/autonomous-supervisor.mjs +31 -8
- package/src/capability-benchmark-runner.mjs +108 -0
- package/src/capability-benchmark.mjs +50 -0
- package/src/coding-mcp-tools.mjs +46 -3
- package/src/coding-output-contracts.mjs +45 -0
- package/src/context-provenance.mjs +86 -0
- package/src/deadbyte-cli.mjs +136 -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/mcp-server.mjs +17 -3
- package/src/observation-smoke-client.mjs +3 -2
- package/src/operator-surface.mjs +37 -0
- package/src/provider-circuit.mjs +125 -0
- package/src/release-generation.mjs +44 -5
- package/src/remote-mcp-autonomous-smoke-client.mjs +53 -14
- 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-r33-parity-client.mjs +1 -1
- package/src/remote-mcp-r34-parity-client.mjs +177 -0
- package/src/remote-mcp-smoke-client.mjs +2 -1
- package/src/remote-result-journal.mjs +114 -0
- package/src/runtime-update.mjs +58 -8
- package/src/semantic-backend-registry.mjs +39 -0
- package/src/semantic-code.mjs +179 -0
- package/src/semantic-lsp-backend.mjs +183 -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-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-runner.test.mjs +49 -0
- package/test/capability-benchmark.test.mjs +47 -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/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 +2 -1
- package/test/document-adapter.test.mjs +23 -0
- package/test/fixtures/lsp-framed-server.mjs +33 -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 +120 -0
- package/test/lsp-stdio-client.test.mjs +72 -0
- package/test/multi-file-read.test.mjs +41 -0
- package/test/observation-integration.test.mjs +3 -3
- package/test/production-docs.test.mjs +48 -0
- package/test/prompts-resources.test.mjs +35 -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 +3 -3
- package/test/r33-finalization.test.mjs +19 -16
- package/test/release-generation.test.mjs +23 -2
- package/test/release-version.test.mjs +24 -17
- package/test/remote-r24-catalog.test.mjs +5 -4
- package/test/remote-result-journal.test.mjs +58 -0
- package/test/remote-session-cli.test.mjs +150 -15
- package/test/runtime-self-update.test.mjs +63 -0
- package/test/semantic-backend-registry.test.mjs +29 -0
- package/test/semantic-code.test.mjs +66 -0
- package/test/semantic-lsp-backend.test.mjs +99 -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-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
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
# R34 DEADBYTE Loop Engine Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Turn the R33 autonomous runtime into a durable Windows-native engineering loop with explicit plan/phase state, evidence-based progress detection, crash reconciliation, authority-safe waiting/resume, and out-of-band local recovery without changing the default public MCP tool catalog.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Keep the existing signed autonomous journal, Native Diff, coding/profile receipts, delegated runtimes, release gate, and MCP tools as the authority spine. Extract focused pure modules for plan/state/context/progress/reconciliation, then make `autonomous-runtime.mjs` the orchestrator that appends signed loop events and delegates side effects. Add a Windows-local supervisor host whose ownership and recovery state live outside the managed MCP bridge, but which can never arm privileged authority.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Node.js >=22 ESM, `node:test`, `node:crypto` Ed25519/SHA-256, `zod/v4`, Windows PowerShell 5.1 controller integration, existing DEADBYTE Native Diff/coding/process/observation runtimes.
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Development workspace is `D:\Projects\deadbyte-mcp-r34-loop-engine`; sealed R33 / `0.8.10` source and published package are immutable.
|
|
16
|
+
- Baseline `package.json` SHA-256 is `99bb03660e5f1915c92d6c12e1526fcde23e15838ee62589a2117e2458178765`.
|
|
17
|
+
- Windows-only. Do not add Linux/macOS backends or a cross-platform abstraction layer for its own sake.
|
|
18
|
+
- Source control is NON-GIT. Do not invent Git commits, branches, HEADs, or commit hashes. Each task closes with targeted tests plus signed coding/Native-Diff evidence during execution.
|
|
19
|
+
- No planner-controlled authority widening. No task may add automatic Process/Coding/Autonomous/Host arming.
|
|
20
|
+
- No raw arbitrary shell/executable/environment injection. Continue to use existing allowlisted profiles, owned process identities, SHA preconditions, and bounded schemas.
|
|
21
|
+
- All source mutation remains exact-SHA-preconditioned and Native-Diff/current-state verifiable.
|
|
22
|
+
- The default public MCP tool names remain unchanged in R34: exact public catalog stays at 68 tools unless an explicit reviewed surface change is approved. Output schemas may only gain explicitly versioned/backward-compatible loop-state fields.
|
|
23
|
+
- R35 semantic/LSP intelligence, R36 multi-machine fabric, R37 commander expansion, and R38 competitor benchmark harness remain out of scope.
|
|
24
|
+
- Package version remains `0.8.10` during development. Cut a successor version only when an R34 release candidate is intentionally created.
|
|
25
|
+
- Every production-code task follows RED -> GREEN -> focused regression -> signed NON-GIT checkpoint.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## File Structure Locked for R34
|
|
30
|
+
|
|
31
|
+
Create these focused modules:
|
|
32
|
+
|
|
33
|
+
- `src/autonomous-plan.mjs` — canonical plan identity/version/transition rules; no I/O.
|
|
34
|
+
- `src/autonomous-loop-state.mjs` — pure signed-event reducer that derives phase, plan, pending action, progress and waiting state.
|
|
35
|
+
- `src/autonomous-context-engine.mjs` — deterministic three-layer planner context and bounded compaction.
|
|
36
|
+
- `src/autonomous-progress.mjs` — deterministic machine-evidence progress/stall/regression judge.
|
|
37
|
+
- `src/autonomous-action-reconcile.mjs` — deterministic action/request identity and crash reconciliation classifications.
|
|
38
|
+
- `src/autonomous-local-supervisor.mjs` — Windows-local supervisor ownership/recovery primitives; no public MCP transport dependency.
|
|
39
|
+
- `src/autonomous-supervisor-host.mjs` — local process entry point that runs/takes over provider-backed loops and managed-runtime recovery.
|
|
40
|
+
|
|
41
|
+
Add focused tests:
|
|
42
|
+
|
|
43
|
+
- `test/autonomous-plan.test.mjs`
|
|
44
|
+
- `test/autonomous-loop-state.test.mjs`
|
|
45
|
+
- `test/autonomous-context-engine.test.mjs`
|
|
46
|
+
- `test/autonomous-progress.test.mjs`
|
|
47
|
+
- `test/autonomous-action-reconcile.test.mjs`
|
|
48
|
+
- `test/autonomous-local-supervisor.test.mjs`
|
|
49
|
+
- `test/autonomous-r34-e2e.test.mjs`
|
|
50
|
+
|
|
51
|
+
Modify existing integration points only where required:
|
|
52
|
+
|
|
53
|
+
- `src/autonomous-planner.mjs`
|
|
54
|
+
- `src/autonomous-planner-contracts.mjs`
|
|
55
|
+
- `src/autonomous-policy.mjs`
|
|
56
|
+
- `src/autonomous-runtime.mjs`
|
|
57
|
+
- `src/autonomous-supervisor.mjs`
|
|
58
|
+
- `src/autonomous-output-contracts.mjs`
|
|
59
|
+
- `src/autonomous-mcp-tools.mjs`
|
|
60
|
+
- `src/mcp-server.mjs`
|
|
61
|
+
- `src/deadbyte-cli.mjs`
|
|
62
|
+
- `controller/deadbyte-controller.ps1`
|
|
63
|
+
- existing autonomous tests as regression coverage
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Task 1: Canonical Plan Model
|
|
68
|
+
|
|
69
|
+
**Files:**
|
|
70
|
+
- Create: `src/autonomous-plan.mjs`
|
|
71
|
+
- Create: `test/autonomous-plan.test.mjs`
|
|
72
|
+
- Modify later consumers only after this task is green.
|
|
73
|
+
|
|
74
|
+
**Interfaces:**
|
|
75
|
+
- Produces: `createPlan({ goalId, title, steps, reasonHash }) -> PlanV1`
|
|
76
|
+
- Produces: `replanPlan(previous, { steps, reasonHash }) -> PlanV1`
|
|
77
|
+
- Produces: `completePlanStep(previous, { stepId, evidence }) -> PlanV1`
|
|
78
|
+
- Produces: `planIsComplete(plan) -> boolean`
|
|
79
|
+
- Produces: `activePlanStep(plan) -> PlanStep|null`
|
|
80
|
+
- `PlanV1` fields: `schema:'deadbyte.autonomous-plan.v1'`, `plan_id`, `plan_version`, `parent_plan_version`, `title`, `steps`, `reason_sha256`.
|
|
81
|
+
- A step has stable `step_id`, bounded `intent`, status `pending|active|completed`, and optional `evidence` array of `{kind,id,sha256}`.
|
|
82
|
+
|
|
83
|
+
- [ ] **Step 1: Write failing plan lifecycle tests**
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import test from 'node:test';
|
|
87
|
+
import assert from 'node:assert/strict';
|
|
88
|
+
import { createPlan, replanPlan, completePlanStep, planIsComplete } from '../src/autonomous-plan.mjs';
|
|
89
|
+
|
|
90
|
+
const H = c => c.repeat(64);
|
|
91
|
+
|
|
92
|
+
test('plan id is goal-stable and version starts at one', () => {
|
|
93
|
+
const plan = createPlan({ goalId:H('a'), title:'Repair', reasonHash:H('b'), steps:[
|
|
94
|
+
{ step_id:'inspect', intent:'Inspect source' },
|
|
95
|
+
{ step_id:'verify', intent:'Verify acceptance' }
|
|
96
|
+
] });
|
|
97
|
+
assert.equal(plan.plan_version,1);
|
|
98
|
+
assert.equal(plan.parent_plan_version,null);
|
|
99
|
+
assert.match(plan.plan_id,/^[0-9a-f]{64}$/);
|
|
100
|
+
assert.equal(plan.steps[0].status,'active');
|
|
101
|
+
assert.equal(plan.steps[1].status,'pending');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('completed prefix is immutable across replan', () => {
|
|
105
|
+
let plan = createPlan({ goalId:H('a'), title:'Repair', reasonHash:H('b'), steps:[
|
|
106
|
+
{ step_id:'inspect', intent:'Inspect source' }, { step_id:'fix', intent:'Apply repair' }
|
|
107
|
+
] });
|
|
108
|
+
plan = completePlanStep(plan,{ stepId:'inspect', evidence:[{kind:'read',id:H('c'),sha256:H('d')}] });
|
|
109
|
+
assert.throws(() => replanPlan(plan,{ reasonHash:H('e'), steps:[
|
|
110
|
+
{ step_id:'inspect', intent:'Changed completed intent' }, { step_id:'fix2', intent:'Alternative' }
|
|
111
|
+
] }),/completed prefix/i);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('replan changes only active/pending suffix and increments version', () => {
|
|
115
|
+
let plan = createPlan({ goalId:H('a'), title:'Repair', reasonHash:H('b'), steps:[
|
|
116
|
+
{ step_id:'inspect', intent:'Inspect source' }, { step_id:'fix', intent:'Apply repair' }
|
|
117
|
+
] });
|
|
118
|
+
plan = completePlanStep(plan,{ stepId:'inspect', evidence:[{kind:'read',id:H('c'),sha256:H('d')}] });
|
|
119
|
+
const next = replanPlan(plan,{ reasonHash:H('e'), steps:[
|
|
120
|
+
plan.steps[0], { step_id:'diagnose', intent:'Diagnose failure' }, { step_id:'fix2', intent:'Apply corrected repair' }
|
|
121
|
+
] });
|
|
122
|
+
assert.equal(next.plan_version,2);
|
|
123
|
+
assert.equal(next.parent_plan_version,1);
|
|
124
|
+
assert.equal(next.steps[0].status,'completed');
|
|
125
|
+
assert.equal(next.steps[1].status,'active');
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- [ ] **Step 2: Run the focused tests and confirm RED**
|
|
130
|
+
|
|
131
|
+
Run:
|
|
132
|
+
|
|
133
|
+
```powershell
|
|
134
|
+
node --test test/autonomous-plan.test.mjs
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Expected: FAIL because `src/autonomous-plan.mjs` does not exist.
|
|
138
|
+
|
|
139
|
+
- [ ] **Step 3: Implement the minimal pure plan module**
|
|
140
|
+
|
|
141
|
+
Use canonical JSON + SHA-256 for `plan_id`; validate IDs with `/^[A-Za-z0-9._-]{1,64}$/`; max 24 steps; max intent 512 UTF-8 characters; exactly one `active` step unless complete; completion requires at least one evidence binding with a 64-hex hash. Do not read/write files in this module.
|
|
142
|
+
|
|
143
|
+
Core identity:
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
const planId = sha256Object({ schema:'deadbyte.autonomous-plan-id.v1', goal_id:goalId });
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`replanPlan` must byte-compare the completed prefix using canonical JSON and reject any mutation/removal of completed steps.
|
|
150
|
+
|
|
151
|
+
- [ ] **Step 4: Run focused tests GREEN plus planner regressions**
|
|
152
|
+
|
|
153
|
+
```powershell
|
|
154
|
+
node --test test/autonomous-plan.test.mjs test/autonomous-adversarial.test.mjs
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Expected: all tests PASS.
|
|
158
|
+
|
|
159
|
+
- [ ] **Step 5: NON-GIT evidence checkpoint**
|
|
160
|
+
|
|
161
|
+
During execution, retain signed coding receipts for the new module/tests and record their final SHA-256 values in the task report. No Git metadata is permitted.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Task 2: Pure R34 Loop State Reducer
|
|
166
|
+
|
|
167
|
+
**Files:**
|
|
168
|
+
- Create: `src/autonomous-loop-state.mjs`
|
|
169
|
+
- Create: `test/autonomous-loop-state.test.mjs`
|
|
170
|
+
- Modify: `src/autonomous-runtime.mjs` only after reducer tests are green.
|
|
171
|
+
|
|
172
|
+
**Interfaces:**
|
|
173
|
+
- Consumes: verified autonomous journal events and `PlanV1` snapshots from Task 1.
|
|
174
|
+
- Produces: `deriveLoopState(goal, events) -> LoopStateV1`.
|
|
175
|
+
- Produces phase enum exactly: `PLANNING|INSPECTING|ACTING|VERIFYING|REPLANNING|WAITING|COMPLETE`.
|
|
176
|
+
- `LoopStateV1` includes `phase`, `plan`, `plan_id`, `plan_version`, `current_step`, `mutation_epoch`, `planner_round`, `replan_count`, `pending_action`, `pending_approval`, `progress`, `wait_reason`, `journal_head_sha256`.
|
|
177
|
+
|
|
178
|
+
- [ ] **Step 1: Write reducer tests from synthetic verified event arrays**
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import test from 'node:test';
|
|
182
|
+
import assert from 'node:assert/strict';
|
|
183
|
+
import { deriveLoopState } from '../src/autonomous-loop-state.mjs';
|
|
184
|
+
|
|
185
|
+
const H = c => c.repeat(64);
|
|
186
|
+
const goal = { goal_id:H('1') };
|
|
187
|
+
const plan = { schema:'deadbyte.autonomous-plan.v1', plan_id:H('2'), plan_version:1,
|
|
188
|
+
parent_plan_version:null, title:'Repair', reason_sha256:H('3'), steps:[
|
|
189
|
+
{step_id:'inspect',intent:'Inspect source',status:'active'},
|
|
190
|
+
{step_id:'verify',intent:'Verify acceptance',status:'pending'}
|
|
191
|
+
] };
|
|
192
|
+
function eventsOf(items) {
|
|
193
|
+
return items.map(([type,payload],index) => ({
|
|
194
|
+
schema:'deadbyte.autonomous-event.v1', seq:index+1, goal_id:goal.goal_id,
|
|
195
|
+
prev_sha256:index===0?'0'.repeat(64):H(String((index%8)+1)),
|
|
196
|
+
event_sha256:H(String(((index+1)%8)+1)), type, payload
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
test('restart replay derives identical loop state', () => {
|
|
201
|
+
const events = eventsOf([
|
|
202
|
+
['goal_created',{}], ['plan_created',{plan}],
|
|
203
|
+
['phase_changed',{from:'PLANNING',to:'INSPECTING',reason:'plan_ready'}],
|
|
204
|
+
['inspection_completed',{evidence_head_sha256:H('a')}],
|
|
205
|
+
['phase_changed',{from:'INSPECTING',to:'ACTING',reason:'evidence_ready'}]
|
|
206
|
+
]);
|
|
207
|
+
assert.deepEqual(deriveLoopState(goal,events),deriveLoopState(goal,structuredClone(events)));
|
|
208
|
+
assert.equal(deriveLoopState(goal,events).phase,'ACTING');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('action_started without completion becomes pending action after replay', () => {
|
|
212
|
+
const state = deriveLoopState(goal,eventsOf([
|
|
213
|
+
['goal_created',{}], ['plan_created',{plan}],
|
|
214
|
+
['action_started',{action_id:H('b'),request_sha256:H('c'),kind:'patch'}]
|
|
215
|
+
]));
|
|
216
|
+
assert.equal(state.pending_action.action_id,H('b'));
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Also test every legal phase transition, `WAITING`, `COMPLETE`, plan/replan count, and that a terminal completion cannot regress to a mutable phase.
|
|
221
|
+
|
|
222
|
+
- [ ] **Step 2: Run RED**
|
|
223
|
+
|
|
224
|
+
```powershell
|
|
225
|
+
node --test test/autonomous-loop-state.test.mjs
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Expected: missing module/function failure.
|
|
229
|
+
|
|
230
|
+
- [ ] **Step 3: Implement reducer as pure event fold**
|
|
231
|
+
|
|
232
|
+
No filesystem, clock, process, planner or authority calls. Unknown legacy R33 events must remain tolerated where they are already part of a valid R33 journal; unknown R34 loop events with malformed required payloads must throw. Preserve existing fields needed by release verification instead of replacing R33 state.
|
|
233
|
+
|
|
234
|
+
- [ ] **Step 4: Run GREEN and journal tamper regression**
|
|
235
|
+
|
|
236
|
+
```powershell
|
|
237
|
+
node --test test/autonomous-loop-state.test.mjs test/autonomous-adversarial.test.mjs
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Expected: PASS, including existing signed-journal tamper test.
|
|
241
|
+
|
|
242
|
+
- [ ] **Step 5: NON-GIT evidence checkpoint**
|
|
243
|
+
|
|
244
|
+
Record signed mutation receipts + test observation receipt; no Git operations.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### Task 3: Deterministic Three-Layer Context Engine
|
|
249
|
+
|
|
250
|
+
**Files:**
|
|
251
|
+
- Create: `src/autonomous-context-engine.mjs`
|
|
252
|
+
- Create: `test/autonomous-context-engine.test.mjs`
|
|
253
|
+
- Modify: `src/autonomous-planner.mjs`
|
|
254
|
+
|
|
255
|
+
**Interfaces:**
|
|
256
|
+
- Produces: `buildLoopContext({ goal, policy, loopState, tree, contexts, observations, decisions, projectMemory })`.
|
|
257
|
+
- Produces: `compactLoopContext(state, maxBytes)`.
|
|
258
|
+
- Produces: `deriveProjectMemory(events) -> ProjectMemoryV1`.
|
|
259
|
+
- Project memory is goal/workspace scoped only; it is not account memory.
|
|
260
|
+
|
|
261
|
+
- [ ] **Step 1: Write failing compaction/preservation tests**
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
import test from 'node:test';
|
|
265
|
+
import assert from 'node:assert/strict';
|
|
266
|
+
import { canonicalJson } from '../src/canonical-json.mjs';
|
|
267
|
+
import { compactLoopContext } from '../src/autonomous-context-engine.mjs';
|
|
268
|
+
|
|
269
|
+
const context = {
|
|
270
|
+
working_context:{ active_plan:null,current_step:null,recent_contexts:[],recent_observations:[],active_identities:[],recent_decisions:[] },
|
|
271
|
+
historical_evidence:{ compacted_events:[{
|
|
272
|
+
request_sha256:'a'.repeat(64),receipt_sha256:'b'.repeat(64),expected_sha256:'c'.repeat(64),
|
|
273
|
+
failure_cause:'test_failed',raw_payload:`OLD_RAW_PAYLOAD_SENTINEL${'X'.repeat(220000)}`
|
|
274
|
+
}], failures:[],receipts:[],mutation_epochs:[0],plan_transitions:[] },
|
|
275
|
+
project_memory:{ acceptance_constraints:['tests pass'],proven_invariants:[],rejected_approaches:[],important_files:[],unresolved_blockers:['test_failed'] }
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
test('compaction preserves proof identity while dropping stale payload bytes', () => {
|
|
279
|
+
const compacted = compactLoopContext(structuredClone(context),65536);
|
|
280
|
+
const json = JSON.stringify(compacted);
|
|
281
|
+
assert.ok(Buffer.byteLength(json,'utf8') <= 65536);
|
|
282
|
+
assert.match(json,/receipt_sha256/);
|
|
283
|
+
assert.match(json,/request_sha256/);
|
|
284
|
+
assert.match(json,/expected_sha256/);
|
|
285
|
+
assert.match(json,/test_failed/);
|
|
286
|
+
assert.match(json,/unresolved_blockers/);
|
|
287
|
+
assert.doesNotMatch(json,/OLD_RAW_PAYLOAD_SENTINEL/);
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
test('same input always produces byte-identical compacted context', () => {
|
|
291
|
+
const a = canonicalJson(compactLoopContext(structuredClone(context),65536));
|
|
292
|
+
const b = canonicalJson(compactLoopContext(structuredClone(context),65536));
|
|
293
|
+
assert.equal(a,b);
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Add a secret-safety test proving common credential fields are represented only by redaction metadata and never raw values.
|
|
298
|
+
|
|
299
|
+
- [ ] **Step 2: Run RED**
|
|
300
|
+
|
|
301
|
+
```powershell
|
|
302
|
+
node --test test/autonomous-context-engine.test.mjs
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
- [ ] **Step 3: Implement deterministic layer ordering**
|
|
306
|
+
|
|
307
|
+
Order planner state as:
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
{
|
|
311
|
+
working_context:{ active_plan, current_step, recent_contexts, recent_observations, active_identities, recent_decisions },
|
|
312
|
+
historical_evidence:{ compacted_events, failures, receipts, mutation_epochs, plan_transitions },
|
|
313
|
+
project_memory:{ acceptance_constraints, proven_invariants, rejected_approaches, important_files, unresolved_blockers }
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Compaction priority: drop/elide stale raw payload first, then old excerpts, then old redundant tree entries. Never elide SHA preconditions, request/receipt ids+hashes, failure causes, authority state, unresolved constraints, active plan, current step, latest evidence or current file identity.
|
|
318
|
+
|
|
319
|
+
- [ ] **Step 4: Replace old planner-state compaction with this module**
|
|
320
|
+
|
|
321
|
+
`buildPlannerPrompt` in `src/autonomous-planner.mjs` must call `buildLoopContext` and serialize one canonical `STATE=` object. Keep the existing context byte ceiling from `policy.limits.max_context_bytes`.
|
|
322
|
+
|
|
323
|
+
- [ ] **Step 5: Run GREEN plus existing context regression**
|
|
324
|
+
|
|
325
|
+
```powershell
|
|
326
|
+
node --test test/autonomous-context-engine.test.mjs test/autonomous-adversarial.test.mjs
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Expected: existing `planner prompt compacts stale context payloads` behavior remains green.
|
|
330
|
+
|
|
331
|
+
- [ ] **Step 6: NON-GIT evidence checkpoint**
|
|
332
|
+
|
|
333
|
+
Record file hashes and signed test receipt.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### Task 4: Evidence-Based Progress Judge
|
|
338
|
+
|
|
339
|
+
**Files:**
|
|
340
|
+
- Create: `src/autonomous-progress.mjs`
|
|
341
|
+
- Create: `test/autonomous-progress.test.mjs`
|
|
342
|
+
- Modify: `src/autonomous-policy.mjs`
|
|
343
|
+
|
|
344
|
+
**Interfaces:**
|
|
345
|
+
- Produces: `judgeProgress({ before, after, decision, evidence }) -> { verdict, score, reason_codes, fingerprint }`.
|
|
346
|
+
- Verdict enum: `progress|stalled|regressed`.
|
|
347
|
+
- Produces: `stallDisposition({ history, limits }) -> { action:'continue'|'replan'|'wait', reason }`.
|
|
348
|
+
- Add policy limits with exact defaults: `max_stalled_cycles:2`, `max_post_replan_stalls:2`, `max_replans:8`.
|
|
349
|
+
|
|
350
|
+
- [ ] **Step 1: Write failing deterministic progress tests**
|
|
351
|
+
|
|
352
|
+
```js
|
|
353
|
+
test('verified Native Diff epoch advance counts as progress', () => {
|
|
354
|
+
const result = judgeProgress({
|
|
355
|
+
before:{mutation_epoch:1,completed_steps:0}, after:{mutation_epoch:2,completed_steps:0},
|
|
356
|
+
decision:{kind:'act'}, evidence:{native_diff_verified:true}
|
|
357
|
+
});
|
|
358
|
+
assert.equal(result.verdict,'progress');
|
|
359
|
+
assert.ok(result.reason_codes.includes('verified_mutation_epoch_advanced'));
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
test('same read identity and equivalent decision stalls', () => {
|
|
363
|
+
const result = judgeProgress({
|
|
364
|
+
before:{evidence_head:'a'.repeat(64)}, after:{evidence_head:'a'.repeat(64)},
|
|
365
|
+
decision:{kind:'inspect',fingerprint:'b'.repeat(64)}, evidence:{same_source_sha:true}
|
|
366
|
+
});
|
|
367
|
+
assert.equal(result.verdict,'stalled');
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
test('stall policy forces replan then waiting', () => {
|
|
371
|
+
assert.equal(stallDisposition({history:['stalled','stalled'],limits:{max_stalled_cycles:2,max_post_replan_stalls:2,max_replans:8}}).action,'replan');
|
|
372
|
+
assert.equal(stallDisposition({history:['replan','stalled','stalled'],limits:{max_stalled_cycles:2,max_post_replan_stalls:2,max_replans:8}}).action,'wait');
|
|
373
|
+
});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
- [ ] **Step 2: Run RED**
|
|
377
|
+
|
|
378
|
+
```powershell
|
|
379
|
+
node --test test/autonomous-progress.test.mjs
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
- [ ] **Step 3: Implement scoring from machine deltas only**
|
|
383
|
+
|
|
384
|
+
Positive reason codes must include: `new_source_identity`, `new_profile_evidence`, `verified_mutation_epoch_advanced`, `acceptance_failure_resolved`, `plan_step_completed`, `diagnostic_narrowed`, `interrupted_action_recovered`, `release_readiness_improved`.
|
|
385
|
+
|
|
386
|
+
Stall reason codes must include: `equivalent_decision_no_new_evidence`, `identical_read_repeated`, `identical_profile_failure_repeated`, `equivalent_replan`, `plan_oscillation`.
|
|
387
|
+
|
|
388
|
+
Planner rationale strings must never affect score.
|
|
389
|
+
|
|
390
|
+
- [ ] **Step 4: Extend policy parser fail-closed**
|
|
391
|
+
|
|
392
|
+
`src/autonomous-policy.mjs` must validate the three new limits with integer bounds `[1,32]`; old policies that omit them receive the defaults above so R33 fixtures continue to load.
|
|
393
|
+
|
|
394
|
+
- [ ] **Step 5: Run GREEN + policy regressions**
|
|
395
|
+
|
|
396
|
+
```powershell
|
|
397
|
+
node --test test/autonomous-progress.test.mjs test/autonomous-adversarial.test.mjs test/autonomous-runtime.test.mjs
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
- [ ] **Step 6: NON-GIT evidence checkpoint**
|
|
401
|
+
|
|
402
|
+
Record signed receipts and final hashes.
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
### Task 5: Canonical R34 Planner Decisions and Provider Adapter
|
|
407
|
+
|
|
408
|
+
**Files:**
|
|
409
|
+
- Modify: `src/autonomous-planner-contracts.mjs`
|
|
410
|
+
- Modify: `src/autonomous-planner.mjs`
|
|
411
|
+
- Create/extend tests in: `test/autonomous-adversarial.test.mjs`, `test/autonomous-loop.test.mjs`
|
|
412
|
+
|
|
413
|
+
**Interfaces:**
|
|
414
|
+
- Canonical decision schema becomes `deadbyte.autonomous-decision.v2` for R34 journals while the runtime remains able to read historical v1 journal decisions.
|
|
415
|
+
- Canonical operations: `plan_create`, `inspect`, `act`, `step_complete`, `replan`, `pause`, `finish`.
|
|
416
|
+
- `act` embeds exactly one existing bounded DEADBYTE action, never an arm command.
|
|
417
|
+
- Provider adapter returns `{ backend, model, raw_response_sha256, decision }` after schema validation.
|
|
418
|
+
|
|
419
|
+
- [ ] **Step 1: Write failing contract tests**
|
|
420
|
+
|
|
421
|
+
```js
|
|
422
|
+
import test from 'node:test';
|
|
423
|
+
import assert from 'node:assert/strict';
|
|
424
|
+
import { parseR34PlannerDecision } from '../src/autonomous-planner.mjs';
|
|
425
|
+
|
|
426
|
+
const policy = { limits:{ max_context_bytes:262144,max_files_per_diff:8 }, profiles:{} };
|
|
427
|
+
|
|
428
|
+
test('R34 decision parser rejects authority arming and prose-wrapped JSON', () => {
|
|
429
|
+
assert.throws(() => parseR34PlannerDecision('Here is JSON: {"kind":"finish"}',policy),/structured|contract/i);
|
|
430
|
+
assert.throws(() => parseR34PlannerDecision(JSON.stringify({
|
|
431
|
+
schema:'deadbyte.autonomous-decision.v2', kind:'act', action:{kind:'armcoding'}
|
|
432
|
+
}),policy),/unsupported|authority/i);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
test('replan carries only a suffix plan proposal', () => {
|
|
436
|
+
const d = parseR34PlannerDecision(JSON.stringify({
|
|
437
|
+
schema:'deadbyte.autonomous-decision.v2', kind:'replan', reason:'test failed',
|
|
438
|
+
steps:[{step_id:'diagnose',intent:'Inspect failing evidence'},{step_id:'fix',intent:'Apply corrected patch'}]
|
|
439
|
+
}),policy);
|
|
440
|
+
assert.equal(d.kind,'replan');
|
|
441
|
+
});
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
- [ ] **Step 2: Run RED**
|
|
445
|
+
|
|
446
|
+
```powershell
|
|
447
|
+
node --test test/autonomous-adversarial.test.mjs test/autonomous-loop.test.mjs
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
The new R34 assertions must fail before parser implementation.
|
|
451
|
+
|
|
452
|
+
- [ ] **Step 3: Implement strict v2 normalization**
|
|
453
|
+
|
|
454
|
+
Use `z.discriminatedUnion('kind', ...)` from `zod/v4`; no Markdown stripping or regex JSON extraction. For provider-native structured output, keep provider-specific envelopes outside core state and hash raw response bytes. Client sampling remains request-id-bound.
|
|
455
|
+
|
|
456
|
+
- [ ] **Step 4: Keep bounded repair semantics**
|
|
457
|
+
|
|
458
|
+
Malformed decisions append `planner_rejected`; after three contract failures the loop must enter durable `WAITING` with `planner_contract_repeated_failure`, preserving existing fail-closed behavior.
|
|
459
|
+
|
|
460
|
+
- [ ] **Step 5: Run GREEN**
|
|
461
|
+
|
|
462
|
+
```powershell
|
|
463
|
+
node --test test/autonomous-loop.test.mjs test/autonomous-adversarial.test.mjs
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
- [ ] **Step 6: NON-GIT evidence checkpoint**
|
|
467
|
+
|
|
468
|
+
Record signed receipts and parser module hashes.
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
### Task 6: Action Identity and Crash Reconciliation
|
|
473
|
+
|
|
474
|
+
**Files:**
|
|
475
|
+
- Create: `src/autonomous-action-reconcile.mjs`
|
|
476
|
+
- Create: `test/autonomous-action-reconcile.test.mjs`
|
|
477
|
+
- Modify: `src/autonomous-runtime.mjs`
|
|
478
|
+
|
|
479
|
+
**Interfaces:**
|
|
480
|
+
- Produces: `actionIdentity({ goalId, planId, planVersion, stepId, mutationEpoch, decisionEventSha, action }) -> { action_id, request_sha256 }`.
|
|
481
|
+
- Produces: `reconcileStartedAction({ startedEvent, journal, runtimes, verifyKeyPath }) -> { classification, evidence, reason }`.
|
|
482
|
+
- Classification enum exactly: `not_executed|executed_verified|executed_failed_verified|ambiguous`.
|
|
483
|
+
|
|
484
|
+
- [ ] **Step 1: Write failing reconciliation tests with fake runtimes**
|
|
485
|
+
|
|
486
|
+
```js
|
|
487
|
+
import test from 'node:test';
|
|
488
|
+
import assert from 'node:assert/strict';
|
|
489
|
+
import { reconcileStartedAction } from '../src/autonomous-action-reconcile.mjs';
|
|
490
|
+
|
|
491
|
+
const H = c => c.repeat(64);
|
|
492
|
+
const patchStarted = { type:'action_started', event_sha256:H('1'), payload:{
|
|
493
|
+
action_id:H('2'), request_sha256:H('3'), action:{kind:'patch',diff_id:H('4')}
|
|
494
|
+
} };
|
|
495
|
+
|
|
496
|
+
test('verified mutation receipt classifies as executed without requesting replay', async () => {
|
|
497
|
+
const result = await reconcileStartedAction({
|
|
498
|
+
startedEvent:patchStarted, journal:[],
|
|
499
|
+
runtimes:{ nativeDiffRuntime:{ async verify({diffId}){
|
|
500
|
+
assert.equal(diffId,H('4'));
|
|
501
|
+
return {ok:true,current_state_matches:true,receipt_sha256:H('a')};
|
|
502
|
+
} } }
|
|
503
|
+
});
|
|
504
|
+
assert.equal(result.classification,'executed_verified');
|
|
505
|
+
assert.equal(result.replay_allowed,false);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
test('conflicting or unverifiable evidence is ambiguous', async () => {
|
|
509
|
+
const result = await reconcileStartedAction({
|
|
510
|
+
startedEvent:patchStarted, journal:[],
|
|
511
|
+
runtimes:{ nativeDiffRuntime:{ async verify(){ return {ok:false,reason:'receipt signature mismatch'}; } } }
|
|
512
|
+
});
|
|
513
|
+
assert.equal(result.classification,'ambiguous');
|
|
514
|
+
assert.equal(result.replay_allowed,false);
|
|
515
|
+
});
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Also cover no receipt/state -> `not_executed`, verified failed command/profile -> `executed_failed_verified`, stale request hash, receipt substitution and current-state mismatch.
|
|
519
|
+
|
|
520
|
+
- [ ] **Step 2: Run RED**
|
|
521
|
+
|
|
522
|
+
```powershell
|
|
523
|
+
node --test test/autonomous-action-reconcile.test.mjs
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
- [ ] **Step 3: Implement deterministic action identity**
|
|
527
|
+
|
|
528
|
+
Identity must bind goal, current plan/version/step, mutation epoch, normalized action and decision event hash. Retrying after `not_executed` reuses the same identity; a replan/step/version change necessarily produces a different identity.
|
|
529
|
+
|
|
530
|
+
- [ ] **Step 4: Integrate pre-action journal protocol**
|
|
531
|
+
|
|
532
|
+
Before every side effect `autonomous-runtime.mjs` must:
|
|
533
|
+
|
|
534
|
+
```text
|
|
535
|
+
verify journal -> reconcile prior action -> check live authority -> append action_started -> execute -> independently verify -> append action_completed
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
If reconciliation is `executed_verified`, append `action_reconciled` + recovered `action_completed` and do not invoke the side effect again. If `ambiguous`, append `waiting_entered` with `ambiguous_interrupted_action`.
|
|
539
|
+
|
|
540
|
+
- [ ] **Step 5: Add crash injection test at the dangerous boundary**
|
|
541
|
+
|
|
542
|
+
Inject termination after Native Diff apply succeeds but before `action_completed`; reconstruct runtime; verify file changed exactly once and journal gains recovered completion rather than a second mutation.
|
|
543
|
+
|
|
544
|
+
- [ ] **Step 6: Run GREEN + existing crash tests**
|
|
545
|
+
|
|
546
|
+
```powershell
|
|
547
|
+
node --test test/autonomous-action-reconcile.test.mjs test/coding-crash.test.mjs test/agent-runtime-crash.test.mjs test/autonomous-adversarial.test.mjs
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
- [ ] **Step 7: NON-GIT evidence checkpoint**
|
|
551
|
+
|
|
552
|
+
Run `native_diff_verify` on the implementation transaction during execution and retain receipt SHA-256.
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
### Task 7: R34 Loop Orchestrator, Phases, Waiting and Approval
|
|
557
|
+
|
|
558
|
+
**Files:**
|
|
559
|
+
- Modify: `src/autonomous-runtime.mjs`
|
|
560
|
+
- Modify: `src/autonomous-output-contracts.mjs`
|
|
561
|
+
- Modify: `src/autonomous-mcp-tools.mjs`
|
|
562
|
+
- Create: `test/helpers/autonomous-r34-fixture.mjs`
|
|
563
|
+
- Create: `test/autonomous-r34-e2e.test.mjs`
|
|
564
|
+
- Extend: `test/autonomous-loop.test.mjs`, `test/autonomous-adversarial.test.mjs`
|
|
565
|
+
|
|
566
|
+
**Interfaces:**
|
|
567
|
+
- `status()` and `run()` expose backward-compatible existing fields plus `loop:{schema:'deadbyte.autonomous-loop-state.v1',phase,plan_id,plan_version,current_step,replan_count,progress,pending_action,pending_approval,wait_reason}`.
|
|
568
|
+
- Test helper `createR34Fixture({ plannerDecisions = [], authority = 'armed' }) -> Promise<{root,project,runtime,policy,codingPolicy,keys,planner,cleanup}>` creates the same real coding/native-diff/autonomous stack used by current loop tests, with a temporary project and trust keys.
|
|
569
|
+
- Test helper `driveClientPlanner(runtime, goalId, decisions) -> Promise<RunResult>` repeatedly calls `run`; whenever status is `input_required`, it binds the next strict decision to `planner_request.request_id`; it returns on `completed|paused|cancelled|terminal` and throws if decisions are exhausted.
|
|
570
|
+
- Test helper decision constructors `planCreateDecision()`, `inspectDecision()`, `patchDecision(expectedSha)`, `stepCompleteDecision(evidence)`, `finishDecision()` return complete `deadbyte.autonomous-decision.v2` objects; no prose or implicit fields.
|
|
571
|
+
- No new public MCP tool names.
|
|
572
|
+
- `approve()` resumes from the verified journal head and never arms authority.
|
|
573
|
+
|
|
574
|
+
- [ ] **Step 1: Write failing phase-path E2E test**
|
|
575
|
+
|
|
576
|
+
```js
|
|
577
|
+
test('R34 loop executes plan -> inspect -> act -> verify -> step complete -> finish', async () => {
|
|
578
|
+
const f = await r34Fixture();
|
|
579
|
+
const goal = await f.runtime.submit({ submissionId:'r34-happy', rootId:'project', title:'repair', goal:'make value fixed', acceptance:'tests pass' });
|
|
580
|
+
const result = await drivePlanner(f,goal.goal_id,[
|
|
581
|
+
planCreateDecision(), inspectDecision(), patchDecision(), stepCompleteDecision(), finishDecision()
|
|
582
|
+
]);
|
|
583
|
+
assert.equal(result.state,'succeeded');
|
|
584
|
+
const status = await f.runtime.status({goalId:goal.goal_id});
|
|
585
|
+
assert.equal(status.loop.phase,'COMPLETE');
|
|
586
|
+
assert.equal(status.loop.plan_version,1);
|
|
587
|
+
assert.equal((await f.runtime.verify({goalId:goal.goal_id})).ok,true);
|
|
588
|
+
});
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Add tests for failing profile -> `VERIFYING` -> `REPLANNING`; missing authority -> `WAITING`; operator approval after re-arm -> same journal head lineage; reject -> cancelled; incomplete plan -> finish blocked.
|
|
592
|
+
|
|
593
|
+
- [ ] **Step 2: Run RED**
|
|
594
|
+
|
|
595
|
+
```powershell
|
|
596
|
+
node --test test/autonomous-r34-e2e.test.mjs
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
- [ ] **Step 3: Replace implicit R33 loop control with explicit signed phase events**
|
|
600
|
+
|
|
601
|
+
`autonomous-runtime.mjs` remains the I/O orchestrator but calls Tasks 1-6 modules. Every phase transition appends `phase_changed`. Initial nontrivial work requires `plan_created` before mutation. `step_completed` requires verified evidence bindings. `replan` calls `replanPlan` and appends `plan_replanned`.
|
|
602
|
+
|
|
603
|
+
- [ ] **Step 4: Integrate Progress Judge**
|
|
604
|
+
|
|
605
|
+
After `verification_completed`, append `progress_judged`. On stall threshold: transition to `REPLANNING`; repeated post-replan stall: append `waiting_entered` with `no_progress_after_replan`.
|
|
606
|
+
|
|
607
|
+
- [ ] **Step 5: Convert authority absence to durable waiting where safe**
|
|
608
|
+
|
|
609
|
+
A missing/revoked privilege before a not-yet-started action produces `WAITING/authority_unavailable`; it must not auto-arm. A revoked authority during an already-started action first goes through reconciliation.
|
|
610
|
+
|
|
611
|
+
- [ ] **Step 6: Version output shape explicitly without breaking tool names**
|
|
612
|
+
|
|
613
|
+
Extend `autonomousGoalRunOutputSchema` and `autonomousGoalStatusOutputSchema` with optional strict `loop` object. Existing R33 fields remain until a later major surface change. Update descriptions from R24/R33 wording to R34 without changing registration names.
|
|
614
|
+
|
|
615
|
+
- [ ] **Step 7: Run focused GREEN**
|
|
616
|
+
|
|
617
|
+
```powershell
|
|
618
|
+
node --test test/autonomous-r34-e2e.test.mjs test/autonomous-loop.test.mjs test/autonomous-adversarial.test.mjs test/autonomous-runtime.test.mjs
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
- [ ] **Step 8: NON-GIT evidence checkpoint**
|
|
622
|
+
|
|
623
|
+
Verify all mutation receipts and capture focused test receipt/output hashes.
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
### Task 8: Windows-Local Out-of-Band Supervisor
|
|
628
|
+
|
|
629
|
+
**Files:**
|
|
630
|
+
- Create: `src/autonomous-local-supervisor.mjs`
|
|
631
|
+
- Create: `src/autonomous-supervisor-host.mjs`
|
|
632
|
+
- Create: `test/autonomous-local-supervisor.test.mjs`
|
|
633
|
+
- Modify: `src/autonomous-supervisor.mjs`
|
|
634
|
+
- Modify: `src/deadbyte-cli.mjs`
|
|
635
|
+
- Modify: `controller/deadbyte-controller.ps1`
|
|
636
|
+
|
|
637
|
+
**Interfaces:**
|
|
638
|
+
- Local ownership marker schema: `deadbyte.autonomous-supervisor-owner.v1` with `pid`, `creation_time_utc`, `image_path`, `image_sha256`, `instance_nonce`, `started_at_utc`.
|
|
639
|
+
- Supervisor journal remains under autonomous evidence/state, not bridge memory.
|
|
640
|
+
- `observeCurrentProcessIdentity(pid = process.pid) -> Promise<{pid,creation_time_utc,image_path,image_sha256}>` uses Windows process observation and returns no result if identity cannot be proven.
|
|
641
|
+
- `claimSupervisor(options)`, `observeSupervisor(options)`, `takeoverSupervisor(options)`, `releaseSupervisor(options)` must verify Windows process identity, not PID alone.
|
|
642
|
+
- Test helper `localSupervisorFixture({ ownerPid, ownerIdentity })` writes one temporary marker/policy rooted under a temp directory and returns `{ options, cleanup }`; `cleanup()` removes only that temp root.
|
|
643
|
+
- Local recovery may invoke only pinned controller operations needed to observe/resume/park managed runtime and disarm planes; it must never invoke `arm*`.
|
|
644
|
+
|
|
645
|
+
- [ ] **Step 1: Write failing ownership/takeover tests**
|
|
646
|
+
|
|
647
|
+
```js
|
|
648
|
+
import test from 'node:test';
|
|
649
|
+
import assert from 'node:assert/strict';
|
|
650
|
+
import { observeCurrentProcessIdentity, observeSupervisor, takeoverSupervisor } from '../src/autonomous-local-supervisor.mjs';
|
|
651
|
+
import { localSupervisorFixture } from './helpers/autonomous-r34-fixture.mjs';
|
|
652
|
+
|
|
653
|
+
test('local supervisor refuses takeover of live verified owner', async () => {
|
|
654
|
+
const identity = await observeCurrentProcessIdentity();
|
|
655
|
+
const f = await localSupervisorFixture({ ownerPid:process.pid, ownerIdentity:identity });
|
|
656
|
+
try { await assert.rejects(takeoverSupervisor(f.options),/live verified owner/i); }
|
|
657
|
+
finally { await f.cleanup(); }
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
test('stale PID reuse does not inherit ownership', async () => {
|
|
661
|
+
const identity = await observeCurrentProcessIdentity();
|
|
662
|
+
const f = await localSupervisorFixture({ ownerPid:process.pid,
|
|
663
|
+
ownerIdentity:{...identity,creation_time_utc:'2000-01-01T00:00:00.000Z'} });
|
|
664
|
+
try {
|
|
665
|
+
const state = await observeSupervisor(f.options);
|
|
666
|
+
assert.equal(state.reason,'pid_reused');
|
|
667
|
+
} finally { await f.cleanup(); }
|
|
668
|
+
});
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Add tests proving controller command allowlist contains `status/resume/park/disarm*` and rejects every `arm*`, arbitrary command, executable and environment input.
|
|
672
|
+
|
|
673
|
+
- [ ] **Step 2: Run RED**
|
|
674
|
+
|
|
675
|
+
```powershell
|
|
676
|
+
node --test test/autonomous-local-supervisor.test.mjs
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
- [ ] **Step 3: Implement Windows identity verification**
|
|
680
|
+
|
|
681
|
+
Reuse the controller's established process identity principles: PID + creation time + full image path + image SHA-256. Fail closed if identity cannot be observed. Marker writes are same-directory atomic replacements after initial exclusive claim.
|
|
682
|
+
|
|
683
|
+
- [ ] **Step 4: Implement supervisor host loop**
|
|
684
|
+
|
|
685
|
+
`src/autonomous-supervisor-host.mjs` loads trusted policy/runtimes, claims local supervisor ownership, scans durable provider-backed goals, calls the existing bounded runtime `run`, and reconciles/takes over only from verified journal state. The host process must survive managed bridge stop/restart because it is not a child of the bridge.
|
|
686
|
+
|
|
687
|
+
- [ ] **Step 5: Implement managed-runtime recovery without self-arming**
|
|
688
|
+
|
|
689
|
+
When a lifecycle/recovery flow leaves the bridge unavailable, the local host may call the pinned PowerShell launcher with `resume`, then explicitly call `disarmautonomous`, `disarmcoding`, `disarmprocess`, `disarmhost`. Final recovery acceptance is `ONLINE + all privileged planes DISARMED`.
|
|
690
|
+
|
|
691
|
+
- [ ] **Step 6: Wire controller/CLI start-stop without changing public MCP tool catalog**
|
|
692
|
+
|
|
693
|
+
Add local-only controller lifecycle commands for the supervisor host, guarded by exact script/executable hash in trusted config. Do not expose a remote public `arm` or arbitrary supervisor exec tool.
|
|
694
|
+
|
|
695
|
+
- [ ] **Step 7: Run GREEN plus remote-session regression**
|
|
696
|
+
|
|
697
|
+
```powershell
|
|
698
|
+
node --test test/autonomous-local-supervisor.test.mjs test/autonomous-supervisor-integration.test.mjs test/remote-session-cli.test.mjs
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
- [ ] **Step 8: NON-GIT evidence checkpoint**
|
|
702
|
+
|
|
703
|
+
Record supervisor executable/script identity, test receipts and final source hashes.
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
### Task 9: Supervisor + MCP Integration and Public Surface Compatibility
|
|
708
|
+
|
|
709
|
+
**Files:**
|
|
710
|
+
- Modify: `src/mcp-server.mjs`
|
|
711
|
+
- Modify: `src/autonomous-supervisor.mjs`
|
|
712
|
+
- Modify: `src/autonomous-output-contracts.mjs`
|
|
713
|
+
- Modify: `src/autonomous-mcp-tools.mjs`
|
|
714
|
+
- Modify: `test/autonomous-supervisor-integration.test.mjs`
|
|
715
|
+
- Modify: `test/output-schema.test.mjs`
|
|
716
|
+
- Modify: `test/remote-r24-catalog.test.mjs` or successor catalog assertion file
|
|
717
|
+
|
|
718
|
+
**Interfaces:**
|
|
719
|
+
- Provider-backed goals may be advanced by the local supervisor even if no client repeatedly calls `autonomous_goal_run`.
|
|
720
|
+
- Client-sampling goals remain `input_required` and are never fabricated by the supervisor.
|
|
721
|
+
- Public autonomous tool names remain exactly the existing set from the spec.
|
|
722
|
+
|
|
723
|
+
- [ ] **Step 1: Add failing schema/catalog assertions**
|
|
724
|
+
|
|
725
|
+
Assert that status/run outputs accept the strict optional `loop` object and reject unknown loop fields. Assert the exact public catalog count/name set does not change accidentally.
|
|
726
|
+
|
|
727
|
+
- [ ] **Step 2: Run RED**
|
|
728
|
+
|
|
729
|
+
```powershell
|
|
730
|
+
node --test test/output-schema.test.mjs test/remote-r24-catalog.test.mjs test/autonomous-supervisor-integration.test.mjs
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
- [ ] **Step 3: Wire supervisor lifecycle in `mcp-server.mjs` without making bridge authoritative**
|
|
734
|
+
|
|
735
|
+
The MCP server may observe/report local supervisor state and may continue to start the in-process compatibility supervisor only when the out-of-band host is explicitly not configured. If the local host owns supervision, the bridge must not create a competing owner.
|
|
736
|
+
|
|
737
|
+
- [ ] **Step 4: Update user-visible descriptions and schemas**
|
|
738
|
+
|
|
739
|
+
Descriptions should say R34 loop/supervisor, but tool names and authority semantics stay unchanged. `autonomous_goal_status` returns journal-derived phase/progress/plan state; `autonomous_goal_events` remains the raw authenticated timeline.
|
|
740
|
+
|
|
741
|
+
- [ ] **Step 5: Run GREEN and catalog exactness gate**
|
|
742
|
+
|
|
743
|
+
```powershell
|
|
744
|
+
node --test test/output-schema.test.mjs test/autonomous-supervisor-integration.test.mjs test/remote-r24-catalog.test.mjs
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
- [ ] **Step 6: NON-GIT evidence checkpoint**
|
|
748
|
+
|
|
749
|
+
Capture catalog list/hash and output-schema test receipts.
|
|
750
|
+
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
### Task 10: Full Adversarial R34 Acceptance
|
|
754
|
+
|
|
755
|
+
**Files:**
|
|
756
|
+
- Create/extend: `test/autonomous-r34-e2e.test.mjs`
|
|
757
|
+
- Extend: `test/autonomous-adversarial.test.mjs`
|
|
758
|
+
- Extend: `test/autonomous-supervisor-integration.test.mjs`
|
|
759
|
+
- No production changes unless a test demonstrates a root-cause defect; any fix follows a new RED -> GREEN cycle.
|
|
760
|
+
|
|
761
|
+
**Interfaces:**
|
|
762
|
+
- This task consumes all prior modules and proves the spec acceptance matrix.
|
|
763
|
+
|
|
764
|
+
- [ ] **Step 1: Add the complete adversarial matrix**
|
|
765
|
+
|
|
766
|
+
Required named cases:
|
|
767
|
+
|
|
768
|
+
```text
|
|
769
|
+
R34 replay reconstructs byte-equivalent logical loop state
|
|
770
|
+
R34 crash after mutation before completion never duplicates mutation
|
|
771
|
+
R34 forged receipt substitution enters WAITING
|
|
772
|
+
R34 stale SHA returns to inspect/replan without force overwrite
|
|
773
|
+
R34 repeated identical evidence forces replan then WAITING
|
|
774
|
+
R34 authority revoke blocks next privileged action
|
|
775
|
+
R34 approval resumes same journal lineage after operator re-arm
|
|
776
|
+
R34 provider garbage pauses after bounded repair attempts
|
|
777
|
+
R34 context pressure preserves proof identities under byte limit
|
|
778
|
+
R34 event deletion/reorder/signature tamper fails before state trust
|
|
779
|
+
R34 stale supervisor PID identity cannot take over live process
|
|
780
|
+
R34 bridge loss is recovered by local supervisor to ONLINE and all-DISARMED
|
|
781
|
+
R34 full inspect-act-verify-replan-finish emits independently verifiable release receipt
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
- [ ] **Step 2: Run the R34 focused/adversarial set**
|
|
785
|
+
|
|
786
|
+
```powershell
|
|
787
|
+
node --test test/autonomous-plan.test.mjs test/autonomous-loop-state.test.mjs test/autonomous-context-engine.test.mjs test/autonomous-progress.test.mjs test/autonomous-action-reconcile.test.mjs test/autonomous-local-supervisor.test.mjs test/autonomous-r34-e2e.test.mjs test/autonomous-adversarial.test.mjs test/autonomous-supervisor-integration.test.mjs
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
Expected: 0 failures.
|
|
791
|
+
|
|
792
|
+
- [ ] **Step 3: Run the entire pre-existing R33 suite on R34 bytes**
|
|
793
|
+
|
|
794
|
+
```powershell
|
|
795
|
+
npm test
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
Expected: all tests pass; no R33 regression is waived.
|
|
799
|
+
|
|
800
|
+
- [ ] **Step 4: Run exact catalog/schema gates**
|
|
801
|
+
|
|
802
|
+
```powershell
|
|
803
|
+
node --test test/output-schema.test.mjs test/remote-r24-catalog.test.mjs test/r33-closeout-regression.test.mjs
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
Expected: public catalog drift is zero unless an explicit reviewed versioned schema change is documented.
|
|
807
|
+
|
|
808
|
+
- [ ] **Step 5: Run a real multi-step disposable workspace goal**
|
|
809
|
+
|
|
810
|
+
Use a scratch project under the configured `projects`/test root. The goal must inspect at least two files, perform a SHA-preconditioned Native Diff, observe one failing verification, replan, apply a corrected mutation, complete plan steps, run required profiles, and finish with `autonomous_goal_verify.ok === true`.
|
|
811
|
+
|
|
812
|
+
Acceptance evidence must include the goal id, journal head, plan id/version history, Native Diff ids/receipt hashes, progress verdicts, release receipt hash, and final source hashes.
|
|
813
|
+
|
|
814
|
+
- [ ] **Step 6: Inject the dangerous crash on real R34 runtime bytes**
|
|
815
|
+
|
|
816
|
+
Use a test-only crash hook after successful mutation evidence is durable but before `action_completed`. Restart the runtime/supervisor. Verify exactly one source mutation occurred, the recovered action id is unchanged, an `action_reconciled` event exists, and current-state verification passes.
|
|
817
|
+
|
|
818
|
+
- [ ] **Step 7: Prove out-of-band recovery**
|
|
819
|
+
|
|
820
|
+
Stop/park the managed Bridge during an active local supervisor run. Verify the local supervisor process remains alive, reconstructs the goal from the signed journal, restores the managed runtime to ONLINE when the controlled recovery path requires it, and leaves Process/Coding/Autonomous/Host DISARMED after recovery.
|
|
821
|
+
|
|
822
|
+
- [ ] **Step 8: Run full Windows gate on exact candidate bytes**
|
|
823
|
+
|
|
824
|
+
Only after all source/test work is frozen:
|
|
825
|
+
|
|
826
|
+
```powershell
|
|
827
|
+
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/gate-windows.ps1
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
Expected: canonical Windows gate PASS on the exact R34 candidate bytes.
|
|
831
|
+
|
|
832
|
+
- [ ] **Step 9: Independent verification before any R34 completion claim**
|
|
833
|
+
|
|
834
|
+
Verify every final release/autonomous/Native-Diff receipt using independent verifier paths. Recompute candidate manifest/package hashes. Confirm R33 `0.8.10` files and npm artifact were never modified or republished.
|
|
835
|
+
|
|
836
|
+
- [ ] **Step 10: NON-GIT final development checkpoint**
|
|
837
|
+
|
|
838
|
+
Record exact R34 workspace manifest, Windows gate evidence, focused/full test counts, public catalog identity, release receipt hash, and all authority planes DISARMED. Do not call the result a release until the separate release-candidate/version/package/activation/public-closeout process is executed on those exact bytes.
|
|
839
|
+
|
|
840
|
+
---
|
|
841
|
+
|
|
842
|
+
## Execution Order and Review Gates
|
|
843
|
+
|
|
844
|
+
Execute Tasks 1-10 strictly in order because each later interface depends on earlier deterministic state contracts. After each task, review the diff/receipts and rerun that task's focused tests before continuing. If three attempted fixes expose unrelated coupling in the same area, stop and reassess the architecture rather than stacking a fourth patch.
|
|
845
|
+
|
|
846
|
+
The release process is deliberately not part of Tasks 1-9. Task 10 only proves an R34 development candidate. Version cut, manifest, deterministic package, activation/rollback, npm publication and public closeout are a separate evidence phase after the implementation candidate is frozen.
|