deadbyte-mcp 0.8.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/CONTEXT.md +41 -0
  2. package/MANIFEST.SHA256 +348 -83
  3. package/R34-BASELINE.json +9 -0
  4. package/README.txt +135 -9
  5. package/bench/fixtures/corpus.json +17 -0
  6. package/bin/WORKER-REGISTRY.txt +3 -3
  7. package/bin/appcontainer-stage.exe +0 -0
  8. package/bin/appcontainer-stage.obj +0 -0
  9. package/bin/bootstrap-advapi32.exe +0 -0
  10. package/bin/bootstrap-advapi32.obj +0 -0
  11. package/bin/bootstrap-exitcode.exe +0 -0
  12. package/bin/bootstrap-exitcode.obj +0 -0
  13. package/bin/bootstrap-kernel32.exe +0 -0
  14. package/bin/bootstrap-kernel32.obj +0 -0
  15. package/bin/child-control-probe.exe +0 -0
  16. package/bin/child-control-probe.obj +0 -0
  17. package/bin/child-control-stage.exe +0 -0
  18. package/bin/child-control-stage.obj +0 -0
  19. package/bin/contained-reverse-worker.exe +0 -0
  20. package/bin/contained-reverse-worker.obj +0 -0
  21. package/bin/contained-transform-worker.exe +0 -0
  22. package/bin/contained-transform-worker.obj +0 -0
  23. package/bin/containment-probe.exe +0 -0
  24. package/bin/containment-probe.obj +0 -0
  25. package/bin/deadbyte-contain.exe +0 -0
  26. package/bin/deadbyte-contain.obj +0 -0
  27. package/bin/deadbyte-exec.exe +0 -0
  28. package/bin/deadbyte-exec.obj +0 -0
  29. package/bin/deadbyte-process-host.exe +0 -0
  30. package/bin/deadbyte-process-host.obj +0 -0
  31. package/bin/deadbyte-tunnel-host.exe +0 -0
  32. package/bin/deadbyte-tunnel-host.obj +0 -0
  33. package/controller/README.TXT +10 -4
  34. package/controller/deadbyte-controller.config.psd1.example +14 -0
  35. package/controller/deadbyte-controller.ps1 +144 -19
  36. package/controller/deadbyte-process-policy.json +5 -5
  37. package/controller/deadbyte-semantic-lsp-config.json +95 -0
  38. package/deadbyte-mcp-0.8.9.tgz +0 -0
  39. package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
  40. package/docs/ARCHITECTURE.md +6 -5
  41. package/docs/superpowers/plans/2026-09-16-deadbyte-loop-engine.md +846 -0
  42. package/docs/superpowers/plans/2026-09-17-r35-production-successor.md +408 -0
  43. package/docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md +435 -0
  44. package/docs/superpowers/specs/2026-09-17-r35-production-successor-design.md +220 -0
  45. package/node_modules/typescript/LICENSE.txt +55 -0
  46. package/node_modules/typescript/README.md +50 -0
  47. package/node_modules/typescript/SECURITY.md +41 -0
  48. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  49. package/node_modules/typescript/bin/tsc +2 -0
  50. package/node_modules/typescript/bin/tsserver +2 -0
  51. package/node_modules/typescript/lib/_tsc.js +133818 -0
  52. package/node_modules/typescript/lib/_tsserver.js +659 -0
  53. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  54. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  55. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  56. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  57. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  58. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  59. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  60. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  61. package/node_modules/typescript/lib/lib.d.ts +22 -0
  62. package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  63. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  64. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  65. package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  66. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  67. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  68. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  69. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  70. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  71. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  72. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  73. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  74. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  75. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  76. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  77. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  78. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  79. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  80. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  81. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  82. package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  83. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  84. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  85. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  86. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  87. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  88. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  89. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  90. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  91. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  92. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  93. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  94. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  95. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  96. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  97. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  98. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  99. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  100. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  101. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  102. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  103. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  104. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  105. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  106. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  107. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  108. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  109. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  110. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  111. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  112. package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  113. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  114. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  115. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  116. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  117. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  118. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  119. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  120. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  121. package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  122. package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  123. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  124. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  125. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  126. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  127. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  128. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  129. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  130. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  131. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  132. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  133. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  134. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  135. package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  136. package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  137. package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  138. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  139. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  140. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  141. package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  142. package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  143. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  144. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  145. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  146. package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  147. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  148. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  149. package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  150. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  151. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  152. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  153. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  154. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  155. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  156. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  157. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  158. package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  159. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  160. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  161. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  162. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  163. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  164. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  165. package/node_modules/typescript/lib/tsc.js +8 -0
  166. package/node_modules/typescript/lib/tsserver.js +8 -0
  167. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  168. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  169. package/node_modules/typescript/lib/typesMap.json +497 -0
  170. package/node_modules/typescript/lib/typescript.d.ts +11437 -0
  171. package/node_modules/typescript/lib/typescript.js +200276 -0
  172. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  173. package/node_modules/typescript/lib/watchGuard.js +53 -0
  174. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  175. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  176. package/node_modules/typescript/package.json +120 -0
  177. package/package.json +5 -3
  178. package/proof/CONTAINMENT-BUILD.txt +6 -6
  179. package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +29 -0
  180. package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +28 -0
  181. package/scripts/capability-benchmark.mjs +27 -0
  182. package/scripts/deferred-slot-operation.mjs +4 -2
  183. package/scripts/final-closure-verify.mjs +10 -10
  184. package/scripts/final-closure.mjs +11 -11
  185. package/scripts/gate-windows.ps1 +3 -3
  186. package/scripts/release-parity.mjs +14 -14
  187. package/scripts/semantic-preflight.ps1 +73 -0
  188. package/scripts/tool-surface-snapshot.mjs +73 -0
  189. package/scripts/windows-gate-evidence.mjs +5 -5
  190. package/src/audit-verify.mjs +6 -2
  191. package/src/autonomous-action-reconcile.mjs +142 -0
  192. package/src/autonomous-context-engine.mjs +255 -0
  193. package/src/autonomous-live-state.mjs +17 -0
  194. package/src/autonomous-local-supervisor.mjs +249 -0
  195. package/src/autonomous-loop-state.mjs +304 -0
  196. package/src/autonomous-output-contracts.mjs +22 -3
  197. package/src/autonomous-plan.mjs +181 -0
  198. package/src/autonomous-planner-contracts.mjs +44 -0
  199. package/src/autonomous-planner.mjs +91 -6
  200. package/src/autonomous-policy.mjs +15 -2
  201. package/src/autonomous-progress.mjs +127 -0
  202. package/src/autonomous-runtime.mjs +601 -48
  203. package/src/autonomous-supervisor-host.mjs +70 -0
  204. package/src/autonomous-supervisor.mjs +31 -8
  205. package/src/capability-benchmark-runner.mjs +108 -0
  206. package/src/capability-benchmark.mjs +50 -0
  207. package/src/coding-mcp-tools.mjs +46 -3
  208. package/src/coding-output-contracts.mjs +45 -0
  209. package/src/context-provenance.mjs +86 -0
  210. package/src/deadbyte-cli.mjs +136 -30
  211. package/src/document-adapter.mjs +43 -0
  212. package/src/lsp-stdio-client.mjs +112 -0
  213. package/src/machine-fs-smoke-client.mjs +2 -1
  214. package/src/mcp-server.mjs +17 -3
  215. package/src/observation-smoke-client.mjs +3 -2
  216. package/src/operator-surface.mjs +37 -0
  217. package/src/provider-circuit.mjs +125 -0
  218. package/src/release-generation.mjs +44 -5
  219. package/src/remote-mcp-autonomous-smoke-client.mjs +53 -14
  220. package/src/remote-mcp-coding-smoke-client.mjs +5 -4
  221. package/src/remote-mcp-r24-disarmed-smoke-client.mjs +4 -2
  222. package/src/remote-mcp-r33-parity-client.mjs +1 -1
  223. package/src/remote-mcp-r34-parity-client.mjs +177 -0
  224. package/src/remote-mcp-smoke-client.mjs +2 -1
  225. package/src/remote-result-journal.mjs +114 -0
  226. package/src/runtime-update.mjs +58 -8
  227. package/src/semantic-backend-registry.mjs +39 -0
  228. package/src/semantic-code.mjs +179 -0
  229. package/src/semantic-lsp-backend.mjs +183 -0
  230. package/src/semantic-lsp-config.mjs +112 -0
  231. package/src/tool-surface-ledger.mjs +92 -0
  232. package/src/version.mjs +1 -1
  233. package/test/audit-verify.test.mjs +1 -1
  234. package/test/autonomous-action-reconcile.test.mjs +106 -0
  235. package/test/autonomous-adversarial.test.mjs +149 -6
  236. package/test/autonomous-context-engine.test.mjs +181 -0
  237. package/test/autonomous-live-state.test.mjs +27 -0
  238. package/test/autonomous-local-supervisor.test.mjs +403 -0
  239. package/test/autonomous-loop-state.test.mjs +126 -0
  240. package/test/autonomous-loop-v2.test.mjs +105 -0
  241. package/test/autonomous-loop.test.mjs +79 -1
  242. package/test/autonomous-output-contract.test.mjs +54 -0
  243. package/test/autonomous-plan.test.mjs +101 -0
  244. package/test/autonomous-progress.test.mjs +106 -0
  245. package/test/autonomous-r34-e2e.test.mjs +338 -0
  246. package/test/autonomous-runtime.test.mjs +3 -3
  247. package/test/autonomous-supervisor-integration.test.mjs +48 -3
  248. package/test/capability-benchmark-runner.test.mjs +49 -0
  249. package/test/capability-benchmark.test.mjs +47 -0
  250. package/test/cli-entrypoint.test.mjs +12 -0
  251. package/test/coding-catalog-consistency.test.mjs +24 -0
  252. package/test/coding-plane.test.mjs +3 -3
  253. package/test/context-provenance.test.mjs +61 -0
  254. package/test/controller-r27.test.mjs +4 -3
  255. package/test/controller.test.mjs +52 -0
  256. package/test/core.test.mjs +1 -1
  257. package/test/deferred-slot-operation-behavior.test.mjs +5 -1
  258. package/test/deferred-slot-operation.test.mjs +2 -1
  259. package/test/document-adapter.test.mjs +23 -0
  260. package/test/fixtures/lsp-framed-server.mjs +33 -0
  261. package/test/fixtures/semantic/cpp/compile_commands.json +4 -0
  262. package/test/fixtures/semantic/cpp/lib.cpp +2 -0
  263. package/test/fixtures/semantic/cpp/lib.hpp +2 -0
  264. package/test/fixtures/semantic/cpp/main.cpp +2 -0
  265. package/test/fixtures/semantic/python/lib.py +2 -0
  266. package/test/fixtures/semantic/python/main.py +2 -0
  267. package/test/fixtures/semantic/rust/Cargo.lock +7 -0
  268. package/test/fixtures/semantic/rust/Cargo.toml +8 -0
  269. package/test/fixtures/semantic/rust/src/lib.rs +3 -0
  270. package/test/fixtures/semantic/rust/src/main.rs +5 -0
  271. package/test/fixtures/semantic/rust/src/math.rs +3 -0
  272. package/test/fixtures/semantic/rust/target/.rustc_info.json +1 -0
  273. package/test/fixtures/semantic/rust/target/CACHEDIR.TAG +3 -0
  274. package/test/fixtures/semantic/rust/target/debug/.cargo-lock +0 -0
  275. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/dep-test-lib-semantic_rust +0 -0
  276. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/invoked.timestamp +1 -0
  277. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust +1 -0
  278. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust.json +1 -0
  279. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/dep-test-bin-semantic_rust_bin +0 -0
  280. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/invoked.timestamp +1 -0
  281. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin +1 -0
  282. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin.json +1 -0
  283. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/dep-lib-semantic_rust +0 -0
  284. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/invoked.timestamp +1 -0
  285. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust +1 -0
  286. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust.json +1 -0
  287. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin +1 -0
  288. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin.json +1 -0
  289. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/dep-bin-semantic_rust_bin +0 -0
  290. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/invoked.timestamp +1 -0
  291. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-4c168fa33c79d09c.rmeta +0 -0
  292. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-6212ccd976aa3808.rmeta +0 -0
  293. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-5dcd474439c54a26.rmeta +0 -0
  294. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-d741378dccdef61c.rmeta +0 -0
  295. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-4c168fa33c79d09c.d +5 -0
  296. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-6212ccd976aa3808.d +5 -0
  297. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-5dcd474439c54a26.d +6 -0
  298. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-d741378dccdef61c.d +6 -0
  299. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/dep-graph.bin +0 -0
  300. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/query-cache.bin +0 -0
  301. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/work-products.bin +0 -0
  302. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc.lock +0 -0
  303. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/dep-graph.bin +0 -0
  304. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/metadata.rmeta +0 -0
  305. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/query-cache.bin +0 -0
  306. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/work-products.bin +0 -0
  307. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq.lock +0 -0
  308. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/dep-graph.bin +0 -0
  309. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/query-cache.bin +0 -0
  310. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/work-products.bin +0 -0
  311. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3.lock +0 -0
  312. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/dep-graph.bin +0 -0
  313. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/query-cache.bin +0 -0
  314. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/work-products.bin +0 -0
  315. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt.lock +0 -0
  316. package/test/fixtures/semantic/rust/target/flycheck0/stderr +1 -0
  317. package/test/fixtures/semantic/rust/target/flycheck0/stdout +5 -0
  318. package/test/fixtures/semantic/typescript/lib.ts +3 -0
  319. package/test/fixtures/semantic/typescript/main.ts +2 -0
  320. package/test/fixtures/tool-surface-stdio-server.mjs +14 -0
  321. package/test/helpers/autonomous-r34-fixture.mjs +120 -0
  322. package/test/lsp-stdio-client.test.mjs +72 -0
  323. package/test/multi-file-read.test.mjs +41 -0
  324. package/test/observation-integration.test.mjs +3 -3
  325. package/test/production-docs.test.mjs +48 -0
  326. package/test/prompts-resources.test.mjs +35 -0
  327. package/test/provider-circuit.test.mjs +93 -0
  328. package/test/public-autonomous-ingress-budget.test.mjs +28 -0
  329. package/test/r33-closeout-regression.test.mjs +3 -3
  330. package/test/r33-finalization.test.mjs +19 -16
  331. package/test/release-generation.test.mjs +23 -2
  332. package/test/release-version.test.mjs +24 -17
  333. package/test/remote-r24-catalog.test.mjs +5 -4
  334. package/test/remote-result-journal.test.mjs +58 -0
  335. package/test/remote-session-cli.test.mjs +150 -15
  336. package/test/runtime-self-update.test.mjs +63 -0
  337. package/test/semantic-backend-registry.test.mjs +29 -0
  338. package/test/semantic-code.test.mjs +66 -0
  339. package/test/semantic-lsp-backend.test.mjs +99 -0
  340. package/test/semantic-lsp-config.test.mjs +81 -0
  341. package/test/semantic-lsp-readiness.test.mjs +34 -0
  342. package/test/semantic-lsp-transient-empty.test.mjs +32 -0
  343. package/test/semantic-lsp-transient-null.test.mjs +31 -0
  344. package/test/semantic-multilang.test.mjs +72 -0
  345. package/test/semantic-runtime-routing.test.mjs +32 -0
  346. package/test/semantic-server-config-integration.test.mjs +66 -0
  347. package/test/tool-surface-ledger.test.mjs +59 -0
  348. package/test/tool-surface-snapshot.test.mjs +17 -0
  349. package/test/tracer-bullet.test.mjs +77 -0
