@telora/daemon 0.22.144 → 0.22.160

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 (252) hide show
  1. package/build-info.json +8 -3
  2. package/dist/audit/audit-phase.d.ts +34 -1
  3. package/dist/audit/audit-phase.d.ts.map +1 -1
  4. package/dist/audit/audit-phase.js +77 -9
  5. package/dist/audit/audit-phase.js.map +1 -1
  6. package/dist/backends/codex/codex-mcp-proxy.d.ts +4 -6
  7. package/dist/backends/codex/codex-mcp-proxy.d.ts.map +1 -1
  8. package/dist/backends/codex/codex-mcp-proxy.js.map +1 -1
  9. package/dist/backends/codex/mcp-preflight.d.ts +2 -2
  10. package/dist/backends/codex/mcp-preflight.d.ts.map +1 -1
  11. package/dist/backends/codex/mcp-preflight.js.map +1 -1
  12. package/dist/completion/completion-phase-registry.d.ts +1 -0
  13. package/dist/completion/completion-phase-registry.d.ts.map +1 -1
  14. package/dist/completion/completion-phase-registry.js +7 -5
  15. package/dist/completion/completion-phase-registry.js.map +1 -1
  16. package/dist/completion/escalation-provenance.d.ts.map +1 -1
  17. package/dist/completion/escalation-provenance.js +5 -2
  18. package/dist/completion/escalation-provenance.js.map +1 -1
  19. package/dist/completion/exit-classification.d.ts +1 -1
  20. package/dist/completion/exit-classification.d.ts.map +1 -1
  21. package/dist/completion/exit-classification.js +7 -1
  22. package/dist/completion/exit-classification.js.map +1 -1
  23. package/dist/completion/review-cycle-cap.d.ts +81 -35
  24. package/dist/completion/review-cycle-cap.d.ts.map +1 -1
  25. package/dist/completion/review-cycle-cap.js +60 -132
  26. package/dist/completion/review-cycle-cap.js.map +1 -1
  27. package/dist/completion/review-exit-deps.d.ts +3 -1
  28. package/dist/completion/review-exit-deps.d.ts.map +1 -1
  29. package/dist/completion/review-exit-deps.js +3 -1
  30. package/dist/completion/review-exit-deps.js.map +1 -1
  31. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  32. package/dist/completion/review-exit-phase.js +5 -4
  33. package/dist/completion/review-exit-phase.js.map +1 -1
  34. package/dist/completion/state-cascade.d.ts.map +1 -1
  35. package/dist/completion/state-cascade.js +3 -7
  36. package/dist/completion/state-cascade.js.map +1 -1
  37. package/dist/delivery/delivery-review-coverage.d.ts +16 -0
  38. package/dist/delivery/delivery-review-coverage.d.ts.map +1 -1
  39. package/dist/delivery/delivery-review-coverage.js +16 -0
  40. package/dist/delivery/delivery-review-coverage.js.map +1 -1
  41. package/dist/focus/focus-engine.d.ts +16 -0
  42. package/dist/focus/focus-engine.d.ts.map +1 -1
  43. package/dist/focus/focus-engine.js +37 -17
  44. package/dist/focus/focus-engine.js.map +1 -1
  45. package/dist/focus/focus-executor.d.ts.map +1 -1
  46. package/dist/focus/focus-executor.js +7 -0
  47. package/dist/focus/focus-executor.js.map +1 -1
  48. package/dist/focus/focus-spawn-decision.d.ts +5 -3
  49. package/dist/focus/focus-spawn-decision.d.ts.map +1 -1
  50. package/dist/focus/focus-spawn-decision.js.map +1 -1
  51. package/dist/focus/listener-spawn.d.ts.map +1 -1
  52. package/dist/focus/listener-spawn.js +4 -3
  53. package/dist/focus/listener-spawn.js.map +1 -1
  54. package/dist/focus/listener.d.ts +15 -0
  55. package/dist/focus/listener.d.ts.map +1 -1
  56. package/dist/focus/listener.js +58 -9
  57. package/dist/focus/listener.js.map +1 -1
  58. package/dist/focus/review-cycle-cap-hold.d.ts +15 -94
  59. package/dist/focus/review-cycle-cap-hold.d.ts.map +1 -1
  60. package/dist/focus/review-cycle-cap-hold.js +54 -112
  61. package/dist/focus/review-cycle-cap-hold.js.map +1 -1
  62. package/dist/focus/session-health.d.ts +22 -1
  63. package/dist/focus/session-health.d.ts.map +1 -1
  64. package/dist/focus/session-health.js +28 -3
  65. package/dist/focus/session-health.js.map +1 -1
  66. package/dist/focus/session-process-reap.d.ts +3 -1
  67. package/dist/focus/session-process-reap.d.ts.map +1 -1
  68. package/dist/focus/session-process-reap.js +20 -0
  69. package/dist/focus/session-process-reap.js.map +1 -1
  70. package/dist/focus-stage-lifecycle/index.d.ts.map +1 -1
  71. package/dist/focus-stage-lifecycle/index.js +1 -0
  72. package/dist/focus-stage-lifecycle/index.js.map +1 -1
  73. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +10 -0
  74. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  75. package/dist/focus-stage-lifecycle/wedge-watchdog.js +27 -3
  76. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  77. package/dist/git/focus-integration-sync.d.ts +42 -3
  78. package/dist/git/focus-integration-sync.d.ts.map +1 -1
  79. package/dist/git/focus-integration-sync.js +38 -2
  80. package/dist/git/focus-integration-sync.js.map +1 -1
  81. package/dist/merge/abandoned-merge-recovery.d.ts.map +1 -1
  82. package/dist/merge/abandoned-merge-recovery.js +10 -0
  83. package/dist/merge/abandoned-merge-recovery.js.map +1 -1
  84. package/dist/merge/merge-back-loop.d.ts +1 -0
  85. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  86. package/dist/merge/merge-back-loop.js +3 -3
  87. package/dist/merge/merge-back-loop.js.map +1 -1
  88. package/dist/prompt/team-prompt-base.d.ts +2 -1
  89. package/dist/prompt/team-prompt-base.d.ts.map +1 -1
  90. package/dist/prompt/team-prompt-base.js +5 -19
  91. package/dist/prompt/team-prompt-base.js.map +1 -1
  92. package/dist/prompt-sections/integration-reconcile-section.d.ts +45 -0
  93. package/dist/prompt-sections/integration-reconcile-section.d.ts.map +1 -0
  94. package/dist/prompt-sections/integration-reconcile-section.js +69 -0
  95. package/dist/prompt-sections/integration-reconcile-section.js.map +1 -0
  96. package/dist/prompt-sections/persona-sections.d.ts +0 -20
  97. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  98. package/dist/prompt-sections/persona-sections.js +4 -49
  99. package/dist/prompt-sections/persona-sections.js.map +1 -1
  100. package/dist/prompt-sections/testing-standard.d.ts +51 -0
  101. package/dist/prompt-sections/testing-standard.d.ts.map +1 -0
  102. package/dist/prompt-sections/testing-standard.js +132 -0
  103. package/dist/prompt-sections/testing-standard.js.map +1 -0
  104. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
  105. package/dist/queries/agent-resolvable-promotion.js +7 -5
  106. package/dist/queries/agent-resolvable-promotion.js.map +1 -1
  107. package/dist/queries/ended-arm.d.ts +47 -0
  108. package/dist/queries/ended-arm.d.ts.map +1 -0
  109. package/dist/queries/ended-arm.js +35 -0
  110. package/dist/queries/ended-arm.js.map +1 -0
  111. package/dist/queries/escalation-consumption.d.ts.map +1 -1
  112. package/dist/queries/escalation-consumption.js +0 -1
  113. package/dist/queries/escalation-consumption.js.map +1 -1
  114. package/dist/queries/focus-discovery.d.ts +14 -0
  115. package/dist/queries/focus-discovery.d.ts.map +1 -1
  116. package/dist/queries/focus-discovery.js +1 -0
  117. package/dist/queries/focus-discovery.js.map +1 -1
  118. package/dist/queries/focus-integration-conflict.d.ts +78 -0
  119. package/dist/queries/focus-integration-conflict.d.ts.map +1 -0
  120. package/dist/queries/focus-integration-conflict.js +136 -0
  121. package/dist/queries/focus-integration-conflict.js.map +1 -0
  122. package/dist/queries/focuses.d.ts +6 -3
  123. package/dist/queries/focuses.d.ts.map +1 -1
  124. package/dist/queries/focuses.js +13 -5
  125. package/dist/queries/focuses.js.map +1 -1
  126. package/dist/queries/incident-correlation.d.ts +1 -2
  127. package/dist/queries/incident-correlation.d.ts.map +1 -1
  128. package/dist/queries/incident-correlation.js +1 -3
  129. package/dist/queries/incident-correlation.js.map +1 -1
  130. package/dist/queries/local-models.js +1 -1
  131. package/dist/queries/local-models.js.map +1 -1
  132. package/dist/queries/schemas-local-model.d.ts +47 -0
  133. package/dist/queries/schemas-local-model.d.ts.map +1 -0
  134. package/dist/queries/schemas-local-model.js +57 -0
  135. package/dist/queries/schemas-local-model.js.map +1 -0
  136. package/dist/queries/schemas.d.ts +10 -32
  137. package/dist/queries/schemas.d.ts.map +1 -1
  138. package/dist/queries/schemas.js +10 -41
  139. package/dist/queries/schemas.js.map +1 -1
  140. package/dist/queries/sessions.d.ts +120 -12
  141. package/dist/queries/sessions.d.ts.map +1 -1
  142. package/dist/queries/sessions.js +104 -11
  143. package/dist/queries/sessions.js.map +1 -1
  144. package/dist/queries/shared.d.ts +1 -0
  145. package/dist/queries/shared.d.ts.map +1 -1
  146. package/dist/queries/shared.js +1 -1
  147. package/dist/queries/shared.js.map +1 -1
  148. package/dist/queries/system-session.d.ts.map +1 -1
  149. package/dist/queries/system-session.js +3 -1
  150. package/dist/queries/system-session.js.map +1 -1
  151. package/dist/resolvers/assembly-engine.d.ts +71 -1
  152. package/dist/resolvers/assembly-engine.d.ts.map +1 -1
  153. package/dist/resolvers/assembly-engine.js +82 -43
  154. package/dist/resolvers/assembly-engine.js.map +1 -1
  155. package/dist/resolvers/branch-work-arming.d.ts +133 -0
  156. package/dist/resolvers/branch-work-arming.d.ts.map +1 -0
  157. package/dist/resolvers/branch-work-arming.js +67 -0
  158. package/dist/resolvers/branch-work-arming.js.map +1 -0
  159. package/dist/resolvers/focus-review-coverage.d.ts.map +1 -1
  160. package/dist/resolvers/focus-review-coverage.js +31 -2
  161. package/dist/resolvers/focus-review-coverage.js.map +1 -1
  162. package/dist/resolvers/wiki-topic.d.ts +6 -5
  163. package/dist/resolvers/wiki-topic.d.ts.map +1 -1
  164. package/dist/resolvers/wiki-topic.js +43 -27
  165. package/dist/resolvers/wiki-topic.js.map +1 -1
  166. package/dist/session/session-lineage.d.ts.map +1 -1
  167. package/dist/session/session-lineage.js +1 -0
  168. package/dist/session/session-lineage.js.map +1 -1
  169. package/dist/shell/crash-recovery.d.ts +4 -2
  170. package/dist/shell/crash-recovery.d.ts.map +1 -1
  171. package/dist/shell/crash-recovery.js +15 -14
  172. package/dist/shell/crash-recovery.js.map +1 -1
  173. package/dist/shell/daemon-instance.d.ts +176 -0
  174. package/dist/shell/daemon-instance.d.ts.map +1 -0
  175. package/dist/shell/daemon-instance.js +281 -0
  176. package/dist/shell/daemon-instance.js.map +1 -0
  177. package/dist/shell/graceful-shutdown.d.ts +12 -1
  178. package/dist/shell/graceful-shutdown.d.ts.map +1 -1
  179. package/dist/shell/graceful-shutdown.js +7 -4
  180. package/dist/shell/graceful-shutdown.js.map +1 -1
  181. package/dist/shell/shutdown-ownership.d.ts +34 -0
  182. package/dist/shell/shutdown-ownership.d.ts.map +1 -0
  183. package/dist/shell/shutdown-ownership.js +51 -0
  184. package/dist/shell/shutdown-ownership.js.map +1 -0
  185. package/dist/shell/unified-shell.d.ts.map +1 -1
  186. package/dist/shell/unified-shell.js +12 -5
  187. package/dist/shell/unified-shell.js.map +1 -1
  188. package/dist/shell/worker-pidfile.d.ts +127 -11
  189. package/dist/shell/worker-pidfile.d.ts.map +1 -1
  190. package/dist/shell/worker-pidfile.js +349 -58
  191. package/dist/shell/worker-pidfile.js.map +1 -1
  192. package/dist/spawn/lead-launch.d.ts +17 -1
  193. package/dist/spawn/lead-launch.d.ts.map +1 -1
  194. package/dist/spawn/lead-launch.js +56 -7
  195. package/dist/spawn/lead-launch.js.map +1 -1
  196. package/dist/spawn/lead-process-ownership.d.ts +5 -4
  197. package/dist/spawn/lead-process-ownership.d.ts.map +1 -1
  198. package/dist/spawn/lead-process-ownership.js +7 -4
  199. package/dist/spawn/lead-process-ownership.js.map +1 -1
  200. package/dist/spawn/lifecycle.d.ts +0 -12
  201. package/dist/spawn/lifecycle.d.ts.map +1 -1
  202. package/dist/spawn/lifecycle.js +76 -19
  203. package/dist/spawn/lifecycle.js.map +1 -1
  204. package/dist/spawn/liveness.d.ts.map +1 -1
  205. package/dist/spawn/liveness.js +3 -1
  206. package/dist/spawn/liveness.js.map +1 -1
  207. package/dist/spawn/one-shot-process-ownership.d.ts +46 -2
  208. package/dist/spawn/one-shot-process-ownership.d.ts.map +1 -1
  209. package/dist/spawn/one-shot-process-ownership.js +78 -3
  210. package/dist/spawn/one-shot-process-ownership.js.map +1 -1
  211. package/dist/spawn/process-group-kill.d.ts.map +1 -1
  212. package/dist/spawn/process-group-kill.js +3 -1
  213. package/dist/spawn/process-group-kill.js.map +1 -1
  214. package/dist/spawn/process-spawn.d.ts +5 -15
  215. package/dist/spawn/process-spawn.d.ts.map +1 -1
  216. package/dist/spawn/process-spawn.js +2 -1
  217. package/dist/spawn/process-spawn.js.map +1 -1
  218. package/dist/spawn/prompt-assembly.d.ts +27 -2
  219. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  220. package/dist/spawn/prompt-assembly.js +65 -43
  221. package/dist/spawn/prompt-assembly.js.map +1 -1
  222. package/dist/spawn/worktree-session.d.ts +46 -2
  223. package/dist/spawn/worktree-session.d.ts.map +1 -1
  224. package/dist/spawn/worktree-session.js +57 -4
  225. package/dist/spawn/worktree-session.js.map +1 -1
  226. package/dist/testing/fixtures/conflicting-repo.d.ts +30 -0
  227. package/dist/testing/fixtures/conflicting-repo.d.ts.map +1 -0
  228. package/dist/testing/fixtures/conflicting-repo.js +89 -0
  229. package/dist/testing/fixtures/conflicting-repo.js.map +1 -0
  230. package/dist/testing/fixtures/index.d.ts.map +1 -1
  231. package/dist/testing/fixtures/index.js +2 -1
  232. package/dist/testing/fixtures/index.js.map +1 -1
  233. package/dist/testing/fixtures/pending-spawn-world.js +2 -2
  234. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  235. package/dist/types/exit-category.d.ts +59 -0
  236. package/dist/types/exit-category.d.ts.map +1 -0
  237. package/dist/types/exit-category.js +133 -0
  238. package/dist/types/exit-category.js.map +1 -0
  239. package/dist/types/index.js +1 -1
  240. package/dist/types/session.d.ts +5 -1
  241. package/dist/types/session.d.ts.map +1 -1
  242. package/dist/types/session.js +1 -1
  243. package/dist/types/session.js.map +1 -1
  244. package/dist/verify/stall-detector-config.d.ts +5 -1
  245. package/dist/verify/stall-detector-config.d.ts.map +1 -1
  246. package/dist/verify/stall-detector-config.js +5 -1
  247. package/dist/verify/stall-detector-config.js.map +1 -1
  248. package/dist/worktree/state.d.ts +75 -1
  249. package/dist/worktree/state.d.ts.map +1 -1
  250. package/dist/worktree/state.js +89 -17
  251. package/dist/worktree/state.js.map +1 -1
  252. package/package.json +3 -3
