@telora/daemon 0.22.233 → 0.22.245

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 (219) hide show
  1. package/build-info.json +4 -3
  2. package/dist/backends/index.d.ts.map +1 -1
  3. package/dist/backends/index.js +1 -0
  4. package/dist/backends/index.js.map +1 -1
  5. package/dist/ci/ci-red-attribution.js +1 -1
  6. package/dist/ci/ci-red-attribution.js.map +1 -1
  7. package/dist/ci/ci-status-git.js +1 -1
  8. package/dist/ci/ci-status-git.js.map +1 -1
  9. package/dist/completion/detector.d.ts.map +1 -1
  10. package/dist/completion/detector.js +1 -0
  11. package/dist/completion/detector.js.map +1 -1
  12. package/dist/completion/escalations.d.ts.map +1 -1
  13. package/dist/completion/escalations.js +1 -0
  14. package/dist/completion/escalations.js.map +1 -1
  15. package/dist/completion/event-entry-phases.d.ts.map +1 -1
  16. package/dist/completion/event-entry-phases.js +13 -11
  17. package/dist/completion/event-entry-phases.js.map +1 -1
  18. package/dist/completion/event-phases.d.ts.map +1 -1
  19. package/dist/completion/event-phases.js +16 -15
  20. package/dist/completion/event-phases.js.map +1 -1
  21. package/dist/completion/merge-phase.d.ts +4 -4
  22. package/dist/completion/merge-phase.d.ts.map +1 -1
  23. package/dist/completion/merge-phase.js +10 -7
  24. package/dist/completion/merge-phase.js.map +1 -1
  25. package/dist/completion/review-breaker-hold.d.ts +107 -0
  26. package/dist/completion/review-breaker-hold.d.ts.map +1 -0
  27. package/dist/completion/review-breaker-hold.js +127 -0
  28. package/dist/completion/review-breaker-hold.js.map +1 -0
  29. package/dist/completion/review-exit-escalations.d.ts +9 -1
  30. package/dist/completion/review-exit-escalations.d.ts.map +1 -1
  31. package/dist/completion/review-exit-escalations.js +14 -3
  32. package/dist/completion/review-exit-escalations.js.map +1 -1
  33. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  34. package/dist/completion/review-exit-phase.js +2 -2
  35. package/dist/completion/review-exit-phase.js.map +1 -1
  36. package/dist/completion/state-cascade.d.ts +14 -12
  37. package/dist/completion/state-cascade.d.ts.map +1 -1
  38. package/dist/completion/state-cascade.js +28 -19
  39. package/dist/completion/state-cascade.js.map +1 -1
  40. package/dist/completion/status-advance-phase.d.ts +3 -0
  41. package/dist/completion/status-advance-phase.d.ts.map +1 -1
  42. package/dist/completion/status-advance-phase.js +2 -1
  43. package/dist/completion/status-advance-phase.js.map +1 -1
  44. package/dist/completion/team-lifecycle.d.ts +3 -3
  45. package/dist/completion/team-lifecycle.d.ts.map +1 -1
  46. package/dist/completion/team-lifecycle.js +6 -5
  47. package/dist/completion/team-lifecycle.js.map +1 -1
  48. package/dist/completion/team-progress-measure.d.ts.map +1 -1
  49. package/dist/completion/team-progress-measure.js +1 -0
  50. package/dist/completion/team-progress-measure.js.map +1 -1
  51. package/dist/delivery/delivery-advance-block.d.ts +17 -4
  52. package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
  53. package/dist/delivery/delivery-advance-block.js +203 -173
  54. package/dist/delivery/delivery-advance-block.js.map +1 -1
  55. package/dist/focus/advance-hold.d.ts +55 -0
  56. package/dist/focus/advance-hold.d.ts.map +1 -0
  57. package/dist/focus/advance-hold.js +155 -0
  58. package/dist/focus/advance-hold.js.map +1 -0
  59. package/dist/focus/focus-spawn-decision.d.ts +17 -6
  60. package/dist/focus/focus-spawn-decision.d.ts.map +1 -1
  61. package/dist/focus/focus-spawn-decision.js +6 -6
  62. package/dist/focus/focus-spawn-decision.js.map +1 -1
  63. package/dist/focus/focus-team-state.js +1 -1
  64. package/dist/focus/focus-worktree-state.d.ts.map +1 -1
  65. package/dist/focus/focus-worktree-state.js +1 -0
  66. package/dist/focus/focus-worktree-state.js.map +1 -1
  67. package/dist/focus/listener-auto-advance.d.ts +14 -0
  68. package/dist/focus/listener-auto-advance.d.ts.map +1 -1
  69. package/dist/focus/listener-auto-advance.js +13 -10
  70. package/dist/focus/listener-auto-advance.js.map +1 -1
  71. package/dist/focus/listener-spawn.d.ts.map +1 -1
  72. package/dist/focus/listener-spawn.js +18 -29
  73. package/dist/focus/listener-spawn.js.map +1 -1
  74. package/dist/focus/listener-state.d.ts.map +1 -1
  75. package/dist/focus/listener-state.js +1 -0
  76. package/dist/focus/listener-state.js.map +1 -1
  77. package/dist/focus/listener.d.ts.map +1 -1
  78. package/dist/focus/listener.js +10 -4
  79. package/dist/focus/listener.js.map +1 -1
  80. package/dist/focus/pending-spawn-pass-deps.d.ts +3 -0
  81. package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -1
  82. package/dist/focus/pending-spawn-pass-deps.js +1 -0
  83. package/dist/focus/pending-spawn-pass-deps.js.map +1 -1
  84. package/dist/focus/ready-focus-spawn-action.d.ts +29 -0
  85. package/dist/focus/ready-focus-spawn-action.d.ts.map +1 -0
  86. package/dist/focus/ready-focus-spawn-action.js +32 -0
  87. package/dist/focus/ready-focus-spawn-action.js.map +1 -0
  88. package/dist/focus/ready-focus-team-work.d.ts +18 -0
  89. package/dist/focus/ready-focus-team-work.d.ts.map +1 -0
  90. package/dist/focus/ready-focus-team-work.js +59 -0
  91. package/dist/focus/ready-focus-team-work.js.map +1 -0
  92. package/dist/focus/team-actionable-work.d.ts +56 -6
  93. package/dist/focus/team-actionable-work.d.ts.map +1 -1
  94. package/dist/focus/team-actionable-work.js +56 -9
  95. package/dist/focus/team-actionable-work.js.map +1 -1
  96. package/dist/git/types.d.ts.map +1 -1
  97. package/dist/git/types.js +1 -0
  98. package/dist/git/types.js.map +1 -1
  99. package/dist/merge/approval-gate-state.d.ts +24 -0
  100. package/dist/merge/approval-gate-state.d.ts.map +1 -0
  101. package/dist/merge/approval-gate-state.js +67 -0
  102. package/dist/merge/approval-gate-state.js.map +1 -0
  103. package/dist/merge/focus-merge.d.ts +3 -3
  104. package/dist/merge/focus-merge.d.ts.map +1 -1
  105. package/dist/merge/focus-merge.js +6 -6
  106. package/dist/merge/focus-merge.js.map +1 -1
  107. package/dist/merge/merge-back-loop.d.ts +3 -3
  108. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  109. package/dist/merge/merge-back-loop.js +10 -10
  110. package/dist/merge/merge-back-loop.js.map +1 -1
  111. package/dist/merge/merge-gate-coverage.d.ts +32 -9
  112. package/dist/merge/merge-gate-coverage.d.ts.map +1 -1
  113. package/dist/merge/merge-gate-coverage.js +69 -18
  114. package/dist/merge/merge-gate-coverage.js.map +1 -1
  115. package/dist/nexus/return.d.ts +44 -1
  116. package/dist/nexus/return.d.ts.map +1 -1
  117. package/dist/nexus/return.js +42 -0
  118. package/dist/nexus/return.js.map +1 -1
  119. package/dist/prompt/focus-prompt-builder.d.ts +10 -8
  120. package/dist/prompt/focus-prompt-builder.d.ts.map +1 -1
  121. package/dist/prompt/focus-prompt-builder.js +19 -10
  122. package/dist/prompt/focus-prompt-builder.js.map +1 -1
  123. package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
  124. package/dist/prompt-sections/execution-sections.js +10 -0
  125. package/dist/prompt-sections/execution-sections.js.map +1 -1
  126. package/dist/queries/deliveries.js +1 -1
  127. package/dist/queries/deliveries.js.map +1 -1
  128. package/dist/queries/delivery-gate-holds.d.ts +78 -0
  129. package/dist/queries/delivery-gate-holds.d.ts.map +1 -0
  130. package/dist/queries/delivery-gate-holds.js +5 -0
  131. package/dist/queries/delivery-gate-holds.js.map +1 -0
  132. package/dist/queries/delivery-gate-state.d.ts +17 -60
  133. package/dist/queries/delivery-gate-state.d.ts.map +1 -1
  134. package/dist/queries/delivery-gate-state.js +8 -3
  135. package/dist/queries/delivery-gate-state.js.map +1 -1
  136. package/dist/queries/escalations.d.ts +2 -1
  137. package/dist/queries/escalations.d.ts.map +1 -1
  138. package/dist/queries/escalations.js +3 -3
  139. package/dist/queries/escalations.js.map +1 -1
  140. package/dist/queries/focus-criteria-standing.d.ts +2 -2
  141. package/dist/queries/focus-discovery.js +1 -1
  142. package/dist/queries/focus-discovery.js.map +1 -1
  143. package/dist/queries/focuses.d.ts.map +1 -1
  144. package/dist/queries/focuses.js +1 -0
  145. package/dist/queries/focuses.js.map +1 -1
  146. package/dist/queries/issues.d.ts.map +1 -1
  147. package/dist/queries/issues.js +1 -0
  148. package/dist/queries/issues.js.map +1 -1
  149. package/dist/queries/shared.js +1 -1
  150. package/dist/queries/workflows.d.ts.map +1 -1
  151. package/dist/queries/workflows.js +1 -0
  152. package/dist/queries/workflows.js.map +1 -1
  153. package/dist/spawn/helpers.d.ts.map +1 -1
  154. package/dist/spawn/helpers.js +1 -0
  155. package/dist/spawn/helpers.js.map +1 -1
  156. package/dist/spawn/idle-work-stamp.d.ts +13 -7
  157. package/dist/spawn/idle-work-stamp.d.ts.map +1 -1
  158. package/dist/spawn/idle-work-stamp.js +22 -11
  159. package/dist/spawn/idle-work-stamp.js.map +1 -1
  160. package/dist/spawn/lead-continuation.d.ts.map +1 -1
  161. package/dist/spawn/lead-continuation.js +13 -11
  162. package/dist/spawn/lead-continuation.js.map +1 -1
  163. package/dist/spawn/spawn-cooldown.js +1 -1
  164. package/dist/testing/fixtures/index.js +1 -1
  165. package/dist/testing/fixtures/merge-log-capture.d.ts +5 -0
  166. package/dist/testing/fixtures/merge-log-capture.d.ts.map +1 -0
  167. package/dist/testing/fixtures/merge-log-capture.js +35 -0
  168. package/dist/testing/fixtures/merge-log-capture.js.map +1 -0
  169. package/dist/testing/fixtures/pending-spawn-world.js +1 -1
  170. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  171. package/dist/types/index.js +1 -1
  172. package/dist/verify/commit-gate-configured.d.ts.map +1 -1
  173. package/dist/verify/commit-gate-configured.js +1 -0
  174. package/dist/verify/commit-gate-configured.js.map +1 -1
  175. package/dist/verify/gate-process-group.d.ts +40 -0
  176. package/dist/verify/gate-process-group.d.ts.map +1 -0
  177. package/dist/verify/gate-process-group.js +91 -0
  178. package/dist/verify/gate-process-group.js.map +1 -0
  179. package/dist/verify/no-verdict-record.d.ts +103 -0
  180. package/dist/verify/no-verdict-record.d.ts.map +1 -0
  181. package/dist/verify/no-verdict-record.js +218 -0
  182. package/dist/verify/no-verdict-record.js.map +1 -0
  183. package/dist/verify/timed-out-rendered-verdict.d.ts +40 -0
  184. package/dist/verify/timed-out-rendered-verdict.d.ts.map +1 -0
  185. package/dist/verify/timed-out-rendered-verdict.js +52 -0
  186. package/dist/verify/timed-out-rendered-verdict.js.map +1 -0
  187. package/dist/verify/verification-attribution-base.js +1 -1
  188. package/dist/verify/verification-attribution-base.js.map +1 -1
  189. package/dist/verify/verification-attribution.js +2 -2
  190. package/dist/verify/verification-attribution.js.map +1 -1
  191. package/dist/verify/verification-baseline-run.d.ts.map +1 -1
  192. package/dist/verify/verification-baseline-run.js +5 -7
  193. package/dist/verify/verification-baseline-run.js.map +1 -1
  194. package/dist/verify/verification-baseline.js +1 -1
  195. package/dist/verify/verification-baseline.js.map +1 -1
  196. package/dist/verify/verification-checkout.js +1 -1
  197. package/dist/verify/verification-checkout.js.map +1 -1
  198. package/dist/verify/verification-commit-sharing.d.ts.map +1 -1
  199. package/dist/verify/verification-commit-sharing.js +93 -10
  200. package/dist/verify/verification-commit-sharing.js.map +1 -1
  201. package/dist/verify/verification-default-on.js +1 -1
  202. package/dist/verify/verification-default-on.js.map +1 -1
  203. package/dist/verify/verification-deps-default.d.ts.map +1 -1
  204. package/dist/verify/verification-deps-default.js +2 -0
  205. package/dist/verify/verification-deps-default.js.map +1 -1
  206. package/dist/verify/verification-deps.d.ts +8 -0
  207. package/dist/verify/verification-deps.d.ts.map +1 -1
  208. package/dist/verify/verification-deterministic.d.ts +8 -0
  209. package/dist/verify/verification-deterministic.d.ts.map +1 -1
  210. package/dist/verify/verification-deterministic.js +3 -6
  211. package/dist/verify/verification-deterministic.js.map +1 -1
  212. package/dist/worktree/provision.d.ts +6 -5
  213. package/dist/worktree/provision.d.ts.map +1 -1
  214. package/dist/worktree/provision.js +13 -8
  215. package/dist/worktree/provision.js.map +1 -1
  216. package/dist/worktree/verify-interlock.d.ts.map +1 -1
  217. package/dist/worktree/verify-interlock.js +2 -0
  218. package/dist/worktree/verify-interlock.js.map +1 -1
  219. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
