@mjasnikovs/pi-task 0.38.28 → 0.38.30

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 (370) 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/remote/bridge.d.ts +19 -10
  14. package/dist/remote/bridge.js +3 -2
  15. package/dist/remote/broadcast.js +3 -1
  16. package/dist/remote/events.js +12 -11
  17. package/dist/remote/history.d.ts +1 -1
  18. package/dist/remote/protocol.d.ts +6 -3
  19. package/dist/remote/protocol.js +2 -1
  20. package/dist/remote/push.d.ts +16 -16
  21. package/dist/remote/push.js +27 -27
  22. package/dist/remote/register.d.ts +3 -3
  23. package/dist/remote/register.js +17 -19
  24. package/dist/remote/server.d.ts +9 -8
  25. package/dist/remote/server.js +15 -14
  26. package/dist/remote/session-state.d.ts +5 -4
  27. package/dist/remote/session-state.js +8 -5
  28. package/dist/remote/sw.d.ts +7 -6
  29. package/dist/remote/sw.js +7 -6
  30. package/dist/remote/tailscale.d.ts +4 -2
  31. package/dist/remote/tailscale.js +4 -2
  32. package/dist/remote/ui-highlight.js +6 -5
  33. package/dist/remote/ui-render.js +4 -4
  34. package/dist/remote/ui-script.js +24 -24
  35. package/dist/remote/ui-styles.d.ts +1 -1
  36. package/dist/remote/ui-styles.js +10 -13
  37. package/dist/remote/ui-tools.js +9 -6
  38. package/dist/shared/child-extensions.d.ts +29 -17
  39. package/dist/shared/child-extensions.js +29 -17
  40. package/dist/shared/child-output.d.ts +30 -24
  41. package/dist/shared/child-output.js +25 -17
  42. package/dist/shared/child-process.d.ts +47 -40
  43. package/dist/shared/child-process.js +50 -59
  44. package/dist/shared/command-watchdog.d.ts +22 -16
  45. package/dist/shared/command-watchdog.js +28 -21
  46. package/dist/shared/fs-text.d.ts +16 -10
  47. package/dist/shared/fs-text.js +16 -10
  48. package/dist/shared/git-runner.d.ts +25 -25
  49. package/dist/shared/git-runner.js +25 -25
  50. package/dist/shared/leaked-tool-call.d.ts +17 -11
  51. package/dist/shared/leaked-tool-call.js +23 -15
  52. package/dist/shared/model-endpoint.d.ts +29 -16
  53. package/dist/shared/model-endpoint.js +33 -21
  54. package/dist/shared/pi-invocation.d.ts +7 -4
  55. package/dist/shared/pi-invocation.js +12 -7
  56. package/dist/shared/pkg-version.d.ts +13 -5
  57. package/dist/shared/pkg-version.js +13 -5
  58. package/dist/shared/reasoning-capability.d.ts +35 -24
  59. package/dist/shared/reasoning-capability.js +35 -24
  60. package/dist/shared/stream-watchdog.d.ts +60 -44
  61. package/dist/shared/stream-watchdog.js +62 -45
  62. package/dist/task/accept-debt.d.ts +41 -43
  63. package/dist/task/accept-debt.js +73 -65
  64. package/dist/task/api-synthesis.d.ts +24 -21
  65. package/dist/task/api-synthesis.js +32 -26
  66. package/dist/task/apis-contract.d.ts +32 -64
  67. package/dist/task/apis-contract.js +32 -64
  68. package/dist/task/artifact-closure.d.ts +27 -13
  69. package/dist/task/artifact-closure.js +95 -67
  70. package/dist/task/auto-commit.d.ts +46 -35
  71. package/dist/task/auto-commit.js +51 -38
  72. package/dist/task/auto-io.d.ts +45 -25
  73. package/dist/task/auto-io.js +57 -29
  74. package/dist/task/auto-orchestrator.d.ts +26 -24
  75. package/dist/task/auto-orchestrator.js +178 -162
  76. package/dist/task/auto-prompts.d.ts +36 -24
  77. package/dist/task/auto-prompts.js +40 -26
  78. package/dist/task/autofix-ledger.d.ts +27 -25
  79. package/dist/task/autofix-ledger.js +29 -26
  80. package/dist/task/batch-test-task.d.ts +20 -12
  81. package/dist/task/batch-test-task.js +67 -60
  82. package/dist/task/boot-probe.d.ts +60 -44
  83. package/dist/task/boot-probe.js +91 -72
  84. package/dist/task/cancel-input.d.ts +30 -16
  85. package/dist/task/cancel-input.js +20 -11
  86. package/dist/task/cancel-points.d.ts +27 -20
  87. package/dist/task/cancel-points.js +30 -22
  88. package/dist/task/child-runner.d.ts +46 -51
  89. package/dist/task/child-runner.js +48 -49
  90. package/dist/task/child-status.d.ts +23 -16
  91. package/dist/task/child-status.js +23 -16
  92. package/dist/task/clamp-output.js +12 -5
  93. package/dist/task/command-run.d.ts +31 -28
  94. package/dist/task/command-run.js +44 -35
  95. package/dist/task/command-shrink.d.ts +25 -18
  96. package/dist/task/command-shrink.js +37 -31
  97. package/dist/task/command-watchdog.d.ts +9 -6
  98. package/dist/task/command-watchdog.js +21 -15
  99. package/dist/task/context-attribution.d.ts +34 -26
  100. package/dist/task/context-attribution.js +34 -26
  101. package/dist/task/context-silence.d.ts +39 -29
  102. package/dist/task/context-silence.js +35 -25
  103. package/dist/task/context-usage.d.ts +25 -7
  104. package/dist/task/context-usage.js +21 -6
  105. package/dist/task/contracts.d.ts +8 -4
  106. package/dist/task/contracts.js +25 -17
  107. package/dist/task/coverage-loop.d.ts +22 -18
  108. package/dist/task/coverage-loop.js +35 -30
  109. package/dist/task/critique-probes.d.ts +13 -14
  110. package/dist/task/critique-probes.js +50 -39
  111. package/dist/task/debug-log.d.ts +13 -5
  112. package/dist/task/debug-log.js +32 -20
  113. package/dist/task/decompose-fidelity.d.ts +11 -9
  114. package/dist/task/decompose-fidelity.js +38 -33
  115. package/dist/task/decompose-granularity.d.ts +41 -38
  116. package/dist/task/decompose-granularity.js +41 -38
  117. package/dist/task/deep-render-check.d.ts +22 -14
  118. package/dist/task/deep-render-check.js +40 -31
  119. package/dist/task/dropped-input.d.ts +12 -7
  120. package/dist/task/dropped-input.js +5 -2
  121. package/dist/task/enforce-attribution.d.ts +38 -47
  122. package/dist/task/enforce-attribution.js +46 -52
  123. package/dist/task/enforce-guidelines.d.ts +31 -20
  124. package/dist/task/enforce-guidelines.js +32 -21
  125. package/dist/task/enrichment.d.ts +7 -2
  126. package/dist/task/enrichment.js +26 -14
  127. package/dist/task/env-notes.d.ts +16 -7
  128. package/dist/task/env-notes.js +48 -31
  129. package/dist/task/env-template-closure.d.ts +4 -4
  130. package/dist/task/env-template-closure.js +42 -34
  131. package/dist/task/external-context.d.ts +28 -21
  132. package/dist/task/external-context.js +17 -12
  133. package/dist/task/failure-classifier.d.ts +4 -5
  134. package/dist/task/failure-classifier.js +6 -7
  135. package/dist/task/file-inventory.d.ts +15 -11
  136. package/dist/task/file-inventory.js +25 -22
  137. package/dist/task/final-gate-fix.d.ts +74 -86
  138. package/dist/task/final-gate-fix.js +97 -116
  139. package/dist/task/final-gate-progress.d.ts +29 -46
  140. package/dist/task/final-gate-progress.js +40 -51
  141. package/dist/task/final-gate.d.ts +64 -97
  142. package/dist/task/final-gate.js +192 -199
  143. package/dist/task/fix-child.d.ts +21 -27
  144. package/dist/task/fix-child.js +21 -27
  145. package/dist/task/foreign-path.d.ts +6 -5
  146. package/dist/task/foreign-path.js +0 -0
  147. package/dist/task/frozen-conflict.d.ts +9 -10
  148. package/dist/task/frozen-conflict.js +61 -64
  149. package/dist/task/frozen-path-guard.d.ts +35 -14
  150. package/dist/task/frozen-path-guard.js +56 -39
  151. package/dist/task/gate-child.d.ts +27 -28
  152. package/dist/task/gate-child.js +37 -35
  153. package/dist/task/gate-deps.d.ts +34 -27
  154. package/dist/task/gate-deps.js +169 -159
  155. package/dist/task/gate-tally.d.ts +77 -80
  156. package/dist/task/gate-tally.js +65 -68
  157. package/dist/task/git-state-guard.d.ts +15 -11
  158. package/dist/task/git-state-guard.js +76 -66
  159. package/dist/task/impl-widget.d.ts +25 -16
  160. package/dist/task/impl-widget.js +27 -17
  161. package/dist/task/implementation-thinking.d.ts +33 -31
  162. package/dist/task/implementation-thinking.js +5 -6
  163. package/dist/task/implementation-turn.d.ts +34 -31
  164. package/dist/task/implementation-turn.js +29 -27
  165. package/dist/task/inline-markdown.d.ts +20 -7
  166. package/dist/task/inline-markdown.js +15 -6
  167. package/dist/task/launch-config-gap.js +25 -39
  168. package/dist/task/launch-contract.d.ts +18 -21
  169. package/dist/task/launch-contract.js +28 -30
  170. package/dist/task/launch-manifest.d.ts +6 -2
  171. package/dist/task/launch-manifest.js +35 -34
  172. package/dist/task/ledger.js +16 -14
  173. package/dist/task/lint-fix.d.ts +6 -8
  174. package/dist/task/lint-fix.js +67 -69
  175. package/dist/task/loop-detector.d.ts +9 -8
  176. package/dist/task/loop-detector.js +16 -12
  177. package/dist/task/mid-run-input.d.ts +17 -15
  178. package/dist/task/mid-run-input.js +17 -15
  179. package/dist/task/orchestrator.d.ts +24 -28
  180. package/dist/task/orchestrator.js +62 -64
  181. package/dist/task/orientation.d.ts +18 -23
  182. package/dist/task/orientation.js +24 -31
  183. package/dist/task/owned-freeze-conflict.d.ts +21 -20
  184. package/dist/task/owned-freeze-conflict.js +52 -85
  185. package/dist/task/owned-freeze-reassign.d.ts +40 -60
  186. package/dist/task/owned-freeze-reassign.js +41 -61
  187. package/dist/task/parsers.d.ts +4 -2
  188. package/dist/task/parsers.js +4 -4
  189. package/dist/task/phases.d.ts +41 -48
  190. package/dist/task/phases.js +180 -248
  191. package/dist/task/plan-io.d.ts +6 -7
  192. package/dist/task/plan-io.js +6 -7
  193. package/dist/task/plan-orchestrator.d.ts +10 -8
  194. package/dist/task/plan-orchestrator.js +14 -10
  195. package/dist/task/plan-prompts.d.ts +6 -5
  196. package/dist/task/plan-prompts.js +6 -5
  197. package/dist/task/plan-readonly.d.ts +4 -5
  198. package/dist/task/plan-readonly.js +4 -5
  199. package/dist/task/plan-rounds.d.ts +17 -29
  200. package/dist/task/plan-rounds.js +21 -34
  201. package/dist/task/plan-session.d.ts +58 -72
  202. package/dist/task/plan-session.js +61 -83
  203. package/dist/task/probe-gaming.d.ts +28 -27
  204. package/dist/task/probe-gaming.js +0 -0
  205. package/dist/task/prohibition-probe.d.ts +14 -16
  206. package/dist/task/prompts.d.ts +3 -4
  207. package/dist/task/prompts.js +17 -26
  208. package/dist/task/qa-transcript.d.ts +15 -22
  209. package/dist/task/qa-transcript.js +15 -21
  210. package/dist/task/question-box.d.ts +17 -13
  211. package/dist/task/question-box.js +19 -15
  212. package/dist/task/question-dedup.d.ts +6 -7
  213. package/dist/task/question-dedup.js +13 -14
  214. package/dist/task/question-dialog.d.ts +22 -32
  215. package/dist/task/question-dialog.js +22 -32
  216. package/dist/task/question-source.d.ts +18 -44
  217. package/dist/task/question-source.js +22 -51
  218. package/dist/task/refuted-constraint.d.ts +11 -31
  219. package/dist/task/refuted-constraint.js +27 -51
  220. package/dist/task/regenerable-artifacts.d.ts +12 -31
  221. package/dist/task/regenerable-artifacts.js +12 -31
  222. package/dist/task/render-check.d.ts +11 -22
  223. package/dist/task/render-check.js +33 -46
  224. package/dist/task/repo-health-check.d.ts +10 -14
  225. package/dist/task/repo-health-check.js +17 -23
  226. package/dist/task/requirements.d.ts +38 -71
  227. package/dist/task/requirements.js +78 -126
  228. package/dist/task/research-fanout-budget.d.ts +51 -88
  229. package/dist/task/research-fanout-budget.js +51 -88
  230. package/dist/task/research-worker.d.ts +33 -36
  231. package/dist/task/research-worker.js +39 -61
  232. package/dist/task/resume-gap.d.ts +14 -15
  233. package/dist/task/root-cause-repair.d.ts +9 -9
  234. package/dist/task/root-cause-repair.js +28 -40
  235. package/dist/task/run-bracket.d.ts +10 -13
  236. package/dist/task/run-end.d.ts +12 -22
  237. package/dist/task/run-end.js +8 -16
  238. package/dist/task/run-final-gate.d.ts +19 -21
  239. package/dist/task/run-final-gate.js +62 -80
  240. package/dist/task/runner-globs.d.ts +12 -13
  241. package/dist/task/runner-globs.js +12 -13
  242. package/dist/task/runner-resolve.d.ts +9 -9
  243. package/dist/task/runner-resolve.js +22 -23
  244. package/dist/task/script-escape.d.ts +10 -12
  245. package/dist/task/script-escape.js +13 -14
  246. package/dist/task/serve-entry.d.ts +1 -1
  247. package/dist/task/serve-entry.js +22 -25
  248. package/dist/task/service-blocks.js +4 -2
  249. package/dist/task/shipped-source.d.ts +11 -29
  250. package/dist/task/shipped-source.js +11 -29
  251. package/dist/task/skip-escape.js +10 -14
  252. package/dist/task/spec-urls.d.ts +26 -65
  253. package/dist/task/spec-urls.js +26 -65
  254. package/dist/task/spec-validation.d.ts +17 -20
  255. package/dist/task/spec-validation.js +17 -20
  256. package/dist/task/stall-detector.d.ts +23 -30
  257. package/dist/task/stall-detector.js +23 -30
  258. package/dist/task/stream-watchdog.d.ts +14 -12
  259. package/dist/task/stream-watchdog.js +14 -12
  260. package/dist/task/substitution-probe.d.ts +17 -20
  261. package/dist/task/substitution-probe.js +17 -20
  262. package/dist/task/task-gates.d.ts +36 -41
  263. package/dist/task/task-gates.js +95 -106
  264. package/dist/task/task-io.d.ts +4 -4
  265. package/dist/task/task-io.js +4 -4
  266. package/dist/task/task-parsers.js +4 -3
  267. package/dist/task/task-provenance.d.ts +2 -2
  268. package/dist/task/task-provenance.js +11 -13
  269. package/dist/task/task-types.d.ts +4 -3
  270. package/dist/task/terminal-outcome.d.ts +14 -16
  271. package/dist/task/terminal-outcome.js +12 -14
  272. package/dist/task/test-assembly.d.ts +13 -20
  273. package/dist/task/test-assembly.js +13 -20
  274. package/dist/task/timings.d.ts +5 -3
  275. package/dist/task/timings.js +5 -3
  276. package/dist/task/title-label.d.ts +9 -4
  277. package/dist/task/title-label.js +9 -4
  278. package/dist/task/type-only-answer.d.ts +44 -52
  279. package/dist/task/type-only-answer.js +44 -52
  280. package/dist/task/unfailable-command.d.ts +18 -24
  281. package/dist/task/unfailable-command.js +21 -27
  282. package/dist/task/unknown-routing.d.ts +10 -4
  283. package/dist/task/unknown-routing.js +10 -4
  284. package/dist/task/user-directives.d.ts +5 -8
  285. package/dist/task/user-directives.js +5 -8
  286. package/dist/task/verify-quality.d.ts +18 -22
  287. package/dist/task/verify-quality.js +45 -46
  288. package/dist/task/verify-reconcile.d.ts +15 -10
  289. package/dist/task/verify-reconcile.js +45 -43
  290. package/dist/task/verify-resolution.d.ts +24 -20
  291. package/dist/task/verify-resolution.js +51 -50
  292. package/dist/task/verify-work.d.ts +59 -66
  293. package/dist/task/verify-work.js +101 -138
  294. package/dist/task/widget.d.ts +15 -14
  295. package/dist/task/widget.js +22 -17
  296. package/dist/task/wiring-claims.d.ts +25 -32
  297. package/dist/task/wiring-claims.js +30 -35
  298. package/dist/task/write-guard.d.ts +39 -39
  299. package/dist/task/write-guard.js +48 -51
  300. package/dist/task/yolo.d.ts +34 -30
  301. package/dist/task/yolo.js +42 -37
  302. package/dist/workers/abstention.d.ts +21 -41
  303. package/dist/workers/abstention.js +27 -48
  304. package/dist/workers/brave-search.d.ts +4 -3
  305. package/dist/workers/brave-search.js +5 -2
  306. package/dist/workers/brave-warning.d.ts +7 -4
  307. package/dist/workers/brave-warning.js +19 -7
  308. package/dist/workers/ddg-search.d.ts +6 -6
  309. package/dist/workers/ddg-search.js +18 -12
  310. package/dist/workers/docs-cache.js +5 -2
  311. package/dist/workers/docs-chunk.d.ts +30 -37
  312. package/dist/workers/docs-chunk.js +37 -41
  313. package/dist/workers/docs-core.d.ts +28 -44
  314. package/dist/workers/docs-core.js +25 -44
  315. package/dist/workers/docs-index.js +4 -3
  316. package/dist/workers/docs-lookup.d.ts +15 -22
  317. package/dist/workers/docs-lookup.js +12 -21
  318. package/dist/workers/docs-project.d.ts +15 -9
  319. package/dist/workers/docs-project.js +17 -10
  320. package/dist/workers/docs-resolve.d.ts +19 -20
  321. package/dist/workers/docs-resolve.js +35 -32
  322. package/dist/workers/docs-retrieve.d.ts +5 -6
  323. package/dist/workers/docs-retrieve.js +18 -15
  324. package/dist/workers/exa-search.d.ts +9 -6
  325. package/dist/workers/exa-search.js +23 -12
  326. package/dist/workers/fetch-core.d.ts +13 -16
  327. package/dist/workers/fetch-core.js +23 -23
  328. package/dist/workers/focused-extractor.d.ts +12 -12
  329. package/dist/workers/focused-extractor.js +16 -19
  330. package/dist/workers/html-clean.js +24 -14
  331. package/dist/workers/http-request.d.ts +28 -20
  332. package/dist/workers/http-request.js +22 -17
  333. package/dist/workers/npm-version.d.ts +28 -11
  334. package/dist/workers/npm-version.js +24 -15
  335. package/dist/workers/phantom-imports.d.ts +15 -12
  336. package/dist/workers/phantom-imports.js +30 -24
  337. package/dist/workers/pi-worker-core.d.ts +86 -54
  338. package/dist/workers/pi-worker-core.js +112 -112
  339. package/dist/workers/pi-worker-docs.d.ts +24 -19
  340. package/dist/workers/pi-worker-docs.js +67 -76
  341. package/dist/workers/pi-worker-fetch.d.ts +7 -3
  342. package/dist/workers/pi-worker-fetch.js +27 -19
  343. package/dist/workers/pi-worker-search.js +12 -8
  344. package/dist/workers/pi-worker.d.ts +9 -4
  345. package/dist/workers/pi-worker.js +23 -10
  346. package/dist/workers/reasoning-warning.d.ts +18 -17
  347. package/dist/workers/reasoning-warning.js +22 -20
  348. package/dist/workers/research-cache.js +50 -78
  349. package/dist/workers/search-core.js +7 -5
  350. package/dist/workers/search-types.d.ts +10 -9
  351. package/dist/workers/search-types.js +9 -8
  352. package/dist/workers/session-hint.d.ts +13 -14
  353. package/dist/workers/session-hint.js +8 -9
  354. package/dist/workers/shared.d.ts +21 -25
  355. package/dist/workers/shared.js +0 -0
  356. package/dist/workers/single-read-extension.d.ts +14 -7
  357. package/dist/workers/single-read-extension.js +14 -7
  358. package/dist/workers/single-read-guard.d.ts +25 -28
  359. package/dist/workers/single-read-guard.js +32 -32
  360. package/dist/workers/typeonly-log.d.ts +12 -9
  361. package/dist/workers/typeonly-log.js +29 -33
  362. package/dist/workers/worker-channels.d.ts +15 -23
  363. package/dist/workers/worker-channels.js +15 -23
  364. package/dist/workers/worker-failure.d.ts +38 -46
  365. package/dist/workers/worker-failure.js +31 -39
  366. package/dist/workers/worker-kill.d.ts +25 -26
  367. package/dist/workers/worker-kill.js +16 -19
  368. package/dist/workers/worker-profiles.d.ts +43 -53
  369. package/dist/workers/worker-profiles.js +30 -38
  370. package/package.json +10 -8
