@mjasnikovs/pi-task 0.38.29 → 0.38.31

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 (373) hide show
  1. package/dist/config/config.d.ts +70 -70
  2. package/dist/config/config.js +26 -35
  3. package/dist/config/extension-list.d.ts +6 -5
  4. package/dist/config/extension-list.js +3 -2
  5. package/dist/config/reasoning-args.d.ts +9 -7
  6. package/dist/config/reasoning-args.js +12 -10
  7. package/dist/config/reasoning.d.ts +44 -105
  8. package/dist/config/reasoning.js +27 -704
  9. package/dist/config/register.d.ts +34 -48
  10. package/dist/config/register.js +41 -51
  11. package/dist/config/tool-list.d.ts +16 -16
  12. package/dist/config/tool-list.js +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/remote/bridge.d.ts +19 -10
  15. package/dist/remote/bridge.js +3 -2
  16. package/dist/remote/broadcast.js +3 -1
  17. package/dist/remote/events.js +12 -11
  18. package/dist/remote/history.d.ts +1 -1
  19. package/dist/remote/protocol.d.ts +6 -3
  20. package/dist/remote/protocol.js +2 -1
  21. package/dist/remote/push.d.ts +16 -16
  22. package/dist/remote/push.js +27 -27
  23. package/dist/remote/register.d.ts +3 -3
  24. package/dist/remote/register.js +17 -19
  25. package/dist/remote/server.d.ts +9 -8
  26. package/dist/remote/server.js +15 -14
  27. package/dist/remote/session-state.d.ts +5 -4
  28. package/dist/remote/session-state.js +8 -5
  29. package/dist/remote/sw.d.ts +7 -6
  30. package/dist/remote/sw.js +7 -6
  31. package/dist/remote/tailscale.d.ts +4 -2
  32. package/dist/remote/tailscale.js +4 -2
  33. package/dist/remote/ui-highlight.js +6 -5
  34. package/dist/remote/ui-render.js +4 -4
  35. package/dist/remote/ui-script.js +24 -24
  36. package/dist/remote/ui-styles.d.ts +1 -1
  37. package/dist/remote/ui-styles.js +10 -13
  38. package/dist/remote/ui-tools.js +9 -6
  39. package/dist/shared/child-extensions.d.ts +29 -17
  40. package/dist/shared/child-extensions.js +29 -17
  41. package/dist/shared/child-output.d.ts +30 -24
  42. package/dist/shared/child-output.js +25 -17
  43. package/dist/shared/child-process.d.ts +47 -40
  44. package/dist/shared/child-process.js +50 -59
  45. package/dist/shared/command-watchdog.d.ts +85 -16
  46. package/dist/shared/command-watchdog.js +115 -21
  47. package/dist/shared/fs-text.d.ts +16 -10
  48. package/dist/shared/fs-text.js +16 -10
  49. package/dist/shared/git-runner.d.ts +25 -25
  50. package/dist/shared/git-runner.js +25 -25
  51. package/dist/shared/leaked-tool-call.d.ts +17 -11
  52. package/dist/shared/leaked-tool-call.js +23 -15
  53. package/dist/shared/model-endpoint.d.ts +29 -16
  54. package/dist/shared/model-endpoint.js +33 -21
  55. package/dist/shared/pi-invocation.d.ts +7 -4
  56. package/dist/shared/pi-invocation.js +12 -7
  57. package/dist/shared/pkg-version.d.ts +13 -5
  58. package/dist/shared/pkg-version.js +13 -5
  59. package/dist/shared/reasoning-capability.d.ts +35 -24
  60. package/dist/shared/reasoning-capability.js +35 -24
  61. package/dist/shared/stream-watchdog.d.ts +60 -44
  62. package/dist/shared/stream-watchdog.js +62 -45
  63. package/dist/task/accept-debt.d.ts +41 -43
  64. package/dist/task/accept-debt.js +73 -65
  65. package/dist/task/api-synthesis.d.ts +24 -21
  66. package/dist/task/api-synthesis.js +32 -26
  67. package/dist/task/apis-contract.d.ts +32 -64
  68. package/dist/task/apis-contract.js +32 -64
  69. package/dist/task/artifact-closure.d.ts +27 -13
  70. package/dist/task/artifact-closure.js +95 -67
  71. package/dist/task/auto-commit.d.ts +46 -35
  72. package/dist/task/auto-commit.js +51 -38
  73. package/dist/task/auto-io.d.ts +45 -25
  74. package/dist/task/auto-io.js +57 -29
  75. package/dist/task/auto-orchestrator.d.ts +26 -24
  76. package/dist/task/auto-orchestrator.js +192 -165
  77. package/dist/task/auto-prompts.d.ts +36 -24
  78. package/dist/task/auto-prompts.js +40 -26
  79. package/dist/task/autofix-ledger.d.ts +27 -25
  80. package/dist/task/autofix-ledger.js +29 -26
  81. package/dist/task/batch-test-task.d.ts +20 -12
  82. package/dist/task/batch-test-task.js +67 -60
  83. package/dist/task/boot-probe.d.ts +60 -44
  84. package/dist/task/boot-probe.js +91 -72
  85. package/dist/task/cancel-input.d.ts +30 -16
  86. package/dist/task/cancel-input.js +20 -11
  87. package/dist/task/cancel-points.d.ts +27 -20
  88. package/dist/task/cancel-points.js +30 -22
  89. package/dist/task/child-runner.d.ts +124 -55
  90. package/dist/task/child-runner.js +298 -90
  91. package/dist/task/child-status.d.ts +23 -16
  92. package/dist/task/child-status.js +23 -16
  93. package/dist/task/clamp-output.js +12 -5
  94. package/dist/task/command-run.d.ts +31 -28
  95. package/dist/task/command-run.js +44 -35
  96. package/dist/task/command-shrink.d.ts +25 -18
  97. package/dist/task/command-shrink.js +37 -31
  98. package/dist/task/command-watchdog.d.ts +9 -6
  99. package/dist/task/command-watchdog.js +21 -15
  100. package/dist/task/context-attribution.d.ts +34 -26
  101. package/dist/task/context-attribution.js +34 -26
  102. package/dist/task/context-silence.d.ts +39 -29
  103. package/dist/task/context-silence.js +35 -25
  104. package/dist/task/context-usage.d.ts +16 -9
  105. package/dist/task/context-usage.js +16 -9
  106. package/dist/task/contracts.d.ts +8 -4
  107. package/dist/task/contracts.js +25 -17
  108. package/dist/task/coverage-loop.d.ts +22 -18
  109. package/dist/task/coverage-loop.js +35 -30
  110. package/dist/task/critique-probes.d.ts +13 -14
  111. package/dist/task/critique-probes.js +50 -39
  112. package/dist/task/debug-log.d.ts +13 -5
  113. package/dist/task/debug-log.js +32 -20
  114. package/dist/task/decompose-fidelity.d.ts +11 -9
  115. package/dist/task/decompose-fidelity.js +38 -33
  116. package/dist/task/decompose-granularity.d.ts +41 -38
  117. package/dist/task/decompose-granularity.js +41 -38
  118. package/dist/task/deep-render-check.d.ts +22 -14
  119. package/dist/task/deep-render-check.js +40 -31
  120. package/dist/task/dropped-input.d.ts +12 -7
  121. package/dist/task/dropped-input.js +5 -2
  122. package/dist/task/enforce-attribution.d.ts +38 -47
  123. package/dist/task/enforce-attribution.js +46 -52
  124. package/dist/task/enforce-guidelines.d.ts +31 -20
  125. package/dist/task/enforce-guidelines.js +32 -21
  126. package/dist/task/enrichment.d.ts +7 -2
  127. package/dist/task/enrichment.js +26 -14
  128. package/dist/task/env-notes.d.ts +16 -7
  129. package/dist/task/env-notes.js +48 -31
  130. package/dist/task/env-template-closure.d.ts +4 -4
  131. package/dist/task/env-template-closure.js +42 -34
  132. package/dist/task/external-context.d.ts +28 -21
  133. package/dist/task/external-context.js +17 -12
  134. package/dist/task/failure-classifier.d.ts +4 -5
  135. package/dist/task/failure-classifier.js +30 -8
  136. package/dist/task/file-inventory.d.ts +15 -11
  137. package/dist/task/file-inventory.js +25 -22
  138. package/dist/task/final-gate-fix.d.ts +74 -86
  139. package/dist/task/final-gate-fix.js +97 -116
  140. package/dist/task/final-gate-progress.d.ts +29 -46
  141. package/dist/task/final-gate-progress.js +40 -51
  142. package/dist/task/final-gate.d.ts +64 -97
  143. package/dist/task/final-gate.js +192 -199
  144. package/dist/task/fix-child.d.ts +21 -27
  145. package/dist/task/fix-child.js +21 -27
  146. package/dist/task/foreign-path.d.ts +6 -5
  147. package/dist/task/foreign-path.js +0 -0
  148. package/dist/task/frozen-conflict.d.ts +9 -10
  149. package/dist/task/frozen-conflict.js +61 -64
  150. package/dist/task/frozen-path-guard.d.ts +35 -14
  151. package/dist/task/frozen-path-guard.js +56 -39
  152. package/dist/task/gate-child.d.ts +27 -28
  153. package/dist/task/gate-child.js +36 -35
  154. package/dist/task/gate-deps.d.ts +34 -27
  155. package/dist/task/gate-deps.js +169 -159
  156. package/dist/task/gate-tally.d.ts +77 -80
  157. package/dist/task/gate-tally.js +65 -68
  158. package/dist/task/git-state-guard.d.ts +15 -11
  159. package/dist/task/git-state-guard.js +76 -66
  160. package/dist/task/impl-widget.d.ts +25 -16
  161. package/dist/task/impl-widget.js +27 -17
  162. package/dist/task/implementation-guards.d.ts +26 -0
  163. package/dist/task/implementation-guards.js +177 -0
  164. package/dist/task/implementation-thinking.d.ts +33 -31
  165. package/dist/task/implementation-thinking.js +5 -6
  166. package/dist/task/implementation-turn.d.ts +39 -31
  167. package/dist/task/implementation-turn.js +41 -28
  168. package/dist/task/inline-markdown.d.ts +20 -7
  169. package/dist/task/inline-markdown.js +15 -6
  170. package/dist/task/launch-config-gap.js +25 -39
  171. package/dist/task/launch-contract.d.ts +18 -21
  172. package/dist/task/launch-contract.js +28 -30
  173. package/dist/task/launch-manifest.d.ts +6 -2
  174. package/dist/task/launch-manifest.js +35 -34
  175. package/dist/task/ledger.js +16 -14
  176. package/dist/task/lint-fix.d.ts +6 -8
  177. package/dist/task/lint-fix.js +67 -69
  178. package/dist/task/loop-detector.d.ts +27 -8
  179. package/dist/task/loop-detector.js +38 -14
  180. package/dist/task/mid-run-input.d.ts +17 -15
  181. package/dist/task/mid-run-input.js +17 -15
  182. package/dist/task/orchestrator.d.ts +24 -28
  183. package/dist/task/orchestrator.js +89 -66
  184. package/dist/task/orientation.d.ts +18 -23
  185. package/dist/task/orientation.js +24 -31
  186. package/dist/task/owned-freeze-conflict.d.ts +21 -20
  187. package/dist/task/owned-freeze-conflict.js +52 -85
  188. package/dist/task/owned-freeze-reassign.d.ts +40 -60
  189. package/dist/task/owned-freeze-reassign.js +41 -61
  190. package/dist/task/parsers.d.ts +4 -2
  191. package/dist/task/parsers.js +4 -4
  192. package/dist/task/phases.d.ts +41 -48
  193. package/dist/task/phases.js +196 -252
  194. package/dist/task/plan-io.d.ts +6 -7
  195. package/dist/task/plan-io.js +6 -7
  196. package/dist/task/plan-orchestrator.d.ts +10 -8
  197. package/dist/task/plan-orchestrator.js +14 -10
  198. package/dist/task/plan-prompts.d.ts +6 -5
  199. package/dist/task/plan-prompts.js +6 -5
  200. package/dist/task/plan-readonly.d.ts +4 -5
  201. package/dist/task/plan-readonly.js +4 -5
  202. package/dist/task/plan-rounds.d.ts +17 -29
  203. package/dist/task/plan-rounds.js +21 -34
  204. package/dist/task/plan-session.d.ts +58 -72
  205. package/dist/task/plan-session.js +61 -83
  206. package/dist/task/probe-gaming.d.ts +28 -27
  207. package/dist/task/probe-gaming.js +0 -0
  208. package/dist/task/prohibition-probe.d.ts +14 -16
  209. package/dist/task/prompts.d.ts +3 -4
  210. package/dist/task/prompts.js +17 -26
  211. package/dist/task/qa-transcript.d.ts +15 -22
  212. package/dist/task/qa-transcript.js +15 -21
  213. package/dist/task/question-box.d.ts +17 -13
  214. package/dist/task/question-box.js +19 -15
  215. package/dist/task/question-dedup.d.ts +6 -7
  216. package/dist/task/question-dedup.js +13 -14
  217. package/dist/task/question-dialog.d.ts +22 -32
  218. package/dist/task/question-dialog.js +22 -32
  219. package/dist/task/question-source.d.ts +18 -44
  220. package/dist/task/question-source.js +22 -51
  221. package/dist/task/refuted-constraint.d.ts +11 -31
  222. package/dist/task/refuted-constraint.js +27 -51
  223. package/dist/task/regenerable-artifacts.d.ts +12 -31
  224. package/dist/task/regenerable-artifacts.js +12 -31
  225. package/dist/task/render-check.d.ts +11 -22
  226. package/dist/task/render-check.js +33 -46
  227. package/dist/task/repo-health-check.d.ts +10 -14
  228. package/dist/task/repo-health-check.js +17 -23
  229. package/dist/task/requirements.d.ts +38 -71
  230. package/dist/task/requirements.js +78 -126
  231. package/dist/task/research-fanout-budget.d.ts +51 -88
  232. package/dist/task/research-fanout-budget.js +51 -88
  233. package/dist/task/research-worker.d.ts +29 -39
  234. package/dist/task/research-worker.js +37 -61
  235. package/dist/task/resume-gap.d.ts +14 -15
  236. package/dist/task/root-cause-repair.d.ts +9 -9
  237. package/dist/task/root-cause-repair.js +28 -40
  238. package/dist/task/run-bracket.d.ts +10 -13
  239. package/dist/task/run-end.d.ts +12 -22
  240. package/dist/task/run-end.js +8 -16
  241. package/dist/task/run-final-gate.d.ts +19 -21
  242. package/dist/task/run-final-gate.js +62 -80
  243. package/dist/task/runner-globs.d.ts +12 -13
  244. package/dist/task/runner-globs.js +12 -13
  245. package/dist/task/runner-resolve.d.ts +9 -9
  246. package/dist/task/runner-resolve.js +22 -23
  247. package/dist/task/script-escape.d.ts +10 -12
  248. package/dist/task/script-escape.js +13 -14
  249. package/dist/task/serve-entry.d.ts +1 -1
  250. package/dist/task/serve-entry.js +22 -25
  251. package/dist/task/service-blocks.js +4 -2
  252. package/dist/task/shipped-source.d.ts +11 -29
  253. package/dist/task/shipped-source.js +11 -29
  254. package/dist/task/skip-escape.js +10 -14
  255. package/dist/task/spec-urls.d.ts +26 -65
  256. package/dist/task/spec-urls.js +26 -65
  257. package/dist/task/spec-validation.d.ts +17 -20
  258. package/dist/task/spec-validation.js +17 -20
  259. package/dist/task/stall-detector.d.ts +23 -30
  260. package/dist/task/stall-detector.js +23 -30
  261. package/dist/task/stream-watchdog.d.ts +14 -12
  262. package/dist/task/stream-watchdog.js +14 -12
  263. package/dist/task/substitution-probe.d.ts +17 -20
  264. package/dist/task/substitution-probe.js +17 -20
  265. package/dist/task/task-gates.d.ts +36 -41
  266. package/dist/task/task-gates.js +95 -106
  267. package/dist/task/task-io.d.ts +4 -4
  268. package/dist/task/task-io.js +4 -4
  269. package/dist/task/task-parsers.js +4 -3
  270. package/dist/task/task-provenance.d.ts +2 -2
  271. package/dist/task/task-provenance.js +11 -13
  272. package/dist/task/task-types.d.ts +4 -3
  273. package/dist/task/terminal-outcome.d.ts +14 -16
  274. package/dist/task/terminal-outcome.js +12 -14
  275. package/dist/task/test-assembly.d.ts +13 -20
  276. package/dist/task/test-assembly.js +13 -20
  277. package/dist/task/timings.d.ts +5 -3
  278. package/dist/task/timings.js +5 -3
  279. package/dist/task/title-label.d.ts +9 -4
  280. package/dist/task/title-label.js +9 -4
  281. package/dist/task/type-only-answer.d.ts +44 -52
  282. package/dist/task/type-only-answer.js +44 -52
  283. package/dist/task/unfailable-command.d.ts +18 -24
  284. package/dist/task/unfailable-command.js +21 -27
  285. package/dist/task/unknown-routing.d.ts +10 -4
  286. package/dist/task/unknown-routing.js +10 -4
  287. package/dist/task/user-directives.d.ts +5 -8
  288. package/dist/task/user-directives.js +5 -8
  289. package/dist/task/verify-quality.d.ts +18 -22
  290. package/dist/task/verify-quality.js +45 -46
  291. package/dist/task/verify-reconcile.d.ts +15 -10
  292. package/dist/task/verify-reconcile.js +45 -43
  293. package/dist/task/verify-resolution.d.ts +24 -20
  294. package/dist/task/verify-resolution.js +51 -50
  295. package/dist/task/verify-work.d.ts +59 -66
  296. package/dist/task/verify-work.js +101 -138
  297. package/dist/task/widget.d.ts +15 -14
  298. package/dist/task/widget.js +22 -17
  299. package/dist/task/wiring-claims.d.ts +25 -32
  300. package/dist/task/wiring-claims.js +30 -35
  301. package/dist/task/write-guard.d.ts +39 -39
  302. package/dist/task/write-guard.js +48 -51
  303. package/dist/task/yolo.d.ts +34 -30
  304. package/dist/task/yolo.js +42 -37
  305. package/dist/workers/abstention.d.ts +21 -41
  306. package/dist/workers/abstention.js +27 -48
  307. package/dist/workers/brave-search.d.ts +4 -3
  308. package/dist/workers/brave-search.js +5 -2
  309. package/dist/workers/brave-warning.d.ts +7 -4
  310. package/dist/workers/brave-warning.js +19 -7
  311. package/dist/workers/ddg-search.d.ts +6 -6
  312. package/dist/workers/ddg-search.js +18 -12
  313. package/dist/workers/docs-cache.js +5 -2
  314. package/dist/workers/docs-chunk.d.ts +30 -37
  315. package/dist/workers/docs-chunk.js +37 -41
  316. package/dist/workers/docs-core.d.ts +28 -44
  317. package/dist/workers/docs-core.js +25 -44
  318. package/dist/workers/docs-index.js +4 -3
  319. package/dist/workers/docs-lookup.d.ts +15 -22
  320. package/dist/workers/docs-lookup.js +12 -21
  321. package/dist/workers/docs-project.d.ts +15 -9
  322. package/dist/workers/docs-project.js +17 -10
  323. package/dist/workers/docs-resolve.d.ts +19 -20
  324. package/dist/workers/docs-resolve.js +35 -32
  325. package/dist/workers/docs-retrieve.d.ts +5 -6
  326. package/dist/workers/docs-retrieve.js +18 -15
  327. package/dist/workers/exa-search.d.ts +9 -6
  328. package/dist/workers/exa-search.js +23 -12
  329. package/dist/workers/fetch-core.d.ts +13 -16
  330. package/dist/workers/fetch-core.js +23 -23
  331. package/dist/workers/focused-extractor.d.ts +13 -12
  332. package/dist/workers/focused-extractor.js +27 -19
  333. package/dist/workers/html-clean.js +24 -14
  334. package/dist/workers/http-request.d.ts +28 -20
  335. package/dist/workers/http-request.js +22 -17
  336. package/dist/workers/npm-version.d.ts +28 -11
  337. package/dist/workers/npm-version.js +24 -15
  338. package/dist/workers/phantom-imports.d.ts +15 -12
  339. package/dist/workers/phantom-imports.js +30 -24
  340. package/dist/workers/pi-worker-core.d.ts +65 -96
  341. package/dist/workers/pi-worker-core.js +93 -181
  342. package/dist/workers/pi-worker-docs.d.ts +24 -19
  343. package/dist/workers/pi-worker-docs.js +67 -76
  344. package/dist/workers/pi-worker-fetch.d.ts +7 -3
  345. package/dist/workers/pi-worker-fetch.js +27 -19
  346. package/dist/workers/pi-worker-search.js +12 -8
  347. package/dist/workers/pi-worker.d.ts +9 -4
  348. package/dist/workers/pi-worker.js +21 -14
  349. package/dist/workers/reasoning-warning.d.ts +18 -17
  350. package/dist/workers/reasoning-warning.js +22 -20
  351. package/dist/workers/research-cache.js +50 -78
  352. package/dist/workers/search-core.js +7 -5
  353. package/dist/workers/search-types.d.ts +10 -9
  354. package/dist/workers/search-types.js +9 -8
  355. package/dist/workers/session-hint.d.ts +13 -14
  356. package/dist/workers/session-hint.js +8 -9
  357. package/dist/workers/shared.d.ts +21 -25
  358. package/dist/workers/shared.js +0 -0
  359. package/dist/workers/single-read-extension.d.ts +14 -7
  360. package/dist/workers/single-read-extension.js +14 -7
  361. package/dist/workers/single-read-guard.d.ts +27 -30
  362. package/dist/workers/single-read-guard.js +36 -36
  363. package/dist/workers/typeonly-log.d.ts +12 -9
  364. package/dist/workers/typeonly-log.js +29 -33
  365. package/dist/workers/worker-channels.d.ts +15 -23
  366. package/dist/workers/worker-channels.js +15 -23
  367. package/dist/workers/worker-failure.d.ts +38 -46
  368. package/dist/workers/worker-failure.js +31 -39
  369. package/dist/workers/worker-kill.d.ts +25 -26
  370. package/dist/workers/worker-kill.js +16 -19
  371. package/dist/workers/worker-profiles.d.ts +54 -56
  372. package/dist/workers/worker-profiles.js +63 -39
  373. package/package.json +10 -8
