@telora/daemon 0.24.25 → 0.24.29

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 (433) hide show
  1. package/build-info.json +10 -3
  2. package/dist/audit/audit-prompt.d.ts.map +1 -1
  3. package/dist/audit/audit-prompt.js +15 -0
  4. package/dist/audit/audit-prompt.js.map +1 -1
  5. package/dist/completion/completion-event/event.d.ts +4 -3
  6. package/dist/completion/completion-event/event.d.ts.map +1 -1
  7. package/dist/completion/completion-event/event.js.map +1 -1
  8. package/dist/completion/review-cycle-budget/review-cycle-cap.d.ts +19 -11
  9. package/dist/completion/review-cycle-budget/review-cycle-cap.d.ts.map +1 -1
  10. package/dist/completion/review-cycle-budget/review-cycle-cap.js +36 -36
  11. package/dist/completion/review-cycle-budget/review-cycle-cap.js.map +1 -1
  12. package/dist/completion/review-cycle-budget/review-loop-detection.d.ts +101 -0
  13. package/dist/completion/review-cycle-budget/review-loop-detection.d.ts.map +1 -0
  14. package/dist/completion/review-cycle-budget/review-loop-detection.js +105 -0
  15. package/dist/completion/review-cycle-budget/review-loop-detection.js.map +1 -0
  16. package/dist/completion/review-cycle-budget/spent-budget-release.d.ts +70 -0
  17. package/dist/completion/review-cycle-budget/spent-budget-release.d.ts.map +1 -0
  18. package/dist/completion/review-cycle-budget/spent-budget-release.js +98 -0
  19. package/dist/completion/review-cycle-budget/spent-budget-release.js.map +1 -0
  20. package/dist/completion/review-exit/review-defect-detector.d.ts +71 -49
  21. package/dist/completion/review-exit/review-defect-detector.d.ts.map +1 -1
  22. package/dist/completion/review-exit/review-defect-detector.js +75 -69
  23. package/dist/completion/review-exit/review-defect-detector.js.map +1 -1
  24. package/dist/completion/review-exit/review-exit-attribution.d.ts +1 -1
  25. package/dist/completion/review-exit/review-exit-attribution.js +1 -1
  26. package/dist/completion/review-exit/review-exit-deps.d.ts +5 -2
  27. package/dist/completion/review-exit/review-exit-deps.d.ts.map +1 -1
  28. package/dist/completion/review-exit/review-exit-deps.js +1 -1
  29. package/dist/completion/review-exit/review-exit-evidence.d.ts +10 -1
  30. package/dist/completion/review-exit/review-exit-evidence.d.ts.map +1 -1
  31. package/dist/completion/review-exit/review-exit-evidence.js +17 -14
  32. package/dist/completion/review-exit/review-exit-evidence.js.map +1 -1
  33. package/dist/completion/review-exit/review-exit-foreign-findings.d.ts +1 -1
  34. package/dist/completion/review-exit/review-exit-foreign-findings.d.ts.map +1 -1
  35. package/dist/completion/review-exit/review-exit-phase.d.ts.map +1 -1
  36. package/dist/completion/review-exit/review-exit-phase.js +12 -8
  37. package/dist/completion/review-exit/review-exit-phase.js.map +1 -1
  38. package/dist/completion/state-cascade/review-next-step.d.ts +12 -3
  39. package/dist/completion/state-cascade/review-next-step.d.ts.map +1 -1
  40. package/dist/completion/state-cascade/review-next-step.js +10 -1
  41. package/dist/completion/state-cascade/review-next-step.js.map +1 -1
  42. package/dist/completion/state-cascade/standing-approval-convergence.d.ts +1 -1
  43. package/dist/completion/state-cascade/standing-approval-convergence.d.ts.map +1 -1
  44. package/dist/completion/state-cascade/standing-approval-convergence.js +10 -4
  45. package/dist/completion/state-cascade/standing-approval-convergence.js.map +1 -1
  46. package/dist/completion/state-cascade/state-cascade.d.ts +3 -0
  47. package/dist/completion/state-cascade/state-cascade.d.ts.map +1 -1
  48. package/dist/completion/state-cascade/state-cascade.js +16 -1
  49. package/dist/completion/state-cascade/state-cascade.js.map +1 -1
  50. package/dist/completion/team-exit/status-advance-phase.d.ts +1 -1
  51. package/dist/completion/team-exit/status-advance-phase.d.ts.map +1 -1
  52. package/dist/completion/team-exit/status-advance-phase.js +6 -4
  53. package/dist/completion/team-exit/status-advance-phase.js.map +1 -1
  54. package/dist/completion/team-outcome/apply-turn.d.ts.map +1 -1
  55. package/dist/completion/team-outcome/apply-turn.js +9 -4
  56. package/dist/completion/team-outcome/apply-turn.js.map +1 -1
  57. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts.map +1 -1
  58. package/dist/completion/team-outcome/decide-turn-entry-rows.js +28 -3
  59. package/dist/completion/team-outcome/decide-turn-entry-rows.js.map +1 -1
  60. package/dist/completion/team-outcome/decide.d.ts.map +1 -1
  61. package/dist/completion/team-outcome/decide.js +1 -0
  62. package/dist/completion/team-outcome/decide.js.map +1 -1
  63. package/dist/completion/team-outcome/exit-limits.d.ts +6 -0
  64. package/dist/completion/team-outcome/exit-limits.d.ts.map +1 -1
  65. package/dist/completion/team-outcome/exit-limits.js +6 -0
  66. package/dist/completion/team-outcome/exit-limits.js.map +1 -1
  67. package/dist/completion/team-outcome/exit-pipeline-state.d.ts +5 -0
  68. package/dist/completion/team-outcome/exit-pipeline-state.d.ts.map +1 -1
  69. package/dist/completion/team-outcome/exit-pipeline-state.js.map +1 -1
  70. package/dist/completion/team-teardown/session-hold-bounds.d.ts +10 -1
  71. package/dist/completion/team-teardown/session-hold-bounds.d.ts.map +1 -1
  72. package/dist/completion/team-teardown/session-hold-bounds.js +11 -0
  73. package/dist/completion/team-teardown/session-hold-bounds.js.map +1 -1
  74. package/dist/completion/team-teardown/session-hold.d.ts.map +1 -1
  75. package/dist/completion/team-teardown/session-hold.js +2 -0
  76. package/dist/completion/team-teardown/session-hold.js.map +1 -1
  77. package/dist/composition/engine-start-context.d.ts.map +1 -1
  78. package/dist/composition/engine-start-context.js +9 -1
  79. package/dist/composition/engine-start-context.js.map +1 -1
  80. package/dist/composition/execution-spawn-context.d.ts.map +1 -1
  81. package/dist/composition/execution-spawn-context.js +2 -0
  82. package/dist/composition/execution-spawn-context.js.map +1 -1
  83. package/dist/composition/judgement-contexts.d.ts.map +1 -1
  84. package/dist/composition/judgement-contexts.js +8 -2
  85. package/dist/composition/judgement-contexts.js.map +1 -1
  86. package/dist/composition/review-exit-context.d.ts.map +1 -1
  87. package/dist/composition/review-exit-context.js +2 -0
  88. package/dist/composition/review-exit-context.js.map +1 -1
  89. package/dist/composition/review-loop-context.d.ts +28 -0
  90. package/dist/composition/review-loop-context.d.ts.map +1 -0
  91. package/dist/composition/review-loop-context.js +147 -0
  92. package/dist/composition/review-loop-context.js.map +1 -0
  93. package/dist/composition/runtime-heartbeat-context.d.ts.map +1 -1
  94. package/dist/composition/runtime-heartbeat-context.js +8 -2
  95. package/dist/composition/runtime-heartbeat-context.js.map +1 -1
  96. package/dist/composition/spawn-pass-deps.d.ts.map +1 -1
  97. package/dist/composition/spawn-pass-deps.js +3 -0
  98. package/dist/composition/spawn-pass-deps.js.map +1 -1
  99. package/dist/composition/state-cascade-context.d.ts.map +1 -1
  100. package/dist/composition/state-cascade-context.js +3 -1
  101. package/dist/composition/state-cascade-context.js.map +1 -1
  102. package/dist/composition/tower-escalation-context.d.ts +12 -0
  103. package/dist/composition/tower-escalation-context.d.ts.map +1 -0
  104. package/dist/composition/tower-escalation-context.js +109 -0
  105. package/dist/composition/tower-escalation-context.js.map +1 -0
  106. package/dist/composition/workstation-intervals-context.d.ts +3 -0
  107. package/dist/composition/workstation-intervals-context.d.ts.map +1 -0
  108. package/dist/composition/workstation-intervals-context.js +33 -0
  109. package/dist/composition/workstation-intervals-context.js.map +1 -0
  110. package/dist/daemon-state/awaiting-slot.d.ts +18 -1
  111. package/dist/daemon-state/awaiting-slot.d.ts.map +1 -1
  112. package/dist/daemon-state/awaiting-slot.js +7 -0
  113. package/dist/daemon-state/awaiting-slot.js.map +1 -1
  114. package/dist/delivery/delivery-reconciler.d.ts +7 -7
  115. package/dist/delivery/recorded-concerns.d.ts +63 -28
  116. package/dist/delivery/recorded-concerns.d.ts.map +1 -1
  117. package/dist/delivery/recorded-concerns.js +72 -28
  118. package/dist/delivery/recorded-concerns.js.map +1 -1
  119. package/dist/directive/directive-queue.d.ts +8 -0
  120. package/dist/directive/directive-queue.d.ts.map +1 -1
  121. package/dist/directive/directive-queue.js +1 -1
  122. package/dist/directive/directive-queue.js.map +1 -1
  123. package/dist/focus/control-state.d.ts +6 -4
  124. package/dist/focus/control-state.d.ts.map +1 -1
  125. package/dist/focus/control-state.js +6 -4
  126. package/dist/focus/control-state.js.map +1 -1
  127. package/dist/focus/daemon-contexts-judgement.d.ts +6 -0
  128. package/dist/focus/daemon-contexts-judgement.d.ts.map +1 -1
  129. package/dist/focus/daemon-contexts.d.ts +6 -0
  130. package/dist/focus/daemon-contexts.d.ts.map +1 -1
  131. package/dist/focus/daemon-contexts.js.map +1 -1
  132. package/dist/focus/focus-engine.d.ts.map +1 -1
  133. package/dist/focus/focus-engine.js +3 -1
  134. package/dist/focus/focus-engine.js.map +1 -1
  135. package/dist/focus/focus-executor.d.ts.map +1 -1
  136. package/dist/focus/focus-executor.js +3 -2
  137. package/dist/focus/focus-executor.js.map +1 -1
  138. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  139. package/dist/focus/focus-loop-registry.js +42 -0
  140. package/dist/focus/focus-loop-registry.js.map +1 -1
  141. package/dist/focus/focus-poller-auto-advance.d.ts +4 -2
  142. package/dist/focus/focus-poller-auto-advance.d.ts.map +1 -1
  143. package/dist/focus/focus-poller-auto-advance.js +24 -18
  144. package/dist/focus/focus-poller-auto-advance.js.map +1 -1
  145. package/dist/focus/focus-poller-spawn.d.ts.map +1 -1
  146. package/dist/focus/focus-poller-spawn.js +8 -6
  147. package/dist/focus/focus-poller-spawn.js.map +1 -1
  148. package/dist/focus/heartbeat.d.ts +9 -2
  149. package/dist/focus/heartbeat.d.ts.map +1 -1
  150. package/dist/focus/heartbeat.js +9 -1
  151. package/dist/focus/heartbeat.js.map +1 -1
  152. package/dist/focus/pending-directive-gates.d.ts +14 -0
  153. package/dist/focus/pending-directive-gates.d.ts.map +1 -1
  154. package/dist/focus/pending-directive-gates.js +25 -1
  155. package/dist/focus/pending-directive-gates.js.map +1 -1
  156. package/dist/focus/pending-spawn-pass-deps.d.ts +7 -0
  157. package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -1
  158. package/dist/focus/pending-spawn-review-next-step.d.ts +1 -1
  159. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -1
  160. package/dist/focus/pending-spawn-review-next-step.js +2 -0
  161. package/dist/focus/pending-spawn-review-next-step.js.map +1 -1
  162. package/dist/focus/ready-focus-team-work.d.ts +9 -4
  163. package/dist/focus/ready-focus-team-work.d.ts.map +1 -1
  164. package/dist/focus/ready-focus-team-work.js +14 -3
  165. package/dist/focus/ready-focus-team-work.js.map +1 -1
  166. package/dist/focus/verify-open-issues.d.ts +3 -2
  167. package/dist/focus/verify-open-issues.d.ts.map +1 -1
  168. package/dist/focus/verify-open-issues.js +6 -4
  169. package/dist/focus/verify-open-issues.js.map +1 -1
  170. package/dist/focus/workstation-intervals.d.ts +83 -0
  171. package/dist/focus/workstation-intervals.d.ts.map +1 -0
  172. package/dist/focus/workstation-intervals.js +81 -0
  173. package/dist/focus/workstation-intervals.js.map +1 -0
  174. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +5 -2
  175. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  176. package/dist/focus-stage-lifecycle/wedge-watchdog.js +2 -2
  177. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  178. package/dist/nexus/escalation-bridge.d.ts.map +1 -1
  179. package/dist/nexus/escalation-bridge.js +2 -1
  180. package/dist/nexus/escalation-bridge.js.map +1 -1
  181. package/dist/nexus/file-escalation.d.ts.map +1 -1
  182. package/dist/nexus/file-escalation.js +1 -0
  183. package/dist/nexus/file-escalation.js.map +1 -1
  184. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  185. package/dist/prompt-sections/persona-sections.js +4 -1
  186. package/dist/prompt-sections/persona-sections.js.map +1 -1
  187. package/dist/prompt-sections/qa-author-section.d.ts.map +1 -1
  188. package/dist/prompt-sections/qa-author-section.js +18 -1
  189. package/dist/prompt-sections/qa-author-section.js.map +1 -1
  190. package/dist/prompt-sections/scoping-sections.d.ts +0 -12
  191. package/dist/prompt-sections/scoping-sections.d.ts.map +1 -1
  192. package/dist/prompt-sections/scoping-sections.js +16 -2
  193. package/dist/prompt-sections/scoping-sections.js.map +1 -1
  194. package/dist/prompts/bounded-universals.d.ts +13 -0
  195. package/dist/prompts/bounded-universals.d.ts.map +1 -0
  196. package/dist/prompts/bounded-universals.js +32 -0
  197. package/dist/prompts/bounded-universals.js.map +1 -0
  198. package/dist/queries/api-client/shared.d.ts +2 -1
  199. package/dist/queries/api-client/shared.d.ts.map +1 -1
  200. package/dist/queries/api-client/shared.js +31 -1
  201. package/dist/queries/api-client/shared.js.map +1 -1
  202. package/dist/queries/deliveries/deliveries.js +1 -1
  203. package/dist/queries/deliveries/issues.d.ts.map +1 -1
  204. package/dist/queries/deliveries/issues.js +1 -0
  205. package/dist/queries/deliveries/issues.js.map +1 -1
  206. package/dist/queries/delivery-gate-state/delivery-gate-state.js +1 -1
  207. package/dist/queries/delivery-gate-state/verify-own-holds.d.ts +24 -2
  208. package/dist/queries/delivery-gate-state/verify-own-holds.d.ts.map +1 -1
  209. package/dist/queries/delivery-gate-state/verify-own-holds.js.map +1 -1
  210. package/dist/queries/escalations/cause-key.d.ts.map +1 -1
  211. package/dist/queries/escalations/cause-key.js +1 -0
  212. package/dist/queries/escalations/cause-key.js.map +1 -1
  213. package/dist/queries/escalations/escalation-consumption.d.ts +13 -0
  214. package/dist/queries/escalations/escalation-consumption.d.ts.map +1 -1
  215. package/dist/queries/escalations/escalation-consumption.js +12 -2
  216. package/dist/queries/escalations/escalation-consumption.js.map +1 -1
  217. package/dist/queries/escalations/escalations.d.ts.map +1 -1
  218. package/dist/queries/escalations/escalations.js +2 -1
  219. package/dist/queries/escalations/escalations.js.map +1 -1
  220. package/dist/queries/escalations/tower-escalations.d.ts +82 -0
  221. package/dist/queries/escalations/tower-escalations.d.ts.map +1 -0
  222. package/dist/queries/escalations/tower-escalations.js +97 -0
  223. package/dist/queries/escalations/tower-escalations.js.map +1 -0
  224. package/dist/queries/focus-review/recorded-concern-ids.d.ts +48 -11
  225. package/dist/queries/focus-review/recorded-concern-ids.d.ts.map +1 -1
  226. package/dist/queries/focus-review/recorded-concern-ids.js +42 -12
  227. package/dist/queries/focus-review/recorded-concern-ids.js.map +1 -1
  228. package/dist/queries/focus-review/review-criterion-verdicts.d.ts +37 -0
  229. package/dist/queries/focus-review/review-criterion-verdicts.d.ts.map +1 -0
  230. package/dist/queries/focus-review/review-criterion-verdicts.js +64 -0
  231. package/dist/queries/focus-review/review-criterion-verdicts.js.map +1 -0
  232. package/dist/queries/focus-review/review-finding-facts.d.ts +18 -6
  233. package/dist/queries/focus-review/review-finding-facts.d.ts.map +1 -1
  234. package/dist/queries/focus-review/review-finding-facts.js +21 -8
  235. package/dist/queries/focus-review/review-finding-facts.js.map +1 -1
  236. package/dist/queries/focuses/ended-arm.d.ts +56 -13
  237. package/dist/queries/focuses/ended-arm.d.ts.map +1 -1
  238. package/dist/queries/focuses/ended-arm.js +40 -14
  239. package/dist/queries/focuses/ended-arm.js.map +1 -1
  240. package/dist/queries/focuses/focus-criteria-standing.d.ts +12 -0
  241. package/dist/queries/focuses/focus-criteria-standing.d.ts.map +1 -1
  242. package/dist/queries/focuses/focus-criteria-standing.js +13 -0
  243. package/dist/queries/focuses/focus-criteria-standing.js.map +1 -1
  244. package/dist/queries/focuses/focus-discovery.d.ts +14 -3
  245. package/dist/queries/focuses/focus-discovery.d.ts.map +1 -1
  246. package/dist/queries/focuses/focus-discovery.js +2 -19
  247. package/dist/queries/focuses/focus-discovery.js.map +1 -1
  248. package/dist/queries/focuses/focuses.d.ts +15 -12
  249. package/dist/queries/focuses/focuses.d.ts.map +1 -1
  250. package/dist/queries/focuses/focuses.js +15 -13
  251. package/dist/queries/focuses/focuses.js.map +1 -1
  252. package/dist/queries/sessions/sessions.d.ts.map +1 -1
  253. package/dist/queries/sessions/sessions.js +2 -1
  254. package/dist/queries/sessions/sessions.js.map +1 -1
  255. package/dist/queries/tower-decisions/tower-decisions.d.ts +103 -0
  256. package/dist/queries/tower-decisions/tower-decisions.d.ts.map +1 -0
  257. package/dist/queries/tower-decisions/tower-decisions.js +138 -0
  258. package/dist/queries/tower-decisions/tower-decisions.js.map +1 -0
  259. package/dist/queries/verification/verification.js +1 -1
  260. package/dist/queries/wire-schemas/schemas.d.ts +2 -0
  261. package/dist/queries/wire-schemas/schemas.d.ts.map +1 -1
  262. package/dist/queries/wire-schemas/schemas.js +8 -2
  263. package/dist/queries/wire-schemas/schemas.js.map +1 -1
  264. package/dist/queries/workstation-intervals/workstation-intervals.d.ts +52 -0
  265. package/dist/queries/workstation-intervals/workstation-intervals.d.ts.map +1 -0
  266. package/dist/queries/workstation-intervals/workstation-intervals.js +49 -0
  267. package/dist/queries/workstation-intervals/workstation-intervals.js.map +1 -0
  268. package/dist/resolvers/escalation-answers.d.ts +31 -0
  269. package/dist/resolvers/escalation-answers.d.ts.map +1 -1
  270. package/dist/resolvers/escalation-answers.js +31 -17
  271. package/dist/resolvers/escalation-answers.js.map +1 -1
  272. package/dist/resolvers/focus-criteria-standing.d.ts.map +1 -1
  273. package/dist/resolvers/focus-criteria-standing.js +20 -0
  274. package/dist/resolvers/focus-criteria-standing.js.map +1 -1
  275. package/dist/shell/unified-engine-lifecycle.d.ts +11 -1
  276. package/dist/shell/unified-engine-lifecycle.d.ts.map +1 -1
  277. package/dist/shell/unified-engine-lifecycle.js +10 -1
  278. package/dist/shell/unified-engine-lifecycle.js.map +1 -1
  279. package/dist/spawn/directive-dispatch.d.ts.map +1 -1
  280. package/dist/spawn/directive-dispatch.js +1 -0
  281. package/dist/spawn/directive-dispatch.js.map +1 -1
  282. package/dist/spawn/lead-continuation.d.ts +4 -3
  283. package/dist/spawn/lead-continuation.d.ts.map +1 -1
  284. package/dist/spawn/lead-continuation.js.map +1 -1
  285. package/dist/spawn/live-answer-delivery.d.ts +53 -0
  286. package/dist/spawn/live-answer-delivery.d.ts.map +1 -0
  287. package/dist/spawn/live-answer-delivery.js +26 -0
  288. package/dist/spawn/live-answer-delivery.js.map +1 -0
  289. package/dist/spawn/routing-decider-spawn.d.ts +64 -2
  290. package/dist/spawn/routing-decider-spawn.d.ts.map +1 -1
  291. package/dist/spawn/routing-decider-spawn.js +65 -20
  292. package/dist/spawn/routing-decider-spawn.js.map +1 -1
  293. package/dist/spawn/worktree-session.d.ts +7 -5
  294. package/dist/spawn/worktree-session.d.ts.map +1 -1
  295. package/dist/spawn/worktree-session.js +11 -7
  296. package/dist/spawn/worktree-session.js.map +1 -1
  297. package/dist/supervision/escalation-filing.js +1 -1
  298. package/dist/supervision/incident-correlation.d.ts +4 -1
  299. package/dist/supervision/incident-correlation.d.ts.map +1 -1
  300. package/dist/supervision/incident-correlation.js +7 -2
  301. package/dist/supervision/incident-correlation.js.map +1 -1
  302. package/dist/supervision/review-cycle-cap-hold.d.ts +11 -5
  303. package/dist/supervision/review-cycle-cap-hold.d.ts.map +1 -1
  304. package/dist/supervision/review-cycle-cap-hold.js +29 -11
  305. package/dist/supervision/review-cycle-cap-hold.js.map +1 -1
  306. package/dist/supervision/review-loop-detector.d.ts +48 -0
  307. package/dist/supervision/review-loop-detector.d.ts.map +1 -0
  308. package/dist/supervision/review-loop-detector.js +13 -0
  309. package/dist/supervision/review-loop-detector.js.map +1 -0
  310. package/dist/supervision/review-loop-hold.d.ts +29 -0
  311. package/dist/supervision/review-loop-hold.d.ts.map +1 -0
  312. package/dist/supervision/review-loop-hold.js +99 -0
  313. package/dist/supervision/review-loop-hold.js.map +1 -0
  314. package/dist/supervision/stall-detector-config.d.ts +8 -0
  315. package/dist/supervision/stall-detector-config.d.ts.map +1 -1
  316. package/dist/supervision/stall-detector-config.js +14 -3
  317. package/dist/supervision/stall-detector-config.js.map +1 -1
  318. package/dist/supervision/stop-registry.d.ts +4 -0
  319. package/dist/supervision/stop-registry.d.ts.map +1 -1
  320. package/dist/supervision/stop-registry.js +3 -1
  321. package/dist/supervision/stop-registry.js.map +1 -1
  322. package/dist/supervision/stop-rows-delivery.d.ts +10 -0
  323. package/dist/supervision/stop-rows-delivery.d.ts.map +1 -1
  324. package/dist/supervision/stop-rows-delivery.js +29 -0
  325. package/dist/supervision/stop-rows-delivery.js.map +1 -1
  326. package/dist/supervision/stop-rows-review-loop.d.ts +35 -0
  327. package/dist/supervision/stop-rows-review-loop.d.ts.map +1 -0
  328. package/dist/supervision/stop-rows-review-loop.js +150 -0
  329. package/dist/supervision/stop-rows-review-loop.js.map +1 -0
  330. package/dist/supervision/stop-rows-team-session.d.ts +1 -1
  331. package/dist/supervision/stop-rows-team-session.d.ts.map +1 -1
  332. package/dist/supervision/stop-rows-team-session.js.map +1 -1
  333. package/dist/supervision/unreviewed-settle-detector.d.ts +7 -2
  334. package/dist/supervision/unreviewed-settle-detector.d.ts.map +1 -1
  335. package/dist/supervision/unreviewed-settle-detector.js +15 -2
  336. package/dist/supervision/unreviewed-settle-detector.js.map +1 -1
  337. package/dist/templates/agents-md.d.ts.map +1 -1
  338. package/dist/templates/agents-md.js +1 -0
  339. package/dist/templates/agents-md.js.map +1 -1
  340. package/dist/templates/claude-md.d.ts +1 -1
  341. package/dist/templates/claude-md.d.ts.map +1 -1
  342. package/dist/templates/claude-md.js +12 -0
  343. package/dist/templates/claude-md.js.map +1 -1
  344. package/dist/testing/fixtures/api-client.js +1 -1
  345. package/dist/testing/fixtures/index.js +1 -1
  346. package/dist/testing/fixtures/pending-spawn-world.d.ts +4 -0
  347. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -1
  348. package/dist/testing/fixtures/pending-spawn-world.js +15 -2
  349. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  350. package/dist/testing/fixtures/recording-api-client.js +1 -1
  351. package/dist/testing/fixtures/review-exit-deps.d.ts.map +1 -1
  352. package/dist/testing/fixtures/review-exit-deps.js +3 -1
  353. package/dist/testing/fixtures/review-exit-deps.js.map +1 -1
  354. package/dist/testing/fixtures/review-loop.d.ts +19 -0
  355. package/dist/testing/fixtures/review-loop.d.ts.map +1 -0
  356. package/dist/testing/fixtures/review-loop.js +30 -0
  357. package/dist/testing/fixtures/review-loop.js.map +1 -0
  358. package/dist/testing/fixtures/shortfall-rework-hold-deps.d.ts.map +1 -1
  359. package/dist/testing/fixtures/shortfall-rework-hold-deps.js +1 -0
  360. package/dist/testing/fixtures/shortfall-rework-hold-deps.js.map +1 -1
  361. package/dist/testing/fixtures/tower-loop.d.ts +28 -0
  362. package/dist/testing/fixtures/tower-loop.d.ts.map +1 -0
  363. package/dist/testing/fixtures/tower-loop.js +83 -0
  364. package/dist/testing/fixtures/tower-loop.js.map +1 -0
  365. package/dist/tower/tower-escalation-gather.d.ts +33 -0
  366. package/dist/tower/tower-escalation-gather.d.ts.map +1 -0
  367. package/dist/tower/tower-escalation-gather.js +38 -0
  368. package/dist/tower/tower-escalation-gather.js.map +1 -0
  369. package/dist/tower/tower-escalation-prompt.d.ts +62 -0
  370. package/dist/tower/tower-escalation-prompt.d.ts.map +1 -0
  371. package/dist/tower/tower-escalation-prompt.js +130 -0
  372. package/dist/tower/tower-escalation-prompt.js.map +1 -0
  373. package/dist/tower/tower-escalation-routing.d.ts +49 -0
  374. package/dist/tower/tower-escalation-routing.d.ts.map +1 -0
  375. package/dist/tower/tower-escalation-routing.js +53 -0
  376. package/dist/tower/tower-escalation-routing.js.map +1 -0
  377. package/dist/tower/tower-escalation-session.d.ts +149 -0
  378. package/dist/tower/tower-escalation-session.d.ts.map +1 -0
  379. package/dist/tower/tower-escalation-session.js +238 -0
  380. package/dist/tower/tower-escalation-session.js.map +1 -0
  381. package/dist/tower/tower-supervisor-history.d.ts +129 -0
  382. package/dist/tower/tower-supervisor-history.d.ts.map +1 -0
  383. package/dist/tower/tower-supervisor-history.js +217 -0
  384. package/dist/tower/tower-supervisor-history.js.map +1 -0
  385. package/dist/tower/tower-supervisor-prompt.d.ts +21 -0
  386. package/dist/tower/tower-supervisor-prompt.d.ts.map +1 -0
  387. package/dist/tower/tower-supervisor-prompt.js +205 -0
  388. package/dist/tower/tower-supervisor-prompt.js.map +1 -0
  389. package/dist/tower/tower-supervisor-session.d.ts +220 -0
  390. package/dist/tower/tower-supervisor-session.d.ts.map +1 -0
  391. package/dist/tower/tower-supervisor-session.js +307 -0
  392. package/dist/tower/tower-supervisor-session.js.map +1 -0
  393. package/dist/tower/tower-supervisor.d.ts +86 -0
  394. package/dist/tower/tower-supervisor.d.ts.map +1 -0
  395. package/dist/tower/tower-supervisor.js +8 -0
  396. package/dist/tower/tower-supervisor.js.map +1 -0
  397. package/dist/types/index.js +1 -1
  398. package/dist/verify/deterministic-gate/verification-deterministic.js +1 -1
  399. package/dist/verify/effect-reconciliation/verify-reconciliation.d.ts +11 -0
  400. package/dist/verify/effect-reconciliation/verify-reconciliation.d.ts.map +1 -1
  401. package/dist/verify/effect-reconciliation/verify-reconciliation.js +35 -2
  402. package/dist/verify/effect-reconciliation/verify-reconciliation.js.map +1 -1
  403. package/dist/verify/effect-reconciliation/verify-restatement.d.ts +4 -0
  404. package/dist/verify/effect-reconciliation/verify-restatement.d.ts.map +1 -1
  405. package/dist/verify/effect-reconciliation/verify-restatement.js +3 -3
  406. package/dist/verify/effect-reconciliation/verify-restatement.js.map +1 -1
  407. package/dist/verify/engine/reconciliation-step.d.ts +9 -2
  408. package/dist/verify/engine/reconciliation-step.d.ts.map +1 -1
  409. package/dist/verify/engine/reconciliation-step.js +26 -3
  410. package/dist/verify/engine/reconciliation-step.js.map +1 -1
  411. package/dist/verify/outcome-routing/incurable-model-hold.d.ts +2 -0
  412. package/dist/verify/outcome-routing/incurable-model-hold.d.ts.map +1 -1
  413. package/dist/verify/outcome-routing/incurable-model-hold.js +21 -6
  414. package/dist/verify/outcome-routing/incurable-model-hold.js.map +1 -1
  415. package/dist/verify/outcome-routing/repeating-model-hold.d.ts.map +1 -1
  416. package/dist/verify/outcome-routing/repeating-model-hold.js +13 -7
  417. package/dist/verify/outcome-routing/repeating-model-hold.js.map +1 -1
  418. package/dist/verify/outcome-routing/unjudged-node-hold.d.ts +31 -0
  419. package/dist/verify/outcome-routing/unjudged-node-hold.d.ts.map +1 -0
  420. package/dist/verify/outcome-routing/unjudged-node-hold.js +134 -0
  421. package/dist/verify/outcome-routing/unjudged-node-hold.js.map +1 -0
  422. package/dist/verify/outcome-routing/verification-model-unavailable-hold.d.ts +4 -0
  423. package/dist/verify/outcome-routing/verification-model-unavailable-hold.d.ts.map +1 -1
  424. package/dist/verify/outcome-routing/verification-model-unavailable-hold.js +25 -8
  425. package/dist/verify/outcome-routing/verification-model-unavailable-hold.js.map +1 -1
  426. package/dist/verify/outcome-routing/verification-rework-issue.d.ts +4 -4
  427. package/dist/verify/outcome-routing/verification-rework-issue.d.ts.map +1 -1
  428. package/dist/verify/outcome-routing/verification-rework-issue.js +16 -6
  429. package/dist/verify/outcome-routing/verification-rework-issue.js.map +1 -1
  430. package/dist/verify/shortfalls/pre-judge-rulings.d.ts.map +1 -1
  431. package/dist/verify/shortfalls/pre-judge-rulings.js +1 -0
  432. package/dist/verify/shortfalls/pre-judge-rulings.js.map +1 -1
  433. package/package.json +3 -3