@@ -1,18 +1,24 @@
1
1
  /**
2
2
  * accept-debt — a per-run ledger of tasks the user ACCEPTED despite a verify-FAIL.
3
3
  *
4
- * The failure this closes (mx5 run 4 B3, carried open; run 8 fixture TASK_0012):
4
+ * The failure this closes:
5
5
  * when a task's VERIFY gate FAILs and the resolution picker's ACCEPT branch is
6
6
  * chosen, the human blesses the artifact AS-IS — a real, recorded defect ships and
7
- * NOTHING revisits it. Run 8's TASK_0012 shipped a frozen-path violation that was
8
- * accepted and never re-checked; a later task could have fixed it, or it could
9
- * still be broken at run end, and no gate ever said which.
7
+ * NOTHING revisits it. A later task could have fixed it, or it could still be
8
+ * broken at run end, and no gate ever said which.
10
9
  *
11
- * Mechanism (mirrors env-notes.ts / contracts.ts): each ACCEPT-despite-FAIL is
12
- * appended HOST-SIDE to `.pi-tasks/accept-debt.md` as a durable `<taskId>\t<reason>`
13
- * record (the gate sequence never lets a child write the file — no artifact
14
- * corruption). The ledger lives under `.pi-tasks/`, so it survives discardEdits and
15
- * the git-state guard, both of which exclude that directory by design.
10
+ * Mechanism (mirrors env-notes.ts / contracts.ts, which share `makeLedger`): each
11
+ * ACCEPT-despite-FAIL is appended HOST-SIDE to `.pi-tasks/accept-debt.md` as a
12
+ * durable tab-separated record. The gate sequence never lets a child write the
13
+ * file, so it cannot be corrupted by the work it is recording.
14
+ *
15
+ * Living under `.pi-tasks/` is what makes it durable, and both exclusions are
16
+ * explicit rather than incidental. `discardEdits` runs
17
+ * `git checkout -- . ':(exclude).pi-tasks'` then `git clean -fd -e .pi-tasks`, and
18
+ * the git-state guard writes its tree with the same `:(exclude).pi-tasks` pathspec.
19
+ * Confirmed against a real repo: a discard restored the tracked file, removed the
20
+ * untracked one, and left the ledger byte-identical; and appending a debt did not
21
+ * move the guard's tree hash, while a one-line source edit did.
16
22
  *
17
23
  * RE-CHECK at run end (final-gate.ts): the final integration gate reads the ledger,
18
24
  * re-checks each debt against the CURRENT tree, and SURFACES the ones still open in
@@ -49,11 +55,11 @@ const FIELD_SEP = '\t';
49
55
  /**
50
56
  * Origin → the one-line provenance label the surfaced report prints for it
51
57
  * (describeDebt). This table IS the origin registry: `Record<DebtOrigin, string>`
52
- * makes a new union member a compile error until it has a label, and both the
53
- * describe side and the parse side read it, so adding an origin is one union member
54
- * plus one line here not the six edit sites the per-origin recorder functions used
55
- * to cost. The label text is user-facing (it lands in the final gate's report and in
56
- * the FAIL picker), so these strings are byte-frozen.
58
+ * makes a new union member a compile error until it has a label, and BOTH the
59
+ * describe side and the parse side read it `isKnownOrigin` tests membership of
60
+ * this very tableso adding an origin is one union member plus one line here.
61
+ * The label text is user-facing: it lands in the final gate's report and in the
62
+ * FAIL picker, so these strings are byte-frozen.
57
63
  */