@@ -0,0 +1,133 @@
1
+ /**
2
+ * GENERATED FILE -- DO NOT EDIT.
3
+ *
4
+ * Deno edge-function copy of src/lib/vocabulary/exit-category.ts, produced by
5
+ * `npm run gen:shared-mirrors`. The canonical source is the ONLY hand-edited
6
+ * copy of this algorithm; edit it there and regenerate. The drift gate
7
+ * (`npm run lint:shared-mirrors`) fails CI when this file differs from what
8
+ * generation would produce, so the same algorithm runs in both runtimes.
9
+ *
10
+ * @module types/exit-category
11
+ */
12
+ /**
13
+ * Every exit category the system writes to `agent_sessions.exit_category`.
14
+ *
15
+ * The column is unconstrained TEXT, so this list is the ONLY thing that says
16
+ * what the vocabulary is. It used to be said three times -- a daemon union, a
17
+ * hand-retyped frontend union, and a third copy inside the dashboard's
18
+ * exhaustiveness test -- with no list derived from another. The consequences
19
+ * were exactly what three hand-copied lists produce: four categories the daemon
20
+ * wrote were absent from its own union (they compiled because the write field
21
+ * was `string`), one category in the union reached neither the frontend nor the
22
+ * disposition table, and the gate whose stated job was to catch that drift was
23
+ * checking the third copy rather than the union.
24
+ *
25
+ * Runtime members, not just a type, because both consumers need to ENUMERATE
26
+ * the vocabulary: the daemon to validate what it writes, the dashboard to prove
27
+ * every member has a declared toast disposition -- and for
28
+ * `npm run lint:exit-category-writers` to prove every member has a WRITER.
29
+ *
30
+ * Removed for having no writer: `local_model_key_unset`, and `timeout` (the
31
+ * daemon carries a `sessionTimeoutMs` config knob, but nothing closes a session
32
+ * with that category; if wall-clock enforcement is built, add the category back
33
+ * WITH its writer).
34
+ */
35
+ export const EXIT_CATEGORIES = [
36
+ // --- Genuine failures (status: failed) ---
37
+ /** Non-zero exit / crash while not shutting down. */
38
+ 'error',
39
+ /** Session was active when the daemon restarted; crash recovery closed it. */
40
+ 'recovery_cleanup',
41
+ /** The backend CLI is missing on the daemon host. */
42
+ 'backend_unavailable',
43
+ /** The sandbox the backend needs is unavailable on the daemon host. */
44
+ 'sandbox_unavailable',
45
+ /** A host-control local-model swap failed, so the spawn was abandoned. */
46
+ 'local_model_swap_failed',
47
+ /**
48
+ * A local-model pass ran without its Telora control surface: required tools
49
+ * were never delivered to the model. Failed durably rather than re-spawned
50
+ * into the same tool-less loop.
51
+ */
52
+ 'mcp_tools_undelivered',
53
+ /**
54
+ * The read-only MCP preflight refused the spawn: the required Telora control
55
+ * tools were not callable on the configured host. Distinct from
56
+ * backend_unavailable (the CLI itself is present).
57
+ */
58
+ 'mcp_preflight_failed',
59
+ // --- Daemon housekeeping closes (status: failed, but not the team's fault) ---
60
+ /**
61
+ * The daemon was shutting down and this team did not exit within the timeout,
62
+ * so the daemon force-closed its session. The status stays `failed` because
63
+ * the team genuinely did not exit cleanly, but the CONDITION is a controlled
64
+ * daemon stop and is announced as one -- never as an operator-facing error.
65
+ */
66
+ 'shutdown_timeout',
67
+ /**
68
+ * The session-health sweep closed a row whose process no live team owned (the
69
+ * per-kind diagnosis -- orphaned team, untracked process, silent-abandoned,
70
+ * system straggler -- stays in exit_reason). Housekeeping, not a condition an
71
+ * operator acts on.
72
+ */
73
+ 'health_reap',
74
+ /** Resource governor refused the slot; the spawn never ran. */
75
+ 'governor_denied',
76
+ /** Daemon-internal bookkeeping close. */
77
+ 'internal',
78
+ /**
79
+ * A host-control model load is running off the poll loop, or the host is held
80
+ * by another focus. Benign and transient: a later tick spawns.
81
+ */
82
+ 'local_model_swap_deferred',
83
+ // --- Controlled lifecycle stops (status: stopped) ---
84
+ /** The operator stopped the team via control state. */
85
+ 'user_stopped',
86
+ /** The focus's agent role was unassigned; the team shut down. */
87
+ 'deactivated',
88
+ /** The daemon stopped the team in order to respawn a fresh one. */
89
+ 'handoff',
90
+ /** The focus was deactivated and its worktree torn down. */
91
+ 'teardown',
92
+ /**
93
+ * The team had nothing actionable while a hold kept a delivery non-terminal;
94
+ * a respawn is coming.
95
+ */
96
+ 'no_actionable_work',
97
+ // --- Completion (status: completed) ---
98
+ /** The daemon stopped the team because all of its work was done. */
99
+ 'work_complete',
100
+ /**
101
+ * A team segment exited cleanly but its PASS continues -- the daemon respawns
102
+ * the same lineage. Deliberately NOT pass-ending: a readiness claim here would
103
+ * be false. This is what used to be written as a NULL category, which is how a
104
+ * close with no category stayed expressible at all.
105
+ */
106
+ 'segment_complete',
107
+ ];
108
+ const EXIT_CATEGORY_SET = new Set(EXIT_CATEGORIES);
109
+ /**
110
+ * True when a string is a declared exit category. The guard a reader uses to
111
+ * narrow the unconstrained TEXT column into the vocabulary; a row written by an
112
+ * older daemon can legitimately carry something outside it, so callers decide
113
+ * what to do with a non-member rather than being handed one typed as if valid.
114
+ */
115
+ export function isExitCategory(value) {
116
+ return typeof value === 'string' && EXIT_CATEGORY_SET.has(value);
117
+ }
118
+ /**
119
+ * Session statuses that CLOSE a session. A write that moves a session into one
120
+ * of these is a close, and a close is the write that must carry a category:
121
+ * without one the dashboard has nothing to decide from and falls back to
122
+ * matching English prose in `exit_reason`.
123
+ *
124
+ * `cancelled` is a frontend-initiated manual cancel, not a daemon close, and is
125
+ * excluded for that reason.
126
+ */
127
+ export const TERMINAL_SESSION_STATUSES = ['completed', 'failed', 'stopped', 'escalated'];
128
+ const TERMINAL_STATUS_SET = new Set(TERMINAL_SESSION_STATUSES);
129
+ /** True when a status closes the session (and therefore requires a category). */
130
+ export function isTerminalSessionStatus(value) {
131
+ return TERMINAL_STATUS_SET.has(value);
132
+ }
133
+ //# sourceMappingURL=exit-category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-category.js","sourceRoot":"","sources":["../../src/types/exit-category.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4CAA4C;IAC5C,qDAAqD;IACrD,OAAO;IACP,8EAA8E;IAC9E,kBAAkB;IAClB,qDAAqD;IACrD,qBAAqB;IACrB,uEAAuE;IACvE,qBAAqB;IACrB,0EAA0E;IAC1E,yBAAyB;IACzB;;;;OAIG;IACH,uBAAuB;IACvB;;;;OAIG;IACH,sBAAsB;IAEtB,gFAAgF;IAChF;;;;;OAKG;IACH,kBAAkB;IAClB;;;;;OAKG;IACH,aAAa;IACb,+DAA+D;IAC/D,iBAAiB;IACjB,yCAAyC;IACzC,UAAU;IACV;;;OAGG;IACH,2BAA2B;IAE3B,uDAAuD;IACvD,uDAAuD;IACvD,cAAc;IACd,iEAAiE;IACjE,aAAa;IACb,mEAAmE;IACnE,SAAS;IACT,4DAA4D;IAC5D,UAAU;IACV;;;OAGG;IACH,oBAAoB;IAEpB,yCAAyC;IACzC,oEAAoE;IACpE,eAAe;IACf;;;;;OAKG;IACH,kBAAkB;CACV,CAAC;AAKX,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AAKlG,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAEpF,iFAAiF;AACjF,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,OAAO,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACxC,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: 199 tests -- run: npm run gen:pinned-by -- --list packages/daemon/src/types/index.ts
2
+ // Pinned by: 202 tests -- run: npm run gen:pinned-by -- --list packages/daemon/src/types/index.ts
3
3
  // PINNED-BY-END