package/build-info.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "commitSha": "0c39811a4",
3
- "builtAt": "2026-10-20T08:11:51.168Z",
2
+ "commitSha": "4bf29ad59",
3
+ "builtAt": "2026-10-21T12:26:57.727Z",
4
4
  "expectedMigrations": [
5
5
  "20250829113330_create_org_nodes_table.sql",
6
6
  "20250829113402_fix_function_security_search_path.sql",
@@ -890,6 +890,13 @@
890
890
  "20261019155414_focus_run_ended_with_recorded_work.sql",
891
891
  "20261019211406_radar_overviews_carry_delivery_state.sql",
892
892
  "20261019211946_radar_theme_closes_as_delivered.sql",
893
- "20261020010002_candidate_ci_reds.sql"
893
+ "20261020010002_candidate_ci_reds.sql",
894
+ "20261020133821_every_arm_end_records_its_reason.sql",
895
+ "20261020134253_linkless_review_filings_are_concerns.sql",
896
+ "20261020142139_armed_criterion_amendment.sql",
897
+ "20261020142509_review_criterion_verdicts_and_tower_decisions.sql",
898
+ "20261020143122_workstation_capacity_and_slot_wait_intervals.sql",
899
+ "20261020155839_escalation_tower_routing.sql",
900
+ "20261021012543_issue_keys_product_unique.sql"
894
901
  ]
