@telora/daemon 0.22.289 → 0.22.293

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 (348) hide show
  1. package/README.md +2 -2
  2. package/build-info.json +2 -2
  3. package/dist/backends/agent-backend.d.ts +2 -0
  4. package/dist/backends/agent-backend.d.ts.map +1 -1
  5. package/dist/backends/availability.d.ts +14 -0
  6. package/dist/backends/availability.d.ts.map +1 -1
  7. package/dist/backends/availability.js +37 -0
  8. package/dist/backends/availability.js.map +1 -1
  9. package/dist/backends/claude/claude-backend.d.ts.map +1 -1
  10. package/dist/backends/claude/claude-backend.js +2 -0
  11. package/dist/backends/claude/claude-backend.js.map +1 -1
  12. package/dist/backends/codex/codex-backend.d.ts.map +1 -1
  13. package/dist/backends/codex/codex-backend.js +2 -0
  14. package/dist/backends/codex/codex-backend.js.map +1 -1
  15. package/dist/backends/index.d.ts +1 -1
  16. package/dist/backends/index.d.ts.map +1 -1
  17. package/dist/backends/index.js +2 -17
  18. package/dist/backends/index.js.map +1 -1
  19. package/dist/cli/connect/config-write.d.ts.map +1 -1
  20. package/dist/cli/connect/config-write.js +2 -1
  21. package/dist/cli/connect/config-write.js.map +1 -1
  22. package/dist/cli/status-commands.d.ts +7 -0
  23. package/dist/cli/status-commands.d.ts.map +1 -1
  24. package/dist/cli/status-commands.js +17 -0
  25. package/dist/cli/status-commands.js.map +1 -1
  26. package/dist/completion/completion-event/event.d.ts +1 -0
  27. package/dist/completion/completion-event/event.d.ts.map +1 -1
  28. package/dist/completion/completion-event/event.js +1 -0
  29. package/dist/completion/completion-event/event.js.map +1 -1
  30. package/dist/completion/review-exit/review-census-record.d.ts +4 -2
  31. package/dist/completion/review-exit/review-census-record.d.ts.map +1 -1
  32. package/dist/completion/review-exit/review-census-record.js +11 -3
  33. package/dist/completion/review-exit/review-census-record.js.map +1 -1
  34. package/dist/completion/review-exit/review-exit-deps.js +1 -1
  35. package/dist/completion/review-exit/review-exit-phase.d.ts +9 -0
  36. package/dist/completion/review-exit/review-exit-phase.d.ts.map +1 -1
  37. package/dist/completion/review-exit/review-exit-phase.js +1 -1
  38. package/dist/completion/review-exit/review-exit-phase.js.map +1 -1
  39. package/dist/completion/review-exit-holds/commit-verdict-release.d.ts.map +1 -1
  40. package/dist/completion/review-exit-holds/commit-verdict-release.js +2 -1
  41. package/dist/completion/review-exit-holds/commit-verdict-release.js.map +1 -1
  42. package/dist/completion/review-exit-holds/review-exit-verdict-gate.d.ts +1 -0
  43. package/dist/completion/review-exit-holds/review-exit-verdict-gate.d.ts.map +1 -1
  44. package/dist/completion/review-exit-holds/review-exit-verdict-gate.js +1 -0
  45. package/dist/completion/review-exit-holds/review-exit-verdict-gate.js.map +1 -1
  46. package/dist/completion/team-exit/team-completion.d.ts.map +1 -1
  47. package/dist/completion/team-exit/team-completion.js +3 -1
  48. package/dist/completion/team-exit/team-completion.js.map +1 -1
  49. package/dist/completion/team-liveness/liveness-firing.js +3 -3
  50. package/dist/completion/team-liveness/team-liveness-phase.d.ts +6 -1
  51. package/dist/completion/team-liveness/team-liveness-phase.d.ts.map +1 -1
  52. package/dist/completion/team-liveness/team-liveness-phase.js.map +1 -1
  53. package/dist/completion/team-outcome/apply-close.d.ts.map +1 -1
  54. package/dist/completion/team-outcome/apply-close.js +4 -1
  55. package/dist/completion/team-outcome/apply-close.js.map +1 -1
  56. package/dist/completion/team-outcome/apply-turn.d.ts.map +1 -1
  57. package/dist/completion/team-outcome/apply-turn.js +3 -1
  58. package/dist/completion/team-outcome/apply-turn.js.map +1 -1
  59. package/dist/completion/team-outcome/apply.d.ts.map +1 -1
  60. package/dist/completion/team-outcome/apply.js +3 -1
  61. package/dist/completion/team-outcome/apply.js.map +1 -1
  62. package/dist/completion/team-outcome/decide-shared.d.ts.map +1 -1
  63. package/dist/completion/team-outcome/decide-shared.js +3 -2
  64. package/dist/completion/team-outcome/decide-shared.js.map +1 -1
  65. package/dist/completion/team-outcome/exit-pipeline-state.d.ts.map +1 -1
  66. package/dist/completion/team-outcome/exit-pipeline-state.js +2 -1
  67. package/dist/completion/team-outcome/exit-pipeline-state.js.map +1 -1
  68. package/dist/completion/team-outcome/team-outcome.d.ts.map +1 -1
  69. package/dist/completion/team-outcome/team-outcome.js +3 -1
  70. package/dist/completion/team-outcome/team-outcome.js.map +1 -1
  71. package/dist/composition/execution-migrations-context.d.ts.map +1 -1
  72. package/dist/composition/execution-migrations-context.js +2 -0
  73. package/dist/composition/execution-migrations-context.js.map +1 -1
  74. package/dist/composition/execution-process-context.js +1 -1
  75. package/dist/composition/execution-spawn-context.d.ts.map +1 -1
  76. package/dist/composition/execution-spawn-context.js +3 -1
  77. package/dist/composition/execution-spawn-context.js.map +1 -1
  78. package/dist/composition/execution-spawn-process-context.d.ts.map +1 -1
  79. package/dist/composition/execution-spawn-process-context.js +3 -2
  80. package/dist/composition/execution-spawn-process-context.js.map +1 -1
  81. package/dist/composition/focus-activity-live-sources.d.ts +4 -0
  82. package/dist/composition/focus-activity-live-sources.d.ts.map +1 -0
  83. package/dist/composition/focus-activity-live-sources.js +68 -0
  84. package/dist/composition/focus-activity-live-sources.js.map +1 -0
  85. package/dist/composition/runtime-delivery-advance-context.d.ts +6 -1
  86. package/dist/composition/runtime-delivery-advance-context.d.ts.map +1 -1
  87. package/dist/composition/runtime-delivery-advance-context.js +14 -3
  88. package/dist/composition/runtime-delivery-advance-context.js.map +1 -1
  89. package/dist/composition/runtime-heartbeat-context.d.ts.map +1 -1
  90. package/dist/composition/runtime-heartbeat-context.js +3 -1
  91. package/dist/composition/runtime-heartbeat-context.js.map +1 -1
  92. package/dist/composition/team-lifecycle-context.d.ts.map +1 -1
  93. package/dist/composition/team-lifecycle-context.js +3 -1
  94. package/dist/composition/team-lifecycle-context.js.map +1 -1
  95. package/dist/composition/team-liveness-phase-sources.d.ts.map +1 -1
  96. package/dist/composition/team-liveness-phase-sources.js +1 -0
  97. package/dist/composition/team-liveness-phase-sources.js.map +1 -1
  98. package/dist/composition/verification-context.d.ts.map +1 -1
  99. package/dist/composition/verification-context.js +4 -1
  100. package/dist/composition/verification-context.js.map +1 -1
  101. package/dist/composition/verify-probe-context.d.ts +7 -0
  102. package/dist/composition/verify-probe-context.d.ts.map +1 -1
  103. package/dist/composition/verify-probe-context.js +55 -3
  104. package/dist/composition/verify-probe-context.js.map +1 -1
  105. package/dist/config/config.d.ts.map +1 -1
  106. package/dist/config/config.js +4 -3
  107. package/dist/config/config.js.map +1 -1
  108. package/dist/config/session-cap.d.ts +89 -0
  109. package/dist/config/session-cap.d.ts.map +1 -0
  110. package/dist/config/session-cap.js +176 -0
  111. package/dist/config/session-cap.js.map +1 -0
  112. package/dist/daemon-state/awaiting-slot.d.ts +8 -2
  113. package/dist/daemon-state/awaiting-slot.d.ts.map +1 -1
  114. package/dist/daemon-state/awaiting-slot.js +21 -8
  115. package/dist/daemon-state/awaiting-slot.js.map +1 -1
  116. package/dist/daemon-state/engine-readiness.d.ts +73 -0
  117. package/dist/daemon-state/engine-readiness.d.ts.map +1 -0
  118. package/dist/daemon-state/engine-readiness.js +191 -0
  119. package/dist/daemon-state/engine-readiness.js.map +1 -0
  120. package/dist/daemon-state/focus-progress-clock.d.ts +34 -0
  121. package/dist/daemon-state/focus-progress-clock.d.ts.map +1 -0
  122. package/dist/daemon-state/focus-progress-clock.js +167 -0
  123. package/dist/daemon-state/focus-progress-clock.js.map +1 -0
  124. package/dist/daemon-state/focus-team-state.d.ts +32 -9
  125. package/dist/daemon-state/focus-team-state.d.ts.map +1 -1
  126. package/dist/daemon-state/focus-team-state.js +50 -9
  127. package/dist/daemon-state/focus-team-state.js.map +1 -1
  128. package/dist/daemon-state/provider-window.d.ts.map +1 -1
  129. package/dist/daemon-state/provider-window.js +5 -1
  130. package/dist/daemon-state/provider-window.js.map +1 -1
  131. package/dist/daemon-state/review-park-record.d.ts +36 -0
  132. package/dist/daemon-state/review-park-record.d.ts.map +1 -0
  133. package/dist/daemon-state/review-park-record.js +27 -0
  134. package/dist/daemon-state/review-park-record.js.map +1 -0
  135. package/dist/daemon-state/worker-pidfile.d.ts.map +1 -1
  136. package/dist/daemon-state/worker-pidfile.js +3 -1
  137. package/dist/daemon-state/worker-pidfile.js.map +1 -1
  138. package/dist/delivery/commit-verdict-hold.d.ts.map +1 -1
  139. package/dist/delivery/commit-verdict-hold.js +3 -1
  140. package/dist/delivery/commit-verdict-hold.js.map +1 -1
  141. package/dist/directive/directive-queue.js +1 -1
  142. package/dist/focus/focus-activity-held.d.ts +37 -0
  143. package/dist/focus/focus-activity-held.d.ts.map +1 -0
  144. package/dist/focus/focus-activity-held.js +89 -0
  145. package/dist/focus/focus-activity-held.js.map +1 -0
  146. package/dist/focus/focus-activity-poll-facts.d.ts +39 -0
  147. package/dist/focus/focus-activity-poll-facts.d.ts.map +1 -0
  148. package/dist/focus/focus-activity-poll-facts.js +110 -0
  149. package/dist/focus/focus-activity-poll-facts.js.map +1 -0
  150. package/dist/focus/focus-activity-producers.d.ts +43 -0
  151. package/dist/focus/focus-activity-producers.d.ts.map +1 -0
  152. package/dist/focus/focus-activity-producers.js +130 -0
  153. package/dist/focus/focus-activity-producers.js.map +1 -0
  154. package/dist/focus/focus-activity-record.d.ts +58 -0
  155. package/dist/focus/focus-activity-record.d.ts.map +1 -0
  156. package/dist/focus/focus-activity-record.js +141 -0
  157. package/dist/focus/focus-activity-record.js.map +1 -0
  158. package/dist/focus/focus-activity-sources.d.ts +99 -0
  159. package/dist/focus/focus-activity-sources.d.ts.map +1 -0
  160. package/dist/focus/focus-activity-sources.js +45 -0
  161. package/dist/focus/focus-activity-sources.js.map +1 -0
  162. package/dist/focus/focus-executor.js +1 -1
  163. package/dist/focus/focus-executor.js.map +1 -1
  164. package/dist/focus/focus-poller-auto-advance.d.ts.map +1 -1
  165. package/dist/focus/focus-poller-auto-advance.js +2 -0
  166. package/dist/focus/focus-poller-auto-advance.js.map +1 -1
  167. package/dist/focus/heartbeat-metadata.d.ts.map +1 -1
  168. package/dist/focus/heartbeat-metadata.js +6 -0
  169. package/dist/focus/heartbeat-metadata.js.map +1 -1
  170. package/dist/focus/heartbeat.d.ts +3 -0
  171. package/dist/focus/heartbeat.d.ts.map +1 -1
  172. package/dist/focus/heartbeat.js +31 -31
  173. package/dist/focus/heartbeat.js.map +1 -1
  174. package/dist/focus/pending-review-approved-head.d.ts.map +1 -1
  175. package/dist/focus/pending-review-approved-head.js +4 -2
  176. package/dist/focus/pending-review-approved-head.js.map +1 -1
  177. package/dist/focus/unchanged-reviewed-head.d.ts.map +1 -1
  178. package/dist/focus/unchanged-reviewed-head.js +4 -2
  179. package/dist/focus/unchanged-reviewed-head.js.map +1 -1
  180. package/dist/index.js +1 -1
  181. package/dist/queries/deliveries/deliveries.d.ts +4 -0
  182. package/dist/queries/deliveries/deliveries.d.ts.map +1 -1
  183. package/dist/queries/deliveries/deliveries.js +6 -0
  184. package/dist/queries/deliveries/deliveries.js.map +1 -1
  185. package/dist/queries/deliveries/issues.d.ts +3 -0
  186. package/dist/queries/deliveries/issues.d.ts.map +1 -1
  187. package/dist/queries/deliveries/issues.js +10 -2
  188. package/dist/queries/deliveries/issues.js.map +1 -1
  189. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts +27 -1
  190. package/dist/queries/delivery-gate-state/delivery-gate-holds.d.ts.map +1 -1
  191. package/dist/queries/delivery-gate-state/delivery-gate-state.d.ts +3 -1
  192. package/dist/queries/delivery-gate-state/delivery-gate-state.d.ts.map +1 -1
  193. package/dist/queries/delivery-gate-state/delivery-gate-state.js.map +1 -1
  194. package/dist/queries/focuses/focus-discovery.d.ts.map +1 -1
  195. package/dist/queries/focuses/focus-discovery.js +2 -0
  196. package/dist/queries/focuses/focus-discovery.js.map +1 -1
  197. package/dist/queries/focuses/focuses.d.ts.map +1 -1
  198. package/dist/queries/focuses/focuses.js +2 -0
  199. package/dist/queries/focuses/focuses.js.map +1 -1
  200. package/dist/queries/sessions/daemon-connection.d.ts.map +1 -1
  201. package/dist/queries/sessions/daemon-connection.js +1 -0
  202. package/dist/queries/sessions/daemon-connection.js.map +1 -1
  203. package/dist/queries/workflow-transitions/workflows.d.ts.map +1 -1
  204. package/dist/queries/workflow-transitions/workflows.js +1 -0
  205. package/dist/queries/workflow-transitions/workflows.js.map +1 -1
  206. package/dist/shell/config-hot-reload.d.ts +11 -0
  207. package/dist/shell/config-hot-reload.d.ts.map +1 -1
  208. package/dist/shell/config-hot-reload.js +12 -0
  209. package/dist/shell/config-hot-reload.js.map +1 -1
  210. package/dist/shell/unified-engine-lifecycle.d.ts +8 -1
  211. package/dist/shell/unified-engine-lifecycle.d.ts.map +1 -1
  212. package/dist/shell/unified-engine-lifecycle.js +44 -24
  213. package/dist/shell/unified-engine-lifecycle.js.map +1 -1
  214. package/dist/shell/unified-init.d.ts +5 -1
  215. package/dist/shell/unified-init.d.ts.map +1 -1
  216. package/dist/shell/unified-init.js +2 -2
  217. package/dist/shell/unified-init.js.map +1 -1
  218. package/dist/shell/unified-shell-config.d.ts +2 -1
  219. package/dist/shell/unified-shell-config.d.ts.map +1 -1
  220. package/dist/shell/unified-shell-config.js +9 -3
  221. package/dist/shell/unified-shell-config.js.map +1 -1
  222. package/dist/shell/unified-shell-status.d.ts +11 -1
  223. package/dist/shell/unified-shell-status.d.ts.map +1 -1
  224. package/dist/shell/unified-shell-status.js +15 -1
  225. package/dist/shell/unified-shell-status.js.map +1 -1
  226. package/dist/shell/unified-shell.d.ts.map +1 -1
  227. package/dist/shell/unified-shell.js +25 -5
  228. package/dist/shell/unified-shell.js.map +1 -1
  229. package/dist/spawn/codex-auth.d.ts +32 -0
  230. package/dist/spawn/codex-auth.d.ts.map +1 -0
  231. package/dist/spawn/codex-auth.js +55 -0
  232. package/dist/spawn/codex-auth.js.map +1 -0
  233. package/dist/spawn/helpers.d.ts.map +1 -1
  234. package/dist/spawn/helpers.js +19 -3
  235. package/dist/spawn/helpers.js.map +1 -1
  236. package/dist/spawn/model-reached.d.ts +36 -0
  237. package/dist/spawn/model-reached.d.ts.map +1 -0
  238. package/dist/spawn/model-reached.js +43 -0
  239. package/dist/spawn/model-reached.js.map +1 -0
  240. package/dist/spawn/next-spawn-cooldown.d.ts +21 -2
  241. package/dist/spawn/next-spawn-cooldown.d.ts.map +1 -1
  242. package/dist/spawn/next-spawn-cooldown.js +65 -7
  243. package/dist/spawn/next-spawn-cooldown.js.map +1 -1
  244. package/dist/spawn/process-spawn.d.ts.map +1 -1
  245. package/dist/spawn/process-spawn.js +8 -5
  246. package/dist/spawn/process-spawn.js.map +1 -1
  247. package/dist/spawn/review-hold-park.d.ts +12 -1
  248. package/dist/spawn/review-hold-park.d.ts.map +1 -1
  249. package/dist/spawn/review-hold-park.js +25 -9
  250. package/dist/spawn/review-hold-park.js.map +1 -1
  251. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  252. package/dist/spawn/spawn-decision.js +4 -0
  253. package/dist/spawn/spawn-decision.js.map +1 -1
  254. package/dist/spawn/team-working-delivery.d.ts +76 -0
  255. package/dist/spawn/team-working-delivery.d.ts.map +1 -0
  256. package/dist/spawn/team-working-delivery.js +76 -0
  257. package/dist/spawn/team-working-delivery.js.map +1 -0
  258. package/dist/spawn/worktree-session.d.ts +15 -0
  259. package/dist/spawn/worktree-session.d.ts.map +1 -1
  260. package/dist/spawn/worktree-session.js +25 -2
  261. package/dist/spawn/worktree-session.js.map +1 -1
  262. package/dist/supervision/spawn-cooldown-window.d.ts +15 -0
  263. package/dist/supervision/spawn-cooldown-window.d.ts.map +1 -0
  264. package/dist/supervision/spawn-cooldown-window.js +46 -0
  265. package/dist/supervision/spawn-cooldown-window.js.map +1 -0
  266. package/dist/supervision/spawn-cooldown.d.ts +3 -2
  267. package/dist/supervision/spawn-cooldown.d.ts.map +1 -1
  268. package/dist/supervision/spawn-cooldown.js +6 -1
  269. package/dist/supervision/spawn-cooldown.js.map +1 -1
  270. package/dist/supervision/stop-registry.d.ts +1 -0
  271. package/dist/supervision/stop-registry.d.ts.map +1 -1
  272. package/dist/supervision/stop-rows-spawn.d.ts +8 -0
  273. package/dist/supervision/stop-rows-spawn.d.ts.map +1 -1
  274. package/dist/supervision/stop-rows-spawn.js +28 -1
  275. package/dist/supervision/stop-rows-spawn.js.map +1 -1
  276. package/dist/testing/fake-npm-registry.d.ts +31 -0
  277. package/dist/testing/fake-npm-registry.d.ts.map +1 -0
  278. package/dist/testing/fake-npm-registry.js +127 -0
  279. package/dist/testing/fake-npm-registry.js.map +1 -0
  280. package/dist/testing/fixtures/approved-head-inert-deps.d.ts.map +1 -1
  281. package/dist/testing/fixtures/approved-head-inert-deps.js +4 -2
  282. package/dist/testing/fixtures/approved-head-inert-deps.js.map +1 -1
  283. package/dist/testing/fixtures/codex-stream-session.d.ts +4 -0
  284. package/dist/testing/fixtures/codex-stream-session.d.ts.map +1 -1
  285. package/dist/testing/fixtures/codex-stream-session.js +21 -5
  286. package/dist/testing/fixtures/codex-stream-session.js.map +1 -1
  287. package/dist/testing/fixtures/completion-event-deps.js +1 -1
  288. package/dist/testing/fixtures/index.js +1 -1
  289. package/dist/testing/fixtures/process-close-context.d.ts.map +1 -1
  290. package/dist/testing/fixtures/process-close-context.js +2 -0
  291. package/dist/testing/fixtures/process-close-context.js.map +1 -1
  292. package/dist/testing/fixtures/recording-api-client.js +1 -1
  293. package/dist/testing/fixtures/review-exit-deps.js +1 -1
  294. package/dist/testing/fixtures/session-wire.d.ts.map +1 -1
  295. package/dist/testing/fixtures/session-wire.js +2 -1
  296. package/dist/testing/fixtures/session-wire.js.map +1 -1
  297. package/dist/testing/fixtures/verification-deps.d.ts.map +1 -1
  298. package/dist/testing/fixtures/verification-deps.js +4 -0
  299. package/dist/testing/fixtures/verification-deps.js.map +1 -1
  300. package/dist/types/config.d.ts +30 -0
  301. package/dist/types/config.d.ts.map +1 -1
  302. package/dist/types/focus-team-state.d.ts +28 -2
  303. package/dist/types/focus-team-state.d.ts.map +1 -1
  304. package/dist/types/focus-team-state.js.map +1 -1
  305. package/dist/types/index.js +1 -1
  306. package/dist/verify/deterministic-gate/verification-checkout.d.ts +8 -4
  307. package/dist/verify/deterministic-gate/verification-checkout.d.ts.map +1 -1
  308. package/dist/verify/deterministic-gate/verification-checkout.js +50 -13
  309. package/dist/verify/deterministic-gate/verification-checkout.js.map +1 -1
  310. package/dist/verify/deterministic-gate/verification-deterministic.d.ts.map +1 -1
  311. package/dist/verify/deterministic-gate/verification-deterministic.js +3 -1
  312. package/dist/verify/deterministic-gate/verification-deterministic.js.map +1 -1
  313. package/dist/verify/engine/verification-deps.d.ts +7 -0
  314. package/dist/verify/engine/verification-deps.d.ts.map +1 -1
  315. package/dist/verify/engine/verification-deps.js +1 -1
  316. package/dist/verify/engine/verification-engine.d.ts.map +1 -1
  317. package/dist/verify/engine/verification-engine.js +107 -8
  318. package/dist/verify/engine/verification-engine.js.map +1 -1
  319. package/dist/verify/gate-config/verification-config.js +1 -1
  320. package/dist/verify/gate-verdicts/commit-verdict-record.js +1 -1
  321. package/dist/verify/gate-verdicts/gate-run-registry.d.ts +74 -3
  322. package/dist/verify/gate-verdicts/gate-run-registry.d.ts.map +1 -1
  323. package/dist/verify/gate-verdicts/gate-run-registry.js +41 -20
  324. package/dist/verify/gate-verdicts/gate-run-registry.js.map +1 -1
  325. package/dist/verify/install-probe/in-repo-publish.d.ts +154 -0
  326. package/dist/verify/install-probe/in-repo-publish.d.ts.map +1 -0
  327. package/dist/verify/install-probe/in-repo-publish.js +183 -0
  328. package/dist/verify/install-probe/in-repo-publish.js.map +1 -0
  329. package/dist/verify/install-probe/install-probe-tick.d.ts +23 -2
  330. package/dist/verify/install-probe/install-probe-tick.d.ts.map +1 -1
  331. package/dist/verify/install-probe/install-probe-tick.js +84 -12
  332. package/dist/verify/install-probe/install-probe-tick.js.map +1 -1
  333. package/dist/verify/install-probe/install-probe.d.ts +16 -0
  334. package/dist/verify/install-probe/install-probe.d.ts.map +1 -1
  335. package/dist/verify/install-probe/install-probe.js +35 -19
  336. package/dist/verify/install-probe/install-probe.js.map +1 -1
  337. package/dist/verify/install-probe/npm-unresolved.d.ts +37 -0
  338. package/dist/verify/install-probe/npm-unresolved.d.ts.map +1 -0
  339. package/dist/verify/install-probe/npm-unresolved.js +63 -0
  340. package/dist/verify/install-probe/npm-unresolved.js.map +1 -0
  341. package/dist/verify/run-selection/default-on-guards.d.ts.map +1 -1
  342. package/dist/verify/run-selection/default-on-guards.js +1 -19
  343. package/dist/verify/run-selection/default-on-guards.js.map +1 -1
  344. package/dist/worktree/verify-interlock.d.ts +23 -2
  345. package/dist/worktree/verify-interlock.d.ts.map +1 -1
  346. package/dist/worktree/verify-interlock.js +79 -2
  347. package/dist/worktree/verify-interlock.js.map +1 -1
  348. package/package.json +3 -3
