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.
Files changed (388) hide show
  1. package/CONTEXT.md +41 -0
  2. package/MANIFEST.SHA256 +386 -94
  3. package/R34-BASELINE.json +9 -0
  4. package/README.txt +141 -10
  5. package/bench/fixtures/corpus.json +36 -0
  6. package/bench/fixtures/r36/case-map.json +8 -0
  7. package/bin/WORKER-REGISTRY.txt +3 -3
  8. package/bin/appcontainer-stage.exe +0 -0
  9. package/bin/appcontainer-stage.obj +0 -0
  10. package/bin/bootstrap-advapi32.exe +0 -0
  11. package/bin/bootstrap-advapi32.obj +0 -0
  12. package/bin/bootstrap-exitcode.exe +0 -0
  13. package/bin/bootstrap-exitcode.obj +0 -0
  14. package/bin/bootstrap-kernel32.exe +0 -0
  15. package/bin/bootstrap-kernel32.obj +0 -0
  16. package/bin/child-control-probe.exe +0 -0
  17. package/bin/child-control-probe.obj +0 -0
  18. package/bin/child-control-stage.exe +0 -0
  19. package/bin/child-control-stage.obj +0 -0
  20. package/bin/contained-reverse-worker.exe +0 -0
  21. package/bin/contained-reverse-worker.obj +0 -0
  22. package/bin/contained-transform-worker.exe +0 -0
  23. package/bin/contained-transform-worker.obj +0 -0
  24. package/bin/containment-probe.exe +0 -0
  25. package/bin/containment-probe.obj +0 -0
  26. package/bin/deadbyte-contain.exe +0 -0
  27. package/bin/deadbyte-contain.obj +0 -0
  28. package/bin/deadbyte-exec.exe +0 -0
  29. package/bin/deadbyte-exec.obj +0 -0
  30. package/bin/deadbyte-process-host.exe +0 -0
  31. package/bin/deadbyte-process-host.obj +0 -0
  32. package/bin/deadbyte-tunnel-host.exe +0 -0
  33. package/bin/deadbyte-tunnel-host.obj +0 -0
  34. package/controller/README.TXT +12 -4
  35. package/controller/deadbyte-controller.config.psd1.example +14 -0
  36. package/controller/deadbyte-controller.ps1 +191 -20
  37. package/controller/deadbyte-process-policy.json +5 -5
  38. package/controller/deadbyte-semantic-lsp-config.json +95 -0
  39. package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
  40. package/docs/ARCHITECTURE.md +6 -5
  41. package/docs/R36-CAPABILITY-EVIDENCE.md +43 -0
  42. package/docs/superpowers/plans/2026-09-16-deadbyte-loop-engine.md +846 -0
  43. package/docs/superpowers/plans/2026-09-17-r35-production-successor.md +408 -0
  44. package/docs/superpowers/plans/2026-09-18-r36-zero-loss-autonomy.md +739 -0
  45. package/docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md +435 -0
  46. package/docs/superpowers/specs/2026-09-17-r35-production-successor-design.md +220 -0
  47. package/docs/superpowers/specs/2026-09-18-r36-zero-loss-autonomy-design.md +640 -0
  48. package/node_modules/typescript/LICENSE.txt +55 -0
  49. package/node_modules/typescript/README.md +50 -0
  50. package/node_modules/typescript/SECURITY.md +41 -0
  51. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  52. package/node_modules/typescript/bin/tsc +2 -0
  53. package/node_modules/typescript/bin/tsserver +2 -0
  54. package/node_modules/typescript/lib/_tsc.js +133818 -0
  55. package/node_modules/typescript/lib/_tsserver.js +659 -0
  56. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  57. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  58. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  59. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  60. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  61. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  62. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  63. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  64. package/node_modules/typescript/lib/lib.d.ts +22 -0
  65. package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  66. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  67. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  68. package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  69. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  70. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  71. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  72. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  73. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  74. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  75. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  76. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  77. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  78. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  79. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  80. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  81. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  82. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  83. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  84. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  85. package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  86. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  87. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  88. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  89. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  90. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  91. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  92. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  93. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  94. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  95. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  96. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  97. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  98. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  99. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  100. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  101. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  102. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  103. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  104. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  105. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  106. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  107. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  108. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  109. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  110. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  111. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  112. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  113. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  114. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  115. package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  116. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  117. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  118. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  119. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  120. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  121. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  122. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  123. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  124. package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  125. package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  126. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  127. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  128. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  129. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  130. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  131. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  132. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  133. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  134. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  135. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  136. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  137. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  138. package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  139. package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  140. package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  141. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  142. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  143. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  144. package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  145. package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  146. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  147. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  148. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  149. package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  150. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  151. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  152. package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  153. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  154. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  155. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  156. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  157. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  158. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  159. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  160. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  161. package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  162. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  163. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  164. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  165. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  166. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  167. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  168. package/node_modules/typescript/lib/tsc.js +8 -0
  169. package/node_modules/typescript/lib/tsserver.js +8 -0
  170. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  171. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  172. package/node_modules/typescript/lib/typesMap.json +497 -0
  173. package/node_modules/typescript/lib/typescript.d.ts +11437 -0
  174. package/node_modules/typescript/lib/typescript.js +200276 -0
  175. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  176. package/node_modules/typescript/lib/watchGuard.js +53 -0
  177. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  178. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  179. package/node_modules/typescript/package.json +120 -0
  180. package/package.json +5 -3
  181. package/proof/CONTAINMENT-BUILD.txt +6 -6
  182. package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +29 -0
  183. package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +28 -0
  184. package/scripts/capability-benchmark.mjs +27 -0
  185. package/scripts/deferred-slot-operation.mjs +56 -16
  186. package/scripts/final-closure-verify.mjs +88 -39
  187. package/scripts/final-closure.mjs +63 -56
  188. package/scripts/gate-windows.ps1 +3 -3
  189. package/scripts/release-parity-tests.ps1 +9 -0
  190. package/scripts/release-parity.mjs +149 -139
  191. package/scripts/semantic-preflight.ps1 +73 -0
  192. package/scripts/tool-surface-snapshot.mjs +73 -0
  193. package/scripts/windows-gate-evidence.mjs +5 -5
  194. package/src/audit-verify.mjs +6 -2
  195. package/src/autonomous-action-reconcile.mjs +142 -0
  196. package/src/autonomous-context-engine.mjs +256 -0
  197. package/src/autonomous-live-state.mjs +17 -0
  198. package/src/autonomous-local-supervisor.mjs +249 -0
  199. package/src/autonomous-loop-state.mjs +304 -0
  200. package/src/autonomous-mcp-tools.mjs +5 -1
  201. package/src/autonomous-output-contracts.mjs +26 -7
  202. package/src/autonomous-plan.mjs +181 -0
  203. package/src/autonomous-planner-contracts.mjs +79 -0
  204. package/src/autonomous-planner.mjs +113 -6
  205. package/src/autonomous-policy.mjs +15 -2
  206. package/src/autonomous-progress.mjs +127 -0
  207. package/src/autonomous-runtime.mjs +785 -62
  208. package/src/autonomous-supervisor-host.mjs +70 -0
  209. package/src/autonomous-supervisor.mjs +31 -8
  210. package/src/capability-benchmark-runner.mjs +193 -0
  211. package/src/capability-benchmark.mjs +95 -0
  212. package/src/capability-ledger.mjs +158 -0
  213. package/src/coding-mcp-tools.mjs +65 -8
  214. package/src/coding-output-contracts.mjs +91 -8
  215. package/src/coding-plane.mjs +45 -9
  216. package/src/coding-search.mjs +130 -47
  217. package/src/compact-gateway-mcp-tools.mjs +128 -0
  218. package/src/compact-gateway-output-contracts.mjs +16 -0
  219. package/src/context-provenance.mjs +86 -0
  220. package/src/deadbyte-cli.mjs +145 -30
  221. package/src/document-adapter.mjs +43 -0
  222. package/src/lsp-stdio-client.mjs +112 -0
  223. package/src/machine-fs-smoke-client.mjs +2 -1
  224. package/src/machine-fs.mjs +51 -8
  225. package/src/mcp-server.mjs +46 -9
  226. package/src/native-diff-v2.mjs +337 -0
  227. package/src/native-diff.mjs +50 -2
  228. package/src/observation-smoke-client.mjs +3 -2
  229. package/src/operator-surface.mjs +43 -0
  230. package/src/process-runtime.mjs +98 -11
  231. package/src/process-smoke-client.mjs +11 -3
  232. package/src/provider-circuit.mjs +125 -0
  233. package/src/r36-compact-disarmed-probe.mjs +50 -0
  234. package/src/r36-full-surface-probe.mjs +56 -0
  235. package/src/release-generation.mjs +44 -5
  236. package/src/remote-live-log.mjs +76 -0
  237. package/src/remote-mcp-autonomous-smoke-client.mjs +58 -15
  238. package/src/remote-mcp-coding-smoke-client.mjs +5 -4
  239. package/src/remote-mcp-r24-disarmed-smoke-client.mjs +4 -2
  240. package/src/remote-mcp-r34-parity-client.mjs +177 -0
  241. package/src/remote-mcp-r36-parity-client.mjs +175 -0
  242. package/src/remote-mcp-smoke-client.mjs +113 -56
  243. package/src/remote-result-journal.mjs +114 -0
  244. package/src/runtime-update.mjs +109 -9
  245. package/src/search-cursor.mjs +45 -0
  246. package/src/semantic-backend-registry.mjs +39 -0
  247. package/src/semantic-code.mjs +246 -0
  248. package/src/semantic-lsp-backend.mjs +219 -0
  249. package/src/semantic-lsp-config.mjs +112 -0
  250. package/src/tool-surface-ledger.mjs +92 -0
  251. package/src/version.mjs +1 -1
  252. package/test/audit-verify.test.mjs +1 -1
  253. package/test/autonomous-action-reconcile.test.mjs +106 -0
  254. package/test/autonomous-adversarial.test.mjs +149 -6
  255. package/test/autonomous-capability-r36.test.mjs +151 -0
  256. package/test/autonomous-context-engine.test.mjs +181 -0
  257. package/test/autonomous-live-state.test.mjs +27 -0
  258. package/test/autonomous-local-supervisor.test.mjs +403 -0
  259. package/test/autonomous-loop-state.test.mjs +126 -0
  260. package/test/autonomous-loop-v2.test.mjs +105 -0
  261. package/test/autonomous-loop.test.mjs +79 -1
  262. package/test/autonomous-output-contract.test.mjs +54 -0
  263. package/test/autonomous-plan.test.mjs +101 -0
  264. package/test/autonomous-progress.test.mjs +106 -0
  265. package/test/autonomous-r34-e2e.test.mjs +338 -0
  266. package/test/autonomous-runtime.test.mjs +3 -3
  267. package/test/autonomous-supervisor-integration.test.mjs +48 -3
  268. package/test/capability-benchmark-r36.test.mjs +107 -0
  269. package/test/capability-benchmark-runner.test.mjs +49 -0
  270. package/test/capability-benchmark-semantic-r36.test.mjs +52 -0
  271. package/test/capability-benchmark.test.mjs +47 -0
  272. package/test/capability-claims-r36.test.mjs +23 -0
  273. package/test/capability-ledger-r36.test.mjs +102 -0
  274. package/test/cli-entrypoint.test.mjs +12 -0
  275. package/test/coding-catalog-consistency.test.mjs +24 -0
  276. package/test/coding-plane.test.mjs +3 -3
  277. package/test/coding-runtime.test.mjs +16 -0
  278. package/test/coding-search-r36.test.mjs +90 -0
  279. package/test/compact-catalog-r36.test.mjs +37 -0
  280. package/test/compact-gateway-r36.test.mjs +66 -0
  281. package/test/contained.test.mjs +1 -1
  282. package/test/context-provenance.test.mjs +61 -0
  283. package/test/controller-r27.test.mjs +4 -3
  284. package/test/controller.test.mjs +52 -0
  285. package/test/core.test.mjs +1 -1
  286. package/test/deferred-slot-operation-behavior.test.mjs +5 -1
  287. package/test/deferred-slot-operation.test.mjs +11 -1
  288. package/test/document-adapter.test.mjs +23 -0
  289. package/test/fixtures/lsp-framed-server.mjs +35 -0
  290. package/test/fixtures/semantic/cpp/compile_commands.json +4 -0
  291. package/test/fixtures/semantic/cpp/lib.cpp +2 -0
  292. package/test/fixtures/semantic/cpp/lib.hpp +2 -0
  293. package/test/fixtures/semantic/cpp/main.cpp +2 -0
  294. package/test/fixtures/semantic/python/lib.py +2 -0
  295. package/test/fixtures/semantic/python/main.py +2 -0
  296. package/test/fixtures/semantic/rust/Cargo.lock +7 -0
  297. package/test/fixtures/semantic/rust/Cargo.toml +8 -0
  298. package/test/fixtures/semantic/rust/src/lib.rs +3 -0
  299. package/test/fixtures/semantic/rust/src/main.rs +5 -0
  300. package/test/fixtures/semantic/rust/src/math.rs +3 -0
  301. package/test/fixtures/semantic/rust/target/.rustc_info.json +1 -0
  302. package/test/fixtures/semantic/rust/target/CACHEDIR.TAG +3 -0
  303. package/test/fixtures/semantic/rust/target/debug/.cargo-lock +0 -0
  304. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/dep-test-lib-semantic_rust +0 -0
  305. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/invoked.timestamp +1 -0
  306. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust +1 -0
  307. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust.json +1 -0
  308. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/dep-test-bin-semantic_rust_bin +0 -0
  309. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/invoked.timestamp +1 -0
  310. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin +1 -0
  311. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin.json +1 -0
  312. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/dep-lib-semantic_rust +0 -0
  313. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/invoked.timestamp +1 -0
  314. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust +1 -0
  315. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust.json +1 -0
  316. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin +1 -0
  317. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin.json +1 -0
  318. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/dep-bin-semantic_rust_bin +0 -0
  319. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/invoked.timestamp +1 -0
  320. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-4c168fa33c79d09c.rmeta +0 -0
  321. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-6212ccd976aa3808.rmeta +0 -0
  322. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-5dcd474439c54a26.rmeta +0 -0
  323. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-d741378dccdef61c.rmeta +0 -0
  324. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-4c168fa33c79d09c.d +5 -0
  325. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-6212ccd976aa3808.d +5 -0
  326. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-5dcd474439c54a26.d +6 -0
  327. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-d741378dccdef61c.d +6 -0
  328. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/dep-graph.bin +0 -0
  329. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/query-cache.bin +0 -0
  330. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/work-products.bin +0 -0
  331. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc.lock +0 -0
  332. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/dep-graph.bin +0 -0
  333. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/metadata.rmeta +0 -0
  334. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/query-cache.bin +0 -0
  335. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/work-products.bin +0 -0
  336. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq.lock +0 -0
  337. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/dep-graph.bin +0 -0
  338. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/query-cache.bin +0 -0
  339. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/work-products.bin +0 -0
  340. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3.lock +0 -0
  341. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/dep-graph.bin +0 -0
  342. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/query-cache.bin +0 -0
  343. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/work-products.bin +0 -0
  344. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt.lock +0 -0
  345. package/test/fixtures/semantic/rust/target/flycheck0/stderr +1 -0
  346. package/test/fixtures/semantic/rust/target/flycheck0/stdout +5 -0
  347. package/test/fixtures/semantic/typescript/lib.ts +3 -0
  348. package/test/fixtures/semantic/typescript/main.ts +2 -0
  349. package/test/fixtures/tool-surface-stdio-server.mjs +14 -0
  350. package/test/helpers/autonomous-r34-fixture.mjs +122 -0
  351. package/test/lsp-stdio-client.test.mjs +72 -0
  352. package/test/multi-file-read.test.mjs +44 -0
  353. package/test/native-diff-topology-r36.test.mjs +105 -0
  354. package/test/observation-integration.test.mjs +3 -3
  355. package/test/package-boundary.test.mjs +6 -0
  356. package/test/process-longrun-r36.test.mjs +82 -0
  357. package/test/process-release-gate.test.mjs +9 -0
  358. package/test/production-docs.test.mjs +48 -0
  359. package/test/prompts-resources.test.mjs +41 -0
  360. package/test/provider-circuit.test.mjs +93 -0
  361. package/test/public-autonomous-ingress-budget.test.mjs +28 -0
  362. package/test/r33-closeout-regression.test.mjs +4 -3
  363. package/test/r33-finalization.test.mjs +26 -18
  364. package/test/r36-finalization.test.mjs +104 -0
  365. package/test/r36-release-identity.test.mjs +52 -0
  366. package/test/release-generation.test.mjs +23 -2
  367. package/test/release-version.test.mjs +27 -17
  368. package/test/remote-live-log-r36.test.mjs +37 -0
  369. package/test/remote-live-log-recovery-r36.test.mjs +41 -0
  370. package/test/remote-r24-catalog.test.mjs +18 -4
  371. package/test/remote-result-journal.test.mjs +58 -0
  372. package/test/remote-session-cli.test.mjs +135 -30
  373. package/test/runtime-self-update.test.mjs +121 -1
  374. package/test/semantic-backend-registry.test.mjs +29 -0
  375. package/test/semantic-code.test.mjs +66 -0
  376. package/test/semantic-lsp-backend.test.mjs +108 -0
  377. package/test/semantic-lsp-config.test.mjs +81 -0
  378. package/test/semantic-lsp-readiness.test.mjs +34 -0
  379. package/test/semantic-lsp-transient-empty.test.mjs +32 -0
  380. package/test/semantic-lsp-transient-null.test.mjs +31 -0
  381. package/test/semantic-multilang.test.mjs +72 -0
  382. package/test/semantic-r36-rename.test.mjs +82 -0
  383. package/test/semantic-runtime-routing.test.mjs +32 -0
  384. package/test/semantic-server-config-integration.test.mjs +66 -0
  385. package/test/tool-surface-ledger.test.mjs +59 -0
  386. package/test/tool-surface-snapshot.test.mjs +17 -0
  387. package/test/tracer-bullet.test.mjs +77 -0
  388. package/deadbyte-mcp-0.8.9.tgz +0 -0