895
902
  }
@@ -1 +1 @@
1
- {"version":3,"file":"audit-prompt.d.ts","sourceRoot":"","sources":["../../src/audit/audit-prompt.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAC;AA0OhD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAU9D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,QAAgC,CAAC"}
1
+ {"version":3,"file":"audit-prompt.d.ts","sourceRoot":"","sources":["../../src/audit/audit-prompt.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAC;AAyPhD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAU9D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,QAAgC,CAAC"}
@@ -152,6 +152,21 @@ criterion only the FOCUS can satisfy (an outcome that spans deliveries) belongs
152
152
  at the focus altitude: relocate it there rather than parking it on a delivery
153
153
  that cannot measure it and annotating it away.
154
154
 
155
+ ## Intent speaks in universals; criteria must not
156
+ A product owner states intent in universals -- "any", "all", "every", "only
157
+ when", "never". Do not copy them into a delivery's acceptance criteria or an
158
+ effect's future (\`frtStatement\`, \`restatements\`). A universal over OPEN-ENDED
159
+ input -- what a model says, what a user asks, every phrasing, any call however
160
+ the code writes it -- can never be held by a test: each review finds one more
161
+ case it misses, and the loop never converges. Translate it into a **closed list
162
+ of the cases that matter, each held by a test, plus a named place where
163
+ everything beyond the list is judged** (a grader, the battery, QA). A universal
164
+ over a closed set ("every delivery in this focus") needs no translation. When a
165
+ criterion or a future you write quantifies over open-ended input, the write
166
+ lands and the response carries an \`unbounded_criterion\` warning naming the
167
+ words; it never refuses the write or the arm -- rewrite the criterion in the
168
+ shape it names.
169
+
155
170
  ## Statement quality (Goldratt Categories of Legitimate Reservation)
156
171
  Hold every node to three statement-quality reservations AS YOU WRITE IT --
157
172
  inline with the rounds above, not a separate pass:
@@ -1 +1 @@
1
- {"version":3,"file":"audit-prompt.js","sourceRoot":"","sources":["../../src/audit/audit-prompt.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iEAAiE;AACjE,mDAAmD;AACnD,yEAAyE;AACzE,gBAAgB;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA+B7D;;;;;GAKG;AACH,MAAM,WAAW,GAAsB;IACrC,uEAAuE;IACvE,EAAE;IACF,ujBAAujB;CACxjB,CAAC;AAEF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,6CAA6C;AAC7C,kCAAkC;AAClC,MAAM,yBAAyB,GAAG,0/BAA0/B,CAAC;AAC7hC,gCAAgC;AAEhC;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,OAAqB;IAChD,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QAC5B,OAAO;YACL,EAAE;YACF,6RAA6R;SAC9R,CAAC;IACJ,CAAC;IACD,OAAO;QACL,EAAE;QACF,6DAA6D,GAAG,yBAAyB,GAAG,2TAA2T;KACxZ,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,kBAAkB,GAAsB;IAC5C,EAAE;IACF,yIAAyI;IACzI,EAAE;IACF,kBAAkB;IAClB,0BAA0B;IAC1B,0BAA0B;IAC1B,YAAY;IACZ,4IAA4I;IAC5I,KAAK;IACL,EAAE;IACF,6LAA6L;CAC9L,CAAC;AAEF,+EAA+E;AAC/E,uEAAuE;AACvE,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,oCAA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AU,gBAAgB,CAAC,OAAqB;IACpD,OAAO;QACL,GAAG,WAAW;QACd,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC/B,EAAE;QACF,kBAAkB;QAClB,GAAG,oBAAoB;QACvB,GAAG,wBAAwB;QAC3B,GAAG,kBAAkB;KACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
@@ -39,9 +39,10 @@ export interface CompletionEventDeps {
39
39
  getFocusDeliveries: (focusId: string) => Promise<FocusDeliveryInfo[]>;
40
40
  getFocusIssues: (focusId: string) => Promise<FocusIssueInfo[]>;
41
41
  /**
42
- * The focus's recorded review concerns (delivery/recorded-concerns.ts; never
43
- * throws, fail-closed to empty), read once per turn with the work state: a
44
- * concern is the human's, so it is neither team work nor listed as work.
42
+ * The focus's recorded review concerns (delivery/recorded-concerns.ts), read once
43
+ * per turn with the work state: a concern is the human's, so it is neither team
44
+ * work nor listed as work. Unreadable classes keep the turn undecided
45
+ * (decide-turn-entry-rows.ts work-classes-unreadable).
45
46
  */
46
47
  readRecordedConcernIds: RecordedConcernReader;
47
48
  createEscalation: (params: CreateEscalationParams) => Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/completion/completion-event/event.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzI,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OA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AAI;KAC5D,CAAC,CAAC;AACL,CAAC;AAED,2EAA2E;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAA2B,EAC3B,IAAyB;IAEzB,2EAA2E;IAC3E,8EAA8E;IAC9E,mEAAmE;IACnE,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,uBAAuB,CAAC,2BAA2B,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IACvF,MAAM,mBAAmB,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -32,10 +32,17 @@
32
32
  * - any other routed cycle increments it. Below the budget nothing else
33
33
  * happens, so cycling below it is unchanged.
34
34
  * - at the budget: the count is written FIRST (so a failed un-arm still stops
35
- * by count -- supervision/review-cycle-cap-hold.ts), then the arm is released with
36
- * its reason, then the review window is closed. The count is NOT reset: it
37
- * is the fail-closed backstop for an un-arm write that did not land, and the
38
- * arm edge is what clears it.
35
+ * by count -- supervision/review-cycle-cap-hold.ts), then the arm is released
36
+ * with its reason AND the review window closed in ONE write (unless a
37
+ * delivery awaits its gate verdict, which keeps the window). The count is NOT
38
+ * reset: it is the fail-closed backstop for an un-arm write that did not land,
39
+ * and the arm edge is what clears it.
40
+ * - a release that FAILS closes nothing -- closing the window on its own would
41
+ * fire the DB's lifecycle clear, which would end the arm under a reason that
42
+ * is not this one -- and is handed to the backstop retry
43
+ * (spent-budget-release.ts), which re-attempts it with the same record on
44
+ * every cascade poll until it lands. The role is never left set under a
45
+ * silent cap hold.
39
46
  *
40
47
  * A DAEMON SHUTDOWN SPENDS NOTHING. A review team killed by a shutdown exits
41
48
  * with no inspection evidence, which routes exactly like a bounce -- so without
@@ -47,7 +54,8 @@
47
54
  *
48
55
  * @module completion/review-cycle-budget/review-cycle-cap
49
56
  */
50
- import type { setReviewCycleCount, releaseFocusArm, clearReviewRequestedAt } from '../../queries/focuses/focuses.js';
57
+ import type { setReviewCycleCount } from '../../queries/focuses/focuses.js';
58
+ import { type SpentBudgetRelease } from './spent-budget-release.js';
51
59
  import type { ReviewFiledFindingSummary } from '../review-exit/review-exit-escalations.js';
52
60
  import type { OpenConcernSummary } from '../../queries/focus-review/recorded-concern-ids.js';
53
61
  /** The routed review exit's facts the cycle count is decided from. */
@@ -86,16 +94,16 @@ export declare function reviewCycleConverged(outcome: Pick<ReviewCycleOutcome, '
86
94
  export interface ReviewCycleCapDeps {
87
95
  setReviewCycleCount: typeof setReviewCycleCount;
88
96
  resolveReviewCycleCap: () => number;
89
- clearReviewRequestedAt: typeof clearReviewRequestedAt;
90
97
  /**
91
98
  * The un-arm writer (queries/focuses/focuses.ts releaseFocusArm), which carries the
92
- * ended-arm record in the SAME edge call as the release. A release that fails
93
- * does not stop the run -- so the crossing REFUSES to pretend: it logs that the
94
- * arm was not ended and leaves the count at the budget, which holds every
95
- * spawn gate by itself. The composition root binds it
99
+ * ended-arm record -- and, when asked, the review-window close -- in the SAME
100
+ * edge call as the release. A release that fails does not stop the run -- so
101
+ * the crossing REFUSES to pretend: it logs that the arm was not ended, leaves
102
+ * the count at the budget (which holds every spawn gate by itself) and hands
103
+ * the record to the backstop retry. The composition root binds it
96
104
  * (composition/review-exit-context.ts; pinned by review-cycle-churn-meter.test.ts).
97
105
  */
98
- releaseFocusArm: typeof releaseFocusArm;
106
+ releaseFocusArm: SpentBudgetRelease;
99
107
  isShuttingDown: () => boolean;
100
108
  }
101
109
  /** The focus this exit belongs to. */
@@ -1 +1 @@
1
- {"version":3,"file":"review-cycle-cap.d.ts","sourceRoot":"","sources":["../../../src/completion/review-cycle-budget/review-cycle-cap.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAA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wBAAsB,+BAA+B,CACnD,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,qBAAqB,EAC1B,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
@@ -1,7 +1,10 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
- // Pinned by: packages/daemon/src/completion/review-cycle-budget/review-cycle-churn-meter.test.ts
2
+ // Pinned by: packages/daemon/src/completion/review-cycle-budget/review-cycle-churn-meter.test.ts,
3
+ // packages/daemon/src/completion/review-cycle-budget/review-loop-detection.test.ts,
4
+ // packages/daemon/src/completion/review-cycle-budget/spent-budget-release.test.ts
3
5
  // PINNED-BY-END
4
6
  import { ARM_ENDED_REVIEW_BUDGET_SPENT } from '../../queries/focuses/ended-arm.js';
7
+ import { rememberPendingSpentBudgetRelease } from './spent-budget-release.js';
5
8
  import { createLogger } from '../../log/daemon-log.js';
6
9
  import { stopFires } from '../../supervision/stop-registry.js';
7
10
  const log = createLogger({ module: 'focus-executor' });
@@ -21,28 +24,31 @@ async function writeCycleCount(setCount, ctx, count) {
21
24
  }
22
25
  }
23
26
  /**
24
- * End the armed run: release the role and record WHY, atomically, in one edge
25
- * call. Returns whether the write landed -- a failure leaves the count standing
26
- * at the budget, which is what holds the spawn gates until the write succeeds on
27
- * a later crossing or an operator acts.
27
+ * End the armed run: release the role, record WHY and (unless a gate verdict
28
+ * holds it) close the review window, atomically, in one edge call. Returns
29
+ * whether the write landed. A failure closes nothing and hands the record to
30
+ * the backstop retry (spent-budget-release.ts), which re-attempts it every
31
+ * cascade poll while the count stands at the budget.
28
32
  */
29
33
  async function endArmForSpentBudget(release, ctx, args) {
34
+ const record = {
35
+ reason: ARM_ENDED_REVIEW_BUDGET_SPENT,
36
+ detail: {
37
+ reviewCycleCount: args.cycleCount,
38
+ cap: args.cap,
39
+ openBlockingFindings: args.openBlockingFindings.map((f) => ({
40
+ id: f.id, key: f.key, title: f.title, deliveryId: f.deliveryId ?? null,
41
+ })),
42
+ openConcerns: args.openConcerns.map((c) => ({ id: c.id, key: c.key, title: c.title, deliveryId: c.deliveryId })),
43
+ },
44
+ };
30
45
  try {
31
- await release(ctx.focusId, {
32
- reason: ARM_ENDED_REVIEW_BUDGET_SPENT,
33
- detail: {
34
- reviewCycleCount: args.cycleCount,
35
- cap: args.cap,
36
- openBlockingFindings: args.openBlockingFindings.map((f) => ({
37
- id: f.id, key: f.key, title: f.title, deliveryId: f.deliveryId ?? null,
38
- })),
39
- openConcerns: args.openConcerns.map((c) => ({ id: c.id, key: c.key, title: c.title, deliveryId: c.deliveryId })),
40
- },
41
- });
46
+ await release(ctx.focusId, record, { closeReviewWindow: args.closeReviewWindow });
42
47
  return true;
43
48
  }
44
49
  catch (err) {
45
50
  log.warn(`[focus-executor] releaseFocusArm (review budget) failed for "${ctx.focusName}": ${err.message}`);
51
+ rememberPendingSpentBudgetRelease(ctx.focusId, { record, closeReviewWindow: args.closeReviewWindow });
46
52
  return false;
47
53
  }
48
54
  }
@@ -77,28 +83,22 @@ export async function recordReviewCycleAndMaybeEndArm(deps, ctx, priorCycleCount
77
83
  await writeCycleCount(deps.setReviewCycleCount, ctx, cycleCount);
78
84
  if (!stopFires('review_budget_spent', { reviewCycleCount: cycleCount, cap }))
79
85
  return;
80
- // The arm goes FIRST, before the window. Closing the review window fires
81
- // clear_focus_team_on_review_window_close(), which nulls the role WITHOUT a
82
- // reason -- so a focus disarmed by that trigger would read as a lifecycle
83
- // clear. Releasing the arm here means the trigger finds the role already null
84
- // and the recorded reason stands.
85
- const armEnded = await endArmForSpentBudget(deps.releaseFocusArm, ctx, { cycleCount, cap, openBlockingFindings: outcome.openBlockingFindings, openConcerns: outcome.openConcerns ?? [] });
86
- // Close the window unless a delivery awaits its gate verdict -- that replay
87
- // converges without a spawn and needs the window.
88
- if (!outcome.verdictHeldAny) {
89
- try {
90
- await deps.clearReviewRequestedAt(ctx.focusId);
91
- }
92
- catch (err) {
93
- log.warn(`[focus-executor] clearReviewRequestedAt (review budget) failed for "${ctx.focusName}": ${err.message}`);
94
- }
95
- }
86
+ // ONE write: the arm, its reason and (unless a delivery awaits its gate
87
+ // verdict -- that replay converges without a spawn and needs the window) the
88
+ // window close. Closing the window in a separate write would fire
89
+ // clear_focus_team_on_review_window_close(), which ends the arm under the
90
+ // lifecycle reason instead of this one.
91
+ const closeReviewWindow = !outcome.verdictHeldAny;
92
+ const armEnded = await endArmForSpentBudget(deps.releaseFocusArm, ctx, {
93
+ cycleCount, cap, closeReviewWindow,
94
+ openBlockingFindings: outcome.openBlockingFindings, openConcerns: outcome.openConcerns ?? [],
95
+ });
96
96
  log.warn(`[focus-executor] "${ctx.focusName}" spent its review-cycle budget without converging (${cycleCount} >= cap ${cap}): ` +
97
97
  (armEnded
98
98
  ? `the armed run has ENDED -- the focus is un-armed with arm_ended_reason='review_budget_spent' ` +
99
- `(${outcome.openBlockingFindings.length} open blocking review-filed finding(s), none closed). Only a new arm grants further cycles.`
100
- : `the arm was NOT ended (the release write failed) -- ` +
101
- `the count stands at the budget, which holds every spawn gate until a release lands or the focus is re-armed.`) +
102
- ` Review window ${outcome.verdictHeldAny ? 'left open for a pending gate verdict' : 'closed'}.`);
99
+ `(${outcome.openBlockingFindings.length} open blocking review-filed finding(s), none closed). Only a new arm grants further cycles.` +
100
+ ` Review window ${closeReviewWindow ? 'closed in the same write' : 'left open for a pending gate verdict'}.`
101
+ : `the arm was NOT ended (the release write failed) -- the count stands at the budget, which holds every ` +
102
+ `spawn gate, the review window is left as it was, and the release is re-attempted on every cascade poll until it lands.`));
103
103
  }
104
104
  //# sourceMappingURL=review-cycle-cap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-cycle-cap.js","sourceRoot":"","sources":["../../../src/completion/review-cycle-budget/review-cycle-cap.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iGAAiG;AACjG,gBAAgB;AAqDhB,OAAO,EAAE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;QACrE,UAAU,EAAE,GAAG,EAAE,iBAAiB;QAClC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;KAC7F,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,CACN,qBAAqB,GAAG,CAAC,SAAS,uDAAuD,UAAU,WAAW,GAAG,KAAK;QACtH,CAAC,QAAQ;YACP,CAAC,CAAC,+FAA+F;gBAC/F,IAAI,OAAO,CAAC,oBAAoB,CAAC,MAAM,6FAA6F;gBACpI,kBAAkB,iBAAiB,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,sCAAsC,GAAG;YAC9G,CAAC,CAAC,wGAAwG;gBACxG,wHAAwH,CAAC,CAC9H,CAAC;AACJ,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * The review exit SEES a non-converging review loop and holds it BEFORE the
3
+ * review budget is spent.
4
+ *
5
+ * On every routed exit of a REVIEW session, before the review-cycle budget is
6
+ * recorded (recordReviewLoopThenCycle), the daemon reads the focus's
7
+ * per-criterion verdicts on its most recent reviews under the arm and asks the
8
+ * review_loop_detected stop row (supervision/review-loop-detector.ts) whether
9
+ * one criterion is failing alone, review after review, each review naming a
10
+ * new blocking finding against it. On a loop it:
11
+ * 1. records ONE `loop_detected` decision on the focus (focus_tower_decisions,
12
+ * decided_by_kind 'daemon'), carrying the criterion, the reviews, the
13
+ * blocking findings each named, the cycle count this exit records and the
14
+ * cap -- the durable hold every spawn gate reads
15
+ * (supervision/review-loop-hold.ts);
16
+ * 2. calls the Tower supervisor with it (tower/tower-supervisor.ts), which
17
+ * decides the loop without the operator and resolves it by recording a
18
+ * `loop_resolved` that names it.
19
+ *
20
+ * WHAT IS NOT RE-DETECTED. A focus with an open loop already is held: nothing
21
+ * new is recorded and the supervisor is not called again. Reviews completed
22
+ * before the newest `loop_resolved` are not evidence of a NEW loop -- the
23
+ * supervisor decided on them -- so a loop is detected again only from N reviews
24
+ * after the resolution.
25
+ *
26
+ * A DETECTED LOOP SPENDS NO REVIEW CYCLE. Detection is evaluated FIRST, and an
27
+ * exit that finds the focus held -- the loop it just recorded, or one already
28
+ * standing -- writes no cycle: the review belongs to the loop, which the Tower
29
+ * supervisor decides, so no arm spends its budget on it and no detecting exit
30
+ * can be the one that ends the arm. Every other exit records the cycle exactly
31
+ * as recordReviewCycleAndMaybeEndArm always has, so the budget is still the
32
+ * backstop for churn that is not a loop. The threshold is read at most at the
33
+ * cap (effectiveLoopThreshold): both are configurable, and a threshold at or
34
+ * above the cap would otherwise let the budget end the arm on a pure loop
35
+ * before the loop could be seen. With the defaults (threshold 3, cap 8) a loop
36
+ * is held after two counted cycles.
37
+ *
38
+ * Best-effort: a failed read or write is logged and leaves routing and the
39
+ * budget untouched. A daemon shutdown detects nothing (it is not a review
40
+ * cycle, as the budget reads it); a coding-session exit is not a review.
41
+ *
42
+ * @module completion/review-cycle-budget/review-loop-detection
43
+ */
44
+ import type { ReviewVerdictRecord } from '../../queries/focus-review/review-criterion-verdicts.js';
45
+ import type { TowerDecision, TowerDecisionInput } from '../../queries/tower-decisions/tower-decisions.js';
46
+ import type { ReviewLoopDetection } from '../../supervision/stop-rows-review-loop.js';
47
+ import type { TowerSupervisor } from '../../tower/tower-supervisor.js';
48
+ import { type ReviewCycleCapContext, type ReviewCycleCapDeps, type ReviewCycleOutcome } from './review-cycle-cap.js';
49
+ /** The collaborators of the detection; production binds them at the composition root. */
50
+ export interface ReviewLoopDetectionDeps {
51
+ /** The focus's verdict-bearing reviews since the arm, newest first, at most `limit`. */
52
+ listReviewCriterionVerdicts: (focusId: string, limit: number) => Promise<ReviewVerdictRecord[]>;
53
+ /** The focus's decisions (newest first) and its open loops. */
54
+ listTowerDecisions: (focusId: string) => Promise<{
55
+ decisions: TowerDecision[];
56
+ openLoopDecisionIds: string[];
57
+ }>;
58
+ recordTowerDecision: (input: TowerDecisionInput) => Promise<{
59
+ decision: TowerDecision;
60
+ created: boolean;
61
+ }>;
62
+ resolveReviewLoopThreshold: () => number;
63
+ towerSupervisor: TowerSupervisor;
64
+ }
65
+ /**
66
+ * Pure: the number of consecutive reviews a loop needs, as the detector reads
67
+ * it -- the configured threshold, never above the cap (a pure loop is then
68
+ * always seen on or before the exit that would spend the budget), never below 2.
69
+ */
70
+ export declare function effectiveLoopThreshold(threshold: number, cap: number): number;
71
+ /** What the detection did on one exit. */
72
+ export type ReviewLoopDetectionResult = 'not_a_review' | 'already_held' | 'no_loop' | 'held' | 'unreadable';
73
+ /** Pure: the reviews completed after the newest loop_resolved (all of them when none). */
74
+ export declare function reviewsAfterLastResolution(reviewsNewestFirst: readonly ReviewVerdictRecord[], decisions: readonly Pick<TowerDecision, 'kind' | 'createdAt'>[]): ReviewVerdictRecord[];
75
+ /** Pure: the decision a detected loop records. */
76
+ export declare function loopDetectedDecision(focusId: string, loop: ReviewLoopDetection, args: {
77
+ threshold: number;
78
+ reviewCycleCount: number;
79
+ cap: number;
80
+ }): TowerDecisionInput;
81
+ /**
82
+ * Detect a non-converging loop at a review exit and, on one, record it and call
83
+ * the supervisor. Best-effort: never throws.
84
+ */
85
+ export declare function detectAndHoldReviewLoop(deps: ReviewLoopDetectionDeps, ctx: ReviewCycleCapContext, args: {
86
+ sessionType?: 'coding' | 'review';
87
+ shuttingDown: boolean;
88
+ /** The count the focus stands at (a held exit writes none). */
89
+ reviewCycleCount: number;
90
+ cap: number;
91
+ }): Promise<ReviewLoopDetectionResult>;
92
+ /**
93
+ * The review exit's budget step with the loop detection ahead of it: detect
94
+ * (and hold) a non-converging loop FIRST; an exit that leaves the focus held
95
+ * spends no cycle, and any other exit records the review cycle exactly as
96
+ * recordReviewCycleAndMaybeEndArm always has.
97
+ */
98
+ export declare function recordReviewLoopThenCycle(deps: ReviewCycleCapDeps & {
99
+ reviewLoop: ReviewLoopDetectionDeps;
100
+ }, ctx: ReviewCycleCapContext, priorCycleCount: number, outcome: ReviewCycleOutcome): Promise<void>;
101
+ //# sourceMappingURL=review-loop-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-loop-detection.d.ts","sourceRoot":"","sources":["../../../src/completion/review-cycle-budget/review-loop-detection.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAE1G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAI/B,yFAAyF;AACzF,MAAM,WAAW,uBAAuB;IACtC,wFAAwF;IACxF,2BAA2B,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAChG,+DAA+D;IAC/D,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,aAAa,EAAE,CAAC;QAAC,mBAAmB,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAChH,mBAAmB,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,aAAa,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC3G,0BAA0B,EAAE,MAAM,MAAM,CAAC;IACzC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,0CAA0C;AAC1C,MAAM,MAAM,yBAAyB,GACjC,cAAc,GACd,cAAc,GACd,SAAS,GACT,MAAM,GACN,YAAY,CAAC;AAEjB,0FAA0F;AAC1F,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,SAAS,mBAAmB,EAAE,EAClD,SAAS,EAAE,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAAC,EAAE,GAC9D,mBAAmB,EAAE,CAGvB;AAED,kDAAkD;AAClD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACjE,kBAAkB,CA6BpB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,uBAAuB,EAC7B,GAAG,EAAE,qBAAqB,EAC1B,IAAI,EAAE;IACJ,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb,GACA,OAAO,CAAC,yBAAyB,CAAC,CAgCpC;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,kBAAkB,GAAG;IAAE,UAAU,EAAE,uBAAuB,CAAA;CAAE,EAClE,GAAG,EAAE,qBAAqB,EAC1B,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAef"}
@@ -0,0 +1,105 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/completion/review-cycle-budget/review-loop-detection.test.ts
3
+ // PINNED-BY-END
4
+ import { detectNonConvergingReviewLoop } from '../../supervision/review-loop-detector.js';
5
+ import { createLogger } from '../../log/daemon-log.js';
6
+ import { recordReviewCycleAndMaybeEndArm, } from './review-cycle-cap.js';
7
+ const log = createLogger({ module: 'focus-executor' });
8
+ /**
9
+ * Pure: the number of consecutive reviews a loop needs, as the detector reads
10
+ * it -- the configured threshold, never above the cap (a pure loop is then
11
+ * always seen on or before the exit that would spend the budget), never below 2.
12
+ */
13
+ export function effectiveLoopThreshold(threshold, cap) {
14
+ return Math.max(2, Math.min(Math.floor(threshold), Math.floor(cap)));
15
+ }
16
+ /** Pure: the reviews completed after the newest loop_resolved (all of them when none). */
17
+ export function reviewsAfterLastResolution(reviewsNewestFirst, decisions) {
18
+ const cutoff = Math.max(-Infinity, ...decisions.filter((d) => d.kind === 'loop_resolved').map((d) => Date.parse(d.createdAt)));
19
+ return reviewsNewestFirst.filter((r) => !(Date.parse(r.completedAt) <= cutoff));
20
+ }
21
+ /** Pure: the decision a detected loop records. */
22
+ export function loopDetectedDecision(focusId, loop, args) {
23
+ const findings = loop.rounds.map((r) => r.newBlockingIssueIds.length).reduce((a, b) => a + b, 0);
24
+ return {
25
+ focusId,
26
+ kind: 'loop_detected',
27
+ decidedByKind: 'daemon',
28
+ summary: `Held the review loop on criterion "${loop.criterion}": no further coding or review pass runs until the ` +
29
+ `loop is decided.`,
30
+ rationale: `The criterion was the only one not_met on ${loop.rounds.length} consecutive reviews under this arm ` +
31
+ `(every other criterion met or excused), and each review named a new blocking finding against it ` +
32
+ `(${findings} in all). Fixing one finding has produced the next: the loop is not converging, and ` +
33
+ `deciding why is a judgement for the Tower supervisor, not another review cycle. Held with ` +
34
+ `${args.reviewCycleCount} of a budget of ${args.cap} review cycles spent; the review that showed the loop spends none.`,
35
+ evidence: {
36
+ criterionKey: loop.criterionKey,
37
+ criterion: loop.criterion,
38
+ nodeId: loop.nodeId,
39
+ threshold: args.threshold,
40
+ reviewCycleCount: args.reviewCycleCount,
41
+ cap: args.cap,
42
+ reviews: loop.rounds.map((r) => ({
43
+ reviewId: r.reviewId, completedAt: r.completedAt, blockingIssueIds: r.blockingIssueIds, newBlockingIssueIds: r.newBlockingIssueIds,
44
+ })),
45
+ },
46
+ criterionKey: loop.criterionKey,
47
+ nodeId: loop.nodeId,
48
+ };
49
+ }
50
+ /**
51
+ * Detect a non-converging loop at a review exit and, on one, record it and call
52
+ * the supervisor. Best-effort: never throws.
53
+ */
54
+ export async function detectAndHoldReviewLoop(deps, ctx, args) {
55
+ if (args.shuttingDown || (args.sessionType !== undefined && args.sessionType !== 'review'))
56
+ return 'not_a_review';
57
+ try {
58
+ const record = await deps.listTowerDecisions(ctx.focusId);
59
+ if (record.openLoopDecisionIds.length > 0)
60
+ return 'already_held';
61
+ const threshold = effectiveLoopThreshold(deps.resolveReviewLoopThreshold(), args.cap);
62
+ const reviews = reviewsAfterLastResolution(await deps.listReviewCriterionVerdicts(ctx.focusId, threshold), record.decisions);
63
+ const loop = detectNonConvergingReviewLoop(reviews, threshold);
64
+ if (loop === null)
65
+ return 'no_loop';
66
+ const { decision, created } = await deps.recordTowerDecision(loopDetectedDecision(ctx.focusId, loop, { threshold, reviewCycleCount: args.reviewCycleCount, cap: args.cap }));
67
+ log.warn(`[focus-executor] "${ctx.focusName}" review loop does not converge: criterion "${loop.criterion}" failed alone on ` +
68
+ `${loop.rounds.length} consecutive reviews, each naming a new blocking finding. HELD (decision ` +
69
+ `${decision.towerDecisionId.slice(0, 8)}${created ? '' : ', already recorded'}) with ` +
70
+ `${args.reviewCycleCount} of ${args.cap} review cycles spent; the focus stays armed and the Tower supervisor decides it.`);
71
+ if (created) {
72
+ await deps.towerSupervisor.onLoopDetected({
73
+ focusId: ctx.focusId, focusName: ctx.focusName, decision,
74
+ criterionKey: loop.criterionKey, criterion: loop.criterion, nodeId: loop.nodeId,
75
+ rounds: loop.rounds, reviewCycleCount: args.reviewCycleCount, cap: args.cap,
76
+ }).catch((err) => log.warn(`[focus-executor] Tower supervisor failed on the held loop of "${ctx.focusName}": ${err.message} -- the loop stays held.`));
77
+ }
78
+ return 'held';
79
+ }
80
+ catch (err) {
81
+ log.warn(`[focus-executor] review-loop detection skipped for "${ctx.focusName}": ${err.message}`);
82
+ return 'unreadable';
83
+ }
84
+ }
85
+ /**
86
+ * The review exit's budget step with the loop detection ahead of it: detect
87
+ * (and hold) a non-converging loop FIRST; an exit that leaves the focus held
88
+ * spends no cycle, and any other exit records the review cycle exactly as
89
+ * recordReviewCycleAndMaybeEndArm always has.
90
+ */
91
+ export async function recordReviewLoopThenCycle(deps, ctx, priorCycleCount, outcome) {
92
+ const detected = await detectAndHoldReviewLoop(deps.reviewLoop, ctx, {
93
+ ...(outcome.sessionType ? { sessionType: outcome.sessionType } : {}),
94
+ shuttingDown: deps.isShuttingDown(),
95
+ reviewCycleCount: priorCycleCount,
96
+ cap: deps.resolveReviewCycleCap(),
97
+ });
98
+ if (detected === 'held' || detected === 'already_held') {
99
+ log.info(`[focus-executor] "${ctx.focusName}" review exit on a held loop -- no review cycle spent; the count stays at ` +
100
+ `${priorCycleCount} and the Tower supervisor decides the loop.`);
101
+ return;
102
+ }
103
+ await recordReviewCycleAndMaybeEndArm(deps, ctx, priorCycleCount, outcome);
104
+ }
105
+ //# sourceMappingURL=review-loop-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-loop-detection.js","sourceRoot":"","sources":["../../../src/completion/review-cycle-budget/review-loop-detection.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,8FAA8F;AAC9F,gBAAgB;AAgDhB,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAG1F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,+BAA+B,GAIhC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAavD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,GAAW;IACnE,OAAO,IAAI,CAAC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assigned gets its arm
4
+ * released, with arm_ended_reason = 'review_budget_spent', on the next cascade
5
+ * poll -- and on every poll after until the write lands.
6
+ *
7
+ * WHY. The budget crossing (review-cycle-cap.ts) writes the count first and
8
+ * then releases the arm. When the release write fails, the count alone holds
9
+ * every spawn gate (supervision/review-cycle-cap-hold.ts) -- with the role still
10
+ * set and no reason recorded, a hold nobody can read. This pass gives the hold a
11
+ * writer behind it, so the held state is transient by construction. History:
12
+ * docs/daemon/history-team-lifecycle.md (review-cycle-cap.ts).
13
+ *
14
+ * The same condition also arises with no failed write at all -- the cap lowered
15
+ * below a focus's standing count -- and is the same spent budget, so it is
16
+ * released the same way.
17
+ *
18
+ * WHAT IT SENDS. The record the failed crossing composed (remembered in this
19
+ * process, together with whether that crossing meant to close the review
20
+ * window), so the end names the findings the exit counted. With no remembered
21
+ * record (a daemon restart in between, or a lowered cap) it sends the count and
22
+ * the cap with `findingsBasis: 'not_measured'` -- the empty finding lists are an
23
+ * absence, not a reading -- and leaves the review window as it is (nothing
24
+ * read whether a gate verdict needs it).
25
+ *
26
+ * The decision is the stop registry's review_budget_spent row, read through
27
+ * isReviewCycleCapHeld -- but only on a READ count: an unreadable count holds
28
+ * every gate (fail closed) and releases nothing, because ending a run needs the
29
+ * fact, not its absence.
30
+ *
31
+ * @module completion/review-cycle-budget/spent-budget-release
32
+ */
33
+ import { type EndedArmRecord } from '../../queries/focuses/ended-arm.js';
34
+ /** The release writer the budget path uses (production: queries/focuses/focuses.ts releaseFocusArm). */
35
+ export type SpentBudgetRelease = (focusId: string, endedArm: EndedArmRecord, opts?: {
36
+ closeReviewWindow?: boolean;
37
+ }) => Promise<void>;
38
+ /** A release the crossing composed but could not land. */
39
+ export interface PendingSpentBudgetRelease {
40
+ record: EndedArmRecord;
41
+ closeReviewWindow: boolean;
42
+ }
43
+ /** Remember a release the crossing could not land, for the next cascade poll to retry. */
44
+ export declare function rememberPendingSpentBudgetRelease(focusId: string, pending: PendingSpentBudgetRelease): void;
45
+ /** Test seam: drop every remembered release. */
46
+ export declare function __resetPendingSpentBudgetReleases(): void;
47
+ /** Test/diagnostic read: the release remembered for a focus, if any. */
48
+ export declare function pendingSpentBudgetRelease(focusId: string): PendingSpentBudgetRelease | undefined;
49
+ /** The focus facts the retry decides from (one active-focus row). */
50
+ export interface SpentBudgetReleaseFacts {
51
+ focusId: string;
52
+ focusName: string;
53
+ /** product_focuses.assigned_agent_role_id. */
54
+ assignedAgentRoleId: string | null;
55
+ /** product_focuses.review_cycle_count; null = unread. */
56
+ reviewCycleCount: number | null;
57
+ }
58
+ export interface SpentBudgetReleaseDeps {
59
+ releaseFocusArm: SpentBudgetRelease;
60
+ resolveReviewCycleCap: () => number;
61
+ }
62
+ export type SpentBudgetReleaseOutcome = 'not_armed' | 'not_spent' | 'released' | 'failed';
63
+ /** Pure: the record a retry sends when no crossing record was remembered. */
64
+ export declare function unmeasuredSpentBudgetRecord(reviewCycleCount: number, cap: number): EndedArmRecord;
65
+ /**
66
+ * Release a still-armed focus whose review budget is spent. Never throws: a
67
+ * failed write stays pending and is re-attempted on the next poll.
68
+ */
69
+ export declare function releaseArmUnderSpentBudget(facts: SpentBudgetReleaseFacts, deps: SpentBudgetReleaseDeps): Promise<SpentBudgetReleaseOutcome>;
70
+ //# sourceMappingURL=spent-budget-release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spent-budget-release.d.ts","sourceRoot":"","sources":["../../../src/completion/review-cycle-budget/spent-budget-release.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAC;AAM5C,wGAAwG;AACxG,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,EACxB,IAAI,CAAC,EAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,KACnC,OAAO,CAAC,IAAI,CAAC,CAAC;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