@telora/daemon 0.24.42 → 0.24.56

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 (359) hide show
  1. package/build-info.json +11 -3
  2. package/dist/completion/completion-event/unfinished-work.d.ts +3 -3
  3. package/dist/completion/review-cycle-budget/review-loop-detection.d.ts.map +1 -1
  4. package/dist/completion/review-cycle-budget/review-loop-detection.js +2 -1
  5. package/dist/completion/review-cycle-budget/review-loop-detection.js.map +1 -1
  6. package/dist/completion/review-exit-holds/review-exit-verdict-gate.d.ts +1 -1
  7. package/dist/completion/review-exit-holds/review-exit-verdict-gate.d.ts.map +1 -1
  8. package/dist/completion/review-exit-holds/review-exit-verdict-gate.js +2 -3
  9. package/dist/completion/review-exit-holds/review-exit-verdict-gate.js.map +1 -1
  10. package/dist/completion/state-cascade/focus-next-step-read.d.ts +38 -0
  11. package/dist/completion/state-cascade/focus-next-step-read.d.ts.map +1 -0
  12. package/dist/completion/state-cascade/focus-next-step-read.js +188 -0
  13. package/dist/completion/state-cascade/focus-next-step-read.js.map +1 -0
  14. package/dist/completion/state-cascade/review-request-gate.d.ts.map +1 -1
  15. package/dist/completion/state-cascade/review-request-gate.js +1 -0
  16. package/dist/completion/state-cascade/review-request-gate.js.map +1 -1
  17. package/dist/completion/state-cascade/review-request-next-step.d.ts +56 -0
  18. package/dist/completion/state-cascade/review-request-next-step.d.ts.map +1 -0
  19. package/dist/completion/state-cascade/review-request-next-step.js +47 -0
  20. package/dist/completion/state-cascade/review-request-next-step.js.map +1 -0
  21. package/dist/completion/state-cascade/review-verify-judgment-gate.d.ts +1 -1
  22. package/dist/completion/state-cascade/review-verify-judgment-gate.d.ts.map +1 -1
  23. package/dist/completion/state-cascade/review-verify-judgment-gate.js +1 -0
  24. package/dist/completion/state-cascade/review-verify-judgment-gate.js.map +1 -1
  25. package/dist/completion/state-cascade/state-cascade.d.ts +12 -7
  26. package/dist/completion/state-cascade/state-cascade.d.ts.map +1 -1
  27. package/dist/completion/state-cascade/state-cascade.js +36 -105
  28. package/dist/completion/state-cascade/state-cascade.js.map +1 -1
  29. package/dist/composition/commit-gate-context.d.ts.map +1 -1
  30. package/dist/composition/commit-gate-context.js +1 -0
  31. package/dist/composition/commit-gate-context.js.map +1 -1
  32. package/dist/composition/daemon-contexts.js +1 -1
  33. package/dist/composition/execution-migrations-context.d.ts.map +1 -1
  34. package/dist/composition/execution-migrations-context.js +3 -1
  35. package/dist/composition/execution-migrations-context.js.map +1 -1
  36. package/dist/composition/execution-process-context.js +1 -1
  37. package/dist/composition/execution-recovery-context.d.ts +4 -3
  38. package/dist/composition/execution-recovery-context.d.ts.map +1 -1
  39. package/dist/composition/execution-recovery-context.js +6 -3
  40. package/dist/composition/execution-recovery-context.js.map +1 -1
  41. package/dist/composition/execution-worktree-context.js +1 -1
  42. package/dist/composition/focus-next-step-context.d.ts +19 -0
  43. package/dist/composition/focus-next-step-context.d.ts.map +1 -0
  44. package/dist/composition/focus-next-step-context.js +51 -0
  45. package/dist/composition/focus-next-step-context.js.map +1 -0
  46. package/dist/composition/runtime-contexts.d.ts.map +1 -1
  47. package/dist/composition/runtime-contexts.js +6 -18
  48. package/dist/composition/runtime-contexts.js.map +1 -1
  49. package/dist/composition/runtime-poll-context.d.ts +8 -53
  50. package/dist/composition/runtime-poll-context.d.ts.map +1 -1
  51. package/dist/composition/runtime-poll-context.js +35 -94
  52. package/dist/composition/runtime-poll-context.js.map +1 -1
  53. package/dist/composition/runtime-prd-context.d.ts +8 -0
  54. package/dist/composition/runtime-prd-context.d.ts.map +1 -1
  55. package/dist/composition/runtime-prd-context.js +32 -0
  56. package/dist/composition/runtime-prd-context.js.map +1 -1
  57. package/dist/composition/runtime-spawn-pass-context.d.ts.map +1 -1
  58. package/dist/composition/runtime-spawn-pass-context.js +2 -3
  59. package/dist/composition/runtime-spawn-pass-context.js.map +1 -1
  60. package/dist/composition/state-cascade-context.d.ts +2 -0
  61. package/dist/composition/state-cascade-context.d.ts.map +1 -1
  62. package/dist/composition/state-cascade-context.js +9 -0
  63. package/dist/composition/state-cascade-context.js.map +1 -1
  64. package/dist/composition/verification-context.d.ts.map +1 -1
  65. package/dist/composition/verification-context.js +15 -3
  66. package/dist/composition/verification-context.js.map +1 -1
  67. package/dist/config/live-daemon-config.js +1 -1
  68. package/dist/daemon-state/branch-removal-record.d.ts +30 -0
  69. package/dist/daemon-state/branch-removal-record.d.ts.map +1 -0
  70. package/dist/daemon-state/branch-removal-record.js +103 -0
  71. package/dist/daemon-state/branch-removal-record.js.map +1 -0
  72. package/dist/delivery/advance-hold.d.ts +8 -19
  73. package/dist/delivery/advance-hold.d.ts.map +1 -1
  74. package/dist/delivery/advance-hold.js +11 -36
  75. package/dist/delivery/advance-hold.js.map +1 -1
  76. package/dist/delivery/commit-verdict-hold.d.ts +1 -1
  77. package/dist/delivery/commit-verdict-hold.js +1 -1
  78. package/dist/delivery/recorded-concerns.d.ts.map +1 -1
  79. package/dist/delivery/recorded-concerns.js +0 -2
  80. package/dist/delivery/recorded-concerns.js.map +1 -1
  81. package/dist/directive/directive-queue.d.ts +4 -16
  82. package/dist/directive/directive-queue.d.ts.map +1 -1
  83. package/dist/directive/directive-queue.js +5 -13
  84. package/dist/directive/directive-queue.js.map +1 -1
  85. package/dist/directive/phase-sync.d.ts +1 -1
  86. package/dist/directive/phase-sync.js +1 -1
  87. package/dist/focus/crash-recovery.d.ts +10 -32
  88. package/dist/focus/crash-recovery.d.ts.map +1 -1
  89. package/dist/focus/crash-recovery.js +55 -150
  90. package/dist/focus/crash-recovery.js.map +1 -1
  91. package/dist/focus/daemon-contexts-runtime.d.ts +3 -3
  92. package/dist/focus/daemon-contexts-runtime.d.ts.map +1 -1
  93. package/dist/focus/daemon-contexts.js +1 -1
  94. package/dist/focus/directive-executor.d.ts.map +1 -1
  95. package/dist/focus/directive-executor.js +3 -7
  96. package/dist/focus/directive-executor.js.map +1 -1
  97. package/dist/focus/failed-head-rework-start.d.ts +61 -0
  98. package/dist/focus/failed-head-rework-start.d.ts.map +1 -0
  99. package/dist/focus/failed-head-rework-start.js +52 -0
  100. package/dist/focus/failed-head-rework-start.js.map +1 -0
  101. package/dist/focus/focus-activity-record.d.ts +4 -2
  102. package/dist/focus/focus-activity-record.d.ts.map +1 -1
  103. package/dist/focus/focus-activity-record.js +4 -2
  104. package/dist/focus/focus-activity-record.js.map +1 -1
  105. package/dist/focus/focus-liveness-pass.d.ts +62 -0
  106. package/dist/focus/focus-liveness-pass.d.ts.map +1 -0
  107. package/dist/focus/focus-liveness-pass.js +197 -0
  108. package/dist/focus/focus-liveness-pass.js.map +1 -0
  109. package/dist/focus/focus-poller-spawn.js +1 -1
  110. package/dist/focus/focus-poller-state.js +1 -1
  111. package/dist/focus/live-branch-preservation.d.ts +123 -0
  112. package/dist/focus/live-branch-preservation.d.ts.map +1 -0
  113. package/dist/focus/live-branch-preservation.js +192 -0
  114. package/dist/focus/live-branch-preservation.js.map +1 -0
  115. package/dist/focus/migration-claim-pass.d.ts +2 -0
  116. package/dist/focus/migration-claim-pass.d.ts.map +1 -1
  117. package/dist/focus/migration-claim-pass.js +57 -22
  118. package/dist/focus/migration-claim-pass.js.map +1 -1
  119. package/dist/focus/migration-held-set-publish.d.ts +28 -2
  120. package/dist/focus/migration-held-set-publish.d.ts.map +1 -1
  121. package/dist/focus/migration-held-set-publish.js +14 -0
  122. package/dist/focus/migration-held-set-publish.js.map +1 -1
  123. package/dist/focus/pending-spawn-review-next-step.d.ts +5 -11
  124. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -1
  125. package/dist/focus/pending-spawn-review-next-step.js +26 -72
  126. package/dist/focus/pending-spawn-review-next-step.js.map +1 -1
  127. package/dist/focus/review-refire-gate.d.ts +25 -0
  128. package/dist/focus/review-refire-gate.d.ts.map +1 -0
  129. package/dist/focus/review-refire-gate.js +68 -0
  130. package/dist/focus/review-refire-gate.js.map +1 -0
  131. package/dist/focus/verify-routing-passes.d.ts +8 -11
  132. package/dist/focus/verify-routing-passes.d.ts.map +1 -1
  133. package/dist/focus/verify-routing-passes.js +1 -2
  134. package/dist/focus/verify-routing-passes.js.map +1 -1
  135. package/dist/git/types.js +1 -1
  136. package/dist/prd/arm-refusal-streak.d.ts +102 -0
  137. package/dist/prd/arm-refusal-streak.d.ts.map +1 -0
  138. package/dist/prd/arm-refusal-streak.js +136 -0
  139. package/dist/prd/arm-refusal-streak.js.map +1 -0
  140. package/dist/prd/arm-refusal.d.ts.map +1 -1
  141. package/dist/prd/arm-refusal.js +7 -4
  142. package/dist/prd/arm-refusal.js.map +1 -1
  143. package/dist/prd/controller-shared.d.ts +47 -12
  144. package/dist/prd/controller-shared.d.ts.map +1 -1
  145. package/dist/prd/controller-shared.js +30 -19
  146. package/dist/prd/controller-shared.js.map +1 -1
  147. package/dist/prd/controller.d.ts.map +1 -1
  148. package/dist/prd/controller.js +3 -1
  149. package/dist/prd/controller.js.map +1 -1
  150. package/dist/prd/frontier-arming.d.ts +10 -2
  151. package/dist/prd/frontier-arming.d.ts.map +1 -1
  152. package/dist/prd/frontier-arming.js +91 -7
  153. package/dist/prd/frontier-arming.js.map +1 -1
  154. package/dist/prd/scoping-prompt.d.ts +8 -0
  155. package/dist/prd/scoping-prompt.d.ts.map +1 -1
  156. package/dist/prd/scoping-prompt.js +18 -0
  157. package/dist/prd/scoping-prompt.js.map +1 -1
  158. package/dist/prompt-sections/qa-failure-section.d.ts.map +1 -1
  159. package/dist/prompt-sections/qa-failure-section.js +3 -1
  160. package/dist/prompt-sections/qa-failure-section.js.map +1 -1
  161. package/dist/queries/api-client/shared.js +1 -1
  162. package/dist/queries/deliveries/deliveries.js +1 -1
  163. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts +4 -3
  164. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts.map +1 -1
  165. package/dist/queries/delivery-gate-state/delivery-gate-state.js +1 -1
  166. package/dist/queries/escalations/escalations.d.ts.map +1 -1
  167. package/dist/queries/escalations/escalations.js +0 -1
  168. package/dist/queries/escalations/escalations.js.map +1 -1
  169. package/dist/queries/escalations/incident-record.d.ts.map +1 -1
  170. package/dist/queries/escalations/incident-record.js +1 -0
  171. package/dist/queries/escalations/incident-record.js.map +1 -1
  172. package/dist/queries/focus-review/review-criterion-verdicts.d.ts.map +1 -1
  173. package/dist/queries/focus-review/review-criterion-verdicts.js +1 -0
  174. package/dist/queries/focus-review/review-criterion-verdicts.js.map +1 -1
  175. package/dist/queries/migrations/live-focus-branches.d.ts +23 -0
  176. package/dist/queries/migrations/live-focus-branches.d.ts.map +1 -1
  177. package/dist/queries/migrations/live-focus-branches.js +32 -1
  178. package/dist/queries/migrations/live-focus-branches.js.map +1 -1
  179. package/dist/queries/prd/prd.d.ts.map +1 -1
  180. package/dist/queries/prd/prd.js +1 -16
  181. package/dist/queries/prd/prd.js.map +1 -1
  182. package/dist/queries/qa-packets/focus-qa-failure.d.ts +18 -0
  183. package/dist/queries/qa-packets/focus-qa-failure.d.ts.map +1 -1
  184. package/dist/queries/qa-packets/focus-qa-failure.js +14 -1
  185. package/dist/queries/qa-packets/focus-qa-failure.js.map +1 -1
  186. package/dist/queries/tower/tower-state.d.ts +2 -0
  187. package/dist/queries/tower/tower-state.d.ts.map +1 -1
  188. package/dist/queries/tower/tower-state.js +6 -0
  189. package/dist/queries/tower/tower-state.js.map +1 -1
  190. package/dist/queries/tower-decisions/tower-decisions.d.ts.map +1 -1
  191. package/dist/queries/tower-decisions/tower-decisions.js +1 -0
  192. package/dist/queries/tower-decisions/tower-decisions.js.map +1 -1
  193. package/dist/queries/verification/verification.d.ts +10 -0
  194. package/dist/queries/verification/verification.d.ts.map +1 -1
  195. package/dist/queries/verification/verification.js +1 -1
  196. package/dist/queries/verification/verification.js.map +1 -1
  197. package/dist/supervision/escalation-suppression.js +1 -1
  198. package/dist/supervision/failed-head-rerun.d.ts +7 -0
  199. package/dist/supervision/failed-head-rerun.d.ts.map +1 -0
  200. package/dist/supervision/failed-head-rerun.js +41 -0
  201. package/dist/supervision/failed-head-rerun.js.map +1 -0
  202. package/dist/supervision/focus-delivery-aggregate-phase.js +1 -1
  203. package/dist/supervision/focus-delivery-aggregate-phase.js.map +1 -1
  204. package/dist/supervision/focus-liveness.d.ts +89 -0
  205. package/dist/supervision/focus-liveness.d.ts.map +1 -0
  206. package/dist/supervision/focus-liveness.js +94 -0
  207. package/dist/supervision/focus-liveness.js.map +1 -0
  208. package/dist/supervision/focus-next-step.d.ts +175 -0
  209. package/dist/supervision/focus-next-step.d.ts.map +1 -0
  210. package/dist/supervision/focus-next-step.js +129 -0
  211. package/dist/supervision/focus-next-step.js.map +1 -0
  212. package/dist/supervision/prd-frontier-rule.d.ts +52 -0
  213. package/dist/supervision/prd-frontier-rule.d.ts.map +1 -0
  214. package/dist/supervision/prd-frontier-rule.js +51 -0
  215. package/dist/supervision/prd-frontier-rule.js.map +1 -0
  216. package/dist/supervision/prt-frontier.d.ts +22 -7
  217. package/dist/supervision/prt-frontier.d.ts.map +1 -1
  218. package/dist/supervision/prt-frontier.js +17 -7
  219. package/dist/supervision/prt-frontier.js.map +1 -1
  220. package/dist/supervision/review-loop-detector.d.ts.map +1 -1
  221. package/dist/supervision/review-loop-detector.js +2 -1
  222. package/dist/supervision/review-loop-detector.js.map +1 -1
  223. package/dist/supervision/spawn-cooldown.js +1 -1
  224. package/dist/supervision/stop-registry.d.ts +1 -0
  225. package/dist/supervision/stop-registry.d.ts.map +1 -1
  226. package/dist/supervision/stop-rows-focus-health.d.ts +14 -0
  227. package/dist/supervision/stop-rows-focus-health.d.ts.map +1 -1
  228. package/dist/supervision/stop-rows-focus-health.js +32 -0
  229. package/dist/supervision/stop-rows-focus-health.js.map +1 -1
  230. package/dist/supervision/stop-rows-spawn.d.ts +3 -2
  231. package/dist/supervision/stop-rows-spawn.d.ts.map +1 -1
  232. package/dist/supervision/stop-rows-spawn.js +9 -6
  233. package/dist/supervision/stop-rows-spawn.js.map +1 -1
  234. package/dist/supervision/team-work.js +1 -1
  235. package/dist/supervision/team-work.js.map +1 -1
  236. package/dist/testing/fixtures/api-client.js +1 -1
  237. package/dist/testing/fixtures/index.js +1 -1
  238. package/dist/testing/fixtures/migration-namespace-repo.d.ts.map +1 -1
  239. package/dist/testing/fixtures/migration-namespace-repo.js +1 -0
  240. package/dist/testing/fixtures/migration-namespace-repo.js.map +1 -1
  241. package/dist/testing/fixtures/pending-spawn-world.d.ts +24 -0
  242. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -1
  243. package/dist/testing/fixtures/pending-spawn-world.js +46 -19
  244. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  245. package/dist/testing/fixtures/recording-api-client.js +1 -1
  246. package/dist/testing/fixtures/verification-deps.d.ts +27 -0
  247. package/dist/testing/fixtures/verification-deps.d.ts.map +1 -1
  248. package/dist/testing/fixtures/verification-deps.js +77 -1
  249. package/dist/testing/fixtures/verification-deps.js.map +1 -1
  250. package/dist/testing/fixtures/vitest-failure-log.d.ts.map +1 -1
  251. package/dist/testing/fixtures/vitest-failure-log.js +1 -0
  252. package/dist/testing/fixtures/vitest-failure-log.js.map +1 -1
  253. package/dist/tower/focus-landed.d.ts +32 -1
  254. package/dist/tower/focus-landed.d.ts.map +1 -1
  255. package/dist/tower/focus-landed.js +67 -12
  256. package/dist/tower/focus-landed.js.map +1 -1
  257. package/dist/tower/tower-graph.d.ts +6 -2
  258. package/dist/tower/tower-graph.d.ts.map +1 -1
  259. package/dist/tower/tower-graph.js +8 -5
  260. package/dist/tower/tower-graph.js.map +1 -1
  261. package/dist/tower/tower-supervisor-history.d.ts.map +1 -1
  262. package/dist/tower/tower-supervisor-history.js +2 -1
  263. package/dist/tower/tower-supervisor-history.js.map +1 -1
  264. package/dist/tower/tower-supervisor-prompt.d.ts.map +1 -1
  265. package/dist/tower/tower-supervisor-prompt.js +40 -8
  266. package/dist/tower/tower-supervisor-prompt.js.map +1 -1
  267. package/dist/tower/tower-supervisor-session.d.ts.map +1 -1
  268. package/dist/tower/tower-supervisor-session.js +1 -0
  269. package/dist/tower/tower-supervisor-session.js.map +1 -1
  270. package/dist/tower/tower-verdicts.d.ts.map +1 -1
  271. package/dist/tower/tower-verdicts.js +2 -1
  272. package/dist/tower/tower-verdicts.js.map +1 -1
  273. package/dist/types/issue-status.d.ts.map +1 -1
  274. package/dist/types/issue-status.js +6 -1
  275. package/dist/types/issue-status.js.map +1 -1
  276. package/dist/verify/attribution/code-failure-evidence.d.ts +77 -0
  277. package/dist/verify/attribution/code-failure-evidence.d.ts.map +1 -0
  278. package/dist/verify/attribution/code-failure-evidence.js +92 -0
  279. package/dist/verify/attribution/code-failure-evidence.js.map +1 -0
  280. package/dist/verify/attribution/verification-attribution.d.ts +18 -0
  281. package/dist/verify/attribution/verification-attribution.d.ts.map +1 -1
  282. package/dist/verify/attribution/verification-attribution.js +49 -2
  283. package/dist/verify/attribution/verification-attribution.js.map +1 -1
  284. package/dist/verify/attribution/verification-baseline.d.ts.map +1 -1
  285. package/dist/verify/attribution/verification-baseline.js +1 -0
  286. package/dist/verify/attribution/verification-baseline.js.map +1 -1
  287. package/dist/verify/attribution/verification-diagnostics.d.ts +10 -0
  288. package/dist/verify/attribution/verification-diagnostics.d.ts.map +1 -1
  289. package/dist/verify/attribution/verification-diagnostics.js +39 -10
  290. package/dist/verify/attribution/verification-diagnostics.js.map +1 -1
  291. package/dist/verify/deterministic-gate/verification-deterministic.d.ts +19 -0
  292. package/dist/verify/deterministic-gate/verification-deterministic.d.ts.map +1 -1
  293. package/dist/verify/deterministic-gate/verification-deterministic.js +1 -1
  294. package/dist/verify/deterministic-gate/verification-deterministic.js.map +1 -1
  295. package/dist/verify/engine/verification-commit-sharing.d.ts.map +1 -1
  296. package/dist/verify/engine/verification-commit-sharing.js +36 -4
  297. package/dist/verify/engine/verification-commit-sharing.js.map +1 -1
  298. package/dist/verify/engine/verification-deps.d.ts +7 -0
  299. package/dist/verify/engine/verification-deps.d.ts.map +1 -1
  300. package/dist/verify/engine/verification-engine.d.ts.map +1 -1
  301. package/dist/verify/engine/verification-engine.js +6 -3
  302. package/dist/verify/engine/verification-engine.js.map +1 -1
  303. package/dist/verify/escaped-tests/escaped-test-run.d.ts +5 -1
  304. package/dist/verify/escaped-tests/escaped-test-run.d.ts.map +1 -1
  305. package/dist/verify/escaped-tests/escaped-test-run.js +24 -2
  306. package/dist/verify/escaped-tests/escaped-test-run.js.map +1 -1
  307. package/dist/verify/failing-test-rerun/failing-test-retry.d.ts +4 -1
  308. package/dist/verify/failing-test-rerun/failing-test-retry.d.ts.map +1 -1
  309. package/dist/verify/failing-test-rerun/failing-test-retry.js.map +1 -1
  310. package/dist/verify/gate-verdicts/commit-verdict-record.js +1 -1
  311. package/dist/verify/gate-verdicts/commit-verdict-record.js.map +1 -1
  312. package/dist/verify/gate-verdicts/no-verdict-record.d.ts +27 -3
  313. package/dist/verify/gate-verdicts/no-verdict-record.d.ts.map +1 -1
  314. package/dist/verify/gate-verdicts/no-verdict-record.js +36 -6
  315. package/dist/verify/gate-verdicts/no-verdict-record.js.map +1 -1
  316. package/dist/verify/outcome-routing/verification-rework-issue.d.ts.map +1 -1
  317. package/dist/verify/outcome-routing/verification-rework-issue.js +5 -4
  318. package/dist/verify/outcome-routing/verification-rework-issue.js.map +1 -1
  319. package/dist/verify/run-selection/default-on-guards.d.ts +15 -4
  320. package/dist/verify/run-selection/default-on-guards.d.ts.map +1 -1
  321. package/dist/verify/run-selection/default-on-guards.js +14 -4
  322. package/dist/verify/run-selection/default-on-guards.js.map +1 -1
  323. package/dist/verify/run-selection/explicit-next-step-gate.d.ts +39 -0
  324. package/dist/verify/run-selection/explicit-next-step-gate.d.ts.map +1 -0
  325. package/dist/verify/run-selection/explicit-next-step-gate.js +70 -0
  326. package/dist/verify/run-selection/explicit-next-step-gate.js.map +1 -0
  327. package/dist/verify/run-selection/pre-review-gate-dispatch.d.ts +0 -9
  328. package/dist/verify/run-selection/pre-review-gate-dispatch.d.ts.map +1 -1
  329. package/dist/verify/run-selection/pre-review-gate-dispatch.js +21 -62
  330. package/dist/verify/run-selection/pre-review-gate-dispatch.js.map +1 -1
  331. package/dist/verify/run-selection/reselection-log-line.d.ts +1 -1
  332. package/dist/verify/run-selection/reselection-log-line.d.ts.map +1 -1
  333. package/dist/verify/run-selection/reselection-log-line.js +2 -0
  334. package/dist/verify/run-selection/reselection-log-line.js.map +1 -1
  335. package/dist/verify/run-selection/verification-default-on.d.ts +32 -4
  336. package/dist/verify/run-selection/verification-default-on.d.ts.map +1 -1
  337. package/dist/verify/run-selection/verification-default-on.js +83 -19
  338. package/dist/verify/run-selection/verification-default-on.js.map +1 -1
  339. package/dist/verify/shortfalls/shortfall-park.js +1 -1
  340. package/dist/worktree/focus-worktree-state.js +1 -1
  341. package/dist/worktree/focus-worktree-state.js.map +1 -1
  342. package/docs/runbook-tower.md +26 -5
  343. package/package.json +3 -3
  344. package/dist/completion/state-cascade/review-next-step.d.ts +0 -107
  345. package/dist/completion/state-cascade/review-next-step.d.ts.map +0 -1
  346. package/dist/completion/state-cascade/review-next-step.js +0 -90
  347. package/dist/completion/state-cascade/review-next-step.js.map +0 -1
  348. package/dist/focus/failed-head-wedge.d.ts +0 -124
  349. package/dist/focus/failed-head-wedge.d.ts.map +0 -1
  350. package/dist/focus/failed-head-wedge.js +0 -120
  351. package/dist/focus/failed-head-wedge.js.map +0 -1
  352. package/dist/focus/stranded-review-reroute.d.ts +0 -70
  353. package/dist/focus/stranded-review-reroute.d.ts.map +0 -1
  354. package/dist/focus/stranded-review-reroute.js +0 -193
  355. package/dist/focus/stranded-review-reroute.js.map +0 -1
  356. package/dist/focus/uncommitted-work-backstop.d.ts +0 -115
  357. package/dist/focus/uncommitted-work-backstop.d.ts.map +0 -1
  358. package/dist/focus/uncommitted-work-backstop.js +0 -259
  359. package/dist/focus/uncommitted-work-backstop.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failed-head-rerun.d.ts","sourceRoot":"","sources":["../../src/supervision/failed-head-rerun.ts"],"names":[],"mappings":"AA+BA,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtE;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEjF;AAED,sCAAsC;AACtC,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD"}
