@wjarka/cezarion 0.17.0-dev.5487 → 0.17.0-dev.5498

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 (62) hide show
  1. package/dist/ci-wait/controller.d.ts +37 -37
  2. package/dist/server/run-checkout.d.ts +29 -0
  3. package/dist/server/run-checkout.js +31 -0
  4. package/dist/server/run-checkout.js.map +1 -0
  5. package/dist/server/self-update-routes.d.ts +19 -19
  6. package/dist/server/server.d.ts +60 -216
  7. package/dist/server/server.js +28 -54
  8. package/dist/server/server.js.map +1 -1
  9. package/dist/workflows/run/compose.d.ts +0 -5
  10. package/dist/workflows/run/compose.js +32 -46
  11. package/dist/workflows/run/compose.js.map +1 -1
  12. package/dist/workflows/run/family-reconciler.d.ts +2 -6
  13. package/dist/workflows/run/family-reconciler.js +7 -9
  14. package/dist/workflows/run/family-reconciler.js.map +1 -1
  15. package/dist/workflows/run/human-waits.d.ts +0 -2
  16. package/dist/workflows/run/human-waits.js +10 -7
  17. package/dist/workflows/run/human-waits.js.map +1 -1
  18. package/dist/workflows/run/input-delivery.d.ts +2 -2
  19. package/dist/workflows/run/input-delivery.js +2 -2
  20. package/dist/workflows/run/input-delivery.js.map +1 -1
  21. package/dist/workflows/run/run-cancel.d.ts +4 -4
  22. package/dist/workflows/run/run-cancel.js +5 -5
  23. package/dist/workflows/run/run-cancel.js.map +1 -1
  24. package/dist/workflows/run/run-finish.d.ts +2 -2
  25. package/dist/workflows/run/run-finish.js +1 -1
  26. package/dist/workflows/run/run-finish.js.map +1 -1
  27. package/dist/workflows/run/run-recovery.d.ts +0 -4
  28. package/dist/workflows/run/run-recovery.js +10 -8
  29. package/dist/workflows/run/run-recovery.js.map +1 -1
  30. package/dist/workflows/run/step-loop.d.ts +2 -2
  31. package/dist/workflows/run/step-loop.js +1 -1
  32. package/dist/workflows/run/step-loop.js.map +1 -1
  33. package/dist/workflows/run/subagent-waits.d.ts +1 -6
  34. package/dist/workflows/run/subagent-waits.js +5 -17
  35. package/dist/workflows/run/subagent-waits.js.map +1 -1
  36. package/dist/workflows/run/turn-settler.d.ts +0 -2
  37. package/dist/workflows/run/turn-settler.js +3 -6
  38. package/dist/workflows/run/turn-settler.js.map +1 -1
  39. package/dist/workflows/run/wait-engine.d.ts +1186 -28
  40. package/dist/workflows/run/wait-engine.js +399 -50
  41. package/dist/workflows/run/wait-engine.js.map +1 -1
  42. package/dist/workflows/run/wait-kinds.d.ts +5 -3
  43. package/dist/workflows/run/wait-kinds.js +5 -6
  44. package/dist/workflows/run/wait-kinds.js.map +1 -1
  45. package/dist/workflows/run/wait-registry.d.ts +5 -7
  46. package/dist/workflows/run/wait-registry.js +61 -60
  47. package/dist/workflows/run/wait-registry.js.map +1 -1
  48. package/dist/workflows/run/wake-admission.d.ts +2 -4
  49. package/dist/workflows/run/wake-admission.js +4 -4
  50. package/dist/workflows/run/wake-admission.js.map +1 -1
  51. package/dist/workflows/run.js +3 -5
  52. package/dist/workflows/run.js.map +1 -1
  53. package/dist/workflows/wait-scope.d.ts +0 -5
  54. package/dist/workflows/wait-scope.js +1 -5
  55. package/dist/workflows/wait-scope.js.map +1 -1
  56. package/package.json +3 -3
  57. package/dist/workflows/run/wait-cancellation.d.ts +0 -34
  58. package/dist/workflows/run/wait-cancellation.js +0 -54
  59. package/dist/workflows/run/wait-cancellation.js.map +0 -1
  60. package/dist/workflows/run/wait-resolve.d.ts +0 -1139
  61. package/dist/workflows/run/wait-resolve.js +0 -313
  62. package/dist/workflows/run/wait-resolve.js.map +0 -1
@@ -1,52 +1,1210 @@
1
- import type { Wait, WaitErrorCode, AskErrorCode } from '../../contract/index.js';
1
+ import type { Wait, WaitErrorCode, AskErrorCode, WorkerWaitEntry } from '../../contract/index.js';
2
2
  import type { ActiveRun } from '../active-run.ts';
3
3
  import type { RunModuleContext } from './types.ts';
4
4
  import type { RunRecord } from '../../runs/store.ts';
5
+ import type { CiWatcherSupervisor } from '../../ci-wait/supervisor.ts';
6
+ import { ProcessWaitSupervisor } from '../../process-wait/supervisor.ts';
7
+ import type { ExitFileRoots } from '../../process-wait/exit-file.ts';
8
+ import { type WaitResult } from '../waits.ts';
5
9
  import { type RegistrationIdentity } from './wait-registration.ts';
6
10
  export declare function warnRegistrationRefused(code: WaitErrorCode | AskErrorCode): void;
11
+ /** What the engine asks the rest of the run manager (ADR 0053): wake admission, the run line,
12
+ * the family reconcile, human waits and the subagent session. */
7
13
  interface WaitEngineHost {
14
+ active(id: string): ActiveRun | undefined;
15
+ canProceedWithRun(id: string, run: RunRecord | undefined): run is RunRecord;
16
+ ciSupervisor(): Pick<CiWatcherSupervisor, 'resolve' | 'watch' | 'close'>;
17
+ reconcileWorkerWaits(family?: string): void;
18
+ noticeParkedWorkers(id: string): void;
8
19
  withdrawCezarHumanWaits(id: string): void;
9
- armWait(id: string, wait: Wait): void;
20
+ /** The session that holds a subagent wait's children is live (hearsay-tools/cezarion#2431). */
21
+ subagentSessionLive(id: string): boolean;
22
+ /** Resolve a subagent wait whose session is gone `interrupted`, ending its running children in the transcript (hearsay-tools/cezarion#2431). */
23
+ interruptSubagentWait(id: string, waitId: string): void;
24
+ countAutomaticWakes(id: string): number;
25
+ /** Cancel these waits at the wake cap, then repark the session or wait on the user without one. */
26
+ wakeCapReached(id: string, waits: readonly Wait[], state: ActiveRun | undefined): void;
27
+ queueWaitWake(id: string): void;
28
+ retryWaitAdmission(id: string): void;
10
29
  isParked(id: string): boolean;
11
30
  parkOnWaits(id: string, state: ActiveRun): void;
12
- reconcileWorkerWaits(family?: string): void;
13
- noticeParkedWorkers(id: string): void;
31
+ abortRegistrations(id: string): void;
32
+ /** Forget the run's wake retries, wake delivery, queued wake and admission, in that order. */
33
+ forgetWakes(id: string): void;
14
34
  }