58
64
  const DEBT_LABELS = {
59
65
  accepted: 'accepted despite verify-FAIL',
@@ -100,7 +106,7 @@ export function parseAcceptDebts(raw) {
100
106
  continue;
101
107
  }
102
108
  const origin = parts[2]?.trim();
103
- // 4th field: the verbatim VERIFY command the reason names (nexttask 5).
109
+ // 4th field: the verbatim VERIFY command the reason names.
104
110
  // Absent in every legacy record, and absent in most new ones.
105
111
  const verifyCommand = parts[3]?.trim();
106
112
  out.push({
@@ -165,7 +171,7 @@ async function appendDebt(cwd, entry) {
165
171
  return;
166
172
  try {
167
173
  // Classify AT RECORD TIME, against the spec as it stands when the defect is
168
- // recorded (nexttask 5). Doing it later would read a spec a subsequent task
174
+ // recorded. Doing it later would read a spec a subsequent task
169
175
  // may have rewritten — the provenance claim has to be made where it is true.
170
176
  const verifyCommand = entry.verifyCommand ?? (await classifyVerifyCommand(cwd, entry.taskId, entry.reason));
171
177
  if (verifyCommand !== null && verifyCommand !== undefined)
@@ -188,19 +194,18 @@ async function appendDebt(cwd, entry) {
188
194
  * Best-effort by construction (appendDebt swallows its own faults): the ledger is an
189
195
  * auditing aid and must never break the gate sequence that calls it.
190
196
  *
191
- * `origin` is REQUIRED and deliberately has no default. It used to default to
192
- * 'accepted' (the legacy 2-field on-disk shape), and that default silently absorbed
193
- * a dropped argument: the eight-recorder collapse migrated one call in
194
- * scripts/ignored-writes-ab.ts without its origin, so a run-level 'final-gate'
195
- * demotion was stamped as a human 'accepted'. The wrappers each carried their class
196
- * in the NAME, so no migration of them could lose it; a defaulted parameter can.
197
- * Making it explicit turns that whole class of slip into a compile error.
197
+ * `origin` is REQUIRED and deliberately has no default. A default of 'accepted'
198
+ * would be the tempting one, since that is the legacy 2-field on-disk shape and
199
+ * that is exactly what makes it dangerous. A dropped argument would then be
200
+ * absorbed in silence, stamping a run-level 'final-gate' demotion as a human
201
+ * 'accepted': the one confusion this type exists to prevent. Requiring it turns
202
+ * that slip into a compile error instead.
198
203
  */
199
204
  export async function recordDebt(cwd, taskId, reason, origin) {
200
205
  await appendDebt(cwd, { taskId: taskId.trim(), reason: normaliseReason(reason), origin });
201
206
  }
202
207
  /**
203
- * The reason text a CROSS-TASK DELETION debt stores (mx5 run 12 PROMPT 2): the task's
208
+ * The reason text a CROSS-TASK DELETION debt stores: the task's
204
209
  * work deleted a file a DIFFERENT task's commit introduced, verify FAILed, and the
205
210
  * user ACCEPTed — so the deletion survives into the next commit. The shape is fixed
206
211
  * and machine-parseable so the final gate's re-check can extract the path and prove
@@ -237,16 +242,14 @@ export function isStaticClassDebt(reason) {
237
242
  return isStaticClass(failClassOfReason(reason));
238
243
  }
239
244
  /**
240
- * The VERIFY-COMMAND class (nexttask 5): the ONE command a recorded reason itself
245
+ * The VERIFY-COMMAND class: the ONE command a recorded reason itself
241
246
  * NAMES, quoted verbatim in backticks, and present byte-identically in the owning
242
247
  * task's VERIFY block.
243
248
  *
244
- * mx5 run 19 recorded `work did not verify: The VERIFY block command \`AGENT=1 bun
245
- * test test/listings.test.ts\` fails unaided …`; eleven minutes later the final-gate
246
- * autofix fixed exactly that, the gate's own re-run printed `121 pass 0 fail`, and
247
- * the run still ended reporting the debt STILL OPEN because no reachable code path
248
- * could ever have closed it (see recheckAcceptDebts: two classes, neither reachable
249
- * for a `work did not verify:` reason).
249
+ * Without it, a debt whose reason reads `work did not verify: The VERIFY block
250
+ * command \`…\` fails unaided` can be FIXED by a later autofix and still be
251
+ * reported STILL OPEN at run end, because no reachable code path could close it:
252
+ * see recheckAcceptDebts, whose other two classes never match such a reason.
250
253
  *
251
254
  * Deliberately NOT fuzzy: a backticked span is accepted only when it equals a parsed
252
255
  * VERIFY line exactly (after trimming). No paraphrase, no reconstruction, no prefix
@@ -262,16 +265,18 @@ export function isStaticClassDebt(reason) {
262
265
  * than a command. Any of those ⇒ not stored ⇒ the debt is simply unclassified, i.e.
263
266
  * exactly as un-closable as it is today.
264
267
  *
265
- * …and one more condition (nexttask 19C): a command whose EXIT STATUS IS DESTROYED
266
- * BY ITS OWN CONSTRUCTION is not storable either. The whole auto-close rests on a
267
- * ZERO exit meaning "the check passed" (see recheckAcceptDebts below), and 16 of
268
- * the 612 store-eligible VERIFY lines on this box exit zero whatever the tree
269
- * contains 12 of them in IAR1, a CMake/C++ OBS plugin with no database, no
270
- * frontend and no HTTP server, where one task is seven consecutive
271
- * `test -f && echo "PASS" || echo "FAIL"` lines standing in for a build check.
268
+ * …and one more condition: a command whose EXIT STATUS IS DESTROYED BY ITS OWN
269
+ * CONSTRUCTION is not storable either. The whole auto-close rests on a ZERO exit
270
+ * meaning "the check passed" (see recheckAcceptDebts below), and a VERIFY line
271
+ * shaped like `test -f && echo "PASS" || echo "FAIL"` exits zero whatever the
272
+ * tree contains. Run in a real shell with the file absent, it prints FAIL and
273
+ * exits 0; the bare `test -f` exits 1. So the chain does not merely weaken the
274
+ * signal, it inverts it the one output a human would read as failure is the one
275
+ * a re-check would read as resolved.
276
+ *
272
277
  * Refusing to store one leaves the debt OPEN and surfaced, which is strictly the
273
- * smaller claim. See unfailable-command.ts for what is and is not decidable, and
274
- * why bare `|| true` stays out of scope.
278
+ * smaller claim. See unfailable-command.ts for what is and is not decidable; bare
279
+ * `|| true` stays out of scope, and is confirmed NOT to match.
275
280
  */
276
281
  function isStorableCommand(cmd) {
277
282
  return (cmd.length > 0
@@ -285,9 +290,9 @@ function isStorableCommand(cmd) {
285
290
  * VERIFY fence, or a reason that quotes nothing all yield null, and null simply
286
291
  * means the debt keeps today's behaviour (surfaced, never auto-closed).
287
292
  *
288
- * The STRICT parse matters here. mx5 run 19's `TASK_0001.md` opens ```sh and never
289
- * closes it, so the lenient parser hands back the phase-timings table and every
290
- * appended gate-trail line as "VERIFY commands" — including sentences that quote
293
+ * The STRICT parse matters here. A spec that opens ```sh and never closes it
294
+ * makes the lenient parser hand back the phase-timings table and every appended
295
+ * gate-trail line as "VERIFY commands" — including sentences that quote
291
296
  * `bun run lint`. Matching a reason against that would mint a stored, re-runnable
292
297
  * command with fabricated provenance, which is the one thing this class may not do.
293
298
  */
@@ -323,10 +328,11 @@ export function verifyCommandFromReason(reason, verifyCommands) {
323
328
  return null;
324
329
  }
325
330
  /**
326
- * Re-runs allowed per re-check. `inv-bounded`: a run that accepted many command-shaped
327
- * FAILs must not turn its own report into an unbounded second test suite. Three covers
328
- * every recorded run in the corpus (max classified per run: 1) with room to spare, and
329
- * anything past it stays open with the budget stated in the trail — never closed.
331
+ * Re-runs allowed per re-check. `inv-bounded`: a run that accepted many
332
+ * command-shaped FAILs must not turn its own report into an unbounded second test
333
+ * suite. The cap is a ceiling, not a target a debt past it stays OPEN with the
334
+ * budget named in the trail, never closed. Confirmed by running the re-check with
335
+ * more command-class debts than the budget: the extras come back open.
330
336
  */
331
337
  const MAX_VERIFY_RERUNS = 3;
332
338
  /**
@@ -336,7 +342,7 @@ const MAX_VERIFY_RERUNS = 3;
336
342
  * task or a human restored it, so the deletion no longer holds); every other debt
337
343
  * stays OPEN (unprovable ⇒ surface, never re-hide) — unless it carries a stored
338
344
  * `verifyCommand` and `rerunVerify` re-runs that command to a ZERO exit, which is the
339
- * third class (nexttask 5): the debt named a command, the command was run, and it
345
+ * third class: the debt named a command, the command was run, and it
340
346
  * passed. FP-safe: the only auto-closes are ones a deterministic check can stand
341
347
  * behind, and here the check is the task spec's own command.
342
348
  */
@@ -401,16 +407,15 @@ export async function recheckAcceptDebts(debts, opts) {
401
407
  }
402
408
  return { open, resolved, trail };
403
409
  }
404
- // ─── Conflicting-claim classification (mx5 run 11) ──────────────────────────
410
+ // ─── Conflicting-claim classification ──────────────────────────
405
411
  //
406
412
  // A recorded debt is a CLAIM about the tree, not an instruction to change it. The
407
413
  // one class a deterministic check can prove SELF-CONTRADICTORY is an
408
414
  // existence-as-failure claim ("<path> exists" fails the verify) whose named path is
409
415
  // a DIFFERENT task's committed deliverable: the plan shipped the file on purpose
410
416
  // and a sibling's verify indicts it — a plan defect (sibling scope-fence leaked
411
- // into a verify assertion), not a fixable fault. Run 11's TASK_0009 debt read
412
- // "src/client/pages/admin.tsx exists (introduced by prior TASK_0008…)" and the
413
- // final-gate autofix child, seeded with it, ran `rm` on the verified page.
417
+ // into a verify assertion), not a fixable fault. A debt reading "<path> exists"
418
+ // hands a final-gate autofix child a reason to `rm` a verified page.
414
419
  /** A path-like token: at least one directory separator, ending in a file name. */
415
420
  const PATH_TOKEN_RE = /(?:[\w.@-]+\/)+[\w.@-]+\.\w+/g;
416
421
  /**
@@ -418,7 +423,7 @@ const PATH_TOKEN_RE = /(?:[\w.@-]+\/)+[\w.@-]+\.\w+/g;
418
423
  * token immediately followed by "exists" / "still exists", or by "must/should not
419
424
  * exist". Only this narrow shape qualifies: a reason that merely MENTIONS a path
420
425
  * (a prohibition violation, a broken import) is an ordinary defect claim, not an
421
- * existence assertion, and must never be flagged (run 11's T1/T7 debts name paths
426
+ * existence assertion, and must never be flagged (such debts name paths
422
427
  * this way and are genuine).
423
428
  */
424
429
  export function extractExistenceClaims(reason) {
@@ -481,7 +486,7 @@ export function describeDebt(d) {
481
486
  return isKnownOrigin(d.origin) ? DEBT_LABELS[d.origin] : DEBT_LABELS.accepted;
482
487
  }
483
488
  /**
484
- * ACCEPT-debt re-check (mx5 run 4 B3 / run 8 TASK_0012): read the ledger of tasks
489
+ * ACCEPT-debt re-check: read the ledger of tasks
485
490
  * the user accepted despite a verify-FAIL and re-check each against the CURRENT
486
491
  * tree. A static-class debt whose statics now pass is provably RESOLVED (a later
487
492
  * task fixed it) and pruned from the ledger; every other debt cannot be proven
@@ -490,9 +495,9 @@ export function describeDebt(d) {
490
495
  * accept-debt.ts). Best-effort: a ledger read/write failure must never break the
491
496
  * caller.
492
497
  *
493
- * FACTORED OUT of runFinalIntegrationGate (nexttask 6): the derivation has to be
498
+ * FACTORED OUT of runFinalIntegrationGate: the derivation has to be
494
499
  * runnable at a SECOND moment — after a converged final-gate autofix, where the
495
- * orchestrator used to rebuild its gate outcome as a bare `{ok, reason}` and drop
500
+ * orchestrator rebuilds its gate outcome as a bare `{ok, reason}` and drops
496
501
  * `openDebts` entirely. The report a run ends on has to be derived from the tree
497
502
  * the run ends with, not from the tree as it was before the fix pass.
498
503
  *
@@ -509,14 +514,14 @@ run = spawnCommand, signal) {
509
514
  // tree — a deterministic existence check, corroborating the per-file
510
515
  // provenance the record already carries.
511
516
  fileExists: rel => existsSync(path.join(cwd, rel)),
512
- // VERIFY-COMMAND class (nexttask 5): a debt that NAMES a command is settled
517
+ // VERIFY-COMMAND class: a debt that NAMES a command is settled
513
518
  // by running that command, under the gate's own env-gap contract and behind
514
519
  // the no-write guard below.
515
520
  rerunVerify: cmd => rerunDebtVerifyCommand(cwd, cmd, run, signal)
516
521
  });
517
522
  if (resolved.length > 0)
518
523
  await writeAcceptDebts(cwd, openRaw);
519
- // Conflicting-claim annotation (mx5 run 11): an existence-as-failure debt whose
524
+ // Conflicting-claim annotation: an existence-as-failure debt whose
520
525
  // named file is another task's committed deliverable is a plan defect — surface
521
526
  // the contradiction with the debt so nobody (human or child) treats the claim as
522
527
  // a deletion instruction. Pure git-history lookup; degrades to no annotation.
@@ -529,10 +534,11 @@ const DEBT_RERUN_TIMEOUT_MS = 300_000;
529
534
  /**
530
535
  * Extra infrastructure-gap shapes recognised ONLY when re-running a debt's command,
531
536
  * never in the gate's own verdicts. A driver that reports its connection simply
532
- * closed (`ERR_POSTGRES_CONNECTION_CLOSED` what bun's SQL client says when the
533
- * database is not there at all, as on this box with the mx5 container stopped) is an
534
- * absent dependency, and calling that "the defect is still present" would be a
535
- * finding the environment invented. Kept out of INFRA_GAP_OUTPUT_RE on purpose: in a
537
+ * closed is an absent dependency, not a defect, and calling it "the defect is
538
+ * still present" would be a finding the environment invented. The postgres code is
539
+ * verbatim from the runtime: pointed at a port with nothing behind it, bun's SQL
540
+ * client throws a `PostgresError` whose `code` is exactly
541
+ * `ERR_POSTGRES_CONNECTION_CLOSED`. Kept out of INFRA_GAP_OUTPUT_RE on purpose: in a
536
542
  * gate verdict the same wording can be a real fault the suite must own, and only the
537
543
  * debt re-check needs the conservative reading — where it costs nothing, because gap
538
544
  * and fail both leave the debt open.
@@ -547,9 +553,11 @@ const DEBT_INFRA_GAP_RE = /ERR_POSTGRES_CONNECTION_CLOSED|ERR_MYSQL_CONNECTION|E
547
553
  * a passing tree and have that count as the debt being fixed — the run would then be
548
554
  * certifying its own side effect. So tracked state is captured before and after, and
549
555
  * a pass that came with a tracked change is downgraded to INCONCLUSIVE with the
550
- * change named. Untracked output is left alone: it is what a build legitimately
551
- * produces, and `git status --porcelain` in a repo with the usual ignores does not
552
- * see it.
556
+ * change named. Untracked output is left alone because the guard asks git not to
557
+ * report it: `--untracked-files=no` is doing that work, NOT the project's ignore
558
+ * rules. Checked both ways — with and without a matching `.gitignore`, the flag
559
+ * returns an empty status for a fresh untracked build directory, while plain
560
+ * `--porcelain` reports it when it is not ignored.
553
561
  *
554
562
  * A repository the guard cannot read (no git, git absent) is not a licence to skip
555
563
  * the guard: the re-run is INCONCLUSIVE there, because "nothing changed" would be an
@@ -1,30 +1,33 @@
1
1
  /**
2
- * Anti-synthesis guard for grill/clarify auto-answers (mx5 run-13 Bug A).
2
+ * Anti-synthesis guard for grill/clarify auto-answers.
3
3
  *
4
- * The grill auto-answer channel invented `Bun.mkdirSync` (does not exist) while
5
- * the task's own research APIS section carried the correct list (Bun.build,
6
- * Bun.spawn). Nothing cross-checked the answer against it, so the invention was
7
- * promoted into the task's title, requirements, acceptance criteria AND VERIFY
8
- * block, and the implementer shipped a fake ambient declare to compile it.
4
+ * The failure: an auto-answer names an API that does not exist, and nothing
5
+ * cross-checks it against the research the task already gathered. A
6
+ * plausible-looking invention is then promoted into the title, the requirements,
7
+ * the acceptance criteria and the VERIFY block, and the implementation fakes a
8
+ * declaration to make it compile. `Bun.mkdirSync` is the shape of it, and it is
9
+ * real: against the runtime, `typeof Bun.mkdirSync` is `undefined`, while
10
+ * `Bun.build` and `Bun.spawn` are both functions.
9
11
  *
10
- * Lever: the same verbatim-substring anti-synthesis check as the F3 contract
11
- * registry. Extract API-shaped identifiers (`Namespace.member`) from the answer;
12
- * an identifier is SYNTHESIZED when
12
+ * The lever is verbatim-substring membership, never a model judgement — the same
13
+ * technique the contract registry uses to reject a paraphrased key. Extract
14
+ * API-shaped identifiers (`Namespace.member`) from the answer; an identifier is
15
+ * SYNTHESIZED when
13
16
  * (a) the full identifier appears nowhere in the research (APIS/docs/context
14
- * sections, verbatim substring, case-sensitive) and nowhere in the
15
- * question itself, AND
17
+ * sections, case-sensitive substring) and nowhere in the question, AND
16
18
  * (b) the research DOES mention that namespace's API surface (`Bun.` appears
17
- * somewhere) — i.e. research claims coverage of the namespace, so a
18
- * member absent from it is suspicious rather than merely uncovered.
19
- * Gate (b) is the step-aside rule: when research never mentions the namespace
20
- * at all (React.StrictMode in a task whose research covered no React API), the
21
- * check is INCONCLUSIVE and must not fire — the guard may only cost time,
22
- * never work. Same for the clarify-triage seam, whose research slot is a stub:
23
- * no namespace coverage ⇒ no findings ⇒ guard inert by construction.
19
+ * somewhere) — research claims coverage of the namespace, so a member
20
+ * absent from it is suspicious rather than merely uncovered.
24
21
  *
25
- * Caller contract (phaseAutoAnswer): findings re-ask ONCE with the research
26
- * API lines injected (belt); a re-asked answer that still carries a flagged
27
- * identifier is surfaced to the user as UNKNOWN instead of being promoted.
22
+ * Gate (b) is the step-aside rule, and it is what keeps the guard costing time
23
+ * rather than work. Run both ways: `React.StrictMode` against research that
24
+ * mentions only `Bun.` produces NO finding, and research that is empty produces
25
+ * none either — so a caller with nothing gathered leaves the guard inert by
26
+ * construction instead of trigger-happy.
27
+ *
28
+ * Caller contract (phaseAutoAnswer): findings ⇒ re-ask exactly ONCE with the
29
+ * verified research lines injected; an answer that STILL carries a flagged
30
+ * identifier is surfaced to the user as `unknown` rather than promoted.
28
31
  */
29
32
  export interface SynthesizedApiFinding {
30
33
  /** The full flagged identifier, e.g. "Bun.mkdirSync". */
@@ -1,42 +1,48 @@
1
1
  /**
2
- * Anti-synthesis guard for grill/clarify auto-answers (mx5 run-13 Bug A).
2
+ * Anti-synthesis guard for grill/clarify auto-answers.
3
3
  *
4
- * The grill auto-answer channel invented `Bun.mkdirSync` (does not exist) while
5
- * the task's own research APIS section carried the correct list (Bun.build,
6
- * Bun.spawn). Nothing cross-checked the answer against it, so the invention was
7
- * promoted into the task's title, requirements, acceptance criteria AND VERIFY
8
- * block, and the implementer shipped a fake ambient declare to compile it.
4
+ * The failure: an auto-answer names an API that does not exist, and nothing
5
+ * cross-checks it against the research the task already gathered. A
6
+ * plausible-looking invention is then promoted into the title, the requirements,
7
+ * the acceptance criteria and the VERIFY block, and the implementation fakes a
8
+ * declaration to make it compile. `Bun.mkdirSync` is the shape of it, and it is
9
+ * real: against the runtime, `typeof Bun.mkdirSync` is `undefined`, while
10
+ * `Bun.build` and `Bun.spawn` are both functions.
9
11
  *
10
- * Lever: the same verbatim-substring anti-synthesis check as the F3 contract
11
- * registry. Extract API-shaped identifiers (`Namespace.member`) from the answer;
12
- * an identifier is SYNTHESIZED when
12
+ * The lever is verbatim-substring membership, never a model judgement — the same
13
+ * technique the contract registry uses to reject a paraphrased key. Extract
14
+ * API-shaped identifiers (`Namespace.member`) from the answer; an identifier is
15
+ * SYNTHESIZED when
13
16
  * (a) the full identifier appears nowhere in the research (APIS/docs/context
14
- * sections, verbatim substring, case-sensitive) and nowhere in the
15
- * question itself, AND
17
+ * sections, case-sensitive substring) and nowhere in the question, AND
16
18
  * (b) the research DOES mention that namespace's API surface (`Bun.` appears
17
- * somewhere) — i.e. research claims coverage of the namespace, so a
18
- * member absent from it is suspicious rather than merely uncovered.
19
- * Gate (b) is the step-aside rule: when research never mentions the namespace
20
- * at all (React.StrictMode in a task whose research covered no React API), the
21
- * check is INCONCLUSIVE and must not fire — the guard may only cost time,
22
- * never work. Same for the clarify-triage seam, whose research slot is a stub:
23
- * no namespace coverage ⇒ no findings ⇒ guard inert by construction.
19
+ * somewhere) — research claims coverage of the namespace, so a member
20
+ * absent from it is suspicious rather than merely uncovered.
24
21
  *
25
- * Caller contract (phaseAutoAnswer): findings re-ask ONCE with the research
26
- * API lines injected (belt); a re-asked answer that still carries a flagged
27
- * identifier is surfaced to the user as UNKNOWN instead of being promoted.
22
+ * Gate (b) is the step-aside rule, and it is what keeps the guard costing time
23
+ * rather than work. Run both ways: `React.StrictMode` against research that
24
+ * mentions only `Bun.` produces NO finding, and research that is empty produces
25
+ * none either — so a caller with nothing gathered leaves the guard inert by
26
+ * construction instead of trigger-happy.
27
+ *
28
+ * Caller contract (phaseAutoAnswer): findings ⇒ re-ask exactly ONCE with the
29
+ * verified research lines injected; an answer that STILL carries a flagged
30
+ * identifier is surfaced to the user as `unknown` rather than promoted.
28
31
  */
29
32
  /**
30
33
  * `Namespace.member` where the namespace starts uppercase (Bun, React, Deno —
31
- * the global/imported-namespace API shape; run-13's TP is exactly this) and
32
- * both sides are ≥2 chars (kills "U.S.", "e.G" prose shapes). Member may start
33
- * either case: `Bun.mkdirSync` and `React.StrictMode` are both API-shaped.
34
+ * the global or imported-namespace API shape) and BOTH sides are at least two
35
+ * characters. Run against the prose shapes it has to survive: `U.S. policy`,
36
+ * `e.G thing`, `A.b` and `fs.readFile` all extract nothing, while
37
+ * `Bun.mkdirSync` and `React.StrictMode` both match — the member may start
38
+ * either case.
34
39
  */
35
40
  const API_IDENT_RE = /\b([A-Z][A-Za-z0-9_$]+)\.([A-Za-z_$][A-Za-z0-9_$]+)\b/g;
36
41
  /**
37
42
  * Member names that make the match a file name, domain, or version-ish token
38
- * rather than an API (Node.js, App.tsx, README.md, Fly.io, Express.com). All
39
- * lowercase-compared, so `INDEX.HTML` is excluded too.
43
+ * rather than an API (Node.js, App.tsx, README.md, Fly.io, Express.com). The
44
+ * comparison is lowercased, so shouting does not slip through: `INDEX.HTML`
45
+ * extracts nothing, same as `App.tsx`.
40
46
  */
41
47
  const NON_API_MEMBERS = new Set([
42
48
  'js',
@@ -1,67 +1,35 @@
1
1
  /**
2
- * STAGE 2 LEVER the APIS OUTPUT CONTRACT.
3
- *
4
- * ── WHAT STAGE 1 MEASURED, AND WHY THIS IS THE ONLY VARIABLE LEFT ─────────────────────────
5
- *
6
- * worker:apis terminates when every entry on its output list has a SIGNATURE. That is not an
7
- * inference; it is what 16 live reps say (commit 807ffad, raw data ~/tmp/apis-stopping-point):
8
- * - it does not stop at a budget — docs calls/rep mean 8.5, sd 3.8, cv 0.45, range 3-14;
9
- * - it does not stop because it is circling — near-repeats 2/45 = 4.4% over the last three
10
- * calls, LOWER than the 10.2% whole-trajectory rate;
11
- * - it does not stop because nothing new is arriving the FINAL answer of a rep still
12
- * returns 39 symbols no earlier answer in that rep carried;
13
- * - it does not stop with holes in its own output ungrounded symbols 2/588 = 0.3%,
14
- * strict open-gap entries 2/277 = 0.7%.
15
- * What it does instead: 95.3% of its lookups reach the emitted section and 72.2% of emitted
16
- * entries were themselves asked about. The trajectory and the output are the SAME LIST. And
17
- * the list's format is `<name> <one-line signature or use>` so of 61 package queries across
18
- * 15 reps, 52 (85.2%) are signature questions and THREE are behaviour questions.
19
- *
20
- * The worker stops because the artifact it was asked for is complete by the standard its
21
- * format sets, and a signature satisfies that standard. "What does this parameter MEAN" is not
22
- * a field of the thing it is building, so nothing in its output is ever left unfilled by not
23
- * asking it. That is why it never escalates: escalation answers a question it has no reason to
24
- * ask.
25
- *
26
- * ── WHY THIS BLOCK AND NOT A THIRD INSTRUCTION ────────────────────────────────────────────
27
- *
28
- * Two levers have already failed against this seam, and they failed for the same reason:
29
- * PROMPT 2 conditioned on RECOGNISING an answer as inadequate (type-only). Reach 9/1680 =
30
- * 0.54% of answers. But a type signature is not an inadequate answer to the
31
- * question actually being asked it is exactly the requested field.
32
- * PROMPT 4 conditioned on nothing at all, and pointed the worker at the exact page that
33
- * would have prevented the fatal bug. 2/20 vs 3/20, Fisher p = 0.50, with delivery
34
- * of the block into the assembled prompt PROVEN separately. A pointer only helps a
35
- * worker that has an unmet slot to fill.
36
- * Both acted on the ANSWER side or the TARGET side. This one adds a FIELD A SIGNATURE CANNOT
37
- * FILL, which is the variable that is not flat.
38
- *
39
- * ── STEP 3 OF THE FALLBACK IS LOAD-BEARING. DO NOT "CLOSE" IT ─────────────────────────────
40
- *
41
- * The `UNVERIFIED:` escape is mandatory and is not a loophole. Forbidding abstention is
42
- * precisely how F-1 manufactured the confident wrong claim that killed run 15: worker:context,
43
- * holding one true citable fact (the pinned hono version), fused it with an uncheckable one
44
- * (what `hc`'s base URL means) under a single attribution — `hc<AppType>('/api')` — and every
45
- * request in the shipped product went to /api/api/… and 404'd. A lever that buys behaviour
46
- * questions with fabrication is a FAIL, not a win. The A/B asserts it: excerptVerified===false
47
- * and the ungrounded-symbol rate must not rise.
48
- *
49
- * Exported unwired first, wired into RESEARCH_APIS_PROMPT in the same series; the STEP A
50
- * feasibility probe splices this exact text into a patched dist so the probe and the shipped
51
- * lever can never drift apart.
52
- */
53
- /**
54
- * The extra output-contract clause for RESEARCH_APIS_PROMPT.
55
- *
56
- * Wording notes, because each of these is answering something measured:
57
- * - "NOT DONE WHEN THEY HAVE A SIGNATURE" is the whole lever. Stage 1's mechanism is
58
- * completion-by-format, so the change has to move the completion bar, not add advice.
59
- * - the worked example is the run-15 fatal case verbatim (`hc(baseUrl: Prefix, …)`), because
60
- * a rule without an instance of what does NOT satisfy it reads as satisfied by anything.
61
- * - step 2 says escalation is EXPECTED rather than permitted: bundled .d.ts files genuinely
62
- * do not carry semantics, and a worker that reads "you may escalate" has been told nothing
63
- * it did not already have (PROMPT 4 measured what permission alone achieves: nothing).
64
- * - step 3 is stated as CORRECT and REQUIRED, in those words, so the field cannot be closed
65
- * by guessing. See the header.
2
+ * An output-contract clause for the APIS research prompt that is NOT wired in.
3
+ *
4
+ * READ THIS FIRST: nothing splices this into `RESEARCH_APIS_PROMPT`. The only
5
+ * references to `APIS_SEMANTICS_CONTRACT` in the tree are its own tests and a
6
+ * regression guard in prompts.test.ts that asserts the shipped prompt does NOT
7
+ * contain it. The text is kept, and pinned by tests, so the lever can be read and
8
+ * re-tried not because it is in use.
9
+ *
10
+ * WHAT IT WOULD CHANGE. `worker:apis` treats an entry as finished once it has a
11
+ * SIGNATURE, because that is what its output format asks for. A signature says
12
+ * nothing about what an argument MEANS, and the implementing agent has to guess —
13
+ * a plausible wrong guess about a base URL or a default is the most damaging thing
14
+ * this section can carry. The clause moves the completion bar: an entry is
15
+ * unfinished until it also carries a SEMANTICS field.
16
+ *
17
+ * STEP 3 OF THE FALLBACK IS LOAD-BEARING. DO NOT "CLOSE" IT. The `UNVERIFIED:`
18
+ * escape is mandatory and is not a loophole: a worker that may not abstain has
19
+ * nowhere to put an uncheckable fact except into a confident claim. A lever that
20
+ * buys behaviour questions with fabrication is a regression, not a win.
21
+ *
22
+ * Wording notes, each answering something the shape of the prompt forces. All four
23
+ * are present in the string below, checked:
24
+ * - "NOT DONE WHEN THEY HAVE A SIGNATURE" is the whole lever. The worker stops by
25
+ * format, so the change has to move the format's bar, not add advice.
26
+ * - the worked example (`hc(baseUrl: Prefix, …)`) shows an entry that does NOT
27
+ * satisfy the rule. A rule with no counter-example reads as satisfied by
28
+ * anything.
29
+ * - step 2 says escalation is EXPECTED "Expect this:" rather than permitted.
30
+ * Bundled `.d.ts` files genuinely carry no semantics, and "you may escalate"
31
+ * tells a worker nothing it did not already have.
32
+ * - step 3 is stated as "A CORRECT AND REQUIRED OUTCOME", in those words, so the
33
+ * field cannot be closed by guessing.
66
34
  */
67
35
  export declare const APIS_SEMANTICS_CONTRACT = "THIRD-PARTY PACKAGE ENTRIES ARE NOT DONE WHEN THEY HAVE A SIGNATURE. For every entry whose symbol comes from a third-party npm package \u2014 not this project's own source, not a runtime builtin \u2014 the line carries a SECOND field saying what the thing MEANS in use: what one of its arguments stands for, what it defaults to, what a path/URL/prefix it is handed is relative to, or what its return value actually is. Format:\n <name> <one-line signature or use> \u2014 SEMANTICS: <what it means in use>\n\nA TYPE SIGNATURE IS NOT A SEMANTICS CLAUSE, and restating one in prose does not make it one. `hc(baseUrl: Prefix, options?: ClientRequestOptions)` names the argument and says nothing about whether that argument is an origin, or a mount prefix, or how it is joined to each route path \u2014 which is the fact the implementing agent actually needs, and the one it will otherwise guess wrong. An entry whose SEMANTICS field is missing is UNFINISHED, and your section is not ready to emit while any package entry is unfinished.\n\nHOW TO FILL THAT FIELD \u2014 in this order. Do not skip a step, and do not stop after step 1 because you already hold the declaration:\n 1. ASK `pi-worker-docs` A BEHAVIOUR QUESTION about that package. NOT \"what is X's signature\", NOT \"what types does X export\" \u2014 those return the declaration you already have. Ask what an argument MEANS, what it DEFAULTS to, what it is RELATIVE to, what HAPPENS when it is given a particular value. For example: `pi-worker-docs(\"hono/client\", \"what does the baseUrl argument to hc MEAN \u2014 an origin or a mount prefix \u2014 and how is it joined to each route path?\")`.\n 2. IF THE PACKAGE TEXT DOES NOT ANSWER IT, ESCALATE. Expect this: bundled `.d.ts` declarations frequently carry no semantics at all, because the semantics live in the package's documentation. Call `pi-worker-search` with the question, or `pi-worker-fetch` on a documentation URL \u2014 including any `@see {@link https://\u2026}` link that appeared in the text `pi-worker-docs` just returned to you.\n 3. ONLY IF BOTH FAIL, WRITE THE OPEN QUESTION DOWN, in this exact form:\n <name> <signature> \u2014 SEMANTICS: UNVERIFIED: <the exact question you could not answer>\n THIS IS A CORRECT AND REQUIRED OUTCOME, not a failure. A named open question is worth far more to the implementing agent than a confident guess, and it is the only acceptable way to finish an entry you could not verify. NEVER fill this field from memory, from what the symbol is named, or from what the API \"obviously\" does: a plausible wrong semantics clause is the single most damaging thing this section can carry.";