@@ -0,0 +1,41 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/completion/state-cascade/focus-next-step-agreement.test.ts,
3
+ // packages/daemon/src/completion/state-cascade/focus-next-step-read.test.ts,
4
+ // packages/daemon/src/composition/focus-next-step-context.test.ts,
5
+ // packages/daemon/src/integration/failed-verdict-review-exit-respawn-regression.test.ts,
6
+ // packages/daemon/src/integration/failed-verdict-review-loop-regression.test.ts,
7
+ // packages/daemon/src/verify/engine/verification-commit-sharing.test.ts,
8
+ // packages/daemon/src/verify/run-selection/verification-default-on.test.ts
9
+ // PINNED-BY-END
10
+ /**
11
+ * The once-per-HEAD record of the failed-HEAD re-run (supervision/focus-next-step.ts).
12
+ *
13
+ * A failed gate at a focus HEAD whose rework Bug was closed with no new commit
14
+ * answers a gate run at that same HEAD -- at most once. The dispatch whose run
15
+ * RENDERED a verdict there notes it here, keyed (focus, HEAD)
16
+ * (verify/engine/verification-commit-sharing.ts) -- a candidate that could not be
17
+ * armed, started or judged spends nothing; the next-step read hands the note back as
18
+ * rerunSpentAtHead, so a second failure at the same HEAD answers a coding team
19
+ * (the Bug re-opened), never a second re-run. A new HEAD is a new key.
20
+ *
21
+ * In process, deliberately: the record bounds a loop inside one daemon run. A
22
+ * restart forgets it and re-arms one more re-run per failed HEAD -- one gate
23
+ * run, never a loop, because the restart is what re-arms it.
24
+ *
25
+ * @module supervision/failed-head-rerun
26
+ */
27
+ /** focusId -> the HEAD its one failed-HEAD re-run was taken at. */
28
+ const rerunAt = new Map();
29
+ /** Record that the failed-HEAD re-run was taken for `focusId` at `sha`. */
30
+ export function noteFailedHeadRerun(focusId, sha) {
31
+ rerunAt.set(focusId, sha);
32
+ }
33
+ /** Whether the failed-HEAD re-run was already taken for `focusId` at `sha`. */
34
+ export function failedHeadRerunSpent(focusId, sha) {
35
+ return sha !== null && rerunAt.get(focusId) === sha;
36
+ }
37
+ /** Test-only: forget every re-run. */
38
+ export function __resetFailedHeadRerunsForTests() {
39
+ rerunAt.clear();
40
+ }
41
+ //# sourceMappingURL=failed-head-rerun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failed-head-rerun.js","sourceRoot":"","sources":["../../src/supervision/failed-head-rerun.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,6FAA6F;AAC7F,+EAA+E;AAC/E,qEAAqE;AACrE,2FAA2F;AAC3F,mFAAmF;AACnF,2EAA2E;AAC3E,6EAA6E;AAC7E,gBAAgB;AAEhB;;;;;;;;;;;;;;;;GAgBG;AAEH,mEAAmE;AACnE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,GAAW;IAC9D,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,GAAkB;IACtE,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AACtD,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,+BAA+B;IAC7C,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
- // Pinned by: packages/daemon/src/completion/state-cascade/review-next-step.test.ts,
2
+ // Pinned by: packages/daemon/src/completion/state-cascade/focus-next-step-agreement.test.ts,
3
3
  // packages/daemon/src/completion/state-cascade/review-request-gate.test.ts,