@@ -0,0 +1,110 @@
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-activity-producers.test.ts,
3
+ // packages/daemon/src/focus/focus-activity-progress-clock.test.ts,
4
+ // packages/daemon/src/focus/focus-activity-team-clock.test.ts,
5
+ // packages/daemon/src/focus/heartbeat-focus-activity.test.ts,
6
+ // packages/daemon/src/spawn/team-working-delivery.test.ts
7
+ // PINNED-BY-END
8
+ /**
9
+ * The focus and delivery rows the poll loop already reads, kept for the
10
+ * heartbeat's focus activity record (focus/focus-activity-record.ts).
11
+ *
12
+ * The teamless auto-advance pass (focus/focus-poller-auto-advance.ts
13
+ * checkDeliveryAutoAdvance) reads every active focus of every product and every
14
+ * such focus's deliveries on each poll. Its two reads are wrapped at the
15
+ * composition root (composition/runtime-delivery-advance-context.ts) with the
16
+ * observers below, so the record knows which focuses are ARMED and what their
17
+ * deliveries hold at NO extra query: the heartbeat reads the latest poll's rows.
18
+ *
19
+ * Replacement, not accumulation: a product's focus list is replaced wholesale
20
+ * by each successful read of it, and a focus's deliveries by each read of them,
21
+ * so a focus that stops being active drops out on the next poll. A failed read
22
+ * records nothing and leaves the previous rows standing (the observed-at time
23
+ * says how old they are): a delivery read that fails after one succeeded keeps
24
+ * the last good rows, it never blanks them.
25
+ *
26
+ * The same reads (and the pass's per-delivery issue reads, observeDeliveryIssues)
27
+ * feed the per-focus progress clock (daemon-state/focus-progress-clock.ts) as its
28
+ * RECOVERY path: the daemon's own status writes stamp the clock when they land,
29
+ * and a read stamps it only for movement written elsewhere (an agent closing an
30
+ * issue over MCP). They also tell the clock which focus a delivery or issue
31
+ * belongs to, which is how a landed write is attributed.
32
+ *
33
+ * @module focus/focus-activity-poll-facts
34
+ */
35
+ import { forgetFocusProgress, observeDeliveryProgress, observeIssueProgress } from '../daemon-state/focus-progress-clock.js';
36
+ const focusesByProduct = new Map();
37
+ const deliveriesByFocus = new Map();
38
+ /** Record one product's active focus list (replaces that product's previous list). */
39
+ export function recordPolledFocuses(productKey, rows) {
40
+ focusesByProduct.set(productKey, rows.map((r) => ({ focus_id: r.focus_id, assigned_agent_role_id: r.assigned_agent_role_id })));
41
+ }
42
+ /** Record one focus's deliveries (replaces its previous rows). */
43
+ export function recordPolledDeliveries(focusId, rows, now = Date.now()) {
44
+ observeDeliveryProgress(focusId, rows, now);
45
+ deliveriesByFocus.set(focusId, {
46
+ rows: rows.map((d) => ({ id: d.id, executionStatus: d.executionStatus ?? null, gateState: d.gateState ?? null })),
47
+ at: now,
48
+ });
49
+ }
50
+ /** Every active focus the latest poll of each product saw, with its latest deliveries. Prunes rows of focuses no longer listed. */
51
+ export function polledFocusSnapshot() {
52
+ const out = new Map();
53
+ for (const rows of focusesByProduct.values()) {
54
+ for (const row of rows) {
55
+ const d = deliveriesByFocus.get(row.focus_id);
56
+ out.set(row.focus_id, {
57
+ focusId: row.focus_id,
58
+ armed: row.assigned_agent_role_id != null,
59
+ deliveries: d?.rows ?? null,
60
+ deliveriesObservedAt: d?.at ?? null,
61
+ });
62
+ }
63
+ }
64
+ for (const focusId of deliveriesByFocus.keys()) {
65
+ if (out.has(focusId))
66
+ continue;
67
+ deliveriesByFocus.delete(focusId);
68
+ forgetFocusProgress(focusId);
69
+ }
70
+ return [...out.values()];
71
+ }
72
+ /** Wrap an active-focus read so each successful result is recorded under the product it was read for. */
73
+ export function observeActiveFocuses(read) {
74
+ return async (organizationId, productId) => {
75
+ const rows = await read(organizationId, productId);
76
+ recordPolledFocuses(productId ?? '', rows);
77
+ return rows;
78
+ };
79
+ }
80
+ /** Wrap a focus-deliveries read so each successful result is recorded for the focus. */
81
+ export function observeFocusDeliveries(read) {
82
+ return async (focusId) => {
83
+ const rows = await read(focusId);
84
+ recordPolledDeliveries(focusId, rows);
85
+ return rows;
86
+ };
87
+ }
88
+ /** The focus whose latest delivery read listed `deliveryId`, or null. */
89
+ function polledFocusOfDelivery(deliveryId) {
90
+ for (const [focusId, { rows }] of deliveriesByFocus)
91
+ if (rows.some((d) => d.id === deliveryId))
92
+ return focusId;
93
+ return null;
94
+ }
95
+ /** Wrap a delivery-issues read so each successful result feeds the focus's progress clock (an issue moving to Done). */
96
+ export function observeDeliveryIssues(read) {
97
+ return async (deliveryId) => {
98
+ const rows = await read(deliveryId);
99
+ const focusId = polledFocusOfDelivery(deliveryId);
100
+ if (focusId !== null)
101
+ observeIssueProgress(focusId, deliveryId, rows, Date.now());
102
+ return rows;
103
+ };
104
+ }
105
+ /** Test-only: forget every polled row. */
106
+ export function __resetPolledFocusFactsForTests() {
107
+ focusesByProduct.clear();
108
+ deliveriesByFocus.clear();
109
+ }
110
+ //# sourceMappingURL=focus-activity-poll-facts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-poll-facts.js","sourceRoot":"","sources":["../../src/focus/focus-activity-poll-facts.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,yEAAyE;AACzE,qEAAqE;AACrE,iEAAiE;AACjE,gEAAgE;AAChE,4DAA4D;AAC5D,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AA0B7H,MAAM,gBAAgB,G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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC;YAAE,OAAO,OAAO,CAAC;IAC/G,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,qBAAqB,CACnC,IAA0C;IAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE;QAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,OAAO,KAAK,IAAI;YAAE,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,+BAA+B;IAC7C,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzB,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type FocusActivityClaim, type FocusActivitySources } from './focus-activity-sources.js';
2
+ /**
3
+ * team_coding / team_reviewing / team_planning / team_resolving: one claim per
4
+ * live team. A team working a delivery is published coding or reviewing THAT
5
+ * delivery. A team with no delivery to work is never a delivery-less coding or
6
+ * review team: it is planning (its focus has none yet) or resolving (every
7
+ * delivery is done or cancelled -- the escalation-answer re-arm).
8
+ */
9
+ export declare function teamActivityClaims(sources: FocusActivitySources): FocusActivityClaim[];
10
+ /** awaiting_slot: a spawn pass would start a team but every session slot is in use. */
11
+ export declare function awaitingSlotClaims(sources: FocusActivitySources): FocusActivityClaim[];
12
+ /** spawn_pending: a team spawn is queued and starts on the next spawn pass (dated by first sight). */
13
+ export declare function spawnPendingClaims(sources: FocusActivitySources): FocusActivityClaim[];
14
+ /** review_parked: the review-hold park is withholding the focus's queued review spawn. */
15
+ export declare function reviewParkedClaims(sources: FocusActivitySources): FocusActivityClaim[];
16
+ /**
17
+ * cooldown: the focus's next spawn is held by its spawn cooldown -- until the
18
+ * time it ends, or with no end when the respawn cycle is exhausted. `since` is
19
+ * the latest teardown; a hold with no teardown of its own (the provider's
20
+ * rate-limit window alone) is dated by first sight.
21
+ */
22
+ export declare function cooldownClaims(sources: FocusActivitySources): FocusActivityClaim[];
23
+ /** The statuses in which a delivery still owes work (a team would pick it up). */
24
+ export declare const OWING_WORK_STATUSES: ReadonlySet<string>;
25
+ /**
26
+ * idle: an armed focus the daemon is doing nothing else for, with the count of
27
+ * the deliveries it has READ that still owe work. The lowest precedence: every
28
+ * other entry wins over it. Dated by first sight of the idle entry.
29
+ *
30
+ * EVERY armed focus is claimed, so every armed focus of every product has an
31
+ * entry. The count comes from the latest SUCCESSFUL read of its deliveries: a
32
+ * read that fails after one succeeded leaves those rows standing
33
+ * (focus-activity-poll-facts.ts), so the count stays the last one the daemon
34
+ * saw. A focus whose deliveries have not been read yet -- listed by this poll,
35
+ * its delivery read still to come or failing since discovery -- publishes a
36
+ * null count: the inventory is UNKNOWN, so 0 always means a read that found
37
+ * nothing owed, never "not read". Dropping the focus instead would make an
38
+ * armed focus vanish from the record exactly when its reads fail. The unread
39
+ * entry is dated by its own first sight, so the first successful read starts
40
+ * the idle clock afresh rather than inheriting the time spent unread.
41
+ */
42
+ export declare function idleClaims(sources: FocusActivitySources): FocusActivityClaim[];
43
+ //# sourceMappingURL=focus-activity-producers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-producers.d.ts","sourceRoot":"","sources":["../../src/focus/focus-activity-producers.ts"],"names":[],"mappings":"AAqBA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAetF;AAED,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAKtF;AAED,sGAAsG;AACtG,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAMtF;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAKtF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAkBlF;AAED,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAIlD,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAa9E"}
@@ -0,0 +1,130 @@
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-activity-producers.test.ts
3
+ // PINNED-BY-END
4
+ /**
5
+ * The focus activity record's team and between-sessions producers: a live
6
+ * coding or review team, a spawn waiting for a session slot, a queued spawn, a
7
+ * spawn cooldown, a parked review, and idle. (Gate entries:
8
+ * focus/focus-activity-record.ts; held deliveries: focus/focus-activity-held.ts.)
9
+ *
10
+ * Each producer reports FACTS WITH TIMESTAMPS -- when a wait began, when a hold
11
+ * ends, how many deliveries still owe work. None classifies a focus as stalled:
12
+ * that judgement belongs to whoever reads the record. Which entry a focus
13
+ * publishes when several apply is the daemon-core precedence rule, applied by
14
+ * the builder; which focuses may carry a between-sessions entry at all (armed
15
+ * ones) is the builder's admission rule too.
16
+ *
17
+ * @module focus/focus-activity-producers
18
+ */
19
+ import { DELIVERY_STATUS } from '@telora/daemon-core';
20
+ import { armedPolledFocuses, commonFields, iso, } from './focus-activity-sources.js';
21
+ /**
22
+ * team_coding / team_reviewing / team_planning / team_resolving: one claim per
23
+ * live team. A team working a delivery is published coding or reviewing THAT
24
+ * delivery. A team with no delivery to work is never a delivery-less coding or
25
+ * review team: it is planning (its focus has none yet) or resolving (every
26
+ * delivery is done or cancelled -- the escalation-answer re-arm).
27
+ */
28
+ export function teamActivityClaims(sources) {
29
+ return sources.teams.map((team) => {
30
+ const clocks = {
31
+ ...commonFields(sources, team.focusId),
32
+ sessionId: team.sessionId,
33
+ lastAgentEventAt: team.lastAgentEventAt === null ? null : iso(team.lastAgentEventAt),
34
+ };
35
+ let activity;
36
+ if (team.deliveryId !== null) {
37
+ activity = { ...clocks, kind: team.sessionType === 'review' ? 'team_reviewing' : 'team_coding', deliveryId: team.deliveryId };
38
+ }
39
+ else {
40
+ activity = { ...clocks, kind: team.resolving ? 'team_resolving' : 'team_planning' };
41
+ }
42
+ return { focusId: team.focusId, activity };
43
+ });
44
+ }
45
+ /** awaiting_slot: a spawn pass would start a team but every session slot is in use. */
46
+ export function awaitingSlotClaims(sources) {
47
+ return sources.awaitingSlot.map(({ focusId, sinceMs }) => ({
48
+ focusId,
49
+ activity: { ...commonFields(sources, focusId), kind: 'awaiting_slot', since: iso(sinceMs) },
50
+ }));
51
+ }
52
+ /** spawn_pending: a team spawn is queued and starts on the next spawn pass (dated by first sight). */
53
+ export function spawnPendingClaims(sources) {
54
+ return sources.pendingSpawns.map(({ focusId, sessionType }) => ({
55
+ focusId,
56
+ activity: { ...commonFields(sources, focusId), kind: 'spawn_pending', sessionType, since: iso(sources.now) },
57
+ sinceKey: `${focusId}|spawn_pending|${sessionType}`,
58
+ }));
59
+ }
60
+ /** review_parked: the review-hold park is withholding the focus's queued review spawn. */
61
+ export function reviewParkedClaims(sources) {
62
+ return [...sources.reviewParks].map(([focusId, park]) => ({
63
+ focusId,
64
+ activity: { ...commonFields(sources, focusId), kind: 'review_parked', reason: park.reason, since: iso(park.sinceMs) },
65
+ }));
66
+ }
67
+ /**
68
+ * cooldown: the focus's next spawn is held by its spawn cooldown -- until the
69
+ * time it ends, or with no end when the respawn cycle is exhausted. `since` is
70
+ * the latest teardown; a hold with no teardown of its own (the provider's
71
+ * rate-limit window alone) is dated by first sight.
72
+ */
73
+ export function cooldownClaims(sources) {
74
+ const claims = [];
75
+ for (const { focusId } of armedPolledFocuses(sources)) {
76
+ const window = sources.readCooldownWindow(focusId);
77
+ if (!window)
78
+ continue;
79
+ claims.push({
80
+ focusId,
81
+ activity: {
82
+ ...commonFields(sources, focusId),
83
+ kind: 'cooldown',
84
+ until: window.untilMs === null ? null : iso(window.untilMs),
85
+ since: iso(window.sinceMs ?? sources.now),
86
+ exhausted: window.exhausted,
87
+ },
88
+ ...(window.sinceMs === null ? { sinceKey: `${focusId}|cooldown` } : {}),
89
+ });
90
+ }
91
+ return claims;
92
+ }
93
+ /** The statuses in which a delivery still owes work (a team would pick it up). */
94
+ export const OWING_WORK_STATUSES = new Set([
95
+ DELIVERY_STATUS.QUEUED,
96
+ DELIVERY_STATUS.CODING,
97
+ DELIVERY_STATUS.VERIFY_FAILED,
98
+ ]);
99
+ /**
100
+ * idle: an armed focus the daemon is doing nothing else for, with the count of
101
+ * the deliveries it has READ that still owe work. The lowest precedence: every
102
+ * other entry wins over it. Dated by first sight of the idle entry.
103
+ *
104
+ * EVERY armed focus is claimed, so every armed focus of every product has an
105
+ * entry. The count comes from the latest SUCCESSFUL read of its deliveries: a
106
+ * read that fails after one succeeded leaves those rows standing
107
+ * (focus-activity-poll-facts.ts), so the count stays the last one the daemon
108
+ * saw. A focus whose deliveries have not been read yet -- listed by this poll,
109
+ * its delivery read still to come or failing since discovery -- publishes a
110
+ * null count: the inventory is UNKNOWN, so 0 always means a read that found
111
+ * nothing owed, never "not read". Dropping the focus instead would make an
112
+ * armed focus vanish from the record exactly when its reads fail. The unread
113
+ * entry is dated by its own first sight, so the first successful read starts
114
+ * the idle clock afresh rather than inheriting the time spent unread.
115
+ */
116
+ export function idleClaims(sources) {
117
+ const claims = [];
118
+ for (const { focusId, deliveries } of armedPolledFocuses(sources)) {
119
+ const owing = deliveries === null
120
+ ? null
121
+ : deliveries.filter((d) => OWING_WORK_STATUSES.has(d.executionStatus ?? '')).length;
122
+ claims.push({
123
+ focusId,
124
+ activity: { ...commonFields(sources, focusId), kind: 'idle', deliveriesOwingWork: owing, since: iso(sources.now) },
125
+ sinceKey: owing === null ? `${focusId}|idle_unread` : `${focusId}|idle`,
126
+ });
127
+ }
128
+ return claims;
129
+ }
130
+ //# sourceMappingURL=focus-activity-producers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-producers.js","sourceRoot":"","sources":["../../src/focus/focus-activity-producers.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wEAAwE;AACxE,gBAAgB;AAEhB;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAsB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,GAAG,GAGJ,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAC9D,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG;YACb,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;YACtC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACrF,CAAC;QACF,IAAI,QAAuB,CAAC;QAC5B,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC7B,QAAQ,GAAG,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QA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AC,aAAa;CAC9B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAAC,OAA6B;IACtD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,KAAK,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClE,MAAM,KAAK,GAAG,UAAU,KAAK,IAAI;YAC/B,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QACtF,MAAM,CAAC,IAAI,CAAC;YACV,OAAO;YACP,QAAQ,EAAE,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAClH,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO;SACxE,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The focus activity record the heartbeat publishes as `metadata.focusActivity`
3
+ * ({ [focusId]: FocusActivity }) -- the ONE statement of what this daemon is
4
+ * doing for each focus it manages. The kinds, their fields and the precedence
5
+ * rule are declared in `@telora/daemon-core` (focus-activity.ts); this module
6
+ * only BUILDS the map from in-process facts.
7
+ *
8
+ * Pull model, like the narrations map: recomputed from live in-memory state every beat,
9
+ * so a change surfaces within one interval and a finished gate or torn-down team
10
+ * drops out on its own. Nothing here is written to the database.
11
+ *
12
+ * Shape: {@link buildFocusActivityMap} runs every producer in
13
+ * {@link FOCUS_ACTIVITY_PRODUCERS} over the sources and keeps, per focus, the
14
+ * entry the daemon-core precedence rule picks (gate entries win over team and
15
+ * idle entries). A new kind is added as a new producer -- the builder and the
16
+ * heartbeat wiring do not change.
17
+ *
18
+ * Who gets an entry: a focus the daemon is DOING something for -- a live team
19
+ * or a gate run -- whether or not it is armed; and every ARMED focus of every
20
+ * product (as the latest poll read them, focus/focus-activity-poll-facts.ts),
21
+ * which always has at least `idle`. The between-sessions kinds (held, parked,
22
+ * cooldown, awaiting a slot, a pending spawn, idle) are admitted only for armed
23
+ * focuses, so an idle un-armed focus gets no entry.
24
+ *
25
+ * The record states facts with timestamps; it never classifies a focus as
26
+ * stalled. Every entry carries the spawn-teardown streak and the last-progress
27
+ * time, so churn is visible to whoever reads it.
28
+ *
29
+ * @module focus/focus-activity-record
30
+ */
31
+ import { type FocusActivityMap } from '@telora/daemon-core';
32
+ import { type FocusActivityClaim, type FocusActivityProducer, type FocusActivitySources } from './focus-activity-sources.js';
33
+ /**
34
+ * gate_running / gate_queued, one claim per selected run with a focus. A run whose
35
+ * command has started is running, with the commit and timeout its registration
36
+ * fixed at that start (verify/gate-verdicts/gate-run-registry.ts) -- a start always
37
+ * names its commit. Every other run is queued on what its registration says: its
38
+ * focus worktree's verify interlock, naming the focus and delivery the hold
39
+ * judges; the daemon-wide verification serialisation, naming the run that holds
40
+ * the slot (running, or in its preflight) as the one ahead of it (null when none
41
+ * does yet); or its own preflight -- it holds its slot and is preparing the run,
42
+ * with nothing ahead.
43
+ */
44
+ export declare function gateActivityClaims(sources: FocusActivitySources): FocusActivityClaim[];
45
+ /** Every producer the record is built from. Order does not decide the winner; precedence does. */
46
+ export declare const FOCUS_ACTIVITY_PRODUCERS: readonly FocusActivityProducer[];
47
+ /** Build the per-focus map: the precedence winner among every admitted claim. Pure but for sources.firstSeen. */
48
+ export declare function buildFocusActivityMap(sources: FocusActivitySources, producers: readonly FocusActivityProducer[]): FocusActivityMap;
49
+ /** The record from every declared producer (FOCUS_ACTIVITY_PRODUCERS). */
50
+ export declare function buildFocusActivityRecord(sources: FocusActivitySources): FocusActivityMap;
51
+ /**
52
+ * Set `metadata.focusActivity` from the beat's sources; the key is absent when
53
+ * no focus has an entry. The live sources are bound at the composition root
54
+ * (composition/focus-activity-live-sources.ts) and reach here through the
55
+ * heartbeat's deps.
56
+ */
57
+ export declare function applyFocusActivity(metadata: Record<string, unknown>, sources: FocusActivitySources): void;
58
+ //# sourceMappingURL=focus-activity-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-record.d.ts","sourceRoot":"","sources":["../../src/focus/focus-activity-record.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAmBrC;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,CAgBtF;AAED,kGAAkG;AAClG,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EASpE,CAAC;AAuBF,iHAAiH;AACjH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,gBAAgB,CAWlB;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,CAExF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAGzG"}
@@ -0,0 +1,141 @@
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-activity-producers.test.ts,
3
+ // packages/daemon/src/focus/focus-activity-progress-clock.test.ts,
4
+ // packages/daemon/src/focus/focus-activity-record.test.ts,
5
+ // packages/daemon/src/focus/focus-activity-team-clock.test.ts,
6
+ // packages/daemon/src/spawn/team-working-delivery.test.ts,
7
+ // packages/daemon/src/verify/gate-verdicts/gate-run-activity.test.ts
8
+ // PINNED-BY-END
9
+ /**
10
+ * The focus activity record the heartbeat publishes as `metadata.focusActivity`
11
+ * ({ [focusId]: FocusActivity }) -- the ONE statement of what this daemon is
12
+ * doing for each focus it manages. The kinds, their fields and the precedence
13
+ * rule are declared in `@telora/daemon-core` (focus-activity.ts); this module
14
+ * only BUILDS the map from in-process facts.
15
+ *
16
+ * Pull model, like the narrations map: recomputed from live in-memory state every beat,
17
+ * so a change surfaces within one interval and a finished gate or torn-down team
18
+ * drops out on its own. Nothing here is written to the database.
19
+ *
20
+ * Shape: {@link buildFocusActivityMap} runs every producer in
21
+ * {@link FOCUS_ACTIVITY_PRODUCERS} over the sources and keeps, per focus, the
22
+ * entry the daemon-core precedence rule picks (gate entries win over team and
23
+ * idle entries). A new kind is added as a new producer -- the builder and the
24
+ * heartbeat wiring do not change.
25
+ *
26
+ * Who gets an entry: a focus the daemon is DOING something for -- a live team
27
+ * or a gate run -- whether or not it is armed; and every ARMED focus of every
28
+ * product (as the latest poll read them, focus/focus-activity-poll-facts.ts),
29
+ * which always has at least `idle`. The between-sessions kinds (held, parked,
30
+ * cooldown, awaiting a slot, a pending spawn, idle) are admitted only for armed
31
+ * focuses, so an idle un-armed focus gets no entry.
32
+ *
33
+ * The record states facts with timestamps; it never classifies a focus as
34
+ * stalled. Every entry carries the spawn-teardown streak and the last-progress
35
+ * time, so churn is visible to whoever reads it.
36
+ *
37
+ * @module focus/focus-activity-record
38
+ */
39
+ import { pickFocusActivity, } from '@telora/daemon-core';
40
+ import { commonFields, iso, } from './focus-activity-sources.js';
41
+ import { awaitingSlotClaims, cooldownClaims, idleClaims, reviewParkedClaims, spawnPendingClaims, teamActivityClaims, } from './focus-activity-producers.js';
42
+ import { deliveryHeldClaims } from './focus-activity-held.js';
43
+ /** The run ahead of a queued one, by what it waits on (see gateActivityClaims). */
44
+ function aheadOf(run, slotHolder) {
45
+ if (run.wait.on === 'worktree_interlock')
46
+ return { focusId: run.wait.aheadFocusId, deliveryId: run.wait.aheadDeliveryId };
47
+ if (run.wait.on === 'preflight')
48
+ return { focusId: null, deliveryId: null };
49
+ return { focusId: slotHolder?.focusId ?? null, deliveryId: slotHolder?.deliveryId ?? null };
50
+ }
51
+ /**
52
+ * gate_running / gate_queued, one claim per selected run with a focus. A run whose
53
+ * command has started is running, with the commit and timeout its registration
54
+ * fixed at that start (verify/gate-verdicts/gate-run-registry.ts) -- a start always
55
+ * names its commit. Every other run is queued on what its registration says: its
56
+ * focus worktree's verify interlock, naming the focus and delivery the hold
57
+ * judges; the daemon-wide verification serialisation, naming the run that holds
58
+ * the slot (running, or in its preflight) as the one ahead of it (null when none
59
+ * does yet); or its own preflight -- it holds its slot and is preparing the run,
60
+ * with nothing ahead.
61
+ */
62
+ export function gateActivityClaims(sources) {
63
+ const slotHolder = sources.gateRuns.find((r) => r.startedAt !== null || r.wait.on === 'preflight') ?? null;
64
+ const claims = [];
65
+ for (const run of sources.gateRuns) {
66
+ if (run.focusId === null)
67
+ continue;
68
+ const common = commonFields(sources, run.focusId);
69
+ const ahead = aheadOf(run, slotHolder);
70
+ const activity = run.startedAt !== null && run.sha !== null
71
+ ? { ...common, kind: 'gate_running', deliveryId: run.deliveryId, sha: run.sha, startedAt: iso(run.startedAt), timeoutMs: run.timeoutMs }
72
+ : {
73
+ ...common, kind: 'gate_queued', deliveryId: run.deliveryId, queuedAt: iso(run.selectedAt),
74
+ waitingOn: run.wait.on, aheadFocusId: ahead.focusId, aheadDeliveryId: ahead.deliveryId,
75
+ };
76
+ claims.push({ focusId: run.focusId, activity });
77
+ }
78
+ return claims;
79
+ }
80
+ /** Every producer the record is built from. Order does not decide the winner; precedence does. */
81
+ export const FOCUS_ACTIVITY_PRODUCERS = [
82
+ gateActivityClaims,
83
+ teamActivityClaims,
84
+ deliveryHeldClaims,
85
+ reviewParkedClaims,
86
+ cooldownClaims,
87
+ awaitingSlotClaims,
88
+ spawnPendingClaims,
89
+ idleClaims,
90
+ ];
91
+ /** The kinds any focus may carry (the daemon is doing something for it); every other kind needs an armed focus. */
92
+ const DOING_KINDS = new Set([
93
+ 'gate_running', 'gate_queued', 'team_reviewing', 'team_coding', 'team_planning', 'team_resolving',
94
+ ]);
95
+ /** Date each winner that carries no start of its own by the first beat it was seen, and forget the rest. */
96
+ function stampObservedSince(winners, sources) {
97
+ const map = {};
98
+ const observed = new Set();
99
+ for (const [focusId, { activity, sinceKey }] of winners) {
100
+ if (sinceKey !== undefined && 'since' in activity) {
101
+ observed.add(sinceKey);
102
+ map[focusId] = { ...activity, since: iso(sources.firstSeen.observe(sinceKey, sources.now)) };
103
+ }
104
+ else {
105
+ map[focusId] = activity;
106
+ }
107
+ }
108
+ sources.firstSeen.retainOnly(observed);
109
+ return map;
110
+ }
111
+ /** Build the per-focus map: the precedence winner among every admitted claim. Pure but for sources.firstSeen. */
112
+ export function buildFocusActivityMap(sources, producers) {
113
+ const armed = new Set(sources.polledFocuses.filter((f) => f.armed).map((f) => f.focusId));
114
+ const winners = new Map();
115
+ for (const produce of producers) {
116
+ for (const claim of produce(sources)) {
117
+ if (!DOING_KINDS.has(claim.activity.kind) && !armed.has(claim.focusId))
118
+ continue;
119
+ const current = winners.get(claim.focusId);
120
+ if (pickFocusActivity(current?.activity, claim.activity) === claim.activity)
121
+ winners.set(claim.focusId, claim);
122
+ }
123
+ }
124
+ return stampObservedSince(winners, sources);
125
+ }
126
+ /** The record from every declared producer (FOCUS_ACTIVITY_PRODUCERS). */
127
+ export function buildFocusActivityRecord(sources) {
128
+ return buildFocusActivityMap(sources, FOCUS_ACTIVITY_PRODUCERS);
129
+ }
130
+ /**
131
+ * Set `metadata.focusActivity` from the beat's sources; the key is absent when
132
+ * no focus has an entry. The live sources are bound at the composition root
133
+ * (composition/focus-activity-live-sources.ts) and reach here through the
134
+ * heartbeat's deps.
135
+ */
136
+ export function applyFocusActivity(metadata, sources) {
137
+ const focusActivity = buildFocusActivityRecord(sources);
138
+ if (Object.keys(focusActivity).length > 0)
139
+ metadata.focusActivity = focusActivity;
140
+ }
141
+ //# sourceMappingURL=focus-activity-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-record.js","sourceRoot":"","sources":["../../src/focus/focus-activity-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,yEAAyE;AACzE,qEAAqE;AACrE,6DAA6D;AAC7D,iEAAiE;AACjE,6DAA6D;AAC7D,uEAAuE;AACvE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EACL,iBAAiB,GAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,GAAG,GAIJ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,mFAAmF;AACnF,SAAS,OAAO,CAAC,GAAgB,EAAE,UAA8B;IAC/D,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,oBAAoB;QAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1H,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,WAAW;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC5E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,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Aa,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;AACpF,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The in-process facts the focus activity record (focus/focus-activity-record.ts)
3
+ * is built from, the claim a producer makes, and the fields every entry
4
+ * carries. Split out so the producers (focus/focus-activity-producers.ts,
5
+ * focus/focus-activity-held.ts) and the builder share one declaration without
6
+ * an import cycle.
7
+ *
8
+ * Every source is a snapshot taken at the beat: the builder and producers are
9
+ * pure over it. The one piece of carried state is the {@link FirstSeenTracker}:
10
+ * a fact with no recorded start time (an idle focus, a pending spawn, an
11
+ * operator hold marker) is dated by the first beat the daemon saw it standing.
12
+ *
13
+ * @module focus/focus-activity-sources
14
+ */
15
+ import type { FocusActivity, FocusActivityCommon } from '@telora/daemon-core';
16
+ import type { GateRunView } from '../verify/gate-verdicts/gate-run-registry.js';
17
+ import type { ReviewPark } from '../daemon-state/review-park-record.js';
18
+ import type { SpawnCooldownWindow } from '../supervision/spawn-cooldown-window.js';
19
+ import type { PolledFocus } from './focus-activity-poll-facts.js';
20
+ /** A live team as the record reads it. */
21
+ export interface TeamView {
22
+ focusId: string;
23
+ sessionType: 'coding' | 'review';
24
+ sessionId: string | null;
25
+ /** Epoch ms of the team's last agent event (focus-team-state's in-memory activity clock), or null. */
26
+ lastAgentEventAt: number | null;
27
+ /** The delivery the team is working, observed from its own issue calls (team-working-delivery.ts), or null. */
28
+ deliveryId: string | null;
29
+ /** Spawned with no delivery to work on a focus whose deliveries are all terminal (team-working-delivery.ts). */
30
+ resolving: boolean;
31
+ }
32
+ /** A queued team spawn as the record reads it. */
33
+ export interface PendingSpawnView {
34
+ focusId: string;
35
+ sessionType: 'coding' | 'review';
36
+ }
37
+ /**
38
+ * Dates a standing fact by the first beat it was seen. `observe` returns the
39
+ * first time the key was observed in the current unbroken run of beats;
40
+ * `retainOnly` forgets every key not observed this beat, so a fact that stops
41
+ * and starts again is dated from its restart.
42
+ */
43
+ export declare class FirstSeenTracker {
44
+ private readonly seen;
45
+ observe(key: string, now: number): number;
46
+ retainOnly(keys: ReadonlySet<string>): void;
47
+ }
48
+ /** The in-process facts the record is built from, as of one beat. */
49
+ export interface FocusActivitySources {
50
+ /** The daemon clock at this beat (epoch ms). */
51
+ now: number;
52
+ /** Every selected, unfinished gate run (verify/gate-verdicts/gate-run-registry.ts). */
53
+ gateRuns: readonly GateRunView[];
54
+ /**
55
+ * When the focus's work last moved forward -- a delivery advancing or an issue
56
+ * moving to Done (daemon-state/focus-progress-clock.ts) -- in epoch ms, or null.
57
+ * Kept per focus, not per team, so it survives teardowns and the gaps between sessions.
58
+ */
59
+ readLastProgressAt: (focusId: string) => number | null;
60
+ /** The focus's spawn-teardown streak (supervision/spawn-cooldown.ts getRespawnCycleStreak), or null. */
61
+ readTeardownStreak: (focusId: string) => {
62
+ firstTime: number;
63
+ count: number;
64
+ } | null;
65
+ /** Every live team (daemon-state/focus-team-state.ts). */
66
+ teams: readonly TeamView[];
67
+ /** Focuses a spawn pass left waiting for a session slot, with when the wait began (daemon-state/awaiting-slot.ts). */
68
+ awaitingSlot: readonly {
69
+ focusId: string;
70
+ sinceMs: number;
71
+ }[];
72
+ /** Queued team spawns (directive/directive-queue.ts). */
73
+ pendingSpawns: readonly PendingSpawnView[];
74
+ /** Standing review parks (daemon-state/review-park-record.ts). */
75
+ reviewParks: ReadonlyMap<string, ReviewPark>;
76
+ /** The cooldown window holding the focus's next spawn now, or null (spawn/next-spawn-cooldown.ts). */
77
+ readCooldownWindow: (focusId: string) => SpawnCooldownWindow | null;
78
+ /** The active focuses and their deliveries as the latest poll read them (focus/focus-activity-poll-facts.ts). */
79
+ polledFocuses: readonly PolledFocus[];
80
+ /** Dates facts that carry no start time of their own. */
81
+ firstSeen: FirstSeenTracker;
82
+ }
83
+ /** One producer's claim about one focus. */
84
+ export interface FocusActivityClaim {
85
+ focusId: string;
86
+ activity: FocusActivity;
87
+ /**
88
+ * Present when the fact has no recorded start: the builder replaces the
89
+ * entry's `since` with the first beat this key was seen (FirstSeenTracker).
90
+ */
91
+ sinceKey?: string;
92
+ }
93
+ export type FocusActivityProducer = (sources: FocusActivitySources) => FocusActivityClaim[];
94
+ export declare const iso: (ms: number) => string;
95
+ /** The fields every entry carries: the beat's clock, the teardown streak, the last progress. */
96
+ export declare function commonFields(sources: FocusActivitySources, focusId: string): FocusActivityCommon;
97
+ /** The armed focuses the latest poll saw. */
98
+ export declare function armedPolledFocuses(sources: FocusActivitySources): PolledFocus[];
99
+ //# sourceMappingURL=focus-activity-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-activity-sources.d.ts","sourceRoot":"","sources":["../../src/focus/focus-activity-sources.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,0CAA0C;AAC1C,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sGAAsG;IACtG,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,+GAA+G;IAC/G,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gHAAgH;IAChH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,QAAQ,GAAG,QAAQ,C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