- // Pinned by: packages/daemon/src/queries/incident-correlation.test.ts,
2
+ // Pinned by: packages/daemon/src/focus/advance-hold.test.ts,
3
+ // packages/daemon/src/queries/incident-correlation.test.ts,
3
4
  // packages/daemon/src/shell/safety-capture-entry-points.test.ts
4
5
  // PINNED-BY-END
5
6
  /**
@@ -153,22 +154,9 @@ async function safetyCommitStrandedWork(worktree, params, deps, onSweepRefusal)
153
154
  * across daemon restarts (it reads the DB, holds no in-memory state).
154
155
  */
155
156
  export async function ensureWorktreeCommittedBeforeAdvance(params, deps = {}) {
156
- const getWorktree = deps.getFocusWorktree ?? getFocusWorktree;
157
- const hasUncommitted = deps.worktreeHasUncommittedChanges ?? worktreeHasUncommittedChanges;
158
- const createEsc = deps.createEscalation ?? createEscalation;
159
- const hasOpenEsc = deps.hasOpenWorktreeDirtyEscalation ?? hasOpenWorktreeDirtyEscalation;
160
- const resolveOpenEsc = deps.resolveOpenWorktreeDirtyEscalations ?? resolveOpenWorktreeDirtyEscalations;
161
- const reconcileTorn = deps.reconcileTornWrite ?? reconcileTornWrite;
162
- const isUnderVerify = deps.isWorktreeUnderVerify ?? isWorktreeUnderVerify;
163
- const isLockfileOnly = deps.dirtyChangesAreGeneratedLockfilesOnly ?? dirtyChangesAreGeneratedLockfilesOnly;
164
- const commitLockfiles = deps.commitGeneratedLockfiles ?? commitGeneratedLockfiles;
165
- const getTeam = deps.getActiveTeam ?? ((id) => getActiveTeams().get(id));
166
- const sendMsg = deps.sendMessage ?? sendMessage;
167
- const budget = deps.autoRemediationBudget ?? resolveAutoRemediationBudget();
168
- const rewakeMinIntervalMs = deps.rewakeMinIntervalMs ?? REWAKE_MIN_INTERVAL_MS;
169
- const now = deps.now ?? Date.now;
170
- const { deliveryId, deliveryName, focusId, organizationId, sessionId } = params;
171
- const worktree = getWorktree(focusId);
157
+ const r = resolveAdvanceBlockDeps(deps);
158
+ const { deliveryName, focusId } = params;
159
+ const worktree = r.getWorktree(focusId);
172
160
  if (!worktree)
173
161
  return { ok: true };
174
162
  // Verify interlock: if a verify command is running in this focus worktree, the
@@ -178,13 +166,13 @@ export async function ensureWorktreeCommittedBeforeAdvance(params, deps = {}) {
178
166
  // budget spent), so the next poll re-evaluates cleanly once the verify completes.
179
167
  // Guarding here as well as in guardedCommit keeps a transient mid-verify dirt
180
168
  // from ever being read as an uncommitted-work condition in the first place.
181
- if (isUnderVerify(worktree.worktreePath)) {
169
+ if (r.isUnderVerify(worktree.worktreePath)) {
182
170
  log.info(`[delivery-lifecycle] Deferring advance of "${deliveryName}": a verify command is ` +
183
171
  `running in ${worktree.worktreePath}. Not committing, re-waking, or escalating; ` +
184
172
  `the next poll retries once verify completes.`);
185
- return { ok: false, reason: 'verify in flight (safety-commit deferred)' };
173
+ return { ok: false, reason: 'verify in flight (safety-commit deferred)', hold: { kind: 'verify_in_flight', worktreePath: worktree.worktreePath } };
186
174
  }
187
- if (!hasUncommitted(worktree.worktreePath)) {
175
+ if (!r.hasUncommitted(worktree.worktreePath)) {
188
176
  // Clean -- the dirty episode (if any) is over. Reset the retry budget so a
189
177
  // future episode starts fresh, and auto-close any worktree-dirty escalation
190
178
  // we filed for it so a resolved-in-fact condition stops sitting in the human
@@ -192,179 +180,222 @@ export async function ensureWorktreeCommittedBeforeAdvance(params, deps = {}) {
192
180
  // common clean-advance path adds no extra DB round-trip.
193
181
  const hadEpisode = remediationState.delete(focusId);
194
182
  if (hadEpisode) {
195
- await autoResolveClearedEscalations(resolveOpenEsc, focusId);
183
+ await autoResolveClearedEscalations(r.resolveOpenEsc, focusId);
196
184
  }
197
185
  return { ok: true };
198
186
  }
199
187
  const reason = `uncommitted changes in focus worktree ${worktree.worktreePath}`;
188
+ const hold = { kind: 'worktree_uncommitted', worktreePath: worktree.worktreePath };
200
189
  log.warn(`Blocking advance of "${deliveryName}": ${reason}`);
201
- // ── Auto-remediation 0: pure torn write -> reconcile the index, advance ────
202
- // A staged index entry with NO worktree content behind it (index != HEAD,
203
- // worktree == HEAD) is not agent work -- it is a torn write (e.g. a verify
204
- // command mutated a tracked file and restored it while a safety-commit
205
- // snapshotted the index mid-flight). There is nothing for a team to commit and
206
- // nothing to preserve, so re-waking or escalating would loop forever. Reconcile
207
- // the index to the worktree; the tree goes clean and the delivery advances with
208
- // NO escalation. Runs FIRST so a torn write never reaches the lockfile /
209
- // re-wake / safety-commit branches below. The advance-gate DETECTOR
210
- // (worktreeHasUncommittedChanges, `git status --porcelain`) and this REMEDIATOR
211
- // (reconcileTornWrite, index-aware) agree on this dirt -- the wedge is what this
212
- // focus exists to remove (escalation 2170fdde, 2026-08-16).
213
- const reconciled = reconcileTorn(worktree.worktreePath);
214
- if (reconciled) {
215
- log.info(`[delivery-lifecycle] Reconciled torn-write index for "${deliveryName}" at ` +
216
- `${worktree.worktreePath} (${reconciled.reconciled.length} staged path(s) with no ` +
217
- `worktree content); advancing without escalation.`);
218
- remediationState.delete(focusId);
219
- await autoResolveClearedEscalations(resolveOpenEsc, focusId);
190
+ if (await clearMechanicalDirt(worktree.worktreePath, deliveryName, focusId, r))
220
191
  return { ok: true };
221
- }
222
- // ── Auto-remediation 1: pure generated-lockfile churn -> auto-commit ──────
223
- if (isLockfileOnly(worktree.worktreePath)) {
224
- const sha = commitLockfiles(worktree.worktreePath);
225
- if (sha) {
226
- log.info(`[delivery-lifecycle] Auto-committed generated lockfile churn for "${deliveryName}" ` +
227
- `(${sha.slice(0, 8)}); advancing without escalation.`);
228
- remediationState.delete(focusId);
229
- // The worktree is now clean -- close any escalation the dirty churn raised.
230
- await autoResolveClearedEscalations(resolveOpenEsc, focusId);
231
- return { ok: true };
232
- }
233
- // Commit failed -- fall through to re-wake / escalation.
234
- }
235
192
  // Record that this focus has an active dirty episode so the clean path can
236
193
  // later auto-resolve whatever escalation we file/maintain for it, even when
237
194
  // the episode is escalated without ever re-waking a team.
238
195
  if (!remediationState.has(focusId)) {
239
196
  remediationState.set(focusId, { attempts: 0, lastNudgeAt: 0 });
240
197
  }
241
- // ── Auto-remediation 2: real work -> re-wake the team, within budget ──────
242
- // Idempotent per poll cycle at FOCUS grain: this guard runs once per delivery,
243
- // but the dirty worktree is one focus-level fact. Only the first delivery in a
244
- // cycle acts (re-wake or escalate); siblings within the same cycle no-op.
245
- //
246
- // whatWasTried context for the eventual human escalation -- overwritten by the
247
- // branch that actually decides to escalate so the row explains itself.
248
- let escalationContext = 'the focus worktree had uncommitted changes the daemon could not auto-remediate';
249
- const leadStdin = getTeam(focusId)?.leadStdin ?? null;
250
- if (leadStdin) {
251
- const state = remediationState.get(focusId) ?? { attempts: 0, lastNudgeAt: 0 };
252
- const newCycle = now() - state.lastNudgeAt >= rewakeMinIntervalMs;
253
- if (!newCycle) {
254
- // A sibling delivery already acted on this focus's dirty worktree this
255
- // poll cycle (re-woke or escalated). Suppress to hold "one action per
256
- // cycle" -- without re-filing or double-counting budget.
257
- return { ok: false, reason };
258
- }
259
- // Claim the cycle up front (idempotency) regardless of which branch we take.
260
- state.lastNudgeAt = now();
198
+ const leadStdin = r.getTeam(focusId)?.leadStdin ?? null;
199
+ const step = leadStdin
200
+ ? rewakeLeadWithinBudget(leadStdin, worktree.worktreePath, deliveryName, focusId, r)
201
+ : await safetyCommitWithNoTeam(worktree, params, deps, r);
202
+ if (step.kind === 'advance')
203
+ return { ok: true };
204
+ if (step.kind === 'held')
205
+ return { ok: false, reason, hold };
206
+ await fileAdvanceBlockEscalation(params, worktree.worktreePath, step.escalationContext, r);
207
+ return { ok: false, reason, hold };
208
+ }
209
+ /** ensureWorktreeCommittedBeforeAdvance's collaborators, each defaulted to the real one. */
210
+ function resolveAdvanceBlockDeps(deps) {
211
+ return {
212
+ getWorktree: deps.getFocusWorktree ?? getFocusWorktree,
213
+ hasUncommitted: deps.worktreeHasUncommittedChanges ?? worktreeHasUncommittedChanges,
214
+ createEsc: deps.createEscalation ?? createEscalation,
215
+ hasOpenEsc: deps.hasOpenWorktreeDirtyEscalation ?? hasOpenWorktreeDirtyEscalation,
216
+ resolveOpenEsc: deps.resolveOpenWorktreeDirtyEscalations ?? resolveOpenWorktreeDirtyEscalations,
217
+ reconcileTorn: deps.reconcileTornWrite ?? reconcileTornWrite,
218
+ isUnderVerify: deps.isWorktreeUnderVerify ?? isWorktreeUnderVerify,
219
+ isLockfileOnly: deps.dirtyChangesAreGeneratedLockfilesOnly ?? dirtyChangesAreGeneratedLockfilesOnly,
220
+ commitLockfiles: deps.commitGeneratedLockfiles ?? commitGeneratedLockfiles,
221
+ getTeam: deps.getActiveTeam ?? ((id) => getActiveTeams().get(id)),
222
+ sendMsg: deps.sendMessage ?? sendMessage,
223
+ budget: deps.autoRemediationBudget ?? resolveAutoRemediationBudget(),
224
+ rewakeMinIntervalMs: deps.rewakeMinIntervalMs ?? REWAKE_MIN_INTERVAL_MS,
225
+ now: deps.now ?? Date.now,
226
+ };
227
+ }
228
+ /** The dirty episode is over: forget its budget and close what it filed. */
229
+ async function closeDirtyEpisode(focusId, r) {
230
+ remediationState.delete(focusId);
231
+ await autoResolveClearedEscalations(r.resolveOpenEsc, focusId);
232
+ }
233
+ /**
234
+ * Auto-remediations 0 and 1: dirt no team needs to commit. True when the tree
235
+ * was made clean and the delivery may advance.
236
+ *
237
+ * 0. A pure torn write -- a staged index entry with NO worktree content behind
238
+ * it (index != HEAD, worktree == HEAD) is not agent work (e.g. a verify
239
+ * command mutated a tracked file and restored it while a safety-commit
240
+ * snapshotted the index mid-flight). There is nothing for a team to commit and
241
+ * nothing to preserve, so re-waking or escalating would loop forever. Reconcile
242
+ * the index to the worktree; the tree goes clean and the delivery advances with
243
+ * NO escalation. Runs FIRST so a torn write never reaches the lockfile /
244
+ * re-wake / safety-commit steps. The advance-gate DETECTOR
245
+ * (worktreeHasUncommittedChanges, `git status --porcelain`) and this REMEDIATOR
246
+ * (reconcileTornWrite, index-aware) agree on this dirt -- the wedge is what this
247
+ * focus exists to remove (escalation 2170fdde, 2026-08-16).
248
+ * 1. Pure generated-lockfile churn -> auto-commit. A failed commit falls through
249
+ * to re-wake / escalation.
250
+ */
251
+ async function clearMechanicalDirt(worktreePath, deliveryName, focusId, r) {
252
+ const reconciled = r.reconcileTorn(worktreePath);
253
+ if (reconciled) {
254
+ log.info(`[delivery-lifecycle] Reconciled torn-write index for "${deliveryName}" at ` +
255
+ `${worktreePath} (${reconciled.reconciled.length} staged path(s) with no ` +
256
+ `worktree content); advancing without escalation.`);
257
+ await closeDirtyEpisode(focusId, r);
258
+ return true;
259
+ }
260
+ if (!r.isLockfileOnly(worktreePath))
261
+ return false;
262
+ const sha = r.commitLockfiles(worktreePath);
263
+ if (!sha)
264
+ return false;
265
+ log.info(`[delivery-lifecycle] Auto-committed generated lockfile churn for "${deliveryName}" ` +
266
+ `(${sha.slice(0, 8)}); advancing without escalation.`);
267
+ // The worktree is now clean -- close any escalation the dirty churn raised.
268
+ await closeDirtyEpisode(focusId, r);
269
+ return true;
270
+ }
271
+ /**
272
+ * Auto-remediation 2: real work with a live lead -> re-wake it to commit, within
273
+ * budget. Idempotent per poll cycle at FOCUS grain: the guard runs once per
274
+ * delivery, but the dirty worktree is one focus-level fact, so only the first
275
+ * delivery in a cycle acts (re-wake or escalate); siblings within the same cycle
276
+ * are `held`.
277
+ *
278
+ * The bounded-retry-vs-escalate boundary is the shared resolver-dispatch policy
279
+ * primitive (nextResolverStep), so this dirty-worktree path and the general seam
280
+ * agree on the ONE definition of "retry within budget, else escalate". The
281
+ * re-wake IS the resolver attempt here; escalation is the residue when it is
282
+ * spent. Only a SUCCESSFUL nudge spends a budget tick -- a failed write means the
283
+ * lead is effectively unreachable, so it escalates now (TEL-5).
284
+ */
285
+ function rewakeLeadWithinBudget(leadStdin, worktreePath, deliveryName, focusId, r) {
286
+ const state = remediationState.get(focusId) ?? { attempts: 0, lastNudgeAt: 0 };
287
+ if (r.now() - state.lastNudgeAt < r.rewakeMinIntervalMs) {
288
+ // A sibling delivery already acted on this focus's dirty worktree this poll
289
+ // cycle (re-woke or escalated): hold "one action per cycle" without
290
+ // re-filing or double-counting budget.
291
+ return { kind: 'held' };
292
+ }
293
+ // Claim the cycle up front (idempotency) regardless of which branch we take.
294
+ state.lastNudgeAt = r.now();
295
+ remediationState.set(focusId, state);
296
+ if (nextResolverStep(state.attempts, r.budget) !== 'retry') {
297
+ log.warn(`[delivery-lifecycle] Auto-remediation budget (${r.budget}) exhausted for focus ${focusId}; escalating to a human.`);
298
+ return {
299
+ kind: 'escalate',
300
+ escalationContext: `auto-remediation (generated-lockfile auto-commit and re-waking the team to commit) ` +
301
+ `did not clear the uncommitted changes within the retry budget (${r.budget})`,
302
+ };
303
+ }
304
+ try {
305
+ r.sendMsg(leadStdin, `Your focus worktree has uncommitted changes, so the daemon cannot advance ` +
306
+ `delivery "${deliveryName}" yet. Please commit (or discard) your work in ` +
307
+ `${worktreePath}; the daemon advances automatically once the worktree ` +
308
+ `is clean. (auto-remediation attempt ${state.attempts + 1}/${r.budget})`);
309
+ state.attempts += 1;
261
310
  remediationState.set(focusId, state);
262
- // Delegate the bounded-retry-vs-escalate boundary to the shared
263
- // resolver-dispatch policy primitive (nextResolverStep), so this
264
- // dirty-worktree path and the general seam agree on the ONE definition of
265
- // "retry within budget, else escalate" -- the attempt-first, bounded-retry,
266
- // escalate-on-exhaustion shape this whole focus generalizes. The re-wake IS
267
- // the resolver attempt here; escalation is the residue when it is spent.
268
- if (nextResolverStep(state.attempts, budget) === 'retry') {
269
- // Within budget: try to re-wake the lead. Only a SUCCESSFUL nudge spends a
270
- // budget tick -- a failed write means the lead is effectively unreachable,
271
- // so we stop pretending a re-wake is possible and escalate now (TEL-5).
272
- try {
273
- sendMsg(leadStdin, `Your focus worktree has uncommitted changes, so the daemon cannot advance ` +
274
- `delivery "${deliveryName}" yet. Please commit (or discard) your work in ` +
275
- `${worktree.worktreePath}; the daemon advances automatically once the worktree ` +
276
- `is clean. (auto-remediation attempt ${state.attempts + 1}/${budget})`);
277
- state.attempts += 1;
278
- remediationState.set(focusId, state);
279
- log.info(`[delivery-lifecycle] Re-woke team for focus ${focusId} to commit ` +
280
- `(auto-remediation ${state.attempts}/${budget}); not escalating.`);
281
- return { ok: false, reason };
282
- }
283
- catch (err) {
284
- log.warn(`[delivery-lifecycle] Re-wake of team for "${deliveryName}" failed (${err.message}); ` +
285
- `treating the lead as unreachable and escalating to a human.`);
286
- escalationContext =
287
- 're-waking the team to commit failed because its input stream was unwritable ' +
288
- '(the lead is effectively unreachable), so the daemon could not ask it to commit';
289
- // fall through to escalation; the failed nudge did NOT spend budget.
290
- }
291
- }
292
- else {
293
- // Budget exhausted -- fall through to the human escalation (durably deduped).
294
- log.warn(`[delivery-lifecycle] Auto-remediation budget (${budget}) exhausted for focus ${focusId}; escalating to a human.`);
295
- escalationContext =
296
- `auto-remediation (generated-lockfile auto-commit and re-waking the team to commit) ` +
297
- `did not clear the uncommitted changes within the retry budget (${budget})`;
298
- }
311
+ log.info(`[delivery-lifecycle] Re-woke team for focus ${focusId} to commit ` +
312
+ `(auto-remediation ${state.attempts}/${r.budget}); not escalating.`);
313
+ return { kind: 'held' };
299
314
  }
300
- else {
301
- // No live team to re-wake and the dirt is not generated-lockfile-only. The
302
- // team wrote real work but exited (or was killed) before committing, leaving
303
- // it stranded: the commit-gate has no team to re-wake, and re-spawning a team
304
- // is out of scope here. Rather than file a needs_operator escalation for a
305
- // condition the daemon can self-resolve, make a WIP safety-commit of the
306
- // uncommitted agent work and advance to verify -- review is the real gate, so
307
- // committing the work-in-progress loses nothing and the differential loop is
308
- // not left churning on a stranded delivery. This reuses the same
309
- // safetyCommitWorktree primitive crash-recovery and removeWorktree use.
310
- // DECIDED 2026-06-22, Jeremy -- this deliberately reverses the prior
311
- // "committing incomplete agent work and merging it is unsafe" stance: the
312
- // safety-commit lands on the focus branch and review still gates the merge.
313
- // Capture a mass-sweep refusal so the eventual escalation can name the
314
- // count/paths the guard withheld (the work stays recoverable).
315
- let sweepRefusal = null;
316
- const { sha, unmergedEscalated } = await safetyCommitStrandedWork(worktree, params, deps, (r) => {
317
- sweepRefusal = r;
318
- });
319
- // A conflict refusal already filed its own escalation: filing the generic one too would duplicate it.
320
- if (!sha && unmergedEscalated)
321
- return { ok: false, reason };
322
- if (sha) {
323
- log.info(`[delivery-lifecycle] No live team for focus ${focusId} to re-wake; safety-committed ` +
324
- `uncommitted agent work ${sha.slice(0, 8)} and advancing "${deliveryName}" to verify -- ` +
325
- `review is the gate.`);
326
- // The worktree is now clean -- close out the dirty episode and auto-resolve
327
- // any worktree-dirty escalation we filed for this focus, mirroring the
328
- // lockfile-only auto-commit branch above.
329
- remediationState.delete(focusId);
330
- await autoResolveClearedEscalations(resolveOpenEsc, focusId);
331
- return { ok: true };
332
- }
333
- // Safety-commit failed -- the one genuine corner that still needs a human.
334
- // Fall through to the escalation block, explaining the corner (TEL-3).
335
- // A sweep refusal is a distinct, recoverable corner: name the count/paths so
336
- // an agent/operator can commit the legitimate subset (the daemon kept the
337
- // scratch/sweep out of history and preserved the working tree).
338
- if (sweepRefusal) {
339
- const r = sweepRefusal;
340
- escalationContext =
341
- `no team is live to re-wake and the daemon REFUSED to safety-commit ${r.count} files ` +
342
- `(exceeds the ${r.maxFiles}-file sweep threshold; e.g. ${r.sample.slice(0, 5).join(', ')}), ` +
343
- `so a mass sweep was kept out of history and the working tree is preserved for recovery`;
344
- }
345
- else {
346
- escalationContext =
347
- 'no team is live to re-wake and the WIP safety-commit of the uncommitted agent work ' +
348
- 'failed, so the daemon could not self-resolve';
349
- }
315
+ catch (err) {
316
+ log.warn(`[delivery-lifecycle] Re-wake of team for "${deliveryName}" failed (${err.message}); ` +
317
+ `treating the lead as unreachable and escalating to a human.`);
318
+ // The failed nudge did NOT spend budget.
319
+ return {
320
+ kind: 'escalate',
321
+ escalationContext: 're-waking the team to commit failed because its input stream was unwritable ' +
322
+ '(the lead is effectively unreachable), so the daemon could not ask it to commit',
323
+ };
350
324
  }
351
- // ── File the residue (proposed needs_operator, no human act) ──────────────
352
- // Reached only when the retry budget is exhausted, the lead was unreachable,
353
- // or no team is reachable to re-wake and the dirt is not lockfile-only. Durable
354
- // focus-grain dedup still applies; fail open on lookup error so a genuine first
355
- // escalation is not silently swallowed.
325
+ }
326
+ /**
327
+ * No live team to re-wake and the dirt is not generated-lockfile-only. The team
328
+ * wrote real work but exited (or was killed) before committing, leaving it
329
+ * stranded: the commit-gate has no team to re-wake, and re-spawning a team is out
330
+ * of scope here. Rather than file a needs_operator escalation for a condition the
331
+ * daemon can self-resolve, make a WIP safety-commit of the uncommitted agent work
332
+ * and advance to verify -- review is the real gate, so committing the
333
+ * work-in-progress loses nothing and the differential loop is not left churning
334
+ * on a stranded delivery. This reuses the same safetyCommitWorktree primitive
335
+ * crash-recovery and removeWorktree use. DECIDED 2026-06-22, Jeremy -- this
336
+ * deliberately reverses the prior "committing incomplete agent work and merging
337
+ * it is unsafe" stance: the safety-commit lands on the focus branch and review
338
+ * still gates the merge.
339
+ */
340
+ async function safetyCommitWithNoTeam(worktree, params, deps, r) {
341
+ const { deliveryName, focusId } = params;
342
+ // Capture a mass-sweep refusal so the eventual escalation can name the
343
+ // count/paths the guard withheld (the work stays recoverable).
344
+ let sweepRefusal = null;
345
+ const { sha, unmergedEscalated } = await safetyCommitStrandedWork(worktree, params, deps, (report) => {
346
+ sweepRefusal = report;
347
+ });
348
+ // A conflict refusal already filed its own escalation: filing the generic one too would duplicate it.
349
+ if (!sha && unmergedEscalated)
350
+ return { kind: 'held' };
351
+ if (sha) {
352
+ log.info(`[delivery-lifecycle] No live team for focus ${focusId} to re-wake; safety-committed ` +
353
+ `uncommitted agent work ${sha.slice(0, 8)} and advancing "${deliveryName}" to verify -- ` +
354
+ `review is the gate.`);
355
+ // The worktree is now clean -- close out the dirty episode, mirroring the
356
+ // lockfile-only auto-commit.
357
+ await closeDirtyEpisode(focusId, r);
358
+ return { kind: 'advance' };
359
+ }
360
+ // Safety-commit failed -- the one genuine corner that still needs a human
361
+ // (TEL-3). A sweep refusal is a distinct, recoverable corner: name the
362
+ // count/paths so an agent/operator can commit the legitimate subset (the
363
+ // daemon kept the scratch/sweep out of history and preserved the working tree).
364
+ if (sweepRefusal) {
365
+ const refusal = sweepRefusal;
366
+ return {
367
+ kind: 'escalate',
368
+ escalationContext: `no team is live to re-wake and the daemon REFUSED to safety-commit ${refusal.count} files ` +
369
+ `(exceeds the ${refusal.maxFiles}-file sweep threshold; e.g. ${refusal.sample.slice(0, 5).join(', ')}), ` +
370
+ `so a mass sweep was kept out of history and the working tree is preserved for recovery`,
371
+ };
372
+ }
373
+ return {
374
+ kind: 'escalate',
375
+ escalationContext: 'no team is live to re-wake and the WIP safety-commit of the uncommitted agent work ' +
376
+ 'failed, so the daemon could not self-resolve',
377
+ };
378
+ }
379
+ /**
380
+ * File the residue (proposed needs_operator, no human act). Reached only when the
381
+ * retry budget is exhausted, the lead was unreachable, or no team is reachable to
382
+ * re-wake and the safety-commit failed. Durable focus-grain dedup still applies;
383
+ * fail open on lookup error so a genuine first escalation is not silently
384
+ * swallowed. Never throws.
385
+ */
386
+ async function fileAdvanceBlockEscalation(params, worktreePath, escalationContext, r) {
387
+ const { deliveryId, deliveryName, focusId, organizationId, sessionId } = params;
356
388
  let alreadyOpen = false;
357
389
  try {
358
- alreadyOpen = await hasOpenEsc(focusId);
390
+ alreadyOpen = await r.hasOpenEsc(focusId);
359
391
  }
360
392
  catch (err) {
361
393
  log.warn(`[delivery-lifecycle] Open advance-block escalation lookup failed for "${deliveryName}", proceeding to file: ${err.message}`);
362
394
  }
363
- if (alreadyOpen) {
364
- return { ok: false, reason };
365
- }
395
+ if (alreadyOpen)
396
+ return;
366
397
  try {
367
- await withRetry(() => createEsc({
398
+ await withRetry(() => r.createEsc({
368
399
  organizationId,
369
400
  sessionId: sessionId ?? '',
370
401
  issueId: null,
@@ -382,12 +413,11 @@ export async function ensureWorktreeCommittedBeforeAdvance(params, deps = {}) {
382
413
  `that the daemon could not auto-remediate.`,
383
414
  whatWasTried: 'Daemon detected all work issues Done and was about to advance the delivery, but the ' +
384
415
  `focus worktree had uncommitted changes. Escalating because ${escalationContext}.`,
385
- helpNeeded: `Commit (or discard) pending changes in ${worktree.worktreePath}, then the next poll will advance the delivery.`,
416
+ helpNeeded: `Commit (or discard) pending changes in ${worktreePath}, then the next poll will advance the delivery.`,
386
417
  }), { maxAttempts: 3, label: 'escalation-uncommitted-before-advance' });
387
418
  }
388
419
  catch (err) {
389
420
  log.error(`Failed to create uncommitted-changes escalation: ${err.message}`);
390
421
  }
391
- return { ok: false, reason };
392
422
  }
393
423
  //# sourceMappingURL=delivery-advance-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-advance-block.js","sourceRoot":"","sources":["../../src/delivery/delivery-advance-block.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,uEAAuE;AACvE,kEAAkE;AAClE,gBAAgB;AAEhB;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,mCAAmC,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AACvK,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE3I,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAgC,MAAM,yCAAyC,CAAC;AACpH,OAAO,EACL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F;gBACtF,8DAA8D,iBAAiB,GAAG;YACpF,UAAU,EAAE,0CAA0C,YAAY,iDAAiD;SACpH,CAAC,EACF,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAuC,EAAE,CACnE,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,KAAK,CAAC,oDAAqD,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { type DeliveryGateRowIo, type DeliveryGateState } from '../queries/deliveries.js';
2
+ import type { AdvanceHoldDetail } from '../queries/delivery-gate-holds.js';
3
+ import type { AdvancePrecheckHold, AdvancePrecheckResult } from '../delivery/delivery-advance-block.js';
4
+ /** The guard names of the paired `blocking` entries -- one per hold reason. */
5
+ export declare const ADVANCE_HOLD_GUARDS: ReadonlySet<string>;
6
+ /** At most this many paths are named; the count carries the rest. */
7
+ export declare const ADVANCE_HOLD_PATH_CAP = 20;
8
+ /**
9
+ * The uncommitted paths in a worktree, as `git status --porcelain` names them
10
+ * (a rename names its destination). Empty when git cannot be read -- the hold
11
+ * is still recorded, just without paths.
12
+ */
13
+ export declare function listUncommittedPaths(worktreePath: string): string[];
14
+ /** Build the hold detail for a precheck refusal. Pure over its inputs. */
15
+ export declare function buildAdvanceHold(hold: AdvancePrecheckHold, uncommittedPaths: readonly string[], nowIso: string): AdvanceHoldDetail;
16
+ /**
17
+ * The gate_state with `hold` recorded, merged over what the row already carries
18
+ * (verification history and any other key survive). Returns undefined when the
19
+ * same hold is already recorded, so a hold that stands across polls writes once.
20
+ * `heldSince` is kept from the standing record when only the paths changed.
21
+ */
22
+ export declare function withAdvanceHold(prior: DeliveryGateState | null, hold: AdvanceHoldDetail): DeliveryGateState | undefined;
23
+ /** The gate_state with any advance hold removed; undefined when there is none. */
24
+ export declare function withoutAdvanceHold(prior: DeliveryGateState | null): DeliveryGateState | undefined;
25
+ /** Injectable seams (tests drive the row IO and the path read). */
26
+ export interface AdvanceHoldDeps {
27
+ io?: Partial<DeliveryGateRowIo>;
28
+ listUncommittedPaths?: (worktreePath: string) => string[];
29
+ now?: () => string;
30
+ }
31
+ /**
32
+ * Record a precheck refusal on the delivery's gate_state, at the row's own
33
+ * status and in its serialized write turn. A standing identical hold writes
34
+ * nothing. Throws what the row read/write throws; the caller logs and moves on.
35
+ */
36
+ export declare function recordAdvanceHold(deliveryId: string, hold: AdvancePrecheckHold, deps?: AdvanceHoldDeps): Promise<void>;
37
+ /**
38
+ * Clear a recorded advance hold (the delivery re-opened: it holds open work
39
+ * again, so nothing is waiting on the advance). No write when there is none.
40
+ */
41
+ export declare function clearAdvanceHold(deliveryId: string, deps?: AdvanceHoldDeps): Promise<void>;
42
+ /**
43
+ * An advance the precheck refused: log it, and name the hold where the team and
44
+ * the dashboard read it -- a finished delivery held at coding otherwise looks
45
+ * stuck, and a team that cannot see why escalates for a status the daemon owns.
46
+ * The live pass (focus/listener-auto-advance.ts) and the team-exit pass
47
+ * (completion/status-advance-phase.ts) both call it. Logs, never throws.
48
+ */
49
+ export declare function noteAdvanceRefused(delivery: {
50
+ id: string;
51
+ name: string;
52
+ }, precheck: AdvancePrecheckResult, record?: typeof recordAdvanceHold): Promise<void>;
53
+ /** Whether a delivery's gate_state (as read) carries an advance hold. */
54
+ export declare function hasAdvanceHold(gateState: unknown): boolean;
55
+ //# sourceMappingURL=advance-hold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advance-hold.d.ts","sourceRoot":"","sources":["../../src/focus/advance-hold.ts"],"names":[],"mappings":"AAkCA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAKxG,+EAA+E;AAC/E,eA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