15
- type CapacityPolicy = 'silent' | 'delegation' | ((code: 'capacity') => never);
16
- interface OpenOptions<W extends Wait> {
17
- withdraw: 'none' | 'first' | 'before-commit';
18
- existing?: () => W | undefined;
19
- compare?: CapacityPolicy;
35
+ /** The steps a registration path chooses; the row decides the arm, the park guard and the entry returned. */
36
+ interface OpenOptions {
37
+ /** Withdraw Cezar's human waits after the compare, before the commit. */
38
+ withdraw: boolean;
20
39
  receipt?: RegistrationIdentity | undefined;
21
- onCommitFailure: 'persistence' | 'delegation' | 'throw' | {
22
- log: string;
23
- };
24
- arm: 'watch' | {
25
- family: () => string;
26
- notice: string;
27
- } | 'none';
28
- park: 'boundary' | 'boundary-if-listed' | 'none';
29
- return: 'stored' | 'recorded-worker' | 'built' | 'none';
40
+ onCommitFailure?: CommitFailure;
41
+ /** Park when the run is at its turn boundary or parked. */
42
+ park: boolean;
43
+ /** Present: the caller already holds the result (undefined takes the row's default), so the
44
+ * wait arms nothing and resolves with it at once. */
45
+ result?: WaitResult | undefined;
30
46
  }
47
+ /** Absent: the commit error escapes as it is. `persistence`: the tool's coded `capacity` or
48
+ * `persistence` error. `log`: warn and refuse. `capacity`: a full list throws the path's own error. */
49
+ type CommitFailure = 'persistence' | {
50
+ log: string;
51
+ } | {
52
+ capacity: () => Error;
53
+ };
31
54
  export type OpenResult<W extends Wait> = {
32
- status: 'opened' | 'reused';
55
+ status: 'opened';
33
56
  wait: W;
34
57
  } | {
35
58
  status: 'refused';
36
59
  wait?: undefined;
37
60
  };
38
- /** Executes the ordered steps of wait registration behind the run facade. */
61
+ interface CancelWaitsOptions {
62
+ onCommitFailure?: 'throw' | 'skip';
63
+ superseded?: true;
64
+ log?: string;
65
+ }
66
+ /** Executes the wait-kind rows behind the run facade: open, arm, resolve, re-arm, cancel and forget. */
39
67
  export declare class WaitEngine {
40
68
  private readonly context;
41
69
  private readonly host;
42
- constructor(context: RunModuleContext, host: WaitEngineHost);
43
- /** Paths with intervening admission checks compare at their original call site. */
44
- compare(run: Pick<RunRecord, 'waits'>, policy: CapacityPolicy): boolean;
45
- /** Commit, arm and (at a boundary) park on a newly registered wait. */
46
- open<W extends Wait>(runId: string, state: ActiveRun | undefined, build: W | (() => W), options: OpenOptions<W>): OpenResult<W>;
47
- private commit;
48
- private arm;
70
+ private readonly maxAutoContinues;
71
+ private readonly processSupervisor;
72
+ /** One CI watch per open CI wait, keyed by wait id. */
73
+ private readonly ciWatches;
74
+ /** A resolution whose checkpoint failed, retried by wait id. */
75
+ private readonly ciRetries;
76
+ /** Process waits' watches (hearsay-tools/cezarion#1446), by wait id. */
77
+ private readonly processWatches;
78
+ private readonly workerResolveRetries;
79
+ /** One timer per open timer wait, keyed by wait id. */
80
+ private readonly waitTimers;
81
+ /** The watch adapter each row names. */
82
+ private readonly watches;
83
+ constructor(context: RunModuleContext, host: WaitEngineHost, maxAutoContinues: number, processSupervisor?: Pick<ProcessWaitSupervisor, 'watch' | 'close'>);
84
+ /** Whether the run's open-wait list has room. Each caller keeps its own refusal shape. */
85
+ hasRoom(run: Pick<RunRecord, 'waits'>): boolean;
86
+ /** Commit, arm and (at a boundary) park on a newly registered wait. A wait opened with the
87
+ * result its caller already holds arms nothing and resolves with it after the park. */
88
+ open<W extends Wait>(runId: string, state: ActiveRun | undefined, wait: W, options: OpenOptions): OpenResult<W>;
89
+ private armOpened;
90
+ /**
91
+ * Commit a changed open wait, then arm it. A moved deadline disarms the old one first; an
92
+ * unchanged one keeps what is armed, including a checkpoint retry. False when the commit failed
93
+ * under a `log` policy: the saved wait and what is armed stay as they were.
94
+ */
95
+ refresh(runId: string, previous: Wait, next: Wait, onCommitFailure?: {
96
+ log: string;
97
+ }): boolean;
98
+ private commitOpened;
99
+ /** A worker wait the family reconcile already resolved is no longer listed, and parks nothing. */
49
100
  private park;
50
- private returnedWait;
101
+ /** The entry as recorded now: the store keeps the entry it was given, and only its phase can
102
+ * have moved since. A worker wait with a deadline may already be settled by the reconcile. */
103
+ private openedEntry;
104
+ /** Where a process wait's exit file may sit: the run's worktree (the checkout for a run without
105
+ * one) and, unless turned off, the Cezar temp directory its agent gets as `TMPDIR`. */
106
+ exitFileRoots(runId: string, run?: {
107
+ archiveWhenDone?: boolean | undefined;
108
+ autoMergePr?: boolean | undefined;
109
+ allowWorkers?: boolean | undefined;
110
+ allowMessaging?: boolean | undefined;
111
+ id: string;
112
+ title: string;
113
+ titleSummary?: string | undefined;
114
+ diffStat?: {
115
+ adds: number;
116
+ dels: number;
117
+ files: number;
118
+ repointed?: boolean | undefined;
119
+ } | undefined;
120
+ workflow: string;
121
+ task: string;
122
+ queuedMessages?: {
123
+ id: string;
124
+ text: string;
125
+ images?: string[] | undefined;
126
+ createdAt: string;
127
+ }[] | undefined;
128
+ continuationMessage?: {
129
+ id: string;
130
+ text: string;
131
+ images?: string[] | undefined;
132
+ createdAt: string;
133
+ origin?: "human" | "lifecycle" | undefined;
134
+ agentInputId?: string | undefined;
135
+ resumeContext?: {
136
+ failure?: {
137
+ stepId?: string | undefined;
138
+ error: string;
139
+ } | undefined;
140
+ restarted?: true | undefined;
141
+ } | undefined;
142
+ } | undefined;
143
+ workflowResumeStepId?: string | undefined;
144
+ invalidAsk?: boolean | undefined;
145
+ agentInputs?: {
146
+ conversation?: {
147
+ senderRunId: string;
148
+ recipientRunId: string;
149
+ kind: "follow-up" | "progress" | "reply" | "request";
150
+ requestId?: string | undefined;
151
+ relationship?: "family" | "peer" | undefined;
152
+ } | undefined;
153
+ id: string;
154
+ source: "agent" | "lifecycle";
155
+ parentRunId: string;
156
+ text: string;
157
+ createdAt: string;
158
+ deliveredAt?: string | undefined;
159
+ consumedAt?: string | undefined;
160
+ awaitingRead?: true | undefined;
161
+ inboxClaim?: {
162
+ receiptId: string;
163
+ generation: string;
164
+ expiresAt: string;
165
+ acknowledgedAt?: string | undefined;
166
+ memberIds?: string[] | undefined;
167
+ } | undefined;
168
+ purpose?: "completion-refusal" | "undelivered-question" | undefined;
169
+ requestHash?: string | undefined;
170
+ deadline?: string | undefined;
171
+ }[] | undefined;
172
+ waits?: ({
173
+ prUrl: string;
174
+ repository: string;
175
+ prNumber: number;
176
+ headSha: string;
177
+ id: string;
178
+ source: "agent" | "cezar";
179
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
180
+ registeredAt: string;
181
+ phase: "cancelled" | "delivered" | "open" | "resolved";
182
+ resolvedAt?: string | undefined;
183
+ deliveredAt?: string | undefined;
184
+ cancelledAt?: string | undefined;
185
+ turnId: string;
186
+ kind: "pr";
187
+ deadline: string;
188
+ generation: string;
189
+ timeoutSeconds: number;
190
+ until: "checks" | "merge" | "merge_or_blocked";
191
+ wakeOnConflict: boolean;
192
+ result?: {
193
+ outcome: "blocked" | "cancelled" | "closed" | "conflicting" | "deadline" | "error" | "failed" | "head_changed" | "merged" | "no_checks" | "passed" | "skipped";
194
+ headSha: string;
195
+ observedHeadSha?: string | undefined;
196
+ mergeable?: "CONFLICTING" | "MERGEABLE" | "UNKNOWN" | undefined;
197
+ mergeStateStatus?: string | undefined;
198
+ mergedAt?: string | undefined;
199
+ mergeCommitSha?: string | undefined;
200
+ mergeBlock?: {
201
+ reason: "conflict" | "no_pending_merge";
202
+ isInMergeQueue: boolean;
203
+ autoMergeEnabled: boolean;
204
+ event?: {
205
+ kind: "auto_merge_disabled" | "queue_removal";
206
+ createdAt: string;
207
+ reason?: string | undefined;
208
+ reasonCode?: string | undefined;
209
+ } | undefined;
210
+ } | undefined;
211
+ observedAt: string;
212
+ checks: {
213
+ name: string;
214
+ state: string;
215
+ link: string;
216
+ }[];
217
+ totalChecks: number;
218
+ truncated: boolean;
219
+ diagnostic?: string | undefined;
220
+ } | undefined;
221
+ } | {
222
+ id: string;
223
+ source: "agent" | "cezar";
224
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
225
+ registeredAt: string;
226
+ phase: "cancelled" | "delivered" | "open" | "resolved";
227
+ resolvedAt?: string | undefined;
228
+ deliveredAt?: string | undefined;
229
+ cancelledAt?: string | undefined;
230
+ turnId: string;
231
+ kind: "timer";
232
+ deadline: string;
233
+ seconds: number;
234
+ note?: string | undefined;
235
+ } | {
236
+ id: string;
237
+ source: "agent" | "cezar";
238
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
239
+ registeredAt: string;
240
+ phase: "cancelled" | "delivered" | "open" | "resolved";
241
+ resolvedAt?: string | undefined;
242
+ deliveredAt?: string | undefined;
243
+ cancelledAt?: string | undefined;
244
+ turnId: string;
245
+ kind: "human";
246
+ questions?: {
247
+ id?: string | undefined;
248
+ header: string;
249
+ question: string;
250
+ options?: {
251
+ label: string;
252
+ description?: string | undefined;
253
+ }[] | undefined;
254
+ multiSelect?: boolean | undefined;
255
+ }[] | undefined;
256
+ context?: string | undefined;
257
+ askSeq?: number | undefined;
258
+ } | {
259
+ id: string;
260
+ source: "agent" | "cezar";
261
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
262
+ registeredAt: string;
263
+ phase: "cancelled" | "delivered" | "open" | "resolved";
264
+ resolvedAt?: string | undefined;
265
+ deliveredAt?: string | undefined;
266
+ cancelledAt?: string | undefined;
267
+ turnId: string;
268
+ kind: "worker";
269
+ deadline?: string | undefined;
270
+ timeoutSeconds?: number | undefined;
271
+ mode?: "all" | "any" | "one" | undefined;
272
+ workerIds?: string[] | undefined;
273
+ revisions?: {
274
+ workerId: string;
275
+ revision: number;
276
+ }[] | undefined;
277
+ outcomes?: {
278
+ workerId: string;
279
+ status: "cancelled" | "done" | "failed" | "review";
280
+ observedAt: string;
281
+ summary?: string | undefined;
282
+ revision?: number | undefined;
283
+ }[] | undefined;
284
+ requestIds?: string[] | undefined;
285
+ requestOutcomes?: {
286
+ requestId: string;
287
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
288
+ observedAt: string;
289
+ replyId?: string | undefined;
290
+ }[] | undefined;
291
+ result?: {
292
+ reason: "outcome" | "timeout";
293
+ } | undefined;
294
+ wakeInputId?: string | undefined;
295
+ } | {
296
+ id: string;
297
+ source: "agent" | "cezar";
298
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
299
+ registeredAt: string;
300
+ phase: "cancelled" | "delivered" | "open" | "resolved";
301
+ resolvedAt?: string | undefined;
302
+ deliveredAt?: string | undefined;
303
+ cancelledAt?: string | undefined;
304
+ turnId: string;
305
+ kind: "process";
306
+ deadline: string;
307
+ timeoutSeconds: number;
308
+ pid: number;
309
+ startToken?: string | undefined;
310
+ exitFile?: string | undefined;
311
+ note?: string | undefined;
312
+ result?: {
313
+ outcome: "deadline" | "error" | "exit_file" | "exited";
314
+ observedAt: string;
315
+ exitCode?: number | undefined;
316
+ exitFileNote?: "not-an-exit-code" | undefined;
317
+ diagnostic?: string | undefined;
318
+ } | undefined;
319
+ } | {
320
+ id: string;
321
+ source: "agent" | "cezar";
322
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
323
+ registeredAt: string;
324
+ phase: "cancelled" | "delivered" | "open" | "resolved";
325
+ resolvedAt?: string | undefined;
326
+ deliveredAt?: string | undefined;
327
+ cancelledAt?: string | undefined;
328
+ turnId: string;
329
+ kind: "peer";
330
+ deadline: string;
331
+ timeoutSeconds: number;
332
+ peerIds: string[];
333
+ result?: {
334
+ reason: "message";
335
+ peerRunId: string;
336
+ messageId: string;
337
+ } | {
338
+ reason: "settled";
339
+ peerRunId: string;
340
+ } | {
341
+ reason: "timeout";
342
+ } | undefined;
343
+ } | {
344
+ id: string;
345
+ registeredAt: string;
346
+ phase: "cancelled" | "delivered" | "open" | "resolved";
347
+ resolvedAt?: string | undefined;
348
+ deliveredAt?: string | undefined;
349
+ cancelledAt?: string | undefined;
350
+ turnId: string;
351
+ kind: "subagent";
352
+ source: "cezar";
353
+ via: "native-subagents";
354
+ deadline: string;
355
+ children: {
356
+ id: string;
357
+ status: "cancelled" | "completed" | "failed" | "running";
358
+ }[];
359
+ result?: {
360
+ reason: "interrupted" | "settled" | "superseded" | "timeout";
361
+ } | undefined;
362
+ })[] | undefined;
363
+ waitRegistrations?: {
364
+ operationId: string;
365
+ requestHash: string;
366
+ wait: {
367
+ prUrl: string;
368
+ repository: string;
369
+ prNumber: number;
370
+ headSha: string;
371
+ id: string;
372
+ source: "agent" | "cezar";
373
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
374
+ registeredAt: string;
375
+ phase: "cancelled" | "delivered" | "open" | "resolved";
376
+ resolvedAt?: string | undefined;
377
+ deliveredAt?: string | undefined;
378
+ cancelledAt?: string | undefined;
379
+ turnId: string;
380
+ kind: "pr";
381
+ deadline: string;
382
+ generation: string;
383
+ timeoutSeconds: number;
384
+ until: "checks" | "merge" | "merge_or_blocked";
385
+ wakeOnConflict: boolean;
386
+ result?: {
387
+ outcome: "blocked" | "cancelled" | "closed" | "conflicting" | "deadline" | "error" | "failed" | "head_changed" | "merged" | "no_checks" | "passed" | "skipped";
388
+ headSha: string;
389
+ observedHeadSha?: string | undefined;
390
+ mergeable?: "CONFLICTING" | "MERGEABLE" | "UNKNOWN" | undefined;
391
+ mergeStateStatus?: string | undefined;
392
+ mergedAt?: string | undefined;
393
+ mergeCommitSha?: string | undefined;
394
+ mergeBlock?: {
395
+ reason: "conflict" | "no_pending_merge";
396
+ isInMergeQueue: boolean;
397
+ autoMergeEnabled: boolean;
398
+ event?: {
399
+ kind: "auto_merge_disabled" | "queue_removal";
400
+ createdAt: string;
401
+ reason?: string | undefined;
402
+ reasonCode?: string | undefined;
403
+ } | undefined;
404
+ } | undefined;
405
+ observedAt: string;
406
+ checks: {
407
+ name: string;
408
+ state: string;
409
+ link: string;
410
+ }[];
411
+ totalChecks: number;
412
+ truncated: boolean;
413
+ diagnostic?: string | undefined;
414
+ } | undefined;
415
+ } | {
416
+ id: string;
417
+ source: "agent" | "cezar";
418
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
419
+ registeredAt: string;
420
+ phase: "cancelled" | "delivered" | "open" | "resolved";
421
+ resolvedAt?: string | undefined;
422
+ deliveredAt?: string | undefined;
423
+ cancelledAt?: string | undefined;
424
+ turnId: string;
425
+ kind: "timer";
426
+ deadline: string;
427
+ seconds: number;
428
+ note?: string | undefined;
429
+ } | {
430
+ id: string;
431
+ source: "agent" | "cezar";
432
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
433
+ registeredAt: string;
434
+ phase: "cancelled" | "delivered" | "open" | "resolved";
435
+ resolvedAt?: string | undefined;
436
+ deliveredAt?: string | undefined;
437
+ cancelledAt?: string | undefined;
438
+ turnId: string;
439
+ kind: "human";
440
+ questions?: {
441
+ id?: string | undefined;
442
+ header: string;
443
+ question: string;
444
+ options?: {
445
+ label: string;
446
+ description?: string | undefined;
447
+ }[] | undefined;
448
+ multiSelect?: boolean | undefined;
449
+ }[] | undefined;
450
+ context?: string | undefined;
451
+ askSeq?: number | undefined;
452
+ } | {
453
+ id: string;
454
+ source: "agent" | "cezar";
455
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
456
+ registeredAt: string;
457
+ phase: "cancelled" | "delivered" | "open" | "resolved";
458
+ resolvedAt?: string | undefined;
459
+ deliveredAt?: string | undefined;
460
+ cancelledAt?: string | undefined;
461
+ turnId: string;
462
+ kind: "worker";
463
+ deadline?: string | undefined;
464
+ timeoutSeconds?: number | undefined;
465
+ mode?: "all" | "any" | "one" | undefined;
466
+ workerIds?: string[] | undefined;
467
+ revisions?: {
468
+ workerId: string;
469
+ revision: number;
470
+ }[] | undefined;
471
+ outcomes?: {
472
+ workerId: string;
473
+ status: "cancelled" | "done" | "failed" | "review";
474
+ observedAt: string;
475
+ summary?: string | undefined;
476
+ revision?: number | undefined;
477
+ }[] | undefined;
478
+ requestIds?: string[] | undefined;
479
+ requestOutcomes?: {
480
+ requestId: string;
481
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
482
+ observedAt: string;
483
+ replyId?: string | undefined;
484
+ }[] | undefined;
485
+ result?: {
486
+ reason: "outcome" | "timeout";
487
+ } | undefined;
488
+ wakeInputId?: string | undefined;
489
+ } | {
490
+ id: string;
491
+ source: "agent" | "cezar";
492
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
493
+ registeredAt: string;
494
+ phase: "cancelled" | "delivered" | "open" | "resolved";
495
+ resolvedAt?: string | undefined;
496
+ deliveredAt?: string | undefined;
497
+ cancelledAt?: string | undefined;
498
+ turnId: string;
499
+ kind: "process";
500
+ deadline: string;
501
+ timeoutSeconds: number;
502
+ pid: number;
503
+ startToken?: string | undefined;
504
+ exitFile?: string | undefined;
505
+ note?: string | undefined;
506
+ result?: {
507
+ outcome: "deadline" | "error" | "exit_file" | "exited";
508
+ observedAt: string;
509
+ exitCode?: number | undefined;
510
+ exitFileNote?: "not-an-exit-code" | undefined;
511
+ diagnostic?: string | undefined;
512
+ } | undefined;
513
+ } | {
514
+ id: string;
515
+ source: "agent" | "cezar";
516
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
517
+ registeredAt: string;
518
+ phase: "cancelled" | "delivered" | "open" | "resolved";
519
+ resolvedAt?: string | undefined;
520
+ deliveredAt?: string | undefined;
521
+ cancelledAt?: string | undefined;
522
+ turnId: string;
523
+ kind: "peer";
524
+ deadline: string;
525
+ timeoutSeconds: number;
526
+ peerIds: string[];
527
+ result?: {
528
+ reason: "message";
529
+ peerRunId: string;
530
+ messageId: string;
531
+ } | {
532
+ reason: "settled";
533
+ peerRunId: string;
534
+ } | {
535
+ reason: "timeout";
536
+ } | undefined;
537
+ } | {
538
+ id: string;
539
+ registeredAt: string;
540
+ phase: "cancelled" | "delivered" | "open" | "resolved";
541
+ resolvedAt?: string | undefined;
542
+ deliveredAt?: string | undefined;
543
+ cancelledAt?: string | undefined;
544
+ turnId: string;
545
+ kind: "subagent";
546
+ source: "cezar";
547
+ via: "native-subagents";
548
+ deadline: string;
549
+ children: {
550
+ id: string;
551
+ status: "cancelled" | "completed" | "failed" | "running";
552
+ }[];
553
+ result?: {
554
+ reason: "interrupted" | "settled" | "superseded" | "timeout";
555
+ } | undefined;
556
+ };
557
+ deduplicated: boolean;
558
+ }[] | undefined;
559
+ lastWaits?: ({
560
+ prUrl: string;
561
+ repository: string;
562
+ prNumber: number;
563
+ headSha: string;
564
+ id: string;
565
+ source: "agent" | "cezar";
566
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
567
+ registeredAt: string;
568
+ phase: "cancelled" | "delivered" | "open" | "resolved";
569
+ resolvedAt?: string | undefined;
570
+ deliveredAt?: string | undefined;
571
+ cancelledAt?: string | undefined;
572
+ turnId: string;
573
+ kind: "pr";
574
+ deadline: string;
575
+ generation: string;
576
+ timeoutSeconds: number;
577
+ until: "checks" | "merge" | "merge_or_blocked";
578
+ wakeOnConflict: boolean;
579
+ result?: {
580
+ outcome: "blocked" | "cancelled" | "closed" | "conflicting" | "deadline" | "error" | "failed" | "head_changed" | "merged" | "no_checks" | "passed" | "skipped";
581
+ headSha: string;
582
+ observedHeadSha?: string | undefined;
583
+ mergeable?: "CONFLICTING" | "MERGEABLE" | "UNKNOWN" | undefined;
584
+ mergeStateStatus?: string | undefined;
585
+ mergedAt?: string | undefined;
586
+ mergeCommitSha?: string | undefined;
587
+ mergeBlock?: {
588
+ reason: "conflict" | "no_pending_merge";
589
+ isInMergeQueue: boolean;
590
+ autoMergeEnabled: boolean;
591
+ event?: {
592
+ kind: "auto_merge_disabled" | "queue_removal";
593
+ createdAt: string;
594
+ reason?: string | undefined;
595
+ reasonCode?: string | undefined;
596
+ } | undefined;
597
+ } | undefined;
598
+ observedAt: string;
599
+ checks: {
600
+ name: string;
601
+ state: string;
602
+ link: string;
603
+ }[];
604
+ totalChecks: number;
605
+ truncated: boolean;
606
+ diagnostic?: string | undefined;
607
+ } | undefined;
608
+ } | {
609
+ id: string;
610
+ source: "agent" | "cezar";
611
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
612
+ registeredAt: string;
613
+ phase: "cancelled" | "delivered" | "open" | "resolved";
614
+ resolvedAt?: string | undefined;
615
+ deliveredAt?: string | undefined;
616
+ cancelledAt?: string | undefined;
617
+ turnId: string;
618
+ kind: "timer";
619
+ deadline: string;
620
+ seconds: number;
621
+ note?: string | undefined;
622
+ } | {
623
+ id: string;
624
+ source: "agent" | "cezar";
625
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
626
+ registeredAt: string;
627
+ phase: "cancelled" | "delivered" | "open" | "resolved";
628
+ resolvedAt?: string | undefined;
629
+ deliveredAt?: string | undefined;
630
+ cancelledAt?: string | undefined;
631
+ turnId: string;
632
+ kind: "human";
633
+ questions?: {
634
+ id?: string | undefined;
635
+ header: string;
636
+ question: string;
637
+ options?: {
638
+ label: string;
639
+ description?: string | undefined;
640
+ }[] | undefined;
641
+ multiSelect?: boolean | undefined;
642
+ }[] | undefined;
643
+ context?: string | undefined;
644
+ askSeq?: number | undefined;
645
+ } | {
646
+ id: string;
647
+ source: "agent" | "cezar";
648
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
649
+ registeredAt: string;
650
+ phase: "cancelled" | "delivered" | "open" | "resolved";
651
+ resolvedAt?: string | undefined;
652
+ deliveredAt?: string | undefined;
653
+ cancelledAt?: string | undefined;
654
+ turnId: string;
655
+ kind: "worker";
656
+ deadline?: string | undefined;
657
+ timeoutSeconds?: number | undefined;
658
+ mode?: "all" | "any" | "one" | undefined;
659
+ workerIds?: string[] | undefined;
660
+ revisions?: {
661
+ workerId: string;
662
+ revision: number;
663
+ }[] | undefined;
664
+ outcomes?: {
665
+ workerId: string;
666
+ status: "cancelled" | "done" | "failed" | "review";
667
+ observedAt: string;
668
+ summary?: string | undefined;
669
+ revision?: number | undefined;
670
+ }[] | undefined;
671
+ requestIds?: string[] | undefined;
672
+ requestOutcomes?: {
673
+ requestId: string;
674
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
675
+ observedAt: string;
676
+ replyId?: string | undefined;
677
+ }[] | undefined;
678
+ result?: {
679
+ reason: "outcome" | "timeout";
680
+ } | undefined;
681
+ wakeInputId?: string | undefined;
682
+ } | {
683
+ id: string;
684
+ source: "agent" | "cezar";
685
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
686
+ registeredAt: string;
687
+ phase: "cancelled" | "delivered" | "open" | "resolved";
688
+ resolvedAt?: string | undefined;
689
+ deliveredAt?: string | undefined;
690
+ cancelledAt?: string | undefined;
691
+ turnId: string;
692
+ kind: "process";
693
+ deadline: string;
694
+ timeoutSeconds: number;
695
+ pid: number;
696
+ startToken?: string | undefined;
697
+ exitFile?: string | undefined;
698
+ note?: string | undefined;
699
+ result?: {
700
+ outcome: "deadline" | "error" | "exit_file" | "exited";
701
+ observedAt: string;
702
+ exitCode?: number | undefined;
703
+ exitFileNote?: "not-an-exit-code" | undefined;
704
+ diagnostic?: string | undefined;
705
+ } | undefined;
706
+ } | {
707
+ id: string;
708
+ source: "agent" | "cezar";
709
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
710
+ registeredAt: string;
711
+ phase: "cancelled" | "delivered" | "open" | "resolved";
712
+ resolvedAt?: string | undefined;
713
+ deliveredAt?: string | undefined;
714
+ cancelledAt?: string | undefined;
715
+ turnId: string;
716
+ kind: "peer";
717
+ deadline: string;
718
+ timeoutSeconds: number;
719
+ peerIds: string[];
720
+ result?: {
721
+ reason: "message";
722
+ peerRunId: string;
723
+ messageId: string;
724
+ } | {
725
+ reason: "settled";
726
+ peerRunId: string;
727
+ } | {
728
+ reason: "timeout";
729
+ } | undefined;
730
+ } | {
731
+ id: string;
732
+ registeredAt: string;
733
+ phase: "cancelled" | "delivered" | "open" | "resolved";
734
+ resolvedAt?: string | undefined;
735
+ deliveredAt?: string | undefined;
736
+ cancelledAt?: string | undefined;
737
+ turnId: string;
738
+ kind: "subagent";
739
+ source: "cezar";
740
+ via: "native-subagents";
741
+ deadline: string;
742
+ children: {
743
+ id: string;
744
+ status: "cancelled" | "completed" | "failed" | "running";
745
+ }[];
746
+ result?: {
747
+ reason: "interrupted" | "settled" | "superseded" | "timeout";
748
+ } | undefined;
749
+ })[] | undefined;
750
+ previewServers?: {
751
+ port: number;
752
+ command: string;
753
+ cwd?: string | undefined;
754
+ label: string;
755
+ path?: string | undefined;
756
+ registeredAt: string;
757
+ answeredAtRegistration: boolean;
758
+ }[] | undefined;
759
+ taskImages?: string[] | undefined;
760
+ model?: string | undefined;
761
+ effort?: string | undefined;
762
+ modelIdentity?: string | undefined;
763
+ agentProfile?: string | undefined;
764
+ systemPrompt?: string | undefined;
765
+ generateFollowups?: boolean | undefined;
766
+ autonomous?: boolean | undefined;
767
+ completionAction?: {
768
+ id: string;
769
+ phase: "blocked" | "complete" | "pending";
770
+ message?: string | undefined;
771
+ } | undefined;
772
+ archiveBlocker?: {
773
+ message: string;
774
+ runId?: string | undefined;
775
+ pullRequestUrl?: string | undefined;
776
+ } | undefined;
777
+ status: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
778
+ createdAt: string;
779
+ startedAt?: string | undefined;
780
+ finishedAt?: string | undefined;
781
+ tokensUsed: number;
782
+ inputTokens?: number | undefined;
783
+ outputTokens?: number | undefined;
784
+ costUsd?: number | undefined;
785
+ pullRequestUrl?: string | undefined;
786
+ referencedPullRequestUrl?: string | undefined;
787
+ prNumber?: number | undefined;
788
+ issueNumber?: number | undefined;
789
+ referencedIssueNumberSeeded?: boolean | undefined;
790
+ titleOrigin?: "auto" | "marker" | "user" | undefined;
791
+ markerRefs?: {
792
+ pr?: number | undefined;
793
+ issue?: number | undefined;
794
+ } | undefined;
795
+ referencedPrCandidates?: string[] | undefined;
796
+ referencedIssueUrl?: string | undefined;
797
+ referencedIssueCandidates?: string[] | undefined;
798
+ worktree?: false | undefined;
799
+ worktreePath?: string | undefined;
800
+ branch?: string | undefined;
801
+ baseBranch?: string | undefined;
802
+ worktreeReclaimedAt?: string | undefined;
803
+ groupId?: string | undefined;
804
+ variant?: string | undefined;
805
+ clientRequestId?: string | undefined;
806
+ clientRequestHash?: string | undefined;
807
+ peakRssBytes?: number | undefined;
808
+ peakProcCount?: number | undefined;
809
+ archivedAt?: string | undefined;
810
+ autoArchive?: {
811
+ reason: "pull-requests-merged";
812
+ archivedAt: string;
813
+ fingerprint: string;
814
+ pullRequests: {
815
+ owner: string;
816
+ repo: string;
817
+ number: number;
818
+ mergedAt: string;
819
+ }[];
820
+ } | undefined;
821
+ manualUnarchivedAt?: string | undefined;
822
+ pinned?: boolean | undefined;
823
+ pinnedAt?: string | undefined;
824
+ seenAt?: string | undefined;
825
+ currentStepId?: string | undefined;
826
+ error?: string | undefined;
827
+ delegation?: {
828
+ role: "root";
829
+ conversation?: {
830
+ messages: {
831
+ senderRunId: string;
832
+ recipientRunId: string;
833
+ kind: "follow-up" | "progress" | "reply" | "request";
834
+ requestId?: string | undefined;
835
+ relationship?: "family" | "peer" | undefined;
836
+ id: string;
837
+ text: string;
838
+ createdAt: string;
839
+ deadline?: string | undefined;
840
+ requestHash: string;
841
+ state: "accepted" | "continuation-required" | "destroyed" | "late";
842
+ resumed?: true | undefined;
843
+ instruction?: string | undefined;
844
+ question?: {
845
+ context?: string | undefined;
846
+ questions: {
847
+ id?: string | undefined;
848
+ header: string;
849
+ question: string;
850
+ options?: {
851
+ label: string;
852
+ description?: string | undefined;
853
+ }[] | undefined;
854
+ multiSelect?: boolean | undefined;
855
+ }[];
856
+ } | undefined;
857
+ }[];
858
+ outcomes: {
859
+ requestId: string;
860
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
861
+ observedAt: string;
862
+ replyId?: string | undefined;
863
+ }[];
864
+ } | undefined;
865
+ permissions: ("destroy" | "diff" | "inspect" | "spawn" | "steer" | "stop" | "wait")[];
866
+ receipts: {
867
+ requestId: string;
868
+ workerId: string;
869
+ requestHash: string;
870
+ deletion?: {
871
+ phase: "complete" | "pending";
872
+ revision: number;
873
+ resourceId: string;
874
+ generation: string;
875
+ } | undefined;
876
+ }[];
877
+ wait?: {
878
+ id: string;
879
+ workerIds: string[];
880
+ requestIds?: string[] | undefined;
881
+ requestOutcomes?: {
882
+ requestId: string;
883
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
884
+ observedAt: string;
885
+ replyId?: string | undefined;
886
+ }[] | undefined;
887
+ deadline: string;
888
+ mode?: "all" | "any" | "one" | undefined;
889
+ revisions?: {
890
+ workerId: string;
891
+ revision: number;
892
+ }[] | undefined;
893
+ reason?: "cancelled" | "message" | "outcome" | "timeout" | undefined;
894
+ phase: "parked" | "registered" | "wake-pending";
895
+ outcomes: {
896
+ workerId: string;
897
+ status: "cancelled" | "done" | "failed" | "review";
898
+ observedAt: string;
899
+ summary?: string | undefined;
900
+ revision?: number | undefined;
901
+ }[];
902
+ wakeId?: string | undefined;
903
+ } | undefined;
904
+ lastWait?: {
905
+ id: string;
906
+ workerIds: string[];
907
+ requestIds?: string[] | undefined;
908
+ requestOutcomes?: {
909
+ requestId: string;
910
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
911
+ observedAt: string;
912
+ replyId?: string | undefined;
913
+ }[] | undefined;
914
+ deadline: string;
915
+ mode?: "all" | "any" | "one" | undefined;
916
+ revisions?: {
917
+ workerId: string;
918
+ revision: number;
919
+ }[] | undefined;
920
+ reason?: "cancelled" | "message" | "outcome" | "timeout" | undefined;
921
+ phase: "parked" | "registered" | "wake-pending";
922
+ outcomes: {
923
+ workerId: string;
924
+ status: "cancelled" | "done" | "failed" | "review";
925
+ observedAt: string;
926
+ summary?: string | undefined;
927
+ revision?: number | undefined;
928
+ }[];
929
+ wakeId?: string | undefined;
930
+ } | undefined;
931
+ results?: {
932
+ workerId: string;
933
+ revision: number;
934
+ snapshotId: string;
935
+ observedAt: string;
936
+ lastExecutionOutcome: "cancelled" | "completed" | "failed" | "review-ready" | "running";
937
+ previous?: {
938
+ revision: number;
939
+ observedAt: string;
940
+ lastExecutionOutcome: "cancelled" | "completed" | "failed" | "review-ready" | "running";
941
+ } | undefined;
942
+ }[] | undefined;
943
+ finishRequestedAt?: string | undefined;
944
+ historyDeletion?: "pending" | undefined;
945
+ completion?: {
946
+ phase: "attention" | "waiting";
947
+ waitId?: string | undefined;
948
+ } | undefined;
949
+ } | {
950
+ role: "worker";
951
+ wait?: {
952
+ id: string;
953
+ workerIds: string[];
954
+ requestIds?: string[] | undefined;
955
+ requestOutcomes?: {
956
+ requestId: string;
957
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
958
+ observedAt: string;
959
+ replyId?: string | undefined;
960
+ }[] | undefined;
961
+ deadline: string;
962
+ mode?: "all" | "any" | "one" | undefined;
963
+ revisions?: {
964
+ workerId: string;
965
+ revision: number;
966
+ }[] | undefined;
967
+ reason?: "cancelled" | "message" | "outcome" | "timeout" | undefined;
968
+ phase: "parked" | "registered" | "wake-pending";
969
+ outcomes: {
970
+ workerId: string;
971
+ status: "cancelled" | "done" | "failed" | "review";
972
+ observedAt: string;
973
+ summary?: string | undefined;
974
+ revision?: number | undefined;
975
+ }[];
976
+ wakeId?: string | undefined;
977
+ } | undefined;
978
+ lastWait?: {
979
+ id: string;
980
+ workerIds: string[];
981
+ requestIds?: string[] | undefined;
982
+ requestOutcomes?: {
983
+ requestId: string;
984
+ status: "cancelled" | "completed-without-reply" | "deleted" | "destroyed" | "failed" | "human-fallback" | "replied" | "replied-late" | "sender-closed" | "timed-out";
985
+ observedAt: string;
986
+ replyId?: string | undefined;
987
+ }[] | undefined;
988
+ deadline: string;
989
+ mode?: "all" | "any" | "one" | undefined;
990
+ revisions?: {
991
+ workerId: string;
992
+ revision: number;
993
+ }[] | undefined;
994
+ reason?: "cancelled" | "message" | "outcome" | "timeout" | undefined;
995
+ phase: "parked" | "registered" | "wake-pending";
996
+ outcomes: {
997
+ workerId: string;
998
+ status: "cancelled" | "done" | "failed" | "review";
999
+ observedAt: string;
1000
+ summary?: string | undefined;
1001
+ revision?: number | undefined;
1002
+ }[];
1003
+ wakeId?: string | undefined;
1004
+ } | undefined;
1005
+ permissions: ("destroy" | "diff" | "inspect" | "spawn" | "steer" | "stop" | "wait")[];
1006
+ parentRunId: string;
1007
+ workspace: {
1008
+ ownerRunId: string;
1009
+ resourceId: string;
1010
+ kind: "owned-isolated";
1011
+ path: string;
1012
+ branch: string;
1013
+ baselineSha: string;
1014
+ };
1015
+ destroy?: {
1016
+ requestedAt: string;
1017
+ phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
1018
+ remaining: ("branch" | "process" | "worktree")[];
1019
+ error?: string | undefined;
1020
+ } | undefined;
1021
+ context?: {
1022
+ text?: string | undefined;
1023
+ inputs: {
1024
+ source: {
1025
+ kind: "parent-file";
1026
+ path: string;
1027
+ } | {
1028
+ kind: "baseline-file";
1029
+ path: string;
1030
+ } | {
1031
+ kind: "parent-attachment";
1032
+ id: string;
1033
+ };
1034
+ path: string;
1035
+ sha256: string;
1036
+ bytes: number;
1037
+ }[];
1038
+ } | undefined;
1039
+ executionRevision?: number | undefined;
1040
+ executionStartSeq?: number | undefined;
1041
+ } | {
1042
+ role: "invalid";
1043
+ } | undefined;
1044
+ lastWaitsError?: string | undefined;
1045
+ automaticWakes?: number | undefined;
1046
+ waitDeliveryFailures?: number | undefined;
1047
+ runner?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1048
+ notify?: boolean | undefined;
1049
+ webhook?: {
1050
+ lastDeliveredAt?: string | undefined;
1051
+ lastError?: string | undefined;
1052
+ lastErrorWebhookId?: string | undefined;
1053
+ } | undefined;
1054
+ destroyRetry?: {
1055
+ attempts: number;
1056
+ nextAt: string;
1057
+ needsAttention?: true | undefined;
1058
+ } | undefined;
1059
+ stopping?: boolean | undefined;
1060
+ hasPendingPermission?: boolean | undefined;
1061
+ autoResumeAt?: string | undefined;
1062
+ autoResumeAttempts?: number | undefined;
1063
+ pullRequests?: {
1064
+ number: number;
1065
+ url?: string | undefined;
1066
+ source: "created" | "declared";
1067
+ }[] | undefined;
1068
+ worktreeSetup?: {
1069
+ status: "done" | "failed" | "running";
1070
+ startedAt: string;
1071
+ finishedAt?: string | undefined;
1072
+ durationMs?: number | undefined;
1073
+ error?: string | undefined;
1074
+ } | undefined;
1075
+ archived: boolean;
1076
+ workflowDef?: {
1077
+ name: string;
1078
+ description?: string | undefined;
1079
+ steps: {
1080
+ id: string;
1081
+ name?: string | undefined;
1082
+ prompt?: string | undefined;
1083
+ skill?: string | undefined;
1084
+ model?: string | undefined;
1085
+ effort?: string | undefined;
1086
+ timeoutMs?: number | undefined;
1087
+ runner?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1088
+ agentProfile?: string | undefined;
1089
+ allowedTools?: string[] | undefined;
1090
+ bashAllowlist?: string[] | undefined;
1091
+ command?: string | undefined;
1092
+ onFail?: {
1093
+ retry: string;
1094
+ max: number;
1095
+ } | undefined;
1096
+ }[];
1097
+ source: "built-in" | "file";
1098
+ path?: string | undefined;
1099
+ } | undefined;
1100
+ steps: {
1101
+ id: string;
1102
+ name: string;
1103
+ kind: "agent" | "check";
1104
+ status: "cancelled" | "done" | "failed" | "pending" | "review" | "running" | "skipped" | "waiting";
1105
+ iterations: number;
1106
+ retriesUsed?: number | undefined;
1107
+ tokensUsed: number;
1108
+ inputTokens?: number | undefined;
1109
+ outputTokens?: number | undefined;
1110
+ usageInvocationsStarted?: number | undefined;
1111
+ usageInvocationsObserved?: number | undefined;
1112
+ usageTurnsStarted?: number | undefined;
1113
+ usageTurnsRecorded?: number | undefined;
1114
+ usageInvocationEpoch?: number | undefined;
1115
+ startedAt?: string | undefined;
1116
+ finishedAt?: string | undefined;
1117
+ error?: string | undefined;
1118
+ sessionId?: string | undefined;
1119
+ sessionTransport?: "cursor-acp" | "cursor-print" | undefined;
1120
+ profileId?: string | undefined;
1121
+ costUsd?: number | undefined;
1122
+ synthetic?: "continuation" | undefined;
1123
+ backend?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1124
+ }[];
1125
+ automation?: {
1126
+ automationId: string;
1127
+ receiptId: string;
1128
+ event: string;
1129
+ automationRevision: number;
1130
+ githubUrl: string;
1131
+ } | undefined;
1132
+ automationTrigger?: {
1133
+ automationId: string;
1134
+ receiptId: string;
1135
+ trigger: "catch-up" | "manual" | "schedule";
1136
+ occurrenceAt: string;
1137
+ automationRevision: number;
1138
+ } | undefined;
1139
+ handoffRecords?: {
1140
+ autosave: {
1141
+ at: string;
1142
+ note: string;
1143
+ periodic?: {
1144
+ branch: string | null;
1145
+ count: number;
1146
+ first: string | null;
1147
+ latest: string | null;
1148
+ } | undefined;
1149
+ }[];
1150
+ } | undefined;
1151
+ } | undefined): ExitFileRoots;
1152
+ /** Start what resolves an open wait: the watch adapter its row names. An overdue deadline
1153
+ * (restart) resolves at once. */
1154
+ private armWait;
1155
+ /** A timer, peer or subagent deadline. Native subagents live only in their session: with none,
1156
+ * as at a restart, they stopped (hearsay-tools/cezarion#2431). At its deadline a lost session
1157
+ * reads the same. */
1158
+ private armDeadline;
1159
+ /**
1160
+ * A worker wait's deadline re-observes its family (hearsay-tools/cezarion#1235): the reconcile
1161
+ * resolves it with `timeout`, keeping any outcome observed by then. A failed checkpoint is
1162
+ * retried every second while the wait is still open, never dropped as an uncaught error. An
1163
+ * outcome whose resolution failed to commit arms the same retry with `firstDelay` 1 second.
1164
+ */
1165
+ private armWorkerDeadline;
1166
+ /** Stop everything that could still resolve this wait. */
1167
+ private disarmWait;
1168
+ /**
1169
+ * Watch a process wait's command (hearsay-tools/cezarion#1446). Like a timer, its wake is the
1170
+ * agent's own arrangement: a stopping, stopped or finishing run takes none, and the wait stays
1171
+ * open for that transition to cancel.
1172
+ */
1173
+ private startProcessWatch;
1174
+ private startCiWatch;
1175
+ /** `resolveWait`, retried while its durable checkpoint is unavailable: a failed write may not
1176
+ * drop the accepted intent or publish a false result. */
1177
+ settleWait(runId: string, waitId: string, result?: WaitResult): void;
1178
+ private disarmRun;
1179
+ /** Re-arm the caller's recovery snapshot. Do not re-read between waits: an overdue
1180
+ * deadline can resolve synchronously, but the remaining snapshot entries still arm. */
1181
+ rearm(run: RunRecord): void;
1182
+ disposeWatches(): void;
1183
+ disposeRetries(): void;
1184
+ dispose(): void;
1185
+ /** The open peer waits of these runs whose named peer already wrote, settled or was deleted resolve now. */
1186
+ resolvePeerWaits(runIds: readonly string[]): void;
1187
+ /** Like a timer, the wake is the agent's own arrangement: a stopping or finishing run takes none,
1188
+ * and the wait stays for that transition to cancel. True when the wait is no longer open. */
1189
+ private resolvePeerWait;
1190
+ /** Commit an open wait as resolved together with its lifecycle input (id = wait id, or an
1191
+ * upgraded worker wait's `wakeInputId`), then queue the run's wake. A worker wait passes the
1192
+ * entry as reconciled, with its outcomes and `result`. Throws when the checkpoint fails; a wait
1193
+ * no longer open is ignored. */
1194
+ resolveWait(runId: string, waitId: string, result?: WaitResult, observed?: WorkerWaitEntry): void;
1195
+ /** A worker's current status, as a worker wait's result names it. */
1196
+ readonly workerStatus: (workerId: string) => string;
1197
+ resolveWorkerWait(runId: string, entry: WorkerWaitEntry, observed: WorkerWaitEntry): boolean;
1198
+ /** Keep watches armed until cancellation is durable. A skipped write disarms nothing. */
1199
+ cancel(runId: string, ids: readonly string[], opts?: CancelWaitsOptions): Wait[];
1200
+ /**
1201
+ * Cancel every open or resolved wait of a run without waking the agent: stop, Finish, cancel,
1202
+ * deletion, DONE and any terminal status. Human input cancels none (hearsay-tools/cezarion#1233).
1203
+ * A failed commit leaves the record as a crash would and never stops the disarm, so Stop still
1204
+ * reaches the session when the store is closed or broken (hearsay-tools/cezarion#1234).
1205
+ */
1206
+ cancelAll(runId: string): void;
1207
+ /** Stop every watch, timer, retry and queued wake a run's waits hold in memory. */
1208
+ forgetRun(runId: string): void;
51
1209
  }
52
1210
  export {};