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,125 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const HEX64=/^[0-9a-f]{64}$/;
|
|
4
|
+
const PROVIDER_ID=/^[A-Za-z0-9._:/-]{1,160}$/;
|
|
5
|
+
const FAILURE_CLASSES=new Set(['timeout','transport','rate_limit','auth','invalid_response','other']);
|
|
6
|
+
export const PROVIDER_CIRCUIT_STATES=Object.freeze(['CLOSED','OPEN','HALF_OPEN','UNAVAILABLE']);
|
|
7
|
+
|
|
8
|
+
function isoMs(value){
|
|
9
|
+
if(typeof value!=='string') return null;
|
|
10
|
+
const ms=Date.parse(value);
|
|
11
|
+
return Number.isFinite(ms)?ms:null;
|
|
12
|
+
}
|
|
13
|
+
function checkedPolicy(policy){
|
|
14
|
+
const threshold=policy?.failure_threshold;
|
|
15
|
+
const openMs=policy?.open_ms;
|
|
16
|
+
const probeLimit=policy?.half_open_probe_limit;
|
|
17
|
+
if(!Number.isInteger(threshold)||threshold<1||threshold>32) throw new Error('provider circuit failure_threshold invalid');
|
|
18
|
+
if(!Number.isInteger(openMs)||openMs<100||openMs>3_600_000) throw new Error('provider circuit open_ms invalid');
|
|
19
|
+
if(!Number.isInteger(probeLimit)||probeLimit<1||probeLimit>8) throw new Error('provider circuit half_open_probe_limit invalid');
|
|
20
|
+
return {failure_threshold:threshold,open_ms:openMs,half_open_probe_limit:probeLimit};
|
|
21
|
+
}
|
|
22
|
+
function publicState(state){
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
state:state.state,
|
|
25
|
+
failure_count:state.failure_count,
|
|
26
|
+
opened_at_utc:state.opened_at_utc,
|
|
27
|
+
next_probe_at_utc:state.next_probe_at_utc,
|
|
28
|
+
last_success_at_utc:state.last_success_at_utc,
|
|
29
|
+
half_open_probes:state.half_open_probes
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function unavailable(){
|
|
33
|
+
return publicState({state:'UNAVAILABLE',failure_count:0,opened_at_utc:null,next_probe_at_utc:null,last_success_at_utc:null,half_open_probes:0});
|
|
34
|
+
}
|
|
35
|
+
function advanceTime(state,ms){
|
|
36
|
+
if(state.state==='OPEN'&&state.next_probe_ms!==null&&ms>=state.next_probe_ms){
|
|
37
|
+
state.state='HALF_OPEN';
|
|
38
|
+
state.half_open_probes=0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function openAt(state,ms,policy){
|
|
42
|
+
state.state='OPEN';
|
|
43
|
+
state.failure_count=Math.max(policy.failure_threshold,state.failure_count);
|
|
44
|
+
state.opened_at_utc=new Date(ms).toISOString();
|
|
45
|
+
state.next_probe_ms=ms+policy.open_ms;
|
|
46
|
+
state.next_probe_at_utc=new Date(state.next_probe_ms).toISOString();
|
|
47
|
+
state.half_open_probes=0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function providerCircuitId(planner){
|
|
51
|
+
if(planner?.backend!=='openai_compatible'||typeof planner.endpoint!=='string'||typeof planner.model!=='string') {
|
|
52
|
+
throw new Error('provider circuit planner identity invalid');
|
|
53
|
+
}
|
|
54
|
+
const digest=createHash('sha256').update(Buffer.from(`${planner.endpoint}\0${planner.model}`,'utf8')).digest('hex');
|
|
55
|
+
return `openai_compatible:${digest}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function classifyProviderFailure(error){
|
|
59
|
+
const name=String(error?.name??'').toLowerCase();
|
|
60
|
+
const text=String(error?.message??error??'').toLowerCase();
|
|
61
|
+
if(name==='aborterror'||/\b(?:timed?\s*out|timeout|aborted)\b/.test(text)) return 'timeout';
|
|
62
|
+
if(/(?:http\s*429|rate[ _-]?limit|too many requests)/.test(text)) return 'rate_limit';
|
|
63
|
+
if(/(?:http\s*(?:401|403)|unauthori[sz]ed|forbidden|api key|authentication)/.test(text)) return 'auth';
|
|
64
|
+
if(/(?:not json|invalid json|missing choices|invalid response|response.*(?:schema|contract|content))/.test(text)) return 'invalid_response';
|
|
65
|
+
if(/(?:econnreset|econnrefused|enotfound|fetch failed|network|socket|transport|connection)/.test(text)) return 'transport';
|
|
66
|
+
return 'other';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function deriveCircuit(events,providerId,rawPolicy,observedAtUtc){
|
|
70
|
+
if(typeof providerId!=='string'||!PROVIDER_ID.test(providerId)) throw new Error('provider circuit provider_id invalid');
|
|
71
|
+
if(!Array.isArray(events)) throw new Error('provider circuit events invalid');
|
|
72
|
+
const policy=checkedPolicy(rawPolicy);
|
|
73
|
+
const observedMs=isoMs(observedAtUtc);
|
|
74
|
+
if(observedMs===null) throw new Error('provider circuit observed time invalid');
|
|
75
|
+
const state={state:'CLOSED',failure_count:0,opened_at_utc:null,next_probe_at_utc:null,next_probe_ms:null,last_success_at_utc:null,half_open_probes:0};
|
|
76
|
+
for(const event of events){
|
|
77
|
+
const eventProvider=event?.payload?.provider_id;
|
|
78
|
+
if(eventProvider!==providerId) continue;
|
|
79
|
+
if(!HEX64.test(event?.event_sha256??'')) return unavailable();
|
|
80
|
+
const ms=isoMs(event?.created_at_utc);
|
|
81
|
+
if(ms===null||ms>observedMs) return unavailable();
|
|
82
|
+
advanceTime(state,ms);
|
|
83
|
+
if(event.type==='provider_call_failed'){
|
|
84
|
+
if(!FAILURE_CLASSES.has(event.payload?.failure_class)) return unavailable();
|
|
85
|
+
if(state.state==='HALF_OPEN'){
|
|
86
|
+
state.failure_count=policy.failure_threshold;
|
|
87
|
+
openAt(state,ms,policy);
|
|
88
|
+
}else if(state.state==='OPEN'){
|
|
89
|
+
return unavailable();
|
|
90
|
+
}else{
|
|
91
|
+
state.failure_count+=1;
|
|
92
|
+
if(state.failure_count>=policy.failure_threshold) openAt(state,ms,policy);
|
|
93
|
+
}
|
|
94
|
+
}else if(event.type==='provider_call_succeeded'){
|
|
95
|
+
if(state.state==='OPEN') return unavailable();
|
|
96
|
+
state.state='CLOSED';
|
|
97
|
+
state.failure_count=0;
|
|
98
|
+
state.opened_at_utc=null;
|
|
99
|
+
state.next_probe_at_utc=null;
|
|
100
|
+
state.next_probe_ms=null;
|
|
101
|
+
state.last_success_at_utc=new Date(ms).toISOString();
|
|
102
|
+
state.half_open_probes=0;
|
|
103
|
+
}else if(event.type==='provider_probe_started'){
|
|
104
|
+
if(state.state!=='HALF_OPEN'||state.half_open_probes>=policy.half_open_probe_limit) return unavailable();
|
|
105
|
+
state.half_open_probes+=1;
|
|
106
|
+
}else if(String(event.type??'').startsWith('provider_')){
|
|
107
|
+
return unavailable();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
advanceTime(state,observedMs);
|
|
111
|
+
return publicState(state);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function providerCallDisposition(circuit){
|
|
115
|
+
if(!circuit||!PROVIDER_CIRCUIT_STATES.includes(circuit.state)) return {allowed:false,probe:false,reason:'circuit_unavailable'};
|
|
116
|
+
if(circuit.state==='UNAVAILABLE') return {allowed:false,probe:false,reason:'circuit_unavailable'};
|
|
117
|
+
if(circuit.state==='OPEN') return {allowed:false,probe:false,reason:'circuit_open'};
|
|
118
|
+
if(circuit.state==='HALF_OPEN'){
|
|
119
|
+
if(!Number.isInteger(circuit.half_open_probes)||circuit.half_open_probes<0) return {allowed:false,probe:false,reason:'circuit_unavailable'};
|
|
120
|
+
return circuit.half_open_probes===0
|
|
121
|
+
? {allowed:true,probe:true,reason:'half_open_probe'}
|
|
122
|
+
: {allowed:false,probe:false,reason:'half_open_probe_limit'};
|
|
123
|
+
}
|
|
124
|
+
return {allowed:true,probe:false,reason:'circuit_closed'};
|
|
125
|
+
}
|
|
@@ -101,8 +101,8 @@ async function rebindProcessPolicy(raw,{developmentRoot,stateRoot,releaseRoot}){
|
|
|
101
101
|
return policy;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function renderControllerConfig({currentConfig,coreRoot,workspaceRoot,processPolicyPath,codingPolicyPath,autonomousPolicyPath,hostPolicyPath}){
|
|
105
|
-
const bridge=currentConfig.Bridge??{},cloud=currentConfig.Cloud??{};
|
|
104
|
+
function renderControllerConfig({currentConfig,coreRoot,workspaceRoot,processPolicyPath,codingPolicyPath,semanticConfigPath,semanticConfigSha256,autonomousPolicyPath,hostPolicyPath}){
|
|
105
|
+
const supervisor=currentConfig.Supervisor??{},bridge=currentConfig.Bridge??{},cloud=currentConfig.Cloud??{};
|
|
106
106
|
return [
|
|
107
107
|
'@{'," Schema = 'deadbyte.controller.v1'",` CoreRoot = ${psQuote(coreRoot)}`,
|
|
108
108
|
` WorkspaceRoot = ${psQuote(workspaceRoot)}`,
|
|
@@ -114,9 +114,22 @@ function renderControllerConfig({currentConfig,coreRoot,workspaceRoot,processPol
|
|
|
114
114
|
` MachineFsRuntimeEnabled = ${psBool(currentConfig.MachineFsRuntimeEnabled)}`,
|
|
115
115
|
` ObservationRuntimeEnabled = ${psBool(currentConfig.ObservationRuntimeEnabled)}`,
|
|
116
116
|
` CodingPolicyFile = ${psQuote(codingPolicyPath)}`,
|
|
117
|
+
` SemanticLspConfigFile = ${psQuote(semanticConfigPath??'')}`,
|
|
118
|
+
` SemanticLspConfigSha256 = ${psQuote(semanticConfigSha256??'')}`,
|
|
117
119
|
` AutonomousRuntimeEnabled = ${psBool(currentConfig.AutonomousRuntimeEnabled)}`,
|
|
118
120
|
` AutonomousPolicyFile = ${psQuote(autonomousPolicyPath)}`,
|
|
121
|
+
` AutonomousSupervisorEnabled = ${psBool(currentConfig.AutonomousSupervisorEnabled===true)}`,
|
|
119
122
|
` HostPolicyFile = ${psQuote(hostPolicyPath??'')}`,
|
|
123
|
+
...(currentConfig.AutonomousSupervisorEnabled===true?[
|
|
124
|
+
' Supervisor = @{',
|
|
125
|
+
` FilePath = ${psQuote(supervisor.FilePath)}`,
|
|
126
|
+
` FileSha256 = ${psQuote(supervisor.FileSha256)}`,
|
|
127
|
+
` Arguments = ${psQuote(supervisor.Arguments)}`,
|
|
128
|
+
` WorkingDirectory = ${psQuote(supervisor.WorkingDirectory)}`,
|
|
129
|
+
` ScriptPath = ${psQuote(supervisor.ScriptPath)}`,
|
|
130
|
+
` ScriptSha256 = ${psQuote(supervisor.ScriptSha256)}`,
|
|
131
|
+
' }'
|
|
132
|
+
]:[]),
|
|
120
133
|
' Bridge = @{',
|
|
121
134
|
` FilePath = ${psQuote(bridge.FilePath)}`,
|
|
122
135
|
` FileSha256 = ${psQuote(bridge.FileSha256)}`,
|
|
@@ -147,6 +160,13 @@ export async function createGenerationBundle({stateRoot,releaseRoot,developmentR
|
|
|
147
160
|
if(typeof releaseId!=='string'||!/^[A-Za-z0-9._-]{1,96}$/.test(releaseId)) throw new Error('generation release id invalid');
|
|
148
161
|
if(typeof currentConfig?.Bridge?.FileSha256!=='string'||!HEX64.test(currentConfig.Bridge.FileSha256)) throw new Error('generation Bridge FileSha256 invalid');
|
|
149
162
|
if(typeof currentConfig?.Cloud?.FileSha256!=='string'||!HEX64.test(currentConfig.Cloud.FileSha256)) throw new Error('generation Cloud FileSha256 invalid');
|
|
163
|
+
if(currentConfig.AutonomousSupervisorEnabled===true){
|
|
164
|
+
if(currentConfig.AutonomousRuntimeEnabled!==true) throw new Error('generation autonomous supervisor requires AutonomousRuntimeEnabled');
|
|
165
|
+
const supervisor=currentConfig.Supervisor;
|
|
166
|
+
if(!supervisor||typeof supervisor!=='object') throw new Error('generation Supervisor launch specification missing');
|
|
167
|
+
for(const key of ['FilePath','Arguments','WorkingDirectory','ScriptPath']) if(typeof supervisor[key]!=='string'||supervisor[key].length<1) throw new Error(`generation Supervisor ${key} invalid`);
|
|
168
|
+
if(!HEX64.test(String(supervisor.FileSha256??''))||!HEX64.test(String(supervisor.ScriptSha256??''))) throw new Error('generation Supervisor hash invalid');
|
|
169
|
+
}
|
|
150
170
|
if(currentConfig.Cloud.Transport!==undefined){
|
|
151
171
|
const transport=String(currentConfig.Cloud.Transport);
|
|
152
172
|
const expectedDependencies=transport==='deadbyte.named-tunnel.v1'?3:transport==='deadbyte.named-tunnel.v2'?2:null;
|
|
@@ -167,6 +187,20 @@ export async function createGenerationBundle({stateRoot,releaseRoot,developmentR
|
|
|
167
187
|
}
|
|
168
188
|
if(typeof currentConfig?.Bridge?.ScriptPath!=='string'||!path.isAbsolute(currentConfig.Bridge.ScriptPath)) throw new Error('generation Bridge ScriptPath must be absolute');
|
|
169
189
|
if(typeof currentConfig?.Bridge?.ScriptSha256!=='string'||!HEX64.test(currentConfig.Bridge.ScriptSha256)) throw new Error('generation Bridge ScriptSha256 invalid');
|
|
190
|
+
const semanticSource=String(currentConfig.SemanticLspConfigFile??'');
|
|
191
|
+
const semanticExpected=String(currentConfig.SemanticLspConfigSha256??'').toLowerCase();
|
|
192
|
+
if(Boolean(semanticSource)!==Boolean(semanticExpected)) throw new Error('generation semantic LSP config path/SHA must be supplied together');
|
|
193
|
+
let semanticBytes=null,semanticConfigSha256=null;
|
|
194
|
+
if(semanticSource){
|
|
195
|
+
if(currentConfig.CodingRuntimeEnabled!==true) throw new Error('generation semantic LSP config requires CodingRuntimeEnabled');
|
|
196
|
+
if(!path.isAbsolute(semanticSource)) throw new Error('generation semantic LSP config path must be absolute');
|
|
197
|
+
if(!HEX64.test(semanticExpected)) throw new Error('generation semantic LSP config SHA-256 invalid');
|
|
198
|
+
const semanticStat=await lstat(semanticSource);
|
|
199
|
+
if(!semanticStat.isFile()||semanticStat.isSymbolicLink()) throw new Error('generation semantic LSP config source must be a regular file');
|
|
200
|
+
semanticBytes=await readFile(semanticSource);
|
|
201
|
+
semanticConfigSha256=sha256(semanticBytes);
|
|
202
|
+
if(semanticConfigSha256!==semanticExpected) throw new Error(`generation semantic LSP config SHA-256 mismatch: expected ${semanticExpected}, found ${semanticConfigSha256}`);
|
|
203
|
+
}
|
|
170
204
|
const parityScratchRoot=path.join(state,'runtime','r33-parity-scratch');
|
|
171
205
|
await mkdir(parityScratchRoot,{recursive:true});
|
|
172
206
|
const parityScratchStat=await lstat(parityScratchRoot);
|
|
@@ -188,10 +222,13 @@ export async function createGenerationBundle({stateRoot,releaseRoot,developmentR
|
|
|
188
222
|
machine_fs_runtime_enabled:currentConfig.MachineFsRuntimeEnabled===true,
|
|
189
223
|
observation_runtime_enabled:currentConfig.ObservationRuntimeEnabled===true,
|
|
190
224
|
autonomous_runtime_enabled:currentConfig.AutonomousRuntimeEnabled===true,
|
|
225
|
+
autonomous_supervisor_enabled:currentConfig.AutonomousSupervisorEnabled===true,
|
|
226
|
+
supervisor:currentConfig.AutonomousSupervisorEnabled===true?(currentConfig.Supervisor??{}):null,
|
|
191
227
|
bridge:currentConfig.Bridge??{},cloud:currentConfig.Cloud??{},
|
|
192
228
|
local_ready_uri:currentConfig.LocalReadyUri??'',url_regex:currentConfig.UrlRegex??'',
|
|
193
229
|
mcp_url_file:currentConfig.McpUrlFile??'',mcp_url_file_sha256:currentConfig.McpUrlFileSha256??'',mcp_path_file:currentConfig.McpPathFile??'',
|
|
194
230
|
start_timeout_seconds:Number(currentConfig.StartTimeoutSeconds??30),probe_timeout_seconds:Number(currentConfig.ProbeTimeoutSeconds??3),
|
|
231
|
+
semantic_lsp_config_sha256:semanticConfigSha256,
|
|
195
232
|
process_policy_sha256:processBytes?sha256(processBytes):null,
|
|
196
233
|
coding_policy_sha256:sha256(codingBytes),autonomous_policy_sha256:sha256(autonomousBytes),host_policy_sha256:hostBytes?sha256(hostBytes):null
|
|
197
234
|
});
|
|
@@ -201,20 +238,22 @@ export async function createGenerationBundle({stateRoot,releaseRoot,developmentR
|
|
|
201
238
|
const generationRoot=path.join(generationsRoot,generationId);
|
|
202
239
|
const processPath=processBytes?path.join(generationRoot,'process-policy.json'):null;
|
|
203
240
|
const codingPath=path.join(generationRoot,'coding-policy.json');
|
|
241
|
+
const semanticPath=semanticBytes?path.join(generationRoot,'semantic-lsp-config.json'):null;
|
|
204
242
|
const autonomousPath=path.join(generationRoot,'autonomous-policy.json');
|
|
205
243
|
const hostPath=host?path.join(generationRoot,'host-policy.json'):null;
|
|
206
244
|
const configPath=path.join(generationRoot,'controller-config.psd1');
|
|
207
245
|
const files=new Map([
|
|
208
246
|
['coding-policy.json',codingBytes],
|
|
209
247
|
['autonomous-policy.json',autonomousBytes],
|
|
210
|
-
['controller-config.psd1',Buffer.from(renderControllerConfig({currentConfig,coreRoot:release,workspaceRoot:workspace,processPolicyPath:processPath,codingPolicyPath:codingPath,autonomousPolicyPath:autonomousPath,hostPolicyPath:hostPath}),'utf8')]
|
|
248
|
+
['controller-config.psd1',Buffer.from(renderControllerConfig({currentConfig,coreRoot:release,workspaceRoot:workspace,processPolicyPath:processPath,codingPolicyPath:codingPath,semanticConfigPath:semanticPath,semanticConfigSha256,autonomousPolicyPath:autonomousPath,hostPolicyPath:hostPath}),'utf8')]
|
|
211
249
|
]);
|
|
250
|
+
if(semanticBytes) files.set('semantic-lsp-config.json',semanticBytes);
|
|
212
251
|
if(processBytes) files.set('process-policy.json',processBytes);
|
|
213
252
|
if(hostBytes) files.set('host-policy.json',hostBytes);
|
|
214
253
|
const manifestBytes=generationManifest(files),manifestSha256=sha256(manifestBytes);
|
|
215
254
|
if(existsSync(generationRoot)){
|
|
216
255
|
const verified=await verifyGenerationBundle(generationRoot,manifestSha256);
|
|
217
|
-
return {generation_id:generationId,generation_seed_sha256:generationSeed,generation_root:generationRoot,generation_manifest_sha256:manifestSha256,config_path:configPath,process_policy_path:processPath,coding_policy_path:codingPath,autonomous_policy_path:autonomousPath,host_policy_path:hostPath,adopted:true,...verified};
|
|
256
|
+
return {generation_id:generationId,generation_seed_sha256:generationSeed,generation_root:generationRoot,generation_manifest_sha256:manifestSha256,config_path:configPath,process_policy_path:processPath,coding_policy_path:codingPath,semantic_config_path:semanticPath,autonomous_policy_path:autonomousPath,host_policy_path:hostPath,adopted:true,...verified};
|
|
218
257
|
}
|
|
219
258
|
await mkdir(generationsRoot,{recursive:true});
|
|
220
259
|
const staging=path.join(generationsRoot,`.staging-${generationId}-${process.pid}-${randomBytes(4).toString('hex')}`);
|
|
@@ -229,5 +268,5 @@ export async function createGenerationBundle({stateRoot,releaseRoot,developmentR
|
|
|
229
268
|
throw error;
|
|
230
269
|
}
|
|
231
270
|
const verified=await verifyGenerationBundle(generationRoot,manifestSha256);
|
|
232
|
-
return {generation_id:generationId,generation_seed_sha256:generationSeed,generation_root:generationRoot,generation_manifest_sha256:manifestSha256,config_path:configPath,process_policy_path:processPath,coding_policy_path:codingPath,autonomous_policy_path:autonomousPath,host_policy_path:hostPath,adopted:false,...verified};
|
|
271
|
+
return {generation_id:generationId,generation_seed_sha256:generationSeed,generation_root:generationRoot,generation_manifest_sha256:manifestSha256,config_path:configPath,process_policy_path:processPath,coding_policy_path:codingPath,semantic_config_path:semanticPath,autonomous_policy_path:autonomousPath,host_policy_path:hostPath,adopted:false,...verified};
|
|
233
272
|
}
|
|
@@ -3,7 +3,8 @@ import { readFile } from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
6
|
-
import {
|
|
6
|
+
import { R34_EXPECTED_TOOLS } from './remote-mcp-r34-parity-client.mjs';
|
|
7
|
+
import { promptContexts, promptObservations, promptMutationEpoch } from './autonomous-live-state.mjs';
|
|
7
8
|
|
|
8
9
|
const endpointText = process.argv[2];
|
|
9
10
|
if (!endpointText) throw new Error('usage: node src/remote-mcp-autonomous-smoke-client.mjs https://host/mcp/path');
|
|
@@ -14,11 +15,34 @@ const coreRoot = path.resolve(here, '..');
|
|
|
14
15
|
const fixtureRelative = 'workspaces/autonomous-live/fixture.txt';
|
|
15
16
|
const fixtureAbsolute = path.join(coreRoot, ...fixtureRelative.split('/'));
|
|
16
17
|
const expectedFinal = 'READY\n';
|
|
18
|
+
const AUTONOMOUS_RUN_MAX_CYCLES_PER_REQUEST = 1;
|
|
19
|
+
const AUTONOMOUS_RUN_REQUEST_TIMEOUT_MS = 100000;
|
|
20
|
+
const AUTONOMOUS_RUN_MAX_REQUESTS = 64;
|
|
21
|
+
const AUTONOMOUS_TIMEOUT_RECOVERY_POLL_MS = 2000;
|
|
22
|
+
const AUTONOMOUS_TIMEOUT_RECOVERY_MAX_POLLS = 120;
|
|
23
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
17
24
|
function structured(result, label) {
|
|
18
25
|
if (result.isError) throw new Error(`${label} returned error: ${JSON.stringify(result.structuredContent ?? result.content)}`);
|
|
19
26
|
if (!result.structuredContent || typeof result.structuredContent !== 'object') throw new Error(`${label} returned no structured object`);
|
|
20
27
|
return result.structuredContent;
|
|
21
28
|
}
|
|
29
|
+
async function recoverTimedOutGoal(client, goalId) {
|
|
30
|
+
for (let poll = 0; poll < AUTONOMOUS_TIMEOUT_RECOVERY_MAX_POLLS; poll += 1) {
|
|
31
|
+
const status = structured(await client.callTool(
|
|
32
|
+
{ name:'autonomous_goal_status', arguments:{ goal_id:goalId } },
|
|
33
|
+
{ timeout:30000, maxTotalTimeout:30000 }
|
|
34
|
+
), 'autonomous_goal_status');
|
|
35
|
+
if (status.state === 'succeeded') return status;
|
|
36
|
+
if (status.state === 'cancelled' || status.state === 'paused') {
|
|
37
|
+
throw new Error(`autonomous goal became terminal after request timeout: ${JSON.stringify(status)}`);
|
|
38
|
+
}
|
|
39
|
+
if (status.state !== 'pending' && status.state !== 'running') {
|
|
40
|
+
throw new Error(`autonomous goal returned unexpected recovery state: ${JSON.stringify(status)}`);
|
|
41
|
+
}
|
|
42
|
+
await sleep(AUTONOMOUS_TIMEOUT_RECOVERY_POLL_MS);
|
|
43
|
+
}
|
|
44
|
+
throw new Error('autonomous goal did not reach a durable terminal state after request timeout');
|
|
45
|
+
}
|
|
22
46
|
function messageText(content) {
|
|
23
47
|
if (typeof content === 'string') return content;
|
|
24
48
|
if (Array.isArray(content)) return content.map(messageText).join('\n');
|
|
@@ -37,35 +61,36 @@ function parseState(prompt) {
|
|
|
37
61
|
return JSON.parse(end >= 0 ? tail.slice(0, end) : tail);
|
|
38
62
|
}
|
|
39
63
|
function latestFixtureContext(state) {
|
|
40
|
-
return [...(state
|
|
64
|
+
return [...promptContexts(state)].reverse().find(item => item.path === fixtureRelative) ?? null;
|
|
41
65
|
}
|
|
42
66
|
function latestTestObservation(state) {
|
|
43
|
-
return [...(state
|
|
67
|
+
return [...promptObservations(state)].reverse().find(item => item.profile_id === 'quick-test') ?? null;
|
|
44
68
|
}let samplingRounds = 0;
|
|
45
69
|
let sawFailureEvidence = false;
|
|
46
70
|
function plannerDecision(prompt) {
|
|
47
71
|
const state = parseState(prompt);
|
|
48
72
|
samplingRounds += 1;
|
|
73
|
+
const mutationEpoch = promptMutationEpoch(state);
|
|
49
74
|
const context = latestFixtureContext(state);
|
|
50
75
|
const testObservation = latestTestObservation(state);
|
|
51
76
|
if (testObservation?.passed === false) sawFailureEvidence = true;
|
|
52
77
|
if (!context) return { schema:'deadbyte.autonomous-decision.v1', action:'inspect', summary:'inspect live fixture before mutation',
|
|
53
78
|
reads:[{ path:fixtureRelative, max_bytes:4096 }] };
|
|
54
|
-
if (
|
|
79
|
+
if (mutationEpoch === 0 && context.content === expectedFinal) {
|
|
55
80
|
return { schema:'deadbyte.autonomous-decision.v1', action:'patch', summary:'deliberately introduce a failing state to prove diagnosis and replanning',
|
|
56
81
|
operations:[{ kind:'replace', path:fixtureRelative, expected_sha256:context.sha256,
|
|
57
82
|
old_string:'READY', new_string:'ALMOST', expected_replacements:1 }] };
|
|
58
83
|
}
|
|
59
|
-
if (
|
|
84
|
+
if (mutationEpoch === 1 && context.content !== 'ALMOST\n') {
|
|
60
85
|
return { schema:'deadbyte.autonomous-decision.v1', action:'inspect', summary:'refresh fixture after observed test failure before corrective patch',
|
|
61
86
|
reads:[{ path:fixtureRelative, max_bytes:4096 }] };
|
|
62
87
|
}
|
|
63
|
-
if (
|
|
88
|
+
if (mutationEpoch === 1 && context.content === 'ALMOST\n' && sawFailureEvidence) {
|
|
64
89
|
return { schema:'deadbyte.autonomous-decision.v1', action:'patch', summary:'repair the diagnosed fixture failure using the refreshed SHA precondition',
|
|
65
90
|
operations:[{ kind:'replace', path:fixtureRelative, expected_sha256:context.sha256,
|
|
66
91
|
old_string:'ALMOST', new_string:'READY', expected_replacements:1 }] };
|
|
67
92
|
}
|
|
68
|
-
if (
|
|
93
|
+
if (mutationEpoch >= 2 && testObservation?.passed === true) {
|
|
69
94
|
return { schema:'deadbyte.autonomous-decision.v1', action:'finish', summary:'acceptance restored and current-epoch quick test evidence passes' };
|
|
70
95
|
}
|
|
71
96
|
return { schema:'deadbyte.autonomous-decision.v1', action:'inspect', summary:'gather current fixture state before deciding next action',
|
|
@@ -88,7 +113,7 @@ try {
|
|
|
88
113
|
await client.connect(transport);
|
|
89
114
|
const listed = await client.listTools();
|
|
90
115
|
const names = listed.tools.map(tool => tool.name).sort();
|
|
91
|
-
if (JSON.stringify(names) !== JSON.stringify(
|
|
116
|
+
if (JSON.stringify(names) !== JSON.stringify(R34_EXPECTED_TOOLS)) throw new Error(`R34 public catalog mismatch: ${JSON.stringify(names)}`);
|
|
92
117
|
for (const tool of listed.tools) {
|
|
93
118
|
if (tool.outputSchema?.type !== 'object' || tool.outputSchema?.additionalProperties !== false || !tool.outputSchema?.properties) {
|
|
94
119
|
throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
@@ -105,12 +130,26 @@ try {
|
|
|
105
130
|
} }), 'autonomous_goal_submit');
|
|
106
131
|
goalId = submitted.goal_id;
|
|
107
132
|
if (!goalId || submitted.state !== 'pending') throw new Error(`autonomous submit failed: ${JSON.stringify(submitted)}`);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
133
|
+
let ran = null;
|
|
134
|
+
let recoveredRequestTimeout = false;
|
|
135
|
+
for (let requestRound = 0; requestRound < AUTONOMOUS_RUN_MAX_REQUESTS; requestRound += 1) {
|
|
136
|
+
try {
|
|
137
|
+
ran = structured(await client.callTool(
|
|
138
|
+
{ name:'autonomous_goal_run', arguments:{ goal_id:goalId, max_cycles:AUTONOMOUS_RUN_MAX_CYCLES_PER_REQUEST } },
|
|
139
|
+
{ timeout:AUTONOMOUS_RUN_REQUEST_TIMEOUT_MS, maxTotalTimeout:AUTONOMOUS_RUN_REQUEST_TIMEOUT_MS }
|
|
140
|
+
), 'autonomous_goal_run');
|
|
141
|
+
} catch (error) {
|
|
142
|
+
if (String(error?.code ?? '') !== 'REQUEST_TIMEOUT') throw error;
|
|
143
|
+
const recovered = await recoverTimedOutGoal(client, goalId);
|
|
144
|
+
ran = { status:'completed', state:recovered.state, goal_id:goalId, recovered_from_timeout:true };
|
|
145
|
+
recoveredRequestTimeout = true;
|
|
146
|
+
}
|
|
147
|
+
if (ran.status === 'completed' && ran.state === 'succeeded') break;
|
|
148
|
+
if (ran.status === 'yielded') continue;
|
|
149
|
+
throw new Error(`autonomous goal did not make resumable progress: ${JSON.stringify(ran)}`);
|
|
150
|
+
}
|
|
151
|
+
if (!ran || ran.status !== 'completed' || ran.state !== 'succeeded') {
|
|
152
|
+
throw new Error(`autonomous goal did not release within ${AUTONOMOUS_RUN_MAX_REQUESTS} bounded requests: ${JSON.stringify(ran)}`);
|
|
114
153
|
}
|
|
115
154
|
if (!sawFailureEvidence || samplingRounds < 5) throw new Error(`autonomous replanning proof missing: failure=${sawFailureEvidence} rounds=${samplingRounds}`);
|
|
116
155
|
const verified = structured(await client.callTool({ name:'autonomous_goal_verify', arguments:{ goal_id:goalId } }), 'autonomous_goal_verify');
|
|
@@ -17,10 +17,11 @@ const tag = randomBytes(8).toString('hex');
|
|
|
17
17
|
const editPath = `workspaces/demo/.deadbyte-coding-smoke-${tag}.txt`;
|
|
18
18
|
const taskPath = `workspaces/demo/.deadbyte-coding-task-${tag}.txt`;
|
|
19
19
|
const codingTools = [
|
|
20
|
-
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write',
|
|
21
|
-
'coding_receipt_verify', '
|
|
22
|
-
'
|
|
23
|
-
'
|
|
20
|
+
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write', 'coding_files_read',
|
|
21
|
+
'coding_receipt_verify', 'coding_search', 'coding_session_status', 'coding_stat',
|
|
22
|
+
'coding_symbol_definition', 'coding_symbol_outline', 'coding_symbol_references', 'coding_symbol_replace',
|
|
23
|
+
'coding_task_approve', 'coding_task_cancel', 'coding_task_events', 'coding_task_run', 'coding_task_status',
|
|
24
|
+
'coding_task_submit', 'coding_task_verify', 'coding_text_replace', 'coding_tree'
|
|
24
25
|
];
|
|
25
26
|
const client = new Client(
|
|
26
27
|
{ name: 'deadbyte-coding-remote-gate', version: '0.8.0' },
|
|
@@ -3,6 +3,7 @@ import { stat } from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
6
|
+
import { R34_EXPECTED_TOOLS } from './remote-mcp-r34-parity-client.mjs';
|
|
6
7
|
const endpointText = process.argv[2];
|
|
7
8
|
if (!endpointText) throw new Error('usage: node src/remote-mcp-r24-disarmed-smoke-client.mjs https://host/mcp/path');
|
|
8
9
|
const endpoint = new URL(endpointText);
|
|
@@ -18,7 +19,8 @@ let exists = false;
|
|
|
18
19
|
try {
|
|
19
20
|
await client.connect(transport);
|
|
20
21
|
const listed = await client.listTools();
|
|
21
|
-
|
|
22
|
+
const names=listed.tools.map(tool=>tool.name).sort();
|
|
23
|
+
if (JSON.stringify(names) !== JSON.stringify(R34_EXPECTED_TOOLS)) throw new Error(`R34 disarmed catalog mismatch: ${JSON.stringify(names)}`);
|
|
22
24
|
const session = await client.callTool({ name:'autonomous_session_status', arguments:{} });
|
|
23
25
|
const status = session.structuredContent;
|
|
24
26
|
if (!status || status.coding_armed !== false || status.autonomous_armed !== false) throw new Error(`authority still armed: ${JSON.stringify(status)}`); const deniedWrite = await client.callTool({ name:'coding_file_write', arguments:{
|
|
@@ -31,7 +33,7 @@ try {
|
|
|
31
33
|
if (deniedGoal.isError !== true) throw new Error(`autonomous submit unexpectedly allowed: ${JSON.stringify(deniedGoal.structuredContent)}`);
|
|
32
34
|
try { await stat(targetAbsolute); exists = true; } catch (error) { if (error?.code !== 'ENOENT') throw error; }
|
|
33
35
|
if (exists) throw new Error('disarmed coding mutation created a file');
|
|
34
|
-
console.log(JSON.stringify({ status:'passed', protocol_revision:client.getNegotiatedProtocolVersion(), tool_count:
|
|
36
|
+
console.log(JSON.stringify({ status:'passed', protocol_revision:client.getNegotiatedProtocolVersion(), tool_count:R34_EXPECTED_TOOLS.length,
|
|
35
37
|
coding_armed:false, autonomous_armed:false, coding_mutation_denied:true, autonomous_submit_denied:true, target_absent:true }));
|
|
36
38
|
} finally {
|
|
37
39
|
await client.close().catch(() => {});
|
|
@@ -67,7 +67,7 @@ export async function runR33Parity(endpointText) {
|
|
|
67
67
|
if (endpoint.protocol !== 'https:') throw new Error('R33 parity requires HTTPS');
|
|
68
68
|
const pointer = JSON.parse(await readFile(path.join(stateRoot, 'active-release.json'), 'utf8'));
|
|
69
69
|
const policy = await loadCodingPolicy(path.join(pointer.generation_root, 'coding-policy.json'));
|
|
70
|
-
const client = new Client({ name:'deadbyte-r33-parity', version:'0.8.
|
|
70
|
+
const client = new Client({ name:'deadbyte-r33-parity', version:'0.8.10' },
|
|
71
71
|
{ versionNegotiation:{ mode:{ pin:'2026-07-28' } } });
|
|
72
72
|
const transport = new StreamableHTTPClientTransport(endpoint);
|
|
73
73
|
const tag = randomBytes(8).toString('hex');
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
7
|
+
import { loadCodingPolicy } from './coding-plane.mjs';
|
|
8
|
+
import { verifyMachineFsReceiptFile } from './machine-fs.mjs';
|
|
9
|
+
import { verifyObservationReceiptFile } from './observation-runtime.mjs';
|
|
10
|
+
|
|
11
|
+
const groups = [
|
|
12
|
+
['contained_transform','evidence_verify','file_read','proof_execute','workspace_open'],
|
|
13
|
+
['machine_list','machine_ping','machine_revoke','machine_status'],
|
|
14
|
+
['host_exec','host_file_read','host_file_write'],
|
|
15
|
+
['agent_task_approve','agent_task_cancel','agent_task_events','agent_task_run','agent_task_status','agent_task_submit','agent_task_verify'],
|
|
16
|
+
['process_session_action','process_session_list','process_session_read','process_session_start','process_session_status','process_session_terminate'],
|
|
17
|
+
['machine_fs_delete','machine_fs_edit_exact','machine_fs_list','machine_fs_mkdir','machine_fs_move','machine_fs_read','machine_fs_stat','machine_fs_write'],
|
|
18
|
+
['machine_search_cancel','machine_search_page','machine_search_start','machine_search_status','machine_process_list','machine_system_status'],
|
|
19
|
+
['coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read','coding_receipt_verify','coding_search','coding_session_status','coding_stat','coding_symbol_definition','coding_symbol_outline','coding_symbol_references','coding_symbol_replace','coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run','coding_task_status','coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'],
|
|
20
|
+
['autonomous_goal_approve','autonomous_goal_cancel','autonomous_goal_events','autonomous_goal_run','autonomous_goal_status','autonomous_goal_submit','autonomous_goal_verify','autonomous_release_gate','autonomous_session_status','native_diff_apply','native_diff_preview','native_diff_verify']
|
|
21
|
+
];
|
|
22
|
+
export const R34_EXPECTED_TOOLS = groups.flat().sort();const here = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const repoRoot = path.resolve(here, '..');
|
|
24
|
+
const stateRoot = path.resolve(process.env.DEADBYTE_STATE_ROOT || path.join(os.homedir(), '.deadbyte-mcp'));
|
|
25
|
+
const verifyKeyPath = path.join(stateRoot, 'trust', 'ed25519-public.pem');
|
|
26
|
+
const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
27
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
28
|
+
|
|
29
|
+
function structured(result, label) {
|
|
30
|
+
if (result.isError) throw new Error(`${label} returned error: ${JSON.stringify(result.structuredContent ?? result.content)}`);
|
|
31
|
+
if (!result.structuredContent || typeof result.structuredContent !== 'object') throw new Error(`${label} missing structured output`);
|
|
32
|
+
return result.structuredContent;
|
|
33
|
+
}
|
|
34
|
+
async function verifyMachineReceipt(policy, receiptId, operation) {
|
|
35
|
+
const verified = await verifyMachineFsReceiptFile({ policy, verifyKeyPath, receiptId });
|
|
36
|
+
if (!verified.ok || verified.signature_valid !== true || verified.operation !== operation) {
|
|
37
|
+
throw new Error(`machine-fs receipt verification failed for ${operation}`);
|
|
38
|
+
}
|
|
39
|
+
return verified;
|
|
40
|
+
}
|
|
41
|
+
async function verifyObservationReceipt(policy, receiptId) {
|
|
42
|
+
const verified = await verifyObservationReceiptFile({ policy, verifyKeyPath, receiptId });
|
|
43
|
+
if (!verified.ok || verified.signature_valid !== true) throw new Error('observation receipt verification failed');
|
|
44
|
+
return verified;
|
|
45
|
+
}
|
|
46
|
+
async function fileSha(relative) {
|
|
47
|
+
return sha256(await readFile(path.join(repoRoot, ...relative.split('/'))));
|
|
48
|
+
}async function waitSearch(client, searchId) {
|
|
49
|
+
for (let attempt = 0; attempt < 200; attempt++) {
|
|
50
|
+
const status = structured(await client.callTool({ name:'machine_search_status', arguments:{ search_id:searchId } }), 'machine_search_status');
|
|
51
|
+
if (['completed','cancelled','failed'].includes(status.state)) return status;
|
|
52
|
+
await sleep(25);
|
|
53
|
+
}
|
|
54
|
+
throw new Error('machine search timeout');
|
|
55
|
+
}
|
|
56
|
+
async function waitProcessOutput(client, sessionId) {
|
|
57
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
58
|
+
const read = structured(await client.callTool({ name:'process_session_read', arguments:{ session_id:sessionId, offset:0, max_bytes:65536 } }), 'process_session_read');
|
|
59
|
+
if (Buffer.from(read.data_base64 ?? '', 'base64').toString('utf8').includes('DEADBYTE_ACTION_PING')) return read;
|
|
60
|
+
await sleep(50);
|
|
61
|
+
}
|
|
62
|
+
throw new Error('process action output timeout');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function runR34Parity(endpointText) {
|
|
66
|
+
const endpoint = new URL(endpointText);
|
|
67
|
+
if (endpoint.protocol !== 'https:') throw new Error('R34 parity requires HTTPS');
|
|
68
|
+
const pointer = JSON.parse(await readFile(path.join(stateRoot, 'active-release.json'), 'utf8'));
|
|
69
|
+
const policy = await loadCodingPolicy(path.join(pointer.generation_root, 'coding-policy.json'));
|
|
70
|
+
const client = new Client({ name:'deadbyte-r34-parity', version:'0.9.0' },
|
|
71
|
+
{ versionNegotiation:{ mode:{ pin:'2026-07-28' } } });
|
|
72
|
+
const transport = new StreamableHTTPClientTransport(endpoint);
|
|
73
|
+
const tag = randomBytes(8).toString('hex');
|
|
74
|
+
const scratchRoot = 'parity_scratch';
|
|
75
|
+
const target = `.deadbyte-r34-parity-${tag}.txt`;
|
|
76
|
+
let processSession = null;
|
|
77
|
+
let targetPresent = false;
|
|
78
|
+
const machineReceipts = [];
|
|
79
|
+
const observationReceipts = [];
|
|
80
|
+
try { await client.connect(transport);
|
|
81
|
+
const listed = await client.listTools();
|
|
82
|
+
const names = listed.tools.map(tool => tool.name).sort();
|
|
83
|
+
if (JSON.stringify(names) !== JSON.stringify(R34_EXPECTED_TOOLS)) throw new Error(`R34 catalog mismatch: ${JSON.stringify(names)}`);
|
|
84
|
+
for (const tool of listed.tools) {
|
|
85
|
+
if (tool.outputSchema?.type !== 'object' || tool.outputSchema?.additionalProperties !== false || !tool.outputSchema?.properties) {
|
|
86
|
+
throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const coding = structured(await client.callTool({ name:'coding_session_status', arguments:{} }), 'coding_session_status');
|
|
90
|
+
const autonomous = structured(await client.callTool({ name:'autonomous_session_status', arguments:{} }), 'autonomous_session_status');
|
|
91
|
+
if (coding.armed !== true || autonomous.coding_armed !== true || autonomous.autonomous_armed !== true) {
|
|
92
|
+
throw new Error('R34 parity requires coding and autonomous standing grants');
|
|
93
|
+
}
|
|
94
|
+
const tree = structured(await client.callTool({ name:'coding_tree', arguments:{ root_id:'core', path:'workspaces/demo', max_depth:2, max_entries:128 } }), 'coding_tree');
|
|
95
|
+
if (tree.status !== 'ok' || !Array.isArray(tree.entries)) throw new Error('coding_tree malformed');
|
|
96
|
+
|
|
97
|
+
const buildScript = 'scripts/autonomous-build.ps1';
|
|
98
|
+
const testScript = 'scripts/autonomous-tests.ps1';
|
|
99
|
+
const build = structured(await client.callTool({ name:'coding_command_run', arguments:{ root_id:'core', command_id:'powershell_script', script_path:buildScript, script_sha256:await fileSha(buildScript), args:[], cwd:'.', timeout_ms:120000 } }, { timeout:180000, maxTotalTimeout:180000 }), 'coding build');
|
|
100
|
+
if (build.status !== 'passed' || build.exit_code !== 0) throw new Error('coding build failed');
|
|
101
|
+
const buildVerify = structured(await client.callTool({ name:'coding_receipt_verify', arguments:{ receipt_id:build.receipt_id } }), 'coding build receipt');
|
|
102
|
+
if (buildVerify.ok !== true || buildVerify.signature_valid !== true) throw new Error('coding build receipt invalid');
|
|
103
|
+
const tests = structured(await client.callTool({ name:'coding_command_run', arguments:{ root_id:'core', command_id:'powershell_script', script_path:testScript, script_sha256:await fileSha(testScript), args:[], cwd:'.', timeout_ms:300000 } }, { timeout:360000, maxTotalTimeout:360000 }), 'coding tests');
|
|
104
|
+
if (tests.status !== 'passed' || tests.exit_code !== 0) throw new Error('coding tests failed');
|
|
105
|
+
const testVerify = structured(await client.callTool({ name:'coding_receipt_verify', arguments:{ receipt_id:tests.receipt_id } }), 'coding test receipt');
|
|
106
|
+
if (testVerify.ok !== true || testVerify.signature_valid !== true) throw new Error('coding test receipt invalid');
|
|
107
|
+
|
|
108
|
+
const initial = `needle-${tag}\n`;
|
|
109
|
+
const write = structured(await client.callTool({ name:'machine_fs_write', arguments:{ root_id:scratchRoot, path:target, content:initial, encoding:'utf8', expected_sha256:'absent' } }), 'machine_fs_write');
|
|
110
|
+
targetPresent = true;
|
|
111
|
+
machineReceipts.push(write.receipt_id);
|
|
112
|
+
await verifyMachineReceipt(policy, write.receipt_id, 'machine_fs_write');
|
|
113
|
+
const bounded = structured(await client.callTool({ name:'machine_fs_read', arguments:{ root_id:scratchRoot, path:target, offset:0, max_bytes:128, hash_file:true } }), 'machine_fs_read');
|
|
114
|
+
if (Buffer.from(bounded.data_base64, 'base64').toString('utf8') !== initial || bounded.file_sha256 !== write.sha256) throw new Error('bounded read mismatch');
|
|
115
|
+
const edit = structured(await client.callTool({ name:'machine_fs_edit_exact', arguments:{ root_id:scratchRoot, path:target, expected_sha256:write.sha256, old_string:'needle', new_string:'beta', expected_replacements:1 } }), 'machine_fs_edit_exact');
|
|
116
|
+
machineReceipts.push(edit.receipt_id);
|
|
117
|
+
await verifyMachineReceipt(policy, edit.receipt_id, 'machine_fs_edit_exact'); const stale = await client.callTool({ name:'machine_fs_edit_exact', arguments:{ root_id:scratchRoot, path:target, expected_sha256:write.sha256, old_string:'beta', new_string:'bad', expected_replacements:1 } });
|
|
118
|
+
if (stale.isError !== true) throw new Error('stale machine-fs precondition was not denied');
|
|
119
|
+
|
|
120
|
+
const searchStart = structured(await client.callTool({ name:'machine_search_start', arguments:{ root_id:scratchRoot, path:'.', pattern:tag, case_sensitive:true, max_results:20, max_files:200, max_bytes:262144, max_file_bytes:16384 } }), 'machine_search_start');
|
|
121
|
+
const searchStatus = await waitSearch(client, searchStart.search_id);
|
|
122
|
+
if (searchStatus.state !== 'completed' || !searchStatus.receipt_id) throw new Error(`search failed: ${JSON.stringify(searchStatus)}`);
|
|
123
|
+
observationReceipts.push(searchStatus.receipt_id);
|
|
124
|
+
await verifyObservationReceipt(policy, searchStatus.receipt_id);
|
|
125
|
+
const page = structured(await client.callTool({ name:'machine_search_page', arguments:{ search_id:searchStart.search_id, limit:20, cursor:null } }), 'machine_search_page');
|
|
126
|
+
if (!page.results.some(item => item.path === target)) throw new Error('search did not return parity file');
|
|
127
|
+
const system = structured(await client.callTool({ name:'machine_system_status', arguments:{} }), 'machine_system_status');
|
|
128
|
+
observationReceipts.push(system.receipt_id);
|
|
129
|
+
await verifyObservationReceipt(policy, system.receipt_id);
|
|
130
|
+
const processes = structured(await client.callTool({ name:'machine_process_list', arguments:{ limit:32, include_external:false, cursor:null } }), 'machine_process_list');
|
|
131
|
+
observationReceipts.push(processes.receipt_id);
|
|
132
|
+
await verifyObservationReceipt(policy, processes.receipt_id);
|
|
133
|
+
|
|
134
|
+
const started = structured(await client.callTool({ name:'process_session_start', arguments:{ profile_id:'ping_hold', root_id:'core', cwd:'.', args:[] } }), 'process_session_start');
|
|
135
|
+
processSession = started.session.session_id;
|
|
136
|
+
const action = structured(await client.callTool({ name:'process_session_action', arguments:{ session_id:processSession, action_id:'ping' } }), 'process_session_action');
|
|
137
|
+
const processRead = await waitProcessOutput(client, processSession);
|
|
138
|
+
const terminated = structured(await client.callTool({ name:'process_session_terminate', arguments:{ session_id:processSession } }), 'process_session_terminate');
|
|
139
|
+
if (action.action_id !== 'ping' || terminated.session.state !== 'terminated') throw new Error('owned process lifecycle failed');
|
|
140
|
+
|
|
141
|
+
const stat = structured(await client.callTool({ name:'machine_fs_stat', arguments:{ root_id:scratchRoot, path:target, hash:true } }), 'machine_fs_stat');
|
|
142
|
+
const deleted = structured(await client.callTool({ name:'machine_fs_delete', arguments:{ root_id:scratchRoot, path:target, expected_source_identity:stat.identity_sha256 } }), 'machine_fs_delete');
|
|
143
|
+
machineReceipts.push(deleted.receipt_id);
|
|
144
|
+
await verifyMachineReceipt(policy, deleted.receipt_id, 'machine_fs_delete');
|
|
145
|
+
targetPresent = false;
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
status:'passed', protocol_revision:client.getNegotiatedProtocolVersion(), tool_count:names.length,
|
|
149
|
+
strict_output_schemas:true, rdc_operation_count:0, execution_provider:'deadbyte_mcp',
|
|
150
|
+
tree_entries:tree.entries.length, bounded_read_verified:true, stale_precondition_denied:true,
|
|
151
|
+
machine_fs_receipts_verified:machineReceipts.length, observation_receipts_verified:observationReceipts.length,
|
|
152
|
+
search_result_count:page.results.length, process_session_id:processSession,
|
|
153
|
+
process_output_bytes:processRead.stream_head, process_journal_head_sha256:terminated.session.journal_head_sha256,
|
|
154
|
+
build_receipt_id:build.receipt_id, test_receipt_id:tests.receipt_id, coding_receipts_verified:2
|
|
155
|
+
}; } finally {
|
|
156
|
+
if (processSession) {
|
|
157
|
+
await client.callTool({ name:'process_session_terminate', arguments:{ session_id:processSession } }).catch(() => {});
|
|
158
|
+
}
|
|
159
|
+
if (targetPresent) {
|
|
160
|
+
try {
|
|
161
|
+
const stat = structured(await client.callTool({ name:'machine_fs_stat', arguments:{ root_id:scratchRoot, path:target, hash:false } }), 'cleanup stat');
|
|
162
|
+
if (stat.kind === 'file' && stat.identity_sha256) {
|
|
163
|
+
await client.callTool({ name:'machine_fs_delete', arguments:{ root_id:scratchRoot, path:target, expected_source_identity:stat.identity_sha256 } }).catch(() => {});
|
|
164
|
+
}
|
|
165
|
+
} catch {}
|
|
166
|
+
}
|
|
167
|
+
await client.close().catch(() => {});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
172
|
+
const endpoint = process.argv[2];
|
|
173
|
+
if (!endpoint) throw new Error('usage: node src/remote-mcp-r34-parity-client.mjs https://host/mcp/path');
|
|
174
|
+
runR34Parity(endpoint)
|
|
175
|
+
.then(result => console.log(JSON.stringify(result, null, 2)))
|
|
176
|
+
.catch(error => { console.error(error instanceof Error ? error.stack : String(error)); process.exitCode = 1; });
|
|
177
|
+
}
|
|
@@ -28,8 +28,9 @@ const agentTools = [
|
|
|
28
28
|
'agent_task_status', 'agent_task_submit', 'agent_task_verify'
|
|
29
29
|
];
|
|
30
30
|
const codingTools = [
|
|
31
|
-
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write',
|
|
31
|
+
'coding_benchmark_run', 'coding_command_run', 'coding_file_read', 'coding_file_write', 'coding_files_read',
|
|
32
32
|
'coding_receipt_verify', 'coding_search', 'coding_session_status', 'coding_stat',
|
|
33
|
+
'coding_symbol_definition', 'coding_symbol_outline', 'coding_symbol_references', 'coding_symbol_replace',
|
|
33
34
|
'coding_task_approve', 'coding_task_cancel', 'coding_task_events', 'coding_task_run',
|
|
34
35
|
'coding_task_status', 'coding_task_submit', 'coding_task_verify', 'coding_text_replace', 'coding_tree'
|
|
35
36
|
];
|