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
@@ -0,0 +1,338 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFile, writeFile } from 'node:fs/promises';
4
+ import {
5
+ createR34Fixture,sendPlannerDecision,planCreateDecision,inspectDecision,patchDecision,
6
+ stepCompleteDecision,finishDecision
7
+ } from './helpers/autonomous-r34-fixture.mjs';
8
+
9
+ test('R34 loop executes plan -> inspect -> act -> verify -> step complete -> finish', async () => {
10
+ const f = await createR34Fixture();
11
+ try {
12
+ const goal = await f.runtime.submit({submissionId:'r34-happy',rootId:'project',title:'repair',
13
+ goal:'change x to y',acceptance:'x.txt contains y and release evidence verifies'});
14
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
15
+ assert.equal(result.status,'input_required');
16
+
17
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
18
+ assert.equal(result.status,'input_required');
19
+ assert.equal(result.loop.phase,'INSPECTING');
20
+ let status = await f.runtime.status({goalId:goal.goal_id});
21
+ assert.equal(status.loop.phase,'INSPECTING');
22
+ assert.equal(status.loop.plan_version,1);
23
+ assert.equal(status.loop.current_step.step_id,'repair');
24
+
25
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
26
+ assert.equal(result.status,'input_required');
27
+ status = await f.runtime.status({goalId:goal.goal_id});
28
+ assert.equal(status.loop.phase,'ACTING');
29
+
30
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256));
31
+ assert.equal(result.status,'input_required');
32
+ assert.equal(await readFile(f.target,'utf8'),'y\n');
33
+ status = await f.runtime.status({goalId:goal.goal_id});
34
+ assert.equal(status.loop.phase,'VERIFYING');
35
+ const afterAct = await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
36
+ const committed = afterAct.events.find(event=>event.type==='native_diff_committed');
37
+ assert.ok(committed);
38
+ assert.ok(afterAct.events.some(event=>event.type==='progress_judged'&&event.payload.verdict==='progress'));
39
+
40
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,stepCompleteDecision([{
41
+ kind:'native_diff',id:'repair-diff',sha256:committed.payload.diff_receipt_sha256
42
+ }]));
43
+ assert.equal(result.status,'input_required');
44
+ status = await f.runtime.status({goalId:goal.goal_id});
45
+ assert.equal(status.loop.phase,'PLANNING');
46
+ assert.equal(status.loop.current_step,null);
47
+
48
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,finishDecision(),{maxCycles:8});
49
+ assert.equal(result.status,'completed');
50
+ status = await f.runtime.status({goalId:goal.goal_id});
51
+ assert.equal(status.state,'succeeded');
52
+ assert.equal(status.loop.phase,'COMPLETE');
53
+ assert.equal(status.loop.plan_version,1);
54
+ assert.equal((await f.runtime.verify({goalId:goal.goal_id})).ok,true);
55
+ } finally { await f.cleanup(); }
56
+ });
57
+
58
+ test('R34 missing authority waits durably and approval resumes the same phase after operator re-arm', async () => {
59
+ const f = await createR34Fixture();
60
+ try {
61
+ const goal = await f.runtime.submit({submissionId:'r34-authority-wait',rootId:'project',title:'repair',
62
+ goal:'change x to y',acceptance:'verified mutation'});
63
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
64
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
65
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
66
+ assert.equal(result.loop.phase,'ACTING');
67
+
68
+ await f.disarm();
69
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256));
70
+ assert.equal(result.status,'paused');
71
+ assert.equal(result.loop.phase,'WAITING');
72
+ assert.equal(result.loop.wait_reason,'authority_unavailable');
73
+ assert.equal(await readFile(f.target,'utf8'),'x\n');
74
+ let journal = await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
75
+ assert.equal(journal.events.filter(event=>event.type==='action_started').length,0);
76
+
77
+ await f.arm();
78
+ const approved = await f.runtime.approve({goalId:goal.goal_id,decision:'approve'});
79
+ assert.equal(approved.status,'approved');
80
+ assert.equal(approved.loop.phase,'ACTING');
81
+ const resumed = await f.runtime.run({goalId:goal.goal_id,maxCycles:2});
82
+ assert.equal(resumed.status,'input_required');
83
+ assert.equal(resumed.loop.phase,'ACTING');
84
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,resumed,patchDecision(f.initial_sha256));
85
+ assert.equal(result.loop.phase,'VERIFYING');
86
+ assert.equal(await readFile(f.target,'utf8'),'y\n');
87
+ } finally { await f.cleanup(); }
88
+ });
89
+
90
+ test('R34 finish is blocked while the active plan is incomplete', async () => {
91
+ const f = await createR34Fixture();
92
+ try {
93
+ const goal = await f.runtime.submit({submissionId:'r34-finish-blocked',rootId:'project',title:'repair',
94
+ goal:'change x to y',acceptance:'complete the plan first'});
95
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
96
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
97
+ assert.equal(result.loop.phase,'INSPECTING');
98
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,finishDecision());
99
+ assert.equal(result.status,'input_required');
100
+ assert.equal(result.loop.phase,'INSPECTING');
101
+ const journal = await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
102
+ const blocked = journal.events.find(event=>event.type==='plan_guard_blocked');
103
+ assert.ok(blocked);
104
+ assert.equal(blocked.payload.reason,'plan_incomplete_blocks_finish');
105
+ assert.equal(await readFile(f.target,'utf8'),'x\n');
106
+ } finally { await f.cleanup(); }
107
+ });
108
+
109
+ test('R34 failed verification enters REPLANNING with regressed progress evidence', async () => {
110
+ const f = await createR34Fixture({withFailingProfile:true});
111
+ try {
112
+ const goal = await f.runtime.submit({submissionId:'r34-verification-regressed',rootId:'project',title:'verify',
113
+ goal:'inspect then verify x.txt',acceptance:'verification must pass'});
114
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
115
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
116
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
117
+ assert.equal(result.loop.phase,'ACTING');
118
+
119
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,{
120
+ schema:'deadbyte.autonomous-decision.v2',kind:'act',action:{kind:'run_profile',profile_id:'check'}
121
+ });
122
+ assert.equal(result.status,'input_required');
123
+ assert.equal(result.loop.phase,'REPLANNING');
124
+ assert.equal(await readFile(f.target,'utf8'),'x\n');
125
+ const journal = await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
126
+ const failed = journal.events.find(event=>event.type==='profile_completed'&&event.payload.profile_id==='check');
127
+ assert.ok(failed);
128
+ assert.equal(failed.payload.passed,false);
129
+ const progress = [...journal.events].reverse().find(event=>event.type==='progress_judged');
130
+ assert.ok(progress);
131
+ assert.equal(progress.payload.verdict,'regressed');
132
+ const critic = journal.events.find(event=>event.type==='critic_classified'&&event.payload.failure_class==='verification_failure');
133
+ assert.ok(critic);
134
+ assert.equal(critic.payload.evidence_fingerprint,progress.payload.fingerprint);
135
+ assert.ok(journal.events.some(event=>event.type==='phase_changed'&&event.payload.to==='CRITIC'));
136
+ } finally { await f.cleanup(); }
137
+ });
138
+
139
+ test('R34 operator reject cancels a waiting goal without requiring authority re-arm', async () => {
140
+ const f = await createR34Fixture();
141
+ try {
142
+ const goal = await f.runtime.submit({submissionId:'r34-reject-waiting',rootId:'project',title:'repair',
143
+ goal:'change x to y',acceptance:'verified mutation'});
144
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
145
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
146
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
147
+ await f.disarm();
148
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256));
149
+ assert.equal(result.loop.phase,'WAITING');
150
+ const rejected = await f.runtime.approve({goalId:goal.goal_id,decision:'reject'});
151
+ assert.equal(rejected.status,'rejected');
152
+ assert.equal(rejected.state,'cancelled');
153
+ assert.equal(rejected.loop.phase,'WAITING');
154
+ assert.equal(rejected.loop.wait_reason,'resume_rejected');
155
+ assert.equal(rejected.loop.pending_approval,false);
156
+ assert.equal(await readFile(f.target,'utf8'),'x\n');
157
+ } finally { await f.cleanup(); }
158
+ });
159
+
160
+ test('R34 stale SHA returns to REPLANNING without force overwrite', async () => {
161
+ const f = await createR34Fixture();
162
+ try {
163
+ const goal = await f.runtime.submit({submissionId:'r34-stale-sha',rootId:'project',title:'repair',
164
+ goal:'change x to y',acceptance:'never overwrite drifted source'});
165
+ let result = await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
166
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
167
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
168
+ assert.equal(result.loop.phase,'ACTING');
169
+ await writeFile(f.target,'external\n');
170
+ result = await sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256));
171
+ assert.equal(await readFile(f.target,'utf8'),'external\n');
172
+ assert.equal(result.status,'input_required');
173
+ assert.equal(result.loop.phase,'REPLANNING');
174
+ const journal = await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
175
+ assert.ok(journal.events.some(event=>event.type==='action_precondition_failed'&&event.payload.reason==='stale_sha'));
176
+ assert.ok(journal.events.some(event=>event.type==='critic_classified'&&event.payload.failure_class==='stale_precondition'));
177
+ assert.ok(journal.events.some(event=>event.type==='phase_changed'&&event.payload.to==='CRITIC'));
178
+ assert.equal(journal.events.filter(event=>event.type==='native_diff_committed').length,0);
179
+ } finally { await f.cleanup(); }
180
+ });
181
+
182
+ test('R34 forged profile receipt substitution enters WAITING without replay', async () => {
183
+ let receiptDurable=false;
184
+ let crashOnce=true;
185
+ let commandCalls=0;
186
+ const f = await createR34Fixture({withFailingProfile:true,codingRuntimeFactory:base=>Object.freeze({...base,
187
+ commandRun:async args=>{ commandCalls+=1; const result=await base.commandRun(args); receiptDurable=true; return result; },
188
+ verifyReceiptDetailed:async receiptId=>{
189
+ const checked=await base.verifyReceiptDetailed(receiptId);
190
+ if(receiptDurable&&crashOnce){ crashOnce=false; throw new Error('simulated crash after profile receipt'); }
191
+ return checked;
192
+ }
193
+ })});
194
+ try {
195
+ const goal=await f.runtime.submit({submissionId:'r34-forged-receipt',rootId:'project',title:'verify',
196
+ goal:'run verification profile',acceptance:'receipt identity must remain exact'});
197
+ let result=await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
198
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
199
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
200
+ assert.equal(result.loop.phase,'ACTING');
201
+ await assert.rejects(sendPlannerDecision(f.runtime,goal.goal_id,result,{
202
+ schema:'deadbyte.autonomous-decision.v2',kind:'act',action:{kind:'run_profile',profile_id:'check'}
203
+ }),/simulated crash after profile receipt/);
204
+ assert.equal(commandCalls,1);
205
+
206
+ const forged=Object.freeze({...f.baseCodingRuntime,
207
+ commandRun:async args=>{ commandCalls+=1; return f.baseCodingRuntime.commandRun(args); },
208
+ verifyReceiptDetailed:async receiptId=>{
209
+ const checked=await f.baseCodingRuntime.verifyReceiptDetailed(receiptId);
210
+ return checked.ok?{...checked,request_sha256:'f'.repeat(64)}:checked;
211
+ }
212
+ });
213
+ const restarted=f.createRuntime({codingRuntimeOverride:forged});
214
+ result=await restarted.run({goalId:goal.goal_id,maxCycles:2});
215
+ assert.equal(result.status,'paused');
216
+ assert.equal(result.loop.phase,'WAITING');
217
+ assert.equal(result.loop.wait_reason,'ambiguous_interrupted_action');
218
+ assert.equal(commandCalls,1,'forged recovery must not execute the profile twice');
219
+ const journal=await restarted.events({goalId:goal.goal_id,fromSeq:1,limit:200});
220
+ assert.ok(journal.events.some(event=>event.type==='waiting_entered'&&event.payload.reason==='ambiguous_interrupted_action'));
221
+ assert.equal(journal.events.filter(event=>event.type==='profile_completed').length,0);
222
+ } finally { await f.cleanup(); }
223
+ });
224
+
225
+ test('R34 multi-step fail replan repair finish emits independently verifiable release evidence', async () => {
226
+ const f=await createR34Fixture({withStatefulProfile:true});
227
+ try {
228
+ await writeFile(`${f.project}/context.txt`,'CONTEXT\n');
229
+ const goal=await f.runtime.submit({submissionId:'r34-real-multistep',rootId:'project',title:'repair after evidence',
230
+ goal:'inspect two files, observe the failing verifier, replan, repair x.txt, verify, and finish',
231
+ acceptance:'x.txt must be y and the required verification profile plus release receipt must verify'});
232
+ let result=await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
233
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
234
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
235
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,{
236
+ schema:'deadbyte.autonomous-decision.v2',kind:'act',action:{kind:'run_profile',profile_id:'check'}
237
+ });
238
+ assert.equal(result.loop.phase,'REPLANNING');
239
+
240
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,{
241
+ schema:'deadbyte.autonomous-decision.v2',kind:'replan',reason:'verification failed before repair',
242
+ steps:[{step_id:'repair2',intent:'inspect x.txt and context.txt then repair x.txt under exact SHA'}]
243
+ });
244
+ assert.equal(result.loop.phase,'INSPECTING');
245
+ assert.equal(result.loop.plan_version,2);
246
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,{
247
+ schema:'deadbyte.autonomous-decision.v2',kind:'inspect',reads:[
248
+ {path:'x.txt',max_bytes:4096},{path:'context.txt',max_bytes:4096}
249
+ ]
250
+ });
251
+ assert.equal(result.loop.phase,'ACTING');
252
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256));
253
+ assert.equal(result.loop.phase,'VERIFYING');
254
+ assert.equal(await readFile(f.target,'utf8'),'y\n');
255
+
256
+ let journal=await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
257
+ const commit=[...journal.events].reverse().find(event=>event.type==='native_diff_committed');
258
+ const passingProfile=[...journal.events].reverse().find(event=>event.type==='profile_completed'&&event.payload.profile_id==='check'&&event.payload.passed===true);
259
+ assert.ok(commit);
260
+ assert.ok(passingProfile);
261
+ const inspections=journal.events.filter(event=>event.type==='inspection_completed');
262
+ assert.equal(inspections.at(-1).payload.contexts.length,2);
263
+ assert.equal(journal.events.find(event=>event.type==='plan_created').payload.plan.plan_version,1);
264
+ assert.equal(journal.events.find(event=>event.type==='plan_replanned').payload.plan.plan_version,2);
265
+ const criticEvent=journal.events.find(event=>event.type==='critic_classified'&&event.payload.failure_class==='verification_failure');
266
+ const repairStarted=journal.events.find(event=>event.type==='repair_started');
267
+ const repairCompleted=journal.events.find(event=>event.type==='repair_completed');
268
+ assert.ok(criticEvent);
269
+ assert.ok(repairStarted);
270
+ assert.ok(repairCompleted);
271
+ assert.notEqual(repairCompleted.payload.previous_fingerprint,repairCompleted.payload.repair_fingerprint);
272
+ const criticPhase=journal.events.findIndex(event=>event.type==='phase_changed'&&event.payload.to==='CRITIC');
273
+ const repairPhase=journal.events.findIndex(event=>event.type==='phase_changed'&&event.payload.from==='CRITIC'&&event.payload.to==='REPAIR');
274
+ const repairedInspect=journal.events.findIndex(event=>event.type==='phase_changed'&&event.payload.from==='REPAIR'&&event.payload.to==='INSPECT');
275
+ assert.ok(criticPhase>=0&&repairPhase>criticPhase&&repairedInspect>repairPhase);
276
+ const verdicts=journal.events.filter(event=>event.type==='progress_judged').map(event=>event.payload.verdict);
277
+ assert.ok(verdicts.includes('regressed'));
278
+ assert.ok(verdicts.includes('progress'));
279
+
280
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,{
281
+ schema:'deadbyte.autonomous-decision.v2',kind:'step_complete',step_id:'repair2',evidence:[
282
+ {kind:'native_diff',id:commit.payload.diff_id,sha256:commit.payload.diff_receipt_sha256},
283
+ {kind:'profile',id:passingProfile.payload.receipt_id,sha256:passingProfile.payload.receipt_sha256}
284
+ ]
285
+ });
286
+ assert.equal(result.loop.phase,'PLANNING');
287
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,finishDecision(),{maxCycles:8});
288
+ assert.equal(result.status,'completed');
289
+ assert.equal(result.loop.phase,'COMPLETE');
290
+ assert.match(result.release.receipt_sha256,/^[0-9a-f]{64}$/);
291
+ const verified=await f.runtime.verify({goalId:goal.goal_id});
292
+ assert.equal(verified.ok,true,verified.reason);
293
+ assert.equal(verified.signature_valid,true);
294
+ assert.equal(verified.receipt_sha256,result.release.receipt_sha256);
295
+ assert.equal(verified.native_diffs_verified,1);
296
+ assert.equal(verified.required_profiles_verified,1);
297
+ } finally { await f.cleanup(); }
298
+ });
299
+
300
+ test('R34 v2 crash after durable mutation reconciles the same action without duplicate apply', async () => {
301
+ let applyCalls=0;
302
+ let crashOnce=true;
303
+ const f=await createR34Fixture({nativeDiffRuntimeFactory:base=>Object.freeze({
304
+ preview:args=>base.preview(args),verify:args=>base.verify(args),
305
+ async apply(args){
306
+ applyCalls+=1;
307
+ const result=await base.apply(args);
308
+ if(crashOnce){ crashOnce=false; throw new Error('simulated R34 crash after native diff apply'); }
309
+ return result;
310
+ }
311
+ })});
312
+ try {
313
+ const goal=await f.runtime.submit({submissionId:'r34-v2-crash-dedupe',rootId:'project',title:'crash recovery',
314
+ goal:'repair x.txt exactly once',acceptance:'restart must reconcile the same action identity'});
315
+ let result=await f.runtime.run({goalId:goal.goal_id,maxCycles:4});
316
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,planCreateDecision());
317
+ result=await sendPlannerDecision(f.runtime,goal.goal_id,result,inspectDecision());
318
+ await assert.rejects(sendPlannerDecision(f.runtime,goal.goal_id,result,patchDecision(f.initial_sha256)),/simulated R34 crash after native diff apply/);
319
+ assert.equal(applyCalls,1);
320
+ assert.equal(await readFile(f.target,'utf8'),'y\n');
321
+ let journal=await f.runtime.events({goalId:goal.goal_id,fromSeq:1,limit:200});
322
+ const started=journal.events.find(event=>event.type==='action_started');
323
+ assert.ok(started);
324
+
325
+ const restarted=f.createRuntime();
326
+ result=await restarted.run({goalId:goal.goal_id,maxCycles:2});
327
+ assert.equal(applyCalls,1,'restart must not invoke Native Diff apply a second time');
328
+ assert.equal(result.loop.phase,'VERIFYING');
329
+ journal=await restarted.events({goalId:goal.goal_id,fromSeq:1,limit:200});
330
+ const reconciled=journal.events.find(event=>event.type==='action_reconciled');
331
+ assert.ok(reconciled);
332
+ assert.equal(reconciled.payload.action_id,started.payload.action_id);
333
+ assert.equal(reconciled.payload.classification,'executed_verified');
334
+ assert.equal(journal.events.filter(event=>event.type==='action_started').length,1);
335
+ assert.equal(journal.events.filter(event=>event.type==='native_diff_committed').length,1);
336
+ assert.equal(journal.events.filter(event=>event.type==='action_completed').length,1);
337
+ } finally { await f.cleanup(); }
338
+ });
@@ -23,8 +23,8 @@ const r23Tools = [
23
23
  'contained_transform','evidence_verify','file_read','proof_execute','workspace_open',
24
24
  'agent_task_approve','agent_task_cancel','agent_task_events','agent_task_run',
25
25
  'agent_task_status','agent_task_submit','agent_task_verify',
26
- 'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write',
27
- 'coding_receipt_verify','coding_search','coding_session_status','coding_stat',
26
+ 'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read',
27
+ 'coding_receipt_verify','coding_search','coding_session_status','coding_stat','coding_symbol_definition','coding_symbol_diagnostics','coding_symbol_implementations','coding_symbol_outline','coding_symbol_references','coding_symbol_rename_preview','coding_symbol_replace',
28
28
  'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run',
29
29
  'coding_task_status','coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'
30
30
  ];
