@telora/daemon 0.22.189 → 0.22.226

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 (376) hide show
  1. package/build-info.json +6 -3
  2. package/dist/backends/index.d.ts.map +1 -1
  3. package/dist/backends/index.js +5 -1
  4. package/dist/backends/index.js.map +1 -1
  5. package/dist/completion/advancement-stall-watchdog.d.ts.map +1 -1
  6. package/dist/completion/advancement-stall-watchdog.js +6 -2
  7. package/dist/completion/advancement-stall-watchdog.js.map +1 -1
  8. package/dist/completion/completion-decision.d.ts +10 -1
  9. package/dist/completion/completion-decision.d.ts.map +1 -1
  10. package/dist/completion/completion-decision.js +1 -1
  11. package/dist/completion/completion-decision.js.map +1 -1
  12. package/dist/completion/completion-fact-readers.d.ts +35 -0
  13. package/dist/completion/completion-fact-readers.d.ts.map +1 -0
  14. package/dist/completion/completion-fact-readers.js +70 -0
  15. package/dist/completion/completion-fact-readers.js.map +1 -0
  16. package/dist/completion/delivery-advancement-guard.d.ts +31 -16
  17. package/dist/completion/delivery-advancement-guard.d.ts.map +1 -1
  18. package/dist/completion/delivery-advancement-guard.js +22 -37
  19. package/dist/completion/delivery-advancement-guard.js.map +1 -1
  20. package/dist/completion/detector.d.ts.map +1 -1
  21. package/dist/completion/detector.js +3 -1
  22. package/dist/completion/detector.js.map +1 -1
  23. package/dist/completion/event-dep-defaults.d.ts +27 -0
  24. package/dist/completion/event-dep-defaults.d.ts.map +1 -0
  25. package/dist/completion/event-dep-defaults.js +30 -0
  26. package/dist/completion/event-dep-defaults.js.map +1 -0
  27. package/dist/completion/event-phases.d.ts +19 -8
  28. package/dist/completion/event-phases.d.ts.map +1 -1
  29. package/dist/completion/event-phases.js +72 -101
  30. package/dist/completion/event-phases.js.map +1 -1
  31. package/dist/completion/event.d.ts +44 -9
  32. package/dist/completion/event.d.ts.map +1 -1
  33. package/dist/completion/event.js +36 -27
  34. package/dist/completion/event.js.map +1 -1
  35. package/dist/completion/index.js +1 -1
  36. package/dist/completion/progress-snapshot.d.ts +13 -9
  37. package/dist/completion/progress-snapshot.d.ts.map +1 -1
  38. package/dist/completion/progress-snapshot.js +16 -13
  39. package/dist/completion/progress-snapshot.js.map +1 -1
  40. package/dist/completion/reengagement-redrive.d.ts +8 -1
  41. package/dist/completion/reengagement-redrive.d.ts.map +1 -1
  42. package/dist/completion/reengagement-redrive.js +16 -2
  43. package/dist/completion/reengagement-redrive.js.map +1 -1
  44. package/dist/completion/session-hold.d.ts +13 -1
  45. package/dist/completion/session-hold.d.ts.map +1 -1
  46. package/dist/completion/session-hold.js +18 -0
  47. package/dist/completion/session-hold.js.map +1 -1
  48. package/dist/completion/state-cascade.d.ts.map +1 -1
  49. package/dist/completion/state-cascade.js +11 -19
  50. package/dist/completion/state-cascade.js.map +1 -1
  51. package/dist/completion/team-phase.d.ts.map +1 -1
  52. package/dist/completion/team-phase.js +1 -0
  53. package/dist/completion/team-phase.js.map +1 -1
  54. package/dist/completion/team-progress-measure.d.ts +70 -0
  55. package/dist/completion/team-progress-measure.d.ts.map +1 -0
  56. package/dist/completion/team-progress-measure.js +285 -0
  57. package/dist/completion/team-progress-measure.js.map +1 -0
  58. package/dist/completion/team-stillness.d.ts +76 -0
  59. package/dist/completion/team-stillness.d.ts.map +1 -0
  60. package/dist/completion/team-stillness.js +96 -0
  61. package/dist/completion/team-stillness.js.map +1 -0
  62. package/dist/completion/unclaimed-migration-notice-phase.d.ts +97 -0
  63. package/dist/completion/unclaimed-migration-notice-phase.d.ts.map +1 -0
  64. package/dist/completion/unclaimed-migration-notice-phase.js +270 -0
  65. package/dist/completion/unclaimed-migration-notice-phase.js.map +1 -0
  66. package/dist/completion/worker-wait.d.ts +84 -0
  67. package/dist/completion/worker-wait.d.ts.map +1 -0
  68. package/dist/completion/worker-wait.js +89 -0
  69. package/dist/completion/worker-wait.js.map +1 -0
  70. package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
  71. package/dist/delivery/delivery-advance-block.js +1 -2
  72. package/dist/delivery/delivery-advance-block.js.map +1 -1
  73. package/dist/directive/directive-executor.d.ts.map +1 -1
  74. package/dist/directive/directive-executor.js +1 -20
  75. package/dist/directive/directive-executor.js.map +1 -1
  76. package/dist/focus/focus-executor.d.ts +1 -0
  77. package/dist/focus/focus-executor.d.ts.map +1 -1
  78. package/dist/focus/focus-executor.js +18 -17
  79. package/dist/focus/focus-executor.js.map +1 -1
  80. package/dist/focus/focus-lifecycle.d.ts.map +1 -1
  81. package/dist/focus/focus-lifecycle.js +7 -1
  82. package/dist/focus/focus-lifecycle.js.map +1 -1
  83. package/dist/focus/focus-team-state.js +1 -1
  84. package/dist/focus/focus-worktree-state.d.ts.map +1 -1
  85. package/dist/focus/focus-worktree-state.js +2 -1
  86. package/dist/focus/focus-worktree-state.js.map +1 -1
  87. package/dist/focus/listener-spawn.d.ts.map +1 -1
  88. package/dist/focus/listener-spawn.js +5 -20
  89. package/dist/focus/listener-spawn.js.map +1 -1
  90. package/dist/focus/listener-state.d.ts.map +1 -1
  91. package/dist/focus/listener-state.js +1 -0
  92. package/dist/focus/listener-state.js.map +1 -1
  93. package/dist/focus/listener.d.ts +1 -0
  94. package/dist/focus/listener.d.ts.map +1 -1
  95. package/dist/focus/listener.js +9 -0
  96. package/dist/focus/listener.js.map +1 -1
  97. package/dist/focus/migration-claim-pass.d.ts +50 -0
  98. package/dist/focus/migration-claim-pass.d.ts.map +1 -0
  99. package/dist/focus/migration-claim-pass.js +234 -0
  100. package/dist/focus/migration-claim-pass.js.map +1 -0
  101. package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -1
  102. package/dist/focus/pending-spawn-pass-deps.js +2 -1
  103. package/dist/focus/pending-spawn-pass-deps.js.map +1 -1
  104. package/dist/focus/team-actionable-work.d.ts +21 -0
  105. package/dist/focus/team-actionable-work.d.ts.map +1 -1
  106. package/dist/focus/team-actionable-work.js +3 -0
  107. package/dist/focus/team-actionable-work.js.map +1 -1
  108. package/dist/git/focus-integration-sync.d.ts +42 -4
  109. package/dist/git/focus-integration-sync.d.ts.map +1 -1
  110. package/dist/git/focus-integration-sync.js +53 -9
  111. package/dist/git/focus-integration-sync.js.map +1 -1
  112. package/dist/git/types.d.ts.map +1 -1
  113. package/dist/git/types.js +4 -1
  114. package/dist/git/types.js.map +1 -1
  115. package/dist/loops/llm-client.d.ts.map +1 -1
  116. package/dist/loops/llm-client.js +11 -1
  117. package/dist/loops/llm-client.js.map +1 -1
  118. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  119. package/dist/merge/merge-back-loop.js +0 -1
  120. package/dist/merge/merge-back-loop.js.map +1 -1
  121. package/dist/migrations/migration-claim-lifecycle.d.ts +166 -0
  122. package/dist/migrations/migration-claim-lifecycle.d.ts.map +1 -0
  123. package/dist/migrations/migration-claim-lifecycle.js +198 -0
  124. package/dist/migrations/migration-claim-lifecycle.js.map +1 -0
  125. package/dist/migrations/migration-held-set.d.ts +171 -0
  126. package/dist/migrations/migration-held-set.d.ts.map +1 -0
  127. package/dist/migrations/migration-held-set.js +295 -0
  128. package/dist/migrations/migration-held-set.js.map +1 -0
  129. package/dist/migrations/migration-inventory.d.ts +187 -0
  130. package/dist/migrations/migration-inventory.d.ts.map +1 -0
  131. package/dist/migrations/migration-inventory.js +253 -0
  132. package/dist/migrations/migration-inventory.js.map +1 -0
  133. package/dist/migrations/migration-manifest.d.ts +114 -0
  134. package/dist/migrations/migration-manifest.d.ts.map +1 -0
  135. package/dist/migrations/migration-manifest.js +295 -0
  136. package/dist/migrations/migration-manifest.js.map +1 -0
  137. package/dist/prompt/team-prompt-base.js +1 -1
  138. package/dist/prompt-sections/migration-numbering-section.d.ts +58 -0
  139. package/dist/prompt-sections/migration-numbering-section.d.ts.map +1 -0
  140. package/dist/prompt-sections/migration-numbering-section.js +70 -0
  141. package/dist/prompt-sections/migration-numbering-section.js.map +1 -0
  142. package/dist/prompt-sections/migration-numbering-state.d.ts +30 -0
  143. package/dist/prompt-sections/migration-numbering-state.d.ts.map +1 -0
  144. package/dist/prompt-sections/migration-numbering-state.js +24 -0
  145. package/dist/prompt-sections/migration-numbering-state.js.map +1 -0
  146. package/dist/prompt-sections/unclaimed-migration-section.d.ts +38 -0
  147. package/dist/prompt-sections/unclaimed-migration-section.d.ts.map +1 -0
  148. package/dist/prompt-sections/unclaimed-migration-section.js +57 -0
  149. package/dist/prompt-sections/unclaimed-migration-section.js.map +1 -0
  150. package/dist/queries/claim-pass-focuses.d.ts +19 -0
  151. package/dist/queries/claim-pass-focuses.d.ts.map +1 -0
  152. package/dist/queries/claim-pass-focuses.js +72 -0
  153. package/dist/queries/claim-pass-focuses.js.map +1 -0
  154. package/dist/queries/daemon-connection.d.ts.map +1 -1
  155. package/dist/queries/daemon-connection.js +1 -0
  156. package/dist/queries/daemon-connection.js.map +1 -1
  157. package/dist/queries/deliveries.d.ts.map +1 -1
  158. package/dist/queries/deliveries.js +3 -1
  159. package/dist/queries/deliveries.js.map +1 -1
  160. package/dist/queries/delivery-gate-state.js +1 -1
  161. package/dist/queries/escalation-suppression.js +1 -1
  162. package/dist/queries/focus-discovery.d.ts +25 -2
  163. package/dist/queries/focus-discovery.d.ts.map +1 -1
  164. package/dist/queries/focus-discovery.js +16 -9
  165. package/dist/queries/focus-discovery.js.map +1 -1
  166. package/dist/queries/focus-integration-conflict.d.ts +7 -4
  167. package/dist/queries/focus-integration-conflict.d.ts.map +1 -1
  168. package/dist/queries/focus-integration-conflict.js +6 -3
  169. package/dist/queries/focus-integration-conflict.js.map +1 -1
  170. package/dist/queries/focus-unclaimed-migration.d.ts +146 -0
  171. package/dist/queries/focus-unclaimed-migration.d.ts.map +1 -0
  172. package/dist/queries/focus-unclaimed-migration.js +266 -0
  173. package/dist/queries/focus-unclaimed-migration.js.map +1 -0
  174. package/dist/queries/live-focus-branches.d.ts +32 -0
  175. package/dist/queries/live-focus-branches.d.ts.map +1 -0
  176. package/dist/queries/live-focus-branches.js +66 -0
  177. package/dist/queries/live-focus-branches.js.map +1 -0
  178. package/dist/queries/migration-claims.d.ts +25 -0
  179. package/dist/queries/migration-claims.d.ts.map +1 -0
  180. package/dist/queries/migration-claims.js +79 -0
  181. package/dist/queries/migration-claims.js.map +1 -0
  182. package/dist/queries/schemas.d.ts +17 -0
  183. package/dist/queries/schemas.d.ts.map +1 -1
  184. package/dist/queries/schemas.js +18 -1
  185. package/dist/queries/schemas.js.map +1 -1
  186. package/dist/queries/shared.js +1 -1
  187. package/dist/queries/shortfall-park-record.d.ts +6 -1
  188. package/dist/queries/shortfall-park-record.d.ts.map +1 -1
  189. package/dist/queries/shortfall-park-record.js.map +1 -1
  190. package/dist/queries/shortfall-rulings.d.ts +14 -2
  191. package/dist/queries/shortfall-rulings.d.ts.map +1 -1
  192. package/dist/queries/shortfall-rulings.js +17 -3
  193. package/dist/queries/shortfall-rulings.js.map +1 -1
  194. package/dist/queries/verification.js +1 -1
  195. package/dist/queries/verify-own-holds.d.ts.map +1 -1
  196. package/dist/queries/verify-own-holds.js +1 -0
  197. package/dist/queries/verify-own-holds.js.map +1 -1
  198. package/dist/session/session-lineage.d.ts.map +1 -1
  199. package/dist/session/session-lineage.js +3 -0
  200. package/dist/session/session-lineage.js.map +1 -1
  201. package/dist/shell/heartbeat-metadata.d.ts +48 -2
  202. package/dist/shell/heartbeat-metadata.d.ts.map +1 -1
  203. package/dist/shell/heartbeat-metadata.js +80 -3
  204. package/dist/shell/heartbeat-metadata.js.map +1 -1
  205. package/dist/shell/heartbeat.d.ts +13 -0
  206. package/dist/shell/heartbeat.d.ts.map +1 -1
  207. package/dist/shell/heartbeat.js +31 -10
  208. package/dist/shell/heartbeat.js.map +1 -1
  209. package/dist/shell/mcp-resolution.js +1 -1
  210. package/dist/shell/mcp-resolution.js.map +1 -1
  211. package/dist/shell/migration-held-set-publish.d.ts +170 -0
  212. package/dist/shell/migration-held-set-publish.d.ts.map +1 -0
  213. package/dist/shell/migration-held-set-publish.js +172 -0
  214. package/dist/shell/migration-held-set-publish.js.map +1 -0
  215. package/dist/shell/worker-pidfile.d.ts.map +1 -1
  216. package/dist/shell/worker-pidfile.js +1 -0
  217. package/dist/shell/worker-pidfile.js.map +1 -1
  218. package/dist/spawn/helpers.d.ts.map +1 -1
  219. package/dist/spawn/helpers.js +10 -1
  220. package/dist/spawn/helpers.js.map +1 -1
  221. package/dist/spawn/lead-continuation.d.ts +10 -2
  222. package/dist/spawn/lead-continuation.d.ts.map +1 -1
  223. package/dist/spawn/lead-continuation.js +39 -22
  224. package/dist/spawn/lead-continuation.js.map +1 -1
  225. package/dist/spawn/lead-launch.d.ts.map +1 -1
  226. package/dist/spawn/lead-launch.js +1 -0
  227. package/dist/spawn/lead-launch.js.map +1 -1
  228. package/dist/spawn/lead-process-ownership.d.ts.map +1 -1
  229. package/dist/spawn/lead-process-ownership.js +1 -0
  230. package/dist/spawn/lead-process-ownership.js.map +1 -1
  231. package/dist/spawn/one-shot-model.d.ts.map +1 -1
  232. package/dist/spawn/one-shot-model.js +1 -0
  233. package/dist/spawn/one-shot-model.js.map +1 -1
  234. package/dist/spawn/process-group-kill.d.ts.map +1 -1
  235. package/dist/spawn/process-group-kill.js +1 -0
  236. package/dist/spawn/process-group-kill.js.map +1 -1
  237. package/dist/spawn/process-spawn.d.ts +18 -1
  238. package/dist/spawn/process-spawn.d.ts.map +1 -1
  239. package/dist/spawn/process-spawn.js +11 -6
  240. package/dist/spawn/process-spawn.js.map +1 -1
  241. package/dist/spawn/prompt-assembly.d.ts +115 -18
  242. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  243. package/dist/spawn/prompt-assembly.js +121 -2
  244. package/dist/spawn/prompt-assembly.js.map +1 -1
  245. package/dist/spawn/spawn-and-acknowledge.d.ts +61 -0
  246. package/dist/spawn/spawn-and-acknowledge.d.ts.map +1 -0
  247. package/dist/spawn/spawn-and-acknowledge.js +117 -0
  248. package/dist/spawn/spawn-and-acknowledge.js.map +1 -0
  249. package/dist/spawn/spawn-cooldown.js +1 -1
  250. package/dist/spawn/spawn-decision.d.ts +10 -10
  251. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  252. package/dist/spawn/spawn-decision.js +33 -5
  253. package/dist/spawn/spawn-decision.js.map +1 -1
  254. package/dist/spawn/worktree-session.d.ts.map +1 -1
  255. package/dist/spawn/worktree-session.js +11 -1
  256. package/dist/spawn/worktree-session.js.map +1 -1
  257. package/dist/templates/claude-md.d.ts +1 -1
  258. package/dist/templates/claude-md.d.ts.map +1 -1
  259. package/dist/templates/claude-md.js +24 -0
  260. package/dist/templates/claude-md.js.map +1 -1
  261. package/dist/testing/fixtures/conflicting-repo.d.ts +17 -0
  262. package/dist/testing/fixtures/conflicting-repo.d.ts.map +1 -1
  263. package/dist/testing/fixtures/conflicting-repo.js +31 -0
  264. package/dist/testing/fixtures/conflicting-repo.js.map +1 -1
  265. package/dist/testing/fixtures/index.d.ts.map +1 -1
  266. package/dist/testing/fixtures/index.js +1 -2
  267. package/dist/testing/fixtures/index.js.map +1 -1
  268. package/dist/testing/fixtures/migration-namespace-repo.d.ts +63 -0
  269. package/dist/testing/fixtures/migration-namespace-repo.d.ts.map +1 -0
  270. package/dist/testing/fixtures/migration-namespace-repo.js +164 -0
  271. package/dist/testing/fixtures/migration-namespace-repo.js.map +1 -0
  272. package/dist/testing/fixtures/stubborn-lead-process.d.ts.map +1 -1
  273. package/dist/testing/fixtures/stubborn-lead-process.js +1 -0
  274. package/dist/testing/fixtures/stubborn-lead-process.js.map +1 -1
  275. package/dist/types/focus.d.ts +59 -26
  276. package/dist/types/focus.d.ts.map +1 -1
  277. package/dist/types/index.js +1 -1
  278. package/dist/verify/commit-verdict-pull.d.ts +28 -3
  279. package/dist/verify/commit-verdict-pull.d.ts.map +1 -1
  280. package/dist/verify/commit-verdict-pull.js +160 -23
  281. package/dist/verify/commit-verdict-pull.js.map +1 -1
  282. package/dist/verify/credit-rearm.d.ts.map +1 -1
  283. package/dist/verify/credit-rearm.js +72 -17
  284. package/dist/verify/credit-rearm.js.map +1 -1
  285. package/dist/verify/default-on-guards.d.ts +54 -8
  286. package/dist/verify/default-on-guards.d.ts.map +1 -1
  287. package/dist/verify/default-on-guards.js +132 -17
  288. package/dist/verify/default-on-guards.js.map +1 -1
  289. package/dist/verify/explicit-rearm.d.ts.map +1 -1
  290. package/dist/verify/explicit-rearm.js +1 -0
  291. package/dist/verify/explicit-rearm.js.map +1 -1
  292. package/dist/verify/explicit-row-selection.d.ts +47 -0
  293. package/dist/verify/explicit-row-selection.d.ts.map +1 -0
  294. package/dist/verify/explicit-row-selection.js +37 -0
  295. package/dist/verify/explicit-row-selection.js.map +1 -0
  296. package/dist/verify/gate-run-registry.d.ts.map +1 -1
  297. package/dist/verify/gate-run-registry.js +2 -0
  298. package/dist/verify/gate-run-registry.js.map +1 -1
  299. package/dist/verify/no-own-delta-verdict.d.ts +16 -2
  300. package/dist/verify/no-own-delta-verdict.d.ts.map +1 -1
  301. package/dist/verify/no-own-delta-verdict.js +18 -2
  302. package/dist/verify/no-own-delta-verdict.js.map +1 -1
  303. package/dist/verify/parked-shortfall-reuse.d.ts +194 -0
  304. package/dist/verify/parked-shortfall-reuse.d.ts.map +1 -0
  305. package/dist/verify/parked-shortfall-reuse.js +310 -0
  306. package/dist/verify/parked-shortfall-reuse.js.map +1 -0
  307. package/dist/verify/reselection-log.d.ts +22 -0
  308. package/dist/verify/reselection-log.d.ts.map +1 -0
  309. package/dist/verify/reselection-log.js +87 -0
  310. package/dist/verify/reselection-log.js.map +1 -0
  311. package/dist/verify/shortfall-park.d.ts +8 -1
  312. package/dist/verify/shortfall-park.d.ts.map +1 -1
  313. package/dist/verify/shortfall-park.js +17 -3
  314. package/dist/verify/shortfall-park.js.map +1 -1
  315. package/dist/verify/shortfall-repeat.d.ts.map +1 -1
  316. package/dist/verify/shortfall-repeat.js +7 -2
  317. package/dist/verify/shortfall-repeat.js.map +1 -1
  318. package/dist/verify/shortfall-rulings.d.ts +93 -6
  319. package/dist/verify/shortfall-rulings.d.ts.map +1 -1
  320. package/dist/verify/shortfall-rulings.js +69 -12
  321. package/dist/verify/shortfall-rulings.js.map +1 -1
  322. package/dist/verify/stall-detector-config.d.ts.map +1 -1
  323. package/dist/verify/stall-detector-config.js +2 -1
  324. package/dist/verify/stall-detector-config.js.map +1 -1
  325. package/dist/verify/stall-detectors.d.ts +6 -4
  326. package/dist/verify/stall-detectors.d.ts.map +1 -1
  327. package/dist/verify/stall-detectors.js +9 -6
  328. package/dist/verify/stall-detectors.js.map +1 -1
  329. package/dist/verify/stalled-team-backstop.d.ts +8 -2
  330. package/dist/verify/stalled-team-backstop.d.ts.map +1 -1
  331. package/dist/verify/stalled-team-backstop.js +15 -11
  332. package/dist/verify/stalled-team-backstop.js.map +1 -1
  333. package/dist/verify/team-stall-reapers.d.ts +28 -0
  334. package/dist/verify/team-stall-reapers.d.ts.map +1 -0
  335. package/dist/verify/team-stall-reapers.js +23 -0
  336. package/dist/verify/team-stall-reapers.js.map +1 -0
  337. package/dist/verify/verification-attribution-deps.d.ts +1 -1
  338. package/dist/verify/verification-attribution-deps.d.ts.map +1 -1
  339. package/dist/verify/verification-attribution-deps.js +20 -1
  340. package/dist/verify/verification-attribution-deps.js.map +1 -1
  341. package/dist/verify/verification-boundary-env.d.ts.map +1 -1
  342. package/dist/verify/verification-boundary-env.js +23 -9
  343. package/dist/verify/verification-boundary-env.js.map +1 -1
  344. package/dist/verify/verification-checkout.d.ts +1 -1
  345. package/dist/verify/verification-checkout.d.ts.map +1 -1
  346. package/dist/verify/verification-checkout.js.map +1 -1
  347. package/dist/verify/verification-commit-sharing.d.ts.map +1 -1
  348. package/dist/verify/verification-commit-sharing.js +14 -3
  349. package/dist/verify/verification-commit-sharing.js.map +1 -1
  350. package/dist/verify/verification-config.d.ts.map +1 -1
  351. package/dist/verify/verification-config.js +1 -20
  352. package/dist/verify/verification-config.js.map +1 -1
  353. package/dist/verify/verification-default-on.d.ts +4 -1
  354. package/dist/verify/verification-default-on.d.ts.map +1 -1
  355. package/dist/verify/verification-default-on.js +29 -2
  356. package/dist/verify/verification-default-on.js.map +1 -1
  357. package/dist/verify/verification-deps-default.d.ts.map +1 -1
  358. package/dist/verify/verification-deps-default.js +13 -0
  359. package/dist/verify/verification-deps-default.js.map +1 -1
  360. package/dist/verify/verification-deps.d.ts +38 -0
  361. package/dist/verify/verification-deps.d.ts.map +1 -1
  362. package/dist/verify/verification-deps.js +2 -1
  363. package/dist/verify/verification-deps.js.map +1 -1
  364. package/dist/verify/verification-engine.d.ts.map +1 -1
  365. package/dist/verify/verification-engine.js +44 -15
  366. package/dist/verify/verification-engine.js.map +1 -1
  367. package/dist/verify/verification-feedback.d.ts.map +1 -1
  368. package/dist/verify/verification-feedback.js +1 -19
  369. package/dist/verify/verification-feedback.js.map +1 -1
  370. package/dist/verify/verify-restatement.d.ts.map +1 -1
  371. package/dist/verify/verify-restatement.js +5 -1
  372. package/dist/verify/verify-restatement.js.map +1 -1
  373. package/dist/worktree/provision.d.ts.map +1 -1
  374. package/dist/worktree/provision.js +3 -1
  375. package/dist/worktree/provision.js.map +1 -1
  376. package/package.json +2 -2