4
4
  /**
5
5
  * Domain-specific type re-exports.
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import type { WriteStream } from 'node:fs';
5
5
  export type AgentSessionStatus = 'starting' | 'running' | 'completed' | 'failed' | 'cancelled' | 'stopped' | 'escalated';
6
- export type ExitCategory = 'error' | 'recovery_cleanup' | 'timeout' | 'user_stopped' | 'governor_denied' | 'internal' | 'work_complete' | 'no_actionable_work' | 'deactivated' | 'handoff' | 'teardown';
6
+ import type { ExitCategory } from './exit-category.js';
7
+ export type { ExitCategory, TerminalSessionStatus } from './exit-category.js';
8
+ export { EXIT_CATEGORIES, isExitCategory, TERMINAL_SESSION_STATUSES, isTerminalSessionStatus, } from './exit-category.js';
7
9
  /**
8
10
  * Agent role from database
9
11
  */
@@ -48,6 +50,8 @@ export interface AgentSession {
48
50
  pass_id: string | null;
49
51
  claude_session_id: string | null;
50
52
  activity_summary: SessionActivitySummary | null;
53
+ daemon_hostname?: string | null;
54
+ daemon_instance_id?: string | null;
51
55
  }
52
56
  /**
53
57
  * The persisted ActivityTracker snapshot. Only `updatedAt` is consumed by the
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,SAAS,GACT,WAAW,GACX,QAAQ,GAER,WAAW,GAKX,SAAS,GACT,WAAW,CAAC;AAKhB,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,kBAAkB,GAClB,SAAS,GACT,cAAc,GACd,iBAAiB,GACjB,UAAU,GACV,eAAe,GACf,oBAAoB,GACpB,aAAa,GACb,SAAS,GACT,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;I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,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;IACzB,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,WAAW,CAAC;IAC7B,YAAY,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1,5 +1,5 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
2
  // Pinned by: none -- no test imports this module directly (baselined; see lint:pinned-by)
3
3
  // PINNED-BY-END
4
- export {};
4
+ export { EXIT_CATEGORIES, isExitCategory, TERMINAL_SESSION_STATUSES, isTerminalSessionStatus, } from './exit-category.js';
5
5
  //# sourceMappingURL=session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,gBAAgB"}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,gBAAgB;AAiChB,OAAO,EACL,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC"}
@@ -2,7 +2,11 @@
2
2
  export declare function resolveVerifyFailedCap(): number;
3
3
  /** Resolve the review-window staleness threshold in hours (env override or default). */