@@ -1,21 +1,28 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import { mkdir, readFile, realpath, writeFile } from 'node:fs/promises';
3
+ import { loadPowerShellDataFile } from '../src/runtime-update.mjs';
3
4
  import os from 'node:os';
4
5
  import path from 'node:path';
5
6
  import { spawn } from 'node:child_process';
6
7
  import { fileURLToPath } from 'node:url';
8
+ import { probeR36FullSurface } from '../src/r36-full-surface-probe.mjs';
9
+ import { runR36CompactParity } from '../src/remote-mcp-r36-parity-client.mjs';
10
+ import { probeR36CompactDisarmed } from '../src/r36-compact-disarmed-probe.mjs';
7
11
 
8
- const here = path.dirname(fileURLToPath(import.meta.url));
9
- const root = path.resolve(here, '..');
10
- const stateRoot = path.resolve(process.env.DEADBYTE_STATE_ROOT || path.join(os.homedir(), '.deadbyte-mcp'));
11
- const deferred = path.join(root, 'scripts', 'deferred-slot-operation.mjs');
12
- const ps = 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe';
13
- const launcher = path.join(stateRoot, 'bin', 'DEADBYTE-MCP.ps1');
14
- const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
15
- const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
12
+ const here=path.dirname(fileURLToPath(import.meta.url));
13
+ const root=path.resolve(here,'..');
14
+ const stateRoot=path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));
15
+ const deferred=path.join(root,'scripts','deferred-slot-operation.mjs');
16
+ const ps='C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe';
17
+ const launcher=path.join(stateRoot,'bin','DEADBYTE-MCP.ps1');
18
+ const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));
19
+ const sha256=bytes=>createHash('sha256').update(bytes).digest('hex');
16
20
 
