@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,68 +1,36 @@
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 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 — not this project's own source, not a runtime builtin — 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:
68
36
  <name> <one-line signature or use> — SEMANTICS: <what it means in use>
@@ -32,9 +32,16 @@ export interface ProducedOutputs {
32
32
  outdirs: Set<string>;
33
33
  }
34
34
  export declare function emptyProducers(): ProducedOutputs;
35
- /** Normalize a literal path: posix separators, strip ./ prefixes, query/hash
36
- * tails (HTML), trailing slash. Returns null when the literal is not a
37
- * checkable relative path (URL, absolute, template hole, glob — step aside). */
35
+ /** Normalize a literal path: posix separators, strip `./` prefixes, query/hash
36
+ * tails (HTML), wrapping quotes, trailing slash. Returns null when the literal
37
+ * is not a checkable repo path a scheme URL, protocol-relative `//host/x`,
38
+ * `~`, a `${…}` hole, a glob, anything with embedded whitespace, and anything
39
+ * under `node_modules/`.
40
+ *
41
+ * A single leading `/` is NOT a rejection: it is treated as root-relative and
42
+ * resolved from the repo root, which is what `<script src="/app.js">` means.
43
+ * So `/app.js` normalizes to `app.js`. A drive-letter path like `C:\win\a.js`
44
+ * is rejected, but as a SCHEME, not as an absolute path. */
38
45
  export declare function normalizeRefPath(raw: string): string | null;
39
46
  /** Extract runtime refs from one JS/TS source. */
40
47
  export declare function extractJsRefs(source: string, referencer: string): RuntimeRef[];
@@ -84,22 +91,29 @@ export declare function collectProducersFromCommand(cmd: string, prod: ProducedO
84
91
  * `writeFile(Sync)`, `createWriteStream`, `copyFile` dest, `mkdir(Sync)`),
85
92
  * `Bun.build({entrypoints, outdir})` (enumerable — unless a `naming` option
86
93
  * makes the output names underivable, then opaque), `outfile:`, and `Bun.spawn`
