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
package/src/deadbyte-cli.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { lstat, mkdir, open, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { spawn, spawnSync } from 'node:child_process';
|
|
4
|
-
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
5
5
|
import os from 'node:os';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { defaultPublicKeyPath } from './trust.mjs';
|
|
10
10
|
import { verifyAuditChain } from './audit-verify.mjs';
|
|
11
|
+
import { openRemoteResultJournal, parseRemoteResultCursor } from './remote-result-journal.mjs';
|
|
11
12
|
|
|
12
13
|
const REMOTE_COMMANDS=new Set([
|
|
13
14
|
'menu','start','resume','park','stop','restart','status','url','test','fulltest','toggle','clean','machinetest',
|
|
@@ -22,15 +23,23 @@ const SESSION_STATUS=[
|
|
|
22
23
|
['hoststatus',/^Host plane\s*:\s*ARMED\b/m]
|
|
23
24
|
];
|
|
24
25
|
const SESSION_CLEANUP=['disarmautonomous','disarmcoding','disarmprocess','disarmhost','park'];
|
|
26
|
+
const SUPERVISOR_COMMANDS=Object.freeze({
|
|
27
|
+
start:'supervisorstart',stop:'supervisorstop',status:'supervisorstatus',recover:'supervisorrecover'
|
|
28
|
+
});
|
|
25
29
|
|
|
26
30
|
function stateRoot(){return path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));}
|
|
27
31
|
async function requireRegular(file,label){const info=await lstat(file);if(!info.isFile()||info.isSymbolicLink()) throw new Error(`${label} must be a regular non-symlink file`);return file;}
|
|
28
32
|
function printHelp(){
|
|
29
33
|
process.stdout.write([
|
|
30
34
|
'DEADBYTE MCP CLI','',
|
|
31
|
-
' npx deadbyte-mcp@latest
|
|
35
|
+
' npx deadbyte-mcp@latest mcp # stdio MCP server for local clients',
|
|
36
|
+
' npx deadbyte-mcp@latest remote # compact foreground device session',
|
|
37
|
+
' npx deadbyte-mcp@latest remote --verbose # detailed audit + bridge logs',
|
|
38
|
+
' npx deadbyte-mcp@latest remote --resume <cursor> # replay missed compact results, then reconnect',
|
|
32
39
|
' npx deadbyte-mcp@latest remote status',
|
|
33
40
|
' npx deadbyte-mcp@latest remote restart',
|
|
41
|
+
' npx deadbyte-mcp@latest supervisor status',
|
|
42
|
+
' npx deadbyte-mcp@latest supervisor recover',
|
|
34
43
|
' npx deadbyte-mcp@latest audit verify',
|
|
35
44
|
' npx deadbyte-mcp@latest audit status',''
|
|
36
45
|
].join('\n'));
|
|
@@ -43,7 +52,7 @@ async function remoteContext(){
|
|
|
43
52
|
const powershell=await requireRegular(path.join(systemRoot,'System32','WindowsPowerShell','v1.0','powershell.exe'),'Windows PowerShell');
|
|
44
53
|
return {root,launcher,powershell};
|
|
45
54
|
}
|
|
46
|
-
function invokeController(ctx,command,{capture=false,allowFailure=false}={}){
|
|
55
|
+
function invokeController(ctx,command,{capture=false,allowFailure=false,echoCaptured=true}={}){
|
|
47
56
|
const result=spawnSync(ctx.powershell,['-NoLogo','-NoProfile','-ExecutionPolicy','Bypass','-File',ctx.launcher,command],{
|
|
48
57
|
stdio:capture?['ignore','pipe','pipe']:'inherit',encoding:capture?'utf8':undefined,windowsHide:false,shell:false
|
|
49
58
|
});
|
|
@@ -51,7 +60,7 @@ function invokeController(ctx,command,{capture=false,allowFailure=false}={}){
|
|
|
51
60
|
const status=Number.isInteger(result.status)?result.status:1;
|
|
52
61
|
const stdout=capture?String(result.stdout||''):'';
|
|
53
62
|
const stderr=capture?String(result.stderr||''):'';
|
|
54
|
-
if(capture){if(stdout) process.stdout.write(stdout);if(stderr) process.stderr.write(stderr);}
|
|
63
|
+
if(capture&&echoCaptured){if(stdout) process.stdout.write(stdout);if(stderr) process.stderr.write(stderr);}
|
|
55
64
|
if(status!==0&&!allowFailure) throw new Error(`remote controller '${command}' failed exit=${status}`);
|
|
56
65
|
return {status,stdout,stderr};
|
|
57
66
|
}
|
|
@@ -68,19 +77,64 @@ async function listLogFiles(root){
|
|
|
68
77
|
}
|
|
69
78
|
return files;
|
|
70
79
|
}
|
|
71
|
-
function formatLogLine(file,line){
|
|
80
|
+
function formatLogLine(file,line,{verbose=false}={}){
|
|
72
81
|
if(!line) return null;
|
|
73
82
|
if(/^segment-\d{8}\.jsonl$/.test(path.basename(file))){
|
|
74
83
|
try{
|
|
75
84
|
const event=JSON.parse(line);
|
|
85
|
+
if(!verbose){
|
|
86
|
+
if(event.event_type!=='tool.result') return null;
|
|
87
|
+
const tool=typeof event.tool==='string'&&event.tool?event.tool:'tool';
|
|
88
|
+
return `${event.outcome?.is_error===true?'[ERR]':'[OK]'} ${tool}`;
|
|
89
|
+
}
|
|
76
90
|
const seq=Number.isInteger(event.seq)?`#${event.seq}`:'#?';
|
|
77
91
|
const request=typeof event.request_id==='string'?` ${event.request_id.slice(0,8)}`:'';
|
|
78
92
|
const tool=typeof event.tool==='string'?` ${event.tool}`:'';
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
let marker='';
|
|
94
|
+
if(event.event_type==='tool.request') marker='📥 ';
|
|
95
|
+
else if(event.event_type==='tool.result'){
|
|
96
|
+
if(event.outcome?.is_error===true) marker='📤❌ ';
|
|
97
|
+
else if(event.outcome?.is_error===false) marker='📤✅ ';
|
|
98
|
+
else marker='📤 ';
|
|
99
|
+
}
|
|
100
|
+
return `${marker}[AUDIT ${seq}] ${event.event_type||'event'}${tool}${request}`;
|
|
101
|
+
}catch{return verbose?`[AUDIT] ${line}`:null;}
|
|
81
102
|
}
|
|
103
|
+
if(!verbose) return null;
|
|
82
104
|
const label=path.basename(file).replace(/\.log$/i,'').toUpperCase();
|
|
83
|
-
|
|
105
|
+
let marker='';
|
|
106
|
+
if(/\[TOOL IN \]/.test(line)) marker='📥 ';
|
|
107
|
+
else if(/\[TOOL OUT\]/.test(line)){
|
|
108
|
+
if(/"is_error"\s*:\s*true/.test(line)) marker='📤❌ ';
|
|
109
|
+
else if(/"is_error"\s*:\s*false/.test(line)) marker='📤✅ ';
|
|
110
|
+
else marker='📤 ';
|
|
111
|
+
}
|
|
112
|
+
return `${marker}[${label}] ${line}`;
|
|
113
|
+
}
|
|
114
|
+
function remoteResultJournalPath(root,sessionId){return path.join(root,'runtime','remote-results',`${sessionId}.json`);}
|
|
115
|
+
function auditTerminalResult(file,line){
|
|
116
|
+
if(!/^segment-\d{8}\.jsonl$/.test(path.basename(file))||!line) return null;
|
|
117
|
+
let event;try{event=JSON.parse(line);}catch{return null;}
|
|
118
|
+
if(event?.event_type!=='tool.result'||typeof event.request_id!=='string'||!event.request_id||typeof event.tool!=='string'||!event.tool) return null;
|
|
119
|
+
const observed=Number.isFinite(Date.parse(event.created_at_utc))?new Date(Date.parse(event.created_at_utc)).toISOString():new Date().toISOString();
|
|
120
|
+
return {request_id:event.request_id,tool:event.tool,status:event.outcome?.is_error===true?'error':'ok',observed_at_utc:observed,
|
|
121
|
+
payload_sha256:createHash('sha256').update(Buffer.from(line,'utf8')).digest('hex')};
|
|
122
|
+
}
|
|
123
|
+
async function replayRemoteResults(root,cursor,{verbose=false}={}){
|
|
124
|
+
const parsed=parseRemoteResultCursor(cursor);
|
|
125
|
+
const file=remoteResultJournalPath(root,parsed.session_id);
|
|
126
|
+
await requireRegular(file,'remote result journal');
|
|
127
|
+
const journal=await openRemoteResultJournal({filePath:file,sessionId:parsed.session_id,maxEntries:2048});
|
|
128
|
+
let next=cursor;
|
|
129
|
+
for(;;){
|
|
130
|
+
const page=await journal.replayAfter(next,{limit:200});
|
|
131
|
+
for(const event of page.events){
|
|
132
|
+
const marker=event.status==='error'?'[ERR]':'[OK]';
|
|
133
|
+
process.stdout.write(`${verbose?'[REPLAY] ': '[REPLAY] '}${marker} ${event.tool} [cursor r1:${event.session_id}:${event.seq}]\n`);
|
|
134
|
+
}
|
|
135
|
+
next=page.next_cursor;
|
|
136
|
+
if(!page.has_more) return next;
|
|
137
|
+
}
|
|
84
138
|
}
|
|
85
139
|
async function readAppend(file,offset){
|
|
86
140
|
let info;try{info=await stat(file);}catch(error){if(error?.code==='ENOENT') return {offset:0,text:''};throw error;}
|
|
@@ -93,29 +147,42 @@ async function readAppend(file,offset){
|
|
|
93
147
|
try{await handle.read(buffer,0,length,start);}finally{await handle.close();}
|
|
94
148
|
return {offset:info.size,text:buffer.toString('utf8')};
|
|
95
149
|
}
|
|
96
|
-
async function tailRemoteLogs(root,signal){
|
|
150
|
+
async function tailRemoteLogs(root,signal,{verbose=false,journal=null}={}){
|
|
97
151
|
const offsets=new Map();
|
|
98
152
|
for(const file of await listLogFiles(root)){
|
|
99
153
|
try{offsets.set(file,(await stat(file)).size);}catch{}
|
|
100
154
|
}
|
|
101
|
-
process.stdout.write(
|
|
155
|
+
process.stdout.write(verbose
|
|
156
|
+
?'📜 [LOG] Live logs active. Press Ctrl+C to disconnect and revoke authority.\n'
|
|
157
|
+
:'[LOG] Live tool results. Ctrl+C disconnects and revokes authority.\n');
|
|
102
158
|
while(!signal.aborted){
|
|
103
159
|
for(const file of await listLogFiles(root)){
|
|
104
160
|
const prior=offsets.has(file)?offsets.get(file):0;
|
|
105
161
|
const next=await readAppend(file,prior);
|
|
106
162
|
offsets.set(file,next.offset);
|
|
107
163
|
for(const line of next.text.split(/\r?\n/)){
|
|
108
|
-
const
|
|
109
|
-
|
|
164
|
+
const terminal=auditTerminalResult(file,line);
|
|
165
|
+
let recorded=null;
|
|
166
|
+
if(terminal&&journal) recorded=await journal.recordTerminal(terminal);
|
|
167
|
+
if(recorded?.duplicate&&!verbose) continue;
|
|
168
|
+
const formatted=formatLogLine(file,line,{verbose});
|
|
169
|
+
if(!formatted) continue;
|
|
170
|
+
if(!verbose&&recorded) process.stdout.write(`${formatted} [cursor ${recorded.cursor}]\n`);
|
|
171
|
+
else process.stdout.write(`${formatted}\n`);
|
|
110
172
|
}
|
|
111
173
|
}
|
|
112
174
|
try{await sleep(250,null,{signal});}catch(error){if(error?.name!=='AbortError') throw error;}
|
|
113
175
|
}
|
|
114
176
|
}
|
|
115
|
-
async function cleanupRemoteSession(ctx){
|
|
177
|
+
async function cleanupRemoteSession(ctx,{verbose=false}={}){
|
|
116
178
|
for(const command of SESSION_CLEANUP){
|
|
117
|
-
try{
|
|
118
|
-
|
|
179
|
+
try{
|
|
180
|
+
const result=invokeController(ctx,command,verbose
|
|
181
|
+
?{allowFailure:true}
|
|
182
|
+
:{allowFailure:true,capture:true,echoCaptured:false});
|
|
183
|
+
if(result.status!==0) process.stderr.write(`⚠️ [WARN] cleanup ${command} exit=${result.status}\n`);
|
|
184
|
+
}
|
|
185
|
+
catch(error){process.stderr.write(`⚠️ [WARN] cleanup ${command}: ${String(error?.message||error)}\n`);}
|
|
119
186
|
}
|
|
120
187
|
}
|
|
121
188
|
const GUARDIAN_SCRIPT=fileURLToPath(new URL('./remote-session-guardian.mjs',import.meta.url));
|
|
@@ -136,7 +203,8 @@ async function readRemoteSessionMarker(root){
|
|
|
136
203
|
if(value?.schema==='deadbyte.remote-session.v2'){
|
|
137
204
|
if(!Number.isInteger(value?.owner_pid)||value.owner_pid<1||
|
|
138
205
|
!/^[0-9a-f]{64}$/.test(String(value?.session_nonce||''))||
|
|
139
|
-
!Number.isInteger(value?.guardian_pid)||value.guardian_pid<1
|
|
206
|
+
!Number.isInteger(value?.guardian_pid)||value.guardian_pid<1||
|
|
207
|
+
(value.result_session_id!==undefined&&!/^[0-9a-f]{24}$/.test(String(value.result_session_id)))) throw new Error('remote session marker schema invalid');
|
|
140
208
|
return value;
|
|
141
209
|
}
|
|
142
210
|
throw new Error('remote session marker schema invalid');
|
|
@@ -156,14 +224,16 @@ async function recoverRemoteSession(ctx){
|
|
|
156
224
|
}
|
|
157
225
|
throw new Error(`remote session guardian cleanup still active pid=${prior.guardian_pid}`);
|
|
158
226
|
}
|
|
159
|
-
process.stdout.write(
|
|
227
|
+
process.stdout.write(`♻️ [RECOVERY] Stale remote session pid=${ownerPid}; revoking authority before restart.\n`);
|
|
160
228
|
await cleanupRemoteSession(ctx);
|
|
161
229
|
await rm(remoteSessionMarker(ctx.root),{force:true});
|
|
162
230
|
}
|
|
163
231
|
async function claimRemoteSession(ctx){
|
|
164
232
|
const dir=path.join(ctx.root,'runtime');await mkdir(dir,{recursive:true});
|
|
165
233
|
const nonce=randomBytes(32).toString('hex');
|
|
166
|
-
const
|
|
234
|
+
const resultSessionId=randomBytes(12).toString('hex');
|
|
235
|
+
const marker={schema:'deadbyte.remote-session.v2',owner_pid:process.pid,guardian_pid:0,session_nonce:nonce,
|
|
236
|
+
result_session_id:resultSessionId,started_at_utc:new Date().toISOString()};
|
|
167
237
|
const markerPath=remoteSessionMarker(ctx.root);
|
|
168
238
|
try{await writeFile(markerPath,`${JSON.stringify(marker)}\n`,{encoding:'utf8',flag:'wx'});}
|
|
169
239
|
catch(error){if(error?.code==='EEXIST') throw new Error('remote session already claimed');throw error;}
|
|
@@ -184,14 +254,18 @@ async function claimRemoteSession(ctx){
|
|
|
184
254
|
}
|
|
185
255
|
}
|
|
186
256
|
async function releaseRemoteSession(ctx,marker){
|
|
187
|
-
let current=null;try{current=await readRemoteSessionMarker(ctx.root);}catch(error){process.stderr.write(
|
|
257
|
+
let current=null;try{current=await readRemoteSessionMarker(ctx.root);}catch(error){process.stderr.write(`⚠️ [WARN] remote session marker cleanup: ${String(error?.message||error)}\n`);return;}
|
|
188
258
|
const same=current?.schema==='deadbyte.remote-session.v2'&¤t.owner_pid===marker.owner_pid&¤t.session_nonce===marker.session_nonce;
|
|
189
259
|
if(same) await rm(remoteSessionMarker(ctx.root),{force:true});
|
|
190
260
|
}
|
|
191
|
-
async function runRemoteSession(){
|
|
261
|
+
async function runRemoteSession({verbose=false,resumeCursor=null}={}){
|
|
192
262
|
const ctx=await remoteContext();
|
|
263
|
+
if(resumeCursor!==null) await replayRemoteResults(ctx.root,resumeCursor,{verbose});
|
|
193
264
|
await recoverRemoteSession(ctx);
|
|
194
265
|
const marker=await claimRemoteSession(ctx);
|
|
266
|
+
const resultJournal=await openRemoteResultJournal({
|
|
267
|
+
filePath:remoteResultJournalPath(ctx.root,marker.result_session_id),sessionId:marker.result_session_id,maxEntries:2048
|
|
268
|
+
});
|
|
195
269
|
const aborter=new AbortController();
|
|
196
270
|
const abort=()=>aborter.abort();
|
|
197
271
|
const watchStdin=!process.stdin.isTTY;
|
|
@@ -199,33 +273,59 @@ async function runRemoteSession(){
|
|
|
199
273
|
if(watchStdin){process.stdin.once('end',abort);process.stdin.once('close',abort);process.stdin.resume();}
|
|
200
274
|
let ready=false;
|
|
201
275
|
try{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
276
|
+
if(verbose){
|
|
277
|
+
process.stdout.write('DEADBYTE MCP DEVICE SESSION\n');
|
|
278
|
+
process.stdout.write('[INFO] Starting local + remote runtime...\n');
|
|
279
|
+
for(const command of SESSION_START) invokeController(ctx,command);
|
|
280
|
+
process.stdout.write('🛡️ [AUTHORITY] Verifying runtime planes...\n');
|
|
281
|
+
}else{
|
|
282
|
+
process.stdout.write('DEADBYTE MCP\n');
|
|
283
|
+
const started=[];
|
|
284
|
+
for(const command of SESSION_START) started.push(invokeController(ctx,command,{capture:true,echoCaptured:false}));
|
|
285
|
+
const startText=started[0]?.stdout||'';
|
|
286
|
+
const url=startText.match(/^URL\s*:\s*(\S+)/m)?.[1]||'';
|
|
287
|
+
process.stdout.write('[OK] ONLINE\n');
|
|
288
|
+
if(url) process.stdout.write(`URL: ${url}\n`);
|
|
289
|
+
}
|
|
206
290
|
for(const [command,pattern] of SESSION_STATUS){
|
|
207
|
-
const result=invokeController(ctx,command,{capture:true});
|
|
291
|
+
const result=invokeController(ctx,command,{capture:true,echoCaptured:verbose});
|
|
208
292
|
if(!pattern.test(result.stdout)) throw new Error(`remote session authority verification failed: ${command} did not report ARMED`);
|
|
209
293
|
}
|
|
210
294
|
ready=true;
|
|
211
|
-
process.stdout.write('[DEVICE] DEADBYTE MCP online; all authority planes ARMED.\n');
|
|
212
|
-
|
|
295
|
+
if(verbose) process.stdout.write('[DEVICE] DEADBYTE MCP online; all authority planes ARMED.\n');
|
|
296
|
+
else process.stdout.write('[OK] Authority ARMED: process, coding, autonomous, host\n');
|
|
297
|
+
await tailRemoteLogs(ctx.root,aborter.signal,{verbose,journal:resultJournal});
|
|
213
298
|
}finally{
|
|
214
299
|
process.removeListener('SIGINT',abort);process.removeListener('SIGTERM',abort);
|
|
215
300
|
if(watchStdin){process.stdin.removeListener('end',abort);process.stdin.removeListener('close',abort);process.stdin.pause();}
|
|
216
|
-
if(ready||!aborter.signal.aborted) process.stdout.write('[INFO] Closing remote device session and revoking authority...\n');
|
|
217
|
-
await cleanupRemoteSession(ctx);
|
|
301
|
+
if(ready||!aborter.signal.aborted) process.stdout.write(verbose?'[INFO] Closing remote device session and revoking authority...\n':'[INFO] Disconnecting; revoking authority...\n');
|
|
302
|
+
await cleanupRemoteSession(ctx,{verbose});
|
|
218
303
|
await releaseRemoteSession(ctx,marker);
|
|
219
304
|
}
|
|
220
305
|
}
|
|
221
306
|
async function runRemote(args){
|
|
222
307
|
if(args.length===0){await runRemoteSession();return;}
|
|
223
|
-
if(args.length
|
|
308
|
+
if(args.length===1&&args[0]==='--verbose'){await runRemoteSession({verbose:true});return;}
|
|
309
|
+
if(args.length===2&&args[0]==='--resume'){await runRemoteSession({resumeCursor:args[1]});return;}
|
|
310
|
+
if(args.length===3&&args[0]==='--verbose'&&args[1]==='--resume'){
|
|
311
|
+
await runRemoteSession({verbose:true,resumeCursor:args[2]});return;
|
|
312
|
+
}
|
|
313
|
+
if(args.length===3&&args[0]==='--resume'&&args[2]==='--verbose'){
|
|
314
|
+
await runRemoteSession({verbose:true,resumeCursor:args[1]});return;
|
|
315
|
+
}
|
|
316
|
+
if(args.length>1) throw new Error('remote accepts one controller command, --verbose, or --resume <cursor>');
|
|
224
317
|
const command=args[0];if(!REMOTE_COMMANDS.has(command)) throw new Error(`unsupported remote command '${command}'`);
|
|
225
318
|
const ctx=await remoteContext();
|
|
226
319
|
const result=invokeController(ctx,command,{allowFailure:true});
|
|
227
320
|
process.exitCode=result.status;
|
|
228
321
|
}
|
|
322
|
+
async function runSupervisor(args){
|
|
323
|
+
const action=args[0]||'status';
|
|
324
|
+
if(args.length>1||!Object.hasOwn(SUPERVISOR_COMMANDS,action)) throw new Error(`unsupported supervisor command '${action}'`);
|
|
325
|
+
const ctx=await remoteContext();
|
|
326
|
+
const result=invokeController(ctx,SUPERVISOR_COMMANDS[action],{allowFailure:true});
|
|
327
|
+
process.exitCode=result.status;
|
|
328
|
+
}
|
|
229
329
|
async function runAudit(args){
|
|
230
330
|
const command=args[0]||'status';if(args.length>1) throw new Error('audit accepts one command');
|
|
231
331
|
if(!['verify','status'].includes(command)) throw new Error(`unsupported audit command '${command}'`);
|
|
@@ -237,7 +337,13 @@ async function runAudit(args){
|
|
|
237
337
|
async function main(argv){
|
|
238
338
|
const [command,...rest]=argv;
|
|
239
339
|
if(!command||command==='help'||command==='--help'||command==='-h'){printHelp();return;}
|
|
340
|
+
if(command==='mcp'){
|
|
341
|
+
if(rest.length) throw new Error('mcp accepts no arguments');
|
|
342
|
+
await import('./mcp-server.mjs');
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
240
345
|
if(command==='remote'){await runRemote(rest);return;}
|
|
346
|
+
if(command==='supervisor'){await runSupervisor(rest);return;}
|
|
241
347
|
if(command==='audit'){await runAudit(rest);return;}
|
|
242
348
|
throw new Error(`unknown command '${command}'`);
|
|
243
349
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const ID=/^[A-Za-z0-9._-]{1,64}$/;
|
|
2
|
+
const OP=/^[a-z][a-z0-9._-]{0,63}$/;
|
|
3
|
+
const MIME=/^[A-Za-z0-9!#$&^_.+-]+\/[A-Za-z0-9!#$&^_.+-]+$/;
|
|
4
|
+
function bound(value,name,min,max){if(!Number.isInteger(value)||value<min||value>max)throw new Error(`${name} must be an integer in [${min}, ${max}]`);return value;}
|
|
5
|
+
function validateDescriptor(value){
|
|
6
|
+
if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('document adapter must be an object');
|
|
7
|
+
if(!ID.test(value.id??''))throw new Error('document adapter id invalid');
|
|
8
|
+
if(!OP.test(value.operation??''))throw new Error('document adapter operation invalid');
|
|
9
|
+
if(!Array.isArray(value.inputMime)||value.inputMime.length<1||value.inputMime.length>16||value.inputMime.some(x=>typeof x!=='string'||!MIME.test(x)))throw new Error('document adapter inputMime invalid');
|
|
10
|
+
if(typeof value.outputMime!=='string'||!MIME.test(value.outputMime))throw new Error('document adapter outputMime invalid');
|
|
11
|
+
if(typeof value.transform!=='function')throw new Error('document adapter transform must be a function');
|
|
12
|
+
return {id:value.id,operation:value.operation,inputMime:[...new Set(value.inputMime)],outputMime:value.outputMime,transform:value.transform};
|
|
13
|
+
}
|
|
14
|
+
function metadataObject(value){
|
|
15
|
+
if(value===undefined)return {};
|
|
16
|
+
if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('document adapter metadata must be an object');
|
|
17
|
+
JSON.stringify(value);
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
export function createDocumentAdapterRegistry({maxInputBytes=8*1024*1024,maxOutputBytes=16*1024*1024}={}){
|
|
21
|
+
bound(maxInputBytes,'maxInputBytes',1,64*1024*1024); bound(maxOutputBytes,'maxOutputBytes',1,128*1024*1024);
|
|
22
|
+
const adapters=new Map();
|
|
23
|
+
function register(value){
|
|
24
|
+
const adapter=validateDescriptor(value);
|
|
25
|
+
if(adapters.has(adapter.id))throw new Error(`document adapter '${adapter.id}' already registered`);
|
|
26
|
+
adapters.set(adapter.id,adapter);
|
|
27
|
+
return {id:adapter.id};
|
|
28
|
+
}
|
|
29
|
+
function list(){return [...adapters.values()].map(a=>({id:a.id,operation:a.operation,input_mime:[...a.inputMime],output_mime:a.outputMime})).sort((a,b)=>a.id.localeCompare(b.id));}
|
|
30
|
+
async function run({adapterId,operation,inputMime,bytes}){
|
|
31
|
+
const adapter=adapters.get(adapterId);
|
|
32
|
+
if(!adapter)throw new Error(`document adapter '${adapterId}' is not registered`);
|
|
33
|
+
if(operation!==adapter.operation)throw new Error(`document adapter operation mismatch: expected ${adapter.operation}`);
|
|
34
|
+
if(!adapter.inputMime.includes(inputMime))throw new Error(`document adapter input MIME denied: ${inputMime}`);
|
|
35
|
+
if(!Buffer.isBuffer(bytes))throw new Error('document adapter input bytes must be a Buffer');
|
|
36
|
+
if(bytes.length>maxInputBytes)throw new Error(`document adapter input exceeds ${maxInputBytes} byte limit`);
|
|
37
|
+
const result=await adapter.transform({bytes:Buffer.from(bytes),inputMime,operation});
|
|
38
|
+
if(!result||!Buffer.isBuffer(result.bytes))throw new Error('document adapter transform must return Buffer bytes');
|
|
39
|
+
if(result.bytes.length>maxOutputBytes)throw new Error(`document adapter output exceeds ${maxOutputBytes} byte limit`);
|
|
40
|
+
return {status:'ok',adapter_id:adapter.id,operation:adapter.operation,input_mime:inputMime,output_mime:adapter.outputMime,bytes:Buffer.from(result.bytes),metadata:metadataObject(result.metadata)};
|
|
41
|
+
}
|
|
42
|
+
return Object.freeze({register,list,run});
|
|
43
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
|
|
5
|
+
const HEX64=/^[0-9a-f]{64}$/;
|
|
6
|
+
const sha256File=file=>createHash('sha256').update(readFileSync(file)).digest('hex');
|
|
7
|
+
const frame=value=>{const body=Buffer.from(JSON.stringify(value),'utf8');return Buffer.concat([Buffer.from(`Content-Length: ${body.length}\r\n\r\n`,'ascii'),body]);};
|
|
8
|
+
|
|
9
|
+
export function createLspStdioClient({executablePath,expectedSha256,args=[],cwd,env={},dependencies=[],requestTimeoutMs=10000,maxMessageBytes=4*1024*1024}){
|
|
10
|
+
if(typeof executablePath!=='string'||executablePath.length<1) throw new Error('LSP executable path missing');
|
|
11
|
+
if(!HEX64.test(expectedSha256??'')) throw new Error('LSP executable SHA-256 invalid');
|
|
12
|
+
const actual=sha256File(executablePath);
|
|
13
|
+
if(actual!==expectedSha256) throw new Error(`LSP executable SHA-256 mismatch: expected ${expectedSha256}, found ${actual}`);
|
|
14
|
+
if(!Array.isArray(dependencies)) throw new Error('LSP dependencies must be an array');
|
|
15
|
+
for(const dependency of dependencies){
|
|
16
|
+
if(!dependency||typeof dependency!=='object'||typeof dependency.path!=='string'||dependency.path.length<1||!HEX64.test(dependency.expectedSha256??'')) throw new Error('LSP dependency identity invalid');
|
|
17
|
+
const observed=sha256File(dependency.path);
|
|
18
|
+
if(observed!==dependency.expectedSha256) throw new Error(`LSP dependency SHA-256 mismatch: expected ${dependency.expectedSha256}, found ${observed}`);
|
|
19
|
+
}
|
|
20
|
+
if(!Array.isArray(args)||args.some(item=>typeof item!=='string')) throw new Error('LSP args must be strings');
|
|
21
|
+
if(!Number.isInteger(requestTimeoutMs)||requestTimeoutMs<1) throw new Error('LSP request timeout invalid');
|
|
22
|
+
if(!Number.isInteger(maxMessageBytes)||maxMessageBytes<256) throw new Error('LSP max message bytes invalid');
|
|
23
|
+
const child=spawn(executablePath,args,{cwd,env:{...env},stdio:['pipe','pipe','pipe'],shell:false,windowsHide:true});
|
|
24
|
+
let input=Buffer.alloc(0);
|
|
25
|
+
let nextId=1;
|
|
26
|
+
let closed=false;
|
|
27
|
+
let expectedExit=false;
|
|
28
|
+
let initialized=false;
|
|
29
|
+
let fatalError=null;
|
|
30
|
+
const pending=new Map();
|
|
31
|
+
|
|
32
|
+
const rejectAll=error=>{
|
|
33
|
+
if(!fatalError) fatalError=error;
|
|
34
|
+
for(const entry of pending.values()) { clearTimeout(entry.timer); entry.reject(error); }
|
|
35
|
+
pending.clear();
|
|
36
|
+
};
|
|
37
|
+
const fail=error=>{
|
|
38
|
+
rejectAll(error instanceof Error?error:new Error(String(error)));
|
|
39
|
+
if(!child.killed) child.kill();
|
|
40
|
+
};
|
|
41
|
+
const dispatch=message=>{
|
|
42
|
+
if(!message||typeof message!=='object') return;
|
|
43
|
+
if(message.id===undefined||message.id===null) return;
|
|
44
|
+
const entry=pending.get(message.id);
|
|
45
|
+
if(!entry) return;
|
|
46
|
+
pending.delete(message.id); clearTimeout(entry.timer);
|
|
47
|
+
if(message.error) entry.reject(new Error(`LSP error ${message.error.code??''}: ${message.error.message??'unknown'}`));
|
|
48
|
+
else entry.resolve(message.result);
|
|
49
|
+
};
|
|
50
|
+
const drain=()=>{
|
|
51
|
+
while(input.length>0){
|
|
52
|
+
const marker=input.indexOf('\r\n\r\n');
|
|
53
|
+
if(marker<0){ if(input.length>8192) fail(new Error('LSP header exceeds 8192 bytes')); return; }
|
|
54
|
+
const header=input.subarray(0,marker).toString('ascii');
|
|
55
|
+
const match=/(?:^|\r\n)Content-Length:\s*(\d+)\s*(?:\r\n|$)/i.exec(header);
|
|
56
|
+
if(!match){ fail(new Error('LSP Content-Length header missing')); return; }
|
|
57
|
+
const size=Number(match[1]);
|
|
58
|
+
if(!Number.isSafeInteger(size)||size<0){ fail(new Error('LSP Content-Length invalid')); return; }
|
|
59
|
+
if(size>maxMessageBytes){ fail(new Error(`LSP message exceeds ${maxMessageBytes} bytes`)); return; }
|
|
60
|
+
const start=marker+4;
|
|
61
|
+
if(input.length<start+size) return;
|
|
62
|
+
const body=input.subarray(start,start+size); input=input.subarray(start+size);
|
|
63
|
+
let parsed;
|
|
64
|
+
try { parsed=JSON.parse(body.toString('utf8')); }
|
|
65
|
+
catch { fail(new Error('LSP message JSON invalid')); return; }
|
|
66
|
+
dispatch(parsed);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
child.stdout.on('data',chunk=>{ if(closed) return; input=Buffer.concat([input,chunk]); drain(); });
|
|
70
|
+
child.on('error',error=>rejectAll(new Error(`LSP process error: ${error.message}`)));
|
|
71
|
+
child.on('exit',(code,signal)=>{
|
|
72
|
+
closed=true;
|
|
73
|
+
if(!expectedExit) rejectAll(new Error(`LSP process exited unexpectedly with code ${code===null?'null':code}${signal?` signal ${signal}`:''}`));
|
|
74
|
+
else rejectAll(new Error('LSP process closed'));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const send=value=>{
|
|
78
|
+
if(fatalError) throw fatalError;
|
|
79
|
+
if(closed||child.stdin.destroyed) throw new Error('LSP process is closed');
|
|
80
|
+
child.stdin.write(frame(value));
|
|
81
|
+
};
|
|
82
|
+
const request=(method,params=undefined)=>{
|
|
83
|
+
if(typeof method!=='string'||method.length<1) return Promise.reject(new Error('LSP request method missing'));
|
|
84
|
+
if(fatalError) return Promise.reject(fatalError);
|
|
85
|
+
const id=nextId++;
|
|
86
|
+
return new Promise((resolve,reject)=>{
|
|
87
|
+
const timer=setTimeout(()=>{pending.delete(id);reject(new Error(`LSP request timeout after ${requestTimeoutMs}ms: ${method}`));},requestTimeoutMs);
|
|
88
|
+
pending.set(id,{resolve,reject,timer,method});
|
|
89
|
+
try { const message={jsonrpc:'2.0',id,method}; if(params!==undefined) message.params=params; send(message); }
|
|
90
|
+
catch(error){clearTimeout(timer);pending.delete(id);reject(error);}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const notify=(method,params=undefined)=>{const message={jsonrpc:'2.0',method};if(params!==undefined)message.params=params;send(message);};
|
|
94
|
+
const initialize=async params=>{
|
|
95
|
+
const result=await request('initialize',params??{});
|
|
96
|
+
initialized=true;
|
|
97
|
+
notify('initialized',{});
|
|
98
|
+
return result;
|
|
99
|
+
};
|
|
100
|
+
const shutdown=async()=>{
|
|
101
|
+
if(expectedExit||closed) return;
|
|
102
|
+
expectedExit=true;
|
|
103
|
+
let shutdownError=null;
|
|
104
|
+
try { if(initialized) await request('shutdown'); }
|
|
105
|
+
catch(error){ shutdownError=error; }
|
|
106
|
+
try { if(!closed) notify('exit'); } catch {}
|
|
107
|
+
if(!closed) await new Promise(resolve=>{const timer=setTimeout(()=>{if(!child.killed)child.kill();resolve();},250);child.once('exit',()=>{clearTimeout(timer);resolve();});});
|
|
108
|
+
closed=true;
|
|
109
|
+
if(shutdownError) throw shutdownError;
|
|
110
|
+
};
|
|
111
|
+
return Object.freeze({initialize,notify,request,shutdown});
|
|
112
|
+
}
|
|
@@ -58,8 +58,9 @@ const stderrChunks = [];
|
|
|
58
58
|
transport.stderr?.on('data', chunk => stderrChunks.push(Buffer.from(chunk)));
|
|
59
59
|
const baseTools = ['contained_transform','evidence_verify','file_read','proof_execute','workspace_open'];
|
|
60
60
|
const codingTools = [
|
|
61
|
-
'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write',
|
|
61
|
+
'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read',
|
|
62
62
|
'coding_receipt_verify','coding_search','coding_session_status','coding_stat',
|
|
63
|
+
'coding_symbol_definition','coding_symbol_outline','coding_symbol_references','coding_symbol_replace',
|
|
63
64
|
'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run',
|
|
64
65
|
'coding_task_status','coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'
|
|
65
66
|
];
|
package/src/mcp-server.mjs
CHANGED
|
@@ -24,6 +24,8 @@ import { createProcessRuntime } from './process-runtime.mjs';
|
|
|
24
24
|
import { registerProcessTools } from './process-mcp-tools.mjs';
|
|
25
25
|
import { createCodingRuntime, loadCodingPolicy } from './coding-plane.mjs';
|
|
26
26
|
import { createCodingTaskRuntime } from './coding-task-runtime.mjs';
|
|
27
|
+
import { createSemanticCodeRuntime } from './semantic-code.mjs';
|
|
28
|
+
import { loadSemanticLspBackends, semanticConfigBindingFromEnv } from './semantic-lsp-config.mjs';
|
|
27
29
|
import { registerCodingTools } from './coding-mcp-tools.mjs';
|
|
28
30
|
import { createMachineFsRuntime } from './machine-fs.mjs';
|
|
29
31
|
import { registerMachineFsTools } from './machine-fs-mcp-tools.mjs';
|
|
@@ -36,6 +38,7 @@ import { startAutonomousSupervisor } from './autonomous-supervisor.mjs';
|
|
|
36
38
|
import { registerAutonomousTools } from './autonomous-mcp-tools.mjs';
|
|
37
39
|
import { createToolAudit, installToolAudit } from './tool-audit.mjs';
|
|
38
40
|
import { createAuditContextProvider } from './audit-context.mjs';
|
|
41
|
+
import { registerOperatorSurface } from './operator-surface.mjs';
|
|
39
42
|
import {
|
|
40
43
|
containedTransformOutputSchema,
|
|
41
44
|
evidenceVerifyOutputSchema,
|
|
@@ -99,6 +102,11 @@ if (codingRuntimeMode === '1' && !codingPolicyPath) throw new Error('DEADBYTE_CO
|
|
|
99
102
|
const codingPolicy = codingRuntimeMode === '1' ? await loadCodingPolicy(codingPolicyPath) : null;
|
|
100
103
|
const codingRuntime = codingPolicy ? createCodingRuntime({ policy: codingPolicy, signingKeyPath, verifyKeyPath }) : null;
|
|
101
104
|
const codingTaskRuntime = codingRuntime ? createCodingTaskRuntime({ codingRuntime, signingKeyPath, verifyKeyPath }) : null;
|
|
105
|
+
const semanticLspBinding = semanticConfigBindingFromEnv(process.env);
|
|
106
|
+
const semanticLsp = codingRuntime && semanticLspBinding
|
|
107
|
+
? await loadSemanticLspBackends({ ...semanticLspBinding, codingRuntime })
|
|
108
|
+
: { backends: [], required_ids: [] };
|
|
109
|
+
const semanticRuntime = codingRuntime ? createSemanticCodeRuntime({ codingRuntime, backends: semanticLsp.backends }) : null;
|
|
102
110
|
const machineFsRuntimeMode = process.env.DEADBYTE_MACHINE_FS_RUNTIME ?? '0';
|
|
103
111
|
if (!['0','1'].includes(machineFsRuntimeMode)) throw new Error('DEADBYTE_MACHINE_FS_RUNTIME must be 0 or 1');
|
|
104
112
|
if (machineFsRuntimeMode === '1' && !codingPolicy) throw new Error('DEADBYTE_MACHINE_FS_RUNTIME=1 requires DEADBYTE_CODING_RUNTIME=1');
|
|
@@ -116,6 +124,10 @@ const observationRuntime = observationRuntimeMode === '1'
|
|
|
116
124
|
|
|
117
125
|
const autonomousRuntimeMode = process.env.DEADBYTE_AUTONOMOUS_RUNTIME ?? '0';
|
|
118
126
|
if (!['0','1'].includes(autonomousRuntimeMode)) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME must be 0 or 1');
|
|
127
|
+
const autonomousSupervisorMode = process.env.DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE ?? 'in_process';
|
|
128
|
+
if (!['in_process','external'].includes(autonomousSupervisorMode)) {
|
|
129
|
+
throw new Error('DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE must be in_process or external');
|
|
130
|
+
}
|
|
119
131
|
if (autonomousRuntimeMode === '1' && !codingRuntime) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME=1 requires DEADBYTE_CODING_RUNTIME=1');
|
|
120
132
|
const localAutonomousPolicyPath = path.join(packageRoot,'controller','deadbyte-autonomous-policy.json');
|
|
121
133
|
let autonomousPolicyPath = process.env.DEADBYTE_AUTONOMOUS_POLICY ?? '';
|
|
@@ -128,7 +140,8 @@ const autonomousPolicy = autonomousRuntimeMode === '1' ? await loadAutonomousPol
|
|
|
128
140
|
const nativeDiffRuntime = autonomousPolicy ? createNativeDiffRuntime({ policy:autonomousPolicy,codingRuntime,signingKeyPath,verifyKeyPath }) : null;
|
|
129
141
|
const autonomousRuntime = autonomousPolicy ? createAutonomousRuntime({ policy:autonomousPolicy,codingRuntime,nativeDiffRuntime,
|
|
130
142
|
machineFsRuntime,observationRuntime,processRuntime,signingKeyPath,verifyKeyPath }) : null;
|
|
131
|
-
const autonomousSupervisor = autonomousRuntime && autonomousPolicy.planner.backend === 'openai_compatible'
|
|
143
|
+
const autonomousSupervisor = autonomousRuntime && autonomousPolicy.planner.backend === 'openai_compatible' &&
|
|
144
|
+
autonomousSupervisorMode === 'in_process'
|
|
132
145
|
? startAutonomousSupervisor({ runtime: autonomousRuntime, policy: autonomousPolicy })
|
|
133
146
|
: null;
|
|
134
147
|
void autonomousSupervisor;
|
|
@@ -158,6 +171,7 @@ function textResult(schema, object, isError = false) {
|
|
|
158
171
|
|
|
159
172
|
serveStdio(() => {
|
|
160
173
|
const server = new McpServer({ name: 'deadbyte-mcp', version: DEADBYTE_VERSION });
|
|
174
|
+
registerOperatorSurface(server,{packageRoot});
|
|
161
175
|
if (toolAudit) installToolAudit(server,toolAudit);
|
|
162
176
|
|
|
163
177
|
server.registerTool(
|
|
@@ -313,8 +327,8 @@ serveStdio(() => {
|
|
|
313
327
|
registerProcessTools(server, { runtime: processRuntime });
|
|
314
328
|
}
|
|
315
329
|
|
|
316
|
-
if (codingRuntime && codingTaskRuntime) {
|
|
317
|
-
registerCodingTools(server, { codingRuntime, taskRuntime: codingTaskRuntime });
|
|
330
|
+
if (codingRuntime && codingTaskRuntime && semanticRuntime) {
|
|
331
|
+
registerCodingTools(server, { codingRuntime, taskRuntime: codingTaskRuntime, semanticRuntime });
|
|
318
332
|
}
|
|
319
333
|
|
|
320
334
|
if (machineFsRuntime) {
|
|
@@ -53,8 +53,9 @@ const transport=new StdioClientTransport({command:process.execPath,args:[serverP
|
|
|
53
53
|
const stderr=[]; transport.stderr?.on('data',chunk=>stderr.push(Buffer.from(chunk)));
|
|
54
54
|
const base=['contained_transform','evidence_verify','file_read','proof_execute','workspace_open'];
|
|
55
55
|
const machine=['machine_list','machine_ping','machine_revoke','machine_status'];
|
|
56
|
-
const coding=['coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_receipt_verify','coding_search',
|
|
57
|
-
'coding_session_status','coding_stat','
|
|
56
|
+
const coding=['coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read','coding_receipt_verify','coding_search',
|
|
57
|
+
'coding_session_status','coding_stat','coding_symbol_definition','coding_symbol_outline','coding_symbol_references','coding_symbol_replace',
|
|
58
|
+
'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run','coding_task_status',
|
|
58
59
|
'coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'];
|
|
59
60
|
const observation=['machine_process_list','machine_search_cancel','machine_search_page','machine_search_start','machine_search_status','machine_system_status'];
|
|
60
61
|
const expected=[...base,...machine,...coding,...observation].sort();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import * as z from 'zod/v4';
|
|
4
|
+
|
|
5
|
+
function userMessage(text){return {messages:[{role:'user',content:{type:'text',text}}]};}
|
|
6
|
+
function workflow(goal,verb){
|
|
7
|
+
return [
|
|
8
|
+
`${verb}: ${goal}`,
|
|
9
|
+
'Read deadbyte://context only if domain vocabulary or invariants are needed.',
|
|
10
|
+
'Inspect the smallest relevant source/evidence slice; prefer semantic navigation or bounded search over whole-repo reads.',
|
|
11
|
+
'State the acceptance condition, reproduce the current behavior, then make one surgical change.',
|
|
12
|
+
'Verify with the narrow test first, then relevant regression gates. If a tool fails, change the hypothesis instead of retrying blindly.',
|
|
13
|
+
'Report observed outcome and remaining blockers; never call a claim verified without evidence.'
|
|
14
|
+
].join('\n');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function registerOperatorSurface(server,{packageRoot}){
|
|
18
|
+
if(!server||!packageRoot) throw new Error('operator surface requires server and packageRoot');
|
|
19
|
+
const contextPath=path.join(packageRoot,'CONTEXT.md');
|
|
20
|
+
const architecturePath=path.join(packageRoot,'docs','ADR-0001-PRODUCTION-BASELINE-SEAMS.md');
|
|
21
|
+
const argSchema=z.strictObject({goal:z.string().min(1).max(2000)});
|
|
22
|
+
for(const [name,title,verb] of [
|
|
23
|
+
['deadbyte.review','Review','Review the requested code or change'],
|
|
24
|
+
['deadbyte.patch','Patch','Patch the requested behavior'],
|
|
25
|
+
['deadbyte.diagnose','Diagnose','Diagnose the reported failure'],
|
|
26
|
+
['deadbyte.run-tests','Run tests','Verify the requested behavior with tests']
|
|
27
|
+
]){
|
|
28
|
+
server.registerPrompt(name,{title,description:`Compact DEADBYTE ${title.toLowerCase()} workflow with evidence-first verification.`,argsSchema:argSchema},
|
|
29
|
+
async ({goal})=>userMessage(workflow(goal,verb)));
|
|
30
|
+
}
|
|
31
|
+
server.registerResource('deadbyte-context','deadbyte://context',{
|
|
32
|
+
title:'DEADBYTE MCP Context',description:'Canonical production vocabulary, context discipline, and Final-baseline invariants.',mimeType:'text/markdown'
|
|
33
|
+
},async uri=>({contents:[{uri:uri.href,mimeType:'text/markdown',text:await readFile(contextPath,'utf8')}]}));
|
|
34
|
+
server.registerResource('deadbyte-architecture','deadbyte://architecture',{
|
|
35
|
+
title:'DEADBYTE MCP Architecture',description:'Production module seams, tracer bullet, policy, telemetry, semantic and remote decisions.',mimeType:'text/markdown'
|
|
36
|
+
},async uri=>({contents:[{uri:uri.href,mimeType:'text/markdown',text:await readFile(architecturePath,'utf8')}]}));
|
|
37
|
+
}
|