4
4
  export declare function resolveReviewWindowStaleHours(): number;
5
- /** Resolve the focus-level review-cycle cap (env override or default). */
5
+ /**
6
+ * Resolve the focus-level review-cycle BUDGET (env override or default): the
7
+ * consecutive unconverged review cycles a focus may spend before the daemon
8
+ * ends its armed run (completion/review-cycle-cap.ts).
9
+ */
6
10
  export declare function resolveReviewCycleCap(): number;
7
11
  /** Resolve the idle-team stall threshold in hours (env override or default). */
8
12
  export declare function resolveIdleTeamStallHours(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"stall-detector-config.d.ts","sourceRoot":"","sources":["../../src/verify/stall-detector-config.ts"],"names":[],"mappings":"AAmCA,uEAAuE;AACvE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AASD,wEAAwE;AACxE,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,kFAAkF;AAClF,wBAAgB,kCAAkC,IAAI,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,IAAI,MAAM,CAE9D;AAED,yFAAyF;AACzF,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,IAAI,MAAM,CAE1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
1
+ {"version":3,"file":"stall-detector-config.d.ts","sourceRoot":"","sources":["../../src/verify/stall-detector-config.ts"],"names":[],"mappings":"AAmCA,uEAAuE;AACvE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AASD,wEAAwE;AACxE,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,kFAAkF;AAClF,wBAAgB,kCAAkC,IAAI,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,IAAI,MAAM,CAE9D;AAED,yFAAyF;AACzF,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,IAAI,MAAM,CAE1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
@@ -38,7 +38,11 @@ export function resolveVerifyFailedCap() {
38
38
  export function resolveReviewWindowStaleHours() {
39
39
  return loadEnvConfig().TELORA_REVIEW_WINDOW_STALE_HOURS;
40
40
  }
41
- /** Resolve the focus-level review-cycle cap (env override or default). */
41
+ /**
42
+ * Resolve the focus-level review-cycle BUDGET (env override or default): the
43
+ * consecutive unconverged review cycles a focus may spend before the daemon
44
+ * ends its armed run (completion/review-cycle-cap.ts).
45
+ */
42
46
  export function resolveReviewCycleCap() {
43
47
  return loadEnvConfig().TELORA_REVIEW_CYCLE_CAP;
44
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stall-detector-config.js","sourceRoot":"","sources":["../../src/verify/stall-detector-config.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,oFAAoF;AACpF,gBAAgB;AAEhB;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAA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AE,EAAE,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iCAAiC;IAC/C,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC"}
@@ -1,10 +1,69 @@
1
+ import { type SessionProcessLiveness } from '../shell/daemon-instance.js';
1
2
  export interface WorktreeWriteReason {
2
3
  code: string;
3
4
  message: string;
4
5
  }
6
+ /**
7
+ * What the focus's own session process was found to be, for a consumer that
8
+ * needs the INPUT rather than the answer.
9
+ *
10
+ * `not_read` means the question never arose (an in-memory team settled it, or
11
+ * there is no worktree); `no_session` means no active agent_sessions row claims
12
+ * this focus. The rest are the liveness verdict verbatim.
13
+ */
14
+ export type WorktreeWriterLiveness = SessionProcessLiveness | 'no_session' | 'not_read';
5
15
  export interface WorktreeWriteSignal {
16
+ /**
17
+ * Whether it is unsafe to write to this worktree right now.
18
+ *
19
+ * Deliberately WIDER than "a process is writing": it is true for a writer that
20
+ * was observed AND for content a write would destroy. A team that committed and
21
+ * died leaves a dirty tree with no writer in it, and the honest answer to "is
22
+ * anything writing" there is no -- but answering `false` would license a merge
23
+ * that clobbers that work, so the residue holds the gate. What it does NOT do is
24
+ * claim a writer: those two branches carry `provable: false`, and a reader that
25
+ * wants the literal writer state reads {@link processLiveness} instead.
26
+ */
6
27
  active: boolean;
7
28
  reason: WorktreeWriteReason | null;
29
+ /**
30
+ * Whether this answer rests on OBSERVATION.
31
+ *
32
+ * `active` is a boolean because its consumers want one, but not every path to
33
+ * it is equally known. Three answers are OBSERVED: a live in-memory team, a
34
+ * verified live process, a missing worktree -- and, at the other end, a
35
+ * decidable session process over a tree with no residue at all, which is
36
+ * observed ABSENCE of a writer.
37
+ *
38
+ * An `active: true` drawn from repository RESIDUE is not, EVER. A dirty tree
39
+ * and a commit that landed seconds ago are things a writer LEFT; a team that
40
+ * committed and then died leaves exactly that HEAD and exactly that tree. So
41
+ * proving the session's process STOPPED does not upgrade its residue -- it
42
+ * makes the residue's writer more doubtful, not less. `provable` is false on
43
+ * every residue branch regardless of what the liveness read decided, and the
44
+ * remaining unknown is carried only into the quiescent answer, where a live
45
+ * child that has not written yet leaves the same clean tree.
46
+ *
47
+ * Rather than coerce that into a confident boolean, the signal says so. A
48
+ * consumer that acts DESTRUCTIVELY on `active: false` -- the merge-back gate --
49
+ * must require `provable` as well; a consumer that only reports may use
50
+ * `active` alone. A consumer asking the DIFFERENT question "could this focus's
51
+ * process be decided at all" wants {@link processLiveness}, not this: the
52
+ * abandoned-merge restore acts on a worktree that is necessarily dirty, so a
53
+ * flag that reads false for every dirty tree would spare every mid-merge
54
+ * worktree forever and the recovery would never run.
55
+ */
56
+ provable: boolean;
57
+ /**
58
+ * The liveness verdict this answer was derived from, passed through unreduced.
59
+ *
60
+ * The reason it is here rather than re-read: crash recovery and this reader
61
+ * consume the same record with OPPOSITE safe directions -- recovery only ever
62
+ * withholds a write, while a reader treats an active row as positive proof.
63
+ * Neither can borrow the other's bias, so the record is read once and each
64
+ * consumer applies its own rule to the verdict itself.
65
+ */
66
+ processLiveness: WorktreeWriterLiveness;
8
67
  }
9
68
  export interface WorktreeStateDeps {
10
69
  hasActiveTeam: (focusId: string) => boolean;
@@ -17,6 +76,15 @@ export interface WorktreeStateDeps {
17
76
  id: string;
18
77
  status: string;
19
78
  } | null>;
79
+ /**
80
+ * What that session's own team PROCESS is doing, from the host's durable lead
81
+ * record (shell/daemon-instance.ts). A row's status alone cannot answer "is
82
+ * this worktree being written": a stale `running` row outlives its team, and
83
+ * this reader treats an active row as positive proof of a writer -- the
84
+ * opposite safe direction from crash recovery, which only ever withholds a
85
+ * write. Both now read ONE record and apply their own direction to it.
86
+ */
87
+ classifySessionProcess: (sessionId: string) => SessionProcessLiveness;
20
88
  worktreeHasUncommittedChanges: (worktreePath: string) => boolean;
21
89
  getLastCommitTimestampMs: (worktreePath: string) => number | null;
22
90
  now?: () => number;
@@ -33,10 +101,16 @@ export interface WorktreeStateDeps {
33
101
  * Order of checks (returns on first hit):
34
102
  * 1. in-memory active team (non-terminal phase) -> active_team
35
103
  * 2. no persistent worktree -> { active: false, no_worktree }
36
- * 3. DB session row in active/starting status -> active_session
104
+ * 3. DB session row in an active status AND its team process provably alive
105
+ * -> active_session (anything less falls through to the worktree's own evidence)
37
106
  * 4. recent commit within threshold -> recent_commit
38
107
  * 5. dirty worktree -> dirty_worktree
39
108
  * 6. otherwise -> { active: false, null }
109
+ *
110
+ * Steps 4 and 5 answer from RESIDUE, so neither is ever `provable`: what they
111
+ * observe is that something wrote, which is not the question asked. Step 6 --
112
+ * observed absence, no residue at all -- is provable exactly when step 3 could
113
+ * decide the session's process.
40
114
  */
41
115
  export declare function isWorktreeBeingWritten(focusId: string, opts?: {
42
116
  recentCommitThresholdMs?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/worktree/state.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACvD,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IA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B,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACvD,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAChG,wBAAwB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC9F;;;;;;;OAOG;IACH,sBAAsB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACtE,6BAA6B,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;IACjE,wBAAwB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAClE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAwFD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,uBAAuB,CAAC,EAAE,MAAM,CAAA;CAAO,EAC/C,IAAI,GAAE,OAAO,CAAC,iBAAiB,CAAM,GACpC,OAAO,CAAC,mBAAmB,CAAC,CAmF9B"}
@@ -19,7 +19,8 @@ import { hasActiveTeam, getActiveTeams } from '../focus/focus-team-state.js';
19
19
  import { getFocusWorktree } from '../focus/focus-worktree-state.js';
20
20
  import { worktreeHasUncommittedChanges } from './safety.js';
21
21
  import { runGitSync } from '../git/index.js';
22
- import { getActiveSessionForFocus } from '../queries/sessions.js';
22
+ import { getActiveSessionForFocus, isActiveSessionStatus } from '../queries/sessions.js';
23
+ import { classifySessionProcess, defaultSessionProcessProbes } from '../shell/daemon-instance.js';
23
24
  const DEFAULT_RECENT_COMMIT_THRESHOLD_MS = 30_000;
24
25
  /**
25
26
  * Read the unix-epoch milliseconds timestamp of the worktree's HEAD commit.
@@ -52,10 +53,58 @@ const defaultDeps = {
52
53
  return { worktreePath: info.worktreePath, branchName: info.branchName };
53
54
  },
54
55
  getActiveSessionForFocus,
56
+ classifySessionProcess: (sessionId) => classifySessionProcess(sessionId, defaultSessionProcessProbes()),
55
57
  worktreeHasUncommittedChanges,
56
58
  getLastCommitTimestampMs: defaultGetLastCommitTimestampMs,
57
59
  now: () => Date.now(),
58
60
  };
61
+ /**
62
+ * What the focus's active session says about a writer.
63
+ *
64
+ * Returns a signal when the session settles it (a verified live process), or the
65
+ * VERDICT the fall-through must carry when it does not -- unreduced, because the
66
+ * residue checks below and the consumers past them ask different questions of it.
67
+ */
68
+ async function sessionWriterSignal(focusId, d) {
69
+ // Test the SAME active-status set the query boundary filters on. The former
70
+ // local list here named only 'active' and 'starting', so a session in
71
+ // 'running' -- the status a team actually spends its life in, and one the
72
+ // server does return -- answered "not being written" for a worktree that was
73
+ // being written.
74
+ const session = await d.getActiveSessionForFocus(focusId);
75
+ if (!session || !isActiveSessionStatus(session.status))
76
+ return { liveness: 'no_session' };
77
+ // An active row is a CLAIM, not a writer. Ask the durable lead record whether
78
+ // this session's own process is actually running, so a stale row -- one whose
79
+ // team stopped, or whose pid the OS handed to something unrelated -- stops
80
+ // nominating an unrelated process as the writer of a quiescent worktree.
81
+ const liveness = d.classifySessionProcess(session.id);
82
+ if (liveness === 'alive') {
83
+ return {
84
+ signal: {
85
+ active: true,
86
+ provable: true,
87
+ processLiveness: 'alive',
88
+ reason: {
89
+ code: 'active_session',
90
+ message: `agent_sessions row ${session.id} is status=${session.status} and its team process is alive`,
91
+ },
92
+ },
93
+ };
94
+ }
95
+ // 'unprovable' falls through too, DELIBERATELY. Answering active:true there
96
+ // turned every unknown into a permanent writer -- a reservation whose daemon
97
+ // was hard-killed, an unreadable record -- and held the worktree open for
98
+ // nothing. The fix attempted then was to retract those records at boot, which
99
+ // erased the one piece of evidence a live post-spawn child had. So the record
100
+ // is kept (recovery still refuses to close an unprovable row, a write it can
101
+ // never take back) and THIS reader, which is asking about the worktree, reads
102
+ // the worktree. 'stopped' / 'no_process_recorded' fall through the same way, and
103
+ // the verdict rides along UNREDUCED rather than collapsed to a boolean here:
104
+ // the residue checks below and the consumers past them ask different questions
105
+ // of it, and the last attempt to pre-answer for all of them got both wrong.
106
+ return { liveness };
107
+ }
59
108
  /**
60
109
  * Observe whether a focus's worktree is currently being written.
61
110
  *
@@ -68,20 +117,31 @@ const defaultDeps = {
68
117
  * Order of checks (returns on first hit):
69
118
  * 1. in-memory active team (non-terminal phase) -> active_team
70
119
  * 2. no persistent worktree -> { active: false, no_worktree }
71
- * 3. DB session row in active/starting status -> active_session
120
+ * 3. DB session row in an active status AND its team process provably alive
121
+ * -> active_session (anything less falls through to the worktree's own evidence)
72
122
  * 4. recent commit within threshold -> recent_commit
73
123
  * 5. dirty worktree -> dirty_worktree
74
124
  * 6. otherwise -> { active: false, null }
125
+ *
126
+ * Steps 4 and 5 answer from RESIDUE, so neither is ever `provable`: what they
127
+ * observe is that something wrote, which is not the question asked. Step 6 --
128
+ * observed absence, no residue at all -- is provable exactly when step 3 could
129
+ * decide the session's process.
75
130
  */
76
131
  export async function isWorktreeBeingWritten(focusId, opts = {}, deps = {}) {
77
132
  const d = { ...defaultDeps, ...deps };
78
133
  const thresholdMs = opts.recentCommitThresholdMs ?? DEFAULT_RECENT_COMMIT_THRESHOLD_MS;
134
+ // The session's own verdict, carried into the residue tail below and out to the
135
+ // caller unreduced. 'not_read' until step 3 asks.
136
+ let liveness = 'not_read';
79
137
  // 1. In-memory active team
80
138
  if (d.hasActiveTeam(focusId)) {
81
139
  const phase = d.getActiveTeamPhase(focusId);
82
140
  if (phase !== null && phase !== 'shutting_down' && phase !== 'terminated') {
83
141
  return {
84
142
  active: true,
143
+ provable: true,
144
+ processLiveness: 'not_read',
85
145
  reason: {
86
146
  code: 'active_team',
87
147
  message: `in-memory team phase=${phase}`,
@@ -94,27 +154,30 @@ export async function isWorktreeBeingWritten(focusId, opts = {}, deps = {}) {
94
154
  if (!worktree) {
95
155
  return {
96
156
  active: false,
157
+ provable: true,
158
+ processLiveness: 'not_read',
97
159
  reason: { code: 'no_worktree', message: 'focus has no worktree' },
98
160
  };
99
161
  }
100
- // 3. Active DB session for this focus
101
- const session = await d.getActiveSessionForFocus(focusId);
102
- if (session && (session.status === 'active' || session.status === 'starting')) {
103
- return {
104
- active: true,
105
- reason: {
106
- code: 'active_session',
107
- message: `agent_sessions row ${session.id} is status=${session.status}`,
108
- },
109
- };
110
- }
111
- // 4. Recent commit
162
+ // 3. Active DB session for this focus.
163
+ const fromSession = await sessionWriterSignal(focusId, d);
164
+ if ('signal' in fromSession)
165
+ return fromSession.signal;
166
+ liveness = fromSession.liveness;
167
+ // 4. Recent commit -- residue, never an observation of a writer. This branch
168
+ // claimed `provable: true` outright at first, then borrowed the liveness read's
169
+ // certainty, and both were wrong the same way: a commit says something WROTE.
170
+ // Over a session proven STOPPED that points AWAY from a current writer -- the
171
+ // team committed and died, leaving this HEAD -- so borrowing made the most
172
+ // doubtful case read as the most certain one.
112
173
  const lastCommitMs = d.getLastCommitTimestampMs(worktree.worktreePath);
113
174
  if (lastCommitMs !== null) {
114
175
  const ageMs = (d.now ?? Date.now)() - lastCommitMs;
115
176
  if (ageMs >= 0 && ageMs <= thresholdMs) {
116
177
  return {
117
178
  active: true,
179
+ provable: false,
180
+ processLiveness: liveness,
118
181
  reason: {
119
182
  code: 'recent_commit',
120
183
  message: `last commit ${ageMs}ms ago`,
@@ -122,17 +185,26 @@ export async function isWorktreeBeingWritten(focusId, opts = {}, deps = {}) {
122
185
  };
123
186
  }
124
187
  }
125
- // 5. Dirty worktree
188
+ // 5. Dirty worktree -- uncommitted content IS a writer's residue, but it does
189
+ // not say the writer is still there. A stopped team leaves the same tree, which
190
+ // is why a stopped session cannot make this answer provable either. The `active`
191
+ // still holds: that content is real, and a merge into it would clobber work.
126
192
  if (d.worktreeHasUncommittedChanges(worktree.worktreePath)) {
127
193
  return {
128
194
  active: true,
195
+ provable: false,
196
+ processLiveness: liveness,
129
197
  reason: {
130
198
  code: 'dirty_worktree',
131
199
  message: 'git status --porcelain non-empty',
132
200
  },
133
201
  };
134
202
  }
135
- // 6. Quiescent
136
- return { active: false, reason: null };
203
+ // 6. Quiescent -- the one place the liveness read still lands. A decidable
204
+ // process over a tree with NO residue is observed absence of a writer; an
205
+ // undecidable one is not, because a live child that has not written yet leaves
206
+ // exactly this tree. This is also the only answer a destructive consumer acts
207
+ // ON, so making it unconditionally unprovable would wedge every merge-back.
208
+ return { active: false, provable: liveness !== 'unprovable', processLiveness: liveness, reason: null };
137
209
  }
138
210
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/worktree/state.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,gBAAgB;AAEhB;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAsBlE,MAAM,kCAAkC,GAAG,MAAM,CAAC;AAElD;;;GAGG;AACH,SAAS,+BAA+B,CAAC,YAAoB;IAC3D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC;QAC/E,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QACjC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,OA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M,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,YAAY,CAAC;QACnD,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,WAAW,EAAE,CAAC;YACvC,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,KAAK;gBACf,eAAe,EAAE,QAAQ;gBACzB,MAAM,EAAE;oBACN,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,eAAe,KAAK,QAAQ;iBACtC;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,gFAAgF;IAChF,iFAAiF;IACjF,6EAA6E;IAC7E,IAAI,CAAC,CAAC,6BAA6B,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3D,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,KAAK;YACf,eAAe,EAAE,QAAQ;YACzB,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,kCAAkC;aAC5C;SACF,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,0EAA0E;IAC1E,+EAA+E;IAC/E,8EAA8E;IAC9E,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,KAAK,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACzG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telora/daemon",
3
- "version": "0.22.144",
3
+ "version": "0.22.160",
4
4
  "description": "Agent orchestration daemon for Telora - spawns and manages Claude Code instances",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "//testRunner": "Uses Node.js built-in test runner (node:test) via tsx for TypeScript support. The root package uses Vitest; this is a deliberate choice for the daemon package to avoid framework dependencies. Test files live beside the modules they exercise (owner-directory layout); the runner discovers them recursively.",
39
39
  "dependencies": {
40
- "@telora/daemon-core": "^0.2.98",
41
- "@telora/mcp-products": "^0.22.155",
40
+ "@telora/daemon-core": "^0.2.99",
41
+ "@telora/mcp-products": "^0.22.156",
42
42
  "commander": "^14.0.3",
43
43
  "yaml": "^2.4.0",
44
44
  "zod": "^4.3.6"