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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
4
4
|
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
5
5
|
import os from 'node:os';
|
|
6
6
|
import path from 'node:path';
|
|
@@ -9,7 +9,7 @@ import { createCodingRuntime, loadCodingPolicy } from '../src/coding-plane.mjs';
|
|
|
9
9
|
import { loadAutonomousPolicy } from '../src/autonomous-policy.mjs';
|
|
10
10
|
import { createNativeDiffRuntime } from '../src/native-diff.mjs';
|
|
11
11
|
import { createAutonomousRuntime } from '../src/autonomous-runtime.mjs';
|
|
12
|
-
import { buildPlannerPrompt, parsePlannerDecision } from '../src/autonomous-planner.mjs';
|
|
12
|
+
import { buildPlannerPrompt, parsePlannerDecision, parseR34PlannerDecision, requestR34ProviderDecision } from '../src/autonomous-planner.mjs';
|
|
13
13
|
|
|
14
14
|
const nonce = () => randomBytes(32).toString('hex');
|
|
15
15
|
async function fixture(delegates = {}) {
|
|
@@ -32,13 +32,17 @@ async function fixture(delegates = {}) {
|
|
|
32
32
|
await writeFile(policy.lease_file, JSON.stringify({ schema:'deadbyte.autonomous-lease.v1', policy_sha256:policy.policy_sha256,
|
|
33
33
|
instance_nonce:nonce(), root_ids:['project'], armed_at_utc:new Date().toISOString(), expires_at_utc:new Date(Date.now()+1800000).toISOString() }));
|
|
34
34
|
const codingRuntime = createCodingRuntime({ policy:codingPolicy, signingKeyPath:keys.privateKeyPath, verifyKeyPath:keys.publicKeyPath });
|
|
35
|
-
const
|
|
36
|
-
const { codingRuntimeFactory, observationRuntimeFactory, ...runtimeDelegates } = delegates;
|
|
35
|
+
const baseNativeDiffRuntime = createNativeDiffRuntime({ policy,codingRuntime,signingKeyPath:keys.privateKeyPath,verifyKeyPath:keys.publicKeyPath });
|
|
36
|
+
const { codingRuntimeFactory, nativeDiffRuntimeFactory, observationRuntimeFactory, ...runtimeDelegates } = delegates;
|
|
37
37
|
const autonomousCodingRuntime = codingRuntimeFactory ? codingRuntimeFactory(codingRuntime) : codingRuntime;
|
|
38
|
+
const autonomousNativeDiffRuntime = nativeDiffRuntimeFactory ? nativeDiffRuntimeFactory(baseNativeDiffRuntime) : baseNativeDiffRuntime;
|
|
38
39
|
if (observationRuntimeFactory) runtimeDelegates.observationRuntime = observationRuntimeFactory({ codingPolicy,keys });
|
|
39
|
-
const
|
|
40
|
+
const createRuntime = (overrides = {}) => createAutonomousRuntime({ policy,codingRuntime:autonomousCodingRuntime,
|
|
41
|
+
nativeDiffRuntime:autonomousNativeDiffRuntime,...runtimeDelegates,...overrides,
|
|
40
42
|
signingKeyPath:keys.privateKeyPath,verifyKeyPath:keys.publicKeyPath });
|
|
41
|
-
|
|
43
|
+
const runtime = createRuntime();
|
|
44
|
+
return { root,project,keys,codingPolicy,policy,codingRuntime:autonomousCodingRuntime,
|
|
45
|
+
nativeDiffRuntime:autonomousNativeDiffRuntime,baseNativeDiffRuntime,createRuntime,runtime };
|
|
42
46
|
}
|
|
43
47
|
async function submit(runtime,id='adv') {
|
|
44
48
|
return runtime.submit({ submissionId:id, rootId:'project', title:'adversarial', goal:'Inspect x.txt safely.', acceptance:'Do not claim release without evidence.' });
|
|
@@ -122,6 +126,66 @@ test('planner parser rejects malformed JSON and unknown top-level fields', async
|
|
|
122
126
|
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
123
127
|
});
|
|
124
128
|
|
|
129
|
+
test('R34 decision parser rejects prose-wrapped JSON and authority arming actions', async () => {
|
|
130
|
+
const f = await fixture();
|
|
131
|
+
try {
|
|
132
|
+
assert.throws(() => parseR34PlannerDecision('Here is JSON: {"schema":"deadbyte.autonomous-decision.v2","kind":"finish"}',f.policy),/structured|JSON|contract/i);
|
|
133
|
+
assert.throws(() => parseR34PlannerDecision(JSON.stringify({
|
|
134
|
+
schema:'deadbyte.autonomous-decision.v2',kind:'act',action:{kind:'armcoding'}
|
|
135
|
+
}),f.policy),/unsupported|authority|contract/i);
|
|
136
|
+
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('R34 replan carries only a bounded mutable suffix proposal', async () => {
|
|
140
|
+
const f = await fixture();
|
|
141
|
+
try {
|
|
142
|
+
const decision = parseR34PlannerDecision(JSON.stringify({
|
|
143
|
+
schema:'deadbyte.autonomous-decision.v2',kind:'replan',reason:'test failed',
|
|
144
|
+
steps:[
|
|
145
|
+
{step_id:'diagnose',intent:'Inspect failing evidence'},
|
|
146
|
+
{step_id:'fix',intent:'Apply corrected patch'}
|
|
147
|
+
]
|
|
148
|
+
}),f.policy);
|
|
149
|
+
assert.equal(decision.schema,'deadbyte.autonomous-decision.v2');
|
|
150
|
+
assert.equal(decision.kind,'replan');
|
|
151
|
+
assert.equal(decision.steps.length,2);
|
|
152
|
+
assert.equal(decision.steps[0].step_id,'diagnose');
|
|
153
|
+
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('R34 act accepts one bounded existing patch action with exact SHA precondition', async () => {
|
|
157
|
+
const f = await fixture();
|
|
158
|
+
try {
|
|
159
|
+
const decision = parseR34PlannerDecision(JSON.stringify({
|
|
160
|
+
schema:'deadbyte.autonomous-decision.v2',kind:'act',
|
|
161
|
+
action:{kind:'patch',operations:[{
|
|
162
|
+
kind:'replace',path:'x.txt',expected_sha256:'0'.repeat(64),old_string:'x',new_string:'y',expected_replacements:1
|
|
163
|
+
}]}
|
|
164
|
+
}),f.policy);
|
|
165
|
+
assert.equal(decision.kind,'act');
|
|
166
|
+
assert.equal(decision.action.kind,'patch');
|
|
167
|
+
assert.equal(decision.action.operations[0].expected_sha256,'0'.repeat(64));
|
|
168
|
+
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('R34 provider adapter returns only normalized decision plus raw response hash', async () => {
|
|
172
|
+
const rawDecision = JSON.stringify({schema:'deadbyte.autonomous-decision.v2',kind:'finish',summary:'verified'});
|
|
173
|
+
const policy = {
|
|
174
|
+
planner:{backend:'openai_compatible',endpoint:'https://planner.invalid/v1/chat/completions',model:'fake-r34',api_key_env:null,max_tokens:2048,timeout_ms:30000,max_response_bytes:262144},
|
|
175
|
+
limits:{max_context_bytes:262144,max_files_per_diff:4},
|
|
176
|
+
profiles:{}
|
|
177
|
+
};
|
|
178
|
+
const fakeFetch = async () => new Response(JSON.stringify({model:'fake-r34',choices:[{message:{content:rawDecision}}]}),{
|
|
179
|
+
status:200,headers:{'content-type':'application/json'}
|
|
180
|
+
});
|
|
181
|
+
const result = await requestR34ProviderDecision(policy,'PROMPT',fakeFetch);
|
|
182
|
+
assert.equal(result.backend,'openai_compatible');
|
|
183
|
+
assert.equal(result.model,'fake-r34');
|
|
184
|
+
assert.equal(result.decision.kind,'finish');
|
|
185
|
+
assert.match(result.raw_response_sha256,/^[0-9a-f]{64}$/);
|
|
186
|
+
assert.equal(Object.hasOwn(result,'raw_text'),false);
|
|
187
|
+
});
|
|
188
|
+
|
|
125
189
|
test('R33 private delegate routes bounded machine reads and records signed evidence', async () => {
|
|
126
190
|
const calls=[];
|
|
127
191
|
const f = await fixture({ machineFsRuntime:{ async stat(args){ calls.push(args); return {status:'ok',root_id:args.rootId,path:args.relativePath,kind:'file',bytes:2}; } } });
|
|
@@ -327,3 +391,82 @@ test('signed autonomous journal tamper is rejected before state is trusted', asy
|
|
|
327
391
|
await assert.rejects(f.runtime.status({ goalId:goal.goal_id }), /signature verification failed|hash-chain mismatch/);
|
|
328
392
|
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
329
393
|
});
|
|
394
|
+
|
|
395
|
+
test('R34 event deletion/reorder/signature tamper fails before state trust', async () => {
|
|
396
|
+
async function prepared(id) {
|
|
397
|
+
const f=await fixture();
|
|
398
|
+
const goal=await submit(f.runtime,id);
|
|
399
|
+
const first=await f.runtime.run({goalId:goal.goal_id,maxCycles:1});
|
|
400
|
+
assert.equal(first.status,'input_required');
|
|
401
|
+
const dir=path.join(f.policy.evidence_dir,'goals',goal.goal_id,'events');
|
|
402
|
+
return {f,goal,dir};
|
|
403
|
+
}
|
|
404
|
+
for (const mode of ['delete','reorder','signature']) {
|
|
405
|
+
const {f,goal,dir}=await prepared(`journal-${mode}`);
|
|
406
|
+
try {
|
|
407
|
+
const one=path.join(dir,'000001.json');
|
|
408
|
+
const two=path.join(dir,'000002.json');
|
|
409
|
+
if(mode==='delete') {
|
|
410
|
+
await rm(two,{force:true});
|
|
411
|
+
} else if(mode==='reorder') {
|
|
412
|
+
const a=await readFile(one); const b=await readFile(two);
|
|
413
|
+
await writeFile(one,b); await writeFile(two,a);
|
|
414
|
+
} else {
|
|
415
|
+
const event=JSON.parse(await readFile(one,'utf8'));
|
|
416
|
+
event.payload.submission_id='forged-submission';
|
|
417
|
+
await writeFile(one,JSON.stringify(event));
|
|
418
|
+
}
|
|
419
|
+
await assert.rejects(f.runtime.status({goalId:goal.goal_id}),/event gap|signature verification failed|hash-chain mismatch/);
|
|
420
|
+
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
test('R34 restart reconciles a committed Native Diff after crash without invoking apply twice', async () => {
|
|
425
|
+
let applyCalls = 0;
|
|
426
|
+
let crashOnce = true;
|
|
427
|
+
const f = await fixture({
|
|
428
|
+
nativeDiffRuntimeFactory(base) {
|
|
429
|
+
return {
|
|
430
|
+
preview: args => base.preview(args),
|
|
431
|
+
verify: args => base.verify(args),
|
|
432
|
+
async apply(args) {
|
|
433
|
+
applyCalls += 1;
|
|
434
|
+
const result = await base.apply(args);
|
|
435
|
+
if (crashOnce) {
|
|
436
|
+
crashOnce = false;
|
|
437
|
+
throw new Error('simulated crash after native diff apply');
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
try {
|
|
445
|
+
const goal = await submit(f.runtime,'r34-crash-after-apply');
|
|
446
|
+
const first = await f.runtime.run({goalId:goal.goal_id,maxCycles:2});
|
|
447
|
+
assert.equal(first.status,'input_required');
|
|
448
|
+
const before = await readFile(path.join(f.project,'x.txt'));
|
|
449
|
+
const beforeSha = createHash('sha256').update(before).digest('hex');
|
|
450
|
+
const patch = JSON.stringify({
|
|
451
|
+
schema:'deadbyte.autonomous-decision.v1',action:'patch',summary:'mutate once',
|
|
452
|
+
operations:[{kind:'replace',path:'x.txt',expected_sha256:beforeSha,old_string:'x',new_string:'y',expected_replacements:1}]
|
|
453
|
+
});
|
|
454
|
+
await assert.rejects(f.runtime.run({goalId:goal.goal_id,maxCycles:2,
|
|
455
|
+
plannerResponse:{request_id:first.planner_request.request_id,model:'fake',raw_text:patch}}),/simulated crash after native diff apply/);
|
|
456
|
+
assert.equal(await readFile(path.join(f.project,'x.txt'),'utf8'),'y\n');
|
|
457
|
+
assert.equal(applyCalls,1);
|
|
458
|
+
|
|
459
|
+
const restarted = f.createRuntime();
|
|
460
|
+
const resumed = await restarted.run({goalId:goal.goal_id,maxCycles:1});
|
|
461
|
+
assert.notEqual(resumed.status,'paused');
|
|
462
|
+
assert.equal(applyCalls,1,'restart must reconcile durable mutation evidence instead of invoking apply again');
|
|
463
|
+
assert.equal(await readFile(path.join(f.project,'x.txt'),'utf8'),'y\n');
|
|
464
|
+
const journal = await restarted.events({goalId:goal.goal_id,fromSeq:1,limit:200});
|
|
465
|
+
assert.equal(journal.events.filter(event=>event.type==='native_diff_committed').length,1);
|
|
466
|
+
assert.equal(journal.events.filter(event=>event.type==='action_started').length,1);
|
|
467
|
+
assert.equal(journal.events.filter(event=>event.type==='action_reconciled').length,1);
|
|
468
|
+
assert.equal(journal.events.filter(event=>event.type==='action_completed').length,1);
|
|
469
|
+
const reconciled = journal.events.find(event=>event.type==='action_reconciled');
|
|
470
|
+
assert.equal(reconciled.payload.classification,'executed_verified');
|
|
471
|
+
} finally { await rm(f.root,{recursive:true,force:true}); }
|
|
472
|
+
});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { canonicalJson } from '../src/canonical-json.mjs';
|
|
4
|
+
import {
|
|
5
|
+
compactLoopContext,
|
|
6
|
+
deriveProjectMemory,
|
|
7
|
+
buildLoopContext
|
|
8
|
+
} from '../src/autonomous-context-engine.mjs';
|
|
9
|
+
import { buildPlannerPrompt } from '../src/autonomous-planner.mjs';
|
|
10
|
+
|
|
11
|
+
const H = c => c.repeat(64);
|
|
12
|
+
|
|
13
|
+
function oversizedContext() {
|
|
14
|
+
return {
|
|
15
|
+
goal:{title:'repair',goal:'repair source',acceptance:'tests pass'},
|
|
16
|
+
loop:{phase:'INSPECTING',mutation_epoch:1,planner_round:2},
|
|
17
|
+
working_context:{
|
|
18
|
+
active_plan:null,
|
|
19
|
+
current_step:null,
|
|
20
|
+
recent_contexts:[
|
|
21
|
+
{path:'old.txt',sha256:H('1'),bytes:20000,content:`OLD_SENTINEL:${'X'.repeat(70000)}`},
|
|
22
|
+
{path:'latest.txt',sha256:H('2'),bytes:20000,content:`LATEST_SENTINEL:${'L'.repeat(8000)}`}
|
|
23
|
+
],
|
|
24
|
+
recent_observations:[],
|
|
25
|
+
active_identities:[],
|
|
26
|
+
recent_decisions:[]
|
|
27
|
+
},
|
|
28
|
+
historical_evidence:{
|
|
29
|
+
compacted_events:[{
|
|
30
|
+
request_sha256:H('a'),receipt_sha256:H('b'),expected_sha256:H('c'),
|
|
31
|
+
failure_cause:'test_failed',raw_payload:`OLD_RAW_PAYLOAD_SENTINEL${'Y'.repeat(160000)}`
|
|
32
|
+
}],
|
|
33
|
+
failures:[{cause:'test_failed',receipt_sha256:H('d')}],
|
|
34
|
+
receipts:[{receipt_id:'receipt-1',receipt_sha256:H('e')}],
|
|
35
|
+
mutation_epochs:[0,1],
|
|
36
|
+
plan_transitions:[]
|
|
37
|
+
},
|
|
38
|
+
project_memory:{
|
|
39
|
+
acceptance_constraints:['tests pass'],
|
|
40
|
+
proven_invariants:[`source_sha=${H('f')}`],
|
|
41
|
+
rejected_approaches:[],
|
|
42
|
+
important_files:[{path:'latest.txt',sha256:H('2')}],
|
|
43
|
+
unresolved_blockers:['test_failed']
|
|
44
|
+
},
|
|
45
|
+
profiles:[]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
test('compaction preserves proof identity while dropping stale payload bytes', () => {
|
|
50
|
+
const compacted = compactLoopContext(oversizedContext(),65536);
|
|
51
|
+
const json = canonicalJson(compacted);
|
|
52
|
+
assert.ok(Buffer.byteLength(json,'utf8') <= 65536);
|
|
53
|
+
assert.match(json,/receipt_sha256/);
|
|
54
|
+
assert.match(json,/request_sha256/);
|
|
55
|
+
assert.match(json,/expected_sha256/);
|
|
56
|
+
assert.match(json,/test_failed/);
|
|
57
|
+
assert.match(json,/unresolved_blockers/);
|
|
58
|
+
assert.match(json,/LATEST_SENTINEL/);
|
|
59
|
+
assert.doesNotMatch(json,/OLD_RAW_PAYLOAD_SENTINEL/);
|
|
60
|
+
assert.doesNotMatch(json,/OLD_SENTINEL/);
|
|
61
|
+
assert.match(json,/content_elided/);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('same input always produces byte-identical compacted context', () => {
|
|
65
|
+
const a = canonicalJson(compactLoopContext(oversizedContext(),65536));
|
|
66
|
+
const b = canonicalJson(compactLoopContext(oversizedContext(),65536));
|
|
67
|
+
assert.equal(a,b);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('secret-like fields are redacted without exposing raw values or a hash oracle', () => {
|
|
71
|
+
const context = oversizedContext();
|
|
72
|
+
context.project_memory.credentials = {
|
|
73
|
+
api_token:'super-secret-token',
|
|
74
|
+
password:'correct horse battery staple',
|
|
75
|
+
authorization:'Bearer abc123'
|
|
76
|
+
};
|
|
77
|
+
const compacted = compactLoopContext(context,65536);
|
|
78
|
+
const json = canonicalJson(compacted);
|
|
79
|
+
assert.doesNotMatch(json,/super-secret-token/);
|
|
80
|
+
assert.doesNotMatch(json,/correct horse battery staple/);
|
|
81
|
+
assert.doesNotMatch(json,/Bearer abc123/);
|
|
82
|
+
assert.match(json,/"reason":"secret"/);
|
|
83
|
+
const redacted = compacted.project_memory.credentials;
|
|
84
|
+
assert.equal(redacted.redacted,true);
|
|
85
|
+
assert.equal(redacted.reason,'secret');
|
|
86
|
+
assert.equal(Object.hasOwn(redacted,'sha256'),false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('project memory derives stable acceptance, failures and unresolved blockers from journal events', () => {
|
|
90
|
+
const memory = deriveProjectMemory([
|
|
91
|
+
{type:'goal_created',payload:{acceptance:'build and tests pass'}},
|
|
92
|
+
{type:'profile_completed',payload:{profile_id:'test',passed:false,receipt_sha256:H('1')}},
|
|
93
|
+
{type:'native_diff_committed',payload:{paths:['src/a.mjs'],diff_receipt_sha256:H('2')}},
|
|
94
|
+
{type:'profile_completed',payload:{profile_id:'test',passed:true,receipt_sha256:H('3')}}
|
|
95
|
+
]);
|
|
96
|
+
assert.deepEqual(memory.acceptance_constraints,['build and tests pass']);
|
|
97
|
+
assert.ok(memory.proven_invariants.some(value => value.includes('test')));
|
|
98
|
+
assert.equal(memory.unresolved_blockers.length,0);
|
|
99
|
+
assert.ok(memory.important_files.some(item => item.path === 'src/a.mjs'));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('buildLoopContext produces the three named layers and respects the policy budget', () => {
|
|
103
|
+
const built = buildLoopContext({
|
|
104
|
+
goal:{title:'repair',goal:'repair source',acceptance:'tests pass'},
|
|
105
|
+
policy:{limits:{max_context_bytes:65536},profiles:{}},
|
|
106
|
+
loopState:{phase:'INSPECTING',mutation_epoch:0,planner_round:1,plan:null,current_step:null},
|
|
107
|
+
tree:[{path:'src/a.mjs',type:'file'}],
|
|
108
|
+
contexts:[{path:'src/a.mjs',sha256:H('1'),bytes:4,content:'code'}],
|
|
109
|
+
observations:[],
|
|
110
|
+
decisions:[],
|
|
111
|
+
projectMemory:null
|
|
112
|
+
});
|
|
113
|
+
assert.ok(built.working_context);
|
|
114
|
+
assert.ok(built.historical_evidence);
|
|
115
|
+
assert.ok(built.project_memory);
|
|
116
|
+
assert.ok(Buffer.byteLength(canonicalJson(built),'utf8') <= 65536);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('R35 buildLoopContext attaches provenance and deduplicates identical retained context by newest observation', () => {
|
|
120
|
+
const built = buildLoopContext({
|
|
121
|
+
goal:{title:'repair',goal:'repair source',acceptance:'tests pass'},
|
|
122
|
+
policy:{limits:{max_context_bytes:65536},profiles:{}},
|
|
123
|
+
loopState:{phase:'INSPECT',mutation_epoch:3,planner_round:2,plan:null,current_step:null},
|
|
124
|
+
contexts:[
|
|
125
|
+
{path:'src/a.mjs',sha256:H('1'),bytes:4,content:'code',observed_at_utc:'2026-09-17T09:00:00.000Z'},
|
|
126
|
+
{path:'src/a.mjs',sha256:H('1'),bytes:4,content:'code',observed_at_utc:'2026-09-17T09:00:05.000Z'}
|
|
127
|
+
],
|
|
128
|
+
observations:[],decisions:[],tree:[],projectMemory:null
|
|
129
|
+
});
|
|
130
|
+
assert.equal(built.working_context.recent_contexts.length,1);
|
|
131
|
+
const retained=built.working_context.recent_contexts[0];
|
|
132
|
+
assert.equal(retained.observed_at_utc,'2026-09-17T09:00:05.000Z');
|
|
133
|
+
assert.equal(retained.provenance.source_kind,'context');
|
|
134
|
+
assert.equal(retained.provenance.source_id,'src/a.mjs');
|
|
135
|
+
assert.match(retained.provenance.source_sha256,/^[0-9a-f]{64}$/);
|
|
136
|
+
assert.equal(retained.provenance.relevance_epoch,3);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('R35 deterministic compaction elides payload but preserves provenance envelope', () => {
|
|
140
|
+
const built=buildLoopContext({
|
|
141
|
+
goal:{title:'repair',goal:'repair source',acceptance:'tests pass'},
|
|
142
|
+
policy:{limits:{max_context_bytes:32768},profiles:{}},
|
|
143
|
+
loopState:{phase:'INSPECT',mutation_epoch:7,planner_round:2,plan:null,current_step:null},
|
|
144
|
+
contexts:[
|
|
145
|
+
{path:'src/old.mjs',sha256:H('3'),bytes:70000,content:'OLD:'+('X'.repeat(70000)),observed_at_utc:'2026-09-17T09:00:00.000Z'},
|
|
146
|
+
{path:'src/current.mjs',sha256:H('4'),bytes:7,content:'current',observed_at_utc:'2026-09-17T09:01:00.000Z'}
|
|
147
|
+
],observations:[],decisions:[],tree:[],projectMemory:null
|
|
148
|
+
});
|
|
149
|
+
const old=built.working_context.recent_contexts.find(item=>item.path==='src/old.mjs');
|
|
150
|
+
assert.ok(old);
|
|
151
|
+
assert.equal(old.content,undefined);
|
|
152
|
+
assert.equal(old.content_elided,true);
|
|
153
|
+
assert.equal(old.provenance.source_id,'src/old.mjs');
|
|
154
|
+
assert.match(old.provenance.source_sha256,/^[0-9a-f]{64}$/);
|
|
155
|
+
assert.match(old.provenance.provenance_id,/^[0-9a-f]{64}$/);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('planner prompt serializes the R34 three-layer context instead of the legacy flat state', () => {
|
|
159
|
+
const policy = { limits:{max_context_bytes:65536}, profiles:{} };
|
|
160
|
+
const prompt = buildPlannerPrompt({
|
|
161
|
+
goal:{title:'repair',goal:'repair source',acceptance:'tests pass'},
|
|
162
|
+
policy,
|
|
163
|
+
view:{
|
|
164
|
+
mutation_epoch:0,
|
|
165
|
+
planner_round:1,
|
|
166
|
+
tree:[{path:'src/a.mjs',type:'file'}],
|
|
167
|
+
contexts:[{path:'src/a.mjs',sha256:H('1'),bytes:4,content:'code'}],
|
|
168
|
+
observations:[],
|
|
169
|
+
active_plan:null,
|
|
170
|
+
recent_decisions:[]
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
const stateText = prompt.match(/STATE=(.*)\nExample shape:/s)?.[1];
|
|
174
|
+
assert.ok(stateText);
|
|
175
|
+
const state = JSON.parse(stateText);
|
|
176
|
+
assert.ok(state.working_context);
|
|
177
|
+
assert.ok(state.historical_evidence);
|
|
178
|
+
assert.ok(state.project_memory);
|
|
179
|
+
assert.equal(Object.hasOwn(state,'contexts'),false);
|
|
180
|
+
assert.equal(Object.hasOwn(state,'observations'),false);
|
|
181
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import {
|
|
4
|
+
promptContexts,
|
|
5
|
+
promptObservations,
|
|
6
|
+
promptMutationEpoch
|
|
7
|
+
} from '../src/autonomous-live-state.mjs';
|
|
8
|
+
|
|
9
|
+
const context = { path:'workspaces/autonomous-live/fixture.txt', content:'READY\n', sha256:'a'.repeat(64), bytes:6 };
|
|
10
|
+
const observation = { profile_id:'quick-test', passed:false };
|
|
11
|
+
|
|
12
|
+
test('R34 compact planner state projects recent context, observations, and mutation epoch', () => {
|
|
13
|
+
const state = {
|
|
14
|
+
loop:{ mutation_epoch:2 },
|
|
15
|
+
working_context:{ recent_contexts:[context], recent_observations:[observation] }
|
|
16
|
+
};
|
|
17
|
+
assert.deepEqual(promptContexts(state), [context]);
|
|
18
|
+
assert.deepEqual(promptObservations(state), [observation]);
|
|
19
|
+
assert.equal(promptMutationEpoch(state), 2);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('legacy planner state remains compatible', () => {
|
|
23
|
+
const state = { mutation_epoch:1, contexts:[context], observations:[observation] };
|
|
24
|
+
assert.deepEqual(promptContexts(state), [context]);
|
|
25
|
+
assert.deepEqual(promptObservations(state), [observation]);
|
|
26
|
+
assert.equal(promptMutationEpoch(state), 1);
|
|
27
|
+
});
|