87
- * argv arrays re-fed through the shell-command collector (the mx5 build.ts
88
- * shape: tailwind's `-o dist/app.css` lives in a spawn array).
94
+ * argv arrays re-fed through the shell-command collector, for the build-script
95
+ * shape where a tool's `-o dist/app.css` lives inside a spawn array rather than
96
+ * in package.json. All four run as described: entrypoints give
97
+ * `dist{a,b}`, adding `naming` turns `dist` opaque and drops the stems, the spawn
98
+ * array yields `dist/app.css`, and `outfile:` yields its exact file.
89
99
  */
90
100
  export declare function collectProducersFromSource(source: string, prod: ProducedOutputs): void;
91
101
  /**
92
102
  * A WATCH/DEV script — one a production build never invokes.
93
103
  *
94
- * The load-bearing rule of nexttask 3 (mx5 run 18): `dist/app.css` had exactly
95
- * one producer, `dev:css` (`@tailwindcss/cli … -o dist/app.css --watch`), a
96
- * watch-mode dev script. The gate's own commands are `build`, `test`, `lint`
97
- * none of them runs it, so the shipped page loaded zero CSS while the closure
98
- * table happily reported the file "produced". A production artifact closed only
99
- * by a watch script is dangling by construction.
104
+ * The rule this exists for: a file whose ONLY producer is a watch-mode script —
105
+ * `dev:css` running `tailwindcss … -o dist/app.css --watch` — is not produced by
106
+ * a release at all. The gate runs `build`, `test`, `lint`; none of them invokes
107
+ * it, so the shipped page loads no CSS while a naive producer table reports the
108
+ * file "produced". A production artifact closed only by a watch script is
109
+ * dangling by construction.
100
110
  *
101
- * Deterministic and name-or-flag based, exactly as pre-registered: a script
102
- * whose NAME starts with `dev`/`watch`, or whose BODY carries `--watch`.
111
+ * Deterministic, name-or-flag based: a script whose NAME starts with
112
+ * `dev`/`watch` (bare or before `:`/`_`/`-`), or whose BODY carries `--watch`.
113
+ * Run across the edge cases — `development` and `predev` are NOT dev scripts,
114
+ * while a script literally named `build` running `tsc --watch` IS one. And
115
+ * end-to-end: with `excludeDevScripts`, a `dist/app.css` produced only by
116
+ * `dev:css` drops out of the producer table entirely.
103
117
  */
104
118
  export declare function isDevScript(name: string, body: string): boolean;
105
119
  export interface ProducerOpts {
@@ -1,16 +1,20 @@
1
1
  /**
2
- * artifact-closure — dangling runtime file references (the run-13 index.html
3
- * class, nexttask PROMPT 2).
2
+ * artifact-closure — dangling runtime file references.
4
3
  *
5
- * The failure this closes (mx5 run 13, validated): a runtime file reference with
6
- * NO producer anywhere in the plan shipped silently. The server's SPA fallback
7
- * read `Bun.file('dist/index.html')`; the build emitted only `app.css` +
8
- * `main.js`; no task, script, or build output ever CREATES `index.html` so the
9
- * shipped app 404'd on every non-API GET while coverage reported "0 unowned"
10
- * (sentence-grounded coverage credited the SERVING side to the server task and
11
- * was structurally blind to the missing PRODUCING side). The spec itself was
12
- * internally dangling: its prose required serving `index.html` while its file
13
- * tree and build section never defined it.
4
+ * The failure this closes: a runtime file reference with NO producer anywhere in
5
+ * the plan ships silently. A server's SPA fallback reads
6
+ * `Bun.file('dist/index.html')`; the build emits only `app.css` and `main.js`;
7
+ * nothing no task, no script, no build output ever CREATES `index.html`, so
8
+ * the app 404s on every non-API GET. Sentence-grounded coverage cannot see it,
9
+ * because it credits the SERVING side to the server's task and is structurally
10
+ * blind to the missing PRODUCING side. The spec can be internally dangling the
11
+ * same way: prose requiring `index.html` be served while the file tree and build
12
+ * section never define it.
13
+ *
14
+ * Reproduced end-to-end while checking this file. A tree whose build runs
15
+ * `bun build entry.ts --outdir dist` and `tailwindcss -o dist/app.css`, with a
16
+ * server reading `dist/index.html`, `dist/app.css` and `dist/entry.js`, reports
17
+ * exactly ONE dangle — `dist/index.html` — and the other two stay silent.
14
18
  *
15
19
  * Two seams consume this module:
16
20
  * • plan-time (auto-orchestrator): refs extracted from the SPEC's own snippets
@@ -19,26 +23,30 @@
19
23
  * `missing` list (forcing a round that assigns a producing task) and are
20
24
  * carried into `.pi-tasks/requirements.md` when still unowned at exhaustion.
21
25
  * • final gate: the shipped tree is scanned; a dangling reference is a ranked
22
- * failure naming referencer + missing path (rides PROMPT 1's aggregation).
26
+ * failure naming referencer + missing path.
23
27
  *
24
- * FP discipline (the run-12 groundedCoverage lesson — ground in artifacts the
25
- * model can't fake, and the standing guard direction inconclusive is NEVER
26
- * evidence):
27
- * literal string paths only; any dynamic expression steps aside.
28
+ * FP discipline — ground in artifacts the model cannot fake, and treat
29
+ * inconclusive as never being evidence. Each rule below was run:
30
+ * literal string paths only. A template hole, a bare variable and a
31
+ * concatenation each extract nothing; the literal beside them extracts.
28
32
  * • a ref is DANGLING only on POSITIVE producer evidence: it must sit under a
29
- * directory whose outputs we could actually ENUMERATE (parsed build
33
+ * directory whose outputs could actually be ENUMERATED (parsed build
30
34
  * script/flags) and not be among them — or be a missing source-extension
31
35
  * script entrypoint, which nothing ever builds. A ref under a directory
32
- * produced by machinery we could NOT enumerate (vite/tsc/next/unknown
33
- * commands that mention it) is OPAQUE and always steps aside.
36
+ * produced by machinery that could NOT be enumerated is OPAQUE and steps
37
+ * aside. Demonstrated on ONE tree by changing only the build command:
38
+ * `vite build` (opaque `dist`) reports zero dangles, while
39
+ * `bun build entry.ts --outdir dist` (enumerable `dist`) reports both refs.
34
40
  * • gitignored-but-built paths therefore never fire: being built means a
35
41
  * producer names them (exact file, enumerable stem, or opaque dir).
36
- * • existence is checked on the live tree (existsSync), so anything already
37
- * present — committed, generated, or hand-made — is satisfied.
42
+ * • existence is checked on the live tree, so anything already present —
43
+ * committed, generated or hand-made — is satisfied. Creating a GITIGNORED
44
+ * `dist/index.html` took the same tree from one dangle to none.
38
45
  *
39
- * Note the mx5 server GUARDED its read (`if (!(await htmlFile.exists())) return
40
- * c.notFound()`): an existence guard is exactly how the bug presents (permanent
41
- * 404), so guarded reads deliberately do NOT step aside.
46
+ * A GUARDED read does NOT step aside, deliberately. An existence guard
47
+ * (`if (!(await htmlFile.exists())) return c.notFound()`) is exactly how this bug
48
+ * presents — a permanent 404 rather than a crash — so the guard is a symptom, not
49
+ * an all-clear. Confirmed: the same ref flags with and without the guard.
42
50
  */
43
51
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
44
52
  import * as path from 'node:path';
@@ -52,9 +60,16 @@ export function emptyProducers() {
52
60
  outdirs: new Set()
53
61
  };
54
62
  }
55
- /** Normalize a literal path: posix separators, strip ./ prefixes, query/hash
56
- * tails (HTML), trailing slash. Returns null when the literal is not a
57
- * checkable relative path (URL, absolute, template hole, glob — step aside). */
63
+ /** Normalize a literal path: posix separators, strip `./` prefixes, query/hash
64
+ * tails (HTML), wrapping quotes, trailing slash. Returns null when the literal
65
+ * is not a checkable repo path a scheme URL, protocol-relative `//host/x`,
66
+ * `~`, a `${…}` hole, a glob, anything with embedded whitespace, and anything
67
+ * under `node_modules/`.
68
+ *
69
+ * A single leading `/` is NOT a rejection: it is treated as root-relative and
70
+ * resolved from the repo root, which is what `<script src="/app.js">` means.
71
+ * So `/app.js` normalizes to `app.js`. A drive-letter path like `C:\win\a.js`
72
+ * is rejected, but as a SCHEME, not as an absolute path. */
58
73
  export function normalizeRefPath(raw) {
59
74
  let p = raw.trim().replace(/\\/g, '/');
60
75
  // Markdown/shell wrapping (a spec bullet's `-o dist/app.css` arrives with a
@@ -147,26 +162,27 @@ export function extractHtmlRefs(source, referencer) {
147
162
  return out;
148
163
  }
149
164
  // ---------------------------------------------------------------------------
150
- // GENERATED HTML (nexttask 3, mx5 run 18).
165
+ // GENERATED HTML.
151
166
  //
152
- // The run-13 checker fired correctly on `src/server/index.ts dist/index.html`;
153
- // the autofix satisfied it by appending an HTML template literal to `build.ts`
154
- // and `Bun.write`ing it and that page pointed at `/app.css`, which `bun run
155
- // build` never emits (only the watch-mode `dev:css` does). The re-run gate saw
156
- // nothing, because the extractor scans HTML FILES and JS READS, never the HTML a
157
- // source GENERATES. So one dangling reference was closed by creating another one
158
- // indirection deeper.
167
+ // Without this pass there is a way to "fix" a dangle by moving it one
168
+ // indirection deeper. The extractor scans HTML FILES and JS READS; it does not
169
+ // see the HTML a source GENERATES. So a build script can satisfy a missing
170
+ // `dist/index.html` by writing one from a template literal and that page can
171
+ // point at an asset the production build never emits, which nothing then checks.
159
172
  //
160
173
  // Scope discipline, the reason this does not become an FP machine: a literal is
161
174
  // scanned ONLY when it reaches a write whose destination is an HTML file inside a
162
- // directory a BUILD TOOL declared as its output (`prod.outdirs`). An email-body
163
- // template (`~/hub/aiz-server/src/connections/mailTemplate.ts` `export default
164
- // \`<!doctype html>…\``) is never written to a build output and is therefore
165
- // never scanned, `<img src="cid:logo">` and all.
175
+ // directory a BUILD TOOL declared as its output (`prod.outdirs`). Both halves
176
+ // were run. The same `Bun.write("dist/index.html", …)` source yields refs when
177
+ // `dist` is a declared outdir and NOTHING when it is not; a write into `report/`
178
+ // enumerable, but never an outdir — yields nothing either. An email-body
179
+ // template that is only exported, never written, is not collected at all,
180
+ // `<img src="cid:logo">` and all.
166
181
  // ---------------------------------------------------------------------------
167
- /** Asset attributes scanned in GENERATED HTML. Wider than HTML_PATTERNS (which
168
- * keeps scanning on-disk .html files exactly as it always has) by the media
169
- * tags nexttask 3 names. */
182
+ /** Asset attributes scanned in GENERATED HTML: everything HTML_PATTERNS matches,
183
+ * plus `<source>`, `<video>` and `<audio>` src. On-disk `.html` files keep using
184
+ * the narrower HTML_PATTERNS confirmed, a `<video src>` in a real HTML file
185
+ * extracts nothing. */
170
186
  const GENERATED_HTML_PATTERNS = [
171
187
  ...HTML_PATTERNS,
172
188
  {
@@ -199,8 +215,10 @@ function readLiteral(src, i) {
199
215
  }
200
216
  return null;
201
217
  }
202
- /** `const NAME = <literal>` bindings (also let/var) the mx5 build.ts shape is
203
- * `const html = \`…\`` followed by `Bun.write('dist/index.html', html)`. */
218
+ /** `const NAME = <literal>` bindings (also let/var). The shape this exists for is
219
+ * a build script holding its page in a variable — `const html = \`…\`` followed by
220
+ * `Bun.write('dist/index.html', html)` — where the literal and the write are not
221
+ * the same expression. */
204
222
  function literalBindings(src) {
205
223
  const out = new Map();
206
224
  const re = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?=['"`])/g;
@@ -486,8 +504,11 @@ export function collectProducersFromCommand(cmd, prod, opts = {}) {
486
504
  * `writeFile(Sync)`, `createWriteStream`, `copyFile` dest, `mkdir(Sync)`),
487
505
  * `Bun.build({entrypoints, outdir})` (enumerable — unless a `naming` option
488
506
  * makes the output names underivable, then opaque), `outfile:`, and `Bun.spawn`
489
- * argv arrays re-fed through the shell-command collector (the mx5 build.ts
490
- * shape: tailwind's `-o dist/app.css` lives in a spawn array).
507
+ * argv arrays re-fed through the shell-command collector, for the build-script
508
+ * shape where a tool's `-o dist/app.css` lives inside a spawn array rather than
509
+ * in package.json. All four run as described: entrypoints give
510
+ * `dist{a,b}`, adding `naming` turns `dist` opaque and drops the stems, the spawn
511
+ * array yields `dist/app.css`, and `outfile:` yields its exact file.
491
512
  */
492
513
  export function collectProducersFromSource(source, prod) {
493
514
  const src = stripCommentLines(source);
@@ -637,15 +658,19 @@ function packageScripts(cwd) {
637
658
  /**
638
659
  * A WATCH/DEV script — one a production build never invokes.
639
660
  *
640
- * The load-bearing rule of nexttask 3 (mx5 run 18): `dist/app.css` had exactly
641
- * one producer, `dev:css` (`@tailwindcss/cli … -o dist/app.css --watch`), a
642
- * watch-mode dev script. The gate's own commands are `build`, `test`, `lint`
643
- * none of them runs it, so the shipped page loaded zero CSS while the closure
644
- * table happily reported the file "produced". A production artifact closed only
645
- * by a watch script is dangling by construction.
661
+ * The rule this exists for: a file whose ONLY producer is a watch-mode script —
662
+ * `dev:css` running `tailwindcss … -o dist/app.css --watch` — is not produced by
663
+ * a release at all. The gate runs `build`, `test`, `lint`; none of them invokes
664
+ * it, so the shipped page loads no CSS while a naive producer table reports the
665
+ * file "produced". A production artifact closed only by a watch script is
666
+ * dangling by construction.
646
667
  *
647
- * Deterministic and name-or-flag based, exactly as pre-registered: a script
648
- * whose NAME starts with `dev`/`watch`, or whose BODY carries `--watch`.
668
+ * Deterministic, name-or-flag based: a script whose NAME starts with
669
+ * `dev`/`watch` (bare or before `:`/`_`/`-`), or whose BODY carries `--watch`.
670
+ * Run across the edge cases — `development` and `predev` are NOT dev scripts,
671
+ * while a script literally named `build` running `tsc --watch` IS one. And
672
+ * end-to-end: with `excludeDevScripts`, a `dist/app.css` produced only by
673
+ * `dev:css` drops out of the producer table entirely.
649
674
  */
650
675
  export function isDevScript(name, body) {
651
676
  return /^(?:dev|watch)\b|^(?:dev|watch)[:._-]/i.test(name) || /(?:^|\s)--watch\b/.test(body);
@@ -666,7 +691,8 @@ export function discoverProducers(cwd, opts = {}) {
666
691
  for (const cmd of splitShellCommands(body)) {
667
692
  collectProducersFromCommand(cmd, prod);
668
693
  // A script that runs a local JS/TS file may produce through it —
669
- // parse that file's source too (the mx5 `bun build.ts` shape).
694
+ // parse that file's source too, for the `bun build.ts` shape where
695
+ // the real output flags live inside the script, not the command.
670
696
  for (const t of cmd.split(/\s+/)) {
671
697
  if (isPathToken(t) && /\.(?:ts|js|mjs|cjs)$/.test(t)) {
672
698
  const p = normalizeRefPath(t);
@@ -796,9 +822,9 @@ export function findDanglingArtifacts(cwd) {
796
822
  const prod = discoverProducers(cwd);
797
823
  // Second, PRODUCTION-only table: identical machinery minus watch/dev scripts.
798
824
  // Generated-HTML refs resolve against this one, so a file whose only producer
799
- // is `dev:css --watch` does not close a reference the built page makes
800
- // (nexttask 3's load-bearing rule). Everything else keeps resolving against
801
- // the full table, so no existing finding moves.
825
+ // is a `--watch` script does not close a reference the built page makes.
826
+ // Everything else keeps resolving against the full table, so widening the
827
+ // production view cannot move an existing finding.
802
828
  const prodProduction = discoverProducers(cwd, { excludeDevScripts: true });
803
829
  const refs = [];
804
830
  const sources = [];
@@ -880,9 +906,9 @@ export function danglingGateFailureText(d) {
880
906
  + `but nothing in the tree, build outputs, or scripts produces it — ${d.reason}`);
881
907
  }
882
908
  // ---------------------------------------------------------------------------
883
- // Plan-time seam: the SPEC's own snippets referencing artifacts the spec never
884
- // defines (mx5 run 13: DESIGN/PROJECT.md L224 required serving index.html; the
885
- // file tree (§7) and build section (§9) never defined it).
909
+ // Plan-time seam: the SPEC's own snippets and prose referencing artifacts the
910
+ // spec never defines a design document whose behaviour section requires
911
+ // serving `index.html` while its file tree and build section never produce it.
886
912
  // ---------------------------------------------------------------------------
887
913
  /** Does the spec LIST the file as its own artifact — a file-tree entry or a
888
914
  * bullet whose first token is (or ends with) the basename? Prose that merely
@@ -903,14 +929,16 @@ export function specListsFile(spec, refPath) {
903
929
  return false;
904
930
  }
905
931
  /** Consuming-side prose verbs: a spec sentence that SERVES/READS/LOADS a
906
- * backticked file is referencing it at runtime (mx5 run 13, the exact line:
907
- * "**SPA fallback:** non-`/api` GETs serve the built `index.html`."). */
932
+ * backticked file is referencing it at runtime the shape being a line like
933
+ * "**SPA fallback:** non-`/api` GETs serve the built `index.html`." */
908
934
  const PROSE_CONSUME_RE = /\b(?:serves?|serving|served|fallback|reads?|loads?|renders?)\b/i;
909
935
  /** Runtime-artifact extensions the prose channel accepts. Prose is the loosest
910
- * signal, so it is whitelist-tight: a backticked dotted identifier (`c.var.user`,
911
- * `Bun.password.hash` measured FPs on the real mx5 spec) must never read as a
912
- * file, and doc files a spec tells the READER to read (`README.md`) don't
913
- * count either. Code-construct refs are not subject to this list. */
936
+ * signal, so the list is a tight whitelist rather than a blocklist: a backticked
937
+ * dotted identifier must never read as a file, and neither must a doc file a
938
+ * spec tells the READER to open. Run on a consuming-verb line, `c.var.user`,
939
+ * `Bun.password.hash`, `foo.bar` and `README.md` all extract nothing, while
940
+ * `index.html`, `data/seed.json` and `assets/logo.svg` all extract.
941
+ * Code-construct refs are not subject to this list. */
914
942
  const PROSE_ASSET_EXT_RE = /\.(?:html?|css|m?js|cjs|json|svg|png|jpe?g|gif|webp|ico|woff2?|ttf|otf|wasm|webmanifest|xml|csv|sql|ya?ml|toml|pdf|mp[34]|db|sqlite)$/i;
915
943
  /** Backticked, asset-extension, path-shaped tokens on consuming-verb lines. */
916
944
  export function extractSpecProseRefs(spec) {
@@ -8,17 +8,23 @@ export interface CommitResult {
8
8
  /** UNTRACKED regenerable test-runner output this commit deliberately left out
9
9
  * of the index (see `stagePathspec`). Empty/absent when nothing was excluded.
10
10
  * Present so the caller can TRAIL it: a silent exclusion is the same failure
11
- * class as the silent ignored-path write nexttask 4 closed. */
11
+ * class as a silent write to an ignored path. */
12
12
  excluded?: string[];
13
13
  }
14
14
  /**
15
- * Does this git stderr describe a missing author identity? Seen live (mx5 run 4):
16
- * the headless docker container has no HOME gitconfig, so EVERY per-task commit
17
- * failed "Author identity unknown" which silently disabled enforce and every
18
- * commit-based differential guard for the whole run.
15
+ * Does this git stderr describe a missing author identity?
16
+ *
17
+ * The failure it catches is total rather than partial: with no usable gitconfig
18
+ * every per-task commit fails, which silently disables enforce and every
19
+ * commit-based differential guard for the rest of the run. Reproduced with real
20
+ * git — committing with `HOME` unset and both config files pointed at
21
+ * `/dev/null` prints "Author identity unknown" plus the `user.email` /
22
+ * `user.name` advice, and this predicate matches that text while rejecting an
23
+ * unrelated `fatal: not a git repository`.
19
24
  */
20
25
  export declare function isIdentityFailure(stderr: string): boolean;
21
- /** Fallback identity for environments with no git config (headless containers). */
26
+ /** Fallback identity for environments with no git config. Confirmed against real
27
+ * git: the same commit that fails with no identity succeeds with these args. */
22
28
  export declare const FALLBACK_IDENTITY_ARGS: readonly ["-c", "user.name=pi-task", "-c", "user.email=pi-task@local"];
23
29
  export declare function git(cwd: string, args: string[], signal: AbortSignal | undefined, spawnFn?: SpawnFn): Promise<{
24
30
  stdout: string;
@@ -31,40 +37,43 @@ export declare function git(cwd: string, args: string[], signal: AbortSignal | u
31
37
  * `test-results/`, `playwright-report/`, `coverage/`, `.nyc_output/`,
32
38
  * `.last-run.json`, `*.tsbuildinfo`.
33
39
  *
34
- * This is the other half of mx5 run 20. TASK_0027's snapshot ran a bare
35
- * `git add -A` over a tree the test run had just littered with three Playwright
36
- * FAILURE screenshots (`*-actual.png` written only when a screenshot assertion
37
- * fails), committed them, and thereby made them tracked deliverables. Two whole
38
- * final-gate fix attempts were then rejected for deleting them. The deletion guard
39
- * fix (write-guard.ts) stops the rejection; this stops the tracking.
40
+ * The failure this closes: a bare `git add -A` sweeps up whatever the test run
41
+ * just littered the tree with a failure screenshot, a coverage dir and commits
42
+ * it, making regenerable output a TRACKED deliverable. A later task that cleans it
43
+ * up then reads as deleting someone's work.
40
44
  *
41
45
  * ONLY UNTRACKED PATHS ARE EXCLUDED, and that is load-bearing rather than tidy.
42
- * `git ls-files --others` lists untracked, non-ignored files and nothing else, so a
43
- * path git ALREADY tracks can never appear here — meaning a project that
44
- * deliberately commits, say, a `coverage/` badge keeps having its edits to it
45
- * committed. Excluding by directory pathspec instead (`:(exclude)coverage/`) would
46
- * silently stop committing those.
46
+ * Both halves measured with real git in a repo with a gitignored `coverage/` and
47
+ * an untracked `test-results/`:
48
+ * `ls-files --others --exclude-standard` returned the untracked file alone;
49
+ * dropping the flag brought the gitignored one back too.
50
+ * a TRACKED file never appears, even while modified.
51
+ * So a project that deliberately commits, say, a `coverage/` badge keeps having
52
+ * its edits to it committed. Excluding by directory pathspec instead
53
+ * (`:(exclude)coverage/`) would silently stop committing those.
47
54
  *
48
- * Best-effort: any git failure yields an empty list, i.e. today's `git add -A`.
55
+ * Best-effort: any git failure yields an empty list, i.e. a plain `git add -A`.
49
56
  */
50
57
  export declare function untrackedArtifacts(cwd: string, signal?: AbortSignal, spawnFn?: SpawnFn): Promise<string[]>;
51
58
  /** `:(exclude)` pathspecs for `git add -A`; empty when nothing is excluded, so the
52
- * common case is byte-identical to the previous bare `git add -A`. */
59
+ * common case adds no arguments at all and stays a bare `git add -A`. */
53
60
  export declare function stagePathspec(excluded: readonly string[]): string[];
54
61
  /**
55
62
  * Paths with unmerged index entries (an in-progress merge conflict), deduped.
56
63
  * Empty outside a git repo or on any git error — this is a GUARD input, and a
57
64
  * guard that cannot conclude must not block.
58
65
  *
59
- * Why it exists (mx5 run 6): a stale `git stash pop` mid-task left two paths UU;
60
- * every later commit was doomed, three verify passes ran against a conflicted
61
- * tree, and worse a blind `git add -A` on that index would have silently
62
- * "resolved" the conflict with whatever happened to be on disk.
66
+ * Why it exists: with an unmerged index every later commit is doomed, verify runs
67
+ * against a conflicted tree, and worst a blind `git add -A` SILENTLY resolves
68
+ * the conflict with whatever is on disk. Reproduced on a real conflict: `git
69
+ * status` showed `UU c.txt`, then a bare `git add -A` turned it into `M c.txt`
70
+ * and left `ls-files -u` empty. The conflict markers become staged content and
71
+ * nothing says so.
63
72
  */
64
73
  export declare function gitUnmergedPaths(cwd: string, signal?: AbortSignal, spawnFn?: SpawnFn): Promise<string[]>;
65
74
  /** Sha of `refs/stash`, or null when there is no stash (or not a git repo). Used
66
75
  * to detect a stash created (or consumed) during a task and left behind — the
67
- * exact landmine that detonated mx5 run 6 two days after it was pushed. */
76
+ * exact landmine that detonates days after it is pushed. */
68
77
  export declare function gitStashRef(cwd: string, signal?: AbortSignal, spawnFn?: SpawnFn): Promise<string | null>;
69
78
  /**
70
79
  * Stage everything (`git add -A`) and commit it with `message`. Honors
@@ -81,17 +90,19 @@ export declare function gitCommitAll(cwd: string, message: string, signal?: Abor
81
90
  * verified task commit underneath it.
82
91
  *
83
92
  * `reset --hard` targets the enforce pass's in-place SOURCE edits. But it must NOT
84
- * rewind the forensic gate trail: `.pi-tasks/` is frequently TRACKED (the per-task
85
- * snapshots stage it via `git add -A`), so a bare reset restores TASK_00NN.md to the
86
- * snapshot commit and ERASES every trail line written after it the "commit: task
87
- * snapshot committed", "enforce(edit): …", and resolution lines (mx5 run 9:
88
- * TASK_0007/0008/0012 each lost their whole post-snapshot trail on this exact path,
89
- * so a passing-then-reverted task looked like it had never been committed). So the
90
- * trail is snapshotted before the reset and restored after the revert undoes code,
91
- * the audit log survives.
93
+ * rewind the forensic gate trail. `.pi-tasks/` is frequently TRACKED here — unlike
94
+ * the accept-debt ledger's writers, the per-task snapshot stages it with a plain
95
+ * `git add -A` and no exclusion so a bare reset rewinds the task file along with
96
+ * the source and ERASES every trail line written after the snapshot.
97
+ *
98
+ * Both halves were run on a real repo. A bare `reset --hard HEAD~1` restored the
99
+ * source AND dropped the trail line added after the snapshot; calling this
100
+ * function on the identical setup restored the source and kept that line. The
101
+ * revert undoes code, the audit log survives.
92
102
  *
93
- * Best-effort and never throws: a git failure is swallowed (the caller has
94
- * already decided to keep the verified work; a failed reset only leaves the
95
- * enforce commit in place, which is surfaced as a warning).
103
+ * Best-effort and never throws: a git failure is swallowed, since the caller has
104
+ * already decided to keep the verified work and a failed reset only leaves the
105
+ * enforce commit in place, which is surfaced as a warning. Called on a directory
106
+ * that is not a repo at all, it returns without throwing.
96
107
  */
97
108
  export declare function gitDropLastCommit(cwd: string, signal?: AbortSignal, spawnFn?: SpawnFn): Promise<void>;