@@ -21,6 +21,10 @@ async function startPlanner(decisions) {
21
21
  const parsed = JSON.parse(body); prompts.push(parsed.messages?.at(-1)?.content ?? '');
22
22
  const decision = decisions[prompts.length - 1];
23
23
  if (!decision) { res.writeHead(500); return res.end('planner sequence exhausted'); }
24
+ if (Number.isInteger(decision?.__http_status)) {
25
+ res.writeHead(decision.__http_status,{'content-type':'application/json'});
26
+ return res.end(JSON.stringify({error:'intentional provider failure'}));
27
+ }
24
28
  res.writeHead(200,{'content-type':'application/json'});
25
29
  const content = typeof decision === 'string' ? decision : JSON.stringify(decision);
26
30
  res.end(JSON.stringify({ model:'deadbyte-fake-planner', choices:[{ message:{ content } }] }));
@@ -78,7 +82,8 @@ async function fixture(decisionPrefix = []) {
78
82
  lease_file:path.join(root,'autonomous-lease.json'), evidence_dir:path.join(root,'autonomous-evidence'),
79
83
  root_ids:['project'], coding_policy_sha256:codingPolicy.policy_sha256,
80
84
  planner:{ backend:'openai_compatible', endpoint:planner.endpoint, model:'fake', max_tokens:2048,
81
- timeout_ms:30000, max_response_bytes:262144 },
85
+ timeout_ms:30000, max_response_bytes:262144,
86
+ circuit:{failure_threshold:3,open_ms:100,half_open_probe_limit:1} },
82
87
  profiles:{
83
88
  build:{ kind:'command', root_id:'project', command_id:'node_script', script_path:'build.mjs',
84
89
  script_sha256:buildHash, args:[], cwd:'.', required_for_release:true, run_after_mutation:true,
@@ -161,6 +166,79 @@ test('provider planner repairs an invalid structured decision inside the same ru
161
166
  }
162
167
  });
163
168
 
169
+ test('provider circuit survives runtime restart, suppresses OPEN calls, then permits one HALF_OPEN probe', async () => {
170
+ const failures=[{__http_status:503},{__http_status:503},{__http_status:503}];
171
+ const f=await fixture(failures);
172
+ try {
173
+ assert.deepEqual(f.policy.planner.circuit,{failure_threshold:3,open_ms:100,half_open_probe_limit:1});
174
+ const submitted=await f.runtime.submit({submissionId:'provider-circuit',rootId:'project',title:'provider circuit',
175
+ goal:'make exported value equal fixed',acceptance:'provider failures must be bounded',maxIterations:10});
176
+ await assert.rejects(f.runtime.run({goalId:submitted.goal_id,maxCycles:2}),/planner HTTP 503/);
177
+ await assert.rejects(f.runtime.run({goalId:submitted.goal_id,maxCycles:2}),/planner HTTP 503/);
178
+ const opened=await f.runtime.run({goalId:submitted.goal_id,maxCycles:2});
179
+ assert.equal(opened.status,'paused');
180
+ assert.equal(opened.reason,'provider_circuit_open');
181
+ assert.equal(f.planner.prompts.length,3);
182
+
183
+ const immediate=await f.runtime.run({goalId:submitted.goal_id,maxCycles:2});
184
+ assert.equal(immediate.status,'paused');
185
+ assert.equal(f.planner.prompts.length,3,'OPEN circuit must suppress provider invocation');
186
+
187
+ const restarted=createAutonomousRuntime({policy:f.policy,codingRuntime:f.codingRuntime,nativeDiffRuntime:f.nativeDiff,
188
+ signingKeyPath:f.keys.privateKeyPath,verifyKeyPath:f.keys.publicKeyPath});
189
+ await new Promise(resolve=>setTimeout(resolve,130));
190
+ const circuitBeforeResume=await restarted.providerCircuitStatus({goalId:submitted.goal_id});
191
+ assert.equal(circuitBeforeResume.state,'HALF_OPEN',JSON.stringify(circuitBeforeResume));
192
+ const resumed=await restarted.run({goalId:submitted.goal_id,maxCycles:1});
193
+ assert.notEqual(resumed.status,'paused');
194
+ assert.equal(f.planner.prompts.length,4,'HALF_OPEN must permit exactly one provider probe');
195
+ const journal=await restarted.events({goalId:submitted.goal_id,fromSeq:1,limit:200});
196
+ assert.equal(journal.events.filter(event=>event.type==='provider_call_failed').length,3);
197
+ assert.equal(journal.events.filter(event=>event.type==='provider_probe_started').length,1);
198
+ assert.equal(journal.events.filter(event=>event.type==='provider_call_succeeded').length,1);
199
+ assert.ok(journal.events.some(event=>event.type==='waiting_entered'&&event.payload.reason==='provider_circuit_open'));
200
+ assert.ok(journal.events.some(event=>event.type==='goal_resumed'&&event.payload.previous_reason==='provider_circuit_open'));
201
+ } finally {
202
+ await new Promise(resolve=>f.planner.server.close(resolve));
203
+ await rm(f.root,{recursive:true,force:true});
204
+ }
205
+ });
206
+
207
+ test('provider supervisor adopts an OPEN circuit after restart and resumes only at HALF_OPEN boundary', async () => {
208
+ const f=await fixture([{__http_status:503},{__http_status:503},{__http_status:503}]);
209
+ let supervisor=null;
210
+ try {
211
+ const submitted=await f.runtime.submit({submissionId:'provider-circuit-supervisor',rootId:'project',
212
+ title:'provider circuit supervisor',goal:'make exported value equal fixed',
213
+ acceptance:'supervisor must resume only after the provider circuit probe boundary',maxIterations:10});
214
+ await assert.rejects(f.runtime.run({goalId:submitted.goal_id,maxCycles:2}),/planner HTTP 503/);
215
+ await assert.rejects(f.runtime.run({goalId:submitted.goal_id,maxCycles:2}),/planner HTTP 503/);
216
+ const opened=await f.runtime.run({goalId:submitted.goal_id,maxCycles:2});
217
+ assert.equal(opened.status,'paused');
218
+ assert.equal(opened.reason,'provider_circuit_open');
219
+ assert.equal(f.planner.prompts.length,3);
220
+
221
+ supervisor=startAutonomousSupervisor({runtime:f.runtime,policy:f.policy,idleDelayMs:25,maxCycles:16,logger:{warn(){}}});
222
+ const deadline=Date.now()+10_000;
223
+ let status;
224
+ do {
225
+ status=await f.runtime.status({goalId:submitted.goal_id});
226
+ if(status.state==='succeeded') break;
227
+ if(status.state==='cancelled') throw new Error('provider circuit supervisor cancelled goal');
228
+ await new Promise(resolve=>setTimeout(resolve,25));
229
+ } while(Date.now()<deadline);
230
+ assert.equal(status.state,'succeeded');
231
+ assert.ok(f.planner.prompts.length>3);
232
+ const journal=await f.runtime.events({goalId:submitted.goal_id,fromSeq:1,limit:200});
233
+ assert.equal(journal.events.filter(event=>event.type==='provider_probe_started').length,1);
234
+ assert.ok(journal.events.some(event=>event.type==='goal_resumed'&&event.payload.previous_reason==='provider_circuit_open'));
235
+ } finally {
236
+ if(supervisor) await supervisor.stop();
237
+ await new Promise(resolve=>f.planner.server.close(resolve));
238
+ await rm(f.root,{recursive:true,force:true});
239
+ }
240
+ });
241
+
164
242
  test('provider supervisor completes a submitted goal without client run calls', async () => {
165
243
  const f = await fixture();
166
244
  const supervisor = startAutonomousSupervisor({ runtime:f.runtime, policy:f.policy, idleDelayMs:25, maxCycles:16,
@@ -1,6 +1,7 @@
1
1
  import test from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import {
4
+ autonomousGoalApproveOutputSchema, autonomousGoalRunOutputSchema, autonomousGoalStatusOutputSchema,
4
5
  autonomousGoalVerifyOutputSchema,
5
6
  autonomousStructuredResult
6
7
  } from '../src/autonomous-output-contracts.mjs';
@@ -22,3 +23,56 @@ test('autonomous_goal_verify structured contract preserves delegated action evid
22
23
  const result = autonomousStructuredResult(autonomousGoalVerifyOutputSchema,value);
23
24
  assert.equal(result.structuredContent.delegated_actions_verified,1);
24
25
  });
26
+
27
+ function baseDerived() {
28
+ return {
29
+ state:'running', reason:null, planner_round:2, mutation_epoch:1, mutation_count:1,
30
+ contexts:[], observations:[], diffs:[], decisions:[], planner_rejections:[], active_plan:null,
31
+ pending_request:null, pending_decision:null, journal_head_sha256:'a'.repeat(64),
32
+ created_at_utc:'2026-09-16T00:00:00.000Z', elapsed_ms:10
33
+ };
34
+ }
35
+
36
+ const publicLoop = {
37
+ schema:'deadbyte.autonomous-loop-state.v1', phase:'ACTING', plan_id:'b'.repeat(64), plan_version:2,
38
+ current_step:{step_id:'repair',intent:'repair x.txt',status:'active'}, replan_count:1,
39
+ progress:{verdict:'progress',score:1,reason_codes:['verified_mutation_epoch_advanced'],fingerprint:'c'.repeat(64)},
40
+ pending_action:{action_id:'d'.repeat(64),request_sha256:'e'.repeat(64),kind:'patch'},
41
+ pending_approval:false, wait_reason:null
42
+ };
43
+
44
+ test('R34 run/status output contracts accept only the sanitized public loop projection', () => {
45
+ const run = autonomousStructuredResult(autonomousGoalRunOutputSchema,{
46
+ status:'yielded',goal_id:'1'.repeat(64),...baseDerived(),loop:publicLoop
47
+ });
48
+ assert.equal(run.structuredContent.loop.phase,'ACTING');
49
+ const status = autonomousStructuredResult(autonomousGoalStatusOutputSchema,{
50
+ status:'ok',goal_id:'1'.repeat(64),goal_sha256:'2'.repeat(64),title:'x',root_id:'project',journal_verified:true,
51
+ ...baseDerived(),loop:publicLoop
52
+ });
53
+ assert.equal(status.structuredContent.loop.pending_action.kind,'patch');
54
+ const approved = autonomousStructuredResult(autonomousGoalApproveOutputSchema,{
55
+ status:'approved',goal_id:'1'.repeat(64),state:'running',loop:{...publicLoop,phase:'ACTING'}
56
+ });
57
+ assert.equal(approved.structuredContent.loop.phase,'ACTING');
58
+ });
59
+
60
+ test('bounded yielded autonomous run preserves its resumable cycle count', () => {
61
+ const result = autonomousStructuredResult(autonomousGoalRunOutputSchema,{
62
+ status:'yielded',goal_id:'1'.repeat(64),cycles:1,...baseDerived(),loop:publicLoop
63
+ });
64
+ assert.equal(result.structuredContent.cycles,1);
65
+ });
66
+
67
+ test('R34 public loop contract rejects internal progress/action payload fields', () => {
68
+ assert.throws(() => autonomousStructuredResult(autonomousGoalRunOutputSchema,{
69
+ status:'yielded',goal_id:'1'.repeat(64),...baseDerived(),loop:{
70
+ ...publicLoop,pending_action:{...publicLoop.pending_action,action:{kind:'patch',operations:[]}}
71
+ }
72
+ }),/autonomous output contract violation/);
73
+ assert.throws(() => autonomousStructuredResult(autonomousGoalRunOutputSchema,{
74
+ status:'yielded',goal_id:'1'.repeat(64),...baseDerived(),loop:{
75
+ ...publicLoop,progress:{...publicLoop.progress,decision_event_sha256:'f'.repeat(64)}
76
+ }
77
+ }),/autonomous output contract violation/);
78
+ });
@@ -0,0 +1,101 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {
4
+ createPlan,
5
+ replanPlan,
6
+ completePlanStep,
7
+ planIsComplete,
8
+ activePlanStep
9
+ } from '../src/autonomous-plan.mjs';
10
+
11
+ const H = c => c.repeat(64);
12
+
13
+ function basePlan() {
14
+ return createPlan({
15
+ goalId:H('a'),
16
+ title:'Repair',
17
+ reasonHash:H('b'),
18
+ steps:[
19
+ { step_id:'inspect', intent:'Inspect source' },
20
+ { step_id:'fix', intent:'Apply repair' },
21
+ { step_id:'verify', intent:'Verify acceptance' }
22
+ ]
23
+ });
24
+ }
25
+
26
+ test('plan id is goal-stable and version starts at one', () => {
27
+ const plan = basePlan();
28
+ assert.equal(plan.schema,'deadbyte.autonomous-plan.v1');
29
+ assert.equal(plan.plan_version,1);
30
+ assert.equal(plan.parent_plan_version,null);
31
+ assert.match(plan.plan_id,/^[0-9a-f]{64}$/);
32
+ assert.equal(plan.steps[0].status,'active');
33
+ assert.equal(plan.steps[1].status,'pending');
34
+ assert.equal(plan.steps[2].status,'pending');
35
+ const same = basePlan();
36
+ assert.equal(same.plan_id,plan.plan_id);
37
+ });
38
+
39
+ test('completed prefix is immutable across replan', () => {
40
+ let plan = basePlan();
41
+ plan = completePlanStep(plan,{
42
+ stepId:'inspect',
43
+ evidence:[{kind:'read',id:H('c'),sha256:H('d')}]
44
+ });
45
+ assert.throws(() => replanPlan(plan,{
46
+ reasonHash:H('e'),
47
+ steps:[
48
+ { step_id:'inspect', intent:'Changed completed intent' },
49
+ { step_id:'fix2', intent:'Alternative repair' }
50
+ ]
51
+ }),/completed prefix/i);
52
+ });
53
+
54
+ test('replan changes only active and pending suffix and increments version', () => {
55
+ let plan = basePlan();
56
+ plan = completePlanStep(plan,{
57
+ stepId:'inspect',
58
+ evidence:[{kind:'read',id:H('c'),sha256:H('d')}]
59
+ });
60
+ const next = replanPlan(plan,{
61
+ reasonHash:H('e'),
62
+ steps:[
63
+ plan.steps[0],
64
+ { step_id:'diagnose', intent:'Diagnose failure' },
65
+ { step_id:'fix2', intent:'Apply corrected repair' }
66
+ ]
67
+ });
68
+ assert.equal(next.plan_version,2);
69
+ assert.equal(next.parent_plan_version,1);
70
+ assert.equal(next.plan_id,plan.plan_id);
71
+ assert.deepEqual(next.steps[0],plan.steps[0]);
72
+ assert.equal(next.steps[1].status,'active');
73
+ assert.equal(next.steps[2].status,'pending');
74
+ });
75
+
76
+ test('step completion requires evidence and activates exactly the next step', () => {
77
+ const plan = basePlan();
78
+ assert.throws(() => completePlanStep(plan,{stepId:'inspect',evidence:[]}),/evidence/i);
79
+ const next = completePlanStep(plan,{
80
+ stepId:'inspect',
81
+ evidence:[{kind:'read',id:H('c'),sha256:H('d')}]
82
+ });
83
+ assert.equal(next.steps[0].status,'completed');
84
+ assert.equal(next.steps[1].status,'active');
85
+ assert.equal(next.steps[2].status,'pending');
86
+ assert.equal(activePlanStep(next).step_id,'fix');
87
+ assert.equal(planIsComplete(next),false);
88
+ });
89
+
90
+ test('completing the final step leaves no active step and marks plan complete', () => {
91
+ let plan = basePlan();
92
+ for (const [index,stepId] of ['inspect','fix','verify'].entries()) {
93
+ plan = completePlanStep(plan,{
94
+ stepId,
95
+ evidence:[{kind:'receipt',id:H(String(index + 1)),sha256:H(String(index + 4))}]
96
+ });
97
+ }
98
+ assert.equal(activePlanStep(plan),null);
99
+ assert.equal(planIsComplete(plan),true);
100
+ assert.ok(plan.steps.every(step => step.status === 'completed'));
101
+ });
@@ -0,0 +1,106 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { judgeProgress, stallDisposition } from '../src/autonomous-progress.mjs';
7
+ import { loadCodingPolicy } from '../src/coding-plane.mjs';
8
+ import { loadAutonomousPolicy } from '../src/autonomous-policy.mjs';
9
+
10
+ const H = c => c.repeat(64);
11
+
12
+ test('verified Native Diff epoch advance counts as progress', () => {
13
+ const result = judgeProgress({
14
+ before:{mutation_epoch:1,completed_steps:0},
15
+ after:{mutation_epoch:2,completed_steps:0},
16
+ decision:{kind:'act'},
17
+ evidence:{native_diff_verified:true}
18
+ });
19
+ assert.equal(result.verdict,'progress');
20
+ assert.ok(result.score > 0);
21
+ assert.ok(result.reason_codes.includes('verified_mutation_epoch_advanced'));
22
+ assert.match(result.fingerprint,/^[0-9a-f]{64}$/);
23
+ });
24
+
25
+ test('same read identity and equivalent decision stalls', () => {
26
+ const result = judgeProgress({
27
+ before:{evidence_head:H('a'),completed_steps:0},
28
+ after:{evidence_head:H('a'),completed_steps:0},
29
+ decision:{kind:'inspect',fingerprint:H('b'),rationale:'first wording'},
30
+ evidence:{same_source_sha:true,equivalent_decision:true}
31
+ });
32
+ assert.equal(result.verdict,'stalled');
33
+ assert.equal(result.score,0);
34
+ assert.ok(result.reason_codes.includes('identical_read_repeated'));
35
+ assert.ok(result.reason_codes.includes('equivalent_decision_no_new_evidence'));
36
+ });
37
+
38
+ test('planner rationale text never changes the machine progress fingerprint', () => {
39
+ const base = {
40
+ before:{evidence_head:H('a')}, after:{evidence_head:H('a')},
41
+ evidence:{same_source_sha:true,equivalent_decision:true}
42
+ };
43
+ const a = judgeProgress({...base,decision:{kind:'inspect',path:'x',rationale:'one'}});
44
+ const b = judgeProgress({...base,decision:{kind:'inspect',path:'x',rationale:'completely different prose'}});
45
+ assert.equal(a.fingerprint,b.fingerprint);
46
+ assert.equal(a.verdict,b.verdict);
47
+ });
48
+
49
+ test('resolved acceptance failure and completed plan step count as progress', () => {
50
+ const result = judgeProgress({
51
+ before:{acceptance_failures:1,completed_steps:1},
52
+ after:{acceptance_failures:0,completed_steps:2},
53
+ decision:{kind:'step_complete'},
54
+ evidence:{step_evidence_verified:true}
55
+ });
56
+ assert.equal(result.verdict,'progress');
57
+ assert.ok(result.reason_codes.includes('acceptance_failure_resolved'));
58
+ assert.ok(result.reason_codes.includes('plan_step_completed'));
59
+ });
60
+
61
+ test('stall policy forces replan then waiting', () => {
62
+ const limits={max_stalled_cycles:2,max_post_replan_stalls:2,max_replans:8};
63
+ assert.deepEqual(stallDisposition({history:['stalled','stalled'],limits}),{
64
+ action:'replan',reason:'stall_threshold_reached'
65
+ });
66
+ assert.deepEqual(stallDisposition({history:['replan','stalled','stalled'],limits}),{
67
+ action:'wait',reason:'post_replan_stall_threshold_reached'
68
+ });
69
+ });
70
+
71
+ async function policyFixture(limits) {
72
+ const root = await mkdtemp(path.join(os.tmpdir(),'deadbyte-r34-progress-policy-'));
73
+ const project = path.join(root,'project');
74
+ await mkdir(project);
75
+ const codingPath = path.join(root,'coding.json');
76
+ await writeFile(codingPath,JSON.stringify({
77
+ schema:'deadbyte.coding-policy.v1',enabled:true,
78
+ lease_file:path.join(root,'coding-grant.json'),evidence_dir:path.join(root,'coding-evidence'),
79
+ roots:{project:{path:project,read:true,write:true,exec:false,deny_paths:[]}},commands:{}
80
+ }));
81
+ const coding = await loadCodingPolicy(codingPath);
82
+ const autonomousPath = path.join(root,'autonomous.json');
83
+ await writeFile(autonomousPath,JSON.stringify({
84
+ schema:'deadbyte.autonomous-policy.v1',enabled:true,
85
+ lease_file:path.join(root,'autonomous-grant.json'),evidence_dir:path.join(root,'autonomous-evidence'),
86
+ root_ids:['project'],coding_policy_sha256:coding.policy_sha256,
87
+ planner:{backend:'client_sampling',max_tokens:2048},profiles:{},
88
+ limits:{max_iterations:8,max_mutations:8,max_wall_ms:600000,max_context_bytes:262144,max_diff_bytes:262144,max_files_per_diff:4,...limits}
89
+ }));
90
+ return {root,coding,autonomousPath};
91
+ }
92
+
93
+ test('autonomous policy defaults R34 progress limits and rejects zero values', async () => {
94
+ const f = await policyFixture({});
95
+ try {
96
+ const policy = await loadAutonomousPolicy(f.autonomousPath,f.coding);
97
+ assert.equal(policy.limits.max_stalled_cycles,2);
98
+ assert.equal(policy.limits.max_post_replan_stalls,2);
99
+ assert.equal(policy.limits.max_replans,8);
100
+ } finally { await rm(f.root,{recursive:true,force:true}); }
101
+
102
+ const bad = await policyFixture({max_stalled_cycles:0});
103
+ try {
104
+ await assert.rejects(loadAutonomousPolicy(bad.autonomousPath,bad.coding),/max_stalled_cycles/);
105
+ } finally { await rm(bad.root,{recursive:true,force:true}); }
106
+ });