@@ -1,21 +1,16 @@
1
1
  /**
2
2
  * serve-entry — the project builds a server app, expects to SERVE, and nothing in
3
- * the tree ever starts a listener (nexttask 2 part B).
3
+ * the tree ever starts a listener.
4
4
  *
5
- * THE FAILURE THIS CLOSES (mx5 run 18, measured). The shipped `src/server/index.ts`
6
- * is 28 lines that construct a Hono app, mount five `/api` routers, add an SPA
7
- * fallback reading `Bun.file('dist/index.html')` — and end at `export {app}`. There
8
- * is no `Bun.serve`, no `export default app`, no `serve()` from an adapter, no
9
- * `start` script. Running the entry directly exits 0 in milliseconds:
5
+ * THE FAILURE THIS CLOSES. A `src/server/index.ts` constructs a Hono app, mounts
6
+ * its `/api` routers, adds an SPA fallback reading `Bun.file('dist/index.html')` —
7
+ * and ends at `export {app}`. No `Bun.serve`, no `export default app`, no `serve()`
8
+ * from an adapter. Running that entry exits 0 immediately: the product cannot be
9
+ * started at all.
10
10
  *
11
- * $ DATABASE_URL=… timeout 15 bun run src/server/index.ts → EXIT=0
12
- *
13
- * The product could not be started at all, and the run shipped green: the gate's
14
- * boot command resolved to a `docker compose up` orchestrator, docker was absent in
15
- * the sandbox, and the boot SKIPPED. This is the SECOND run to lose this exact
16
- * clause — mx5 run 16 shipped a server that never served the client bundle
17
- * (scripts/live-owned-requirement-compose-ab.ts) — so a dynamic-only gate has now
18
- * failed to catch it twice.
11
+ * A dynamic gate does not necessarily catch it. If the boot command resolves to an
12
+ * orchestrator the environment cannot run, the boot SKIPS under the env-gap
13
+ * contract and the run ships green.
19
14
  *
20
15
  * WHY STATIC. The check needs no runtime, no browser, no docker, no database and no
21
16
  * model: the tree either contains a bind or it does not. It runs in milliseconds and
@@ -50,9 +45,9 @@ const CONSTRUCT_PATTERNS = [
50
45
  { re: /(?:^|[^.\w])express\s*\(\s*\)/, construct: 'express()' },
51
46
  { re: /(?:^|[^.\w])[Ff]astify\s*\(/, construct: 'fastify()' },
52
47
  { re: /(?:^|[^.\w])polka\s*\(/, construct: 'polka()' }
53
- // `connect()` (the middleware framework) is deliberately absent: gofer's
54
- // src/store/db.ts calls `connect()` on a DATABASE, and a construct signal that
55
- // cannot tell a server from a db handle is not a construct signal.
48
+ // `connect()` (the middleware framework) is deliberately absent: `connect()` is
49
+ // also what a database module calls, and a construct signal that cannot tell a
50
+ // server from a db handle is not a construct signal.
56
51
  ];
57
52
  /**
58
53
  * Anything that starts (or hands off) a listener. Deliberately GENEROUS: every
@@ -72,7 +67,8 @@ const BIND_PATTERNS = [
72
67
  * Vercel) starts whatever is exported. A default-exported config object
73
68
  * (`export default defineConfig({…})`) is not one of them, and neither is a React
74
69
  * component — hence the identifier must be a name the tree BOUND to a server-app
75
- * construction (aiz-client's `export default App` is a component, not a listener). */
70
+ * construction. `export default App` on a component names nothing this scan
71
+ * constructed, so it is not a bind. */
76
72
  function defaultExportBind(src, appNames) {
77
73
  for (const m of src.matchAll(/export\s+default\s+([A-Za-z_$][\w$]*)/g)) {
78
74
  if (appNames.has(m[1]))
@@ -147,7 +143,7 @@ export function findServeExpectation(src) {
147
143
  return null;
148
144
  }
149
145
  /** A design/spec clause that names a served path — the plan-side half of the same
150
- * expectation (mx5's `DESIGN/PROJECT.md:285`: "serves `/api` + static `dist/`"). */
146
+ * expectation, e.g. a design that says "serves `/api` + static `dist/`". */
151
147
  export function planExpectsServing(planText) {
152
148
  if (!planText)
153
149
  return null;
@@ -182,8 +178,8 @@ export function opaqueLauncher(cwd) {
182
178
  return null;
183
179
  }
184
180
  // The tree walk, the caps, the skip sets and the comment strip live in
185
- // task/shipped-source.ts this scan and artifact-closure's were the same walker
186
- // written twice, and their skip sets had drifted apart on `bench`/`benchmarks`.
181
+ // task/shipped-source.ts, shared with artifact-closure's scan so the two cannot
182
+ // drift apart on which directories they skip.
187
183
  const scanCandidates = (cwd) => shippedSources(cwd, { ext: SOURCE_JS_RE });
188
184
  /** A `/…/flags` literal whose body carries a regex METACHARACTER — `[`, `\`, `+`,
189
185
  * `?`, `|`, a group. A path string like `'/api/admin'` has none, so it survives. */
@@ -192,10 +188,11 @@ const METACHAR_RE = /[\\[\]+*?^$|(){}]/;
192
188
  /**
193
189
  * Blank out regex literals. A project that MATCHES on `new Hono` — a linter, a
194
190
  * codemod, this very module — does not construct one, and a source scanner that
195
- * cannot tell the two apart reports every detector as an app (pi-task scanned
196
- * itself and found "9 server apps", all of them pattern tables). Only literals
197
- * carrying a metacharacter are stripped, so `'/api/v1'` is untouched, and because
198
- * stripping can only REMOVE matches it is safe in the FP direction by construction.
191
+ * cannot tell the two apart reports every detector as an app. With this in place
192
+ * `scanServeEntry` finds ZERO apps in pi-task's own tree, whose pattern tables name
193
+ * every construct it looks for. Only literals carrying a metacharacter are
194
+ * stripped, so `'/api/v1'` is untouched, and because stripping can only REMOVE
195
+ * matches it is safe in the FP direction by construction.
199
196
  */
200
197
  function stripRegexLiterals(src) {
201
198
  return src.replace(REGEX_LITERAL_RE, (whole, body) => METACHAR_RE.test(body) ? ' ' : whole);
@@ -5,8 +5,10 @@ export function formatServiceBlock(name, fullQuery, results) {
5
5
  const bullets = results.map(r => `- **${r.title}** — ${r.url}\n ${r.description}`).join('\n');
6
6
  return `${header}\n${bullets}`;
7
7
  }
8
- // Only the brave provider can be unconfigured (exa/ddg are keyless), so the
9
- // skip reason names its missing key directly.
8
+ // Only brave can be unconfigured: `SEARCH_PROVIDER_KEY_ENV` (search-types.ts)
9
+ // lists no env var for exa or ddg, so `searchProviderKey` answers '' for them and
10
+ // the `no_key` result this block reports is unreachable. The reason therefore
11
+ // names brave's key outright rather than describing a generic misconfiguration.
10
12
  export function formatFreshnessSkippedBlock(names) {
11
13
  return `### freshness-check skipped\nCould not verify external services (search provider is brave but BRAVE_SEARCH_API_KEY is not set):\n${names.map(n => `- ${n}`).join('\n')}`;
12
14
  }
@@ -1,35 +1,17 @@
1
1
  /**
2
- * What counts as SHIPPED SOURCE — the input every run-level closure scan reads.
2
+ * What counts as SHIPPED SOURCE — the input the run-level closure scans read.
3
3
  *
4
- * `CLOSURE_SCANS` (final-gate.ts) deepened the DRIVER of these scans: the fault
5
- * isolation, the rank, the stage. It did not unify their INPUT, and the copies
6
- * had drifted.
4
+ * ONE walker, ONE skip set, ONE extension regex, ONE comment strip, shared by
5
+ * `serve-entry.ts` and `artifact-closure.ts`. Two copies of this drift: a skip set
6
+ * that gains a directory on one side makes a file a run-level finding for one scan
7
+ * while the sibling scan cannot see it at all, and nothing in either file would say
8
+ * so.
7
9
  *
8
- * - `scanCandidates` existed twice, near-byte-identical`serve-entry.ts` and
9
- * `artifact-closure.ts` same `readdirSync().sort()` `statSync` recurse,
10
- * same 3000-file cap, same 400 KB per-file cap, same dot-dir rule.
11
- * - The skip sets had diverged: serve-entry carried `bench|benchmarks` and
12
- * `*.bench.*`; artifact-closure did not, so a dangling artifact reference in a
13
- * benchmark file was a run-level finding while the same file was invisible to
14
- * the sibling scan. Nothing in either file acknowledged the other.
15
- * - The same extension regex was declared twice under two names (`SCAN_RE`,
16
- * `SCAN_JS_RE`), and `stripCommentLines` was byte-identical in both.
17
- * - `.pi-tasks` was hardcoded into both skip sets rather than derived from
18
- * `TASKS_DIR_NAME`.
19
- *
20
- * The locality proof is in the suites: `artifact-closure.test.ts` has 28
21
- * references to the pure extractors and 5 calls to the driver, and NO test in the
22
- * cluster asserted a skip set at all. That is the shape recorded under
23
- * `resolveTypeSource` — pure functions extracted for testability while the real
24
- * logic stayed in how they are CALLED.
25
- *
26
- * NOT unified here: `env-template-closure.ts`. It asks a different question —
27
- * which TRACKED files could read an env var, including `.py`/`.go`, including
28
- * tests — and answering it over this walk would silently change which env
29
- * findings a run produces. Its comment rule is not this one either: it is a
30
- * per-line predicate that also treats `#` as a comment opener, which it must,
31
- * and which would be wrong for JS/TS. Recorded as a real divergence rather than
32
- * harmonised; changing it is an env-policy change with its own A/B.
10
+ * NOT unified here: `env-template-closure.ts`. It asks a different question which
11
+ * TRACKED files could read an env var, `.py` and `.go` included, tests included —
12
+ * and answering it over this walk would silently change which env findings a run
13
+ * produces. Its comment rule differs too: a per-line predicate that also treats `#`
14
+ * as an opener, which it must, and which would be wrong for JS/TS.
33
15
  */
34
16
  /** Authored JS/TS. The one declaration — it was two constants under two names. */
35
17
  export declare const SOURCE_JS_RE: RegExp;
@@ -1,35 +1,17 @@
1
1
  /**
2
- * What counts as SHIPPED SOURCE — the input every run-level closure scan reads.
2
+ * What counts as SHIPPED SOURCE — the input the run-level closure scans read.
3
3
  *
4
- * `CLOSURE_SCANS` (final-gate.ts) deepened the DRIVER of these scans: the fault
5
- * isolation, the rank, the stage. It did not unify their INPUT, and the copies
6
- * had drifted.
4
+ * ONE walker, ONE skip set, ONE extension regex, ONE comment strip, shared by
5
+ * `serve-entry.ts` and `artifact-closure.ts`. Two copies of this drift: a skip set
6
+ * that gains a directory on one side makes a file a run-level finding for one scan
7
+ * while the sibling scan cannot see it at all, and nothing in either file would say
8
+ * so.
7
9
  *
8
- * - `scanCandidates` existed twice, near-byte-identical`serve-entry.ts` and
9
- * `artifact-closure.ts` same `readdirSync().sort()` `statSync` recurse,
10
- * same 3000-file cap, same 400 KB per-file cap, same dot-dir rule.
11
- * - The skip sets had diverged: serve-entry carried `bench|benchmarks` and
12
- * `*.bench.*`; artifact-closure did not, so a dangling artifact reference in a
13
- * benchmark file was a run-level finding while the same file was invisible to
14
- * the sibling scan. Nothing in either file acknowledged the other.
15
- * - The same extension regex was declared twice under two names (`SCAN_RE`,
16
- * `SCAN_JS_RE`), and `stripCommentLines` was byte-identical in both.
17
- * - `.pi-tasks` was hardcoded into both skip sets rather than derived from
18
- * `TASKS_DIR_NAME`.
19
- *
20
- * The locality proof is in the suites: `artifact-closure.test.ts` has 28
21
- * references to the pure extractors and 5 calls to the driver, and NO test in the
22
- * cluster asserted a skip set at all. That is the shape recorded under
23
- * `resolveTypeSource` — pure functions extracted for testability while the real
24
- * logic stayed in how they are CALLED.
25
- *
26
- * NOT unified here: `env-template-closure.ts`. It asks a different question —
27
- * which TRACKED files could read an env var, including `.py`/`.go`, including
28
- * tests — and answering it over this walk would silently change which env
29
- * findings a run produces. Its comment rule is not this one either: it is a
30
- * per-line predicate that also treats `#` as a comment opener, which it must,
31
- * and which would be wrong for JS/TS. Recorded as a real divergence rather than
32
- * harmonised; changing it is an env-policy change with its own A/B.
10
+ * NOT unified here: `env-template-closure.ts`. It asks a different question which
11
+ * TRACKED files could read an env var, `.py` and `.go` included, tests included —
12
+ * and answering it over this walk would silently change which env findings a run
13
+ * produces. Its comment rule differs too: a per-line predicate that also treats `#`
14
+ * as an opener, which it must, and which would be wrong for JS/TS.
33
15
  */
34
16
  import { readdirSync, statSync } from 'node:fs';
35
17
  import * as path from 'node:path';
@@ -1,22 +1,18 @@
1
1
  /**
2
- * Deterministic skip-escape scanner for authored VERIFY blocks (run-8 F2).
2
+ * Deterministic skip-escape scanner for authored VERIFY blocks.
3
3
  *
4
4
  * A skip-escape is a `||` fallback that lets a REQUIRED check pass SILENTLY when
5
5
  * its tool is absent or it fails — e.g. `playwright test … || echo "skipping"`.
6
- * mx5 run-8 shipped a blank/dead app partly because its only behavioral smoke
7
- * tests were wrapped this way: the tool was absent, the check silently skipped,
8
- * and the verify child blessed it as "correctly skipped".
6
+ * A spec whose only behavioural check is wrapped that way passes its gate on a
7
+ * machine without the tool, and the verify child reads it as "correctly skipped".
9
8
  *
10
- * FP-MEASURED on the historical VERIFY blocks (~/hub/mx5/.pi-tasks, 22 tasks): a
11
- * blanket `|| true` flag is ~90% false positives teardown (`kill … || true`,
12
- * `docker compose down … || true`), setup (`… install || true`), and negative
13
- * tests (`… && exit 1 || true`, where `|| true` catches an EXPECTED failure). Of
14
- * 45 `||` uses, exactly one was the real F2 skip-escape, and it ANNOUNCED the skip
15
- * ("Playwright not available skipping browser smoke test"). So the crisp,
16
- * ~zero-FP signal is a fallback whose text ADMITS it is dodging the check — that is
17
- * the actionable finding here. Bare `|| true` is left to the verify child's runtime
18
- * rule 5c, which can actually observe whether the check ran (a static scan cannot
19
- * tell a required-check `|| true` from a teardown `|| true`).
9
+ * Flagging every `|| true` would be almost all false positives: teardown
10
+ * (`kill || true`, `docker compose down || true`), setup (`… install
11
+ * … || true`) and negative tests (`… && exit 1 || true`, where `|| true` catches
12
+ * an EXPECTED failure) are all legitimate, and a static scan cannot tell a
13
+ * required-check `|| true` from a teardown one. The crisp signal is narrower: a
14
+ * fallback whose TEXT admits it is dodging the check. Bare `|| true` is left to
15
+ * the verify child's runtime rule 5c, which can observe whether the check ran.
20
16
  *
21
17
  * Pure shell-shape / text analysis; no stack or tool-name assumptions.
22
18
  */
@@ -1,60 +1,28 @@
1
1
  /**
2
- * PROMPT 4 / F-2(b) — the design document's own cited URLs, ranked as fetch candidates for
3
- * the APIS research worker.
2
+ * The design document's own cited URLs, ranked as fetch candidates for the APIS
3
+ * research worker.
4
4
  *
5
- * THE FACT THIS CLOSES. mx5's DESIGN/PROJECT.md is a literal reference list: §5 line 184
6
- * cites https://hono.dev/docs/guides/rpc and §13 lists four hono.dev URLs plus
7
- * https://bun.com/docs/runtime/sql. Neither of the two pages that document the semantics
8
- * behind run 15's two fatal defects was ever fetched worker:apis' 6 distinct fetches went
9
- * to bun.com/reference/*, tailwindcss.com/* and nothing on hono.dev at all. Measured
10
- * afterwards (scripts/spec-url-reach.ts): 31 of 44 tasks asked pi-worker-docs about a package
11
- * for which the design cites a page, 215 (task, URL) pairs, and 15 of the 17 reachable cited
12
- * URLs were never fetched by anyone. The pages were named, in the project's own spec, and the
13
- * worker went looking somewhere else.
5
+ * A design that names its references by URL has already chosen which pages
6
+ * document the packages it uses. Nothing makes a research worker prefer them: it
7
+ * searches, and lands wherever the search lands. This module extracts the cited
8
+ * URLs, keeps the ones documenting a package THIS task touches, and renders them
9
+ * as a ranked prompt block.
14
10
  *
15
- * WHY THIS IS A POPULATION LEVER AND THE TYPE-ONLY GUARD WAS NOT. PROMPT 2's detector fires
16
- * on 0.54% of docs answers (9/1680 live) because it has to RECOGNISE something about an
17
- * answer. This one recognises nothing: the URLs are already sitting in the spec text, so its
18
- * reach is "every task whose design cites a page for a package the task uses" — the 31/44
19
- * above, measured before any of this was written.
11
+ * RANKING, NOT REPLACING. The block says the cited pages outrank a page the model
12
+ * would pick itself, and says in terms that they are not the only pages it may
13
+ * fetch. A worker that can no longer follow a question off the design's reference
14
+ * list has been narrowed, not improved.
20
15
  *
21
- * RANKING, NOT REPLACING. The block says the cited pages outrank a page the model would pick
22
- * itself, and says in terms that they are not the only pages it may fetch. A worker that can
23
- * no longer follow a question off the design's reference list has been narrowed, not
24
- * improved; PROMPT 4 invariant 3 asserts that explicitly in the A/B.
25
- *
26
- * ── *** NOT WIRED. THE LIVE A/B FAILED. READ THIS BEFORE RE-ENABLING IT. *** ─────────────
27
- *
28
- * scripts/live-spec-url-fetch-ab.ts, 2026-07-22, 40 reps, both arms in one process, real
29
- * phaseResearch, offline fixture web, metric = WHICH URL WAS FETCHED at the tool layer:
30
- *
31
- * task27-hono baseline 2/10 treatment 3/10 Fisher one-tailed p = 0.50
32
- * task28-wouter baseline 0/10 treatment 0/10 p = 1.00
33
- * POOLED baseline 2/20 treatment 3/20 p = 0.50
34
- *
35
- * Everything that could have made that a false negative was ruled out, not assumed:
36
- * - the surgery held in every rep (baseline block 0 chars 20/20, treatment non-empty 20/20);
37
- * - a positive control proved a real child can reach the stubbed pi-worker-fetch;
38
- * - the block was proven to REACH the APIS prompt, not merely to be built — the prompt is
39
- * 19,473 chars and ends with the six ranked URLs
40
- * (scripts/spec-url-prompt-delivery-check.ts).
41
- * So the model reads the instruction and does not act on it.
42
- *
43
- * AND THE PREMISE ITSELF DID NOT SURVIVE. PROMPT 4 rests on run 15 having fetched the WRONG
44
- * pages. Across all 40 reps the only URL any worker ever fetched, in either arm, was
45
- * https://hono.dev/docs/guides/rpc — the cited one. The worker does not choose badly between
46
- * pages; it almost never fetches at all (5 of 40 reps). A lever that improves URL RANKING is
47
- * aimed at a decision this worker rarely makes.
48
- *
49
- * The module is kept — deterministic, unit-tested against the real run-15 design text, and
50
- * the A/B harness's string surgery targets it — so the experiment can be re-run cheaply if
51
- * the fetch rate itself is ever moved. It is NOT called from phases.ts, deliberately.
16
+ * NOT WIRED. `buildSpecUrlBlock` has no production caller phases.ts says so at
17
+ * the site where it would go. The module is kept deterministic and unit-tested
18
+ * against real design text so the experiment can be re-run cheaply, but nothing in
19
+ * a run reads it today.
52
20
  */
53
21
  /**
54
- * How many cited pages the block may name. The design cites 21 URLs; listing all of them in
55
- * every APIS prompt would be prefill spent on pages the task has no use for, and a list long
56
- * enough to skim past is a list the model ignores. Eight is above the highest per-task
57
- * reachable count measured on run 15 (5 hono.dev pages for a hono task) with headroom.
22
+ * How many cited pages the block may name. A design's whole reference list, repeated in
23
+ * every APIS prompt, is prefill spent on pages the task has no use for, and a list long
24
+ * enough to skim past is a list the model ignores. The ranking already drops every URL
25
+ * documenting nothing this task touches, so this only bounds a task that touches a lot.
58
26
  */
59
27
  export declare const MAX_SPEC_URLS = 8;
60
28
  /** http(s) URLs in a text, deduped, with local and placeholder hosts dropped. */
@@ -72,7 +40,7 @@ export declare function packageTokens(pkg: string): string[];
72
40
  * Does this cited URL document this package? Host OR path, deliberately: wouter's page is
73
41
  * github.com/molefrog/wouter#readme and @hono/zod-validator's is
74
42
  * github.com/honojs/middleware/tree/main/packages/zod-validator — both real associations that
75
- * live in the path. A host-only rule scored 0 tasks for either.
43
+ * live in the path, and a host-only rule matches neither.
76
44
  */
77
45
  export declare function urlDocumentsPackage(url: string, pkg: string): boolean;
78
46
  export interface RankedSpecUrl {
@@ -92,24 +60,17 @@ export interface RankedSpecUrl {
92
60
  export declare function rankSpecUrls(urls: string[], packages: string[]): RankedSpecUrl[];
93
61
  /**
94
62
  * The prompt block, or '' when nothing is cited for anything this task uses.
95
- *
96
- * NOTE FOR ANYONE EDITING THE GUARD CLAUSE BELOW: scripts/live-spec-url-fetch-ab.ts strips
97
- * this lever for its baseline arm by replacing that exact statement in the compiled output,
98
- * and asserts it occurs exactly once. Reshaping it (an early `return` on the caller's side, a
99
- * ternary, a different variable name) silently makes both arms identical, which reads as
100
- * "the lever had no effect". Update the harness's anchor in the same commit.
101
63
  */
102
64
  export declare function buildSpecUrlBlock(urls: string[], packages: string[]): string;
103
65
  /**
104
66
  * The manifest dependencies this task's refined text actually names — the relevance signal
105
- * the ranking needs, and the reason the block does not simply list all 21 cited URLs.
67
+ * the ranking needs, and the reason the block does not simply list every cited URL.
106
68
  *
107
- * WHY NOT extractEnrichTargets. That parser is tuned for the EXTERNAL-DEPENDENCIES section
108
- * and, run over TASK_0027's refined text, returns ["any", "api", "hc", "package.json",
109
- * "tsconfig.json", "eslint.config.js"] and NOT "hono". Ranking off that would drop the one
110
- * package the task is about while promoting URL noise. The manifest is the authoritative list
111
- * of what the project actually depends on; matching it against the task text is both
112
- * deterministic and impossible to fool with prose.
69
+ * WHY NOT extractEnrichTargets (enrichment.ts). That parser is tuned for the
70
+ * EXTERNAL-DEPENDENCIES section, so over an ordinary refined text it returns whatever
71
+ * identifiers and config filenames the prose mentions rather than the packages the task is
72
+ * about. The manifest is the authoritative list of what the project actually depends on;
73
+ * matching it against the task text is deterministic and cannot be fooled by prose.
113
74
  *
114
75
  * Word-boundary matched, so `react` does not match inside `react-dom` or `@types/react`, and
115
76
  * a package genuinely named twice is still listed once.
@@ -1,63 +1,31 @@
1
1
  /**
2
- * PROMPT 4 / F-2(b) — the design document's own cited URLs, ranked as fetch candidates for
3
- * the APIS research worker.
2
+ * The design document's own cited URLs, ranked as fetch candidates for the APIS
3
+ * research worker.
4
4
  *
5
- * THE FACT THIS CLOSES. mx5's DESIGN/PROJECT.md is a literal reference list: §5 line 184
6
- * cites https://hono.dev/docs/guides/rpc and §13 lists four hono.dev URLs plus
7
- * https://bun.com/docs/runtime/sql. Neither of the two pages that document the semantics
8
- * behind run 15's two fatal defects was ever fetched worker:apis' 6 distinct fetches went
9
- * to bun.com/reference/*, tailwindcss.com/* and nothing on hono.dev at all. Measured
10
- * afterwards (scripts/spec-url-reach.ts): 31 of 44 tasks asked pi-worker-docs about a package
11
- * for which the design cites a page, 215 (task, URL) pairs, and 15 of the 17 reachable cited
12
- * URLs were never fetched by anyone. The pages were named, in the project's own spec, and the
13
- * worker went looking somewhere else.
5
+ * A design that names its references by URL has already chosen which pages
6
+ * document the packages it uses. Nothing makes a research worker prefer them: it
7
+ * searches, and lands wherever the search lands. This module extracts the cited
8
+ * URLs, keeps the ones documenting a package THIS task touches, and renders them
9
+ * as a ranked prompt block.
14
10
  *
15
- * WHY THIS IS A POPULATION LEVER AND THE TYPE-ONLY GUARD WAS NOT. PROMPT 2's detector fires
16
- * on 0.54% of docs answers (9/1680 live) because it has to RECOGNISE something about an
17
- * answer. This one recognises nothing: the URLs are already sitting in the spec text, so its
18
- * reach is "every task whose design cites a page for a package the task uses" — the 31/44
19
- * above, measured before any of this was written.
11
+ * RANKING, NOT REPLACING. The block says the cited pages outrank a page the model
12
+ * would pick itself, and says in terms that they are not the only pages it may
13
+ * fetch. A worker that can no longer follow a question off the design's reference
14
+ * list has been narrowed, not improved.
20
15
  *
21
- * RANKING, NOT REPLACING. The block says the cited pages outrank a page the model would pick
22
- * itself, and says in terms that they are not the only pages it may fetch. A worker that can
23
- * no longer follow a question off the design's reference list has been narrowed, not
24
- * improved; PROMPT 4 invariant 3 asserts that explicitly in the A/B.
25
- *
26
- * ── *** NOT WIRED. THE LIVE A/B FAILED. READ THIS BEFORE RE-ENABLING IT. *** ─────────────
27
- *
28
- * scripts/live-spec-url-fetch-ab.ts, 2026-07-22, 40 reps, both arms in one process, real
29
- * phaseResearch, offline fixture web, metric = WHICH URL WAS FETCHED at the tool layer:
30
- *
31
- * task27-hono baseline 2/10 treatment 3/10 Fisher one-tailed p = 0.50
32
- * task28-wouter baseline 0/10 treatment 0/10 p = 1.00
33
- * POOLED baseline 2/20 treatment 3/20 p = 0.50
34
- *
35
- * Everything that could have made that a false negative was ruled out, not assumed:
36
- * - the surgery held in every rep (baseline block 0 chars 20/20, treatment non-empty 20/20);
37
- * - a positive control proved a real child can reach the stubbed pi-worker-fetch;
38
- * - the block was proven to REACH the APIS prompt, not merely to be built — the prompt is
39
- * 19,473 chars and ends with the six ranked URLs
40
- * (scripts/spec-url-prompt-delivery-check.ts).
41
- * So the model reads the instruction and does not act on it.
42
- *
43
- * AND THE PREMISE ITSELF DID NOT SURVIVE. PROMPT 4 rests on run 15 having fetched the WRONG
44
- * pages. Across all 40 reps the only URL any worker ever fetched, in either arm, was
45
- * https://hono.dev/docs/guides/rpc — the cited one. The worker does not choose badly between
46
- * pages; it almost never fetches at all (5 of 40 reps). A lever that improves URL RANKING is
47
- * aimed at a decision this worker rarely makes.
48
- *
49
- * The module is kept — deterministic, unit-tested against the real run-15 design text, and
50
- * the A/B harness's string surgery targets it — so the experiment can be re-run cheaply if
51
- * the fetch rate itself is ever moved. It is NOT called from phases.ts, deliberately.
16
+ * NOT WIRED. `buildSpecUrlBlock` has no production caller phases.ts says so at
17
+ * the site where it would go. The module is kept deterministic and unit-tested
18
+ * against real design text so the experiment can be re-run cheaply, but nothing in
19
+ * a run reads it today.
52
20
  */
53
21
  /** Never candidates: a local dev URL is not documentation. */
54
22
  const LOCAL_HOST = /^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|.*\.local)$/i;
55
23
  const PLACEHOLDER_HOST = /^(example\.(com|org|net)|your-.*|<.*)$/i;
56
24
  /**
57
- * How many cited pages the block may name. The design cites 21 URLs; listing all of them in
58
- * every APIS prompt would be prefill spent on pages the task has no use for, and a list long
59
- * enough to skim past is a list the model ignores. Eight is above the highest per-task
60
- * reachable count measured on run 15 (5 hono.dev pages for a hono task) with headroom.
25
+ * How many cited pages the block may name. A design's whole reference list, repeated in
26
+ * every APIS prompt, is prefill spent on pages the task has no use for, and a list long
27
+ * enough to skim past is a list the model ignores. The ranking already drops every URL
28
+ * documenting nothing this task touches, so this only bounds a task that touches a lot.
61
29
  */
62
30
  export const MAX_SPEC_URLS = 8;
63
31
  /** http(s) URLs in a text, deduped, with local and placeholder hosts dropped. */
@@ -110,7 +78,7 @@ export function packageTokens(pkg) {
110
78
  * Does this cited URL document this package? Host OR path, deliberately: wouter's page is
111
79
  * github.com/molefrog/wouter#readme and @hono/zod-validator's is
112
80
  * github.com/honojs/middleware/tree/main/packages/zod-validator — both real associations that
113
- * live in the path. A host-only rule scored 0 tasks for either.
81
+ * live in the path, and a host-only rule matches neither.
114
82
  */
115
83
  export function urlDocumentsPackage(url, pkg) {
116
84
  const toks = packageTokens(pkg);
@@ -152,12 +120,6 @@ export function rankSpecUrls(urls, packages) {
152
120
  }
153
121
  /**
154
122
  * The prompt block, or '' when nothing is cited for anything this task uses.
155
- *
156
- * NOTE FOR ANYONE EDITING THE GUARD CLAUSE BELOW: scripts/live-spec-url-fetch-ab.ts strips
157
- * this lever for its baseline arm by replacing that exact statement in the compiled output,
158
- * and asserts it occurs exactly once. Reshaping it (an early `return` on the caller's side, a
159
- * ternary, a different variable name) silently makes both arms identical, which reads as
160
- * "the lever had no effect". Update the harness's anchor in the same commit.
161
123
  */
162
124
  export function buildSpecUrlBlock(urls, packages) {
163
125
  const ranked = rankSpecUrls(urls, packages);
@@ -189,14 +151,13 @@ export function buildSpecUrlBlock(urls, packages) {
189
151
  }
190
152
  /**
191
153
  * The manifest dependencies this task's refined text actually names — the relevance signal
192
- * the ranking needs, and the reason the block does not simply list all 21 cited URLs.
154
+ * the ranking needs, and the reason the block does not simply list every cited URL.
193
155
  *
194
- * WHY NOT extractEnrichTargets. That parser is tuned for the EXTERNAL-DEPENDENCIES section
195
- * and, run over TASK_0027's refined text, returns ["any", "api", "hc", "package.json",
196
- * "tsconfig.json", "eslint.config.js"] and NOT "hono". Ranking off that would drop the one
197
- * package the task is about while promoting URL noise. The manifest is the authoritative list
198
- * of what the project actually depends on; matching it against the task text is both
199
- * deterministic and impossible to fool with prose.
156
+ * WHY NOT extractEnrichTargets (enrichment.ts). That parser is tuned for the
157
+ * EXTERNAL-DEPENDENCIES section, so over an ordinary refined text it returns whatever
158
+ * identifiers and config filenames the prose mentions rather than the packages the task is
159
+ * about. The manifest is the authoritative list of what the project actually depends on;
160
+ * matching it against the task text is deterministic and cannot be fooled by prose.
200
161
  *
201
162
  * Word-boundary matched, so `react` does not match inside `react-dom` or `@types/react`, and
202
163
  * a package genuinely named twice is still listed once.
@@ -13,15 +13,15 @@ export declare function parseVerifyBlock(spec: string): VerifyCommand[] | null;
13
13
  /**
14
14
  * parseVerifyBlock, but only when the fenced block is actually CLOSED.
15
15
  *
16
- * An unterminated fence makes the lenient parser swallow the rest of the file:
17
- * mx5 run 19's `TASK_0001.md` opens ```sh and never closes it, so its "VERIFY
18
- * commands" include the phase-timings table and every appended gate-trail line.
16
+ * An unterminated fence makes the lenient parser swallow the rest of the file: a
17
+ * task file that opens ```sh and never closes it yields "VERIFY commands" that
18
+ * include every line appended after the spec — a timings table, a gate-trail line.
19
19
  * That is harmless where the parser only asks "is there something runnable here",
20
- * and NOT harmless where a parsed line is treated as provenance a debt reason
21
- * quoting `bun run lint` would match a gate-trail sentence and mint a stored,
20
+ * and NOT harmless where a parsed line is treated as PROVENANCE: a debt reason
21
+ * quoting `bun run lint` would then match a trail sentence and mint a stored,
22
22
  * re-runnable command the spec never asked for (accept-debt.ts
23
- * verifyCommandFromReason, `inv-command-provenance`). Callers that need the block
24
- * to MEAN something use this one: an unclosed fence is no block at all.
23
+ * `verifyCommandFromReason`, `inv-command-provenance`). Callers that need the
24
+ * block to MEAN something use this one: an unclosed fence is no block at all.
25
25
  */
26
26
  export declare function parseVerifyBlockStrict(spec: string): VerifyCommand[] | null;
27
27
  export declare function isCritiqueClean(text: string): boolean;
@@ -40,24 +40,21 @@ export declare const REFINE_SECTIONS: readonly ["GOAL", "CONSTRAINTS", "KNOWN-UN
40
40
  /**
41
41
  * Is a refine child's output shaped like a refined prompt?
42
42
  *
43
- * Refine shipped with NO shape check at all `phaseRefine` passes no validator,
44
- * unlike compose and critique and every downstream reader of a refined prompt
45
- * is a PARTIAL parser that tolerates a missing section SILENTLY:
46
- * `extractCapsSection` (refuted-constraint.ts) returns null, `scopedToolingGoal`
47
- * (phases.ts) returns the whole text, `deriveTitle` and `extractEnrichTargets`
48
- * fall back. So a refine answer that dropped a heading degrades four features at
49
- * once and says nothing. This names the contract in one place.
43
+ * Every downstream reader of a refined prompt is a PARTIAL parser that tolerates a
44
+ * missing section SILENTLY: `extractCapsSection` (refuted-constraint.ts) returns
45
+ * null, `scopedToolingGoal` (phases.ts) returns the whole text, and `deriveTitle`
46
+ * (parsers.ts) and `extractEnrichTargets` (enrichment.ts) fall back. So a refine
47
+ * answer that dropped a heading degrades four features at once and says nothing.
48
+ * This names the contract in one place; phases.ts calls it after refine.
50
49
  *
51
50
  * WHAT IT CHECKS, and why it is only this. Every one of those consumers looks
52
51
  * for a BARE ALL-CAPS heading alone on its own line — `l.trim() === heading`,
53
52
  * `/^GOAL[ \t]*\n/m`. That is the operative contract, so that is the test.
54
53
  *
55
- * It does NOT require the text to START with GOAL, even though REFINE_PROMPT
56
- * says "four sections, exact headings, in this order" and forbids a preamble.
57
- * Measured over the 57-task mx5 corpus: 55/56 non-empty refined prompts carry
58
- * all four bare headings, but only 25/56 open with one a preamble is what real
59
- * refine output usually looks like, and production has always consumed it fine.
60
- * A validator stricter than its consumers would reject work that works.
54
+ * It does NOT require the text to START with GOAL, even though REFINE_PROMPT asks
55
+ * for the four headings in order and forbids a preamble. None of the four
56
+ * consumers above cares where the heading sits, so a validator that did would
57
+ * reject work every one of them handles.
61
58
  *
62
59
  * Returns a problem string, or null when the shape is good — same contract as
63
60
  * `validateSpecShape` above.