4
4
  // packages/daemon/src/completion/state-cascade/review-window-winding-down-clear.test.ts,
5
5
  // packages/daemon/src/focus/focus-reaches-review-with-held-delivery.test.ts,
@@ -1 +1 @@
1
- {"version":3,"file":"focus-delivery-aggregate-phase.js","sourceRoot":"","sources":["../../src/supervision/focus-delivery-aggregate-phase.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,oFAAoF;AACpF,8EAA8E;AAC9E,2FAA2F;AAC3F,+EAA+E;AAC/E,mEAAmE;AACnE,8DAA8D;AAC9D,sEAAsE;AACtE,sEAAsE;AACtE,2DAA2D;AAC3D,2FAA2F;AAC3F,gGAAgG;AAChG,mFAAmF;AACnF,2FAA2F;AAC3F,mFAAmF;AACnF,2FAA2F;AAC3F,kFAAkF;AAClF,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,gBAAgB;AAuChB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAiB,MAAM,0BAA0B,CAAC;AAoC9E,MAAM,kBAAkB,GAAwC;IAC9D,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,eAAe;IACxC,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,eAAe;IAC3C,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ;IAClC,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ;IAClC,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,QAAQ;IACzC,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ;IAClC,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,UAAU;IAClC,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,UAAU;IACvC,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ;C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;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAEhC,CAAC,GAAG,EAAE;IACR,MAAM,MAAM,GAAkC;QAC5C,SAAS;QACT,QAAQ;QACR,WAAW;QACX,WAAW;QACX,cAAc;QACd,SAAS;KACV,CAAC;IACF,MAAM,KAAK,GAA+E,EAAE,CAAC;IAC7F,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;YACxB,IAAI,IAAI,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAU,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"focus-delivery-aggregate-phase.js","sourceRoot":"","sources":["../../src/supervision/focus-delivery-aggregate-phase.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,6FAA6F;AAC7F,8EAA8E;AAC9E,2FAA2F;AAC3F,+EAA+E;AAC/E,mEAAmE;AACnE,8DAA8D;AAC9D,sEAAsE;AACtE,sEAAsE;AACtE,2DAA2D;AAC3D,2FAA2F;AAC3F,gGAAgG;AAChG,mFAAmF;AACnF,2FAA2F;AAC3F,mFAAmF;AACnF,2FAA2F;AAC3F,kFAAkF;AAClF,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,gBAAgB;AAuChB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAiB,MAAM,0BAA0B,CAAC;AAoC9E,MAAM,kBAAkB,GAAwC;IAC9D,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,eAAe;IACxC,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,eAAe;IAC3C,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ;IAClC,CAAC,eAAe,CAAC,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AY,GAAG,UAAU,CAAC,IAAI,CAClC,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,eAAe,IAAI,IAAI;QACzB,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC;QACpC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAC5C,CAAC;IACF,OAAO,CAAC,YAAY,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAEhC,CAAC,GAAG,EAAE;IACR,MAAM,MAAM,GAAkC;QAC5C,SAAS;QACT,QAAQ;QACR,WAAW;QACX,WAAW;QACX,cAAc;QACd,SAAS;KACV,CAAC;IACF,MAAM,KAAK,GAA+E,EAAE,CAAC;IAC7F,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;YACxB,IAAI,IAAI,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAU,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * THE LIVENESS DETECTOR: an armed focus whose decided next actor does not move
3
+ * it is ONE condition, read off the one next-step decision
4
+ * (supervision/focus-next-step.ts) -- not a predicate per stall shape.
5
+ *
6
+ * Each poll the detector is handed a focus's decided step. The actors it
7
+ * watches are the ones that must START for the focus to move: a coding team, a
8
+ * gate run at HEAD, a review, the merge of a settled branch. It keys what it sees
9
+ * on (step, HEAD, review window) -- the reason is left out, so a team going live does not look like a
10
+ * new answer -- and counts, while the key is unchanged:
11
+ * - not-started polls: the actor is neither live nor in flight (a queued spawn
12
+ * directive is not started: it may wait on a cooldown or a slot);
13
+ * - starts: the actor went live -- a review re-fired on an unchanged range, a
14
+ * coding team that committed nothing -- and the focus still did not move.
15
+ * A new key (a commit, a new step, a window opened or closed) starts over.
16
+ *
17
+ * WHAT IT DOES:
18
+ * - at LIVENESS_START_CODING_POLLS not-started polls on a coding step, it asks
19
+ * its caller to start the coding team itself (a daemon coding respawn naming
20
+ * the reason) -- once per key. The ready-focus path spawns only for
21
+ * actionable deliveries, so a coding answer for uncommitted work, or for a
22
+ * failed HEAD's rework on a verify-only focus, has no other starter. A start
23
+ * the caller could not make (the failed HEAD's rework Bug could not be filed
24
+ * or re-opened) is handed back (unmarkFocusLivenessCodingStarted), so the next
25
+ * poll asks again -- the caller queues nothing until it can;
26
+ * - at the stall (the focus_next_actor_stalled stop-registry row: not-started
27
+ * polls or starts past their bounds) it asks its caller to file ONE
28
+ * agent-resolvable observation for the key, and marks the focus stalled so
29
+ * the stranded-review re-fire stops queueing a review that cannot move it
30
+ * (focus/review-refire-gate.ts).
31
+ * A merge never reads as started (no step answers a merge in flight), so its
32
+ * bound is the longer LIVENESS_MERGE_STALL_POLLS: a completion merge waits on its
33
+ * candidate's CI judgment before it lands. Holds, done and an unreadable state are
34
+ * not counted: a hold names its own releaser (the decision's exhaustive test
35
+ * proves it reachable), and an unreadable state is bounded by the pending-spawn
36
+ * deferral. A focus that is not armed is
37
+ * forgotten.
38
+ *
39
+ * In memory: a restart starts every count over.
40
+ *
41
+ * @module supervision/focus-liveness
42
+ */
43
+ import type { FocusNextStep } from './focus-next-step.js';
44
+ /** Not-started polls on a coding step before the detector starts the coding team itself. */
45
+ export declare const LIVENESS_START_CODING_POLLS = 4;
46
+ /** Not-started polls on an unchanged key before the stall is reported (10 minutes at the 30s poll). */
47
+ export declare const LIVENESS_STALL_POLLS = 20;
48
+ /** Not-started polls on an unchanged merge step before the stall is reported (an hour at the 30s poll: the candidate's CI judges first). */
49
+ export declare const LIVENESS_MERGE_STALL_POLLS = 120;
50
+ /** Starts of the decided actor on an unchanged key before the stall is reported. */
51
+ export declare const LIVENESS_STALL_STARTS = 3;
52
+ /** The actors whose start moves a focus. */
53
+ export type WatchedStep = 'coding' | 'gate_run' | 'review' | 'merge';
54
+ /** What the detector is handed for one focus this poll. */
55
+ export interface LivenessObservation {
56
+ focusId: string;
57
+ next: FocusNextStep;
58
+ /** The HEAD the step was decided at. */
59
+ head: string | null;
60
+ /** review_requested_at. */
61
+ reviewWindow: string | null;
62
+ }
63
+ /** What the caller does this poll. */
64
+ export type LivenessAct = {
65
+ act: 'none';
66
+ } | {
67
+ act: 'start_coding';
68
+ key: string;
69
+ notStartedPolls: number;
70
+ } | {
71
+ act: 'report';
72
+ key: string;
73
+ step: WatchedStep;
74
+ notStartedPolls: number;
75
+ starts: number;
76
+ };
77
+ /** Test-only: forget every count. */
78
+ export declare function __resetFocusLivenessForTests(): void;
79
+ /** Forget a focus (it is no longer armed, or its state is unreadable this poll). */
80
+ export declare function forgetFocusLiveness(focusId: string): void;
81
+ /** Whether the detector has reported the focus's current key stalled. */
82
+ export declare function focusLivenessStalled(focusId: string): boolean;
83
+ /** Count one poll of a focus's decided step and say what the caller does (module header). */
84
+ export declare function observeFocusLiveness(obs: LivenessObservation): LivenessAct;
85
+ /** A coding start the caller could not make: the next poll asks for it again. */
86
+ export declare function unmarkFocusLivenessCodingStarted(focusId: string, key: string): void;
87
+ /** A report the caller could not file: the next poll reports it again. */
88
+ export declare function unmarkFocusLivenessReported(focusId: string, key: string): void;
89
+ //# sourceMappingURL=focus-liveness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-liveness.d.ts","sourceRoot":"","sources":["../../src/supervision/focus-liveness.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,4FAA4F;AAC5F,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,uGAAuG;AACvG,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,4IAA4I;AAC5I,eAAO,MAAM,0B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AAM,GAAG,IAAI,CAG9E"}
@@ -0,0 +1,94 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/focus/focus-liveness-pass.test.ts,
3
+ // packages/daemon/src/focus/stranded-review-refire-bound.test.ts,
4
+ // packages/daemon/src/integration/failed-verdict-review-exit-respawn-regression.test.ts,
5
+ // packages/daemon/src/integration/failed-verdict-review-loop-regression.test.ts,
6
+ // packages/daemon/src/integration/focus-liveness-poll.test.ts,
7
+ // packages/daemon/src/supervision/focus-liveness.test.ts
8
+ // PINNED-BY-END
9
+ import { evaluateStop } from './stop-registry.js';
10
+ /** Not-started polls on a coding step before the detector starts the coding team itself. */
11
+ export const LIVENESS_START_CODING_POLLS = 4;
12
+ /** Not-started polls on an unchanged key before the stall is reported (10 minutes at the 30s poll). */
13
+ export const LIVENESS_STALL_POLLS = 20;
14
+ /** Not-started polls on an unchanged merge step before the stall is reported (an hour at the 30s poll: the candidate's CI judges first). */
15
+ export const LIVENESS_MERGE_STALL_POLLS = 120;
16
+ /** Starts of the decided actor on an unchanged key before the stall is reported. */
17
+ export const LIVENESS_STALL_STARTS = 3;
18
+ const entries = new Map();
19
+ /** Test-only: forget every count. */
20
+ export function __resetFocusLivenessForTests() {
21
+ entries.clear();
22
+ }
23
+ /** Forget a focus (it is no longer armed, or its state is unreadable this poll). */
24
+ export function forgetFocusLiveness(focusId) {
25
+ entries.delete(focusId);
26
+ }
27
+ /** Whether the detector has reported the focus's current key stalled. */
28
+ export function focusLivenessStalled(focusId) {
29
+ return entries.get(focusId)?.reported === true;
30
+ }
31
+ function watchedStep(next) {
32
+ return next.step === 'coding' || next.step === 'gate_run' || next.step === 'review' || next.step === 'merge' ? next.step : null;
33
+ }
34
+ /** The actor is running: a live team, or a gate run in flight. */
35
+ function isStarted(next) {
36
+ return (next.step === 'coding' || next.step === 'review' || next.step === 'gate_run')
37
+ && (next.reason === 'team_live' || next.reason === 'run_in_flight');
38
+ }
39
+ /** The entry for this key: kept when the key is unchanged, else a fresh one. */
40
+ function entryFor(focusId, key) {
41
+ const prior = entries.get(focusId);
42
+ if (prior?.key === key)
43
+ return prior;
44
+ const fresh = { key, notStartedPolls: 0, starts: 0, wasStarted: false, codingStarted: false, reported: false };
45
+ entries.set(focusId, fresh);
46
+ return fresh;
47
+ }
48
+ /** Count one poll of a focus's decided step and say what the caller does (module header). */
49
+ export function observeFocusLiveness(obs) {
50
+ const step = watchedStep(obs.next);
51
+ if (step === null) {
52
+ forgetFocusLiveness(obs.focusId);
53
+ return { act: 'none' };
54
+ }
55
+ const key = `${step}|${obs.head ?? '?'}|${obs.reviewWindow ?? ''}`;
56
+ const entry = entryFor(obs.focusId, key);
57
+ const started = isStarted(obs.next);
58
+ if (started && !entry.wasStarted)
59
+ entry.starts += 1;
60
+ entry.wasStarted = started;
61
+ if (!started)
62
+ entry.notStartedPolls += 1;
63
+ if (entry.reported)
64
+ return { act: 'none' };
65
+ const stalled = evaluateStop('focus_next_actor_stalled', {
66
+ watched: true,
67
+ notStartedPolls: entry.notStartedPolls,
68
+ starts: entry.starts,
69
+ stallPolls: step === 'merge' ? LIVENESS_MERGE_STALL_POLLS : LIVENESS_STALL_POLLS,
70
+ stallStarts: LIVENESS_STALL_STARTS,
71
+ });
72
+ if (stalled) {
73
+ entry.reported = true;
74
+ return { act: 'report', key, step, notStartedPolls: entry.notStartedPolls, starts: entry.starts };
75
+ }
76
+ if (step === 'coding' && !started && !entry.codingStarted && entry.notStartedPolls >= LIVENESS_START_CODING_POLLS) {
77
+ entry.codingStarted = true;
78
+ return { act: 'start_coding', key, notStartedPolls: entry.notStartedPolls };
79
+ }
80
+ return { act: 'none' };
81
+ }
82
+ /** A coding start the caller could not make: the next poll asks for it again. */
83
+ export function unmarkFocusLivenessCodingStarted(focusId, key) {
84
+ const entry = entries.get(focusId);
85
+ if (entry?.key === key)
86
+ entry.codingStarted = false;
87
+ }
88
+ /** A report the caller could not file: the next poll reports it again. */
89
+ export function unmarkFocusLivenessReported(focusId, key) {
90
+ const entry = entries.get(focusId);
91
+ if (entry?.key === key)
92
+ entry.reported = false;
93
+ }
94
+ //# sourceMappingURL=focus-liveness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-liveness.js","sourceRoot":"","sources":["../../src/supervision/focus-liveness.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,oEAAoE;AACpE,oEAAoE;AACpE,2FAA2F;AAC3F,mFAAmF;AACnF,iEAAiE;AACjE,2DAA2D;AAC3D,gBAAgB;AA8ChB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,uGAAuG;AACvG,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,4IAA4I;AAC5I,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AA8BvC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;AAEjD,qCAAqC;AACrC,MAAM,UAAU,4BAA4B;IAC1C,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,IAAmB;IACtC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC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EAAE,MAAM,EAAE,CAAC;AACzB,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,gCAAgC,CAAC,OAAe,EAAE,GAAW;IAC3E,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,EAAE,GAAG,KAAK,GAAG;QAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;AACtD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,2BAA2B,CAAC,OAAe,EAAE,GAAW;IACtE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,EAAE,GAAG,KAAK,GAAG;QAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;AACjD,CAAC"}
@@ -0,0 +1,175 @@
1
+ /**
2
+ * THE NEXT-STEP DECISION: one total function from a focus's state to the actor
3
+ * that moves it next.
4
+ *
5
+ * The stop registry (supervision/stop-registry.ts) answers what STOPS a team.
6
+ * This answers what MOVES a focus: a coding team, a gate run at HEAD, a review,
7
+ * a merge, a named hold with its releaser, or done -- exactly one, for every
8
+ * state -- so no decider names a releaser another is suppressing.
9
+ * History: docs/daemon/history-team-lifecycle.md (supervision/focus-next-step.ts).
10
+ *
11
+ * PURE. The decision reads a reduced snapshot (FocusNextStepFacts), each input
12
+ * cut to the distinct values that change the answer, and calls nothing. The
13
+ * snapshot is built from the live reads by
14
+ * completion/state-cascade/focus-next-step-read.ts; the decision's exhaustive
15
+ * test (focus-next-step.test.ts) enumerates every combination of the value lists
16
+ * exported below and fails when one maps to no actor, or to a hold whose
17
+ * releaser the decision itself holds in that state.
18
+ *
19
+ * HOLDS NAME A RELEASER THE DECISION CAN REACH. A hold is answered only where
20
+ * no actor can move the focus until something outside the decision's inputs
21
+ * changes. Each hold kind is one row of HOLD_RELEASES: the actor that moves the
22
+ * focus once the hold lifts (one of the decision's own steps), what lifts it,
23
+ * and the state just after it lifts. The exhaustive test re-decides that state
24
+ * and requires the named releaser -- so a hold can never name a step another
25
+ * hold in the same state would suppress.
26
+ *
27
+ * ORDER (first match answers):
28
+ * 1. a live team is the actor (its lineage);
29
+ * 2. uncommitted work in the worktree: a coding team commits it -- the gate
30
+ * and the review judge commits, so nothing else can see it;
31
+ * 3. by the delivery aggregate: nothing executable -> done; active work ->
32
+ * coding; all remaining work paused, or every delivery settled, with a
33
+ * FAILED gate at HEAD -> the failed HEAD's rework (below: the completion merge
34
+ * refuses a red HEAD, and the gate-rework reopen re-opens a done or paused
35
+ * owner); else paused -> hold (paused), settled -> merge while the branch
36
+ * holds unmerged commits, else done;
37
+ * 4. converged on verify (decideConverged): a park, owed open work (a coding
38
+ * team -- or the review, while its window is open, since the review exit
39
+ * routes that work), then the gate at HEAD, then the review.
40
+ *
41
+ * THE FAILED HEAD. A failed gate at HEAD whose rework Bug is OPEN (or not yet
42
+ * filed) is a coding team's. One whose rework Bug is CLOSED, with no new commit
43
+ * (HEAD is still the failed commit), answers a gate run at that HEAD -- once:
44
+ * the re-run is recorded per (focus, HEAD) (supervision/failed-head-rerun.ts),
45
+ * and the same state after it answers the coding team again, with the Bug
46
+ * re-opened (reason gate_rework_unanswered), never a second re-run.
47
+ *
48
+ * @module supervision/focus-next-step
49
+ */
50
+ import type { PipelineConfig } from '../types/index.js';
51
+ /** The delivery aggregate, reduced (supervision/focus-delivery-aggregate-phase.ts). */
52
+ export declare const FOCUS_WORK_STATES: readonly ["nothing_executable", "active", "converged", "settled", "paused"];
53
+ export type FocusWorkState = (typeof FOCUS_WORK_STATES)[number];
54
+ /** Which verify deliveries are parked on a repeating verify shortfall (verify/shortfalls/shortfall-park.ts). */
55
+ export declare const PARKED_STATES: readonly ["none", "some", "all"];
56
+ export type ParkedState = (typeof PARKED_STATES)[number];
57
+ /**
58
+ * The gate's judgment of the focus HEAD, combined with verify's
59
+ * (review-request-gate.ts + review-verify-judgment-gate.ts): unconfigured (no
60
+ * gate governs a verify delivery), pending (no verdict, or verify has not
61
+ * finished judging it), in_flight (a run is selected and not finished), passed,
62
+ * failed.
63
+ */
64
+ export declare const HEAD_GATE_STATES: readonly ["unconfigured", "pending", "in_flight", "passed", "failed"];
65
+ export type HeadGateState = (typeof HEAD_GATE_STATES)[number];
66
+ /** The rework Bug for a failed HEAD (verify/outcome-routing/verification-rework-issue.ts): open, closed, or never filed. */
67
+ export declare const HEAD_REWORK_STATES: readonly ["open", "closed", "unfiled"];
68
+ export type HeadReworkState = (typeof HEAD_REWORK_STATES)[number];
69
+ /** The lineage of the team live for the focus on this host, if any. */
70
+ export declare const LIVE_TEAMS: readonly ["none", "coding", "review"];
71
+ export type LiveTeam = (typeof LIVE_TEAMS)[number];
72
+ /** Everything the decision reads. Each field is one dimension of the exhaustive test. */
73
+ export interface FocusNextStepFacts {
74
+ work: FocusWorkState;
75
+ /** An owed open Task/Bug on an UNPARKED verify delivery (recorded concerns are not owed). */
76
+ openWorkOnVerify: boolean;
77
+ parked: ParkedState;
78
+ reviewEnabled: boolean;
79
+ /** review_requested_at is set. */
80
+ reviewWindowOpen: boolean;
81
+ gateAtHead: HeadGateState;
82
+ /** Read only when gateAtHead is failed. */
83
+ reworkAtHead: HeadReworkState;
84
+ /** The one failed-HEAD re-run was already taken at this HEAD. */
85
+ rerunSpentAtHead: boolean;
86
+ liveTeam: LiveTeam;
87
+ /** The focus worktree holds uncommitted paths. */
88
+ uncommittedWork: boolean;
89
+ /** The focus branch holds commits integration does not. */
90
+ branchAhead: boolean;
91
+ }
92
+ /** The actors a step or a hold's releaser can name. */
93
+ export declare const NEXT_STEP_ACTORS: readonly ["coding", "gate_run", "review", "merge"];
94
+ export type NextStepActor = (typeof NEXT_STEP_ACTORS)[number];
95
+ export type CodingReason = 'team_live' | 'uncommitted_work' | 'owed_work' | 'gate_rework' | 'gate_rework_unfiled' | 'gate_rework_unanswered';
96
+ export type GateRunReason = 'run_in_flight' | 'verdict_owed' | 'failed_head_rework_closed';
97
+ export type ReviewReason = 'team_live' | 'review_team' | 'window_ready' | 'review_disabled_skip';
98
+ export type HoldKind = 'shortfall_park' | 'paused';
99
+ /** The decision's answer: exactly one of these. */
100
+ export type FocusNextStep = {
101
+ step: 'coding';
102
+ reason: CodingReason;
103
+ } | {
104
+ step: 'gate_run';
105
+ reason: GateRunReason;
106
+ } | {
107
+ step: 'review';
108
+ reason: ReviewReason;
109
+ } | {
110
+ step: 'merge';
111
+ reason: 'settled_unmerged';
112
+ } | {
113
+ step: 'hold';
114
+ hold: HoldKind;
115
+ releaser: NextStepActor;
116
+ releasedBy: string;
117
+ } | {
118
+ step: 'done';
119
+ reason: 'settled_merged' | 'nothing_executable';
120
+ };
121
+ /** One hold kind: the actor that moves the focus once it lifts, what lifts it, and the state just after. */
122
+ export interface HoldRelease {
123
+ releaser: NextStepActor;
124
+ releasedBy: string;
125
+ lifted: (facts: FocusNextStepFacts) => FocusNextStepFacts;
126
+ }
127
+ /**
128
+ * Every hold the decision can answer. A park lifts on a ruling on its nodes or a
129
+ * new delivery commit, and either re-selects the parked delivery for verify
130
+ * (shortfall-rulings.ts): the state just after is a run in flight with nothing
131
+ * parked, and the open work a park held is the shortfall's own, routed only once
132
+ * verify re-judges. A pause lifts when an operator resumes the delivery, which
133
+ * makes it active work again.
134
+ */
135
+ export declare const HOLD_RELEASES: Readonly<Record<HoldKind, HoldRelease>>;
136
+ /** Resolve the one next step for a focus (module header). Total and pure. */
137
+ export declare function resolveFocusNextStep(facts: FocusNextStepFacts): FocusNextStep;
138
+ /** The delivery slice the read takes. */
139
+ export interface NextStepDelivery {
140
+ id: string;
141
+ executionStatus?: string | null;
142
+ injectionId?: string | null;
143
+ gateState?: unknown;
144
+ }
145
+ /** The focus row slice the read takes. */
146
+ export interface NextStepFocus {
147
+ focus_id: string;
148
+ review_requested_at: string | null;
149
+ pipeline_config: PipelineConfig | null;
150
+ }
151
+ /** The focus row slice a production read takes: the HEAD reads key on its product and read_only, the merge read on its branch. */
152
+ export interface NextStepFocusRow extends NextStepFocus {
153
+ product_id: string | null;
154
+ read_only: boolean;
155
+ branch_name: string | null;
156
+ }
157
+ /** What the read could not take. */
158
+ export type NextStepUnreadable = 'deliveries' | 'issues' | 'concerns' | 'head_verdict' | 'worktree';
159
+ /** The read's answer: the facts, the step and the HEAD they were read at -- or what could not be read. */
160
+ export type FocusNextStepRead<D extends NextStepDelivery = NextStepDelivery> = {
161
+ readable: true;
162
+ facts: FocusNextStepFacts;
163
+ next: FocusNextStep;
164
+ head: string | null;
165
+ deliveries: readonly D[];
166
+ } | {
167
+ readable: false;
168
+ what: NextStepUnreadable;
169
+ error: Error;
170
+ };
171
+ /** Reads a focus's one next step against the live daemon (composition/focus-next-step-context.ts binds it). */
172
+ export type FocusNextStepReader = (focus: NextStepFocusRow) => Promise<FocusNextStepRead>;
173
+ /** One line naming the step, for the deciders' logs. */
174
+ export declare function describeFocusNextStep(next: FocusNextStep): string;
175
+ //# sourceMappingURL=focus-next-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-next-step.d.ts","sourceRoot":"","sources":["../../src/supervision/focus-next-step.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,6EAA8E,CAAC;AAC7G,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,gHAAgH;AAChH,eAAO,MAAM,aAAa,kCAAmC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,uEAAwE,CAAC;AACtG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,4HAA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nC,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;CACxC;AAED,kIAAkI;AAClI,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,oCAAoC;AACpC,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAEpG,0GAA0G;AAC1G,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IACvE;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAA;CAAE,GACjH;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhE,+GAA+G;AAC/G,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE1F,wDAAwD;AACxD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAGjE"}
@@ -0,0 +1,129 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/completion/state-cascade/focus-next-step-agreement.test.ts,
3
+ // packages/daemon/src/focus/focus-liveness-pass.test.ts,
4
+ // packages/daemon/src/integration/failed-verdict-review-exit-respawn-regression.test.ts,
5
+ // packages/daemon/src/integration/failed-verdict-review-loop-regression.test.ts,
6
+ // packages/daemon/src/integration/held-route-pull-dispatch.test.ts,
7
+ // packages/daemon/src/supervision/focus-liveness.test.ts,
8
+ // packages/daemon/src/supervision/focus-next-step.test.ts,
9
+ // packages/daemon/src/verify/engine/verification-commit-sharing.test.ts,
10
+ // packages/daemon/src/verify/run-selection/explicit-next-step-gate.test.ts,
11
+ // packages/daemon/src/verify/run-selection/verification-default-on.test.ts
12
+ // PINNED-BY-END
13
+ /** The delivery aggregate, reduced (supervision/focus-delivery-aggregate-phase.ts). */
14
+ export const FOCUS_WORK_STATES = ['nothing_executable', 'active', 'converged', 'settled', 'paused'];
15
+ /** Which verify deliveries are parked on a repeating verify shortfall (verify/shortfalls/shortfall-park.ts). */
16
+ export const PARKED_STATES = ['none', 'some', 'all'];
17
+ /**
18
+ * The gate's judgment of the focus HEAD, combined with verify's
19
+ * (review-request-gate.ts + review-verify-judgment-gate.ts): unconfigured (no
20
+ * gate governs a verify delivery), pending (no verdict, or verify has not
21
+ * finished judging it), in_flight (a run is selected and not finished), passed,
22
+ * failed.
23
+ */
24
+ export const HEAD_GATE_STATES = ['unconfigured', 'pending', 'in_flight', 'passed', 'failed'];
25
+ /** The rework Bug for a failed HEAD (verify/outcome-routing/verification-rework-issue.ts): open, closed, or never filed. */
26
+ export const HEAD_REWORK_STATES = ['open', 'closed', 'unfiled'];
27
+ /** The lineage of the team live for the focus on this host, if any. */
28
+ export const LIVE_TEAMS = ['none', 'coding', 'review'];
29
+ /** The actors a step or a hold's releaser can name. */
30
+ export const NEXT_STEP_ACTORS = ['coding', 'gate_run', 'review', 'merge'];
31
+ /**
32
+ * Every hold the decision can answer. A park lifts on a ruling on its nodes or a
33
+ * new delivery commit, and either re-selects the parked delivery for verify
34
+ * (shortfall-rulings.ts): the state just after is a run in flight with nothing
35
+ * parked, and the open work a park held is the shortfall's own, routed only once
36
+ * verify re-judges. A pause lifts when an operator resumes the delivery, which
37
+ * makes it active work again.
38
+ */
39
+ export const HOLD_RELEASES = {
40
+ shortfall_park: {
41
+ releaser: 'gate_run',
42
+ releasedBy: 'a ruling on the parked nodes (the park escalation names it) or a new delivery commit, '
43
+ + 'either of which re-selects the parked delivery for verify',
44
+ lifted: (facts) => ({
45
+ ...facts,
46
+ parked: 'none',
47
+ gateAtHead: 'in_flight',
48
+ openWorkOnVerify: facts.parked === 'all' ? false : facts.openWorkOnVerify,
49
+ }),
50
+ },
51
+ paused: {
52
+ releaser: 'coding',
53
+ releasedBy: 'an operator resuming the paused delivery',
54
+ lifted: (facts) => ({ ...facts, work: 'active' }),
55
+ },
56
+ };
57
+ function hold(kind) {
58
+ const { releaser, releasedBy } = HOLD_RELEASES[kind];
59
+ return { step: 'hold', hold: kind, releaser, releasedBy };
60
+ }
61
+ /** A failed gate at HEAD: its rework is the coding team's, unless the Bug closed with no commit. */
62
+ function decideFailedHead(facts) {
63
+ if (facts.reworkAtHead === 'open')
64
+ return { step: 'coding', reason: 'gate_rework' };
65
+ if (facts.reworkAtHead === 'unfiled')
66
+ return { step: 'coding', reason: 'gate_rework_unfiled' };
67
+ // Closed with no new commit: re-judge the same HEAD once; after that, the Bug re-opens for a coding team.
68
+ return facts.rerunSpentAtHead
69
+ ? { step: 'coding', reason: 'gate_rework_unanswered' }
70
+ : { step: 'gate_run', reason: 'failed_head_rework_closed' };
71
+ }
72
+ /**
73
+ * Owed open work on a verify delivery. A failed HEAD's rework wins. With the review window open, the review is next:
74
+ * its exit routes the open work back to coding (the open-work pass leaves a windowed focus to it). Else a coding team.
75
+ */
76
+ function decideOwedWork(facts) {
77
+ if (facts.gateAtHead === 'failed')
78
+ return decideFailedHead(facts);
79
+ if (facts.reviewWindowOpen)
80
+ return { step: 'review', reason: 'review_team' };
81
+ return { step: 'coding', reason: 'owed_work' };
82
+ }
83
+ /** Converged on verify (nothing active, at least one verify delivery). */
84
+ function decideConverged(facts) {
85
+ if (facts.parked === 'all')
86
+ return hold('shortfall_park');
87
+ if (facts.openWorkOnVerify)
88
+ return decideOwedWork(facts);
89
+ // A parked sibling's failure stands at this head: no review may approve it.
90
+ if (facts.parked === 'some')
91
+ return hold('shortfall_park');
92
+ if (facts.gateAtHead === 'in_flight')
93
+ return { step: 'gate_run', reason: 'run_in_flight' };
94
+ if (facts.gateAtHead === 'pending')
95
+ return { step: 'gate_run', reason: 'verdict_owed' };
96
+ if (facts.gateAtHead === 'failed')
97
+ return decideFailedHead(facts);
98
+ if (!facts.reviewEnabled)
99
+ return { step: 'review', reason: 'review_disabled_skip' };
100
+ return facts.reviewWindowOpen ? { step: 'review', reason: 'review_team' } : { step: 'review', reason: 'window_ready' };
101
+ }
102
+ /** Resolve the one next step for a focus (module header). Total and pure. */
103
+ export function resolveFocusNextStep(facts) {
104
+ if (facts.liveTeam !== 'none')
105
+ return { step: facts.liveTeam, reason: 'team_live' };
106
+ if (facts.uncommittedWork)
107
+ return { step: 'coding', reason: 'uncommitted_work' };
108
+ switch (facts.work) {
109
+ case 'nothing_executable':
110
+ return { step: 'done', reason: 'nothing_executable' };
111
+ case 'paused':
112
+ return facts.gateAtHead === 'failed' ? decideFailedHead(facts) : hold('paused');
113
+ case 'active':
114
+ return { step: 'coding', reason: 'owed_work' };
115
+ case 'settled':
116
+ if (facts.gateAtHead === 'failed')
117
+ return decideFailedHead(facts);
118
+ return facts.branchAhead ? { step: 'merge', reason: 'settled_unmerged' } : { step: 'done', reason: 'settled_merged' };
119
+ case 'converged':
120
+ return decideConverged(facts);
121
+ }
122
+ }
123
+ /** One line naming the step, for the deciders' logs. */
124
+ export function describeFocusNextStep(next) {
125
+ if (next.step === 'hold')
126
+ return `hold (${next.hold}) until ${next.releasedBy}; then ${next.releaser}`;
127
+ return `${next.step} (${next.reason})`;
128
+ }
129
+ //# sourceMappingURL=focus-next-step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-next-step.js","sourceRoot":"","sources":["../../src/supervision/focus-next-step.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,6FAA6F;AAC7F,2DAA2D;AAC3D,2FAA2F;AAC3F,mFAAmF;AACnF,sEAAsE;AACtE,4DAA4D;A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