17
- function assert(condition, message) { if (!condition) throw new Error(message); }
18
- function parseFrozenManifest(text) {
21
+ export const R35_PREDECESSOR_RELEASE_ID='v0.9.0-b95e1ec1d9a7e26a';
22
+ export const R35_PREDECESSOR_MANIFEST='b95e1ec1d9a7e26a96ef492306c1be4df18c883ff03ab3b6015f677d7429ec8d';
23
+
24
+ function assert(condition,message){if(!condition) throw new Error(message);}
25
+ function parseFrozenManifest(text){
19
26
  const entries=[];const seen=new Set();
20
27
  for(const [index,line] of text.split(/\r?\n/).entries()){
21
28
  if(!line) continue;
@@ -27,164 +34,167 @@ function parseFrozenManifest(text) {
27
34
  }
28
35
  return entries;
29
36
  }
30
- export async function restoreFrozenStage({developmentRoot,releaseRoot,expectedManifestSha256}) {
37
+ // Restore the mutable development stage from the immutable active release after live parity work may drift it.
38
+ export async function restoreFrozenStage({developmentRoot,releaseRoot,expectedManifestSha256}){
31
39
  const dev=path.resolve(developmentRoot);const release=path.resolve(releaseRoot);
32
40
  const manifestBytes=await readFile(path.join(release,'MANIFEST.SHA256'));
33
41
  const manifestSha256=sha256(manifestBytes);
34
42
  assert(manifestSha256===expectedManifestSha256,`immutable release manifest drift: ${manifestSha256}`);
35
43
  const entries=parseFrozenManifest(manifestBytes.toString('utf8'));
36
44
  for(const entry of entries){
37
- const source=path.join(release,...entry.path.split('/'));
38
- const bytes=await readFile(source);
45
+ const source=path.join(release,...entry.path.split('/'));const bytes=await readFile(source);
39
46
  assert(sha256(bytes)===entry.sha256,`immutable release file drift: ${entry.path}`);
40
- const destination=path.join(dev,...entry.path.split('/'));
41
- await mkdir(path.dirname(destination),{recursive:true});
42
- await writeFile(destination,bytes);
43
- assert(sha256(await readFile(destination))===entry.sha256,`development restore verification failed: ${entry.path}`);
47
+ const destination=path.join(dev,...entry.path.split('/'));await mkdir(path.dirname(destination),{recursive:true});
48
+ await writeFile(destination,bytes);assert(sha256(await readFile(destination))===entry.sha256,`development restore verification failed: ${entry.path}`);
44
49
  }
45
50
  await writeFile(path.join(dev,'MANIFEST.SHA256'),manifestBytes);
46
51
  assert(sha256(await readFile(path.join(dev,'MANIFEST.SHA256')))===expectedManifestSha256,'development manifest restore verification failed');
47
52
  return {status:'restored',file_count:entries.length,manifest_sha256:manifestSha256};
48
53
  }
49
- function parseJsonOutput(text, label) {
50
- const trimmed = String(text).trim();
51
- const starts = [...trimmed.matchAll(/\{/g)].map(match => match.index);
52
- for (const start of starts) {
53
- try { return JSON.parse(trimmed.slice(start)); } catch {}
54
- }
54
+ function parseJsonOutput(text,label){
55
+ const trimmed=String(text).trim();const starts=[...trimmed.matchAll(/\{/g)].map(match=>match.index);
56
+ for(const start of starts){try{return JSON.parse(trimmed.slice(start));}catch{}}
55
57
  throw new Error(`${label} did not emit JSON`);
56
- }function run(command, args, { timeoutMs = 900000, env = process.env } = {}) {
57
- return new Promise((resolve, reject) => {
58
- const child = spawn(command, args, { cwd:root, shell:false, windowsHide:true, env, stdio:['ignore','pipe','pipe'] });
59
- const out = [], err = [];
60
- const timer = setTimeout(() => { child.kill(); reject(new Error(`command timeout: ${path.basename(command)}`)); }, timeoutMs);
61
- child.stdout.on('data', chunk => out.push(Buffer.from(chunk)));
62
- child.stderr.on('data', chunk => err.push(Buffer.from(chunk)));
63
- child.on('error', error => { clearTimeout(timer); reject(error); });
64
- child.on('exit', code => {
65
- clearTimeout(timer);
66
- const stdout = Buffer.concat(out).toString('utf8');
67
- const stderr = Buffer.concat(err).toString('utf8');
68
- if (code !== 0) reject(new Error(`command failed exit=${code}: ${stderr || stdout}`));
69
- else resolve({ stdout, stderr, exitCode:code });
58
+ }
59
+ function run(command,args,{timeoutMs=900000,env=process.env,cwd=root}={}){
60
+ return new Promise((resolve,reject)=>{
61
+ const child=spawn(command,args,{cwd,shell:false,windowsHide:true,env,stdio:['ignore','pipe','pipe']});
62
+ const out=[],err=[];const timer=setTimeout(()=>{child.kill();reject(new Error(`command timeout: ${path.basename(command)}`));},timeoutMs);
63
+ child.stdout.on('data',chunk=>out.push(Buffer.from(chunk)));child.stderr.on('data',chunk=>err.push(Buffer.from(chunk)));
64
+ child.on('error',error=>{clearTimeout(timer);reject(error);});child.on('exit',code=>{
65
+ clearTimeout(timer);const stdout=Buffer.concat(out).toString('utf8');const stderr=Buffer.concat(err).toString('utf8');
66
+ if(code!==0) reject(new Error(`command failed exit=${code}: ${stderr||stdout}`));else resolve({stdout,stderr,exitCode:code});
70
67
  });
71
68
  });
72
69
  }
73
- async function publicUrl() {
74
- const text = (await readFile(path.join(stateRoot, 'bridge', 'mcp-url.txt'), 'utf8')).trim();
75
- const url = new URL(text);
76
- if (url.protocol !== 'https:') throw new Error('public MCP URL must be HTTPS');
77
- return text;
70
+ async function publicUrl(){
71
+ const value=(await readFile(path.join(stateRoot,'bridge','mcp-url.txt'),'utf8')).trim();const url=new URL(value);
72
+ if(url.protocol!=='https:') throw new Error('public MCP URL must be HTTPS');return value;
78
73
  }
79
- async function disarmAll() {
80
- for (const command of ['disarmautonomous','disarmcoding','disarmprocess','disarmhost']) {
81
- await run(ps, ['-NoLogo','-NoProfile','-ExecutionPolicy','Bypass','-File',launcher,command], { timeoutMs:60000 });
82
- }
83
- }async function waitDeferred(statePath, timeoutMs = 180000) {
84
- const deadline = Date.now() + timeoutMs;
85
- while (Date.now() < deadline) {
86
- const state = JSON.parse(await readFile(statePath, 'utf8'));
87
- if (state.state === 'completed') return state;
88
- if (state.state === 'failed') throw new Error(`deferred ${state.mode} failed: ${state.error}`);
89
- await sleep(500);
74
+ async function pointer(){return JSON.parse(await readFile(path.join(stateRoot,'active-release.json'),'utf8'));}
75
+ async function disarmAll(){
76
+ for(const command of ['disarmautonomous','disarmcoding','disarmprocess','disarmhost']){
77
+ await run(ps,['-NoLogo','-NoProfile','-ExecutionPolicy','Bypass','-File',launcher,command],{timeoutMs:60000});
90
78
  }
79
+ }
80
+ async function waitDeferred(statePath,timeoutMs=180000){
81
+ const deadline=Date.now()+timeoutMs;
82
+ while(Date.now()<deadline){const state=JSON.parse(await readFile(statePath,'utf8'));if(state.state==='completed') return state;if(state.state==='failed') throw new Error(`deferred ${state.mode} failed: ${state.error}`);await sleep(500);}
91
83
  throw new Error(`deferred operation timeout: ${statePath}`);
92
84
  }
93
- async function scheduleDeferred(mode, value) {
94
- const scheduled = parseJsonOutput((await run(process.execPath, [deferred, mode, value], { timeoutMs:30000 })).stdout, `deferred ${mode}`);
95
- assert(scheduled.status === 'scheduled', `deferred ${mode} was not scheduled`);
96
- assert(scheduled.execution_provider === 'deadbyte_mcp' && scheduled.rdc_operation_count === 0, 'deferred operation provider mismatch');
97
- return { scheduled, completed:await waitDeferred(scheduled.state_path) };
85
+ async function scheduleDeferred(mode,value,{bridgeRoot=null,bridgeScriptSha256=null}={}){
86
+ if((bridgeRoot===null)!==(bridgeScriptSha256===null)) throw new Error('deferred bridge override requires exact root + SHA pair');
87
+ const args=[deferred,mode,value];
88
+ if(bridgeRoot!==null) args.push('--bridge-root',bridgeRoot,'--bridge-script-sha256',bridgeScriptSha256);
89
+ const scheduled=parseJsonOutput((await run(process.execPath,args,{timeoutMs:30000})).stdout,`deferred ${mode}`);
90
+ assert(scheduled.status==='scheduled',`deferred ${mode} was not scheduled`);
91
+ assert(scheduled.execution_provider==='deadbyte_mcp'&&scheduled.rdc_operation_count===0,'deferred operation provider mismatch');
92
+ return {scheduled,completed:await waitDeferred(scheduled.state_path)};
98
93
  }
99
- async function publicDisarmed(url) {
100
- const script = path.join(root, 'src', 'remote-mcp-r24-disarmed-smoke-client.mjs');
101
- const result = parseJsonOutput((await run(process.execPath, [script, url], { timeoutMs:90000 })).stdout, 'public disarmed gate');
102
- assert(result.status === 'passed' && result.tool_count === 68, 'public disarmed gate failed exact catalog');
103
- assert(result.coding_armed === false && result.autonomous_armed === false, 'public authority remained armed');
94
+ async function publicR35Disarmed(url){
95
+ const script=path.join(root,'src','remote-mcp-r24-disarmed-smoke-client.mjs');
96
+ const result=parseJsonOutput((await run(process.execPath,[script,url],{timeoutMs:90000})).stdout,'R35 predecessor disarmed gate');
97
+ assert(result.status==='passed'&&result.tool_count===73,'R35 predecessor public catalog mismatch');
98
+ assert(result.coding_armed===false&&result.autonomous_armed===false,'R35 predecessor authority remained armed');
104
99
  return result;
105
- }export function validateParityEvidence(value) {
106
- assert(value?.schema === 'deadbyte.r33-parity.v1', 'parity schema mismatch');
107
- assert(value.status === 'passed', 'parity status is not passed');
108
- assert(value.rdc_operation_count === 0 && value.execution_provider === 'deadbyte_mcp', 'parity used non-DEADBYTE execution');
109
- assert(value.public_full?.status === 'passed' && value.public_full?.tools?.length === 68, 'public full gate missing exact 68');
110
- assert(value.machine_control?.status === 'passed' && value.machine_control?.tool_count === 68, 'machine control parity missing');
111
- assert(value.autonomous?.status === 'passed' && value.autonomous?.tool_count === 68, 'autonomous parity missing');
112
- assert(value.rollback?.state === 'completed' && value.restore?.state === 'completed', 'rollback/restore not completed');
113
- assert(value.predecessor_disarmed?.tool_count === 68 && value.successor_disarmed?.tool_count === 68, 'disarmed public gate missing');
114
- for (const key of ['tree_read','precondition_mutation','search','owned_process','observation','coding_loop','autonomy','interrupted_recovery','evidence_verification']) {
115
- assert(value.requirements?.[key] === true, `parity requirement not proven: ${key}`);
116
- }
100
+ }
101
+ async function mutableCore(pointerValue){
102
+ const policy=JSON.parse(await readFile(path.join(pointerValue.generation_root,'coding-policy.json'),'utf8'));
103
+ const raw=policy?.roots?.core?.path??policy?.roots?.core?.real_path;
104
+ assert(typeof raw==='string'&&raw,'R36 generation missing coding core root');
105
+ const core=path.resolve(raw);const release=path.resolve(pointerValue.release_root);
106
+ assert(core.toLowerCase()!==release.toLowerCase(),'R36 coding core must not point at immutable active release slot');
107
+ return core;
108
+ }
109
+
110
+ export function validateParityEvidence(value){
111
+ assert(value?.schema==='deadbyte.r36-parity.v1','R36 parity schema mismatch');
112
+ assert(value.status==='passed','R36 parity status is not passed');
113
+ assert(value.rdc_operation_count===0&&value.execution_provider==='deadbyte_mcp','R36 parity used non-DEADBYTE execution');
114
+ assert(value.candidate?.version==='0.10.0'&&/^[0-9a-f]{64}$/.test(value.candidate?.manifest_sha256??''),'R36 candidate identity missing');
115
+ assert(value.local_full?.status==='passed'&&value.local_full?.tool_count===76&&value.local_full?.strict_output_schemas===true,'R36 local full 76-tool proof missing');
116
+ assert(value.public_compact?.status==='passed'&&value.public_compact?.tool_count<=42&&value.public_compact?.capability_closure===true&&value.public_compact?.gateway_count===5,'R36 public compact closure missing');
117
+ assert(value.autonomous?.status==='passed'&&value.autonomous?.signed_release_verified===true,'R36 autonomous live proof missing');
118
+ assert(value.before_rollback_disarmed?.status==='passed'&&value.before_rollback_disarmed?.capability_closure===true&&value.before_rollback_disarmed?.coding_armed===false&&value.before_rollback_disarmed?.autonomous_armed===false,'R36 pre-rollback disarm proof missing');
119
+ assert(value.rollback?.state==='completed'&&value.restore?.state==='completed','R36 rollback/restore not completed');
120
+ assert(value.stage_restore?.status==='restored'&&value.stage_restore?.manifest_sha256===value.candidate.manifest_sha256,'R36 stage restore proof missing');
121
+ assert(value.predecessor?.release_id===R35_PREDECESSOR_RELEASE_ID&&value.predecessor?.manifest_sha256===R35_PREDECESSOR_MANIFEST&&value.predecessor?.version==='0.9.0','R35 exact predecessor identity mismatch');
122
+ assert(value.predecessor_disarmed?.status==='passed'&&value.predecessor_disarmed?.tool_count===73,'R35 predecessor public proof missing');
123
+ assert(value.successor?.version==='0.10.0'&&value.successor?.manifest_sha256===value.candidate.manifest_sha256,'R36 exact successor restore identity mismatch');
124
+ assert(value.successor_disarmed?.status==='passed'&&value.successor_disarmed?.capability_closure===true&&value.successor_disarmed?.coding_armed===false&&value.successor_disarmed?.autonomous_armed===false,'R36 successor disarmed proof missing');
125
+ assert(value.immutable_slot?.protected===true&&value.immutable_slot?.development_root!==value.immutable_slot?.release_root,'R36 immutable-slot separation missing');
126
+ for(const key of ['tree_read','precondition_mutation','search','owned_process','observation','coding_loop','autonomy','interrupted_recovery','evidence_verification','compact_closure','full_surface']) assert(value.requirements?.[key]===true,`R36 parity requirement not proven: ${key}`);
117
127
  return true;
118
128
  }
119
129
 
120
- export async function runReleaseParity(activationReceiptPath) {
121
- const pointer = JSON.parse(await readFile(path.join(stateRoot, 'active-release.json'), 'utf8'));
122
- const candidateManifest = sha256(await readFile(path.join(root, 'MANIFEST.SHA256')));
123
- assert(pointer.manifest_sha256 === candidateManifest, 'active release is not the canonical candidate');
124
- const url = await publicUrl();
125
- const publicFullScript = path.join(root, 'src', 'remote-mcp-smoke-client.mjs');
126
- const machineScript = path.join(root, 'src', 'remote-mcp-r33-parity-client.mjs');
127
- const autonomousScript = path.join(root, 'src', 'remote-mcp-autonomous-smoke-client.mjs'); let publicFull,machineControl,autonomous,publicGatesPassed=false;
128
- try {
129
- publicFull = parseJsonOutput((await run(process.execPath, [publicFullScript, url, 'full'], { timeoutMs:180000 })).stdout, 'public full gate');
130
- machineControl = parseJsonOutput((await run(process.execPath, [machineScript, url], { timeoutMs:600000 })).stdout, 'R33 machine parity');
131
- autonomous = parseJsonOutput((await run(process.execPath, [autonomousScript, url], { timeoutMs:900000 })).stdout, 'R33 autonomous parity');
132
- assert(publicFull.status === 'passed' && publicFull.tools?.length === 68, 'public full gate did not expose exact 68');
133
- assert(machineControl.status === 'passed' && machineControl.tool_count === 68, 'machine-control parity failed');
134
- assert(autonomous.status === 'passed' && autonomous.tool_count === 68, 'autonomous parity failed');
135
- publicGatesPassed=true;
136
- } finally {
137
- let restoreError=null;
138
- try {
139
- await restoreFrozenStage({developmentRoot:root,releaseRoot:pointer.release_root,expectedManifestSha256:candidateManifest});
140
- } catch(error) { restoreError=error; }
141
- if(!publicGatesPassed||restoreError) await disarmAll().catch(()=>{});
142
- if(restoreError) throw restoreError;
143
- }
130
+ export async function runReleaseParity(activationReceiptPath){
131
+ const active=await pointer();const candidateManifest=sha256(await readFile(path.join(root,'MANIFEST.SHA256')));
132
+ assert(active.version==='0.10.0','R36 parity requires active 0.10.0 candidate');
133
+ assert(active.manifest_sha256===candidateManifest,'active release is not canonical R36 candidate');
134
+ const activeConfig=await loadPowerShellDataFile(active.config_path);
135
+ const successorBridgeRootRaw=activeConfig?.Bridge?.WorkingDirectory;
136
+ const successorBridgeConfiguredSha=activeConfig?.Bridge?.ScriptSha256;
137
+ assert(typeof successorBridgeRootRaw==='string'&&path.isAbsolute(successorBridgeRootRaw),'R36 active bridge root missing');
138
+ assert(typeof successorBridgeConfiguredSha==='string'&&/^[0-9a-f]{64}$/.test(successorBridgeConfiguredSha),'R36 active bridge SHA missing');
139
+ const successorBridgeRoot=await realpath(path.resolve(successorBridgeRootRaw));
140
+ const successorBridgeActualSha=sha256(await readFile(path.join(successorBridgeRoot,'src','bridge.mjs')));
141
+ assert(successorBridgeActualSha===successorBridgeConfiguredSha,'R36 active bridge bytes do not match generation pin');
142
+ const successorBridge={root:successorBridgeRoot,sha256:successorBridgeActualSha};
143
+ const developmentRoot=await mutableCore(active);
144
+ const localFull=await probeR36FullSurface({packageRoot:active.release_root,generationRoot:active.generation_root,stateRoot});
145
+ const url=await publicUrl();
146
+ let publicCompact,autonomous;
147
+ try{
148
+ publicCompact=await runR36CompactParity(url);
149
+ autonomous=parseJsonOutput((await run(process.execPath,[path.join(root,'src','remote-mcp-autonomous-smoke-client.mjs'),url],{timeoutMs:900000})).stdout,'R36 autonomous compact parity');
150
+ assert(autonomous.status==='passed'&&autonomous.signed_release_verified===true,'R36 autonomous compact parity failed');
151
+ }catch(error){await disarmAll().catch(()=>{});throw error;}
144
152
 
145
153
  await disarmAll();
146
- const beforeRollback = await publicDisarmed(url);
147
- const rollbackPair = await scheduleDeferred('rollback', path.resolve(activationReceiptPath));
148
- const predecessorDisarmed = await publicDisarmed(url);
149
- const restorePair = await scheduleDeferred('activate', candidateManifest);
150
- const successorDisarmed = await publicDisarmed(url);
151
- const finalPointer = JSON.parse(await readFile(path.join(stateRoot, 'active-release.json'), 'utf8'));
152
- assert(finalPointer.manifest_sha256 === candidateManifest, 'restore did not return canonical candidate');
154
+ const beforeRollback=await probeR36CompactDisarmed(url);
155
+ const rollbackPair=await scheduleDeferred('rollback',path.resolve(activationReceiptPath));
156
+ const predecessor=await pointer();
157
+ assert(predecessor.release_id===R35_PREDECESSOR_RELEASE_ID&&predecessor.manifest_sha256===R35_PREDECESSOR_MANIFEST&&predecessor.version==='0.9.0','rollback did not reach exact sealed R35 predecessor');
158
+ const predecessorDisarmed=await publicR35Disarmed(url);
159
+ const stageRestore=await restoreFrozenStage({developmentRoot,releaseRoot:active.release_root,expectedManifestSha256:candidateManifest});
160
+ const restorePair=await scheduleDeferred('activate',candidateManifest,{bridgeRoot:successorBridge.root,bridgeScriptSha256:successorBridge.sha256});
161
+ const successor=await pointer();
162
+ assert(successor.version==='0.10.0'&&successor.manifest_sha256===candidateManifest,'restore did not return exact R36 candidate');
163
+ const successorDisarmed=await probeR36CompactDisarmed(url);
164
+ await disarmAll();
153
165
 
154
- const evidence = {
155
- schema:'deadbyte.r33-parity.v1', status:'passed', completed_at_utc:new Date().toISOString(),
156
- release_id:finalPointer.release_id, manifest_sha256:candidateManifest,
157
- execution_provider:'deadbyte_mcp', rdc_operation_count:0,
158
- public_full:publicFull, machine_control:machineControl, autonomous,
159
- before_rollback_disarmed:beforeRollback,
160
- rollback:{...rollbackPair.completed, scheduled_operation_id:rollbackPair.scheduled.operation_id},
161
- predecessor_disarmed:predecessorDisarmed,
162
- restore:{...restorePair.completed, scheduled_operation_id:restorePair.scheduled.operation_id},
163
- successor_disarmed:successorDisarmed, requirements:{
164
- tree_read:machineControl.bounded_read_verified === true && machineControl.tree_entries >= 0,
165
- precondition_mutation:machineControl.stale_precondition_denied === true && machineControl.machine_fs_receipts_verified >= 3,
166
- search:machineControl.search_result_count >= 1,
167
- owned_process:typeof machineControl.process_session_id === 'string' && machineControl.process_output_bytes > 0,
168
- observation:machineControl.observation_receipts_verified >= 3,
169
- coding_loop:machineControl.coding_receipts_verified === 2,
170
- autonomy:autonomous.signed_release_verified === true && autonomous.observed_failure_before_replan === true,
171
- interrupted_recovery:rollbackPair.completed.state === 'completed' && restorePair.completed.state === 'completed',
172
- evidence_verification:machineControl.machine_fs_receipts_verified >= 3 && autonomous.signed_release_verified === true
166
+ const evidence={
167
+ schema:'deadbyte.r36-parity.v1',status:'passed',completed_at_utc:new Date().toISOString(),execution_provider:'deadbyte_mcp',rdc_operation_count:0,
168
+ candidate:{release_id:active.release_id,version:active.version,manifest_sha256:candidateManifest},
169
+ immutable_slot:{protected:true,release_root:path.resolve(active.release_root),development_root:developmentRoot},
170
+ local_full:localFull,public_compact:publicCompact,autonomous,before_rollback_disarmed:beforeRollback,
171
+ rollback:{...rollbackPair.completed,scheduled_operation_id:rollbackPair.scheduled.operation_id},
172
+ predecessor:{release_id:predecessor.release_id,version:predecessor.version,manifest_sha256:predecessor.manifest_sha256},predecessor_disarmed:predecessorDisarmed,
173
+ stage_restore:stageRestore,
174
+ restore:{...restorePair.completed,scheduled_operation_id:restorePair.scheduled.operation_id},
175
+ successor:{release_id:successor.release_id,version:successor.version,manifest_sha256:successor.manifest_sha256},successor_disarmed:successorDisarmed,
176
+ requirements:{
177
+ tree_read:publicCompact.tree_entries>=0&&publicCompact.coding_stat_verified===true,
178
+ precondition_mutation:publicCompact.machine_fs_receipts_verified>=3,
179
+ search:publicCompact.coding_search_result_count>=1&&publicCompact.observation_search_result_count>=1,
180
+ owned_process:typeof publicCompact.process_session_id==='string'&&publicCompact.process_output_bytes>0,
181
+ observation:publicCompact.observation_receipts_verified>=2,
182
+ coding_loop:publicCompact.coding_receipts_verified===2,
183
+ autonomy:autonomous.signed_release_verified===true&&autonomous.observed_failure_before_replan===true,
184
+ interrupted_recovery:rollbackPair.completed.state==='completed'&&restorePair.completed.state==='completed',
185
+ evidence_verification:publicCompact.machine_fs_receipts_verified>=3&&autonomous.signed_release_verified===true,
186
+ compact_closure:publicCompact.capability_closure===true&&successorDisarmed.capability_closure===true,
187
+ full_surface:localFull.tool_count===76&&localFull.strict_output_schemas===true
173
188
  }
174
189
  };
175
190
  validateParityEvidence(evidence);
176
- const evidenceDir = path.join(stateRoot, 'evidence', 'release');
177
- await mkdir(evidenceDir, { recursive:true });
178
- const evidencePath = path.join(evidenceDir, `r33-parity-${candidateManifest.slice(0,16)}.json`);
179
- const bytes = Buffer.from(`${JSON.stringify(evidence, null, 2)}\n`, 'utf8');
180
- await writeFile(evidencePath, bytes);
181
- return { evidence, evidence_path:evidencePath, evidence_sha256:sha256(bytes) };
191
+ const evidenceDir=path.join(stateRoot,'evidence','release');await mkdir(evidenceDir,{recursive:true});
192
+ const evidencePath=path.join(evidenceDir,`r36-parity-${candidateManifest.slice(0,16)}.json`);
193
+ const bytes=Buffer.from(`${JSON.stringify(evidence,null,2)}\n`,'utf8');await writeFile(evidencePath,bytes);
194
+ return {evidence,evidence_path:evidencePath,evidence_sha256:sha256(bytes)};
182
195
  }
183
196
 
184
- if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
185
- const receipt = process.argv[2];
186
- if (!receipt) throw new Error('usage: node scripts/release-parity.mjs <activation-receipt.json>');
187
- runReleaseParity(receipt)
188
- .then(result => console.log(JSON.stringify({ status:'passed', ...result }, null, 2)))
189
- .catch(error => { console.error(error instanceof Error ? error.stack : String(error)); process.exitCode = 1; });
190
- }
197
+ if(process.argv[1]&&path.resolve(process.argv[1])===fileURLToPath(import.meta.url)){
198
+ const receipt=process.argv[2];if(!receipt) throw new Error('usage: node scripts/release-parity.mjs <activation-receipt.json>');
199
+ runReleaseParity(receipt).then(result=>console.log(JSON.stringify({status:'passed',...result},null,2))).catch(error=>{console.error(error instanceof Error?error.stack:String(error));process.exitCode=1;});
200
+ }
@@ -0,0 +1,73 @@
1
+ param(
2
+ [Parameter(Mandatory=$true)][string]$ConfigPath,
3
+ [Parameter(Mandatory=$true)][ValidatePattern('^[0-9a-fA-F]{64}$')][string]$ConfigSha256,
4
+ [string[]]$RequiredIds=@('pyright','rust-analyzer','clangd'),
5
+ [string]$OutputPath=''
6
+ )
7
+ $ErrorActionPreference='Stop'
8
+ function Hash-Lower([string]$Path){
9
+ if(-not (Test-Path -LiteralPath $Path -PathType Leaf)){ throw "missing file: $Path" }
10
+ return (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToLowerInvariant()
11
+ }
12
+ $configFull=[IO.Path]::GetFullPath($ConfigPath)
13
+ $expected=$ConfigSha256.ToLowerInvariant()
14
+ $observed=Hash-Lower $configFull
15
+ if($observed -ne $expected){ throw "semantic config SHA-256 mismatch: expected $expected found $observed" }
16
+ $config=Get-Content -LiteralPath $configFull -Raw -Encoding UTF8 | ConvertFrom-Json
17
+ if([string]$config.schema -ne 'deadbyte.semantic-lsp-config.v1'){ throw 'semantic config schema mismatch' }
18
+ $servers=@($config.servers)
19
+ $seen=@{}
20
+ $records=@()
21
+ foreach($server in $servers){
22
+ $id=[string]$server.id
23
+ if([string]::IsNullOrWhiteSpace($id)){ throw 'semantic server id missing' }
24
+ if($seen.ContainsKey($id)){ throw "duplicate semantic server id: $id" }
25
+ $seen[$id]=$true
26
+ $exe=[string]$server.executable_path
27
+ $exeExpected=([string]$server.executable_sha256).ToLowerInvariant()
28
+ if($exeExpected -notmatch '^[0-9a-f]{64}$'){ throw "semantic executable SHA invalid for $id" }
29
+ $exeObserved=Hash-Lower $exe
30
+ if($exeObserved -ne $exeExpected){ throw "semantic executable SHA-256 mismatch for ${id}: expected $exeExpected found $exeObserved" }
31
+ $deps=@()
32
+ foreach($dep in @($server.dependencies)){
33
+ $depPath=[string]$dep.path
34
+ $depExpected=([string]$dep.expected_sha256).ToLowerInvariant()
35
+ if($depExpected -notmatch '^[0-9a-f]{64}$'){ throw "semantic dependency SHA invalid for $id" }
36
+ $depObserved=Hash-Lower $depPath
37
+ if($depObserved -ne $depExpected){ throw "semantic dependency SHA-256 mismatch for ${id}: expected $depExpected found $depObserved" }
38
+ $deps += [ordered]@{path=$depPath;sha256=$depObserved}
39
+ }
40
+ $settle=0
41
+ if($null -ne $server.startup_settle_ms){ $settle=[int]$server.startup_settle_ms }
42
+ $records += [ordered]@{
43
+ id=$id
44
+ language_id=[string]$server.language_id
45
+ required=[bool]$server.required
46
+ executable_path=$exe
47
+ executable_sha256=$exeObserved
48
+ dependencies=$deps
49
+ startup_settle_ms=$settle
50
+ status='pinned'
51
+ }
52
+ }
53
+ foreach($required in $RequiredIds){
54
+ if(-not $seen.ContainsKey($required)){ throw "missing required semantic server: $required" }
55
+ }
56
+ $payload=[ordered]@{
57
+ schema='deadbyte.r35-semantic-preflight.v1'
58
+ status='passed'
59
+ config_path=$configFull
60
+ config_sha256=$observed
61
+ builtin=@([ordered]@{id='typescript';language_id='typescript';status='builtin';required=$true})
62
+ required_ids=@('typescript') + @($RequiredIds)
63
+ servers=$records
64
+ }
65
+ $json=$payload | ConvertTo-Json -Depth 12
66
+ if($OutputPath){
67
+ $out=[IO.Path]::GetFullPath($OutputPath)
68
+ $dir=Split-Path -Parent $out
69
+ if($dir -and -not(Test-Path -LiteralPath $dir)){ New-Item -ItemType Directory -Force -Path $dir | Out-Null }
70
+ [IO.File]::WriteAllText($out,$json,[Text.UTF8Encoding]::new($false))
71
+ }
72
+ Write-Output $json
73
+ Write-Host ("R35_SEMANTIC_PREFLIGHT_PASS config={0} required={1}" -f $observed,(@('typescript')+@($RequiredIds) -join ','))
@@ -0,0 +1,73 @@
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
5
+ import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/client/stdio';
6
+ import { snapshotToolsListResult } from '../src/tool-surface-ledger.mjs';
7
+
8
+ function parseArgs(argv){
9
+ const out={input:'',endpointFile:'',output:''};
10
+ for(let i=0;i<argv.length;i+=1){
11
+ const arg=argv[i];
12
+ if(arg==='--input') out.input=argv[++i]??'';
13
+ else if(arg==='--endpoint-file') out.endpointFile=argv[++i]??'';
14
+ else if(arg==='--output') out.output=argv[++i]??'';
15
+ else throw new Error(`unknown argument: ${arg}`);
16
+ }
17
+ if(Boolean(out.input)===Boolean(out.endpointFile)) throw new Error('use exactly one of --input or --endpoint-file');
18
+ if(!out.input&&!out.endpointFile) throw new Error('missing snapshot source');
19
+ return out;
20
+ }
21
+
22
+ async function listFromEndpointFile(endpointFile){
23
+ const endpointText=(await readFile(path.resolve(endpointFile),'utf8')).trim();
24
+ const endpoint=new URL(endpointText);
25
+ if(endpoint.protocol!=='https:') throw new Error('tool surface endpoint must use HTTPS');
26
+ const client=new Client({name:'deadbyte-r35-tool-surface',version:'0.9.0'},{versionNegotiation:{mode:{pin:'2026-07-28'}}});
27
+ const transport=new StreamableHTTPClientTransport(endpoint);
28
+ try{
29
+ await client.connect(transport);
30
+ return await client.listTools();
31
+ } finally {
32
+ await client.close().catch(()=>{});
33
+ }
34
+ }
35
+
36
+ export async function snapshotStdioServer({command,args=[],cwd=process.cwd(),env={}}){
37
+ if(typeof command!=='string'||command.length<1) throw new Error('stdio snapshot command required');
38
+ if(!Array.isArray(args)||args.some(arg=>typeof arg!=='string')) throw new Error('stdio snapshot args must be strings');
39
+ const client=new Client({name:'deadbyte-r35-tool-surface-stdio',version:'0.9.0'},{versionNegotiation:{mode:{pin:'2026-07-28'}}});
40
+ const transport=new StdioClientTransport({
41
+ command,
42
+ args,
43
+ cwd,
44
+ env:{...getDefaultEnvironment(),...env},
45
+ stderr:'pipe'
46
+ });
47
+ try{
48
+ await client.connect(transport);
49
+ return snapshotToolsListResult(await client.listTools());
50
+ } finally {
51
+ await client.close().catch(()=>{});
52
+ }
53
+ }
54
+
55
+ export async function snapshotSource({input='',endpointFile=''}){
56
+ const listed=input
57
+ ? JSON.parse(await readFile(path.resolve(input),'utf8'))
58
+ : await listFromEndpointFile(endpointFile);
59
+ return snapshotToolsListResult(listed);
60
+ }
61
+
62
+ export async function main(argv=process.argv.slice(2)){
63
+ const args=parseArgs(argv);
64
+ const snapshot=await snapshotSource(args);
65
+ const text=`${JSON.stringify(snapshot,null,2)}\n`;
66
+ if(args.output) await writeFile(path.resolve(args.output),text,{encoding:'utf8',flag:'w'});
67
+ else process.stdout.write(text);
68
+ return snapshot;
69
+ }
70
+
71
+ if(process.argv[1]&&path.resolve(process.argv[1])===fileURLToPath(import.meta.url)){
72
+ main().catch(error=>{console.error(error instanceof Error?error.stack:String(error));process.exitCode=1;});
73
+ }
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  const here=path.dirname(fileURLToPath(import.meta.url));
8
8
  const root=path.resolve(here,'..');
9
9
  const sha256=bytes=>createHash('sha256').update(bytes).digest('hex');
10
- const marker='DEADBYTE V0.8.10 / R33 WINDOWS BATCH GATE: PASS';
10
+ const marker='DEADBYTE V0.10.0 / R36 WINDOWS BATCH GATE: PASS';
11
11
  function insist(ok,message){if(!ok) throw new Error(message);}
12
12
 
13
13
  export async function writeWindowsGateEvidence({
@@ -19,17 +19,17 @@ export async function writeWindowsGateEvidence({
19
19
  const manifestBytes=await readFile(path.join(candidate,'MANIFEST.SHA256'));
20
20
  const manifestSha256=sha256(manifestBytes);
21
21
  const pkg=JSON.parse(await readFile(path.join(candidate,'package.json'),'utf8'));
22
- insist(pkg.version==='0.8.10',`Windows gate evidence requires V0.8.10, found ${pkg.version}`);
22
+ insist(pkg.version==='0.10.0',`Windows gate evidence requires V0.10.0, found ${pkg.version}`);
23
23
  const completed=clock();
24
24
  insist(completed instanceof Date&&!Number.isNaN(completed.getTime()),'Windows gate evidence clock invalid');
25
25
  const evidence={
26
- schema:'deadbyte.r33-windows-gate.v1',status:'passed',exit_code:0,version:'0.8.10',
26
+ schema:'deadbyte.r36-windows-gate.v1',status:'passed',exit_code:0,version:'0.10.0',
27
27
  marker,completed_at_utc:completed.toISOString(),manifest_sha256:manifestSha256
28
28
  };
29
29
  const bytes=Buffer.from(`${JSON.stringify(evidence,null,2)}\n`,'utf8');
30
30
  const dir=path.join(path.resolve(stateRoot),'evidence','release');
31
31
  await mkdir(dir,{recursive:true});
32
- const file=path.join(dir,`r33-windows-gate-${manifestSha256.slice(0,16)}.json`);
32
+ const file=path.join(dir,`r36-windows-gate-${manifestSha256.slice(0,16)}.json`);
33
33
  try{
34
34
  const handle=await open(file,'wx',0o600);
35
35
  try{await handle.writeFile(bytes);await handle.sync();}finally{await handle.close();}
@@ -39,7 +39,7 @@ export async function writeWindowsGateEvidence({
39
39
  const existingBytes=await readFile(file);
40
40
  const existing=JSON.parse(existingBytes.toString('utf8'));
41
41
  insist(existing.schema===evidence.schema&&existing.status==='passed'&&existing.exit_code===0,'existing Windows gate evidence invalid');
42
- insist(existing.version==='0.8.10'&&existing.marker===marker&&existing.manifest_sha256===manifestSha256,'existing Windows gate evidence binding mismatch');
42
+ insist(existing.version==='0.10.0'&&existing.marker===marker&&existing.manifest_sha256===manifestSha256,'existing Windows gate evidence binding mismatch');
43
43
  return {status:'existing',path:file,sha256:sha256(existingBytes),manifest_sha256:manifestSha256};
44
44
  }
45
45
  }
@@ -43,6 +43,8 @@ export async function verifyAuditChain({stateRoot,verifyKeyPath,requireComplete=
43
43
 
44
44
  let seq=0,head=ZERO,previousCheckpoint=ZERO,requestCount=0,resultCount=0,checkpointCount=0;
45
45
  const open=new Map();
46
+ const usage=new Map();
47
+ const usageFor=tool=>{ if(!usage.has(tool)) usage.set(tool,{tool,requests:0,results:0,errors:0}); return usage.get(tool); };
46
48
  for(let pos=0;pos<segmentIndexes.length;pos++){
47
49
  const index=segmentIndexes[pos],fileName=segmentName(index),file=path.join(auditDir,fileName),bytes=await readFile(file),rows=parseSegment(bytes,fileName);
48
50
  const firstSeq=seq+1,firstPrev=head;
@@ -59,11 +61,12 @@ export async function verifyAuditChain({stateRoot,verifyKeyPath,requireComplete=
59
61
  if(event.event_type==='tool.request'){
60
62
  if(open.has(event.request_id)) throw new Error(`audit duplicate request id at seq ${event.seq}`);
61
63
  if(event.args===undefined) throw new Error(`audit request args missing at seq ${event.seq}`);
62
- open.set(event.request_id,{tool:event.tool,seq:event.seq,segment:index});requestCount++;
64
+ open.set(event.request_id,{tool:event.tool,seq:event.seq,segment:index});requestCount++;usageFor(event.tool).requests++;
63
65
  }else if(event.event_type==='tool.result'){
64
66
  const pending=open.get(event.request_id);if(!pending) throw new Error(`audit orphan result at seq ${event.seq}`);
65
67
  if(pending.tool!==event.tool) throw new Error(`audit result tool mismatch at seq ${event.seq}`);
66
68
  requireObject(event.outcome,`audit outcome at seq ${event.seq}`);
69
+ const stats=usageFor(event.tool);stats.results++;if(event.outcome.is_error===true)stats.errors++;
67
70
  open.delete(event.request_id);resultCount++;
68
71
  }else throw new Error(`audit event type invalid at seq ${event.seq}`);
69
72
  seq=event.seq;head=event.event_sha256;
@@ -88,6 +91,7 @@ export async function verifyAuditChain({stateRoot,verifyKeyPath,requireComplete=
88
91
  }
89
92
  }
90
93
  if(requireComplete&&open.size>0) throw new Error(`audit has ${open.size} request(s) without result`);
91
- return {ok:true,event_count:seq,request_count:requestCount,result_count:resultCount,open_request_count:open.size,segment_count:segmentIndexes.length,checkpoint_count:checkpointCount,last_seq:seq,head_sha256:head,last_checkpoint_sha256:previousCheckpoint,key_id:key.keyId,complete:open.size===0};
94
+ const toolUsage=[...usage.values()].sort((a,b)=>a.tool.localeCompare(b.tool,'en'));
95
+ return {ok:true,event_count:seq,request_count:requestCount,result_count:resultCount,open_request_count:open.size,segment_count:segmentIndexes.length,checkpoint_count:checkpointCount,last_seq:seq,head_sha256:head,last_checkpoint_sha256:previousCheckpoint,key_id:key.keyId,complete:open.size===0,tool_usage:toolUsage};
92
96
  }catch(error){return {ok:false,reason:String(error?.message||error)};}
93
97
  }