@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-escalation-session.js","sourceRoot":"","sources":["../../src/tower/tower-escalation-session.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wEAAwE;AACxE,gBAAgB;AAsDhB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAA6B,MAAM,+BAA+B,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAA0B,MAAM,8BAA8B,CAAC;AAG5H,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAE9C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,yEAAyE;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1D,6GAA6G;AAC7G,MAAM,CAAC,MAAM,gCAAgC,GAAG,kBAAkB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;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I,OAAO,KAAK,YAAY;YAAE,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;;YACrD,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD,6DAA6D;AAC7D,MAAM,UAAU,+BAA+B,CAAC,IAAmC;IAIjF,MAAM,EAAE,GAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACrE,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;KACvE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,129 @@
1
+ import type { DaemonConfig, FocusDeliveryInfo, FocusIssueInfo } from '../types/index.js';
2
+ import type { CriterionVerdictRecord, ReviewVerdictRecord } from '../queries/focus-review/review-criterion-verdicts.js';
3
+ import type { TowerDecision } from '../queries/tower-decisions/tower-decisions.js';
4
+ /**
5
+ * Where a product keeps its standing decisions, in the order they are tried.
6
+ * A file is read whole (cut at the cap; logs are kept newest first); a
7
+ * directory (an ADR folder) contributes its markdown files, highest-numbered
8
+ * first. Conventional rather than configured: a product with its log elsewhere
9
+ * gets none, and the prompt says so.
10
+ */
11
+ export declare const STANDING_DECISIONS_PATHS: readonly string[];
12
+ /** The most standing-decision text one prompt carries. */
13
+ export declare const STANDING_DECISIONS_MAX_CHARS = 24000;
14
+ /** The most review-summary text one round carries. */
15
+ export declare const ROUND_SUMMARY_MAX_CHARS = 3000;
16
+ /** The most lines one git listing (log or stat) carries. */
17
+ export declare const GIT_LISTING_MAX_LINES = 40;
18
+ /** A held loop as its loop_detected decision recorded it. */
19
+ export interface HeldLoop {
20
+ towerDecisionId: string;
21
+ focusId: string;
22
+ criterionKey: string;
23
+ criterion: string;
24
+ nodeId: string | null;
25
+ createdAt: string;
26
+ /** The loop's reviews, oldest first, with the new blocking findings each named. */
27
+ reviews: Array<{
28
+ reviewId: string;
29
+ completedAt: string;
30
+ newBlockingIssueIds: string[];
31
+ }>;
32
+ }
33
+ /** Pure: the held loop a loop_detected decision recorded, or null when its evidence is unreadable. */
34
+ export declare function heldLoopOf(decision: TowerDecision): HeldLoop | null;
35
+ /** One blocking finding a round filed against the criterion. */
36
+ export interface LoopFinding {
37
+ issueId: string;
38
+ key: string | null;
39
+ title: string;
40
+ description: string | null;
41
+ status: string | null;
42
+ deliveryId: string | null;
43
+ relevantFiles: string | null;
44
+ }
45
+ /** One review of the loop. */
46
+ export interface LoopRound {
47
+ reviewId: string;
48
+ completedAt: string;
49
+ outcome: string | null;
50
+ reviewedSha: string | null;
51
+ /** The review's verdict on the held criterion (null when the review was not readable). */
52
+ verdict: CriterionVerdictRecord | null;
53
+ /** The review's summary, cut at ROUND_SUMMARY_MAX_CHARS: where each verdict's reasoning is written. */
54
+ summaryExcerpt: string | null;
55
+ findings: LoopFinding[];
56
+ /** git log + diff --stat from the previous round's commit to this one's (null on the first round or when unreadable). */
57
+ changeSincePrevious: string | null;
58
+ }
59
+ /** A product's standing decisions, as read. */
60
+ export interface StandingDecisions {
61
+ /** The path read (repo-relative), or null when none of STANDING_DECISIONS_PATHS held any. */
62
+ source: string | null;
63
+ text: string;
64
+ truncated: boolean;
65
+ }
66
+ /** The deliveries of the focus, so a Task can be filed on the right one. */
67
+ export interface LoopDelivery {
68
+ deliveryId: string;
69
+ name: string;
70
+ executionStatus: string;
71
+ }
72
+ /** Everything the supervisor is shown besides the loop itself. */
73
+ export interface LoopHistory {
74
+ rounds: LoopRound[];
75
+ /** git log + diff --stat from the last reviewed commit to the focus HEAD. */
76
+ changeSinceLastReview: string | null;
77
+ /** The test files the findings and the loop's commits touched -- the check under dispute. */
78
+ disputedChecks: string[];
79
+ deliveries: LoopDelivery[];
80
+ /** The assembled focus context (focus.context, focus.criteria_standing, loop.context). */
81
+ focusContext: string;
82
+ standingDecisions: StandingDecisions;
83
+ /** Every read that failed, by name, so the prompt says what is missing. */
84
+ readErrors: string[];
85
+ }
86
+ /** The outcome of one git command (daemon-core's GitResult, structurally). */
87
+ export interface GitRun {
88
+ success: boolean;
89
+ output: string;
90
+ }
91
+ /** The reads the gathering makes. Bound at the composition root. */
92
+ export interface LoopHistoryDeps {
93
+ listReviewCriterionVerdicts: (focusId: string, limit: number) => Promise<ReviewVerdictRecord[]>;
94
+ getFocusIssues: (focusId: string) => Promise<FocusIssueInfo[]>;
95
+ getFocusDeliveries: (focusId: string) => Promise<FocusDeliveryInfo[]>;
96
+ /** The focus's assembled context ladder (resolvers), as markdown. */
97
+ assembleFocusContext: (focusId: string, productId: string, config: DaemonConfig) => Promise<string>;
98
+ runGit: (args: string[], cwd: string) => GitRun;
99
+ /** A file's text, or null when it does not exist. */
100
+ readTextFile: (path: string) => string | null;
101
+ /** A directory's entry names, or null when it does not exist. */
102
+ listDirectory: (path: string) => string[] | null;
103
+ }
104
+ /** What one gathering is about. */
105
+ export interface GatherLoopHistoryArgs {
106
+ loop: HeldLoop;
107
+ productId: string;
108
+ config: DaemonConfig;
109
+ /** Where git runs and the standing decisions are read: the focus worktree, else the product repo. */
110
+ repoRoot: string;
111
+ }
112
+ /** Pure: whether a repo path is a test (a check). */
113
+ export declare function isTestPath(path: string): boolean;
114
+ /** Pure: the first `max` lines of `text`, with a marker when more were cut. */
115
+ export declare function firstLines(text: string, max: number): string;
116
+ /** Pure: `text` cut at `max` characters on a line boundary, and whether it was cut. */
117
+ export declare function boundText(text: string, max: number): {
118
+ text: string;
119
+ truncated: boolean;
120
+ };
121
+ /** Read the product's standing decisions from the first conventional path that holds any. */
122
+ export declare function readStandingDecisions(repoRoot: string, io: Pick<LoopHistoryDeps, 'readTextFile' | 'listDirectory'>): StandingDecisions;
123
+ /** Pure: the test paths named in a finding's relevant files or description. */
124
+ export declare function testPathsOfFinding(finding: Pick<LoopFinding, 'relevantFiles' | 'description' | 'title'>): string[];
125
+ /** Build the rounds of the loop, oldest first. Pure over its inputs. */
126
+ export declare function buildLoopRounds(loop: HeldLoop, reviews: readonly ReviewVerdictRecord[], issues: readonly FocusIssueInfo[]): Array<Omit<LoopRound, 'changeSincePrevious'>>;
127
+ /** Gather everything the supervisor is shown. Never throws: a failed read is named in readErrors. */
128
+ export declare function gatherLoopHistory(deps: LoopHistoryDeps, args: GatherLoopHistoryArgs): Promise<LoopHistory>;
129
+ //# sourceMappingURL=tower-supervisor-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-supervisor-history.d.ts","sourceRoot":"","sources":["../../src/tower/tower-supervisor-history.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AACxH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAErD,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAE7C,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAKxC,6DAA6D;AAC7D,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,OAAO,EAA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inned-by)
2
+ // Pinned by: packages/daemon/src/tower/tower-supervisor-history.test.ts,
3
+ // packages/daemon/src/tower/tower-supervisor-prompt.test.ts,
4
+ // packages/daemon/src/tower/tower-supervisor-session.test.ts
5
+ // PINNED-BY-END
6
+ /**
7
+ * What the Tower supervisor is shown about a held review loop: the LOOP'S
8
+ * HISTORY (each round's verdict on the criterion and the reasoning the review
9
+ * wrote, the blocking findings filed, what changed on the focus branch between
10
+ * rounds), the CHECK UNDER DISPUTE (the test files those findings and commits
11
+ * touched), the focus's deliveries, its assembled context (focus, criteria
12
+ * standing, loop) and the product's STANDING DECISIONS.
13
+ *
14
+ * Why standing decisions are read here: a daemon session loads no operator
15
+ * memory, so what the product has already ruled reaches the supervisor only if
16
+ * the daemon hands it over. They are read from the product repo by convention
17
+ * (STANDING_DECISIONS_PATHS, first that yields text; newest-first entries cut
18
+ * at STANDING_DECISIONS_MAX_CHARS).
19
+ *
20
+ * Every read is a REQUIRED collaborator (LoopHistoryDeps), bound at the
21
+ * composition root (composition/review-loop-context.ts). A failed read never
22
+ * fails the gathering: it is named in `readErrors`, which the prompt shows, so
23
+ * the supervisor knows what it was not given.
24
+ *
25
+ * @module tower/tower-supervisor-history
26
+ */
27
+ import { z } from 'zod';
28
+ /**
29
+ * Where a product keeps its standing decisions, in the order they are tried.
30
+ * A file is read whole (cut at the cap; logs are kept newest first); a
31
+ * directory (an ADR folder) contributes its markdown files, highest-numbered
32
+ * first. Conventional rather than configured: a product with its log elsewhere
33
+ * gets none, and the prompt says so.
34
+ */
35
+ export const STANDING_DECISIONS_PATHS = [
36
+ 'docs/DECISIONS.md', 'DECISIONS.md', 'docs/decisions.md', 'docs/adr', 'doc/adr', 'docs/decisions',
37
+ ];
38
+ /** The most standing-decision text one prompt carries. */
39
+ export const STANDING_DECISIONS_MAX_CHARS = 24_000;
40
+ /** The most review-summary text one round carries. */
41
+ export const ROUND_SUMMARY_MAX_CHARS = 3_000;
42
+ /** The most lines one git listing (log or stat) carries. */
43
+ export const GIT_LISTING_MAX_LINES = 40;
44
+ /** How many verdict-bearing reviews the history reads back to find the loop's rounds. */
45
+ const REVIEWS_READ = 20;
46
+ const LoopEvidenceSchema = z.object({
47
+ criterionKey: z.string(),
48
+ criterion: z.string(),
49
+ nodeId: z.string().nullable().optional(),
50
+ reviews: z.array(z.object({
51
+ reviewId: z.string(),
52
+ completedAt: z.string(),
53
+ newBlockingIssueIds: z.array(z.string()),
54
+ }).passthrough()),
55
+ }).passthrough();
56
+ /** Pure: the held loop a loop_detected decision recorded, or null when its evidence is unreadable. */
57
+ export function heldLoopOf(decision) {
58
+ if (decision.kind !== 'loop_detected')
59
+ return null;
60
+ const parsed = LoopEvidenceSchema.safeParse(decision.evidence);
61
+ if (!parsed.success)
62
+ return null;
63
+ const ev = parsed.data;
64
+ return {
65
+ towerDecisionId: decision.towerDecisionId,
66
+ focusId: decision.focusId,
67
+ criterionKey: decision.criterionKey ?? ev.criterionKey,
68
+ criterion: ev.criterion,
69
+ nodeId: decision.nodeId ?? ev.nodeId ?? null,
70
+ createdAt: decision.createdAt,
71
+ reviews: [...ev.reviews]
72
+ .sort((a, b) => Date.parse(a.completedAt) - Date.parse(b.completedAt))
73
+ .map((r) => ({ reviewId: r.reviewId, completedAt: r.completedAt, newBlockingIssueIds: r.newBlockingIssueIds })),
74
+ };
75
+ }
76
+ const TEST_PATH = /(^|\/)(__tests__|tests?|spec)\/|\.(test|spec)\.[cm]?[jt]sx?$|_test\.(go|py|rs)$|(^|\/)test_[^/]+\.py$|\.test\.sql$/;
77
+ const PATH_IN_TEXT = /[\w./@-]+\.[a-z]{1,5}\b/g;
78
+ /** Pure: whether a repo path is a test (a check). */
79
+ export function isTestPath(path) {
80
+ return TEST_PATH.test(path);
81
+ }
82
+ /** Pure: the first `max` lines of `text`, with a marker when more were cut. */
83
+ export function firstLines(text, max) {
84
+ const lines = text.trimEnd().split('\n');
85
+ return lines.length <= max ? lines.join('\n') : [...lines.slice(0, max), `... (${lines.length - max} more lines)`].join('\n');
86
+ }
87
+ /** Pure: `text` cut at `max` characters on a line boundary, and whether it was cut. */
88
+ export function boundText(text, max) {
89
+ if (text.length <= max)
90
+ return { text, truncated: false };
91
+ const cut = text.slice(0, max);
92
+ const lastNewline = cut.lastIndexOf('\n');
93
+ return { text: lastNewline > max / 2 ? cut.slice(0, lastNewline) : cut, truncated: true };
94
+ }
95
+ /** Read the product's standing decisions from the first conventional path that holds any. */
96
+ export function readStandingDecisions(repoRoot, io) {
97
+ for (const rel of STANDING_DECISIONS_PATHS) {
98
+ const abs = `${repoRoot.replace(/\/$/, '')}/${rel}`;
99
+ const entries = io.listDirectory(abs);
100
+ if (entries !== null) {
101
+ const files = entries.filter((e) => e.toLowerCase().endsWith('.md')).sort().reverse();
102
+ const parts = files.map((f) => `### ${rel}/${f}\n\n${io.readTextFile(`${abs}/${f}`) ?? ''}`.trimEnd());
103
+ const joined = parts.join('\n\n');
104
+ if (joined.trim() === '')
105
+ continue;
106
+ const bounded = boundText(joined, STANDING_DECISIONS_MAX_CHARS);
107
+ return { source: rel, text: bounded.text, truncated: bounded.truncated };
108
+ }
109
+ const text = io.readTextFile(abs);
110
+ if (text !== null && text.trim() !== '') {
111
+ const bounded = boundText(text, STANDING_DECISIONS_MAX_CHARS);
112
+ return { source: rel, text: bounded.text, truncated: bounded.truncated };
113
+ }
114
+ }
115
+ return { source: null, text: '', truncated: false };
116
+ }
117
+ /** The log + stat of a commit range, or null when git cannot read it. */
118
+ function describeRange(runGit, cwd, from, to) {
119
+ const log = runGit(['log', '--oneline', '--no-decorate', `${from}..${to}`], cwd);
120
+ const stat = runGit(['diff', '--stat', `${from}..${to}`], cwd);
121
+ if (!log.success || !stat.success)
122
+ return null;
123
+ const commits = log.output.trim() === '' ? '(no commits)' : firstLines(log.output, GIT_LISTING_MAX_LINES);
124
+ const files = stat.output.trim() === '' ? '(no file changes)' : firstLines(stat.output, GIT_LISTING_MAX_LINES);
125
+ return `Commits ${from.slice(0, 12)}..${to.slice(0, 12)}:\n${commits}\n\nFiles:\n${files}`;
126
+ }
127
+ /** The files a commit range changed (empty when unreadable). */
128
+ function changedFiles(runGit, cwd, from, to) {
129
+ const res = runGit(['diff', '--name-only', `${from}..${to}`], cwd);
130
+ return res.success ? res.output.split('\n').map((l) => l.trim()).filter((l) => l !== '') : [];
131
+ }
132
+ /** Pure: the test paths named in a finding's relevant files or description. */
133
+ export function testPathsOfFinding(finding) {
134
+ const text = [finding.relevantFiles ?? '', finding.description ?? '', finding.title].join('\n');
135
+ return [...new Set(text.match(PATH_IN_TEXT) ?? [])].filter(isTestPath);
136
+ }
137
+ function findingOf(issue) {
138
+ return {
139
+ issueId: issue.id, key: issue.key, title: issue.title, description: issue.description,
140
+ status: issue.status, deliveryId: issue.deliveryId, relevantFiles: issue.relevantFiles,
141
+ };
142
+ }
143
+ /** Run one read; on failure name it in `errors` and answer `fallback`. */
144
+ async function guarded(name, errors, fallback, read) {
145
+ try {
146
+ return await read();
147
+ }
148
+ catch (err) {
149
+ errors.push(`${name}: ${err.message}`);
150
+ return fallback;
151
+ }
152
+ }
153
+ /** Build the rounds of the loop, oldest first. Pure over its inputs. */
154
+ export function buildLoopRounds(loop, reviews, issues) {
155
+ const byId = new Map(reviews.map((r) => [r.reviewId, r]));
156
+ const issueById = new Map(issues.map((i) => [i.id, i]));
157
+ return loop.reviews.map((entry) => {
158
+ const review = byId.get(entry.reviewId);
159
+ const verdict = review?.criterionVerdicts.find((v) => v.criterionKey === loop.criterionKey) ?? null;
160
+ const ids = [...new Set([...entry.newBlockingIssueIds, ...(verdict?.issueIds ?? [])])];
161
+ const findings = ids.map((id) => {
162
+ const issue = issueById.get(id);
163
+ return issue ? findingOf(issue) : { issueId: id, key: null, title: '(issue not readable on this focus)', description: null, status: null, deliveryId: null, relevantFiles: null };
164
+ });
165
+ const summary = review?.summary ?? null;
166
+ return {
167
+ reviewId: entry.reviewId,
168
+ completedAt: review?.completedAt ?? entry.completedAt,
169
+ outcome: review?.outcome ?? null,
170
+ reviewedSha: review?.reviewedSha ?? null,
171
+ verdict,
172
+ summaryExcerpt: summary === null ? null : boundText(summary, ROUND_SUMMARY_MAX_CHARS).text,
173
+ findings,
174
+ };
175
+ });
176
+ }
177
+ /** Gather everything the supervisor is shown. Never throws: a failed read is named in readErrors. */
178
+ export async function gatherLoopHistory(deps, args) {
179
+ const { loop, repoRoot } = args;
180
+ const readErrors = [];
181
+ const [reviews, issues, deliveries, focusContext] = await Promise.all([
182
+ guarded('review verdicts', readErrors, [], () => deps.listReviewCriterionVerdicts(loop.focusId, REVIEWS_READ)),
183
+ guarded('focus issues', readErrors, [], () => deps.getFocusIssues(loop.focusId)),
184
+ guarded('focus deliveries', readErrors, [], () => deps.getFocusDeliveries(loop.focusId)),
185
+ guarded('focus context', readErrors, '', () => deps.assembleFocusContext(loop.focusId, args.productId, args.config)),
186
+ ]);
187
+ const base = buildLoopRounds(loop, reviews, issues);
188
+ const disputed = new Set(base.flatMap((r) => r.findings.flatMap(testPathsOfFinding)));
189
+ const rounds = base.map((round, i) => {
190
+ const prev = i > 0 ? base[i - 1]?.reviewedSha ?? null : null;
191
+ if (prev === null || round.reviewedSha === null)
192
+ return { ...round, changeSincePrevious: null };
193
+ for (const f of changedFiles(deps.runGit, repoRoot, prev, round.reviewedSha))
194
+ if (isTestPath(f))
195
+ disputed.add(f);
196
+ return { ...round, changeSincePrevious: describeRange(deps.runGit, repoRoot, prev, round.reviewedSha) };
197
+ });
198
+ const lastSha = [...base].reverse().find((r) => r.reviewedSha !== null)?.reviewedSha ?? null;
199
+ const changeSinceLastReview = lastSha === null ? null : describeRange(deps.runGit, repoRoot, lastSha, 'HEAD');
200
+ let standingDecisions = { source: null, text: '', truncated: false };
201
+ try {
202
+ standingDecisions = readStandingDecisions(repoRoot, deps);
203
+ }
204
+ catch (err) {
205
+ readErrors.push(`standing decisions: ${err.message}`);
206
+ }
207
+ return {
208
+ rounds,
209
+ changeSinceLastReview,
210
+ disputedChecks: [...disputed].sort(),
211
+ deliveries: deliveries.map((d) => ({ deliveryId: d.id, name: d.name, executionStatus: d.executionStatus ?? 'unknown' })),
212
+ focusContext,
213
+ standingDecisions,
214
+ readErrors,
215
+ };
216
+ }
217
+ //# sourceMappingURL=tower-supervisor-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-supervisor-history.js","sourceRoot":"","sources":["../../src/tower/tower-supervisor-history.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,yEAAyE;AACzE,+DAA+D;AAC/D,+DAA+D;AAC/D,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB;CAClG,CAAC;AAEF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAEnD,sDAAsD;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAE7C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC,yFAAyF;AACzF,MAAM,YAAY,GAAG,EAAE,CAAC;AAcxB,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACxC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CA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E,CAAC;IAC1G,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,IAAI,CAAC,EAAE,WAAW,IAAI,IAAI,CAAC;IAC7F,MAAM,qBAAqB,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9G,IAAI,iBAAiB,GAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACxF,IAAI,CAAC;QACH,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAC,IAAI,CAAC,uBAAwB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO;QACL,MAAM;QACN,qBAAqB;QACrB,cAAc,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE;QACpC,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,SAAS,EAAE,CAAC,CAAC;QACxH,YAAY;QACZ,iBAAiB;QACjB,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { HeldLoop, LoopHistory } from './tower-supervisor-history.js';
2
+ /** The last line the session prints, parsed into the log line (the record is what decides). */
3
+ export declare const TOWER_DECISION_LINE_PREFIX = "TOWER DECISION:";
4
+ /** Inputs of one supervisor prompt. */
5
+ export interface TowerSupervisorPromptInput {
6
+ focus: {
7
+ focusId: string;
8
+ focusName: string;
9
+ focusDescription: string | null;
10
+ productId: string;
11
+ };
12
+ loop: HeldLoop;
13
+ /** The id this session acts under: every amendment and decision it records carries it as agentSessionId. */
14
+ supervisorSessionId: string;
15
+ history: LoopHistory;
16
+ }
17
+ /** Pure: the whole supervisor prompt. */
18
+ export declare function buildTowerSupervisorPrompt(input: TowerSupervisorPromptInput): string;
19
+ /** Pure: the decision the session's last line states, or null. Informational: the record decides. */
20
+ export declare function parseTowerDecisionLine(stdout: string): 'bounded' | 'escalated' | null;
21
+ //# sourceMappingURL=tower-supervisor-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-supervisor-prompt.d.ts","sourceRoot":"","sources":["../../src/tower/tower-supervisor-prompt.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAa,MAAM,+BAA+B,CAAC;AAEtF,+FAA+F;AAC/F,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAE5D,uCAAuC;AACvC,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAClG,IAAI,EAAE,QAAQ,CAAC;IACf,4GAA4G;IAC5G,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,WAAW,CAAC;CACtB;AA2ID,yCAAyC;AACzC,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,CAiBpF;AAED,qGAAqG;AACrG,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAUrF"}
@@ -0,0 +1,205 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/tower/tower-supervisor-prompt.test.ts
3
+ // PINNED-BY-END
4
+ /**
5
+ * The Tower supervisor's PROMPT: a pure builder over the held loop and its
6
+ * history (tower/tower-supervisor-history.ts).
7
+ *
8
+ * The session decides the loop WITHOUT the operator, and reports what it
9
+ * decided on the focus (the operator ruling is in docs/DECISIONS.md and
10
+ * docs/daemon/invariants-review-and-arm.md). It is told, in
11
+ * order: spot-check the disputed check with ordinary inputs; bound the
12
+ * criterion to a closed list of the cases that matter, each held by a test,
13
+ * plus a named place where the rest is judged (design principle 17,
14
+ * prompts/bounded-universals.ts -- the same text every scoping pass carries);
15
+ * apply the bound with the amendment act; close the in-flight blocking
16
+ * finding(s); file any remaining Task on the right delivery; record each
17
+ * decision on the focus; and, when it cannot bound the criterion, escalate to
18
+ * the operator and record that instead.
19
+ *
20
+ * WHAT IT IS NEVER GIVEN: a budget lever. The prompt carries no review-cycle
21
+ * count, no cap, no arm, and no instruction that could grant cycles; it says
22
+ * outright that none exist for it. Pinned by tower-supervisor-prompt.test.ts.
23
+ * The prompt is not the bound: the session's Telora MCP server runs the scoped
24
+ * `tower_supervisor` profile (tower-supervisor-session.ts
25
+ * TOWER_SUPERVISOR_MCP_PROFILE), under which no tool can arm, unarm or grant
26
+ * review cycles.
27
+ *
28
+ * @module tower/tower-supervisor-prompt
29
+ */
30
+ import { BOUNDED_UNIVERSALS_LINES } from '../prompts/bounded-universals.js';
31
+ /** The last line the session prints, parsed into the log line (the record is what decides). */
32
+ export const TOWER_DECISION_LINE_PREFIX = 'TOWER DECISION:';
33
+ function fence(text) {
34
+ return ['```', text.replace(/```/g, "'''"), '```'].join('\n');
35
+ }
36
+ function roundLines(round, n) {
37
+ const out = [
38
+ `### Round ${n}: review ${round.reviewId} (${round.completedAt}, outcome ${round.outcome ?? 'unknown'}, judged ${round.reviewedSha?.slice(0, 12) ?? 'an unrecorded commit'})`,
39
+ '',
40
+ `Verdict on the held criterion: **${round.verdict?.verdict ?? 'not readable'}**`,
41
+ ];
42
+ if (round.findings.length === 0)
43
+ out.push('', 'Blocking findings named: none readable.');
44
+ else {
45
+ out.push('', 'Blocking findings named against it:');
46
+ for (const f of round.findings) {
47
+ out.push(`- ${f.key ?? f.issueId} "${f.title}" (issueId ${f.issueId}, status ${f.status ?? 'unknown'}, deliveryId ${f.deliveryId ?? 'unknown'})`);
48
+ if (f.description)
49
+ out.push(` ${f.description.slice(0, 1200).replace(/\n/g, '\n ')}`);
50
+ }
51
+ }
52
+ if (round.summaryExcerpt)
53
+ out.push('', 'The review\'s reasoning (its summary):', fence(round.summaryExcerpt));
54
+ out.push('', round.changeSincePrevious
55
+ ? `What the coding pass changed after the previous round:\n${fence(round.changeSincePrevious)}`
56
+ : (n === 1 ? 'First round of the loop.' : 'What changed since the previous round: not readable.'));
57
+ out.push('');
58
+ return out;
59
+ }
60
+ function heldLoopSection(input) {
61
+ const { loop, focus } = input;
62
+ return [
63
+ '## The held loop',
64
+ '',
65
+ `Focus: "${focus.focusName}" (focusId ${focus.focusId}, productId ${focus.productId})`,
66
+ `Held loop decision: towerDecisionId ${loop.towerDecisionId} (recorded ${loop.createdAt})`,
67
+ `Criterion under dispute (criterionKey ${loop.criterionKey}${loop.nodeId ? `, nodeId ${loop.nodeId}` : ''}):`,
68
+ '',
69
+ `> ${loop.criterion}`,
70
+ '',
71
+ `On ${loop.reviews.length} consecutive reviews under this arm this criterion was the ONLY one not met, and`,
72
+ 'each review named a NEW blocking finding against it. Fixing one finding produced the next. The daemon',
73
+ 'holds the focus: no coding or review pass runs until the loop is decided.',
74
+ '',
75
+ ];
76
+ }
77
+ function historySection(history) {
78
+ const out = ['## The loop, round by round (oldest first)', ''];
79
+ history.rounds.forEach((r, i) => out.push(...roundLines(r, i + 1)));
80
+ out.push('### Since the last review', '', history.changeSinceLastReview ? fence(history.changeSinceLastReview) : 'Not readable.', '');
81
+ out.push('## The check under dispute', '');
82
+ if (history.disputedChecks.length === 0)
83
+ out.push('No test file could be read off the findings or the commits; find the check yourself from the findings above.');
84
+ else
85
+ out.push('The tests the findings and the loop\'s commits touched:', ...history.disputedChecks.map((p) => `- ${p}`));
86
+ out.push('');
87
+ return out;
88
+ }
89
+ function contextSection(history) {
90
+ const out = ['## The focus (its context, the criteria its arm stamped and where they stand)', ''];
91
+ out.push(history.focusContext.trim() === '' ? '(The focus context could not be assembled.)' : history.focusContext.trim(), '');
92
+ out.push('### Deliveries', '');
93
+ if (history.deliveries.length === 0)
94
+ out.push('(none readable)');
95
+ for (const d of history.deliveries)
96
+ out.push(`- "${d.name}" (deliveryId ${d.deliveryId}, ${d.executionStatus})`);
97
+ out.push('', '## The product\'s standing decisions', '');
98
+ const sd = history.standingDecisions;
99
+ if (sd.source === null)
100
+ out.push('This product keeps no decisions log the daemon could find (docs/DECISIONS.md, DECISIONS.md, docs/adr/). Decide from the focus alone.');
101
+ else {
102
+ out.push(`From ${sd.source}${sd.truncated ? ' (newest entries; cut at the size cap -- read the file for older ones)' : ''}. What is ruled here is not re-decided: bound the criterion inside it.`, '', sd.text);
103
+ }
104
+ out.push('');
105
+ if (history.readErrors.length > 0) {
106
+ out.push('## What you were NOT given (a read failed)', '', ...history.readErrors.map((e) => `- ${e}`), '');
107
+ }
108
+ return out;
109
+ }
110
+ function instructionsSection(input) {
111
+ const { loop, focus, supervisorSessionId: sid } = input;
112
+ const ids = `focusId "${focus.focusId}", loopDecisionId "${loop.towerDecisionId}", agentSessionId "${sid}"`;
113
+ return [
114
+ '## What you do, in order',
115
+ '',
116
+ '1. **Spot-check the check with ordinary inputs.** Read the disputed test(s) and the code under them in',
117
+ ' this worktree. Run the check against a handful of ORDINARY inputs a user would actually produce (not',
118
+ ' the adversarial case the last review invented). Note what passes and what does not. This tells you',
119
+ ' whether the work falls short on what matters, or the criterion asks for more than any test can hold.',
120
+ '2. **Bound the criterion.** Write the new wording as a CLOSED LIST of the cases that matter -- each one',
121
+ ' held by a named test that exists or that the remaining Task will add -- plus the NAMED PLACE where',
122
+ ' everything beyond the list is judged (a grader, the battery, QA). Keep the intent; drop the universal.',
123
+ `3. **Apply it** with \`telora_product_focus\` action "amend_criterion": focusId "${focus.focusId}", nodeId`,
124
+ ` "${loop.nodeId ?? '<the nodeId criteria_standing shows for this criterion>'}", amendedCriterion (the bounded wording), reason (why the bar`,
125
+ ` moved, citing the spot-check), agentSessionId "${sid}", towerDecisionId "${loop.towerDecisionId}".`,
126
+ '4. **Record it** with `telora_product_tower` action "decision_record", decisionKind "criterion_bounded",',
127
+ ` ${ids}, nodeId of the criterion, summary (what you decided),`,
128
+ ' rationale (why), decisionEvidence { originalCriterion, amendedCriterion, closedList: [{ case, test }],',
129
+ ' judgedElsewhere, spotCheck: [{ input, result }] }.',
130
+ '5. **Close the in-flight blocking finding(s)** the loop filed that the bound wording no longer asks for:',
131
+ ' `telora_product_issue` update -- to "In Progress" first if it is still "To Do", then "Done" -- with a',
132
+ ' comment naming the amendment. Record each with',
133
+ ` decision_record decisionKind "finding_closed" (${ids}).`,
134
+ '6. **File any remaining Task** a case on the closed list still needs (a missing test, a real defect the',
135
+ ' spot-check found) with `telora_product_issue` create on the delivery that owns it (deliveryId from',
136
+ ` the list above), and record decision_record decisionKind "task_filed" (${ids}).`,
137
+ '7. **When you cannot bound it** -- the standing decisions or the focus leave the intent genuinely open, or',
138
+ ' the spot-check shows the criterion is right and the work falls short in a way no Task can settle --',
139
+ ' do NOT amend. File ONE escalation to the operator with `telora_agent` action "escalate": disposition',
140
+ ' "needs_operator", reasonType "decision_needed", focusId, humanAct { kind "unreachable_capability", act:',
141
+ ' "Rule what <the criterion> must mean: <the two readings>" }, describing the loop, the spot-check and',
142
+ ' the readings. Then record decision_record decisionKind "escalated_to_operator" with its escalationId',
143
+ ` (${ids}). The loop stays held until the operator rules.`,
144
+ '',
145
+ 'The daemon releases the hold itself once a criterion_bounded decision names this loop AND the amendment',
146
+ 'of step 3 is on the record; the next review is a fresh session that judges the amended wording. A',
147
+ 'decision whose amend_criterion call failed releases nothing -- if the amendment is refused, fix the call',
148
+ 'and apply it again, or escalate (step 7). You never write loop_resolved.',
149
+ '',
150
+ 'You are the only supervisor this criterion gets under this arm. If the reviews after your bound still',
151
+ 'fail it, the loop goes to the operator, not back to a supervisor -- so bound it to what a test can hold.',
152
+ '',
153
+ ];
154
+ }
155
+ function boundariesSection() {
156
+ return [
157
+ '## What you never do',
158
+ '',
159
+ '- You hold NO budget lever. You cannot grant review cycles, extend a budget, re-arm, un-arm or stop the',
160
+ ' focus; never call `telora_product_focus` action "update" -- your Telora tools do not offer it and refuse',
161
+ ' it. The fix for a loop is a bounded criterion, not more cycles.',
162
+ '- You do not write code, commit, or change tests. Reading and running them is how you spot-check; the',
163
+ ' coding pass does the work a Task you file asks for.',
164
+ '- You do not lower the bar to make the loop pass: the closed list keeps every case that matters, and the',
165
+ ' rest is judged somewhere named. Bounding is not waiving.',
166
+ '- You do not ask the operator anything except through the one escalation in step 7.',
167
+ '',
168
+ `End with one line: \`${TOWER_DECISION_LINE_PREFIX} bounded\` or \`${TOWER_DECISION_LINE_PREFIX} escalated\`.`,
169
+ ];
170
+ }
171
+ /** Pure: the whole supervisor prompt. */
172
+ export function buildTowerSupervisorPrompt(input) {
173
+ return [
174
+ `# Tower supervisor: decide the held review loop of "${input.focus.focusName}"`,
175
+ '',
176
+ 'You are the Tower supervisor. A review loop on this focus cannot converge, and deciding why is a',
177
+ 'judgement call. The operator ruled that you decide it yourself -- the operator is NOT in the loop -- and',
178
+ 'that every decision you make is recorded on the focus (what, why, and the evidence), where the',
179
+ 'dashboard shows it. Rulings are not undone; the operator judges results, not decisions.',
180
+ '',
181
+ ...heldLoopSection(input),
182
+ ...historySection(input.history),
183
+ ...contextSection(input.history),
184
+ '## The principle you bound by',
185
+ ...BOUNDED_UNIVERSALS_LINES,
186
+ ...instructionsSection(input),
187
+ ...boundariesSection(),
188
+ ].join('\n');
189
+ }
190
+ /** Pure: the decision the session's last line states, or null. Informational: the record decides. */
191
+ export function parseTowerDecisionLine(stdout) {
192
+ const lines = stdout.trim().split('\n').reverse();
193
+ for (const line of lines) {
194
+ const at = line.indexOf(TOWER_DECISION_LINE_PREFIX);
195
+ if (at === -1)
196
+ continue;
197
+ const word = line.slice(at + TOWER_DECISION_LINE_PREFIX.length).trim().replace(/[`*.]/g, '').toLowerCase();
198
+ if (word.startsWith('bounded'))
199
+ return 'bounded';
200
+ if (word.startsWith('escalated'))
201
+ return 'escalated';
202
+ }
203
+ return null;
204
+ }
205
+ //# sourceMappingURL=tower-supervisor-prompt.js.map