@@ -0,0 +1,194 @@
1
+ /**
2
+ * A PARKED shortfall is REUSED, not re-judged, while its commit set and its
3
+ * rulings are unchanged.
4
+ *
5
+ * WHY. The verify gate already works this way about the SUITE: a commit whose
6
+ * verdict is recorded is not run again (verify/verification-commit-sharing.ts
7
+ * readReusableVerdict). The RECONCILIATION did not: the engine called
8
+ * `authorTargetRestatements` -- a ~28s `claude --print` one-shot -- on every
9
+ * dispatch whose gate verdict was passed, and consulted the delivery's shortfall
10
+ * park only afterwards, in routing. So however a parked delivery reached dispatch
11
+ * it paid a model call to re-derive a shortfall the park already records by commit
12
+ * set and signature. Measured 2026-09-24: delivery 8ae80225, parked at 06:25Z on
13
+ * commit set `15:2b25de49`, made ~30 reconciliation calls (median 28s) between
14
+ * 06:08Z and 06:54Z at an unchanged HEAD; the one at 06:50Z failed with
15
+ * "verify-reconciliation: model unavailable (auth)", proving each dispatch really
16
+ * was calling the model. A sibling delivery closed the re-dispatch path that fed
17
+ * that loop; this module bounds the COST of any re-dispatch path, including ones
18
+ * not yet found.
19
+ *
20
+ * WHAT IS REUSED. Not a cached verdict -- the park's OWN record. The gaps are
21
+ * rebuilt VERBATIM from the shortfall detail standing on the same gate_state
22
+ * (`shortfallReconciliation.shortfalls`: declared / achieved / reason /
23
+ * diffCitation as the judging pass wrote them), and the rebuild is accepted only
24
+ * when it reproduces the park's own signature (`sameShortfallSignature`). So the
25
+ * routing that follows is the routing a fresh IDENTICAL judgement would produce:
26
+ * the same demotion to 'failed', the same park re-hold with its original
27
+ * `parkedAt`, the same cause-keyed escalation (already deduped in
28
+ * verify/shortfall-park-escalation.ts, so nothing is re-filed) and the same
29
+ * gate_state detail. What it does NOT do is call the model.
30
+ *
31
+ * WHEN IT IS REFUSED -- every one of these judges instead, so the reuse can only
32
+ * ever remove a model call, never a judgement:
33
+ * - no standing park refusing re-work (verify/shortfall-park.ts
34
+ * shortfallParkRefusingRework: a park on a delivery in verify);
35
+ * - the CURRENT commit set could not be read, or differs from the park's, or
36
+ * the park itself recorded none. A null fingerprint means the read FAILED and
37
+ * must never match;
38
+ * - the CURRENT rulings fingerprint could not be read, or differs from the
39
+ * park's, or the PARK carries none. A park's fingerprint is PRESENT exactly
40
+ * when the judgement that recorded it could READ the rulings: '' is a
41
+ * succeeded read of an empty set ("no ruling was in force"), and the field is
42
+ * absent only where the read FAILED (shortfall-park.ts classifyShortfallPark).
43
+ * So an absent one is a park whose ruling history is UNKNOWN and is refused
44
+ * ('park-rulings-unknown') rather than coerced to '' -- coercing it would let
45
+ * a park recorded while the rulings were unreadable be answered from after a
46
+ * later successful EMPTY read, as though the unknown had been known-empty.
47
+ * The recorder is why this can be strict: the previous cycle read an absent
48
+ * fingerprint as '' because requiring presence would otherwise have made the
49
+ * reuse inert for the measured incident (an ordinary no-rulings park wrote no
50
+ * field at all). With the recorder fixed there is no such dilemma -- a
51
+ * known-empty park records '' and reuses, an unknown one judges. A park
52
+ * WRITTEN BY THE OLD RECORDER carries no field even where the rulings were
53
+ * readable and empty: it refuses ONCE, that judgement re-holds it carrying
54
+ * '', and reuse resumes -- the one reconciliation after recovery, no more.
55
+ * Any ruling landing since (an operator row, or an approving review's node
56
+ * verdict arriving through the same reader as `ruledByKind: 'review'`)
57
+ * changes the fingerprint and re-judges exactly once, after which the park
58
+ * carries the new fingerprint and matches again;
59
+ * - the gate_state carries an AWAITED-MODEL hold (`modelUnavailable`,
60
+ * verify/verification-model-unavailable-hold.ts). A park is never WRITTEN by
61
+ * that path -- the engine routes no shortfall when the model was not reached
62
+ * -- but a later tick can leave the hold standing beside a park, and then the
63
+ * last thing that happened to this delivery was a non-judgement. The hold
64
+ * exists precisely so the next tick re-judges the same commit, so this
65
+ * refuses rather than answering from a record the hold sits on top of. It is
66
+ * self-clearing: the first reconciliation that renders rebuilds gate_state
67
+ * without it, and reuse resumes on the tick after;
68
+ * - the gaps cannot be rebuilt from the standing detail, or the rebuild does
69
+ * not reproduce the park's signature (a legacy park, or a writer that
70
+ * replaced the live detail). One judgement re-establishes the detail;
71
+ * - the rebuilt gaps look like a FAILED reconciliation rather than a judgement:
72
+ * a non-ModelUnavailable throw is signed as a whole-injection shortfall
73
+ * (classifyReconciliationThrow), which names the INJECTION node and carries
74
+ * the '(unknown -- reconciliation failed)' declared statement. That is an
75
+ * error, not a verdict, so it is re-attempted rather than reused.
76
+ *
77
+ * WHAT STAYS REACHABLE, AND WHAT DOES NOT. The engine resolves the delivery's
78
+ * evidence before asking this: those are git and record reads every dispatch pays
79
+ * anyway, and leaving them unconditional keeps the pass path one shape. Their
80
+ * instrument-fault branch is then unreachable on a reused dispatch, on purpose --
81
+ * it routes the delivery to bounded RE-WORK, which is exactly what a standing park
82
+ * refuses (shortfallParkRefusingRework), so a blind bundle on a parked delivery
83
+ * must re-hold the park rather than send it back to coding. Everything after the
84
+ * reconciliation is reached exactly as a fresh judgement reaches it: the inward
85
+ * shortfall drift, the routing, the park's escalation, the recorded-targets report
86
+ * (left untouched -- a reused dispatch learned nothing new about arm coverage).
87
+ *
88
+ * WHAT IT DELIBERATELY DOES NOT WIDEN. Reuse is keyed on exactly the two facts
89
+ * the park's own release rule is keyed on (shortfall-park.ts
90
+ * isShortfallParkReleased: the commit set and the rulings fingerprint). Anything
91
+ * that does not release the park does not release the reuse either -- the park
92
+ * already governs whether such a delivery is judged at all, and a second,
93
+ * differently-keyed opinion here would be a way for the two to disagree.
94
+ *
95
+ * The DECISION is pure (decideParkedShortfallReuse) and takes the facts; only
96
+ * resolveParkedShortfallReuse reads them, through the engine's dep seam.
97
+ *
98
+ * @module verify/parked-shortfall-reuse
99
+ */
100
+ import { type ShortfallPark } from './shortfall-park.js';
101
+ import type { DeliveryGateRecord } from '../queries/deliveries.js';
102
+ import type { ShortfallReconciliationDetail } from '../queries/delivery-gate-state.js';
103
+ import type { PendingVerification } from '../queries/verification.js';
104
+ import type { RuledReconciliation, ShortfallRulingsReader } from './shortfall-rulings.js';
105
+ import type { TargetShortfall } from './verify-restatement.js';
106
+ /** Why a dispatch judged instead of reusing the park. Named so the log says which fact refused. */
107
+ export type ParkReuseRefusal = 'no-park' | 'awaiting-model' | 'park-commit-set-unknown' | 'commit-set-unknown' | 'commit-set-changed' | 'park-rulings-unknown' | 'rulings-unknown' | 'rulings-changed' | 'gaps-not-reconstructable' | 'not-a-judgement';
108
+ /** What a dispatch knows about the delivery's park before it would call the model. */
109
+ export interface ParkedShortfallFacts {
110
+ /** The standing park that refuses re-work (shortfallParkRefusingRework), or null. */
111
+ park: ShortfallPark | null;
112
+ /** The shortfall detail standing on the same gate_state -- the judged gaps, verbatim. */
113
+ detail: ShortfallReconciliationDetail | null;
114
+ /** True when the same gate_state carries the awaited-model hold. */
115
+ awaitingModel: boolean;
116
+ /** The delivery's CURRENT commit-set fingerprint; null when it could not be read. */
117
+ commitSet: string | null;
118
+ /** The delivery's CURRENT rulings fingerprint; null when it could not be read. */
119
+ rulingsFingerprint: string | null;
120
+ /** The injection this dispatch judges (a gap naming it is a failed reconciliation). */
121
+ injectionNodeId: string;
122
+ }
123
+ /** Reuse the park's judgement, or judge afresh (and why). */
124
+ export type ParkedShortfallDecision = {
125
+ reuse: true;
126
+ park: ShortfallPark;
127
+ shortfalls: TargetShortfall[];
128
+ rulingsFingerprint: string;
129
+ } | {
130
+ reuse: false;
131
+ refusal: ParkReuseRefusal;
132
+ };
133
+ /**
134
+ * The park's gaps, rebuilt VERBATIM from the standing shortfall detail; null when
135
+ * they cannot be. Accepted only when the detail's node set is a BIJECTION with
136
+ * the park's -- no node missing and none extra -- AND the rebuild re-hashes to
137
+ * the park's own signature, so the routing that follows re-holds THIS park
138
+ * rather than opening a new one, and routes exactly what a fresh judgement would.
139
+ * Pure.
140
+ */
141
+ export declare function reconstructParkedShortfalls(park: ShortfallPark, detail: ShortfallReconciliationDetail | null): TargetShortfall[] | null;
142
+ /**
143
+ * Decide whether this dispatch may answer from the park instead of calling the
144
+ * model (see the module header for each refusal). Pure: every fact is supplied,
145
+ * and every unknown fact refuses.
146
+ */
147
+ export declare function decideParkedShortfallReuse(facts: ParkedShortfallFacts): ParkedShortfallDecision;
148
+ /** The seams the reuse reads its facts through; each absent one simply judges. */
149
+ export interface ParkedShortfallReuseDeps {
150
+ /**
151
+ * The delivery's execution_status + gate_state as the last writer left them
152
+ * (queries/deliveries.ts getDeliveryGateRecord -- the read
153
+ * routeShortfallOutcome's prior-state read uses). Absent: no park is read and
154
+ * every dispatch judges, exactly as before this module existed.
155
+ */
156
+ readDeliveryGateRecord?: (deliveryId: string) => Promise<DeliveryGateRecord | null>;
157
+ /**
158
+ * The identities of the delivery's own trailered commits at the commit this
159
+ * dispatch judged (verify/delivery-commit-set.ts), fingerprinted here with
160
+ * commitSetFingerprint -- the same pair routeShortfallOutcome's
161
+ * `resolveCommitSet` goes through, so the two fingerprints are comparable by
162
+ * construction. null when git could not answer.
163
+ */
164
+ resolveDeliveryCommitSet?: (v: PendingVerification, judgedSha: string | null) => Promise<string[] | null> | string[] | null;
165
+ /** The delivery's active rulings (queries/shortfall-rulings.ts), read for their fingerprint. */
166
+ readShortfallRulings?: ShortfallRulingsReader;
167
+ }
168
+ /**
169
+ * A reused park, shaped as the ruled reconciliation the engine already routes:
170
+ * no restatements (a held gate flips nothing), no honored ruling (the ruling set
171
+ * is unchanged, so it cleared these gaps at park time or not at all) and nothing
172
+ * withheld.
173
+ */
174
+ export interface ParkedShortfallReuse extends RuledReconciliation {
175
+ rulingsFingerprint: string;
176
+ park: ShortfallPark;
177
+ }
178
+ /**
179
+ * Whether a park stands on this delivery whose facts are ALL unchanged -- the
180
+ * question every re-selection path asks before dropping a run mark.
181
+ *
182
+ * TRUE means re-selecting it would re-derive exactly what the park already
183
+ * records, so the path declines. FALSE means the park is absent, its facts moved
184
+ * (a new commit, a new ruling), or SOMETHING IS UNKNOWN -- and unknown must
185
+ * re-select, never suppress: this gate may only ever remove a re-selection it can
186
+ * PROVE is pointless. Never throws.
187
+ */
188
+ export declare function parkHoldsOnUnchangedFacts(v: PendingVerification, judgedSha: string | null, deps: ParkedShortfallReuseDeps): Promise<boolean>;
189
+ /**
190
+ * The park this dispatch may answer from instead of calling the model, or null to
191
+ * judge. Never throws: every read failure refuses.
192
+ */
193
+ export declare function resolveParkedShortfallReuse(v: PendingVerification, judgedSha: string | null, deps: ParkedShortfallReuseDeps): Promise<ParkedShortfallReuse | null>;
194
+ //# sourceMappingURL=parked-shortfall-reuse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parked-shortfall-reuse.d.ts","sourceRoot":"","sources":["../../src/verify/parked-shortfall-reuse.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,EAAqD,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG5G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,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;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,oBAAoB,GAAG,uBAAuB,CAkB/F;AAED,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACpF;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5H,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,sBAAsB,CAAC;CAC/C;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC;CACrB;AAqED;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAC7C,CAAC,EAAE,mBAAmB,EACtB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,CAAC,EAAE,mBAAmB,EACtB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAyBtC"}
@@ -0,0 +1,310 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/verify/commit-verdict-pull.test.ts,
3
+ // packages/daemon/src/verify/explicit-row-selection.test.ts,
4
+ // packages/daemon/src/verify/parked-shortfall-reuse.test.ts
5
+ // PINNED-BY-END
6
+ /**
7
+ * A PARKED shortfall is REUSED, not re-judged, while its commit set and its
8
+ * rulings are unchanged.
9
+ *
10
+ * WHY. The verify gate already works this way about the SUITE: a commit whose
11
+ * verdict is recorded is not run again (verify/verification-commit-sharing.ts
12
+ * readReusableVerdict). The RECONCILIATION did not: the engine called
13
+ * `authorTargetRestatements` -- a ~28s `claude --print` one-shot -- on every
14
+ * dispatch whose gate verdict was passed, and consulted the delivery's shortfall
15
+ * park only afterwards, in routing. So however a parked delivery reached dispatch
16
+ * it paid a model call to re-derive a shortfall the park already records by commit
17
+ * set and signature. Measured 2026-09-24: delivery 8ae80225, parked at 06:25Z on
18
+ * commit set `15:2b25de49`, made ~30 reconciliation calls (median 28s) between
19
+ * 06:08Z and 06:54Z at an unchanged HEAD; the one at 06:50Z failed with
20
+ * "verify-reconciliation: model unavailable (auth)", proving each dispatch really
21
+ * was calling the model. A sibling delivery closed the re-dispatch path that fed
22
+ * that loop; this module bounds the COST of any re-dispatch path, including ones
23
+ * not yet found.
24
+ *
25
+ * WHAT IS REUSED. Not a cached verdict -- the park's OWN record. The gaps are
26
+ * rebuilt VERBATIM from the shortfall detail standing on the same gate_state
27
+ * (`shortfallReconciliation.shortfalls`: declared / achieved / reason /
28
+ * diffCitation as the judging pass wrote them), and the rebuild is accepted only
29
+ * when it reproduces the park's own signature (`sameShortfallSignature`). So the
30
+ * routing that follows is the routing a fresh IDENTICAL judgement would produce:
31
+ * the same demotion to 'failed', the same park re-hold with its original
32
+ * `parkedAt`, the same cause-keyed escalation (already deduped in
33
+ * verify/shortfall-park-escalation.ts, so nothing is re-filed) and the same
34
+ * gate_state detail. What it does NOT do is call the model.
35
+ *
36
+ * WHEN IT IS REFUSED -- every one of these judges instead, so the reuse can only
37
+ * ever remove a model call, never a judgement:
38
+ * - no standing park refusing re-work (verify/shortfall-park.ts
39
+ * shortfallParkRefusingRework: a park on a delivery in verify);
40
+ * - the CURRENT commit set could not be read, or differs from the park's, or
41
+ * the park itself recorded none. A null fingerprint means the read FAILED and
42
+ * must never match;
43
+ * - the CURRENT rulings fingerprint could not be read, or differs from the
44
+ * park's, or the PARK carries none. A park's fingerprint is PRESENT exactly
45
+ * when the judgement that recorded it could READ the rulings: '' is a
46
+ * succeeded read of an empty set ("no ruling was in force"), and the field is
47
+ * absent only where the read FAILED (shortfall-park.ts classifyShortfallPark).
48
+ * So an absent one is a park whose ruling history is UNKNOWN and is refused
49
+ * ('park-rulings-unknown') rather than coerced to '' -- coercing it would let
50
+ * a park recorded while the rulings were unreadable be answered from after a
51
+ * later successful EMPTY read, as though the unknown had been known-empty.
52
+ * The recorder is why this can be strict: the previous cycle read an absent
53
+ * fingerprint as '' because requiring presence would otherwise have made the
54
+ * reuse inert for the measured incident (an ordinary no-rulings park wrote no
55
+ * field at all). With the recorder fixed there is no such dilemma -- a
56
+ * known-empty park records '' and reuses, an unknown one judges. A park
57
+ * WRITTEN BY THE OLD RECORDER carries no field even where the rulings were
58
+ * readable and empty: it refuses ONCE, that judgement re-holds it carrying
59
+ * '', and reuse resumes -- the one reconciliation after recovery, no more.
60
+ * Any ruling landing since (an operator row, or an approving review's node
61
+ * verdict arriving through the same reader as `ruledByKind: 'review'`)
62
+ * changes the fingerprint and re-judges exactly once, after which the park
63
+ * carries the new fingerprint and matches again;
64
+ * - the gate_state carries an AWAITED-MODEL hold (`modelUnavailable`,
65
+ * verify/verification-model-unavailable-hold.ts). A park is never WRITTEN by
66
+ * that path -- the engine routes no shortfall when the model was not reached
67
+ * -- but a later tick can leave the hold standing beside a park, and then the
68
+ * last thing that happened to this delivery was a non-judgement. The hold
69
+ * exists precisely so the next tick re-judges the same commit, so this
70
+ * refuses rather than answering from a record the hold sits on top of. It is
71
+ * self-clearing: the first reconciliation that renders rebuilds gate_state
72
+ * without it, and reuse resumes on the tick after;
73
+ * - the gaps cannot be rebuilt from the standing detail, or the rebuild does
74
+ * not reproduce the park's signature (a legacy park, or a writer that
75
+ * replaced the live detail). One judgement re-establishes the detail;
76
+ * - the rebuilt gaps look like a FAILED reconciliation rather than a judgement:
77
+ * a non-ModelUnavailable throw is signed as a whole-injection shortfall
78
+ * (classifyReconciliationThrow), which names the INJECTION node and carries
79
+ * the '(unknown -- reconciliation failed)' declared statement. That is an
80
+ * error, not a verdict, so it is re-attempted rather than reused.
81
+ *
82
+ * WHAT STAYS REACHABLE, AND WHAT DOES NOT. The engine resolves the delivery's
83
+ * evidence before asking this: those are git and record reads every dispatch pays
84
+ * anyway, and leaving them unconditional keeps the pass path one shape. Their
85
+ * instrument-fault branch is then unreachable on a reused dispatch, on purpose --
86
+ * it routes the delivery to bounded RE-WORK, which is exactly what a standing park
87
+ * refuses (shortfallParkRefusingRework), so a blind bundle on a parked delivery
88
+ * must re-hold the park rather than send it back to coding. Everything after the
89
+ * reconciliation is reached exactly as a fresh judgement reaches it: the inward
90
+ * shortfall drift, the routing, the park's escalation, the recorded-targets report
91
+ * (left untouched -- a reused dispatch learned nothing new about arm coverage).
92
+ *
93
+ * WHAT IT DELIBERATELY DOES NOT WIDEN. Reuse is keyed on exactly the two facts
94
+ * the park's own release rule is keyed on (shortfall-park.ts
95
+ * isShortfallParkReleased: the commit set and the rulings fingerprint). Anything
96
+ * that does not release the park does not release the reuse either -- the park
97
+ * already governs whether such a delivery is judged at all, and a second,
98
+ * differently-keyed opinion here would be a way for the two to disagree.
99
+ *
100
+ * The DECISION is pure (decideParkedShortfallReuse) and takes the facts; only
101
+ * resolveParkedShortfallReuse reads them, through the engine's dep seam.
102
+ *
103
+ * @module verify/parked-shortfall-reuse
104
+ */
105
+ import { commitSetFingerprint, shortfallParkRefusingRework } from './shortfall-park.js';
106
+ import { sameShortfallSignature, shortfallSignature } from './shortfall-repeat.js';
107
+ import { hasModelUnavailableHold } from '../queries/verify-own-holds.js';
108
+ import { createLogger } from '../shell/log.js';
109
+ const log = createLogger({ module: 'verification' });
110
+ /**
111
+ * The declared statement classifyReconciliationThrow
112
+ * (verify/verification-model-unavailable-hold.ts) signs a FAILED reconciliation
113
+ * with. Duplicated as a sentinel rather than imported so this module keeps no
114
+ * edge to the hold module; the structural test beside it (the shortfall names the
115
+ * INJECTION node, which a judged target never is) stands on its own if the
116
+ * wording drifts.
117
+ */
118
+ const RECONCILIATION_FAILED_DECLARED = '(unknown -- reconciliation failed)';
119
+ function lower(id) {
120
+ return id.trim().toLowerCase();
121
+ }
122
+ /**
123
+ * The park's gaps, rebuilt VERBATIM from the standing shortfall detail; null when
124
+ * they cannot be. Accepted only when the detail's node set is a BIJECTION with
125
+ * the park's -- no node missing and none extra -- AND the rebuild re-hashes to
126
+ * the park's own signature, so the routing that follows re-holds THIS park
127
+ * rather than opening a new one, and routes exactly what a fresh judgement would.
128
+ * Pure.
129
+ */
130
+ export function reconstructParkedShortfalls(park, detail) {
131
+ if (!detail || !Array.isArray(detail.shortfalls))
132
+ return null;
133
+ const parked = new Set(park.nodeIds.map(lower));
134
+ const nodesSeen = new Set();
135
+ const identities = new Set();
136
+ const gaps = [];
137
+ for (const s of detail.shortfalls) {
138
+ if (typeof s?.nodeId !== 'string' || typeof s.declared !== 'string')
139
+ return null;
140
+ const id = lower(s.nodeId);
141
+ // An EXTRA node: the standing detail holds a gap this park does not. Skipping
142
+ // it would reuse a judgement that routes STRICTLY LESS than a fresh one would
143
+ // (park [A] with detail [A,B] routed A alone, where judging routes A and B),
144
+ // and the signature check below cannot catch it -- the reconstruction would
145
+ // re-hash to the park's own signature precisely BECAUSE the extra was
146
+ // dropped. So refuse and let the reconciliation run.
147
+ if (!parked.has(id))
148
+ return null;
149
+ // Deduped on (nodeId, declared) -- the SIGNATURE's own key
150
+ // (verify/shortfall-repeat.ts canonicalSignature), not nodeId alone -- so an
151
+ // identical repeat collapses to one gap while two DIFFERING declarations for
152
+ // one node stay two and are caught by the signature comparison.
153
+ const identity = JSON.stringify([s.nodeId, s.declared]);
154
+ if (identities.has(identity))
155
+ continue;
156
+ identities.add(identity);
157
+ nodesSeen.add(id);
158
+ gaps.push({
159
+ nodeId: s.nodeId,
160
+ declaredStatement: s.declared,
161
+ achievedStatement: typeof s.achieved === 'string' ? s.achieved : '',
162
+ reason: typeof s.reason === 'string' ? s.reason : '',
163
+ ...(s.diffCitation ? { diffCitation: s.diffCitation } : {}),
164
+ });
165
+ }
166
+ // A BIJECTION, both directions: the loop above refused every node the park does
167
+ // not hold, and this refuses a park node the detail does not carry.
168
+ if (nodesSeen.size !== parked.size)
169
+ return null;
170
+ return sameShortfallSignature(shortfallSignature(gaps), park.signature) ? gaps : null;
171
+ }
172
+ /** Whether one rebuilt gap is a signed reconciliation FAILURE rather than a judgement. Pure. */
173
+ function isFailedReconciliation(gap, injectionNodeId) {
174
+ return lower(gap.nodeId) === lower(injectionNodeId)
175
+ || gap.declaredStatement === RECONCILIATION_FAILED_DECLARED;
176
+ }
177
+ /**
178
+ * Decide whether this dispatch may answer from the park instead of calling the
179
+ * model (see the module header for each refusal). Pure: every fact is supplied,
180
+ * and every unknown fact refuses.
181
+ */
182
+ export function decideParkedShortfallReuse(facts) {
183
+ const { park } = facts;
184
+ if (park === null)
185
+ return { reuse: false, refusal: 'no-park' };
186
+ if (facts.awaitingModel)
187
+ return { reuse: false, refusal: 'awaiting-model' };
188
+ if (park.commitSet === null)
189
+ return { reuse: false, refusal: 'park-commit-set-unknown' };
190
+ if (facts.commitSet === null)
191
+ return { reuse: false, refusal: 'commit-set-unknown' };
192
+ if (facts.commitSet !== park.commitSet)
193
+ return { reuse: false, refusal: 'commit-set-changed' };
194
+ // PRESENT on the park means its recorder could READ the rulings ('' = a
195
+ // succeeded read of an empty set). Absent means unknown, which never matches.
196
+ if (park.rulingsFingerprint === undefined)
197
+ return { reuse: false, refusal: 'park-rulings-unknown' };
198
+ if (facts.rulingsFingerprint === null)
199
+ return { reuse: false, refusal: 'rulings-unknown' };
200
+ if (facts.rulingsFingerprint !== park.rulingsFingerprint)
201
+ return { reuse: false, refusal: 'rulings-changed' };
202
+ const shortfalls = reconstructParkedShortfalls(park, facts.detail);
203
+ if (shortfalls === null)
204
+ return { reuse: false, refusal: 'gaps-not-reconstructable' };
205
+ if (shortfalls.some((gap) => isFailedReconciliation(gap, facts.injectionNodeId))) {
206
+ return { reuse: false, refusal: 'not-a-judgement' };
207
+ }
208
+ return { reuse: true, park, shortfalls, rulingsFingerprint: facts.rulingsFingerprint };
209
+ }
210
+ /** The current commit-set fingerprint; null (logged) when unreadable -- which refuses reuse. */
211
+ async function readCommitSet(deps, v, judgedSha) {
212
+ if (!deps.resolveDeliveryCommitSet)
213
+ return null;
214
+ try {
215
+ const ids = await deps.resolveDeliveryCommitSet(v, judgedSha);
216
+ return ids === null ? null : commitSetFingerprint(ids);
217
+ }
218
+ catch (err) {
219
+ log.warn(`[verification] parked delivery ${v.deliveryId}: commit set unreadable, re-judging:`, err.message);
220
+ return null;
221
+ }
222
+ }
223
+ /** The current rulings fingerprint; null (logged) when unreadable -- which refuses reuse. */
224
+ async function readRulingsFingerprint(deps, deliveryId) {
225
+ if (!deps.readShortfallRulings)
226
+ return null;
227
+ try {
228
+ return (await deps.readShortfallRulings(deliveryId)).fingerprint;
229
+ }
230
+ catch (err) {
231
+ log.warn(`[verification] parked delivery ${deliveryId}: rulings unreadable, re-judging:`, err.message);
232
+ return null;
233
+ }
234
+ }
235
+ /** The delivery's gate record; null (logged) when the read failed -- which refuses reuse. */
236
+ async function readGateRecord(deps, deliveryId) {
237
+ if (!deps.readDeliveryGateRecord)
238
+ return null;
239
+ try {
240
+ return await deps.readDeliveryGateRecord(deliveryId);
241
+ }
242
+ catch (err) {
243
+ log.warn(`[verification] delivery ${deliveryId}: gate_state unreadable, re-judging:`, err.message);
244
+ return null;
245
+ }
246
+ }
247
+ /**
248
+ * Read the delivery's park and decide about it; null when NO park stands, so an
249
+ * ordinary dispatch pays one gate_state read and nothing else. The single
250
+ * decision point: both the cost bound (reuse the judgement) and the re-selection
251
+ * rule (`parkHoldsOnUnchangedFacts`) ask through here, so the two cannot answer
252
+ * differently about the same park. Never throws: every read failure refuses.
253
+ */
254
+ async function decideForDelivery(v, judgedSha, deps) {
255
+ const record = await readGateRecord(deps, v.deliveryId);
256
+ const park = record === null ? null : shortfallParkRefusingRework(record);
257
+ if (park === null)
258
+ return null;
259
+ const decision = decideParkedShortfallReuse({
260
+ park,
261
+ detail: record?.gateState?.shortfallReconciliation ?? null,
262
+ awaitingModel: hasModelUnavailableHold(record?.gateState),
263
+ commitSet: await readCommitSet(deps, v, judgedSha),
264
+ rulingsFingerprint: await readRulingsFingerprint(deps, v.deliveryId),
265
+ injectionNodeId: v.injectionNodeId,
266
+ });
267
+ return { park, decision };
268
+ }
269
+ /**
270
+ * Whether a park stands on this delivery whose facts are ALL unchanged -- the
271
+ * question every re-selection path asks before dropping a run mark.
272
+ *
273
+ * TRUE means re-selecting it would re-derive exactly what the park already
274
+ * records, so the path declines. FALSE means the park is absent, its facts moved
275
+ * (a new commit, a new ruling), or SOMETHING IS UNKNOWN -- and unknown must
276
+ * re-select, never suppress: this gate may only ever remove a re-selection it can
277
+ * PROVE is pointless. Never throws.
278
+ */
279
+ export async function parkHoldsOnUnchangedFacts(v, judgedSha, deps) {
280
+ const decided = await decideForDelivery(v, judgedSha, deps);
281
+ return decided !== null && decided.decision.reuse;
282
+ }
283
+ /**
284
+ * The park this dispatch may answer from instead of calling the model, or null to
285
+ * judge. Never throws: every read failure refuses.
286
+ */
287
+ export async function resolveParkedShortfallReuse(v, judgedSha, deps) {
288
+ const decided = await decideForDelivery(v, judgedSha, deps);
289
+ if (decided === null)
290
+ return null;
291
+ const { park, decision } = decided;
292
+ if (!decision.reuse) {
293
+ log.debug(`[verification] delivery "${v.deliveryName}" (${v.deliveryId}) is parked but re-judged this dispatch ` +
294
+ `(${decision.refusal}); the reconciliation runs`);
295
+ return null;
296
+ }
297
+ log.info(`[verification] delivery "${v.deliveryName}" (${v.deliveryId}): re-holding the shortfall park recorded ` +
298
+ `${park.parkedAt} on commit set ${park.commitSet} -- unchanged commit set and rulings, so its ` +
299
+ `${decision.shortfalls.length} shortfall(s) are reused as judged and NO MODEL CALL WAS MADE ` +
300
+ `(no reconciliation this dispatch)`);
301
+ return {
302
+ restatements: [],
303
+ shortfalls: decision.shortfalls,
304
+ rulingsFingerprint: decision.rulingsFingerprint,
305
+ withheldNodeIds: [],
306
+ honored: [],
307
+ park,
308
+ };
309
+ }
310
+ //# sourceMappingURL=parked-shortfall-reuse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parked-shortfall-reuse.js","sourceRoot":"","sources":["../../src/verify/parked-shortfall-reuse.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,qEAAqE;AACrE,+DAA+D;AAC/D,8DAA8D;AAC9D,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAsB,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAMzE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,8BAA8B,GAAG,oCAAoC,CAAC;AAoC5E,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACjC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAmB,EACnB,MAA4C;IAE5C,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,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AO,CAAC;IACnC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACpB,GAAG,CAAC,KAAK,CACP,4BAA4B,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,UAAU,0CAA0C;YACtG,IAAI,QAAQ,CAAC,OAAO,4BAA4B,CACjD,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,GAAG,CAAC,IAAI,CACN,4BAA4B,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,UAAU,4CAA4C;QACxG,GAAG,IAAI,CAAC,QAAQ,kBAAkB,IAAI,CAAC,SAAS,+CAA+C;QAC/F,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,gEAAgE;QAC7F,mCAAmC,CACpC,CAAC;IACF,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,eAAe,EAAE,EAAE;QACnB,OAAO,EAAE,EAAE;QACX,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Every path that can re-select a delivery already sitting in verify. A new path
3
+ * belongs here AND at a `logReselection` call site; the enumeration test fails
4
+ * on a member with no driver.
5
+ */
6
+ export declare const RESELECTION_PATHS: readonly ["run-mark-prune", "run-mark-release", "commit-verdict-pull", "credit-rearm", "ruling-rearm", "pending-relisting", "model-unavailable-unmark", "checkout-unavailable-unmark"];
7
+ /** One of {@link RESELECTION_PATHS}. */
8
+ export type ReselectionPath = (typeof RESELECTION_PATHS)[number];
9
+ /** Test-only: forget every de-duplicated line written so far. */
10
+ export declare function __resetReselectionLogForTests(): void;
11
+ /**
12
+ * Write the one line for this re-selection.
13
+ *
14
+ * `dedupeKey` is for a line that fires REPEATEDLY for the same (delivery,
15
+ * reason) WITHOUT re-selecting anything -- a DECLINED re-selection, e.g. a parked
16
+ * row the edge re-lists every tick. Pass it and the line is written once per
17
+ * (path, delivery, key). A line for a re-selection that happens -- a dispatch
18
+ * follows -- is never de-duplicated: the repetition IS the information (the
19
+ * incident's ~30 re-dispatches should have produced ~30 lines, not one).
20
+ */
21
+ export declare function logReselection(path: ReselectionPath, deliveryId: string, detail: string, dedupeKey?: string): void;
22
+ //# sourceMappingURL=reselection-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reselection-log.d.ts","sourceRoot":"","sources":["../../src/verify/reselection-log.ts"],"names":[],"mappings":"AA0CA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,wLAiBpB,CAAC;AAEX,wCAAwC;AACxC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAKjE,iEAAiE;AACjE,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAON"}
@@ -0,0 +1,87 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/verify/explicit-row-selection.test.ts,
3
+ // packages/daemon/src/verify/reselection-log.test.ts,
4
+ // packages/daemon/src/verify/verification-default-on.test.ts
5
+ // PINNED-BY-END
6
+ /**
7
+ * ONE line per re-selection of a delivery sitting in verify, naming the PATH
8
+ * that re-selected it.
9
+ *
10
+ * Why this module exists. On 2026-09-24 delivery 8ae80225 sat parked in verify
11
+ * at an unchanged focus HEAD (88cd9d77) and was re-dispatched every ~60s for
12
+ * ~30 ticks. Every tick logged the dispatch ("takes the 'passed' verdict
13
+ * recorded for focus HEAD 88cd9d77") and, ~28s later, its outcome -- and NOTHING
14
+ * said why the delivery had been selected again. The five paths that re-arm a
15
+ * delivery either log per FOCUS (credit-rearm), log nothing at all
16
+ * (pruneGuardsOutsideVerify -- which turned out to be the one at fault), or log
17
+ * in their own private shape. So the re-dispatch could not be attributed from
18
+ * ~/.telora/daemon.log: the incident had to be reasoned out of the source.
19
+ *
20
+ * The rule: a delivery whose guards are dropped is a delivery that WILL be
21
+ * selected again, and exactly one line says which path dropped them. The path
22
+ * names are an exported const union, so the shape cannot drift and a path added
23
+ * later without a log line is a visible hole (verify/reselection-log.test.ts
24
+ * enumerates the union).
25
+ *
26
+ * WHO LOGS. Each path logs at its OWN call site, because only there is the
27
+ * reason known. The guard mutators in verify/default-on-guards.ts are the
28
+ * fallback, not a second voice: `releaseDefaultOnMark(id)` called with no path
29
+ * logs 'run-mark-release', and called WITH a path stays silent so the caller's
30
+ * own richer line stands alone.
31
+ *
32
+ * A line is only written when something was actually dropped -- a release that
33
+ * found no mark suppressed nothing and re-selected nothing.
34
+ *
35
+ * @module verify/reselection-log
36
+ */
37
+ import { createLogger } from '../shell/log.js';
38
+ const log = createLogger({ module: 'verification' });
39
+ /**
40
+ * Every path that can re-select a delivery already sitting in verify. A new path
41
+ * belongs here AND at a `logReselection` call site; the enumeration test fails
42
+ * on a member with no driver.
43
+ */
44
+ export const RESELECTION_PATHS = [
45
+ /** The default-on scan no longer observed the delivery in verify (default-on-guards.ts pruneGuardsOutsideVerify). */
46
+ 'run-mark-prune',
47
+ /** The run mark was dropped by a caller that named no path of its own (default-on-guards.ts releaseDefaultOnMark). */
48
+ 'run-mark-release',
49
+ /** A route held for a verdict on the current HEAD pulled the run (commit-verdict-pull.ts). */
50
+ 'commit-verdict-pull',
51
+ /** The focus's commit-credit set changed, so the same commit is judged again (credit-rearm.ts). */
52
+ 'credit-rearm',
53
+ /** An operator ruling released a shortfall park (shortfall-rulings.ts rearmRuledShortfallParks). */
54
+ 'ruling-rearm',
55
+ /** The edge re-listed an explicit-method row in the pending queue (verification-engine.ts). */
56
+ 'pending-relisting',
57
+ /** The reconciliation's model could not be reached: no verdict to guard (default-on-guards.ts noteDefaultOnResult). */
58
+ 'model-unavailable-unmark',
59
+ /** No checkout could be made, or the verdict was discarded mid-run (default-on-guards.ts noteDefaultOnResult). */
60
+ 'checkout-unavailable-unmark',
61
+ ];
62
+ /** `${path}@${deliveryId}@${dedupeKey}` triples already written. */
63
+ const written = new Set();
64
+ /** Test-only: forget every de-duplicated line written so far. */
65
+ export function __resetReselectionLogForTests() {
66
+ written.clear();
67
+ }
68
+ /**
69
+ * Write the one line for this re-selection.
70
+ *
71
+ * `dedupeKey` is for a line that fires REPEATEDLY for the same (delivery,
72
+ * reason) WITHOUT re-selecting anything -- a DECLINED re-selection, e.g. a parked
73
+ * row the edge re-lists every tick. Pass it and the line is written once per
74
+ * (path, delivery, key). A line for a re-selection that happens -- a dispatch
75
+ * follows -- is never de-duplicated: the repetition IS the information (the
76
+ * incident's ~30 re-dispatches should have produced ~30 lines, not one).
77
+ */
78
+ export function logReselection(path, deliveryId, detail, dedupeKey) {
79
+ if (dedupeKey !== undefined) {
80
+ const key = `${path}@${deliveryId}@${dedupeKey}`;
81
+ if (written.has(key))
82
+ return;
83
+ written.add(key);
84
+ }
85
+ log.info(`[verification] re-selection (${path}): delivery ${deliveryId} -- ${detail}`);
86
+ }
87
+ //# sourceMappingURL=reselection-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reselection-log.js","sourceRoot":"","sources":["../../src/verify/reselection-log.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wEAAwE;AACxE,wDAAwD;AACxD,+DAA+D;AAC/D,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,qHAAqH;IACrH,gBAAgB;IAChB,sHAAsH;IACtH,kBAAkB;IAClB,8FAA8F;IAC9F,qBAAqB;IACrB,mGAAmG;IACnG,cAAc;IACd,oGAAoG;IACpG,cAAc;IACd,+FAA+F;IAC/F,mBAAmB;IACnB,uHAAuH;IACvH,0BAA0B;IAC1B,kHAAkH;IAClH,6BAA6B;CACrB,CAAC;AAKX,oEAAoE;AACpE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;AAElC,iEAAiE;AACjE,MAAM,UAAU,6BAA6B;IAC3C,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAqB,EACrB,UAAkB,EAClB,MAAc,EACd,SAAkB;IAElB,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;QACjD,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,gCAAgC,IAAI,eAAe,UAAU,OAAO,MAAM,EAAE,CAAC,CAAC;AACzF,CAAC"}