@@ -75,7 +75,7 @@ async function fixture() {
75
75
  return { root, client, transport };
76
76
  }
77
77
 
78
- test('R30 hermetic autonomous fixture exposes the exact 41-tool no-host catalog', async () => {
78
+ test('R36 hermetic autonomous fixture exposes the exact 49-tool no-host catalog', async () => {
79
79
  const f = await fixture();
80
80
  try {
81
81
  await f.client.connect(f.transport);
@@ -1,6 +1,7 @@
1
1
  import test from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import { createHash, randomBytes } from 'node:crypto';
4
+ import { spawn } from 'node:child_process';
4
5
  import { createServer } from 'node:http';
5
6
  import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
6
7
  import os from 'node:os';
@@ -15,6 +16,14 @@ const repoRoot = path.resolve(here, '..');
15
16
  const serverPath = path.join(repoRoot, 'src', 'mcp-server.mjs');
16
17
  const sha = bytes => createHash('sha256').update(bytes).digest('hex');
17
18
  const nonce = () => randomBytes(32).toString('hex');
19
+ const runChild = (command,args,options={}) => new Promise((resolve,reject)=>{
20
+ const child=spawn(command,args,{...options,stdio:['ignore','pipe','pipe'],shell:false});
21
+ const out=[],err=[];
22
+ child.stdout.on('data',chunk=>out.push(Buffer.from(chunk)));
23
+ child.stderr.on('data',chunk=>err.push(Buffer.from(chunk)));
24
+ child.on('error',reject);
25
+ child.on('exit',code=>resolve({code,stdout:Buffer.concat(out).toString('utf8'),stderr:Buffer.concat(err).toString('utf8')}));
26
+ });
18
27
 
19
28
  async function startPlanner() {
20
29
  let round = 0;
@@ -31,7 +40,7 @@ async function startPlanner() {
31
40
  });
32
41
  await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
33
42
  return { server, endpoint:`http://127.0.0.1:${server.address().port}/v1/chat/completions`, rounds:() => round };
34
- }async function fixture() {
43
+ }async function fixture({supervisorMode='in_process'}={}) {
35
44
  const root = await mkdtemp(path.join(os.tmpdir(), 'deadbyte-supervisor-mcp-'));
36
45
  const project = path.join(root, 'project');
37
46
  const trust = path.join(root, 'trust');
@@ -73,9 +82,10 @@ async function startPlanner() {
73
82
  env:{ ...getDefaultEnvironment(), DEADBYTE_SIGNING_KEY:keys.privateKeyPath,
74
83
  DEADBYTE_VERIFY_KEY:keys.publicKeyPath, DEADBYTE_CODING_RUNTIME:'1',
75
84
  DEADBYTE_CODING_POLICY:codingPath, DEADBYTE_AUTONOMOUS_RUNTIME:'1',
76
- DEADBYTE_AUTONOMOUS_POLICY:autonomousPath }
85
+ DEADBYTE_AUTONOMOUS_POLICY:autonomousPath,
86
+ DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE:supervisorMode }
77
87
  });
78
- return { root, planner, client, transport };
88
+ return { root, planner, client, transport, codingPath, autonomousPath, keys };
79
89
  }test('provider-backed MCP server supervises submitted goal without client run calls', async () => {
80
90
  const f = await fixture();
81
91
  try {
@@ -103,4 +113,39 @@ async function startPlanner() {
103
113
  await new Promise(resolve => f.planner.server.close(resolve));
104
114
  await rm(f.root, { recursive:true, force:true });
105
115
  }
116
+ });
117
+
118
+ test('external supervisor mode leaves provider goal durable until standalone host advances it', async () => {
119
+ const f = await fixture({supervisorMode:'external'});
120
+ try {
121
+ await f.client.connect(f.transport);
122
+ const submit = await f.client.callTool({ name:'autonomous_goal_submit', arguments:{
123
+ submission_id:'external-owner-integration', root_id:'project', title:'external-owner',
124
+ goal:'Inspect source.txt and release after verified observation.', acceptance:'source.txt must remain READY',
125
+ max_iterations:8
126
+ } });
127
+ assert.equal(submit.isError,false);
128
+ const goalId=submit.structuredContent.goal_id;
129
+ await new Promise(resolve=>setTimeout(resolve,1200));
130
+ const before=await f.client.callTool({name:'autonomous_goal_status',arguments:{goal_id:goalId}});
131
+ assert.equal(before.isError,false);
132
+ assert.equal(before.structuredContent.state,'pending');
133
+ assert.equal(f.planner.rounds(),0);
134
+
135
+ const host=await runChild(process.execPath,[path.join(repoRoot,'src','autonomous-supervisor-host.mjs')],{
136
+ cwd:repoRoot,
137
+ env:{...process.env,DEADBYTE_SIGNING_KEY:f.keys.privateKeyPath,DEADBYTE_VERIFY_KEY:f.keys.publicKeyPath,
138
+ DEADBYTE_CODING_POLICY:f.codingPath,DEADBYTE_AUTONOMOUS_POLICY:f.autonomousPath,
139
+ DEADBYTE_SUPERVISOR_ONCE:'1',DEADBYTE_SUPERVISOR_MARKER:path.join(f.root,'external-supervisor-owner.json')}
140
+ });
141
+ assert.equal(host.code,0,host.stderr||host.stdout);
142
+ const after=await f.client.callTool({name:'autonomous_goal_status',arguments:{goal_id:goalId}});
143
+ assert.equal(after.isError,false);
144
+ assert.equal(after.structuredContent.state,'succeeded');
145
+ assert.ok(f.planner.rounds()>=2);
146
+ } finally {
147
+ await f.client.close().catch(()=>{});
148
+ await new Promise(resolve=>f.planner.server.close(resolve));
149
+ await rm(f.root,{recursive:true,force:true});
150
+ }
106
151
  });
@@ -0,0 +1,107 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { fileURLToPath } from 'node:url';
5
+ import path from 'node:path';
6
+ import {
7
+ R36_CAPABILITY_BENCHMARK_SCHEMA,
8
+ normalizeR36BenchmarkCase,
9
+ buildR36CapabilityBenchmark
10
+ } from '../src/capability-benchmark.mjs';
11
+ import {
12
+ R36_BENCHMARK_CASE_IDS,
13
+ r36BenchmarkCaseDefinitions
14
+ } from '../src/capability-benchmark-runner.mjs';
15
+
16
+ const REQUIRED=Object.freeze([
17
+ 'repository_tree_exploration',
18
+ 'literal_content_search',
19
+ 'regex_content_search',
20
+ 'filename_path_search',
21
+ 'deterministic_search_paging_cancel',
22
+ 'bounded_multi_file_read',
23
+ 'rich_stat_reparse_handling',
24
+ 'stale_edit_race_rejection',
25
+ 'transactional_multi_file_native_diff',
26
+ 'topology_mkdir_move_delete_rollback',
27
+ 'semantic_typescript_navigation',
28
+ 'semantic_python_navigation',
29
+ 'semantic_rust_navigation',
30
+ 'semantic_cpp_navigation',
31
+ 'diagnostics_normalization',
32
+ 'implementation_lookup',
33
+ 'cross_file_rename_transaction',
34
+ 'long_process_lifecycle',
35
+ 'policy_defined_process_action',
36
+ 'process_crash_reconciliation',
37
+ 'autonomous_failing_test_repair',
38
+ 'autonomous_search_semantic_patch_test',
39
+ 'release_gate_finish_without_evidence_refusal',
40
+ 'provider_bridge_interruption_recovery',
41
+ 'remote_result_replay_deduplication',
42
+ 'compact_connector_capability_closure',
43
+ 'live_log_request_before_result',
44
+ 'live_log_redaction',
45
+ 'forged_stale_receipt_rejection',
46
+ 'rollback_r35_restore_r36'
47
+ ]);
48
+ const H=c=>c.repeat(64);
49
+ const base={
50
+ case_id:REQUIRED[0],fixture_sha256:H('a'),correct:true,round_trips:2,bytes_returned:128,elapsed_ms:12.5,
51
+ stale_rejected:false,recovery_success:true,duplicate_side_effects:0,capability_reachable:true,
52
+ evidence_verified:true,release_gate_result:'not_applicable',evidence_sha256:H('b')
53
+ };
54
+
55
+ test('R36 benchmark corpus exposes exactly the 30 approved production coding cases',async()=>{
56
+ assert.equal(R36_CAPABILITY_BENCHMARK_SCHEMA,'deadbyte.r36-capability-benchmark.v1');
57
+ assert.deepEqual([...R36_BENCHMARK_CASE_IDS],REQUIRED);
58
+ const defs=r36BenchmarkCaseDefinitions();
59
+ assert.equal(defs.length,30);
60
+ assert.deepEqual(defs.map(item=>item.case_id),REQUIRED);
61
+ assert.equal(new Set(defs.map(item=>item.case_id)).size,30);
62
+ for(const item of defs){
63
+ assert.ok(Array.isArray(item.test_files)&&item.test_files.length>=1,item.case_id);
64
+ assert.ok(Array.isArray(item.fixture_files)&&item.fixture_files.length>=1,item.case_id);
65
+ assert.ok(Number.isInteger(item.round_trips)&&item.round_trips>=1,item.case_id);
66
+ assert.equal(typeof item.capability_reachable,'boolean',item.case_id);
67
+ assert.equal(typeof item.evidence_verified,'boolean',item.case_id);
68
+ assert.ok(['passed','blocked','not_applicable'].includes(item.release_gate_result),item.case_id);
69
+ }
70
+ const root=path.resolve(fileURLToPath(new URL('../',import.meta.url)));
71
+ const corpus=JSON.parse(await readFile(path.join(root,'bench','fixtures','corpus.json'),'utf8'));
72
+ assert.equal(corpus.schema,'deadbyte.r36-capability-corpus.v1');
73
+ assert.equal(corpus.suite_id,'r36-production-coding-v1');
74
+ assert.deepEqual(corpus.cases.map(item=>item.case_id),REQUIRED);
75
+ });
76
+
77
+ test('R36 benchmark case requires reachability, evidence verification and typed release-gate result',()=>{
78
+ const value=normalizeR36BenchmarkCase(base);
79
+ assert.equal(value.capability_reachable,true);
80
+ assert.equal(value.evidence_verified,true);
81
+ assert.equal(value.release_gate_result,'not_applicable');
82
+ assert.throws(()=>normalizeR36BenchmarkCase({...base,capability_reachable:undefined}),/reachable/i);
83
+ assert.throws(()=>normalizeR36BenchmarkCase({...base,evidence_verified:undefined}),/evidence/i);
84
+ assert.throws(()=>normalizeR36BenchmarkCase({...base,release_gate_result:'maybe'}),/release/i);
85
+ });
86
+
87
+ test('R36 aggregate fails closed when correctness reachability or evidence proof is missing',()=>{
88
+ const ok=buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases:[base]});
89
+ assert.equal(ok.overall_correct,true);
90
+ assert.equal(ok.capability_closure,true);
91
+ assert.equal(ok.evidence_closure,true);
92
+ assert.equal('score' in ok,false);
93
+ const unreachable=buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases:[{...base,capability_reachable:false}]});
94
+ assert.equal(unreachable.overall_correct,false);
95
+ assert.equal(unreachable.capability_closure,false);
96
+ const unverified=buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases:[{...base,evidence_verified:false}]});
97
+ assert.equal(unverified.overall_correct,false);
98
+ assert.equal(unverified.evidence_closure,false);
99
+ });
100
+
101
+ test('R36 verdict identity is independent of timing and byte-count noise while observation identity retains it',()=>{
102
+ const first=buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases:[base]});
103
+ const noisy=buildR36CapabilityBenchmark({suite_id:'r36-production-coding-v1',cases:[{...base,elapsed_ms:999.25,bytes_returned:999999,evidence_sha256:H('c')}]});
104
+ assert.match(first.verdict_identity_sha256,/^[0-9a-f]{64}$/);
105
+ assert.equal(first.verdict_identity_sha256,noisy.verdict_identity_sha256);
106
+ assert.notEqual(first.observation_sha256,noisy.observation_sha256);
107
+ });
@@ -0,0 +1,49 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {
4
+ R35_BENCHMARK_CASE_IDS,
5
+ benchmarkCaseDefinitions,
6
+ fixtureIdentityForCase,
7
+ runCapabilityBenchmark
8
+ } from '../src/capability-benchmark-runner.mjs';
9
+
10
+ const REQUIRED=[
11
+ 'filesystem_bounded_read','exact_edit_stale_reject','paged_search','process_owned_lifecycle',
12
+ 'semantic_typescript','semantic_python','semantic_rust','semantic_cpp','context_provenance',
13
+ 'autonomous_fail_repair','remote_replay_dedupe'
14
+ ];
15
+
16
+ test('R35 benchmark corpus exposes the exact required offline case set',()=>{
17
+ assert.deepEqual([...R35_BENCHMARK_CASE_IDS],REQUIRED);
18
+ const defs=benchmarkCaseDefinitions();
19
+ assert.deepEqual(defs.map(item=>item.case_id),REQUIRED);
20
+ for(const item of defs){
21
+ assert.ok(Array.isArray(item.test_files)&&item.test_files.length>=1,item.case_id);
22
+ assert.ok(Number.isInteger(item.round_trips)&&item.round_trips>=1,item.case_id);
23
+ assert.equal(typeof item.stale_rejected,'boolean');
24
+ assert.equal(typeof item.recovery_success,'boolean');
25
+ }
26
+ });
27
+
28
+ test('fixture identity is deterministic and changes when any declared fixture byte changes',async()=>{
29
+ const root=new URL('../',import.meta.url);
30
+ const def={case_id:'fixture_probe',test_files:['test/capability-benchmark.test.mjs'],fixture_files:['test/capability-benchmark.test.mjs']};
31
+ const a=await fixtureIdentityForCase({rootUrl:root,definition:def});
32
+ const b=await fixtureIdentityForCase({rootUrl:root,definition:structuredClone(def)});
33
+ assert.match(a,/^[0-9a-f]{64}$/);assert.equal(a,b);
34
+ });
35
+
36
+ test('runner fails closed on a failed case and returns evidence-backed metrics for passing cases',async()=>{
37
+ const defs=[
38
+ {case_id:'pass_case',test_files:['test/capability-benchmark.test.mjs'],fixture_files:['test/capability-benchmark.test.mjs'],round_trips:1,stale_rejected:false,recovery_success:true},
39
+ {case_id:'fail_case',test_files:['test/__definitely_missing__.test.mjs'],fixture_files:['test/capability-benchmark.test.mjs'],round_trips:1,stale_rejected:false,recovery_success:false}
40
+ ];
41
+ const root=new URL('../',import.meta.url);
42
+ const result=await runCapabilityBenchmark({rootUrl:root,definitions:defs,env:{},timeoutMs:30_000});
43
+ assert.equal(result.schema,'deadbyte.r35-capability-benchmark.v1');
44
+ assert.equal(result.overall_correct,false);
45
+ const pass=result.cases.find(item=>item.case_id==='pass_case');
46
+ const fail=result.cases.find(item=>item.case_id==='fail_case');
47
+ assert.equal(pass.correct,true);assert.match(pass.evidence_sha256,/^[0-9a-f]{64}$/);assert.ok(pass.bytes_returned>0);assert.ok(pass.elapsed_ms>=0);
48
+ assert.equal(fail.correct,false);assert.match(fail.evidence_sha256,/^[0-9a-f]{64}$/);
49
+ });
@@ -0,0 +1,52 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { createHash } from 'node:crypto';
4
+ import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { createSemanticLspBackend } from '../src/semantic-lsp-backend.mjs';
9
+
10
+ const here=path.dirname(fileURLToPath(import.meta.url));
11
+ const serverFixture=path.join(here,'fixtures','lsp-framed-server.mjs');
12
+ const sha256=bytes=>createHash('sha256').update(bytes).digest('hex');
13
+ const nodeSha=sha256(await readFile(process.execPath));
14
+ const fixtureSha=sha256(await readFile(serverFixture));
15
+
16
+ async function proveNavigation({extension,languageId,engineId}){
17
+ const root=await mkdtemp(path.join(os.tmpdir(),`deadbyte-r36-${engineId}-`));
18
+ const main=`main${extension}`; const peer=`peer${extension}`;
19
+ await writeFile(path.join(root,main),'export function main() { return alpha(); }\n','utf8');
20
+ await writeFile(path.join(root,peer),'export function alpha() { return 1; }\n','utf8');
21
+ const codingRuntime={
22
+ policy:{roots:{project:{real_path:root,read:true,write:true,exec:false,deny_paths:[]}}},
23
+ async sessionStatus(){return {armed:true,reason:'standing-grant',root_ids:['project']};},
24
+ async tree(){return {truncated:false,entries:[{type:'file',path:main},{type:'file',path:peer}]};},
25
+ async fileRead({relativePath}){const content=await readFile(path.join(root,relativePath),'utf8');return {status:'ok',content,sha256:sha256(Buffer.from(content,'utf8'))};},
26
+ async textReplace(){throw new Error('not used by navigation benchmark');}
27
+ };
28
+ try{
29
+ const backend=createSemanticLspBackend({id:engineId,extensions:[extension],codingRuntime,server:{
30
+ language_id:languageId,executable_path:process.execPath,executable_sha256:nodeSha,args:[serverFixture],
31
+ dependencies:[{path:serverFixture,expectedSha256:fixtureSha}],
32
+ initialization_options:{expectedLanguageId:languageId,requiredOpenCount:2},request_timeout_ms:1000,max_message_bytes:131072
33
+ }});
34
+ const definition=await backend.definition({rootId:'project',relativePath:main,line:0,column:18,maxResults:10});
35
+ const references=await backend.references({rootId:'project',relativePath:main,line:0,column:18,maxResults:10});
36
+ assert.equal(definition.engine,engineId);
37
+ assert.ok(definition.locations.some(item=>item.path===peer),JSON.stringify(definition.locations));
38
+ assert.ok(references.locations.some(item=>item.path===peer),JSON.stringify(references.locations));
39
+ } finally {await rm(root,{recursive:true,force:true});}
40
+ }
41
+
42
+ test('R36 benchmark Python symbol navigation',async()=>{
43
+ await proveNavigation({extension:'.py',languageId:'python',engineId:'pyright-fixture'});
44
+ });
45
+
46
+ test('R36 benchmark Rust symbol navigation',async()=>{
47
+ await proveNavigation({extension:'.rs',languageId:'rust',engineId:'rust-analyzer-fixture'});
48
+ });
49
+
50
+ test('R36 benchmark Cpp symbol navigation',async()=>{
51
+ await proveNavigation({extension:'.cpp',languageId:'cpp',engineId:'clangd-fixture'});
52
+ });