@telora/daemon 0.24.17 → 0.24.26

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 (536) hide show
  1. package/build-info.json +12 -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/ci/candidate-failure-record.d.ts +104 -0
  6. package/dist/ci/candidate-failure-record.d.ts.map +1 -0
  7. package/dist/ci/candidate-failure-record.js +135 -0
  8. package/dist/ci/candidate-failure-record.js.map +1 -0
  9. package/dist/ci/candidate-ref.d.ts.map +1 -1
  10. package/dist/ci/candidate-ref.js +10 -3
  11. package/dist/ci/candidate-ref.js.map +1 -1
  12. package/dist/ci/ci-status-git.d.ts.map +1 -1
  13. package/dist/ci/ci-status-git.js +1 -0
  14. package/dist/ci/ci-status-git.js.map +1 -1
  15. package/dist/ci/ci-status.d.ts.map +1 -1
  16. package/dist/ci/ci-status.js +1 -0
  17. package/dist/ci/ci-status.js.map +1 -1
  18. package/dist/ci/gate-ref.d.ts +10 -1
  19. package/dist/ci/gate-ref.d.ts.map +1 -1
  20. package/dist/ci/gate-ref.js +11 -4
  21. package/dist/ci/gate-ref.js.map +1 -1
  22. package/dist/ci/product-ci-repo.d.ts.map +1 -1
  23. package/dist/ci/product-ci-repo.js +3 -2
  24. package/dist/ci/product-ci-repo.js.map +1 -1
  25. package/dist/completion/completion-event/event.d.ts +4 -3
  26. package/dist/completion/completion-event/event.d.ts.map +1 -1
  27. package/dist/completion/completion-event/event.js.map +1 -1
  28. package/dist/completion/review-cycle-budget/review-cycle-cap.d.ts +19 -11
  29. package/dist/completion/review-cycle-budget/review-cycle-cap.d.ts.map +1 -1
  30. package/dist/completion/review-cycle-budget/review-cycle-cap.js +36 -36
  31. package/dist/completion/review-cycle-budget/review-cycle-cap.js.map +1 -1
  32. package/dist/completion/review-cycle-budget/review-loop-detection.d.ts +101 -0
  33. package/dist/completion/review-cycle-budget/review-loop-detection.d.ts.map +1 -0
  34. package/dist/completion/review-cycle-budget/review-loop-detection.js +105 -0
  35. package/dist/completion/review-cycle-budget/review-loop-detection.js.map +1 -0
  36. package/dist/completion/review-cycle-budget/spent-budget-release.d.ts +70 -0
  37. package/dist/completion/review-cycle-budget/spent-budget-release.d.ts.map +1 -0
  38. package/dist/completion/review-cycle-budget/spent-budget-release.js +98 -0
  39. package/dist/completion/review-cycle-budget/spent-budget-release.js.map +1 -0
  40. package/dist/completion/review-exit/review-defect-detector.d.ts +71 -49
  41. package/dist/completion/review-exit/review-defect-detector.d.ts.map +1 -1
  42. package/dist/completion/review-exit/review-defect-detector.js +75 -69
  43. package/dist/completion/review-exit/review-defect-detector.js.map +1 -1
  44. package/dist/completion/review-exit/review-exit-attribution.d.ts +1 -1
  45. package/dist/completion/review-exit/review-exit-attribution.js +1 -1
  46. package/dist/completion/review-exit/review-exit-deps.d.ts +5 -2
  47. package/dist/completion/review-exit/review-exit-deps.d.ts.map +1 -1
  48. package/dist/completion/review-exit/review-exit-deps.js +1 -1
  49. package/dist/completion/review-exit/review-exit-evidence.d.ts +10 -1
  50. package/dist/completion/review-exit/review-exit-evidence.d.ts.map +1 -1
  51. package/dist/completion/review-exit/review-exit-evidence.js +17 -14
  52. package/dist/completion/review-exit/review-exit-evidence.js.map +1 -1
  53. package/dist/completion/review-exit/review-exit-foreign-findings.d.ts +1 -1
  54. package/dist/completion/review-exit/review-exit-foreign-findings.d.ts.map +1 -1
  55. package/dist/completion/review-exit/review-exit-phase.d.ts.map +1 -1
  56. package/dist/completion/review-exit/review-exit-phase.js +12 -8
  57. package/dist/completion/review-exit/review-exit-phase.js.map +1 -1
  58. package/dist/completion/state-cascade/review-next-step.d.ts +12 -3
  59. package/dist/completion/state-cascade/review-next-step.d.ts.map +1 -1
  60. package/dist/completion/state-cascade/review-next-step.js +10 -1
  61. package/dist/completion/state-cascade/review-next-step.js.map +1 -1
  62. package/dist/completion/state-cascade/standing-approval-convergence.d.ts +1 -1
  63. package/dist/completion/state-cascade/standing-approval-convergence.d.ts.map +1 -1
  64. package/dist/completion/state-cascade/standing-approval-convergence.js +10 -4
  65. package/dist/completion/state-cascade/standing-approval-convergence.js.map +1 -1
  66. package/dist/completion/state-cascade/state-cascade.d.ts +3 -0
  67. package/dist/completion/state-cascade/state-cascade.d.ts.map +1 -1
  68. package/dist/completion/state-cascade/state-cascade.js +16 -1
  69. package/dist/completion/state-cascade/state-cascade.js.map +1 -1
  70. package/dist/completion/team-exit/status-advance-phase.d.ts +1 -1
  71. package/dist/completion/team-exit/status-advance-phase.d.ts.map +1 -1
  72. package/dist/completion/team-exit/status-advance-phase.js +6 -4
  73. package/dist/completion/team-exit/status-advance-phase.js.map +1 -1
  74. package/dist/completion/team-outcome/apply-turn.d.ts.map +1 -1
  75. package/dist/completion/team-outcome/apply-turn.js +9 -4
  76. package/dist/completion/team-outcome/apply-turn.js.map +1 -1
  77. package/dist/completion/team-outcome/decide-turn-entry-rows.d.ts.map +1 -1
  78. package/dist/completion/team-outcome/decide-turn-entry-rows.js +28 -3
  79. package/dist/completion/team-outcome/decide-turn-entry-rows.js.map +1 -1
  80. package/dist/completion/team-outcome/decide.d.ts.map +1 -1
  81. package/dist/completion/team-outcome/decide.js +1 -0
  82. package/dist/completion/team-outcome/decide.js.map +1 -1
  83. package/dist/completion/team-outcome/exit-limits.d.ts +6 -0
  84. package/dist/completion/team-outcome/exit-limits.d.ts.map +1 -1
  85. package/dist/completion/team-outcome/exit-limits.js +6 -0
  86. package/dist/completion/team-outcome/exit-limits.js.map +1 -1
  87. package/dist/completion/team-outcome/exit-pipeline-state.d.ts +5 -0
  88. package/dist/completion/team-outcome/exit-pipeline-state.d.ts.map +1 -1
  89. package/dist/completion/team-outcome/exit-pipeline-state.js.map +1 -1
  90. package/dist/completion/team-teardown/session-hold-bounds.d.ts +10 -1
  91. package/dist/completion/team-teardown/session-hold-bounds.d.ts.map +1 -1
  92. package/dist/completion/team-teardown/session-hold-bounds.js +11 -0
  93. package/dist/completion/team-teardown/session-hold-bounds.js.map +1 -1
  94. package/dist/completion/team-teardown/session-hold.d.ts.map +1 -1
  95. package/dist/completion/team-teardown/session-hold.js +2 -0
  96. package/dist/completion/team-teardown/session-hold.js.map +1 -1
  97. package/dist/composition/engine-start-context.d.ts.map +1 -1
  98. package/dist/composition/engine-start-context.js +9 -1
  99. package/dist/composition/engine-start-context.js.map +1 -1
  100. package/dist/composition/execution-merge-context.d.ts +13 -0
  101. package/dist/composition/execution-merge-context.d.ts.map +1 -1
  102. package/dist/composition/execution-merge-context.js +76 -3
  103. package/dist/composition/execution-merge-context.js.map +1 -1
  104. package/dist/composition/execution-spawn-context.d.ts.map +1 -1
  105. package/dist/composition/execution-spawn-context.js +2 -0
  106. package/dist/composition/execution-spawn-context.js.map +1 -1
  107. package/dist/composition/focus-activity-live-sources.d.ts.map +1 -1
  108. package/dist/composition/focus-activity-live-sources.js +1 -0
  109. package/dist/composition/focus-activity-live-sources.js.map +1 -1
  110. package/dist/composition/judgement-contexts.d.ts.map +1 -1
  111. package/dist/composition/judgement-contexts.js +8 -2
  112. package/dist/composition/judgement-contexts.js.map +1 -1
  113. package/dist/composition/review-exit-context.d.ts.map +1 -1
  114. package/dist/composition/review-exit-context.js +2 -0
  115. package/dist/composition/review-exit-context.js.map +1 -1
  116. package/dist/composition/review-loop-context.d.ts +28 -0
  117. package/dist/composition/review-loop-context.d.ts.map +1 -0
  118. package/dist/composition/review-loop-context.js +147 -0
  119. package/dist/composition/review-loop-context.js.map +1 -0
  120. package/dist/composition/runtime-heartbeat-context.d.ts +11 -0
  121. package/dist/composition/runtime-heartbeat-context.d.ts.map +1 -1
  122. package/dist/composition/runtime-heartbeat-context.js +33 -2
  123. package/dist/composition/runtime-heartbeat-context.js.map +1 -1
  124. package/dist/composition/spawn-pass-deps.d.ts.map +1 -1
  125. package/dist/composition/spawn-pass-deps.js +3 -0
  126. package/dist/composition/spawn-pass-deps.js.map +1 -1
  127. package/dist/composition/state-cascade-context.d.ts.map +1 -1
  128. package/dist/composition/state-cascade-context.js +3 -1
  129. package/dist/composition/state-cascade-context.js.map +1 -1
  130. package/dist/composition/team-liveness-phase-sources.d.ts.map +1 -1
  131. package/dist/composition/team-liveness-phase-sources.js +1 -0
  132. package/dist/composition/team-liveness-phase-sources.js.map +1 -1
  133. package/dist/composition/tower-escalation-context.d.ts +12 -0
  134. package/dist/composition/tower-escalation-context.d.ts.map +1 -0
  135. package/dist/composition/tower-escalation-context.js +109 -0
  136. package/dist/composition/tower-escalation-context.js.map +1 -0
  137. package/dist/composition/verification-context.d.ts.map +1 -1
  138. package/dist/composition/verification-context.js +34 -4
  139. package/dist/composition/verification-context.js.map +1 -1
  140. package/dist/composition/workstation-intervals-context.d.ts +3 -0
  141. package/dist/composition/workstation-intervals-context.d.ts.map +1 -0
  142. package/dist/composition/workstation-intervals-context.js +33 -0
  143. package/dist/composition/workstation-intervals-context.js.map +1 -0
  144. package/dist/daemon-state/awaiting-slot.d.ts +18 -1
  145. package/dist/daemon-state/awaiting-slot.d.ts.map +1 -1
  146. package/dist/daemon-state/awaiting-slot.js +7 -0
  147. package/dist/daemon-state/awaiting-slot.js.map +1 -1
  148. package/dist/delivery/delivery-reconciler.d.ts +7 -7
  149. package/dist/delivery/recorded-concerns.d.ts +63 -28
  150. package/dist/delivery/recorded-concerns.d.ts.map +1 -1
  151. package/dist/delivery/recorded-concerns.js +72 -28
  152. package/dist/delivery/recorded-concerns.js.map +1 -1
  153. package/dist/directive/directive-queue.d.ts +8 -0
  154. package/dist/directive/directive-queue.d.ts.map +1 -1
  155. package/dist/directive/directive-queue.js +1 -1
  156. package/dist/directive/directive-queue.js.map +1 -1
  157. package/dist/focus/control-state.d.ts +6 -4
  158. package/dist/focus/control-state.d.ts.map +1 -1
  159. package/dist/focus/control-state.js +6 -4
  160. package/dist/focus/control-state.js.map +1 -1
  161. package/dist/focus/daemon-contexts-judgement.d.ts +6 -0
  162. package/dist/focus/daemon-contexts-judgement.d.ts.map +1 -1
  163. package/dist/focus/daemon-contexts.d.ts +6 -0
  164. package/dist/focus/daemon-contexts.d.ts.map +1 -1
  165. package/dist/focus/daemon-contexts.js.map +1 -1
  166. package/dist/focus/focus-engine.d.ts.map +1 -1
  167. package/dist/focus/focus-engine.js +3 -1
  168. package/dist/focus/focus-engine.js.map +1 -1
  169. package/dist/focus/focus-executor.d.ts.map +1 -1
  170. package/dist/focus/focus-executor.js +3 -2
  171. package/dist/focus/focus-executor.js.map +1 -1
  172. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  173. package/dist/focus/focus-loop-registry.js +42 -0
  174. package/dist/focus/focus-loop-registry.js.map +1 -1
  175. package/dist/focus/focus-poller-auto-advance.d.ts +4 -2
  176. package/dist/focus/focus-poller-auto-advance.d.ts.map +1 -1
  177. package/dist/focus/focus-poller-auto-advance.js +24 -18
  178. package/dist/focus/focus-poller-auto-advance.js.map +1 -1
  179. package/dist/focus/focus-poller-spawn.d.ts.map +1 -1
  180. package/dist/focus/focus-poller-spawn.js +8 -6
  181. package/dist/focus/focus-poller-spawn.js.map +1 -1
  182. package/dist/focus/heartbeat-metadata.d.ts +5 -0
  183. package/dist/focus/heartbeat-metadata.d.ts.map +1 -1
  184. package/dist/focus/heartbeat-metadata.js +12 -0
  185. package/dist/focus/heartbeat-metadata.js.map +1 -1
  186. package/dist/focus/heartbeat.d.ts +9 -2
  187. package/dist/focus/heartbeat.d.ts.map +1 -1
  188. package/dist/focus/heartbeat.js +10 -1
  189. package/dist/focus/heartbeat.js.map +1 -1
  190. package/dist/focus/host-pressure.d.ts +77 -0
  191. package/dist/focus/host-pressure.d.ts.map +1 -0
  192. package/dist/focus/host-pressure.js +83 -0
  193. package/dist/focus/host-pressure.js.map +1 -0
  194. package/dist/focus/pending-directive-gates.d.ts +14 -0
  195. package/dist/focus/pending-directive-gates.d.ts.map +1 -1
  196. package/dist/focus/pending-directive-gates.js +25 -1
  197. package/dist/focus/pending-directive-gates.js.map +1 -1
  198. package/dist/focus/pending-spawn-pass-deps.d.ts +7 -0
  199. package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -1
  200. package/dist/focus/pending-spawn-review-next-step.d.ts +1 -1
  201. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -1
  202. package/dist/focus/pending-spawn-review-next-step.js +2 -0
  203. package/dist/focus/pending-spawn-review-next-step.js.map +1 -1
  204. package/dist/focus/ready-focus-team-work.d.ts +9 -4
  205. package/dist/focus/ready-focus-team-work.d.ts.map +1 -1
  206. package/dist/focus/ready-focus-team-work.js +14 -3
  207. package/dist/focus/ready-focus-team-work.js.map +1 -1
  208. package/dist/focus/verify-open-issues.d.ts +3 -2
  209. package/dist/focus/verify-open-issues.d.ts.map +1 -1
  210. package/dist/focus/verify-open-issues.js +6 -4
  211. package/dist/focus/verify-open-issues.js.map +1 -1
  212. package/dist/focus/workstation-intervals.d.ts +83 -0
  213. package/dist/focus/workstation-intervals.d.ts.map +1 -0
  214. package/dist/focus/workstation-intervals.js +81 -0
  215. package/dist/focus/workstation-intervals.js.map +1 -0
  216. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +5 -2
  217. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  218. package/dist/focus-stage-lifecycle/wedge-watchdog.js +2 -2
  219. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  220. package/dist/git/types.js +1 -1
  221. package/dist/merge/candidate-ci-failures.d.ts +72 -0
  222. package/dist/merge/candidate-ci-failures.d.ts.map +1 -0
  223. package/dist/merge/candidate-ci-failures.js +240 -0
  224. package/dist/merge/candidate-ci-failures.js.map +1 -0
  225. package/dist/merge/candidate-red-record.d.ts +44 -0
  226. package/dist/merge/candidate-red-record.d.ts.map +1 -0
  227. package/dist/merge/candidate-red-record.js +98 -0
  228. package/dist/merge/candidate-red-record.js.map +1 -0
  229. package/dist/merge/candidate-rework.d.ts +4 -3
  230. package/dist/merge/candidate-rework.d.ts.map +1 -1
  231. package/dist/merge/candidate-rework.js +46 -14
  232. package/dist/merge/candidate-rework.js.map +1 -1
  233. package/dist/merge/candidate-tip-attribution.d.ts +135 -0
  234. package/dist/merge/candidate-tip-attribution.d.ts.map +1 -0
  235. package/dist/merge/candidate-tip-attribution.js +319 -0
  236. package/dist/merge/candidate-tip-attribution.js.map +1 -0
  237. package/dist/merge/completion-merge-driver.d.ts +49 -5
  238. package/dist/merge/completion-merge-driver.d.ts.map +1 -1
  239. package/dist/merge/completion-merge-driver.js +56 -2
  240. package/dist/merge/completion-merge-driver.js.map +1 -1
  241. package/dist/merge/completion-merge-gate.d.ts +4 -1
  242. package/dist/merge/completion-merge-gate.d.ts.map +1 -1
  243. package/dist/merge/completion-merge-gate.js +9 -8
  244. package/dist/merge/completion-merge-gate.js.map +1 -1
  245. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  246. package/dist/prompt-sections/persona-sections.js +4 -1
  247. package/dist/prompt-sections/persona-sections.js.map +1 -1
  248. package/dist/prompt-sections/qa-author-section.d.ts.map +1 -1
  249. package/dist/prompt-sections/qa-author-section.js +18 -1
  250. package/dist/prompt-sections/qa-author-section.js.map +1 -1
  251. package/dist/prompt-sections/scoping-sections.d.ts +0 -12
  252. package/dist/prompt-sections/scoping-sections.d.ts.map +1 -1
  253. package/dist/prompt-sections/scoping-sections.js +16 -2
  254. package/dist/prompt-sections/scoping-sections.js.map +1 -1
  255. package/dist/prompts/bounded-universals.d.ts +13 -0
  256. package/dist/prompts/bounded-universals.d.ts.map +1 -0
  257. package/dist/prompts/bounded-universals.js +32 -0
  258. package/dist/prompts/bounded-universals.js.map +1 -0
  259. package/dist/queries/api-client/shared.d.ts +2 -1
  260. package/dist/queries/api-client/shared.d.ts.map +1 -1
  261. package/dist/queries/api-client/shared.js +36 -1
  262. package/dist/queries/api-client/shared.js.map +1 -1
  263. package/dist/queries/candidate-ci-reds/candidate-ci-reds.d.ts +35 -0
  264. package/dist/queries/candidate-ci-reds/candidate-ci-reds.d.ts.map +1 -0
  265. package/dist/queries/candidate-ci-reds/candidate-ci-reds.js +42 -0
  266. package/dist/queries/candidate-ci-reds/candidate-ci-reds.js.map +1 -0
  267. package/dist/queries/candidate-ci-reds/gate-escape-files.d.ts +16 -0
  268. package/dist/queries/candidate-ci-reds/gate-escape-files.d.ts.map +1 -0
  269. package/dist/queries/candidate-ci-reds/gate-escape-files.js +51 -0
  270. package/dist/queries/candidate-ci-reds/gate-escape-files.js.map +1 -0
  271. package/dist/queries/deliveries/issues.d.ts.map +1 -1
  272. package/dist/queries/deliveries/issues.js +1 -0
  273. package/dist/queries/deliveries/issues.js.map +1 -1
  274. package/dist/queries/escalations/escalation-consumption.d.ts +13 -0
  275. package/dist/queries/escalations/escalation-consumption.d.ts.map +1 -1
  276. package/dist/queries/escalations/escalation-consumption.js +12 -2
  277. package/dist/queries/escalations/escalation-consumption.js.map +1 -1
  278. package/dist/queries/escalations/tower-escalations.d.ts +82 -0
  279. package/dist/queries/escalations/tower-escalations.d.ts.map +1 -0
  280. package/dist/queries/escalations/tower-escalations.js +97 -0
  281. package/dist/queries/escalations/tower-escalations.js.map +1 -0
  282. package/dist/queries/focus-review/recorded-concern-ids.d.ts +48 -11
  283. package/dist/queries/focus-review/recorded-concern-ids.d.ts.map +1 -1
  284. package/dist/queries/focus-review/recorded-concern-ids.js +42 -12
  285. package/dist/queries/focus-review/recorded-concern-ids.js.map +1 -1
  286. package/dist/queries/focus-review/review-criterion-verdicts.d.ts +37 -0
  287. package/dist/queries/focus-review/review-criterion-verdicts.d.ts.map +1 -0
  288. package/dist/queries/focus-review/review-criterion-verdicts.js +64 -0
  289. package/dist/queries/focus-review/review-criterion-verdicts.js.map +1 -0
  290. package/dist/queries/focus-review/review-finding-facts.d.ts +18 -6
  291. package/dist/queries/focus-review/review-finding-facts.d.ts.map +1 -1
  292. package/dist/queries/focus-review/review-finding-facts.js +21 -8
  293. package/dist/queries/focus-review/review-finding-facts.js.map +1 -1
  294. package/dist/queries/focuses/ended-arm.d.ts +56 -13
  295. package/dist/queries/focuses/ended-arm.d.ts.map +1 -1
  296. package/dist/queries/focuses/ended-arm.js +40 -14
  297. package/dist/queries/focuses/ended-arm.js.map +1 -1
  298. package/dist/queries/focuses/focus-criteria-standing.d.ts +12 -0
  299. package/dist/queries/focuses/focus-criteria-standing.d.ts.map +1 -1
  300. package/dist/queries/focuses/focus-criteria-standing.js +13 -0
  301. package/dist/queries/focuses/focus-criteria-standing.js.map +1 -1
  302. package/dist/queries/focuses/focus-discovery.d.ts +14 -3
  303. package/dist/queries/focuses/focus-discovery.d.ts.map +1 -1
  304. package/dist/queries/focuses/focus-discovery.js +2 -19
  305. package/dist/queries/focuses/focus-discovery.js.map +1 -1
  306. package/dist/queries/focuses/focuses.d.ts +15 -12
  307. package/dist/queries/focuses/focuses.d.ts.map +1 -1
  308. package/dist/queries/focuses/focuses.js +15 -13
  309. package/dist/queries/focuses/focuses.js.map +1 -1
  310. package/dist/queries/sessions/daemon-connection.d.ts.map +1 -1
  311. package/dist/queries/sessions/daemon-connection.js +1 -0
  312. package/dist/queries/sessions/daemon-connection.js.map +1 -1
  313. package/dist/queries/sessions/sessions.d.ts.map +1 -1
  314. package/dist/queries/sessions/sessions.js +2 -1
  315. package/dist/queries/sessions/sessions.js.map +1 -1
  316. package/dist/queries/tower-decisions/tower-decisions.d.ts +103 -0
  317. package/dist/queries/tower-decisions/tower-decisions.d.ts.map +1 -0
  318. package/dist/queries/tower-decisions/tower-decisions.js +138 -0
  319. package/dist/queries/tower-decisions/tower-decisions.js.map +1 -0
  320. package/dist/queries/verification/verification.js +1 -1
  321. package/dist/queries/wire-schemas/schemas.d.ts +2 -0
  322. package/dist/queries/wire-schemas/schemas.d.ts.map +1 -1
  323. package/dist/queries/wire-schemas/schemas.js +8 -2
  324. package/dist/queries/wire-schemas/schemas.js.map +1 -1
  325. package/dist/queries/workstation-intervals/workstation-intervals.d.ts +52 -0
  326. package/dist/queries/workstation-intervals/workstation-intervals.d.ts.map +1 -0
  327. package/dist/queries/workstation-intervals/workstation-intervals.js +49 -0
  328. package/dist/queries/workstation-intervals/workstation-intervals.js.map +1 -0
  329. package/dist/resolvers/escalation-answers.d.ts +31 -0
  330. package/dist/resolvers/escalation-answers.d.ts.map +1 -1
  331. package/dist/resolvers/escalation-answers.js +31 -17
  332. package/dist/resolvers/escalation-answers.js.map +1 -1
  333. package/dist/resolvers/focus-criteria-standing.d.ts.map +1 -1
  334. package/dist/resolvers/focus-criteria-standing.js +20 -0
  335. package/dist/resolvers/focus-criteria-standing.js.map +1 -1
  336. package/dist/shell/unified-engine-lifecycle.d.ts +11 -1
  337. package/dist/shell/unified-engine-lifecycle.d.ts.map +1 -1
  338. package/dist/shell/unified-engine-lifecycle.js +10 -1
  339. package/dist/shell/unified-engine-lifecycle.js.map +1 -1
  340. package/dist/shell/unified-shell.d.ts +25 -0
  341. package/dist/shell/unified-shell.d.ts.map +1 -1
  342. package/dist/shell/unified-shell.js +26 -80
  343. package/dist/shell/unified-shell.js.map +1 -1
  344. package/dist/shell/update-restart.d.ts +47 -0
  345. package/dist/shell/update-restart.d.ts.map +1 -0
  346. package/dist/shell/update-restart.js +124 -0
  347. package/dist/shell/update-restart.js.map +1 -0
  348. package/dist/spawn/directive-dispatch.d.ts.map +1 -1
  349. package/dist/spawn/directive-dispatch.js +1 -0
  350. package/dist/spawn/directive-dispatch.js.map +1 -1
  351. package/dist/spawn/lead-continuation.d.ts +4 -3
  352. package/dist/spawn/lead-continuation.d.ts.map +1 -1
  353. package/dist/spawn/lead-continuation.js.map +1 -1
  354. package/dist/spawn/live-answer-delivery.d.ts +53 -0
  355. package/dist/spawn/live-answer-delivery.d.ts.map +1 -0
  356. package/dist/spawn/live-answer-delivery.js +26 -0
  357. package/dist/spawn/live-answer-delivery.js.map +1 -0
  358. package/dist/spawn/routing-decider-spawn.d.ts +64 -2
  359. package/dist/spawn/routing-decider-spawn.d.ts.map +1 -1
  360. package/dist/spawn/routing-decider-spawn.js +65 -20
  361. package/dist/spawn/routing-decider-spawn.js.map +1 -1
  362. package/dist/spawn/worktree-session.d.ts +7 -5
  363. package/dist/spawn/worktree-session.d.ts.map +1 -1
  364. package/dist/spawn/worktree-session.js +11 -7
  365. package/dist/spawn/worktree-session.js.map +1 -1
  366. package/dist/supervision/escalation-suppression.js +1 -1
  367. package/dist/supervision/review-cycle-cap-hold.d.ts +11 -5
  368. package/dist/supervision/review-cycle-cap-hold.d.ts.map +1 -1
  369. package/dist/supervision/review-cycle-cap-hold.js +29 -11
  370. package/dist/supervision/review-cycle-cap-hold.js.map +1 -1
  371. package/dist/supervision/review-loop-detector.d.ts +48 -0
  372. package/dist/supervision/review-loop-detector.d.ts.map +1 -0
  373. package/dist/supervision/review-loop-detector.js +13 -0
  374. package/dist/supervision/review-loop-detector.js.map +1 -0
  375. package/dist/supervision/review-loop-hold.d.ts +29 -0
  376. package/dist/supervision/review-loop-hold.d.ts.map +1 -0
  377. package/dist/supervision/review-loop-hold.js +99 -0
  378. package/dist/supervision/review-loop-hold.js.map +1 -0
  379. package/dist/supervision/stall-detector-config.d.ts +8 -0
  380. package/dist/supervision/stall-detector-config.d.ts.map +1 -1
  381. package/dist/supervision/stall-detector-config.js +14 -3
  382. package/dist/supervision/stall-detector-config.js.map +1 -1
  383. package/dist/supervision/stop-registry.d.ts +3 -0
  384. package/dist/supervision/stop-registry.d.ts.map +1 -1
  385. package/dist/supervision/stop-registry.js +3 -1
  386. package/dist/supervision/stop-registry.js.map +1 -1
  387. package/dist/supervision/stop-rows-review-loop.d.ts +35 -0
  388. package/dist/supervision/stop-rows-review-loop.d.ts.map +1 -0
  389. package/dist/supervision/stop-rows-review-loop.js +150 -0
  390. package/dist/supervision/stop-rows-review-loop.js.map +1 -0
  391. package/dist/supervision/stop-rows-team-session.d.ts +1 -1
  392. package/dist/supervision/stop-rows-team-session.d.ts.map +1 -1
  393. package/dist/supervision/stop-rows-team-session.js.map +1 -1
  394. package/dist/supervision/unreviewed-settle-detector.d.ts +7 -2
  395. package/dist/supervision/unreviewed-settle-detector.d.ts.map +1 -1
  396. package/dist/supervision/unreviewed-settle-detector.js +15 -2
  397. package/dist/supervision/unreviewed-settle-detector.js.map +1 -1
  398. package/dist/templates/agents-md.d.ts.map +1 -1
  399. package/dist/templates/agents-md.js +1 -0
  400. package/dist/templates/agents-md.js.map +1 -1
  401. package/dist/templates/claude-md.d.ts +1 -1
  402. package/dist/templates/claude-md.d.ts.map +1 -1
  403. package/dist/templates/claude-md.js +12 -0
  404. package/dist/templates/claude-md.js.map +1 -1
  405. package/dist/testing/fixtures/api-client.js +1 -1
  406. package/dist/testing/fixtures/completion-judge-stubs.d.ts +7 -2
  407. package/dist/testing/fixtures/completion-judge-stubs.d.ts.map +1 -1
  408. package/dist/testing/fixtures/completion-judge-stubs.js +11 -1
  409. package/dist/testing/fixtures/completion-judge-stubs.js.map +1 -1
  410. package/dist/testing/fixtures/index.js +1 -1
  411. package/dist/testing/fixtures/merge-log-capture.d.ts.map +1 -1
  412. package/dist/testing/fixtures/merge-log-capture.js +1 -0
  413. package/dist/testing/fixtures/merge-log-capture.js.map +1 -1
  414. package/dist/testing/fixtures/pending-spawn-world.d.ts +4 -0
  415. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -1
  416. package/dist/testing/fixtures/pending-spawn-world.js +15 -2
  417. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  418. package/dist/testing/fixtures/recording-api-client.js +1 -1
  419. package/dist/testing/fixtures/review-exit-deps.d.ts.map +1 -1
  420. package/dist/testing/fixtures/review-exit-deps.js +3 -1
  421. package/dist/testing/fixtures/review-exit-deps.js.map +1 -1
  422. package/dist/testing/fixtures/review-loop.d.ts +19 -0
  423. package/dist/testing/fixtures/review-loop.d.ts.map +1 -0
  424. package/dist/testing/fixtures/review-loop.js +30 -0
  425. package/dist/testing/fixtures/review-loop.js.map +1 -0
  426. package/dist/testing/fixtures/shortfall-rework-hold-deps.d.ts.map +1 -1
  427. package/dist/testing/fixtures/shortfall-rework-hold-deps.js +1 -0
  428. package/dist/testing/fixtures/shortfall-rework-hold-deps.js.map +1 -1
  429. package/dist/testing/fixtures/tower-loop.d.ts +28 -0
  430. package/dist/testing/fixtures/tower-loop.d.ts.map +1 -0
  431. package/dist/testing/fixtures/tower-loop.js +83 -0
  432. package/dist/testing/fixtures/tower-loop.js.map +1 -0
  433. package/dist/testing/fixtures/verification-deps.d.ts +7 -0
  434. package/dist/testing/fixtures/verification-deps.d.ts.map +1 -1
  435. package/dist/testing/fixtures/verification-deps.js +17 -1
  436. package/dist/testing/fixtures/verification-deps.js.map +1 -1
  437. package/dist/testing/fixtures/vitest-failure-log.d.ts.map +1 -1
  438. package/dist/testing/fixtures/vitest-failure-log.js +2 -1
  439. package/dist/testing/fixtures/vitest-failure-log.js.map +1 -1
  440. package/dist/tower/tower-escalation-gather.d.ts +33 -0
  441. package/dist/tower/tower-escalation-gather.d.ts.map +1 -0
  442. package/dist/tower/tower-escalation-gather.js +38 -0
  443. package/dist/tower/tower-escalation-gather.js.map +1 -0
  444. package/dist/tower/tower-escalation-prompt.d.ts +62 -0
  445. package/dist/tower/tower-escalation-prompt.d.ts.map +1 -0
  446. package/dist/tower/tower-escalation-prompt.js +130 -0
  447. package/dist/tower/tower-escalation-prompt.js.map +1 -0
  448. package/dist/tower/tower-escalation-routing.d.ts +49 -0
  449. package/dist/tower/tower-escalation-routing.d.ts.map +1 -0
  450. package/dist/tower/tower-escalation-routing.js +53 -0
  451. package/dist/tower/tower-escalation-routing.js.map +1 -0
  452. package/dist/tower/tower-escalation-session.d.ts +149 -0
  453. package/dist/tower/tower-escalation-session.d.ts.map +1 -0
  454. package/dist/tower/tower-escalation-session.js +238 -0
  455. package/dist/tower/tower-escalation-session.js.map +1 -0
  456. package/dist/tower/tower-supervisor-history.d.ts +129 -0
  457. package/dist/tower/tower-supervisor-history.d.ts.map +1 -0
  458. package/dist/tower/tower-supervisor-history.js +217 -0
  459. package/dist/tower/tower-supervisor-history.js.map +1 -0
  460. package/dist/tower/tower-supervisor-prompt.d.ts +21 -0
  461. package/dist/tower/tower-supervisor-prompt.d.ts.map +1 -0
  462. package/dist/tower/tower-supervisor-prompt.js +205 -0
  463. package/dist/tower/tower-supervisor-prompt.js.map +1 -0
  464. package/dist/tower/tower-supervisor-session.d.ts +220 -0
  465. package/dist/tower/tower-supervisor-session.d.ts.map +1 -0
  466. package/dist/tower/tower-supervisor-session.js +307 -0
  467. package/dist/tower/tower-supervisor-session.js.map +1 -0
  468. package/dist/tower/tower-supervisor.d.ts +86 -0
  469. package/dist/tower/tower-supervisor.d.ts.map +1 -0
  470. package/dist/tower/tower-supervisor.js +8 -0
  471. package/dist/tower/tower-supervisor.js.map +1 -0
  472. package/dist/types/index.js +1 -1
  473. package/dist/update/auto-update.d.ts +11 -5
  474. package/dist/update/auto-update.d.ts.map +1 -1
  475. package/dist/update/auto-update.js +11 -5
  476. package/dist/update/auto-update.js.map +1 -1
  477. package/dist/update/restart-contract.d.ts +62 -0
  478. package/dist/update/restart-contract.d.ts.map +1 -0
  479. package/dist/update/restart-contract.js +137 -0
  480. package/dist/update/restart-contract.js.map +1 -0
  481. package/dist/verify/attribution/verification-baseline-run.d.ts.map +1 -1
  482. package/dist/verify/attribution/verification-baseline-run.js +1 -0
  483. package/dist/verify/attribution/verification-baseline-run.js.map +1 -1
  484. package/dist/verify/ci-gate/ci-gate-dispatch.d.ts +3 -0
  485. package/dist/verify/ci-gate/ci-gate-dispatch.d.ts.map +1 -1
  486. package/dist/verify/ci-gate/ci-gate-dispatch.js +31 -9
  487. package/dist/verify/ci-gate/ci-gate-dispatch.js.map +1 -1
  488. package/dist/verify/ci-gate/ci-gate-wait-record.d.ts +6 -0
  489. package/dist/verify/ci-gate/ci-gate-wait-record.d.ts.map +1 -1
  490. package/dist/verify/ci-gate/ci-gate-wait-record.js +1 -0
  491. package/dist/verify/ci-gate/ci-gate-wait-record.js.map +1 -1
  492. package/dist/verify/deterministic-gate/verification-checkout.d.ts +12 -2
  493. package/dist/verify/deterministic-gate/verification-checkout.d.ts.map +1 -1
  494. package/dist/verify/deterministic-gate/verification-checkout.js +18 -3
  495. package/dist/verify/deterministic-gate/verification-checkout.js.map +1 -1
  496. package/dist/verify/deterministic-gate/verification-deterministic.js +1 -1
  497. package/dist/verify/deterministic-gate/verification-failure-parser.d.ts +30 -9
  498. package/dist/verify/deterministic-gate/verification-failure-parser.d.ts.map +1 -1
  499. package/dist/verify/deterministic-gate/verification-failure-parser.js +52 -8
  500. package/dist/verify/deterministic-gate/verification-failure-parser.js.map +1 -1
  501. package/dist/verify/engine/verification-commit-sharing.d.ts.map +1 -1
  502. package/dist/verify/engine/verification-commit-sharing.js +6 -2
  503. package/dist/verify/engine/verification-commit-sharing.js.map +1 -1
  504. package/dist/verify/engine/verification-deps.d.ts +9 -0
  505. package/dist/verify/engine/verification-deps.d.ts.map +1 -1
  506. package/dist/verify/engine/verification-deps.js +1 -1
  507. package/dist/verify/engine/verification-engine.d.ts.map +1 -1
  508. package/dist/verify/engine/verification-engine.js +4 -1
  509. package/dist/verify/engine/verification-engine.js.map +1 -1
  510. package/dist/verify/escaped-tests/escaped-pass-store.d.ts +19 -0
  511. package/dist/verify/escaped-tests/escaped-pass-store.d.ts.map +1 -0
  512. package/dist/verify/escaped-tests/escaped-pass-store.js +90 -0
  513. package/dist/verify/escaped-tests/escaped-pass-store.js.map +1 -0
  514. package/dist/verify/escaped-tests/escaped-test-run.d.ts +39 -0
  515. package/dist/verify/escaped-tests/escaped-test-run.d.ts.map +1 -0
  516. package/dist/verify/escaped-tests/escaped-test-run.js +156 -0
  517. package/dist/verify/escaped-tests/escaped-test-run.js.map +1 -0
  518. package/dist/verify/escaped-tests/escaped-test-set.d.ts +65 -0
  519. package/dist/verify/escaped-tests/escaped-test-set.d.ts.map +1 -0
  520. package/dist/verify/escaped-tests/escaped-test-set.js +95 -0
  521. package/dist/verify/escaped-tests/escaped-test-set.js.map +1 -0
  522. package/dist/verify/escaped-tests/escaped-tests-source.d.ts +44 -0
  523. package/dist/verify/escaped-tests/escaped-tests-source.d.ts.map +1 -0
  524. package/dist/verify/escaped-tests/escaped-tests-source.js +142 -0
  525. package/dist/verify/escaped-tests/escaped-tests-source.js.map +1 -0
  526. package/dist/verify/gate-config/verification-manifest.d.ts +12 -1
  527. package/dist/verify/gate-config/verification-manifest.d.ts.map +1 -1
  528. package/dist/verify/gate-config/verification-manifest.js +12 -1
  529. package/dist/verify/gate-config/verification-manifest.js.map +1 -1
  530. package/dist/verify/gate-verdicts/commit-verdict-record.js +1 -1
  531. package/dist/verify/outcome-routing/verification-rework-issue.d.ts +4 -4
  532. package/dist/verify/outcome-routing/verification-rework-issue.d.ts.map +1 -1
  533. package/dist/verify/outcome-routing/verification-rework-issue.js +16 -6
  534. package/dist/verify/outcome-routing/verification-rework-issue.js.map +1 -1
  535. package/package.json +3 -3
  536. package/scripts/telora-daemon-wrapper.sh +16 -7
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-supervisor-prompt.js","sourceRoot":"","sources":["../../src/tower/tower-supervisor-prompt.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,uEAAuE;AACvE,gBAAgB;AA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,OAAO,CAAC;QAChC,GAAG,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC;QAChC,+BAA+B;QAC/B,GAAG,wBAAwB;QAC3B,GAAG,mBAAmB,CAAC,KAAK,CAAC;QAC7B,GAAG,iBAAiB,EAAE;KACvB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACpD,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,SAAS;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3G,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QACjD,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;IACvD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * The TOWER SUPERVISOR SESSION: the TowerSupervisor (tower/tower-supervisor.ts)
3
+ * the composition root binds. One held loop -> one one-shot `claude --print`
4
+ * judgement session (the routing decider's process, spawn/routing-decider-spawn.ts
5
+ * spawnOneShotJudgementSession, under the supervisor's identity), started in
6
+ * the background so the review exit never waits on it; the hold covers the wait.
7
+ *
8
+ * BOUNDED.
9
+ * - One session per open loop_detected: an in-flight map keyed by the loop
10
+ * decision; no second session starts while one runs.
11
+ * - A governor slot (engine TOWER_SUPERVISOR_GOVERNOR_ENGINE, bounded by the
12
+ * global session cap). None free, the provider window open, the model
13
+ * unavailable: nothing ran, nothing is counted, the next sweep retries.
14
+ * - A session that RAN and left no terminal decision on the record (crashed,
15
+ * timed out, exited without recording) is an attempt. After
16
+ * TOWER_SUPERVISOR_MAX_ATTEMPTS the daemon stops trying: it files one
17
+ * agent_resolvable observation (the daemon has no human-facing route --
18
+ * supervision/filing-route.ts; a routing decider makes it the operator's)
19
+ * and records `escalated_to_operator` naming it, so the loop never stands
20
+ * held SILENTLY. Attempts are counted in memory: a restart grants at most
21
+ * that many more.
22
+ *
23
+ * ONCE PER CRITERION PER ARM. Before any session starts for an undecided
24
+ * loop, the record is asked whether the loop's criterion was already bounded
25
+ * under the current arm (escalateRepeatReviewLoop -> product-api
26
+ * handlers/tower-repeat-loop-escalation.ts, where the rule lives). A repeat --
27
+ * the supervisor's bound did not hold -- is never handed to a second
28
+ * supervisor: the edge files it to the operator (the one path by which a
29
+ * review loop reaches the operator) and records `escalated_to_operator`, so
30
+ * the loop stays held and every later sweep reads it as awaiting the operator.
31
+ * A failed check starts nothing (the next sweep asks again). A new arm resets
32
+ * the allowance: the rule counts bounds of the current arm only.
33
+ *
34
+ * WHO RELEASES THE HOLD: the daemon, never the session. After a session exits
35
+ * (and on every sweep) the daemon reads the focus record: a `criterion_bounded`
36
+ * decision naming the loop (evidence.loopDecisionId) WHOSE BOUND WAS APPLIED --
37
+ * the edge reports an amendment of the loop's criterion recorded since the
38
+ * loop was detected (appliedBounds; handlers/tower-loop-amendments.ts, which
39
+ * also refuses a loop_resolved without one) -> the daemon records
40
+ * `loop_resolved` naming the loop and drops any review directive queued before
41
+ * the amendment, so the next review is a fresh session on the new wording. A
42
+ * criterion_bounded whose amendment never landed releases nothing: the
43
+ * decision is the session's account, the amendment the act, and a release on
44
+ * the account would resume the team on the unbounded wording. That session is
45
+ * an attempt like one that decided nothing. An
46
+ * `escalated_to_operator` naming it -> the loop STAYS held while the operator
47
+ * answers (the safe reading of "the escalation goes to the human"); a new arm
48
+ * is the operator's release, as it always was. A session cannot hold or
49
+ * release a loop by writing a row (product-api tower_decision_record refuses
50
+ * both kinds).
51
+ *
52
+ * MODEL PIN: 'opus' (TOWER_SUPERVISOR_MODEL), the routing decider's pin and for
53
+ * its reason: bounding a criterion moves the bar a whole armed run is judged
54
+ * against, without a human, so the stronger model is worth its cost, and the
55
+ * volume is one session per held loop. A constant, not an EnginePass: the
56
+ * one-shot is a `claude --print` session (an engine pass would let a per-pass
57
+ * org default name a model this path cannot run), and adding a pass widens
58
+ * every engine-override surface for a session that is not a team pass.
59
+ * Reversible: a 'supervisor' pass can replace the constant later.
60
+ *
61
+ * NO BUDGET LEVER, ENFORCED AT THE TOOL. The session runs its Telora MCP server
62
+ * under the scoped profile TOWER_SUPERVISOR_MCP_PROFILE (`tower_supervisor`,
63
+ * mcp/telora-products src/profile-scope.ts), handed to it as its ONLY MCP config
64
+ * (composition/review-loop-context.ts TOWER_SUPERVISOR_IDENTITY.mcpProfile ->
65
+ * spawn/routing-decider-spawn.ts inline --mcp-config + --strict-mcp-config).
66
+ * Under that profile telora_product_focus offers the reads plus amend_criterion
67
+ * and nothing else -- no update, so no arm or re-arm (a new arm resets
68
+ * review_cycle_count: a fresh budget), no unarm, no review-request clear, no
69
+ * pipelineConfig -- and refuses any other action at dispatch; no other tool it
70
+ * registers can arm, unarm, grant cycles or write review_cycle_count. The
71
+ * allowlist (TOWER_SUPERVISOR_MCP_TOOLS) and the prompt
72
+ * (tower/tower-supervisor-prompt.ts) say the same; neither is the bound. Pinned
73
+ * by tower-supervisor-session.test.ts, the prompt test, routing-decider-spawn
74
+ * .test.ts and mcp/telora-products tower-supervisor-profile.test.ts.
75
+ *
76
+ * @module tower/tower-supervisor-session
77
+ */
78
+ import type { ResourceGovernor } from '@telora/daemon-core';
79
+ import type { DaemonConfig } from '../types/index.js';
80
+ import type { FocusDecisionRecord, OpenReviewLoop, RepeatReviewLoopAnswer, TowerDecision, TowerDecisionInput } from '../queries/tower-decisions/tower-decisions.js';
81
+ import { type GatherLoopHistoryArgs, type HeldLoop, type LoopHistory } from './tower-supervisor-history.js';
82
+ import { type TowerSupervisor } from './tower-supervisor.js';
83
+ export declare const TOWER_SUPERVISOR_MODEL = "opus";
84
+ /** Kill a supervisor that has not exited within this window (30 minutes: it may run the disputed tests). */
85
+ export declare const TOWER_SUPERVISOR_TIMEOUT_MS: number;
86
+ /** Sessions that ran without deciding, per loop, before the daemon stops trying and files it. */
87
+ export declare const TOWER_SUPERVISOR_MAX_ATTEMPTS = 2;
88
+ /** Governor engine name for supervisor slots (no per-engine limit: bounded by the global session cap). */
89
+ export declare const TOWER_SUPERVISOR_GOVERNOR_ENGINE = "tower-supervisor";
90
+ /**
91
+ * The scoped MCP profile the supervisor's Telora server runs under
92
+ * (mcp/telora-products profile-scope.ts TOWER_SUPERVISOR_PROFILE): the tool-level
93
+ * bound on "it never grants review budget".
94
+ */
95
+ export declare const TOWER_SUPERVISOR_MCP_PROFILE = "tower_supervisor";
96
+ /** escalation_kind of the observation filed when every attempt ran without deciding. */
97
+ export declare const TOWER_SUPERVISOR_UNDECIDED_KIND = "tower_supervisor_undecided";
98
+ /**
99
+ * The tools a supervisor session is pre-approved for: reading and running the
100
+ * disputed check in the worktree, and the Telora acts it decides through --
101
+ * the amendment (telora_product_focus amend_criterion), the findings and Tasks
102
+ * (telora_product_issue), the decision record (telora_product_tower), the one
103
+ * escalation (telora_agent) -- plus the context it reads. This list only
104
+ * PRE-APPROVES; what the Telora tools can DO is bounded by the scoped MCP
105
+ * profile (TOWER_SUPERVISOR_MCP_PROFILE), under which none can arm, unarm or
106
+ * grant review cycles: the budget is the daemon's.
107
+ */
108
+ export declare const TOWER_SUPERVISOR_MCP_TOOLS: readonly string[];
109
+ /** What one supervisor process is spawned with. */
110
+ export interface TowerSupervisorSpawnOptions {
111
+ config: DaemonConfig;
112
+ prompt: string;
113
+ cwd: string;
114
+ focusId: string;
115
+ /** The loop being decided (telemetry + worker label). */
116
+ loopDecisionId: string;
117
+ model: string;
118
+ timeoutMs: number;
119
+ allowedTools: readonly string[];
120
+ }
121
+ /** How a supervisor process ended. */
122
+ export interface TowerSupervisorSpawnResult {
123
+ started: boolean;
124
+ exitCode: number | null;
125
+ timedOut: boolean;
126
+ stdout: string;
127
+ errorMessage?: string;
128
+ /** The model never ran (rate limit, auth, the provider window): not an attempt. */
129
+ modelUnavailable?: {
130
+ kind: string;
131
+ resetAtMs: number | null;
132
+ };
133
+ }
134
+ /** The focus a held loop belongs to, as the daemon runs it. */
135
+ export interface SupervisedFocus {
136
+ focusId: string;
137
+ focusName: string;
138
+ focusDescription: string | null;
139
+ productId: string;
140
+ }
141
+ /** The one observation filed when every attempt ran without deciding. */
142
+ export interface UndecidedLoopFiling {
143
+ organizationId: string;
144
+ productId: string;
145
+ focusId: string;
146
+ escalationKind: string;
147
+ description: string;
148
+ whatWasTried: string;
149
+ helpNeeded: string;
150
+ metadata: Record<string, unknown>;
151
+ }
152
+ /** The supervisor's collaborators, all required, bound at the composition root. */
153
+ export interface TowerSupervisorDeps {
154
+ /** The running daemon's config (null before the poller starts). */
155
+ readConfig: () => DaemonConfig | null;
156
+ /** The product-scoped config for a product this daemon runs, or null. */
157
+ productConfig: (config: DaemonConfig, productId: string) => DaemonConfig | null;
158
+ /** Read at use time: the engine receives the governor after composition. */
159
+ readGovernor: () => Pick<ResourceGovernor, 'tryAcquireSlot' | 'releaseSlot'> | null;
160
+ listOpenReviewLoops: (scope: {
161
+ productId: string | null;
162
+ }) => Promise<OpenReviewLoop[]>;
163
+ listTowerDecisions: (focusId: string) => Promise<FocusDecisionRecord>;
164
+ recordTowerDecision: (input: TowerDecisionInput) => Promise<{
165
+ decision: TowerDecision;
166
+ created: boolean;
167
+ }>;
168
+ /** The once-per-criterion-per-arm rule: a repeat is filed to the operator by the edge. Throws on failure. */
169
+ escalateRepeatReviewLoop: (args: {
170
+ focusId: string;
171
+ loopDecisionId: string;
172
+ }) => Promise<RepeatReviewLoopAnswer>;
173
+ findFocus: (focusId: string, productId: string | null) => Promise<SupervisedFocus | null>;
174
+ focusWorktreePath: (focusId: string) => string | null;
175
+ gatherHistory: (args: GatherLoopHistoryArgs) => Promise<LoopHistory>;
176
+ spawn: (opts: TowerSupervisorSpawnOptions) => Promise<TowerSupervisorSpawnResult>;
177
+ fileUndecidedLoop: (filing: UndecidedLoopFiling) => Promise<{
178
+ escalationId: string | null;
179
+ }>;
180
+ /** Drop a review directive queued for the focus (directive-queue clearPendingReviewDirective). */
181
+ dropPendingReviewDirective: (focusId: string) => boolean;
182
+ newSessionId: () => string;
183
+ }
184
+ /** Where the record stands for one held loop. */
185
+ export type LoopSettlement = {
186
+ kind: 'bounded';
187
+ bounded: TowerDecision[];
188
+ amendmentIds: string[];
189
+ } | {
190
+ kind: 'bound_unapplied';
191
+ bounded: TowerDecision[];
192
+ } | {
193
+ kind: 'awaiting_operator';
194
+ escalations: TowerDecision[];
195
+ } | {
196
+ kind: 'undecided';
197
+ };
198
+ /** Pure: the decisions on the record that are ABOUT a loop (evidence.loopDecisionId). */
199
+ export declare function decisionsAboutLoop(decisions: readonly TowerDecision[], loopDecisionId: string): TowerDecision[];
200
+ /**
201
+ * Pure: where a held loop stands on the record. An escalation to the operator
202
+ * wins over a bound (a supervisor that escalated did not settle it); a
203
+ * criterion_bounded decision naming the loop settles it only when the edge
204
+ * reports its bound APPLIED (an amendment of the criterion since detection);
205
+ * a bound on the record without one is `bound_unapplied`, which releases
206
+ * nothing; anything else is undecided.
207
+ */
208
+ export declare function settlementOf(record: Pick<FocusDecisionRecord, 'decisions' | 'appliedBounds'>, loopDecisionId: string): LoopSettlement;
209
+ /** Pure: the loop_resolved the daemon records once the criterion was bounded. */
210
+ export declare function loopResolvedDecision(loop: HeldLoop, bounded: readonly TowerDecision[], amendmentIds: readonly string[]): TowerDecisionInput;
211
+ /** Pure: what a finished spawn was -- not run at all (retry, uncounted), or ran. */
212
+ export declare function spawnRan(result: TowerSupervisorSpawnResult): boolean;
213
+ /** Pure: a one-line account of a spawn's end. */
214
+ export declare function describeSpawnEnd(result: TowerSupervisorSpawnResult): string;
215
+ /** Build the TowerSupervisor the composition root binds (one per process). */
216
+ export declare function createTowerSupervisor(deps: TowerSupervisorDeps): TowerSupervisor & {
217
+ /** Test seam: resolves once every session started so far has finished. */
218
+ settled(): Promise<void>;
219
+ };
220
+ //# sourceMappingURL=tower-supervisor-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tower-supervisor-session.d.ts","sourceRoot":"","sources":["../../src/tower/tower-supervisor-session.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EACnB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAc,KAAK,qBAAqB,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAExH,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAE7C,4GAA4G;AAC5G,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAE1D,iGAAiG;AACjG,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,0GAA0G;AAC1G,eAAO,MAAM,gCAAgC,qBAAqB,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAE5E;;;;;;;;;GASG;AACH,eAAO,MAAM,0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