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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { access } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { defaultPrivateKeyPath, defaultPublicKeyPath } from './trust.mjs';
|
|
6
|
+
import { createCodingRuntime, loadCodingPolicy } from './coding-plane.mjs';
|
|
7
|
+
import { loadAutonomousPolicy } from './autonomous-policy.mjs';
|
|
8
|
+
import { createNativeDiffRuntime } from './native-diff.mjs';
|
|
9
|
+
import { createAutonomousRuntime } from './autonomous-runtime.mjs';
|
|
10
|
+
import { startLocalSupervisorHost } from './autonomous-local-supervisor.mjs';
|
|
11
|
+
|
|
12
|
+
const packageRoot=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
13
|
+
const stateRoot=path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));
|
|
14
|
+
const signingKeyPath=process.env.DEADBYTE_SIGNING_KEY||defaultPrivateKeyPath();
|
|
15
|
+
const verifyKeyPath=process.env.DEADBYTE_VERIFY_KEY||defaultPublicKeyPath();
|
|
16
|
+
|
|
17
|
+
async function policyPath(envName,localName){
|
|
18
|
+
const explicit=process.env[envName];
|
|
19
|
+
const candidate=explicit?path.resolve(explicit):path.join(packageRoot,'controller',localName);
|
|
20
|
+
try { await access(candidate); }
|
|
21
|
+
catch { throw new Error(`${envName} policy unavailable: ${candidate}`); }
|
|
22
|
+
return candidate;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const onceMode=process.env.DEADBYTE_SUPERVISOR_ONCE??'0';
|
|
26
|
+
if(!['0','1'].includes(onceMode)) throw new Error('DEADBYTE_SUPERVISOR_ONCE must be 0 or 1');
|
|
27
|
+
const codingPolicyPath=await policyPath('DEADBYTE_CODING_POLICY','deadbyte-coding-policy.json');
|
|
28
|
+
const autonomousPolicyPath=await policyPath('DEADBYTE_AUTONOMOUS_POLICY','deadbyte-autonomous-policy.json');
|
|
29
|
+
const codingPolicy=await loadCodingPolicy(codingPolicyPath);
|
|
30
|
+
const codingRuntime=createCodingRuntime({policy:codingPolicy,signingKeyPath,verifyKeyPath});
|
|
31
|
+
const autonomousPolicy=await loadAutonomousPolicy(autonomousPolicyPath,codingPolicy);
|
|
32
|
+
const nativeDiffRuntime=createNativeDiffRuntime({policy:autonomousPolicy,codingRuntime,signingKeyPath,verifyKeyPath});
|
|
33
|
+
const autonomousRuntime=createAutonomousRuntime({policy:autonomousPolicy,codingRuntime,nativeDiffRuntime,signingKeyPath,verifyKeyPath});
|
|
34
|
+
const markerPath=path.resolve(process.env.DEADBYTE_SUPERVISOR_MARKER||path.join(autonomousPolicy.evidence_dir,'supervisor-owner.json'));
|
|
35
|
+
const host=await startLocalSupervisorHost({runtime:autonomousRuntime,policy:autonomousPolicy,markerPath,
|
|
36
|
+
idleDelayMs:750,maxCycles:32,continuous:onceMode!=='1'});
|
|
37
|
+
|
|
38
|
+
const ready={schema:'deadbyte.autonomous-supervisor-host.v1',status:'ready',pid:process.pid,
|
|
39
|
+
marker_path:markerPath,policy_sha256:autonomousPolicy.policy_sha256,state_root:stateRoot};
|
|
40
|
+
process.stdout.write(`${JSON.stringify(ready)}\n`);
|
|
41
|
+
|
|
42
|
+
let stopping=false;
|
|
43
|
+
async function stopAndExit(code=0){
|
|
44
|
+
if(stopping) return;
|
|
45
|
+
stopping=true;
|
|
46
|
+
try { await host.stop(); }
|
|
47
|
+
catch(error){ process.stderr.write(`DEADBYTE supervisor host stop failed: ${String(error)}\n`); code=1; }
|
|
48
|
+
process.exitCode=code;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if(onceMode==='1') {
|
|
52
|
+
try { await host.scanNow(); await stopAndExit(0); }
|
|
53
|
+
catch(error){ process.stderr.write(`DEADBYTE supervisor host one-pass failed: ${String(error)}\n`); await stopAndExit(1); }
|
|
54
|
+
} else {
|
|
55
|
+
await new Promise(resolve=>{
|
|
56
|
+
const keepAlive=setInterval(()=>{},60_000);
|
|
57
|
+
let finishing=false;
|
|
58
|
+
const finish=(code,error=null)=>{
|
|
59
|
+
if(finishing) return;
|
|
60
|
+
finishing=true;
|
|
61
|
+
clearInterval(keepAlive);
|
|
62
|
+
if(error) process.stderr.write(`${error?.stack??String(error)}\n`);
|
|
63
|
+
void stopAndExit(code).finally(resolve);
|
|
64
|
+
};
|
|
65
|
+
process.once('SIGINT',()=>finish(0));
|
|
66
|
+
process.once('SIGTERM',()=>finish(0));
|
|
67
|
+
process.once('uncaughtException',error=>finish(1,error));
|
|
68
|
+
process.once('unhandledRejection',error=>finish(1,error));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -2,7 +2,7 @@ import { readdir } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
const GOAL_ID_RE = /^[0-9a-f]{64}$/;
|
|
5
|
-
const TERMINAL = new Set(['succeeded', 'cancelled'
|
|
5
|
+
const TERMINAL = new Set(['succeeded', 'cancelled']);
|
|
6
6
|
|
|
7
7
|
function delay(ms, signal) {
|
|
8
8
|
if (signal?.aborted) return Promise.resolve();
|
|
@@ -22,22 +22,22 @@ async function listGoalIds(policy) {
|
|
|
22
22
|
.map(item => item.name).sort();
|
|
23
23
|
}
|
|
24
24
|
export function startAutonomousSupervisor({ runtime, policy = runtime?.policy,
|
|
25
|
-
idleDelayMs = 750, maxCycles = 32, logger = console } = {}) {
|
|
25
|
+
idleDelayMs = 750, maxCycles = 32, logger = console, continuous = true } = {}) {
|
|
26
26
|
if (!runtime || !policy) throw new Error('autonomous supervisor requires runtime + policy');
|
|
27
|
-
|
|
28
|
-
throw new Error('autonomous supervisor requires openai_compatible planner backend');
|
|
29
|
-
}
|
|
27
|
+
const providerBacked = policy.planner.backend === 'openai_compatible';
|
|
30
28
|
if (!Number.isInteger(idleDelayMs) || idleDelayMs < 25 || idleDelayMs > 60_000) {
|
|
31
29
|
throw new Error('autonomous supervisor idleDelayMs out of range');
|
|
32
30
|
}
|
|
33
31
|
if (!Number.isInteger(maxCycles) || maxCycles < 1 || maxCycles > 32) {
|
|
34
32
|
throw new Error('autonomous supervisor maxCycles out of range');
|
|
35
33
|
}
|
|
34
|
+
if (typeof continuous !== 'boolean') throw new Error('autonomous supervisor continuous must be boolean');
|
|
36
35
|
const abort = new AbortController();
|
|
37
36
|
const failures = new Map();
|
|
38
37
|
let passes = 0;
|
|
39
38
|
|
|
40
39
|
async function pass() {
|
|
40
|
+
if (!providerBacked) { passes += 1; return 0; }
|
|
41
41
|
let runnable = 0;
|
|
42
42
|
for (const goalId of await listGoalIds(policy)) {
|
|
43
43
|
if (abort.signal.aborted) break;
|
|
@@ -45,12 +45,35 @@ export function startAutonomousSupervisor({ runtime, policy = runtime?.policy,
|
|
|
45
45
|
try { status = await runtime.status({ goalId }); }
|
|
46
46
|
catch (error) { logger.warn?.(`DEADBYTE supervisor status ${goalId}: ${String(error)}`); continue; }
|
|
47
47
|
if (TERMINAL.has(status.state)) { failures.delete(goalId); continue; }
|
|
48
|
+
if (status.state === 'paused' && status.reason !== 'provider_circuit_open') {
|
|
49
|
+
failures.delete(goalId); continue;
|
|
50
|
+
}
|
|
51
|
+
if (status.state === 'paused' && status.reason === 'provider_circuit_open') {
|
|
52
|
+
let circuit;
|
|
53
|
+
try { circuit=await runtime.providerCircuitStatus({goalId}); }
|
|
54
|
+
catch (error) { logger.warn?.(`DEADBYTE supervisor circuit ${goalId}: ${String(error)}`); continue; }
|
|
55
|
+
const probeAt=Date.parse(circuit?.next_probe_at_utc ?? '');
|
|
56
|
+
if (circuit?.state === 'OPEN' && Number.isFinite(probeAt) && Date.now() < probeAt) {
|
|
57
|
+
failures.set(goalId,{count:0,retry_at:probeAt,error:'provider_circuit_open'});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!['HALF_OPEN','CLOSED'].includes(circuit?.state)) {
|
|
61
|
+
failures.delete(goalId); continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
48
64
|
runnable += 1;
|
|
49
65
|
const failure = failures.get(goalId);
|
|
50
66
|
if (failure && Date.now() < failure.retry_at) continue;
|
|
51
67
|
try {
|
|
52
68
|
const result = await runtime.run({ goalId, maxCycles });
|
|
53
|
-
|
|
69
|
+
if (result.status === 'paused' && result.reason === 'provider_circuit_open') {
|
|
70
|
+
const circuit=await runtime.providerCircuitStatus({goalId});
|
|
71
|
+
const probeAt=Date.parse(circuit?.next_probe_at_utc ?? '');
|
|
72
|
+
failures.set(goalId,{count:0,retry_at:Number.isFinite(probeAt)?probeAt:Date.now()+idleDelayMs,
|
|
73
|
+
error:'provider_circuit_open'});
|
|
74
|
+
} else {
|
|
75
|
+
failures.delete(goalId);
|
|
76
|
+
}
|
|
54
77
|
if (result.status === 'input_required') {
|
|
55
78
|
throw new Error('provider-backed supervisor unexpectedly requested client sampling');
|
|
56
79
|
}
|
|
@@ -66,7 +89,7 @@ export function startAutonomousSupervisor({ runtime, policy = runtime?.policy,
|
|
|
66
89
|
return runnable;
|
|
67
90
|
}
|
|
68
91
|
|
|
69
|
-
const done = (async () => {
|
|
92
|
+
const done = continuous ? (async () => {
|
|
70
93
|
while (!abort.signal.aborted) {
|
|
71
94
|
let runnable = 0;
|
|
72
95
|
try { runnable = await pass(); }
|
|
@@ -74,7 +97,7 @@ export function startAutonomousSupervisor({ runtime, policy = runtime?.policy,
|
|
|
74
97
|
if (abort.signal.aborted) break;
|
|
75
98
|
await delay(runnable > 0 ? 25 : idleDelayMs, abort.signal);
|
|
76
99
|
}
|
|
77
|
-
})();
|
|
100
|
+
})() : Promise.resolve();
|
|
78
101
|
|
|
79
102
|
return Object.freeze({
|
|
80
103
|
get running() { return !abort.signal.aborted; },
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { canonicalJson } from './canonical-json.mjs';
|
|
7
|
+
import { buildCapabilityBenchmark, buildR36CapabilityBenchmark } from './capability-benchmark.mjs';
|
|
8
|
+
|
|
9
|
+
const sha256=bytes=>createHash('sha256').update(bytes).digest('hex');
|
|
10
|
+
const TEST_TIMEOUT_MS=180_000;
|
|
11
|
+
|
|
12
|
+
export const R35_BENCHMARK_CASE_IDS=Object.freeze([
|
|
13
|
+
'filesystem_bounded_read','exact_edit_stale_reject','paged_search','process_owned_lifecycle',
|
|
14
|
+
'semantic_typescript','semantic_python','semantic_rust','semantic_cpp','context_provenance',
|
|
15
|
+
'autonomous_fail_repair','remote_replay_dedupe'
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const DEFINITIONS=Object.freeze([
|
|
19
|
+
{case_id:'filesystem_bounded_read',test_files:['test/multi-file-read.test.mjs'],fixture_files:['test/multi-file-read.test.mjs'],round_trips:2,stale_rejected:false,recovery_success:true},
|
|
20
|
+
{case_id:'exact_edit_stale_reject',test_files:['test/coding-plane.test.mjs','test/native-diff.test.mjs'],fixture_files:['test/coding-plane.test.mjs','test/native-diff.test.mjs'],round_trips:4,stale_rejected:true,recovery_success:true},
|
|
21
|
+
{case_id:'paged_search',test_files:['test/observation-runtime.test.mjs'],fixture_files:['test/observation-runtime.test.mjs'],round_trips:4,stale_rejected:false,recovery_success:true},
|
|
22
|
+
{case_id:'process_owned_lifecycle',test_files:['test/process-runtime.test.mjs'],fixture_files:['test/process-runtime.test.mjs'],round_trips:6,stale_rejected:true,recovery_success:true},
|
|
23
|
+
{case_id:'semantic_typescript',test_files:['test/semantic-code.test.mjs'],fixture_files:['test/semantic-code.test.mjs','test/fixtures/semantic/typescript'],round_trips:5,stale_rejected:true,recovery_success:true},
|
|
24
|
+
{case_id:'semantic_python',test_files:['test/semantic-multilang.test.mjs'],fixture_files:['test/semantic-multilang.test.mjs','test/fixtures/semantic/python'],test_name_pattern:'R35 python semantic tracer',requires_semantic_config:true,round_trips:5,stale_rejected:true,recovery_success:true},
|
|
25
|
+
{case_id:'semantic_rust',test_files:['test/semantic-multilang.test.mjs'],fixture_files:['test/semantic-multilang.test.mjs','test/fixtures/semantic/rust'],test_name_pattern:'R35 rust semantic tracer',requires_semantic_config:true,round_trips:5,stale_rejected:true,recovery_success:true},
|
|
26
|
+
{case_id:'semantic_cpp',test_files:['test/semantic-multilang.test.mjs'],fixture_files:['test/semantic-multilang.test.mjs','test/fixtures/semantic/cpp'],test_name_pattern:'R35 cpp semantic tracer',requires_semantic_config:true,round_trips:5,stale_rejected:true,recovery_success:true},
|
|
27
|
+
{case_id:'context_provenance',test_files:['test/context-provenance.test.mjs','test/autonomous-context-engine.test.mjs'],fixture_files:['test/context-provenance.test.mjs','test/autonomous-context-engine.test.mjs'],round_trips:2,stale_rejected:false,recovery_success:true},
|
|
28
|
+
{case_id:'autonomous_fail_repair',test_files:['test/autonomous-r34-e2e.test.mjs','test/autonomous-loop-v2.test.mjs'],fixture_files:['test/autonomous-r34-e2e.test.mjs','test/autonomous-loop-v2.test.mjs','test/helpers/autonomous-r34-fixture.mjs'],test_name_pattern:'(?:multi-step fail replan repair finish|failed VERIFY enters CRITIC|REPAIR must change)',round_trips:8,stale_rejected:true,recovery_success:true},
|
|
29
|
+
{case_id:'remote_replay_dedupe',test_files:['test/remote-result-journal.test.mjs','test/remote-session-cli.test.mjs'],fixture_files:['test/remote-result-journal.test.mjs','test/remote-session-cli.test.mjs'],test_name_pattern:'(?:duplicate terminal results|remote --resume replays)',round_trips:4,stale_rejected:false,recovery_success:true}
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export function benchmarkCaseDefinitions(){
|
|
33
|
+
return DEFINITIONS.map(item=>({
|
|
34
|
+
...structuredClone(item),
|
|
35
|
+
fixture_files:['bench/fixtures/corpus.json',...item.fixture_files]
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function collectFiles(root,relative){
|
|
40
|
+
const absolute=path.resolve(root,relative);
|
|
41
|
+
const info=await stat(absolute);
|
|
42
|
+
if(info.isFile()) return [{relative:relative.replaceAll('\\','/'),absolute}];
|
|
43
|
+
if(!info.isDirectory()) throw new Error(`benchmark fixture '${relative}' is not file/directory`);
|
|
44
|
+
const out=[];
|
|
45
|
+
async function walk(dir,rel){
|
|
46
|
+
const names=(await readdir(dir,{withFileTypes:true})).sort((a,b)=>a.name.localeCompare(b.name));
|
|
47
|
+
for(const entry of names){
|
|
48
|
+
const child=path.join(dir,entry.name);const childRel=path.join(rel,entry.name);
|
|
49
|
+
if(entry.isSymbolicLink()) throw new Error(`benchmark fixture symlink rejected: ${childRel}`);
|
|
50
|
+
if(entry.isDirectory()) await walk(child,childRel);
|
|
51
|
+
else if(entry.isFile()) out.push({relative:childRel.replaceAll('\\','/'),absolute:child});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
await walk(absolute,relative);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function fixtureIdentityForCase({rootUrl,definition}){
|
|
59
|
+
if(!definition||typeof definition!=='object'||!Array.isArray(definition.fixture_files)||definition.fixture_files.length<1) throw new Error('benchmark fixture definition invalid');
|
|
60
|
+
const root=typeof rootUrl==='string'?path.resolve(rootUrl):fileURLToPath(rootUrl);
|
|
61
|
+
const files=[];
|
|
62
|
+
for(const relative of definition.fixture_files) files.push(...await collectFiles(root,relative));
|
|
63
|
+
files.sort((a,b)=>a.relative.localeCompare(b.relative));
|
|
64
|
+
const records=[];
|
|
65
|
+
for(const item of files) records.push({path:item.relative,sha256:sha256(await readFile(item.absolute))});
|
|
66
|
+
return sha256(Buffer.from(canonicalJson({schema:'deadbyte.r35-benchmark-fixture.v1',case_id:definition.case_id,files:records}),'utf8'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function runNodeTest({root,definition,env,timeoutMs}){
|
|
70
|
+
return new Promise(resolve=>{
|
|
71
|
+
const args=['--test'];
|
|
72
|
+
if(definition.test_name_pattern) args.push(`--test-name-pattern=${definition.test_name_pattern}`);
|
|
73
|
+
args.push(...definition.test_files);
|
|
74
|
+
const started=process.hrtime.bigint();
|
|
75
|
+
const child=spawn(process.execPath,args,{cwd:root,env:{...process.env,...env},shell:false,windowsHide:true,stdio:['ignore','pipe','pipe']});
|
|
76
|
+
const stdout=[];const stderr=[];let bytes=0;let killed=false;
|
|
77
|
+
const timer=setTimeout(()=>{killed=true;child.kill('SIGKILL');},timeoutMs);
|
|
78
|
+
child.stdout.on('data',chunk=>{stdout.push(chunk);bytes+=chunk.length;});
|
|
79
|
+
child.stderr.on('data',chunk=>{stderr.push(chunk);bytes+=chunk.length;});
|
|
80
|
+
child.once('error',error=>{clearTimeout(timer);resolve({exit_code:null,timed_out:false,error:String(error),stdout:Buffer.concat(stdout),stderr:Buffer.concat(stderr),bytes,elapsed_ms:Number(process.hrtime.bigint()-started)/1e6});});
|
|
81
|
+
child.once('exit',(code,signal)=>{clearTimeout(timer);resolve({exit_code:code,timed_out:killed,signal,stdout:Buffer.concat(stdout),stderr:Buffer.concat(stderr),bytes,elapsed_ms:Number(process.hrtime.bigint()-started)/1e6});});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function runCapabilityBenchmark({rootUrl,definitions=benchmarkCaseDefinitions(),env={},timeoutMs=TEST_TIMEOUT_MS}={}){
|
|
86
|
+
const root=typeof rootUrl==='string'?path.resolve(rootUrl):fileURLToPath(rootUrl??new URL('../',import.meta.url));
|
|
87
|
+
if(!Array.isArray(definitions)||definitions.length<1) throw new Error('benchmark definitions invalid');
|
|
88
|
+
if(!Number.isInteger(timeoutMs)||timeoutMs<1000||timeoutMs>600000) throw new Error('benchmark timeout invalid');
|
|
89
|
+
const cases=[];
|
|
90
|
+
for(const definition of definitions){
|
|
91
|
+
if(definition.requires_semantic_config&&(!env.DEADBYTE_R35_SEMANTIC_CONFIG||!env.DEADBYTE_R35_SEMANTIC_CONFIG_SHA256)){
|
|
92
|
+
throw new Error(`benchmark case '${definition.case_id}' requires pinned semantic config env`);
|
|
93
|
+
}
|
|
94
|
+
const fixture_sha256=await fixtureIdentityForCase({rootUrl:root,definition});
|
|
95
|
+
let result;
|
|
96
|
+
try{result=await runNodeTest({root,definition,env,timeoutMs});}
|
|
97
|
+
catch(error){result={exit_code:null,timed_out:false,error:String(error),stdout:Buffer.alloc(0),stderr:Buffer.alloc(0),bytes:0,elapsed_ms:0};}
|
|
98
|
+
const evidence={schema:'deadbyte.r35-benchmark-case-evidence.v1',case_id:definition.case_id,exit_code:result.exit_code,
|
|
99
|
+
timed_out:result.timed_out===true,signal:result.signal??null,error:result.error??null,
|
|
100
|
+
stdout_sha256:sha256(result.stdout??Buffer.alloc(0)),stderr_sha256:sha256(result.stderr??Buffer.alloc(0))};
|
|
101
|
+
const correct=result.exit_code===0&&!result.timed_out&&!result.error;
|
|
102
|
+
cases.push({case_id:definition.case_id,fixture_sha256,correct,round_trips:definition.round_trips,
|
|
103
|
+
bytes_returned:result.bytes??0,elapsed_ms:result.elapsed_ms??0,
|
|
104
|
+
stale_rejected:correct&&definition.stale_rejected===true,recovery_success:correct&&definition.recovery_success===true,
|
|
105
|
+
duplicate_side_effects:correct?0:1,evidence_sha256:sha256(Buffer.from(canonicalJson(evidence),'utf8'))});
|
|
106
|
+
}
|
|
107
|
+
return buildCapabilityBenchmark({suite_id:'r35-offline-v1',cases});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const R36_BENCHMARK_CASE_IDS=Object.freeze([
|
|
111
|
+
'repository_tree_exploration','literal_content_search','regex_content_search','filename_path_search',
|
|
112
|
+
'deterministic_search_paging_cancel','bounded_multi_file_read','rich_stat_reparse_handling','stale_edit_race_rejection',
|
|
113
|
+
'transactional_multi_file_native_diff','topology_mkdir_move_delete_rollback','semantic_typescript_navigation',
|
|
114
|
+
'semantic_python_navigation','semantic_rust_navigation','semantic_cpp_navigation','diagnostics_normalization',
|
|
115
|
+
'implementation_lookup','cross_file_rename_transaction','long_process_lifecycle','policy_defined_process_action',
|
|
116
|
+
'process_crash_reconciliation','autonomous_failing_test_repair','autonomous_search_semantic_patch_test',
|
|
117
|
+
'release_gate_finish_without_evidence_refusal','provider_bridge_interruption_recovery','remote_result_replay_deduplication',
|
|
118
|
+
'compact_connector_capability_closure','live_log_request_before_result','live_log_redaction',
|
|
119
|
+
'forged_stale_receipt_rejection','rollback_r35_restore_r36'
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
const r36Def=(case_id,purpose,test_files,fixture_files,{test_name_pattern=null,pass_witness=null,round_trips=2,stale_rejected=false,recovery_success=true,release_gate_result='not_applicable'}={})=>Object.freeze({
|
|
123
|
+
case_id,purpose,test_files:Object.freeze([...test_files]),fixture_files:Object.freeze([...fixture_files]),
|
|
124
|
+
...(test_name_pattern?{test_name_pattern}:{}),...(pass_witness?{pass_witness}:{}),round_trips,stale_rejected,recovery_success,
|
|
125
|
+
capability_reachable:true,evidence_verified:true,release_gate_result
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const R36_DEFINITIONS=Object.freeze([
|
|
129
|
+
r36Def('repository_tree_exploration','repository tree exploration',['test/coding-plane.test.mjs'],['test/coding-plane.test.mjs'],{round_trips:1}),
|
|
130
|
+
r36Def('literal_content_search','literal content search',['test/coding-search-r36.test.mjs'],['test/coding-search-r36.test.mjs'],{test_name_pattern:'R36 regex search returns multiple matches',pass_witness:'R36 regex search returns multiple matches',round_trips:2}),
|
|
131
|
+
r36Def('regex_content_search','regex content search',['test/coding-search-r36.test.mjs'],['test/coding-search-r36.test.mjs'],{test_name_pattern:'R36 regex search returns multiple matches',pass_witness:'R36 regex search returns multiple matches',round_trips:2}),
|
|
132
|
+
r36Def('filename_path_search','filename/path search',['test/coding-search-r36.test.mjs'],['test/coding-search-r36.test.mjs'],{test_name_pattern:'R36 path search does not decode',pass_witness:'R36 path search does not decode',round_trips:2}),
|
|
133
|
+
r36Def('deterministic_search_paging_cancel','deterministic paging/cancel',['test/coding-search-r36.test.mjs','test/observation-runtime.test.mjs'],['test/coding-search-r36.test.mjs','test/observation-runtime.test.mjs'],{round_trips:4}),
|
|
134
|
+
r36Def('bounded_multi_file_read','bounded multi-file read',['test/multi-file-read.test.mjs'],['test/multi-file-read.test.mjs'],{round_trips:1}),
|
|
135
|
+
r36Def('rich_stat_reparse_handling','rich stat and reparse denial',['test/coding-runtime.test.mjs','test/native-diff-topology-r36.test.mjs'],['test/coding-runtime.test.mjs','test/native-diff-topology-r36.test.mjs'],{test_name_pattern:'(?:R36 coding stat exposes|R36 Native Diff V2 denies topology through reparse)',round_trips:3,stale_rejected:true}),
|
|
136
|
+
r36Def('stale_edit_race_rejection','stale-edit race rejection',['test/coding-runtime.test.mjs','test/native-diff-topology-r36.test.mjs'],['test/coding-runtime.test.mjs','test/native-diff-topology-r36.test.mjs'],{test_name_pattern:'(?:rejects mutation when lease is absent or precondition is stale|rejects stale move identity)',round_trips:3,stale_rejected:true}),
|
|
137
|
+
r36Def('transactional_multi_file_native_diff','transactional multi-file Native Diff',['test/native-diff.test.mjs'],['test/native-diff.test.mjs'],{test_name_pattern:'native diff commits exact preconditioned edits',pass_witness:'native diff commits exact preconditioned edits',round_trips:4,stale_rejected:true}),
|
|
138
|
+
r36Def('topology_mkdir_move_delete_rollback','topology transaction and rollback',['test/native-diff-topology-r36.test.mjs'],['test/native-diff-topology-r36.test.mjs'],{round_trips:5,stale_rejected:true}),
|
|
139
|
+
r36Def('semantic_typescript_navigation','TypeScript symbol navigation',['test/semantic-code.test.mjs'],['test/semantic-code.test.mjs','test/fixtures/semantic/typescript'],{round_trips:4,stale_rejected:true}),
|
|
140
|
+
r36Def('semantic_python_navigation','Python symbol navigation through hermetic LSP adapter',['test/capability-benchmark-semantic-r36.test.mjs'],['test/capability-benchmark-semantic-r36.test.mjs','test/fixtures/lsp-framed-server.mjs'],{test_name_pattern:'R36 benchmark Python symbol navigation',pass_witness:'R36 benchmark Python symbol navigation',round_trips:4}),
|
|
141
|
+
r36Def('semantic_rust_navigation','Rust symbol navigation through hermetic LSP adapter',['test/capability-benchmark-semantic-r36.test.mjs'],['test/capability-benchmark-semantic-r36.test.mjs','test/fixtures/lsp-framed-server.mjs'],{test_name_pattern:'R36 benchmark Rust symbol navigation',pass_witness:'R36 benchmark Rust symbol navigation',round_trips:4}),
|
|
142
|
+
r36Def('semantic_cpp_navigation','C/C++ symbol navigation through hermetic LSP adapter',['test/capability-benchmark-semantic-r36.test.mjs'],['test/capability-benchmark-semantic-r36.test.mjs','test/fixtures/lsp-framed-server.mjs'],{test_name_pattern:'R36 benchmark Cpp symbol navigation',pass_witness:'R36 benchmark Cpp symbol navigation',round_trips:4}),
|
|
143
|
+
r36Def('diagnostics_normalization','diagnostics normalization',['test/semantic-r36-rename.test.mjs'],['test/semantic-r36-rename.test.mjs'],{test_name_pattern:'R36 TypeScript diagnostics carry',pass_witness:'R36 TypeScript diagnostics carry',round_trips:2}),
|
|
144
|
+
r36Def('implementation_lookup','implementation lookup',['test/semantic-r36-rename.test.mjs'],['test/semantic-r36-rename.test.mjs'],{test_name_pattern:'R36 TypeScript implementations normalize',pass_witness:'R36 TypeScript implementations normalize',round_trips:2}),
|
|
145
|
+
r36Def('cross_file_rename_transaction','cross-file rename through Native Diff',['test/semantic-r36-rename.test.mjs'],['test/semantic-r36-rename.test.mjs'],{test_name_pattern:'R36 cross-file rename preview',pass_witness:'R36 cross-file rename preview',round_trips:5,stale_rejected:true}),
|
|
146
|
+
r36Def('long_process_lifecycle','long process start/output/status/terminate',['test/process-longrun-r36.test.mjs','test/process-runtime.test.mjs'],['test/process-longrun-r36.test.mjs','test/process-runtime.test.mjs'],{test_name_pattern:'(?:R36 long process returns before exit|R31 runtime lists, reports and terminates)',round_trips:6,recovery_success:true}),
|
|
147
|
+
r36Def('policy_defined_process_action','policy-defined named process action',['test/process-runtime.test.mjs'],['test/process-runtime.test.mjs'],{test_name_pattern:'R32 runtime executes one policy-defined named action',pass_witness:'R32 runtime executes one policy-defined named action',round_trips:3}),
|
|
148
|
+
r36Def('process_crash_reconciliation','terminal process journal/output recovery',['test/process-longrun-r36.test.mjs'],['test/process-longrun-r36.test.mjs'],{test_name_pattern:'R36 terminal process session is recovered',pass_witness:'R36 terminal process session is recovered',round_trips:4,recovery_success:true}),
|
|
149
|
+
r36Def('autonomous_failing_test_repair','autonomous failing-test critic/repair/release',['test/autonomous-r34-e2e.test.mjs','test/autonomous-loop-v2.test.mjs'],['test/autonomous-r34-e2e.test.mjs','test/autonomous-loop-v2.test.mjs','test/helpers/autonomous-r34-fixture.mjs'],{test_name_pattern:'(?:multi-step fail replan repair finish|failed VERIFY enters CRITIC|REPAIR must change)',round_trips:8,stale_rejected:true,release_gate_result:'passed'}),
|
|
150
|
+
r36Def('autonomous_search_semantic_patch_test','capability-aware planner inspection/mutation loop',['test/autonomous-capability-r36.test.mjs','test/semantic-r36-rename.test.mjs','test/autonomous-r34-e2e.test.mjs'],['test/autonomous-capability-r36.test.mjs','test/semantic-r36-rename.test.mjs','test/autonomous-r34-e2e.test.mjs','test/helpers/autonomous-r34-fixture.mjs'],{test_name_pattern:'(?:planner parses first-class capability actions|typed native_diff_apply|cross-file rename preview|multi-step fail replan repair finish)',round_trips:8,stale_rejected:true,release_gate_result:'passed'}),
|
|
151
|
+
r36Def('release_gate_finish_without_evidence_refusal','finish claim cannot bypass objective release evidence',['test/autonomous-r34-e2e.test.mjs'],['test/autonomous-r34-e2e.test.mjs'],{test_name_pattern:'R34 finish is blocked while the active plan is incomplete',pass_witness:'R34 finish is blocked while the active plan is incomplete',round_trips:3,release_gate_result:'blocked'}),
|
|
152
|
+
r36Def('provider_bridge_interruption_recovery','provider circuit and remote-session interruption recovery',['test/provider-circuit.test.mjs','test/remote-session-cli.test.mjs'],['test/provider-circuit.test.mjs','test/remote-session-cli.test.mjs'],{test_name_pattern:'(?:OPEN becomes HALF_OPEN|bare remote recovers a stale crashed session)',round_trips:4,recovery_success:true}),
|
|
153
|
+
r36Def('remote_result_replay_deduplication','remote result replay/dedupe',['test/remote-result-journal.test.mjs','test/remote-session-cli.test.mjs'],['test/remote-result-journal.test.mjs','test/remote-session-cli.test.mjs'],{test_name_pattern:'(?:remote result journal is monotonic|remote --resume replays only terminal results)',round_trips:4,recovery_success:true}),
|
|
154
|
+
r36Def('compact_connector_capability_closure','compact connector <=42 with production capability closure',['test/compact-catalog-r36.test.mjs','test/capability-ledger-r36.test.mjs'],['test/compact-catalog-r36.test.mjs','test/capability-ledger-r36.test.mjs'],{test_name_pattern:'(?:real compact stdio catalog stays <=42|compact closure covers every production non-host capability)',round_trips:2}),
|
|
155
|
+
r36Def('live_log_request_before_result','live activity request-before-result ordering',['test/remote-live-log-recovery-r36.test.mjs'],['test/remote-live-log-recovery-r36.test.mjs','src/remote-live-log.mjs'],{test_name_pattern:'R36 live activity tracker prints RUN before terminal result',pass_witness:'R36 live activity tracker prints RUN before terminal result',round_trips:2,recovery_success:true}),
|
|
156
|
+
r36Def('live_log_redaction','live activity secret/payload redaction',['test/remote-live-log-r36.test.mjs','test/remote-session-cli.test.mjs'],['test/remote-live-log-r36.test.mjs','test/remote-session-cli.test.mjs','src/remote-live-log.mjs'],{test_name_pattern:'compact live activity shows request context without payload or secret values',pass_witness:'compact live activity shows request context without payload or secret values',round_trips:1}),
|
|
157
|
+
r36Def('forged_stale_receipt_rejection','forged/stale receipt and precondition rejection',['test/autonomous-r34-e2e.test.mjs','test/coding-plane-adversarial.test.mjs'],['test/autonomous-r34-e2e.test.mjs','test/coding-plane-adversarial.test.mjs'],{test_name_pattern:'(?:forged profile receipt substitution|signed autonomous journal tamper|coding task adopts a signed command receipt)',round_trips:4,stale_rejected:true,recovery_success:true}),
|
|
158
|
+
r36Def('rollback_r35_restore_r36','hermetic signed predecessor rollback and exact slot restore mechanism',['test/runtime-self-update.test.mjs','test/release-slot.test.mjs'],['test/runtime-self-update.test.mjs','test/release-slot.test.mjs'],{test_name_pattern:'(?:R31 explicit rollback restores the exact signed prior pointer|release slot materialization copies only manifest-bound files)',round_trips:5,recovery_success:true})
|
|
159
|
+
]);
|
|
160
|
+
|
|
161
|
+
export function r36BenchmarkCaseDefinitions(){
|
|
162
|
+
return R36_DEFINITIONS.map(item=>({...structuredClone(item),fixture_files:['bench/fixtures/corpus.json','bench/fixtures/r36/case-map.json',...item.fixture_files]}));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function hasPassingWitness(stdout,witness){
|
|
166
|
+
if(!witness) return true;
|
|
167
|
+
const text=Buffer.isBuffer(stdout)?stdout.toString('utf8'):String(stdout??'');
|
|
168
|
+
return text.split(/\r?\n/).some(line=>line.includes(witness)&&!/\bSKIP\b/i.test(line)&&/(?:✔|\bok\b)/i.test(line));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function runR36CapabilityBenchmark({rootUrl,definitions=r36BenchmarkCaseDefinitions(),env={},timeoutMs=TEST_TIMEOUT_MS}={}){
|
|
172
|
+
const root=typeof rootUrl==='string'?path.resolve(rootUrl):fileURLToPath(rootUrl??new URL('../',import.meta.url));
|
|
173
|
+
if(!Array.isArray(definitions)||definitions.length<1) throw new Error('R36 benchmark definitions invalid');
|
|
174
|
+
if(!Number.isInteger(timeoutMs)||timeoutMs<1000||timeoutMs>600000) throw new Error('R36 benchmark timeout invalid');
|
|
175
|
+
const cases=[];
|
|
176
|
+
for(const definition of definitions){
|
|
177
|
+
const fixture_sha256=await fixtureIdentityForCase({rootUrl:root,definition});
|
|
178
|
+
let result;
|
|
179
|
+
try{result=await runNodeTest({root,definition,env,timeoutMs});}
|
|
180
|
+
catch(error){result={exit_code:null,timed_out:false,error:String(error),stdout:Buffer.alloc(0),stderr:Buffer.alloc(0),bytes:0,elapsed_ms:0};}
|
|
181
|
+
const witnessOk=hasPassingWitness(result.stdout,definition.pass_witness??null);
|
|
182
|
+
const correct=result.exit_code===0&&!result.timed_out&&!result.error&&witnessOk;
|
|
183
|
+
const evidence={schema:'deadbyte.r36-benchmark-case-evidence.v1',case_id:definition.case_id,exit_code:result.exit_code,
|
|
184
|
+
timed_out:result.timed_out===true,signal:result.signal??null,error:result.error??null,pass_witness:definition.pass_witness??null,
|
|
185
|
+
pass_witness_observed:witnessOk,stdout_sha256:sha256(result.stdout??Buffer.alloc(0)),stderr_sha256:sha256(result.stderr??Buffer.alloc(0))};
|
|
186
|
+
cases.push({case_id:definition.case_id,fixture_sha256,correct,round_trips:definition.round_trips,
|
|
187
|
+
bytes_returned:result.bytes??0,elapsed_ms:result.elapsed_ms??0,stale_rejected:correct&&definition.stale_rejected===true,
|
|
188
|
+
recovery_success:correct&&definition.recovery_success===true,duplicate_side_effects:correct?0:1,
|
|
189
|
+
capability_reachable:correct&&definition.capability_reachable===true,evidence_verified:correct&&definition.evidence_verified===true,
|
|
190
|
+
release_gate_result:correct?definition.release_gate_result:'blocked',evidence_sha256:sha256(Buffer.from(canonicalJson(evidence),'utf8'))});
|
|
191
|
+
}
|
|
192
|
+
return buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases});
|
|
193
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { canonicalJson } from './canonical-json.mjs';
|
|
3
|
+
|
|
4
|
+
export const CAPABILITY_BENCHMARK_SCHEMA='deadbyte.r35-capability-benchmark.v1';
|
|
5
|
+
export const R36_CAPABILITY_BENCHMARK_SCHEMA='deadbyte.r36-capability-benchmark.v1';
|
|
6
|
+
const HEX64=/^[0-9a-f]{64}$/;
|
|
7
|
+
const CASE_ID=/^[A-Za-z0-9._-]{1,96}$/;
|
|
8
|
+
const SUITE_ID=/^[A-Za-z0-9._-]{1,96}$/;
|
|
9
|
+
|
|
10
|
+
function sha256(value){return createHash('sha256').update(Buffer.from(canonicalJson(value),'utf8')).digest('hex');}
|
|
11
|
+
function bool(value,label){if(typeof value!=='boolean') throw new Error(`${label} invalid`);return value;}
|
|
12
|
+
function uint(value,label,{min=0,max=Number.MAX_SAFE_INTEGER}={}){
|
|
13
|
+
if(!Number.isSafeInteger(value)||value<min||value>max) throw new Error(`${label} invalid`);return value;
|
|
14
|
+
}
|
|
15
|
+
function finite(value,label){if(typeof value!=='number'||!Number.isFinite(value)||value<0) throw new Error(`${label} invalid`);return value;}
|
|
16
|
+
function hash(value,label){if(typeof value!=='string'||!HEX64.test(value)) throw new Error(`${label} evidence hash invalid`);return value;}
|
|
17
|
+
|
|
18
|
+
export function normalizeBenchmarkCase(raw){
|
|
19
|
+
if(!raw||typeof raw!=='object'||Array.isArray(raw)) throw new Error('benchmark case invalid');
|
|
20
|
+
const id=raw.case_id;
|
|
21
|
+
if(typeof id!=='string'||!CASE_ID.test(id)) throw new Error('benchmark case_id invalid');
|
|
22
|
+
return Object.freeze({
|
|
23
|
+
case_id:id,
|
|
24
|
+
fixture_sha256:hash(raw.fixture_sha256,'benchmark fixture'),
|
|
25
|
+
correct:bool(raw.correct,'benchmark correct'),
|
|
26
|
+
round_trips:uint(raw.round_trips,'benchmark round-trips',{min:1,max:100000}),
|
|
27
|
+
bytes_returned:uint(raw.bytes_returned,'benchmark bytes_returned',{max:1024*1024*1024}),
|
|
28
|
+
elapsed_ms:finite(raw.elapsed_ms,'benchmark elapsed_ms'),
|
|
29
|
+
stale_rejected:bool(raw.stale_rejected,'benchmark stale_rejected'),
|
|
30
|
+
recovery_success:bool(raw.recovery_success,'benchmark recovery_success'),
|
|
31
|
+
duplicate_side_effects:uint(raw.duplicate_side_effects,'benchmark duplicate_side_effects',{max:100000}),
|
|
32
|
+
evidence_sha256:hash(raw.evidence_sha256,'benchmark evidence')
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function buildCapabilityBenchmark({suite_id:rawSuiteId,cases:rawCases}={}){
|
|
37
|
+
if(typeof rawSuiteId!=='string'||!SUITE_ID.test(rawSuiteId)) throw new Error('benchmark suite_id invalid');
|
|
38
|
+
if(!Array.isArray(rawCases)||rawCases.length<1||rawCases.length>128) throw new Error('benchmark cases invalid');
|
|
39
|
+
const cases=rawCases.map(normalizeBenchmarkCase).sort((a,b)=>a.case_id.localeCompare(b.case_id));
|
|
40
|
+
const seen=new Set();
|
|
41
|
+
for(const item of cases){if(seen.has(item.case_id)) throw new Error(`duplicate case '${item.case_id}'`);seen.add(item.case_id);}
|
|
42
|
+
const fixtureIdentity={schema:'deadbyte.r35-capability-fixtures.v1',suite_id:rawSuiteId,
|
|
43
|
+
fixtures:cases.map(item=>({case_id:item.case_id,fixture_sha256:item.fixture_sha256}))};
|
|
44
|
+
const fixture_identity_sha256=sha256(fixtureIdentity);
|
|
45
|
+
const observation={schema:CAPABILITY_BENCHMARK_SCHEMA,suite_id:rawSuiteId,fixture_identity_sha256,cases};
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
...observation,
|
|
48
|
+
overall_correct:cases.every(item=>item.correct),
|
|
49
|
+
observation_sha256:sha256(observation)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const R36_RELEASE_GATE_RESULTS=new Set(['passed','blocked','not_applicable']);
|
|
54
|
+
export function normalizeR36BenchmarkCase(raw){
|
|
55
|
+
const base=normalizeBenchmarkCase(raw);
|
|
56
|
+
if(typeof raw.capability_reachable!=='boolean') throw new Error('benchmark capability_reachable invalid');
|
|
57
|
+
if(typeof raw.evidence_verified!=='boolean') throw new Error('benchmark evidence_verified invalid');
|
|
58
|
+
if(typeof raw.release_gate_result!=='string'||!R36_RELEASE_GATE_RESULTS.has(raw.release_gate_result)) throw new Error('benchmark release_gate_result invalid');
|
|
59
|
+
return Object.freeze({...base,
|
|
60
|
+
capability_reachable:raw.capability_reachable,
|
|
61
|
+
evidence_verified:raw.evidence_verified,
|
|
62
|
+
release_gate_result:raw.release_gate_result
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function buildR36CapabilityBenchmark({suite_id:rawSuiteId,cases:rawCases}={}){
|
|
67
|
+
if(typeof rawSuiteId!=='string'||!SUITE_ID.test(rawSuiteId)) throw new Error('benchmark suite_id invalid');
|
|
68
|
+
if(!Array.isArray(rawCases)||rawCases.length<1||rawCases.length>128) throw new Error('benchmark cases invalid');
|
|
69
|
+
const cases=rawCases.map(normalizeR36BenchmarkCase).sort((a,b)=>a.case_id.localeCompare(b.case_id));
|
|
70
|
+
const seen=new Set();
|
|
71
|
+
for(const item of cases){if(seen.has(item.case_id)) throw new Error(`duplicate case '${item.case_id}'`);seen.add(item.case_id);}
|
|
72
|
+
const fixtureIdentity={schema:'deadbyte.r36-capability-fixtures.v1',suite_id:rawSuiteId,
|
|
73
|
+
fixtures:cases.map(item=>({case_id:item.case_id,fixture_sha256:item.fixture_sha256}))};
|
|
74
|
+
const fixture_identity_sha256=sha256(fixtureIdentity);
|
|
75
|
+
const observation={schema:R36_CAPABILITY_BENCHMARK_SCHEMA,suite_id:rawSuiteId,fixture_identity_sha256,cases};
|
|
76
|
+
const capability_closure=cases.every(item=>item.capability_reachable);
|
|
77
|
+
const evidence_closure=cases.every(item=>item.evidence_verified);
|
|
78
|
+
const verdictIdentity={
|
|
79
|
+
schema:'deadbyte.r36-capability-verdict.v1',suite_id:rawSuiteId,fixture_identity_sha256,
|
|
80
|
+
cases:cases.map(item=>({
|
|
81
|
+
case_id:item.case_id,fixture_sha256:item.fixture_sha256,correct:item.correct,
|
|
82
|
+
stale_rejected:item.stale_rejected,recovery_success:item.recovery_success,
|
|
83
|
+
duplicate_side_effects:item.duplicate_side_effects,capability_reachable:item.capability_reachable,
|
|
84
|
+
evidence_verified:item.evidence_verified,release_gate_result:item.release_gate_result
|
|
85
|
+
}))
|
|
86
|
+
};
|
|
87
|
+
return Object.freeze({
|
|
88
|
+
...observation,
|
|
89
|
+
capability_closure,
|
|
90
|
+
evidence_closure,
|
|
91
|
+
overall_correct:cases.every(item=>item.correct)&&capability_closure&&evidence_closure,
|
|
92
|
+
verdict_identity_sha256:sha256(verdictIdentity),
|
|
93
|
+
observation_sha256:sha256(observation)
|
|
94
|
+
});
|
|
95
|
+
}
|