deadbyte-mcp 0.8.10 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTEXT.md +41 -0
- package/MANIFEST.SHA256 +386 -94
- package/R34-BASELINE.json +9 -0
- package/README.txt +141 -10
- package/bench/fixtures/corpus.json +36 -0
- package/bench/fixtures/r36/case-map.json +8 -0
- package/bin/WORKER-REGISTRY.txt +3 -3
- package/bin/appcontainer-stage.exe +0 -0
- package/bin/appcontainer-stage.obj +0 -0
- package/bin/bootstrap-advapi32.exe +0 -0
- package/bin/bootstrap-advapi32.obj +0 -0
- package/bin/bootstrap-exitcode.exe +0 -0
- package/bin/bootstrap-exitcode.obj +0 -0
- package/bin/bootstrap-kernel32.exe +0 -0
- package/bin/bootstrap-kernel32.obj +0 -0
- package/bin/child-control-probe.exe +0 -0
- package/bin/child-control-probe.obj +0 -0
- package/bin/child-control-stage.exe +0 -0
- package/bin/child-control-stage.obj +0 -0
- package/bin/contained-reverse-worker.exe +0 -0
- package/bin/contained-reverse-worker.obj +0 -0
- package/bin/contained-transform-worker.exe +0 -0
- package/bin/contained-transform-worker.obj +0 -0
- package/bin/containment-probe.exe +0 -0
- package/bin/containment-probe.obj +0 -0
- package/bin/deadbyte-contain.exe +0 -0
- package/bin/deadbyte-contain.obj +0 -0
- package/bin/deadbyte-exec.exe +0 -0
- package/bin/deadbyte-exec.obj +0 -0
- package/bin/deadbyte-process-host.exe +0 -0
- package/bin/deadbyte-process-host.obj +0 -0
- package/bin/deadbyte-tunnel-host.exe +0 -0
- package/bin/deadbyte-tunnel-host.obj +0 -0
- package/controller/README.TXT +12 -4
- package/controller/deadbyte-controller.config.psd1.example +14 -0
- package/controller/deadbyte-controller.ps1 +191 -20
- package/controller/deadbyte-process-policy.json +5 -5
- package/controller/deadbyte-semantic-lsp-config.json +95 -0
- package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
- package/docs/ARCHITECTURE.md +6 -5
- package/docs/R36-CAPABILITY-EVIDENCE.md +43 -0
- package/docs/superpowers/plans/2026-09-16-deadbyte-loop-engine.md +846 -0
- package/docs/superpowers/plans/2026-09-17-r35-production-successor.md +408 -0
- package/docs/superpowers/plans/2026-09-18-r36-zero-loss-autonomy.md +739 -0
- package/docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md +435 -0
- package/docs/superpowers/specs/2026-09-17-r35-production-successor-design.md +220 -0
- package/docs/superpowers/specs/2026-09-18-r36-zero-loss-autonomy-design.md +640 -0
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +50 -0
- package/node_modules/typescript/SECURITY.md +41 -0
- package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/typescript/bin/tsc +2 -0
- package/node_modules/typescript/bin/tsserver +2 -0
- package/node_modules/typescript/lib/_tsc.js +133818 -0
- package/node_modules/typescript/lib/_tsserver.js +659 -0
- package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/lib.d.ts +22 -0
- package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tsc.js +8 -0
- package/node_modules/typescript/lib/tsserver.js +8 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/node_modules/typescript/lib/typesMap.json +497 -0
- package/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/node_modules/typescript/lib/typescript.js +200276 -0
- package/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/node_modules/typescript/lib/watchGuard.js +53 -0
- package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/package.json +120 -0
- package/package.json +5 -3
- package/proof/CONTAINMENT-BUILD.txt +6 -6
- package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +29 -0
- package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +28 -0
- package/scripts/capability-benchmark.mjs +27 -0
- package/scripts/deferred-slot-operation.mjs +56 -16
- package/scripts/final-closure-verify.mjs +88 -39
- package/scripts/final-closure.mjs +63 -56
- package/scripts/gate-windows.ps1 +3 -3
- package/scripts/release-parity-tests.ps1 +9 -0
- package/scripts/release-parity.mjs +149 -139
- package/scripts/semantic-preflight.ps1 +73 -0
- package/scripts/tool-surface-snapshot.mjs +73 -0
- package/scripts/windows-gate-evidence.mjs +5 -5
- package/src/audit-verify.mjs +6 -2
- package/src/autonomous-action-reconcile.mjs +142 -0
- package/src/autonomous-context-engine.mjs +256 -0
- package/src/autonomous-live-state.mjs +17 -0
- package/src/autonomous-local-supervisor.mjs +249 -0
- package/src/autonomous-loop-state.mjs +304 -0
- package/src/autonomous-mcp-tools.mjs +5 -1
- package/src/autonomous-output-contracts.mjs +26 -7
- package/src/autonomous-plan.mjs +181 -0
- package/src/autonomous-planner-contracts.mjs +79 -0
- package/src/autonomous-planner.mjs +113 -6
- package/src/autonomous-policy.mjs +15 -2
- package/src/autonomous-progress.mjs +127 -0
- package/src/autonomous-runtime.mjs +785 -62
- package/src/autonomous-supervisor-host.mjs +70 -0
- package/src/autonomous-supervisor.mjs +31 -8
- package/src/capability-benchmark-runner.mjs +193 -0
- package/src/capability-benchmark.mjs +95 -0
- package/src/capability-ledger.mjs +158 -0
- package/src/coding-mcp-tools.mjs +65 -8
- package/src/coding-output-contracts.mjs +91 -8
- package/src/coding-plane.mjs +45 -9
- package/src/coding-search.mjs +130 -47
- package/src/compact-gateway-mcp-tools.mjs +128 -0
- package/src/compact-gateway-output-contracts.mjs +16 -0
- package/src/context-provenance.mjs +86 -0
- package/src/deadbyte-cli.mjs +145 -30
- package/src/document-adapter.mjs +43 -0
- package/src/lsp-stdio-client.mjs +112 -0
- package/src/machine-fs-smoke-client.mjs +2 -1
- package/src/machine-fs.mjs +51 -8
- package/src/mcp-server.mjs +46 -9
- package/src/native-diff-v2.mjs +337 -0
- package/src/native-diff.mjs +50 -2
- package/src/observation-smoke-client.mjs +3 -2
- package/src/operator-surface.mjs +43 -0
- package/src/process-runtime.mjs +98 -11
- package/src/process-smoke-client.mjs +11 -3
- package/src/provider-circuit.mjs +125 -0
- package/src/r36-compact-disarmed-probe.mjs +50 -0
- package/src/r36-full-surface-probe.mjs +56 -0
- package/src/release-generation.mjs +44 -5
- package/src/remote-live-log.mjs +76 -0
- package/src/remote-mcp-autonomous-smoke-client.mjs +58 -15
- package/src/remote-mcp-coding-smoke-client.mjs +5 -4
- package/src/remote-mcp-r24-disarmed-smoke-client.mjs +4 -2
- package/src/remote-mcp-r34-parity-client.mjs +177 -0
- package/src/remote-mcp-r36-parity-client.mjs +175 -0
- package/src/remote-mcp-smoke-client.mjs +113 -56
- package/src/remote-result-journal.mjs +114 -0
- package/src/runtime-update.mjs +109 -9
- package/src/search-cursor.mjs +45 -0
- package/src/semantic-backend-registry.mjs +39 -0
- package/src/semantic-code.mjs +246 -0
- package/src/semantic-lsp-backend.mjs +219 -0
- package/src/semantic-lsp-config.mjs +112 -0
- package/src/tool-surface-ledger.mjs +92 -0
- package/src/version.mjs +1 -1
- package/test/audit-verify.test.mjs +1 -1
- package/test/autonomous-action-reconcile.test.mjs +106 -0
- package/test/autonomous-adversarial.test.mjs +149 -6
- package/test/autonomous-capability-r36.test.mjs +151 -0
- package/test/autonomous-context-engine.test.mjs +181 -0
- package/test/autonomous-live-state.test.mjs +27 -0
- package/test/autonomous-local-supervisor.test.mjs +403 -0
- package/test/autonomous-loop-state.test.mjs +126 -0
- package/test/autonomous-loop-v2.test.mjs +105 -0
- package/test/autonomous-loop.test.mjs +79 -1
- package/test/autonomous-output-contract.test.mjs +54 -0
- package/test/autonomous-plan.test.mjs +101 -0
- package/test/autonomous-progress.test.mjs +106 -0
- package/test/autonomous-r34-e2e.test.mjs +338 -0
- package/test/autonomous-runtime.test.mjs +3 -3
- package/test/autonomous-supervisor-integration.test.mjs +48 -3
- package/test/capability-benchmark-r36.test.mjs +107 -0
- package/test/capability-benchmark-runner.test.mjs +49 -0
- package/test/capability-benchmark-semantic-r36.test.mjs +52 -0
- package/test/capability-benchmark.test.mjs +47 -0
- package/test/capability-claims-r36.test.mjs +23 -0
- package/test/capability-ledger-r36.test.mjs +102 -0
- package/test/cli-entrypoint.test.mjs +12 -0
- package/test/coding-catalog-consistency.test.mjs +24 -0
- package/test/coding-plane.test.mjs +3 -3
- package/test/coding-runtime.test.mjs +16 -0
- package/test/coding-search-r36.test.mjs +90 -0
- package/test/compact-catalog-r36.test.mjs +37 -0
- package/test/compact-gateway-r36.test.mjs +66 -0
- package/test/contained.test.mjs +1 -1
- package/test/context-provenance.test.mjs +61 -0
- package/test/controller-r27.test.mjs +4 -3
- package/test/controller.test.mjs +52 -0
- package/test/core.test.mjs +1 -1
- package/test/deferred-slot-operation-behavior.test.mjs +5 -1
- package/test/deferred-slot-operation.test.mjs +11 -1
- package/test/document-adapter.test.mjs +23 -0
- package/test/fixtures/lsp-framed-server.mjs +35 -0
- package/test/fixtures/semantic/cpp/compile_commands.json +4 -0
- package/test/fixtures/semantic/cpp/lib.cpp +2 -0
- package/test/fixtures/semantic/cpp/lib.hpp +2 -0
- package/test/fixtures/semantic/cpp/main.cpp +2 -0
- package/test/fixtures/semantic/python/lib.py +2 -0
- package/test/fixtures/semantic/python/main.py +2 -0
- package/test/fixtures/semantic/rust/Cargo.lock +7 -0
- package/test/fixtures/semantic/rust/Cargo.toml +8 -0
- package/test/fixtures/semantic/rust/src/lib.rs +3 -0
- package/test/fixtures/semantic/rust/src/main.rs +5 -0
- package/test/fixtures/semantic/rust/src/math.rs +3 -0
- package/test/fixtures/semantic/rust/target/.rustc_info.json +1 -0
- package/test/fixtures/semantic/rust/target/CACHEDIR.TAG +3 -0
- package/test/fixtures/semantic/rust/target/debug/.cargo-lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/dep-test-lib-semantic_rust +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/dep-test-bin-semantic_rust_bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/dep-lib-semantic_rust +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin.json +1 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/dep-bin-semantic_rust_bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/invoked.timestamp +1 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-4c168fa33c79d09c.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-6212ccd976aa3808.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-5dcd474439c54a26.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-d741378dccdef61c.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-4c168fa33c79d09c.d +5 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-6212ccd976aa3808.d +5 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-5dcd474439c54a26.d +6 -0
- package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-d741378dccdef61c.d +6 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/metadata.rmeta +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3.lock +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/dep-graph.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/query-cache.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/work-products.bin +0 -0
- package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt.lock +0 -0
- package/test/fixtures/semantic/rust/target/flycheck0/stderr +1 -0
- package/test/fixtures/semantic/rust/target/flycheck0/stdout +5 -0
- package/test/fixtures/semantic/typescript/lib.ts +3 -0
- package/test/fixtures/semantic/typescript/main.ts +2 -0
- package/test/fixtures/tool-surface-stdio-server.mjs +14 -0
- package/test/helpers/autonomous-r34-fixture.mjs +122 -0
- package/test/lsp-stdio-client.test.mjs +72 -0
- package/test/multi-file-read.test.mjs +44 -0
- package/test/native-diff-topology-r36.test.mjs +105 -0
- package/test/observation-integration.test.mjs +3 -3
- package/test/package-boundary.test.mjs +6 -0
- package/test/process-longrun-r36.test.mjs +82 -0
- package/test/process-release-gate.test.mjs +9 -0
- package/test/production-docs.test.mjs +48 -0
- package/test/prompts-resources.test.mjs +41 -0
- package/test/provider-circuit.test.mjs +93 -0
- package/test/public-autonomous-ingress-budget.test.mjs +28 -0
- package/test/r33-closeout-regression.test.mjs +4 -3
- package/test/r33-finalization.test.mjs +26 -18
- package/test/r36-finalization.test.mjs +104 -0
- package/test/r36-release-identity.test.mjs +52 -0
- package/test/release-generation.test.mjs +23 -2
- package/test/release-version.test.mjs +27 -17
- package/test/remote-live-log-r36.test.mjs +37 -0
- package/test/remote-live-log-recovery-r36.test.mjs +41 -0
- package/test/remote-r24-catalog.test.mjs +18 -4
- package/test/remote-result-journal.test.mjs +58 -0
- package/test/remote-session-cli.test.mjs +135 -30
- package/test/runtime-self-update.test.mjs +121 -1
- package/test/semantic-backend-registry.test.mjs +29 -0
- package/test/semantic-code.test.mjs +66 -0
- package/test/semantic-lsp-backend.test.mjs +108 -0
- package/test/semantic-lsp-config.test.mjs +81 -0
- package/test/semantic-lsp-readiness.test.mjs +34 -0
- package/test/semantic-lsp-transient-empty.test.mjs +32 -0
- package/test/semantic-lsp-transient-null.test.mjs +31 -0
- package/test/semantic-multilang.test.mjs +72 -0
- package/test/semantic-r36-rename.test.mjs +82 -0
- package/test/semantic-runtime-routing.test.mjs +32 -0
- package/test/semantic-server-config-integration.test.mjs +66 -0
- package/test/tool-surface-ledger.test.mjs +59 -0
- package/test/tool-surface-snapshot.test.mjs +17 -0
- package/test/tracer-bullet.test.mjs +77 -0
- package/deadbyte-mcp-0.8.9.tgz +0 -0
|
@@ -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 { R36_COMPACT_GATEWAYS, R36_COMPACT_TOOL_LIMIT } from './remote-mcp-r36-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,41 +61,42 @@ 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',
|
|
72
97
|
reads:[{ path:fixtureRelative, max_bytes:4096 }] };
|
|
73
98
|
}const client = new Client(
|
|
74
|
-
{ name:'deadbyte-
|
|
99
|
+
{ name:'deadbyte-r36-public-autonomous-gate', version:'0.10.0' },
|
|
75
100
|
{ capabilities:{ sampling:{} }, versionNegotiation:{ mode:{ pin:'2026-07-28' } },
|
|
76
101
|
inputRequired:{ autoFulfill:true, maxRounds:16 } }
|
|
77
102
|
);
|
|
@@ -88,7 +113,11 @@ 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 (
|
|
116
|
+
if (names.length > R36_COMPACT_TOOL_LIMIT) throw new Error(`R36 compact public catalog exceeds ${R36_COMPACT_TOOL_LIMIT}: ${names.length}`);
|
|
117
|
+
for (const name of R36_COMPACT_GATEWAYS) if (!names.includes(name)) throw new Error(`R36 compact public gateway missing ${name}`);
|
|
118
|
+
for (const name of ['autonomous_goal_submit','autonomous_goal_run','autonomous_goal_status','autonomous_goal_events','autonomous_goal_verify','autonomous_release_gate','autonomous_session_status','native_diff_apply','native_diff_preview','native_diff_verify']) {
|
|
119
|
+
if (!names.includes(name)) throw new Error(`R36 compact autonomous control missing ${name}`);
|
|
120
|
+
}
|
|
92
121
|
for (const tool of listed.tools) {
|
|
93
122
|
if (tool.outputSchema?.type !== 'object' || tool.outputSchema?.additionalProperties !== false || !tool.outputSchema?.properties) {
|
|
94
123
|
throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
@@ -105,12 +134,26 @@ try {
|
|
|
105
134
|
} }), 'autonomous_goal_submit');
|
|
106
135
|
goalId = submitted.goal_id;
|
|
107
136
|
if (!goalId || submitted.state !== 'pending') throw new Error(`autonomous submit failed: ${JSON.stringify(submitted)}`);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
let ran = null;
|
|
138
|
+
let recoveredRequestTimeout = false;
|
|
139
|
+
for (let requestRound = 0; requestRound < AUTONOMOUS_RUN_MAX_REQUESTS; requestRound += 1) {
|
|
140
|
+
try {
|
|
141
|
+
ran = structured(await client.callTool(
|
|
142
|
+
{ name:'autonomous_goal_run', arguments:{ goal_id:goalId, max_cycles:AUTONOMOUS_RUN_MAX_CYCLES_PER_REQUEST } },
|
|
143
|
+
{ timeout:AUTONOMOUS_RUN_REQUEST_TIMEOUT_MS, maxTotalTimeout:AUTONOMOUS_RUN_REQUEST_TIMEOUT_MS }
|
|
144
|
+
), 'autonomous_goal_run');
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (String(error?.code ?? '') !== 'REQUEST_TIMEOUT') throw error;
|
|
147
|
+
const recovered = await recoverTimedOutGoal(client, goalId);
|
|
148
|
+
ran = { status:'completed', state:recovered.state, goal_id:goalId, recovered_from_timeout:true };
|
|
149
|
+
recoveredRequestTimeout = true;
|
|
150
|
+
}
|
|
151
|
+
if (ran.status === 'completed' && ran.state === 'succeeded') break;
|
|
152
|
+
if (ran.status === 'yielded') continue;
|
|
153
|
+
throw new Error(`autonomous goal did not make resumable progress: ${JSON.stringify(ran)}`);
|
|
154
|
+
}
|
|
155
|
+
if (!ran || ran.status !== 'completed' || ran.state !== 'succeeded') {
|
|
156
|
+
throw new Error(`autonomous goal did not release within ${AUTONOMOUS_RUN_MAX_REQUESTS} bounded requests: ${JSON.stringify(ran)}`);
|
|
114
157
|
}
|
|
115
158
|
if (!sawFailureEvidence || samplingRounds < 5) throw new Error(`autonomous replanning proof missing: failure=${sawFailureEvidence} rounds=${samplingRounds}`);
|
|
116
159
|
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_diagnostics', 'coding_symbol_implementations', 'coding_symbol_outline', 'coding_symbol_references', 'coding_symbol_rename_preview', '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(() => {});
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
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 { R34_EXPECTED_TOOLS } from './remote-mcp-r34-parity-client.mjs';
|
|
8
|
+
import { loadCodingPolicy } from './coding-plane.mjs';
|
|
9
|
+
import { verifyMachineFsReceiptFile } from './machine-fs.mjs';
|
|
10
|
+
import { verifyObservationReceiptFile } from './observation-runtime.mjs';
|
|
11
|
+
|
|
12
|
+
export const R36_EXPECTED_TOOLS=Object.freeze([...new Set([
|
|
13
|
+
...R34_EXPECTED_TOOLS,
|
|
14
|
+
'coding_symbol_diagnostics','coding_symbol_implementations','coding_symbol_rename_preview'
|
|
15
|
+
])].sort());
|
|
16
|
+
if(R36_EXPECTED_TOOLS.length !== 76) throw new Error(`R36 full catalog identity mismatch: ${R36_EXPECTED_TOOLS.length}`);
|
|
17
|
+
export const R36_COMPACT_GATEWAYS=Object.freeze(['capability_manifest','coding_inspect','machine_fs','machine_observe','process_session'].sort());
|
|
18
|
+
export const R36_COMPACT_TOOL_LIMIT=42;
|
|
19
|
+
|
|
20
|
+
const here=path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const repoRoot=path.resolve(here,'..');
|
|
22
|
+
const stateRoot=path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));
|
|
23
|
+
const verifyKeyPath=path.join(stateRoot,'trust','ed25519-public.pem');
|
|
24
|
+
const sha256=bytes=>createHash('sha256').update(bytes).digest('hex');
|
|
25
|
+
const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));
|
|
26
|
+
|
|
27
|
+
function structured(result,label){
|
|
28
|
+
if(result.isError) throw new Error(`${label} returned error: ${JSON.stringify(result.structuredContent??result.content)}`);
|
|
29
|
+
if(!result.structuredContent||typeof result.structuredContent!=='object') throw new Error(`${label} missing structured output`);
|
|
30
|
+
return result.structuredContent;
|
|
31
|
+
}
|
|
32
|
+
function gateway(result,label){
|
|
33
|
+
const value=structured(result,label);
|
|
34
|
+
if(value.status!=='ok'||!value.result||typeof value.result!=='object') throw new Error(`${label} gateway status=${String(value.status)} error=${String(value.error??'')}`);
|
|
35
|
+
return value.result;
|
|
36
|
+
}
|
|
37
|
+
async function fileSha(relative){return sha256(await readFile(path.join(repoRoot,...relative.split('/'))));}
|
|
38
|
+
async function verifyMachineReceipt(policy,receiptId,operation){
|
|
39
|
+
const checked=await verifyMachineFsReceiptFile({policy,verifyKeyPath,receiptId});
|
|
40
|
+
if(!checked.ok||checked.signature_valid!==true||checked.operation!==operation) throw new Error(`machine-fs receipt verification failed for ${operation}`);
|
|
41
|
+
return checked;
|
|
42
|
+
}
|
|
43
|
+
async function verifyObservationReceipt(policy,receiptId){
|
|
44
|
+
const checked=await verifyObservationReceiptFile({policy,verifyKeyPath,receiptId});
|
|
45
|
+
if(!checked.ok||checked.signature_valid!==true) throw new Error('observation receipt verification failed');
|
|
46
|
+
return checked;
|
|
47
|
+
}
|
|
48
|
+
async function waitSearch(client,searchId){
|
|
49
|
+
for(let attempt=0;attempt<200;attempt+=1){
|
|
50
|
+
const status=gateway(await client.callTool({name:'machine_observe',arguments:{op:'search_status',search_id:searchId}}),'search_status');
|
|
51
|
+
if(['completed','cancelled','failed'].includes(status.state)) return status;
|
|
52
|
+
await sleep(25);
|
|
53
|
+
}
|
|
54
|
+
throw new Error('R36 compact search timeout');
|
|
55
|
+
}
|
|
56
|
+
async function waitProcessOutput(client,sessionId){
|
|
57
|
+
for(let attempt=0;attempt<100;attempt+=1){
|
|
58
|
+
const page=gateway(await client.callTool({name:'process_session',arguments:{op:'read',session_id:sessionId,offset:0,max_bytes:65536}}),'process read');
|
|
59
|
+
if(Buffer.from(page.data_base64??'','base64').toString('utf8').includes('DEADBYTE_ACTION_PING')) return page;
|
|
60
|
+
await sleep(50);
|
|
61
|
+
}
|
|
62
|
+
throw new Error('R36 compact process output timeout');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function runR36CompactParity(endpointText){
|
|
66
|
+
const endpoint=new URL(endpointText);
|
|
67
|
+
if(endpoint.protocol!=='https:') throw new Error('R36 compact 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-r36-compact-parity',version:'0.10.0'},{versionNegotiation:{mode:{pin:'2026-07-28'}}});
|
|
71
|
+
const transport=new StreamableHTTPClientTransport(endpoint);
|
|
72
|
+
const tag=randomBytes(8).toString('hex');
|
|
73
|
+
const scratchRoot='parity_scratch';
|
|
74
|
+
const target=`.deadbyte-r36-parity-${tag}.txt`;
|
|
75
|
+
let processSession=null,targetPresent=false;
|
|
76
|
+
const machineReceipts=[],observationReceipts=[];
|
|
77
|
+
try{
|
|
78
|
+
await client.connect(transport);
|
|
79
|
+
const listed=await client.listTools();
|
|
80
|
+
const names=listed.tools.map(tool=>tool.name).sort();
|
|
81
|
+
if(names.length>R36_COMPACT_TOOL_LIMIT) throw new Error(`R36 compact catalog exceeds ${R36_COMPACT_TOOL_LIMIT}: ${names.length}`);
|
|
82
|
+
for(const name of R36_COMPACT_GATEWAYS) if(!names.includes(name)) throw new Error(`R36 compact gateway missing ${name}`);
|
|
83
|
+
for(const tool of listed.tools){
|
|
84
|
+
if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties) throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
85
|
+
}
|
|
86
|
+
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
87
|
+
if(manifest.schema!=='deadbyte.capability-manifest.v1'||manifest.profile!=='compact'||!Array.isArray(manifest.capabilities)||!/^[0-9a-f]{64}$/.test(String(manifest.ledger_sha256??''))) throw new Error('R36 compact capability manifest malformed');
|
|
88
|
+
const required=manifest.capabilities.filter(item=>item?.production===true&&item?.host_only!==true);
|
|
89
|
+
for(const item of required){
|
|
90
|
+
if(typeof item.compact_tool!=='string'||!names.includes(item.compact_tool)) throw new Error(`compact capability route missing: ${String(item.id)}`);
|
|
91
|
+
}
|
|
92
|
+
const coding=structured(await client.callTool({name:'coding_session_status',arguments:{}}),'coding_session_status');
|
|
93
|
+
const autonomous=structured(await client.callTool({name:'autonomous_session_status',arguments:{}}),'autonomous_session_status');
|
|
94
|
+
if(coding.armed!==true||autonomous.coding_armed!==true||autonomous.autonomous_armed!==true) throw new Error('R36 compact parity requires coding and autonomous standing grants');
|
|
95
|
+
const tree=structured(await client.callTool({name:'coding_tree',arguments:{root_id:'core',path:'workspaces/demo',max_depth:2,max_entries:128}}),'coding_tree');
|
|
96
|
+
if(tree.status!=='ok'||!Array.isArray(tree.entries)) throw new Error('coding_tree malformed');
|
|
97
|
+
const stat=gateway(await client.callTool({name:'coding_inspect',arguments:{op:'stat',root_id:'core',path:'package.json',hash:true}}),'coding stat');
|
|
98
|
+
if(stat.type!=='file'||!/^[0-9a-f]{64}$/.test(String(stat.sha256??''))||!/^[0-9a-f]{64}$/.test(String(stat.observation_sha256??''))) throw new Error('coding stat identity missing');
|
|
99
|
+
const search=gateway(await client.callTool({name:'coding_inspect',arguments:{op:'search',root_id:'core',path:'src',pattern:'R36_CAPABILITY_LEDGER',target:'content',mode:'literal',case_sensitive:true,max_results:20,max_file_bytes:262144,max_scan_bytes:4194304,page_size:20,cursor:null}}),'coding search');
|
|
100
|
+
if(!Array.isArray(search.matches)||search.matches.length<1) throw new Error('coding search returned no R36 ledger match');
|
|
101
|
+
|
|
102
|
+
const buildScript='scripts/autonomous-build.ps1';
|
|
103
|
+
const testScript='scripts/release-parity-tests.ps1';
|
|
104
|
+
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');
|
|
105
|
+
if(build.status!=='passed'||build.exit_code!==0) throw new Error('R36 coding build failed');
|
|
106
|
+
const buildVerify=structured(await client.callTool({name:'coding_receipt_verify',arguments:{receipt_id:build.receipt_id}}),'coding build receipt');
|
|
107
|
+
if(buildVerify.ok!==true||buildVerify.signature_valid!==true) throw new Error('R36 coding build receipt invalid');
|
|
108
|
+
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');
|
|
109
|
+
if(tests.status!=='passed'||tests.exit_code!==0) throw new Error('R36 coding tests failed');
|
|
110
|
+
const testVerify=structured(await client.callTool({name:'coding_receipt_verify',arguments:{receipt_id:tests.receipt_id}}),'coding test receipt');
|
|
111
|
+
if(testVerify.ok!==true||testVerify.signature_valid!==true) throw new Error('R36 coding test receipt invalid');
|
|
112
|
+
|
|
113
|
+
const initial=`needle-${tag}\n`;
|
|
114
|
+
const write=gateway(await client.callTool({name:'machine_fs',arguments:{op:'write',root_id:scratchRoot,path:target,content:initial,encoding:'utf8',expected_sha256:'absent'}}),'machine_fs write');
|
|
115
|
+
targetPresent=true;machineReceipts.push(write.receipt_id);await verifyMachineReceipt(policy,write.receipt_id,'machine_fs_write');
|
|
116
|
+
const bounded=gateway(await client.callTool({name:'machine_fs',arguments:{op:'read',root_id:scratchRoot,path:target,offset:0,max_bytes:128,hash_file:true}}),'machine_fs read');
|
|
117
|
+
if(Buffer.from(bounded.data_base64,'base64').toString('utf8')!==initial||bounded.file_sha256!==write.sha256) throw new Error('R36 bounded machine read mismatch');
|
|
118
|
+
const edit=gateway(await client.callTool({name:'machine_fs',arguments:{op:'edit_exact',root_id:scratchRoot,path:target,expected_sha256:write.sha256,old_string:'needle',new_string:'beta',expected_replacements:1}}),'machine_fs edit');
|
|
119
|
+
machineReceipts.push(edit.receipt_id);await verifyMachineReceipt(policy,edit.receipt_id,'machine_fs_edit_exact');
|
|
120
|
+
const stale=await client.callTool({name:'machine_fs',arguments:{op:'edit_exact',root_id:scratchRoot,path:target,expected_sha256:write.sha256,old_string:'beta',new_string:'bad',expected_replacements:1}});
|
|
121
|
+
const staleValue=stale.structuredContent;
|
|
122
|
+
if(!staleValue||typeof staleValue!=='object') throw new Error('R36 stale machine-fs denial missing structured output');
|
|
123
|
+
if(stale.isError!==true||staleValue.status!=='denied'||!/precondition mismatch/i.test(String(staleValue.error??''))) {
|
|
124
|
+
throw new Error(`R36 stale machine-fs precondition was not denied: ${JSON.stringify(staleValue)}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const searchStart=gateway(await client.callTool({name:'machine_observe',arguments:{op:'search_start',root_id:scratchRoot,path:'.',pattern:tag,case_sensitive:true,max_results:20,max_files:200,max_bytes:262144,max_file_bytes:16384}}),'observe search start');
|
|
128
|
+
const searchStatus=await waitSearch(client,searchStart.search_id);
|
|
129
|
+
if(searchStatus.state!=='completed'||!searchStatus.receipt_id) throw new Error('R36 compact observation search failed');
|
|
130
|
+
observationReceipts.push(searchStatus.receipt_id);await verifyObservationReceipt(policy,searchStatus.receipt_id);
|
|
131
|
+
const page=gateway(await client.callTool({name:'machine_observe',arguments:{op:'search_page',search_id:searchStart.search_id,limit:20,cursor:null}}),'observe search page');
|
|
132
|
+
if(!page.results.some(item=>item.path===target)) throw new Error('R36 compact search did not return parity file');
|
|
133
|
+
const system=gateway(await client.callTool({name:'machine_observe',arguments:{op:'system_status'}}),'system status');
|
|
134
|
+
observationReceipts.push(system.receipt_id);await verifyObservationReceipt(policy,system.receipt_id);
|
|
135
|
+
const machineStatus=gateway(await client.callTool({name:'machine_observe',arguments:{op:'machine_status'}}),'machine status');
|
|
136
|
+
if(machineStatus.release_id!==pointer.release_id||machineStatus.release_manifest_sha256!==pointer.manifest_sha256) throw new Error('R36 compact machine status release mismatch');
|
|
137
|
+
|
|
138
|
+
const started=gateway(await client.callTool({name:'process_session',arguments:{op:'start',profile_id:'ping_hold',root_id:'core',cwd:'.',args:[]}}),'process start');
|
|
139
|
+
processSession=started.session_id??started.session?.session_id;
|
|
140
|
+
if(!/^[0-9a-f]{64}$/.test(String(processSession??''))) throw new Error('R36 compact process session id missing');
|
|
141
|
+
const action=gateway(await client.callTool({name:'process_session',arguments:{op:'action',session_id:processSession,action_id:'ping'}}),'process action');
|
|
142
|
+
const processRead=await waitProcessOutput(client,processSession);
|
|
143
|
+
const terminated=gateway(await client.callTool({name:'process_session',arguments:{op:'terminate',session_id:processSession}}),'process terminate');
|
|
144
|
+
const terminalState=terminated.state??terminated.session?.state;
|
|
145
|
+
if(action.action_id!=='ping'||terminalState!=='terminated') throw new Error('R36 compact process lifecycle failed');
|
|
146
|
+
|
|
147
|
+
const fsStat=gateway(await client.callTool({name:'machine_fs',arguments:{op:'stat',root_id:scratchRoot,path:target,hash:true}}),'machine_fs stat');
|
|
148
|
+
const deleted=gateway(await client.callTool({name:'machine_fs',arguments:{op:'delete',root_id:scratchRoot,path:target,expected_source_identity:fsStat.identity_sha256}}),'machine_fs delete');
|
|
149
|
+
machineReceipts.push(deleted.receipt_id);await verifyMachineReceipt(policy,deleted.receipt_id,'machine_fs_delete');targetPresent=false;
|
|
150
|
+
|
|
151
|
+
return {status:'passed',protocol_revision:client.getNegotiatedProtocolVersion(),profile:'compact',tool_count:names.length,tools:names,
|
|
152
|
+
catalog_sha256:sha256(Buffer.from(JSON.stringify(names),'utf8')),strict_output_schemas:true,ledger_sha256:manifest.ledger_sha256,
|
|
153
|
+
capability_count:manifest.capabilities.length,production_non_host_capabilities:required.length,capability_closure:true,
|
|
154
|
+
gateway_count:R36_COMPACT_GATEWAYS.length,tree_entries:tree.entries.length,coding_stat_verified:true,coding_search_result_count:search.matches.length,
|
|
155
|
+
machine_fs_receipts_verified:machineReceipts.length,observation_receipts_verified:observationReceipts.length,
|
|
156
|
+
observation_search_result_count:page.results.length,process_session_id:processSession,process_output_bytes:processRead.stream_head,
|
|
157
|
+
process_journal_head_sha256:terminated.journal_head_sha256??terminated.session?.journal_head_sha256,
|
|
158
|
+
build_receipt_id:build.receipt_id,test_receipt_id:tests.receipt_id,coding_receipts_verified:2,
|
|
159
|
+
execution_provider:'deadbyte_mcp',rdc_operation_count:0};
|
|
160
|
+
} finally {
|
|
161
|
+
if(processSession) await client.callTool({name:'process_session',arguments:{op:'terminate',session_id:processSession}}).catch(()=>{});
|
|
162
|
+
if(targetPresent){
|
|
163
|
+
try{const fsStat=gateway(await client.callTool({name:'machine_fs',arguments:{op:'stat',root_id:scratchRoot,path:target,hash:false}}),'cleanup stat');
|
|
164
|
+
if(fsStat.identity_sha256) await client.callTool({name:'machine_fs',arguments:{op:'delete',root_id:scratchRoot,path:target,expected_source_identity:fsStat.identity_sha256}}).catch(()=>{});
|
|
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-r36-parity-client.mjs https://host/mcp/path');
|
|
174
|
+
runR36CompactParity(endpoint).then(result=>console.log(JSON.stringify(result,null,2))).catch(error=>{console.error(error instanceof Error?error.stack:String(error));process.exitCode=1;});
|
|
175
|
+
}
|