@knpkv/herdr-fleet 0.3.0 → 0.5.0

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.
package/dist/service.d.ts CHANGED
@@ -1,15 +1,60 @@
1
- import { Crypto, Effect } from "effect";
2
- import { FleetApprovalError, FleetJobNotFoundError, FleetOperationError, FleetStoreError, FleetTransitionConflictError, FleetValidationError } from "./errors.js";
3
- import { type AgentDelegate, type AgentInventory, type AgentWorkerIdentity, type CoreJobPayload, type HostDetails, type JobHash, type LocalJobPayload } from "./model.js";
1
+ import { Crypto, Effect, Schema } from "effect";
2
+ import { FleetApprovalError, FleetJobNotFoundError, FleetOperationError, FleetOperationUnavailableError, FleetStoreError, FleetTransitionConflictError, FleetValidationError } from "./errors.js";
3
+ import { type AgentDelegate, type AgentInventory, type AgentWorkerIdentity, type CoreJobPayload, type HostDetails, JobActor, type JobHash, type LocalJobPayload, type SubmissionProvenance, type WorkJobKind } from "./model.js";
4
4
  import type { JobStore } from "./store.js";
5
5
  export type { AgentInventory, AgentSummary, HostDetails } from "./model.js";
6
6
  export type WorkerStarted = (identity: AgentWorkerIdentity) => Effect.Effect<void, FleetOperationError>;
7
+ export declare const hostOperationTerminalDetailMaxLength = 20000;
8
+ export declare const HostOperationTerminal: Schema.Union<readonly [Schema.Struct<{
9
+ readonly type: Schema.Literal<"settled">;
10
+ readonly detail: Schema.String;
11
+ }>, Schema.Struct<{
12
+ readonly type: Schema.Literal<"delivery_failed">;
13
+ readonly detail: Schema.String;
14
+ }>, Schema.Struct<{
15
+ readonly type: Schema.Literal<"task_failed">;
16
+ readonly detail: Schema.String;
17
+ }>]>;
18
+ export type HostOperationTerminal = typeof HostOperationTerminal.Type;
19
+ /** Projects an authoritative coordinator detail into Fleet's bounded summary. */
20
+ export declare const summarizeHostOperationTerminalDetail: (detail: string) => string;
21
+ export type HostOperationLifecycle = {
22
+ /** Persists a durable receipt while the fleet job remains running. */
23
+ readonly accepted: (receipt: string) => Effect.Effect<void, FleetOperationError>;
24
+ /** Mirrors the authoritative durable terminal event into the fleet job. */
25
+ readonly terminal: (event: HostOperationTerminal) => Effect.Effect<void, FleetOperationError>;
26
+ };
27
+ export type ResumeHostOperation = (payload: CoreJobPayload, workerStarted: WorkerStarted, jobId: string, actor: JobActor, receipt: string | null, lifecycle: HostOperationLifecycle, persistedWorker: AgentWorkerIdentity | null) => Effect.Effect<void, FleetOperationError>;
28
+ export type HostOperationRecovery = {
29
+ /** Identifies operations whose deterministic Fleet job ID is their durable submission identity. */
30
+ readonly matches: (payload: CoreJobPayload) => boolean;
31
+ /**
32
+ * Rejoins or idempotently completes submission, including before Fleet persisted a receipt.
33
+ * A running job's exact persisted worker is supplied for authoritative replay without discovery.
34
+ * It must attach observation in its owning scope and return without waiting for terminal work.
35
+ */
36
+ readonly resume: ResumeHostOperation;
37
+ };
7
38
  export type HostOperations = {
8
39
  readonly listAgents: () => Effect.Effect<AgentInventory, FleetOperationError>;
9
40
  readonly inspect: () => Effect.Effect<HostDetails, FleetOperationError>;
10
- readonly run: (payload: CoreJobPayload, workerStarted: WorkerStarted, jobId: string) => Effect.Effect<string, FleetOperationError>;
41
+ readonly run: (payload: CoreJobPayload, workerStarted: WorkerStarted, jobId: string, actor: JobActor, lifecycle: HostOperationLifecycle, approval?: ApprovedJobIdentity | null) => Effect.Effect<string, FleetOperationError>;
11
42
  readonly runLocal: (payload: LocalJobPayload) => Effect.Effect<string, FleetOperationError>;
12
- readonly runCoordinatorChat: (payload: AgentDelegate, workerStarted: WorkerStarted, jobId: string) => Effect.Effect<string, FleetOperationError>;
43
+ readonly runCoordinatorChat: (payload: AgentDelegate, workerStarted: WorkerStarted, jobId: string, actor: JobActor, lifecycle: HostOperationLifecycle) => Effect.Effect<string, FleetOperationError>;
44
+ /** Explicit crash recovery for operations backed by another durable store. */
45
+ readonly recovery?: HostOperationRecovery;
46
+ /**
47
+ * Work job kinds this host's composed Work adapter executes. Submission
48
+ * refuses every other Work kind before an approval request exists; absent
49
+ * means the host executes none.
50
+ */
51
+ readonly workJobKinds?: ReadonlySet<WorkJobKind>;
52
+ };
53
+ /** Persisted Fleet approval, distinct from the job's submitting actor. */
54
+ export type ApprovedJobIdentity = {
55
+ readonly approvedBy: string;
56
+ readonly approvedAt: number;
57
+ readonly hash: JobHash;
13
58
  };
14
59
  export type Approval = {
15
60
  readonly hash: JobHash;
@@ -29,24 +74,148 @@ type Options = {
29
74
  export declare const makeFleetService: (options: Options) => Effect.Effect<{
30
75
  submit: (request: {
31
76
  readonly payload: {
32
- readonly kind: "nix.check";
33
- } | {
34
- readonly kind: "nix.apply";
35
- readonly ref: string;
36
- } | {
37
77
  readonly kind: "agent.delegate";
38
78
  readonly repository: string;
39
79
  readonly prompt: string;
40
- readonly mode: "consult" | "review" | "work";
80
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
41
81
  readonly channel?: "coordinator_chat";
82
+ } | {
83
+ readonly kind: "work.reconcile";
84
+ readonly repository: string;
85
+ readonly pullRequest: number;
86
+ readonly goalId: string;
87
+ readonly laneId: string;
88
+ readonly operationId: string;
89
+ readonly expectedRevision: number;
90
+ readonly expectedHead: string;
91
+ readonly newHead: string;
92
+ readonly expectedOwner: {
93
+ readonly id: string;
94
+ readonly name: string;
95
+ };
96
+ readonly expectedGoalEventId: string;
97
+ readonly bindingDispatchRequestId: string;
98
+ readonly sessionId: string;
99
+ readonly expectedWork: string;
100
+ readonly worker: {
101
+ readonly host: string;
102
+ readonly agentId: string;
103
+ readonly name: string;
104
+ readonly paneId: string;
105
+ readonly relationship?: {
106
+ readonly parentAgentId: string;
107
+ readonly relation: "delegated" | "pair" | "review";
108
+ };
109
+ };
110
+ readonly worktree: string;
111
+ readonly branch: string;
112
+ } | {
113
+ readonly kind: "work.admit";
114
+ readonly repository: string;
115
+ readonly pullRequest: number;
116
+ readonly reviewUrl: string;
117
+ readonly goalId: string;
118
+ readonly laneId: string;
119
+ readonly operationId: string;
120
+ readonly expectedAbsenceToken: string;
121
+ readonly head: string;
122
+ readonly baseHead: string;
123
+ readonly owner: {
124
+ readonly id: string;
125
+ readonly name: string;
126
+ };
127
+ readonly sessionId: string;
128
+ readonly expectedWork: string;
129
+ readonly worker: {
130
+ readonly host: string;
131
+ readonly agentId: string;
132
+ readonly name: string;
133
+ readonly paneId: string;
134
+ readonly relationship?: {
135
+ readonly parentAgentId: string;
136
+ readonly relation: "delegated" | "pair" | "review";
137
+ };
138
+ };
139
+ readonly worktree: string;
140
+ readonly branch: string;
141
+ readonly title: string;
142
+ readonly summary: string;
143
+ readonly detail: string;
144
+ } | {
145
+ readonly kind: "work.recover";
146
+ readonly repository: string;
147
+ readonly pullRequest: number;
148
+ readonly reviewUrl: string;
149
+ readonly goalId: string;
150
+ readonly laneId: string;
151
+ readonly operationId: string;
152
+ readonly expectedGoalEventId: string;
153
+ readonly expectedGoalUpdatedAt: number;
154
+ readonly expectedHistoryToken: string;
155
+ readonly head: string;
156
+ readonly baseHead: string;
157
+ readonly owner: {
158
+ readonly id: string;
159
+ readonly name: string;
160
+ };
161
+ readonly sessionId: string;
162
+ readonly expectedWork: string;
163
+ readonly worker: {
164
+ readonly host: string;
165
+ readonly agentId: string;
166
+ readonly name: string;
167
+ readonly paneId: string;
168
+ readonly relationship?: {
169
+ readonly parentAgentId: string;
170
+ readonly relation: "delegated" | "pair" | "review";
171
+ };
172
+ };
173
+ readonly worktree: string;
174
+ readonly branch: string;
175
+ } | {
176
+ readonly kind: "work.reassign";
177
+ readonly goalId: string;
178
+ readonly from: {
179
+ readonly id: string;
180
+ readonly name: string;
181
+ };
182
+ readonly to: {
183
+ readonly id: string;
184
+ readonly name: string;
185
+ };
186
+ readonly toAgent: {
187
+ readonly _tag: "clear";
188
+ } | {
189
+ readonly _tag: "keep";
190
+ } | {
191
+ readonly _tag: "set";
192
+ readonly agent: {
193
+ readonly host: string;
194
+ readonly agentId: string;
195
+ readonly name: string;
196
+ readonly paneId: string;
197
+ readonly relationship?: {
198
+ readonly parentAgentId: string;
199
+ readonly relation: "delegated" | "pair" | "review";
200
+ };
201
+ };
202
+ };
203
+ readonly reason: string;
204
+ readonly expectedGoalEventId: string;
205
+ readonly expectedGoalUpdatedAt: number;
206
+ } | {
207
+ readonly kind: "browser.mcp.recover";
208
+ } | {
209
+ readonly kind: "nix.check";
210
+ } | {
211
+ readonly kind: "nix.apply";
212
+ readonly ref: string;
42
213
  } | {
43
214
  readonly kind: "agent.message";
44
215
  readonly session: string;
45
216
  readonly message: string;
46
- } | {
47
- readonly kind: "browser.mcp.recover";
48
217
  };
49
- }, actor: string) => Effect.Effect<{
218
+ }, actor: string, provenance?: SubmissionProvenance | undefined) => Effect.Effect<{
50
219
  readonly id: string;
51
220
  readonly createdAt: number;
52
221
  readonly updatedAt: number;
@@ -61,24 +230,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
61
230
  readonly expiredAt?: number | null;
62
231
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
63
232
  readonly payload: {
64
- readonly kind: "nix.check";
65
- } | {
66
- readonly kind: "nix.apply";
67
- readonly ref: string;
68
- } | {
69
233
  readonly kind: "agent.delegate";
70
234
  readonly repository: string;
71
235
  readonly prompt: string;
72
- readonly mode: "consult" | "review" | "work";
236
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
73
237
  readonly channel?: "coordinator_chat";
238
+ } | {
239
+ readonly kind: "work.reconcile";
240
+ readonly repository: string;
241
+ readonly pullRequest: number;
242
+ readonly goalId: string;
243
+ readonly laneId: string;
244
+ readonly operationId: string;
245
+ readonly expectedRevision: number;
246
+ readonly expectedHead: string;
247
+ readonly newHead: string;
248
+ readonly expectedOwner: {
249
+ readonly id: string;
250
+ readonly name: string;
251
+ };
252
+ readonly expectedGoalEventId: string;
253
+ readonly bindingDispatchRequestId: string;
254
+ readonly sessionId: string;
255
+ readonly expectedWork: string;
256
+ readonly worker: {
257
+ readonly host: string;
258
+ readonly agentId: string;
259
+ readonly name: string;
260
+ readonly paneId: string;
261
+ readonly relationship?: {
262
+ readonly parentAgentId: string;
263
+ readonly relation: "delegated" | "pair" | "review";
264
+ };
265
+ };
266
+ readonly worktree: string;
267
+ readonly branch: string;
268
+ } | {
269
+ readonly kind: "work.admit";
270
+ readonly repository: string;
271
+ readonly pullRequest: number;
272
+ readonly reviewUrl: string;
273
+ readonly goalId: string;
274
+ readonly laneId: string;
275
+ readonly operationId: string;
276
+ readonly expectedAbsenceToken: string;
277
+ readonly head: string;
278
+ readonly baseHead: string;
279
+ readonly owner: {
280
+ readonly id: string;
281
+ readonly name: string;
282
+ };
283
+ readonly sessionId: string;
284
+ readonly expectedWork: string;
285
+ readonly worker: {
286
+ readonly host: string;
287
+ readonly agentId: string;
288
+ readonly name: string;
289
+ readonly paneId: string;
290
+ readonly relationship?: {
291
+ readonly parentAgentId: string;
292
+ readonly relation: "delegated" | "pair" | "review";
293
+ };
294
+ };
295
+ readonly worktree: string;
296
+ readonly branch: string;
297
+ readonly title: string;
298
+ readonly summary: string;
299
+ readonly detail: string;
300
+ } | {
301
+ readonly kind: "work.recover";
302
+ readonly repository: string;
303
+ readonly pullRequest: number;
304
+ readonly reviewUrl: string;
305
+ readonly goalId: string;
306
+ readonly laneId: string;
307
+ readonly operationId: string;
308
+ readonly expectedGoalEventId: string;
309
+ readonly expectedGoalUpdatedAt: number;
310
+ readonly expectedHistoryToken: string;
311
+ readonly head: string;
312
+ readonly baseHead: string;
313
+ readonly owner: {
314
+ readonly id: string;
315
+ readonly name: string;
316
+ };
317
+ readonly sessionId: string;
318
+ readonly expectedWork: string;
319
+ readonly worker: {
320
+ readonly host: string;
321
+ readonly agentId: string;
322
+ readonly name: string;
323
+ readonly paneId: string;
324
+ readonly relationship?: {
325
+ readonly parentAgentId: string;
326
+ readonly relation: "delegated" | "pair" | "review";
327
+ };
328
+ };
329
+ readonly worktree: string;
330
+ readonly branch: string;
331
+ } | {
332
+ readonly kind: "work.reassign";
333
+ readonly goalId: string;
334
+ readonly from: {
335
+ readonly id: string;
336
+ readonly name: string;
337
+ };
338
+ readonly to: {
339
+ readonly id: string;
340
+ readonly name: string;
341
+ };
342
+ readonly toAgent: {
343
+ readonly _tag: "clear";
344
+ } | {
345
+ readonly _tag: "keep";
346
+ } | {
347
+ readonly _tag: "set";
348
+ readonly agent: {
349
+ readonly host: string;
350
+ readonly agentId: string;
351
+ readonly name: string;
352
+ readonly paneId: string;
353
+ readonly relationship?: {
354
+ readonly parentAgentId: string;
355
+ readonly relation: "delegated" | "pair" | "review";
356
+ };
357
+ };
358
+ };
359
+ readonly reason: string;
360
+ readonly expectedGoalEventId: string;
361
+ readonly expectedGoalUpdatedAt: number;
362
+ } | {
363
+ readonly kind: "browser.mcp.recover";
364
+ } | {
365
+ readonly kind: "nix.check";
366
+ } | {
367
+ readonly kind: "nix.apply";
368
+ readonly ref: string;
74
369
  } | {
75
370
  readonly kind: "agent.message";
76
371
  readonly session: string;
77
372
  readonly message: string;
78
- } | {
79
- readonly kind: "browser.mcp.recover";
80
373
  };
81
374
  readonly result: string | null;
375
+ readonly acceptedReceipt?: string | null;
376
+ readonly durableOperation?: true;
82
377
  readonly error: string | null;
83
378
  readonly worker?: {
84
379
  readonly host: string;
@@ -96,7 +391,7 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
96
391
  readonly url: string;
97
392
  };
98
393
  readonly workerTerminalObservedAt?: number | null;
99
- }, import("./errors.js").FleetJobConflictError | FleetOperationError | FleetStoreError | FleetValidationError, never>;
394
+ }, import("./errors.js").FleetJobConflictError | FleetOperationError | FleetOperationUnavailableError | FleetStoreError | FleetValidationError, never>;
100
395
  approve: (jobId: string, approval: Approval, actor: string) => Effect.Effect<{
101
396
  readonly id: string;
102
397
  readonly createdAt: number;
@@ -112,24 +407,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
112
407
  readonly expiredAt?: number | null;
113
408
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
114
409
  readonly payload: {
115
- readonly kind: "nix.check";
116
- } | {
117
- readonly kind: "nix.apply";
118
- readonly ref: string;
119
- } | {
120
410
  readonly kind: "agent.delegate";
121
411
  readonly repository: string;
122
412
  readonly prompt: string;
123
- readonly mode: "consult" | "review" | "work";
413
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
124
414
  readonly channel?: "coordinator_chat";
415
+ } | {
416
+ readonly kind: "work.reconcile";
417
+ readonly repository: string;
418
+ readonly pullRequest: number;
419
+ readonly goalId: string;
420
+ readonly laneId: string;
421
+ readonly operationId: string;
422
+ readonly expectedRevision: number;
423
+ readonly expectedHead: string;
424
+ readonly newHead: string;
425
+ readonly expectedOwner: {
426
+ readonly id: string;
427
+ readonly name: string;
428
+ };
429
+ readonly expectedGoalEventId: string;
430
+ readonly bindingDispatchRequestId: string;
431
+ readonly sessionId: string;
432
+ readonly expectedWork: string;
433
+ readonly worker: {
434
+ readonly host: string;
435
+ readonly agentId: string;
436
+ readonly name: string;
437
+ readonly paneId: string;
438
+ readonly relationship?: {
439
+ readonly parentAgentId: string;
440
+ readonly relation: "delegated" | "pair" | "review";
441
+ };
442
+ };
443
+ readonly worktree: string;
444
+ readonly branch: string;
445
+ } | {
446
+ readonly kind: "work.admit";
447
+ readonly repository: string;
448
+ readonly pullRequest: number;
449
+ readonly reviewUrl: string;
450
+ readonly goalId: string;
451
+ readonly laneId: string;
452
+ readonly operationId: string;
453
+ readonly expectedAbsenceToken: string;
454
+ readonly head: string;
455
+ readonly baseHead: string;
456
+ readonly owner: {
457
+ readonly id: string;
458
+ readonly name: string;
459
+ };
460
+ readonly sessionId: string;
461
+ readonly expectedWork: string;
462
+ readonly worker: {
463
+ readonly host: string;
464
+ readonly agentId: string;
465
+ readonly name: string;
466
+ readonly paneId: string;
467
+ readonly relationship?: {
468
+ readonly parentAgentId: string;
469
+ readonly relation: "delegated" | "pair" | "review";
470
+ };
471
+ };
472
+ readonly worktree: string;
473
+ readonly branch: string;
474
+ readonly title: string;
475
+ readonly summary: string;
476
+ readonly detail: string;
477
+ } | {
478
+ readonly kind: "work.recover";
479
+ readonly repository: string;
480
+ readonly pullRequest: number;
481
+ readonly reviewUrl: string;
482
+ readonly goalId: string;
483
+ readonly laneId: string;
484
+ readonly operationId: string;
485
+ readonly expectedGoalEventId: string;
486
+ readonly expectedGoalUpdatedAt: number;
487
+ readonly expectedHistoryToken: string;
488
+ readonly head: string;
489
+ readonly baseHead: string;
490
+ readonly owner: {
491
+ readonly id: string;
492
+ readonly name: string;
493
+ };
494
+ readonly sessionId: string;
495
+ readonly expectedWork: string;
496
+ readonly worker: {
497
+ readonly host: string;
498
+ readonly agentId: string;
499
+ readonly name: string;
500
+ readonly paneId: string;
501
+ readonly relationship?: {
502
+ readonly parentAgentId: string;
503
+ readonly relation: "delegated" | "pair" | "review";
504
+ };
505
+ };
506
+ readonly worktree: string;
507
+ readonly branch: string;
508
+ } | {
509
+ readonly kind: "work.reassign";
510
+ readonly goalId: string;
511
+ readonly from: {
512
+ readonly id: string;
513
+ readonly name: string;
514
+ };
515
+ readonly to: {
516
+ readonly id: string;
517
+ readonly name: string;
518
+ };
519
+ readonly toAgent: {
520
+ readonly _tag: "clear";
521
+ } | {
522
+ readonly _tag: "keep";
523
+ } | {
524
+ readonly _tag: "set";
525
+ readonly agent: {
526
+ readonly host: string;
527
+ readonly agentId: string;
528
+ readonly name: string;
529
+ readonly paneId: string;
530
+ readonly relationship?: {
531
+ readonly parentAgentId: string;
532
+ readonly relation: "delegated" | "pair" | "review";
533
+ };
534
+ };
535
+ };
536
+ readonly reason: string;
537
+ readonly expectedGoalEventId: string;
538
+ readonly expectedGoalUpdatedAt: number;
539
+ } | {
540
+ readonly kind: "browser.mcp.recover";
541
+ } | {
542
+ readonly kind: "nix.check";
543
+ } | {
544
+ readonly kind: "nix.apply";
545
+ readonly ref: string;
125
546
  } | {
126
547
  readonly kind: "agent.message";
127
548
  readonly session: string;
128
549
  readonly message: string;
129
- } | {
130
- readonly kind: "browser.mcp.recover";
131
550
  };
132
551
  readonly result: string | null;
552
+ readonly acceptedReceipt?: string | null;
553
+ readonly durableOperation?: true;
133
554
  readonly error: string | null;
134
555
  readonly worker?: {
135
556
  readonly host: string;
@@ -163,24 +584,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
163
584
  readonly expiredAt?: number | null;
164
585
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
165
586
  readonly payload: {
166
- readonly kind: "nix.check";
167
- } | {
168
- readonly kind: "nix.apply";
169
- readonly ref: string;
170
- } | {
171
587
  readonly kind: "agent.delegate";
172
588
  readonly repository: string;
173
589
  readonly prompt: string;
174
- readonly mode: "consult" | "review" | "work";
590
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
175
591
  readonly channel?: "coordinator_chat";
592
+ } | {
593
+ readonly kind: "work.reconcile";
594
+ readonly repository: string;
595
+ readonly pullRequest: number;
596
+ readonly goalId: string;
597
+ readonly laneId: string;
598
+ readonly operationId: string;
599
+ readonly expectedRevision: number;
600
+ readonly expectedHead: string;
601
+ readonly newHead: string;
602
+ readonly expectedOwner: {
603
+ readonly id: string;
604
+ readonly name: string;
605
+ };
606
+ readonly expectedGoalEventId: string;
607
+ readonly bindingDispatchRequestId: string;
608
+ readonly sessionId: string;
609
+ readonly expectedWork: string;
610
+ readonly worker: {
611
+ readonly host: string;
612
+ readonly agentId: string;
613
+ readonly name: string;
614
+ readonly paneId: string;
615
+ readonly relationship?: {
616
+ readonly parentAgentId: string;
617
+ readonly relation: "delegated" | "pair" | "review";
618
+ };
619
+ };
620
+ readonly worktree: string;
621
+ readonly branch: string;
622
+ } | {
623
+ readonly kind: "work.admit";
624
+ readonly repository: string;
625
+ readonly pullRequest: number;
626
+ readonly reviewUrl: string;
627
+ readonly goalId: string;
628
+ readonly laneId: string;
629
+ readonly operationId: string;
630
+ readonly expectedAbsenceToken: string;
631
+ readonly head: string;
632
+ readonly baseHead: string;
633
+ readonly owner: {
634
+ readonly id: string;
635
+ readonly name: string;
636
+ };
637
+ readonly sessionId: string;
638
+ readonly expectedWork: string;
639
+ readonly worker: {
640
+ readonly host: string;
641
+ readonly agentId: string;
642
+ readonly name: string;
643
+ readonly paneId: string;
644
+ readonly relationship?: {
645
+ readonly parentAgentId: string;
646
+ readonly relation: "delegated" | "pair" | "review";
647
+ };
648
+ };
649
+ readonly worktree: string;
650
+ readonly branch: string;
651
+ readonly title: string;
652
+ readonly summary: string;
653
+ readonly detail: string;
654
+ } | {
655
+ readonly kind: "work.recover";
656
+ readonly repository: string;
657
+ readonly pullRequest: number;
658
+ readonly reviewUrl: string;
659
+ readonly goalId: string;
660
+ readonly laneId: string;
661
+ readonly operationId: string;
662
+ readonly expectedGoalEventId: string;
663
+ readonly expectedGoalUpdatedAt: number;
664
+ readonly expectedHistoryToken: string;
665
+ readonly head: string;
666
+ readonly baseHead: string;
667
+ readonly owner: {
668
+ readonly id: string;
669
+ readonly name: string;
670
+ };
671
+ readonly sessionId: string;
672
+ readonly expectedWork: string;
673
+ readonly worker: {
674
+ readonly host: string;
675
+ readonly agentId: string;
676
+ readonly name: string;
677
+ readonly paneId: string;
678
+ readonly relationship?: {
679
+ readonly parentAgentId: string;
680
+ readonly relation: "delegated" | "pair" | "review";
681
+ };
682
+ };
683
+ readonly worktree: string;
684
+ readonly branch: string;
685
+ } | {
686
+ readonly kind: "work.reassign";
687
+ readonly goalId: string;
688
+ readonly from: {
689
+ readonly id: string;
690
+ readonly name: string;
691
+ };
692
+ readonly to: {
693
+ readonly id: string;
694
+ readonly name: string;
695
+ };
696
+ readonly toAgent: {
697
+ readonly _tag: "clear";
698
+ } | {
699
+ readonly _tag: "keep";
700
+ } | {
701
+ readonly _tag: "set";
702
+ readonly agent: {
703
+ readonly host: string;
704
+ readonly agentId: string;
705
+ readonly name: string;
706
+ readonly paneId: string;
707
+ readonly relationship?: {
708
+ readonly parentAgentId: string;
709
+ readonly relation: "delegated" | "pair" | "review";
710
+ };
711
+ };
712
+ };
713
+ readonly reason: string;
714
+ readonly expectedGoalEventId: string;
715
+ readonly expectedGoalUpdatedAt: number;
716
+ } | {
717
+ readonly kind: "browser.mcp.recover";
718
+ } | {
719
+ readonly kind: "nix.check";
720
+ } | {
721
+ readonly kind: "nix.apply";
722
+ readonly ref: string;
176
723
  } | {
177
724
  readonly kind: "agent.message";
178
725
  readonly session: string;
179
726
  readonly message: string;
180
- } | {
181
- readonly kind: "browser.mcp.recover";
182
727
  };
183
728
  readonly result: string | null;
729
+ readonly acceptedReceipt?: string | null;
730
+ readonly durableOperation?: true;
184
731
  readonly error: string | null;
185
732
  readonly worker?: {
186
733
  readonly host: string;
@@ -214,24 +761,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
214
761
  readonly expiredAt?: number | null;
215
762
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
216
763
  readonly payload: {
217
- readonly kind: "nix.check";
218
- } | {
219
- readonly kind: "nix.apply";
220
- readonly ref: string;
221
- } | {
222
764
  readonly kind: "agent.delegate";
223
765
  readonly repository: string;
224
766
  readonly prompt: string;
225
- readonly mode: "consult" | "review" | "work";
767
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
226
768
  readonly channel?: "coordinator_chat";
769
+ } | {
770
+ readonly kind: "work.reconcile";
771
+ readonly repository: string;
772
+ readonly pullRequest: number;
773
+ readonly goalId: string;
774
+ readonly laneId: string;
775
+ readonly operationId: string;
776
+ readonly expectedRevision: number;
777
+ readonly expectedHead: string;
778
+ readonly newHead: string;
779
+ readonly expectedOwner: {
780
+ readonly id: string;
781
+ readonly name: string;
782
+ };
783
+ readonly expectedGoalEventId: string;
784
+ readonly bindingDispatchRequestId: string;
785
+ readonly sessionId: string;
786
+ readonly expectedWork: string;
787
+ readonly worker: {
788
+ readonly host: string;
789
+ readonly agentId: string;
790
+ readonly name: string;
791
+ readonly paneId: string;
792
+ readonly relationship?: {
793
+ readonly parentAgentId: string;
794
+ readonly relation: "delegated" | "pair" | "review";
795
+ };
796
+ };
797
+ readonly worktree: string;
798
+ readonly branch: string;
799
+ } | {
800
+ readonly kind: "work.admit";
801
+ readonly repository: string;
802
+ readonly pullRequest: number;
803
+ readonly reviewUrl: string;
804
+ readonly goalId: string;
805
+ readonly laneId: string;
806
+ readonly operationId: string;
807
+ readonly expectedAbsenceToken: string;
808
+ readonly head: string;
809
+ readonly baseHead: string;
810
+ readonly owner: {
811
+ readonly id: string;
812
+ readonly name: string;
813
+ };
814
+ readonly sessionId: string;
815
+ readonly expectedWork: string;
816
+ readonly worker: {
817
+ readonly host: string;
818
+ readonly agentId: string;
819
+ readonly name: string;
820
+ readonly paneId: string;
821
+ readonly relationship?: {
822
+ readonly parentAgentId: string;
823
+ readonly relation: "delegated" | "pair" | "review";
824
+ };
825
+ };
826
+ readonly worktree: string;
827
+ readonly branch: string;
828
+ readonly title: string;
829
+ readonly summary: string;
830
+ readonly detail: string;
831
+ } | {
832
+ readonly kind: "work.recover";
833
+ readonly repository: string;
834
+ readonly pullRequest: number;
835
+ readonly reviewUrl: string;
836
+ readonly goalId: string;
837
+ readonly laneId: string;
838
+ readonly operationId: string;
839
+ readonly expectedGoalEventId: string;
840
+ readonly expectedGoalUpdatedAt: number;
841
+ readonly expectedHistoryToken: string;
842
+ readonly head: string;
843
+ readonly baseHead: string;
844
+ readonly owner: {
845
+ readonly id: string;
846
+ readonly name: string;
847
+ };
848
+ readonly sessionId: string;
849
+ readonly expectedWork: string;
850
+ readonly worker: {
851
+ readonly host: string;
852
+ readonly agentId: string;
853
+ readonly name: string;
854
+ readonly paneId: string;
855
+ readonly relationship?: {
856
+ readonly parentAgentId: string;
857
+ readonly relation: "delegated" | "pair" | "review";
858
+ };
859
+ };
860
+ readonly worktree: string;
861
+ readonly branch: string;
862
+ } | {
863
+ readonly kind: "work.reassign";
864
+ readonly goalId: string;
865
+ readonly from: {
866
+ readonly id: string;
867
+ readonly name: string;
868
+ };
869
+ readonly to: {
870
+ readonly id: string;
871
+ readonly name: string;
872
+ };
873
+ readonly toAgent: {
874
+ readonly _tag: "clear";
875
+ } | {
876
+ readonly _tag: "keep";
877
+ } | {
878
+ readonly _tag: "set";
879
+ readonly agent: {
880
+ readonly host: string;
881
+ readonly agentId: string;
882
+ readonly name: string;
883
+ readonly paneId: string;
884
+ readonly relationship?: {
885
+ readonly parentAgentId: string;
886
+ readonly relation: "delegated" | "pair" | "review";
887
+ };
888
+ };
889
+ };
890
+ readonly reason: string;
891
+ readonly expectedGoalEventId: string;
892
+ readonly expectedGoalUpdatedAt: number;
893
+ } | {
894
+ readonly kind: "browser.mcp.recover";
895
+ } | {
896
+ readonly kind: "nix.check";
897
+ } | {
898
+ readonly kind: "nix.apply";
899
+ readonly ref: string;
227
900
  } | {
228
901
  readonly kind: "agent.message";
229
902
  readonly session: string;
230
903
  readonly message: string;
231
- } | {
232
- readonly kind: "browser.mcp.recover";
233
904
  };
234
905
  readonly result: string | null;
906
+ readonly acceptedReceipt?: string | null;
907
+ readonly durableOperation?: true;
235
908
  readonly error: string | null;
236
909
  readonly worker?: {
237
910
  readonly host: string;
@@ -249,7 +922,7 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
249
922
  readonly url: string;
250
923
  };
251
924
  readonly workerTerminalObservedAt?: number | null;
252
- }, FleetApprovalError | FleetJobNotFoundError | FleetStoreError | FleetTransitionConflictError, never>;
925
+ }, FleetApprovalError | FleetJobNotFoundError | FleetOperationError | FleetStoreError | FleetTransitionConflictError | FleetValidationError, never>;
253
926
  runCoordinatorChat: (jobId: string) => Effect.Effect<{
254
927
  readonly id: string;
255
928
  readonly createdAt: number;
@@ -265,24 +938,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
265
938
  readonly expiredAt?: number | null;
266
939
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
267
940
  readonly payload: {
268
- readonly kind: "nix.check";
269
- } | {
270
- readonly kind: "nix.apply";
271
- readonly ref: string;
272
- } | {
273
941
  readonly kind: "agent.delegate";
274
942
  readonly repository: string;
275
943
  readonly prompt: string;
276
- readonly mode: "consult" | "review" | "work";
944
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
277
945
  readonly channel?: "coordinator_chat";
946
+ } | {
947
+ readonly kind: "work.reconcile";
948
+ readonly repository: string;
949
+ readonly pullRequest: number;
950
+ readonly goalId: string;
951
+ readonly laneId: string;
952
+ readonly operationId: string;
953
+ readonly expectedRevision: number;
954
+ readonly expectedHead: string;
955
+ readonly newHead: string;
956
+ readonly expectedOwner: {
957
+ readonly id: string;
958
+ readonly name: string;
959
+ };
960
+ readonly expectedGoalEventId: string;
961
+ readonly bindingDispatchRequestId: string;
962
+ readonly sessionId: string;
963
+ readonly expectedWork: string;
964
+ readonly worker: {
965
+ readonly host: string;
966
+ readonly agentId: string;
967
+ readonly name: string;
968
+ readonly paneId: string;
969
+ readonly relationship?: {
970
+ readonly parentAgentId: string;
971
+ readonly relation: "delegated" | "pair" | "review";
972
+ };
973
+ };
974
+ readonly worktree: string;
975
+ readonly branch: string;
976
+ } | {
977
+ readonly kind: "work.admit";
978
+ readonly repository: string;
979
+ readonly pullRequest: number;
980
+ readonly reviewUrl: string;
981
+ readonly goalId: string;
982
+ readonly laneId: string;
983
+ readonly operationId: string;
984
+ readonly expectedAbsenceToken: string;
985
+ readonly head: string;
986
+ readonly baseHead: string;
987
+ readonly owner: {
988
+ readonly id: string;
989
+ readonly name: string;
990
+ };
991
+ readonly sessionId: string;
992
+ readonly expectedWork: string;
993
+ readonly worker: {
994
+ readonly host: string;
995
+ readonly agentId: string;
996
+ readonly name: string;
997
+ readonly paneId: string;
998
+ readonly relationship?: {
999
+ readonly parentAgentId: string;
1000
+ readonly relation: "delegated" | "pair" | "review";
1001
+ };
1002
+ };
1003
+ readonly worktree: string;
1004
+ readonly branch: string;
1005
+ readonly title: string;
1006
+ readonly summary: string;
1007
+ readonly detail: string;
1008
+ } | {
1009
+ readonly kind: "work.recover";
1010
+ readonly repository: string;
1011
+ readonly pullRequest: number;
1012
+ readonly reviewUrl: string;
1013
+ readonly goalId: string;
1014
+ readonly laneId: string;
1015
+ readonly operationId: string;
1016
+ readonly expectedGoalEventId: string;
1017
+ readonly expectedGoalUpdatedAt: number;
1018
+ readonly expectedHistoryToken: string;
1019
+ readonly head: string;
1020
+ readonly baseHead: string;
1021
+ readonly owner: {
1022
+ readonly id: string;
1023
+ readonly name: string;
1024
+ };
1025
+ readonly sessionId: string;
1026
+ readonly expectedWork: string;
1027
+ readonly worker: {
1028
+ readonly host: string;
1029
+ readonly agentId: string;
1030
+ readonly name: string;
1031
+ readonly paneId: string;
1032
+ readonly relationship?: {
1033
+ readonly parentAgentId: string;
1034
+ readonly relation: "delegated" | "pair" | "review";
1035
+ };
1036
+ };
1037
+ readonly worktree: string;
1038
+ readonly branch: string;
1039
+ } | {
1040
+ readonly kind: "work.reassign";
1041
+ readonly goalId: string;
1042
+ readonly from: {
1043
+ readonly id: string;
1044
+ readonly name: string;
1045
+ };
1046
+ readonly to: {
1047
+ readonly id: string;
1048
+ readonly name: string;
1049
+ };
1050
+ readonly toAgent: {
1051
+ readonly _tag: "clear";
1052
+ } | {
1053
+ readonly _tag: "keep";
1054
+ } | {
1055
+ readonly _tag: "set";
1056
+ readonly agent: {
1057
+ readonly host: string;
1058
+ readonly agentId: string;
1059
+ readonly name: string;
1060
+ readonly paneId: string;
1061
+ readonly relationship?: {
1062
+ readonly parentAgentId: string;
1063
+ readonly relation: "delegated" | "pair" | "review";
1064
+ };
1065
+ };
1066
+ };
1067
+ readonly reason: string;
1068
+ readonly expectedGoalEventId: string;
1069
+ readonly expectedGoalUpdatedAt: number;
1070
+ } | {
1071
+ readonly kind: "browser.mcp.recover";
1072
+ } | {
1073
+ readonly kind: "nix.check";
1074
+ } | {
1075
+ readonly kind: "nix.apply";
1076
+ readonly ref: string;
278
1077
  } | {
279
1078
  readonly kind: "agent.message";
280
1079
  readonly session: string;
281
1080
  readonly message: string;
282
- } | {
283
- readonly kind: "browser.mcp.recover";
284
1081
  };
285
1082
  readonly result: string | null;
1083
+ readonly acceptedReceipt?: string | null;
1084
+ readonly durableOperation?: true;
286
1085
  readonly error: string | null;
287
1086
  readonly worker?: {
288
1087
  readonly host: string;
@@ -300,7 +1099,7 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
300
1099
  readonly url: string;
301
1100
  };
302
1101
  readonly workerTerminalObservedAt?: number | null;
303
- }, FleetApprovalError | FleetJobNotFoundError | FleetStoreError | FleetTransitionConflictError | FleetValidationError, never>;
1102
+ }, FleetApprovalError | FleetJobNotFoundError | FleetOperationError | FleetStoreError | FleetTransitionConflictError | FleetValidationError, never>;
304
1103
  get: (jobId: string) => Effect.Effect<{
305
1104
  readonly id: string;
306
1105
  readonly createdAt: number;
@@ -316,24 +1115,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
316
1115
  readonly expiredAt?: number | null;
317
1116
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
318
1117
  readonly payload: {
319
- readonly kind: "nix.check";
320
- } | {
321
- readonly kind: "nix.apply";
322
- readonly ref: string;
323
- } | {
324
1118
  readonly kind: "agent.delegate";
325
1119
  readonly repository: string;
326
1120
  readonly prompt: string;
327
- readonly mode: "consult" | "review" | "work";
1121
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
328
1122
  readonly channel?: "coordinator_chat";
1123
+ } | {
1124
+ readonly kind: "work.reconcile";
1125
+ readonly repository: string;
1126
+ readonly pullRequest: number;
1127
+ readonly goalId: string;
1128
+ readonly laneId: string;
1129
+ readonly operationId: string;
1130
+ readonly expectedRevision: number;
1131
+ readonly expectedHead: string;
1132
+ readonly newHead: string;
1133
+ readonly expectedOwner: {
1134
+ readonly id: string;
1135
+ readonly name: string;
1136
+ };
1137
+ readonly expectedGoalEventId: string;
1138
+ readonly bindingDispatchRequestId: string;
1139
+ readonly sessionId: string;
1140
+ readonly expectedWork: string;
1141
+ readonly worker: {
1142
+ readonly host: string;
1143
+ readonly agentId: string;
1144
+ readonly name: string;
1145
+ readonly paneId: string;
1146
+ readonly relationship?: {
1147
+ readonly parentAgentId: string;
1148
+ readonly relation: "delegated" | "pair" | "review";
1149
+ };
1150
+ };
1151
+ readonly worktree: string;
1152
+ readonly branch: string;
1153
+ } | {
1154
+ readonly kind: "work.admit";
1155
+ readonly repository: string;
1156
+ readonly pullRequest: number;
1157
+ readonly reviewUrl: string;
1158
+ readonly goalId: string;
1159
+ readonly laneId: string;
1160
+ readonly operationId: string;
1161
+ readonly expectedAbsenceToken: string;
1162
+ readonly head: string;
1163
+ readonly baseHead: string;
1164
+ readonly owner: {
1165
+ readonly id: string;
1166
+ readonly name: string;
1167
+ };
1168
+ readonly sessionId: string;
1169
+ readonly expectedWork: string;
1170
+ readonly worker: {
1171
+ readonly host: string;
1172
+ readonly agentId: string;
1173
+ readonly name: string;
1174
+ readonly paneId: string;
1175
+ readonly relationship?: {
1176
+ readonly parentAgentId: string;
1177
+ readonly relation: "delegated" | "pair" | "review";
1178
+ };
1179
+ };
1180
+ readonly worktree: string;
1181
+ readonly branch: string;
1182
+ readonly title: string;
1183
+ readonly summary: string;
1184
+ readonly detail: string;
1185
+ } | {
1186
+ readonly kind: "work.recover";
1187
+ readonly repository: string;
1188
+ readonly pullRequest: number;
1189
+ readonly reviewUrl: string;
1190
+ readonly goalId: string;
1191
+ readonly laneId: string;
1192
+ readonly operationId: string;
1193
+ readonly expectedGoalEventId: string;
1194
+ readonly expectedGoalUpdatedAt: number;
1195
+ readonly expectedHistoryToken: string;
1196
+ readonly head: string;
1197
+ readonly baseHead: string;
1198
+ readonly owner: {
1199
+ readonly id: string;
1200
+ readonly name: string;
1201
+ };
1202
+ readonly sessionId: string;
1203
+ readonly expectedWork: string;
1204
+ readonly worker: {
1205
+ readonly host: string;
1206
+ readonly agentId: string;
1207
+ readonly name: string;
1208
+ readonly paneId: string;
1209
+ readonly relationship?: {
1210
+ readonly parentAgentId: string;
1211
+ readonly relation: "delegated" | "pair" | "review";
1212
+ };
1213
+ };
1214
+ readonly worktree: string;
1215
+ readonly branch: string;
1216
+ } | {
1217
+ readonly kind: "work.reassign";
1218
+ readonly goalId: string;
1219
+ readonly from: {
1220
+ readonly id: string;
1221
+ readonly name: string;
1222
+ };
1223
+ readonly to: {
1224
+ readonly id: string;
1225
+ readonly name: string;
1226
+ };
1227
+ readonly toAgent: {
1228
+ readonly _tag: "clear";
1229
+ } | {
1230
+ readonly _tag: "keep";
1231
+ } | {
1232
+ readonly _tag: "set";
1233
+ readonly agent: {
1234
+ readonly host: string;
1235
+ readonly agentId: string;
1236
+ readonly name: string;
1237
+ readonly paneId: string;
1238
+ readonly relationship?: {
1239
+ readonly parentAgentId: string;
1240
+ readonly relation: "delegated" | "pair" | "review";
1241
+ };
1242
+ };
1243
+ };
1244
+ readonly reason: string;
1245
+ readonly expectedGoalEventId: string;
1246
+ readonly expectedGoalUpdatedAt: number;
1247
+ } | {
1248
+ readonly kind: "browser.mcp.recover";
1249
+ } | {
1250
+ readonly kind: "nix.check";
1251
+ } | {
1252
+ readonly kind: "nix.apply";
1253
+ readonly ref: string;
329
1254
  } | {
330
1255
  readonly kind: "agent.message";
331
1256
  readonly session: string;
332
1257
  readonly message: string;
333
- } | {
334
- readonly kind: "browser.mcp.recover";
335
1258
  };
336
1259
  readonly result: string | null;
1260
+ readonly acceptedReceipt?: string | null;
1261
+ readonly durableOperation?: true;
337
1262
  readonly error: string | null;
338
1263
  readonly worker?: {
339
1264
  readonly host: string;
@@ -367,24 +1292,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
367
1292
  readonly expiredAt?: number | null;
368
1293
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
369
1294
  readonly payload: {
1295
+ readonly kind: "agent.delegate";
1296
+ readonly repository: string;
1297
+ readonly prompt: string;
1298
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
1299
+ readonly channel?: "coordinator_chat";
1300
+ } | {
1301
+ readonly kind: "work.reconcile";
1302
+ readonly repository: string;
1303
+ readonly pullRequest: number;
1304
+ readonly goalId: string;
1305
+ readonly laneId: string;
1306
+ readonly operationId: string;
1307
+ readonly expectedRevision: number;
1308
+ readonly expectedHead: string;
1309
+ readonly newHead: string;
1310
+ readonly expectedOwner: {
1311
+ readonly id: string;
1312
+ readonly name: string;
1313
+ };
1314
+ readonly expectedGoalEventId: string;
1315
+ readonly bindingDispatchRequestId: string;
1316
+ readonly sessionId: string;
1317
+ readonly expectedWork: string;
1318
+ readonly worker: {
1319
+ readonly host: string;
1320
+ readonly agentId: string;
1321
+ readonly name: string;
1322
+ readonly paneId: string;
1323
+ readonly relationship?: {
1324
+ readonly parentAgentId: string;
1325
+ readonly relation: "delegated" | "pair" | "review";
1326
+ };
1327
+ };
1328
+ readonly worktree: string;
1329
+ readonly branch: string;
1330
+ } | {
1331
+ readonly kind: "work.admit";
1332
+ readonly repository: string;
1333
+ readonly pullRequest: number;
1334
+ readonly reviewUrl: string;
1335
+ readonly goalId: string;
1336
+ readonly laneId: string;
1337
+ readonly operationId: string;
1338
+ readonly expectedAbsenceToken: string;
1339
+ readonly head: string;
1340
+ readonly baseHead: string;
1341
+ readonly owner: {
1342
+ readonly id: string;
1343
+ readonly name: string;
1344
+ };
1345
+ readonly sessionId: string;
1346
+ readonly expectedWork: string;
1347
+ readonly worker: {
1348
+ readonly host: string;
1349
+ readonly agentId: string;
1350
+ readonly name: string;
1351
+ readonly paneId: string;
1352
+ readonly relationship?: {
1353
+ readonly parentAgentId: string;
1354
+ readonly relation: "delegated" | "pair" | "review";
1355
+ };
1356
+ };
1357
+ readonly worktree: string;
1358
+ readonly branch: string;
1359
+ readonly title: string;
1360
+ readonly summary: string;
1361
+ readonly detail: string;
1362
+ } | {
1363
+ readonly kind: "work.recover";
1364
+ readonly repository: string;
1365
+ readonly pullRequest: number;
1366
+ readonly reviewUrl: string;
1367
+ readonly goalId: string;
1368
+ readonly laneId: string;
1369
+ readonly operationId: string;
1370
+ readonly expectedGoalEventId: string;
1371
+ readonly expectedGoalUpdatedAt: number;
1372
+ readonly expectedHistoryToken: string;
1373
+ readonly head: string;
1374
+ readonly baseHead: string;
1375
+ readonly owner: {
1376
+ readonly id: string;
1377
+ readonly name: string;
1378
+ };
1379
+ readonly sessionId: string;
1380
+ readonly expectedWork: string;
1381
+ readonly worker: {
1382
+ readonly host: string;
1383
+ readonly agentId: string;
1384
+ readonly name: string;
1385
+ readonly paneId: string;
1386
+ readonly relationship?: {
1387
+ readonly parentAgentId: string;
1388
+ readonly relation: "delegated" | "pair" | "review";
1389
+ };
1390
+ };
1391
+ readonly worktree: string;
1392
+ readonly branch: string;
1393
+ } | {
1394
+ readonly kind: "work.reassign";
1395
+ readonly goalId: string;
1396
+ readonly from: {
1397
+ readonly id: string;
1398
+ readonly name: string;
1399
+ };
1400
+ readonly to: {
1401
+ readonly id: string;
1402
+ readonly name: string;
1403
+ };
1404
+ readonly toAgent: {
1405
+ readonly _tag: "clear";
1406
+ } | {
1407
+ readonly _tag: "keep";
1408
+ } | {
1409
+ readonly _tag: "set";
1410
+ readonly agent: {
1411
+ readonly host: string;
1412
+ readonly agentId: string;
1413
+ readonly name: string;
1414
+ readonly paneId: string;
1415
+ readonly relationship?: {
1416
+ readonly parentAgentId: string;
1417
+ readonly relation: "delegated" | "pair" | "review";
1418
+ };
1419
+ };
1420
+ };
1421
+ readonly reason: string;
1422
+ readonly expectedGoalEventId: string;
1423
+ readonly expectedGoalUpdatedAt: number;
1424
+ } | {
1425
+ readonly kind: "browser.mcp.recover";
1426
+ } | {
370
1427
  readonly kind: "nix.check";
371
1428
  } | {
372
1429
  readonly kind: "nix.apply";
373
1430
  readonly ref: string;
374
- } | {
375
- readonly kind: "agent.delegate";
376
- readonly repository: string;
377
- readonly prompt: string;
378
- readonly mode: "consult" | "review" | "work";
379
- readonly channel?: "coordinator_chat";
380
1431
  } | {
381
1432
  readonly kind: "agent.message";
382
1433
  readonly session: string;
383
1434
  readonly message: string;
384
- } | {
385
- readonly kind: "browser.mcp.recover";
386
1435
  };
387
1436
  readonly result: string | null;
1437
+ readonly acceptedReceipt?: string | null;
1438
+ readonly durableOperation?: true;
388
1439
  readonly error: string | null;
389
1440
  readonly worker?: {
390
1441
  readonly host: string;
@@ -421,24 +1472,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
421
1472
  readonly expiredAt?: number | null;
422
1473
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
423
1474
  readonly payload: {
424
- readonly kind: "nix.check";
425
- } | {
426
- readonly kind: "nix.apply";
427
- readonly ref: string;
428
- } | {
429
1475
  readonly kind: "agent.delegate";
430
1476
  readonly repository: string;
431
1477
  readonly prompt: string;
432
- readonly mode: "consult" | "review" | "work";
1478
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
433
1479
  readonly channel?: "coordinator_chat";
1480
+ } | {
1481
+ readonly kind: "work.reconcile";
1482
+ readonly repository: string;
1483
+ readonly pullRequest: number;
1484
+ readonly goalId: string;
1485
+ readonly laneId: string;
1486
+ readonly operationId: string;
1487
+ readonly expectedRevision: number;
1488
+ readonly expectedHead: string;
1489
+ readonly newHead: string;
1490
+ readonly expectedOwner: {
1491
+ readonly id: string;
1492
+ readonly name: string;
1493
+ };
1494
+ readonly expectedGoalEventId: string;
1495
+ readonly bindingDispatchRequestId: string;
1496
+ readonly sessionId: string;
1497
+ readonly expectedWork: string;
1498
+ readonly worker: {
1499
+ readonly host: string;
1500
+ readonly agentId: string;
1501
+ readonly name: string;
1502
+ readonly paneId: string;
1503
+ readonly relationship?: {
1504
+ readonly parentAgentId: string;
1505
+ readonly relation: "delegated" | "pair" | "review";
1506
+ };
1507
+ };
1508
+ readonly worktree: string;
1509
+ readonly branch: string;
1510
+ } | {
1511
+ readonly kind: "work.admit";
1512
+ readonly repository: string;
1513
+ readonly pullRequest: number;
1514
+ readonly reviewUrl: string;
1515
+ readonly goalId: string;
1516
+ readonly laneId: string;
1517
+ readonly operationId: string;
1518
+ readonly expectedAbsenceToken: string;
1519
+ readonly head: string;
1520
+ readonly baseHead: string;
1521
+ readonly owner: {
1522
+ readonly id: string;
1523
+ readonly name: string;
1524
+ };
1525
+ readonly sessionId: string;
1526
+ readonly expectedWork: string;
1527
+ readonly worker: {
1528
+ readonly host: string;
1529
+ readonly agentId: string;
1530
+ readonly name: string;
1531
+ readonly paneId: string;
1532
+ readonly relationship?: {
1533
+ readonly parentAgentId: string;
1534
+ readonly relation: "delegated" | "pair" | "review";
1535
+ };
1536
+ };
1537
+ readonly worktree: string;
1538
+ readonly branch: string;
1539
+ readonly title: string;
1540
+ readonly summary: string;
1541
+ readonly detail: string;
1542
+ } | {
1543
+ readonly kind: "work.recover";
1544
+ readonly repository: string;
1545
+ readonly pullRequest: number;
1546
+ readonly reviewUrl: string;
1547
+ readonly goalId: string;
1548
+ readonly laneId: string;
1549
+ readonly operationId: string;
1550
+ readonly expectedGoalEventId: string;
1551
+ readonly expectedGoalUpdatedAt: number;
1552
+ readonly expectedHistoryToken: string;
1553
+ readonly head: string;
1554
+ readonly baseHead: string;
1555
+ readonly owner: {
1556
+ readonly id: string;
1557
+ readonly name: string;
1558
+ };
1559
+ readonly sessionId: string;
1560
+ readonly expectedWork: string;
1561
+ readonly worker: {
1562
+ readonly host: string;
1563
+ readonly agentId: string;
1564
+ readonly name: string;
1565
+ readonly paneId: string;
1566
+ readonly relationship?: {
1567
+ readonly parentAgentId: string;
1568
+ readonly relation: "delegated" | "pair" | "review";
1569
+ };
1570
+ };
1571
+ readonly worktree: string;
1572
+ readonly branch: string;
1573
+ } | {
1574
+ readonly kind: "work.reassign";
1575
+ readonly goalId: string;
1576
+ readonly from: {
1577
+ readonly id: string;
1578
+ readonly name: string;
1579
+ };
1580
+ readonly to: {
1581
+ readonly id: string;
1582
+ readonly name: string;
1583
+ };
1584
+ readonly toAgent: {
1585
+ readonly _tag: "clear";
1586
+ } | {
1587
+ readonly _tag: "keep";
1588
+ } | {
1589
+ readonly _tag: "set";
1590
+ readonly agent: {
1591
+ readonly host: string;
1592
+ readonly agentId: string;
1593
+ readonly name: string;
1594
+ readonly paneId: string;
1595
+ readonly relationship?: {
1596
+ readonly parentAgentId: string;
1597
+ readonly relation: "delegated" | "pair" | "review";
1598
+ };
1599
+ };
1600
+ };
1601
+ readonly reason: string;
1602
+ readonly expectedGoalEventId: string;
1603
+ readonly expectedGoalUpdatedAt: number;
1604
+ } | {
1605
+ readonly kind: "browser.mcp.recover";
1606
+ } | {
1607
+ readonly kind: "nix.check";
1608
+ } | {
1609
+ readonly kind: "nix.apply";
1610
+ readonly ref: string;
434
1611
  } | {
435
1612
  readonly kind: "agent.message";
436
1613
  readonly session: string;
437
1614
  readonly message: string;
438
- } | {
439
- readonly kind: "browser.mcp.recover";
440
1615
  };
441
1616
  readonly result: string | null;
1617
+ readonly acceptedReceipt?: string | null;
1618
+ readonly durableOperation?: true;
442
1619
  readonly error: string | null;
443
1620
  readonly worker?: {
444
1621
  readonly host: string;
@@ -476,24 +1653,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
476
1653
  readonly expiredAt?: number | null;
477
1654
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
478
1655
  readonly payload: {
479
- readonly kind: "nix.check";
480
- } | {
481
- readonly kind: "nix.apply";
482
- readonly ref: string;
483
- } | {
484
1656
  readonly kind: "agent.delegate";
485
1657
  readonly repository: string;
486
1658
  readonly prompt: string;
487
- readonly mode: "consult" | "review" | "work";
1659
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
488
1660
  readonly channel?: "coordinator_chat";
1661
+ } | {
1662
+ readonly kind: "work.reconcile";
1663
+ readonly repository: string;
1664
+ readonly pullRequest: number;
1665
+ readonly goalId: string;
1666
+ readonly laneId: string;
1667
+ readonly operationId: string;
1668
+ readonly expectedRevision: number;
1669
+ readonly expectedHead: string;
1670
+ readonly newHead: string;
1671
+ readonly expectedOwner: {
1672
+ readonly id: string;
1673
+ readonly name: string;
1674
+ };
1675
+ readonly expectedGoalEventId: string;
1676
+ readonly bindingDispatchRequestId: string;
1677
+ readonly sessionId: string;
1678
+ readonly expectedWork: string;
1679
+ readonly worker: {
1680
+ readonly host: string;
1681
+ readonly agentId: string;
1682
+ readonly name: string;
1683
+ readonly paneId: string;
1684
+ readonly relationship?: {
1685
+ readonly parentAgentId: string;
1686
+ readonly relation: "delegated" | "pair" | "review";
1687
+ };
1688
+ };
1689
+ readonly worktree: string;
1690
+ readonly branch: string;
1691
+ } | {
1692
+ readonly kind: "work.admit";
1693
+ readonly repository: string;
1694
+ readonly pullRequest: number;
1695
+ readonly reviewUrl: string;
1696
+ readonly goalId: string;
1697
+ readonly laneId: string;
1698
+ readonly operationId: string;
1699
+ readonly expectedAbsenceToken: string;
1700
+ readonly head: string;
1701
+ readonly baseHead: string;
1702
+ readonly owner: {
1703
+ readonly id: string;
1704
+ readonly name: string;
1705
+ };
1706
+ readonly sessionId: string;
1707
+ readonly expectedWork: string;
1708
+ readonly worker: {
1709
+ readonly host: string;
1710
+ readonly agentId: string;
1711
+ readonly name: string;
1712
+ readonly paneId: string;
1713
+ readonly relationship?: {
1714
+ readonly parentAgentId: string;
1715
+ readonly relation: "delegated" | "pair" | "review";
1716
+ };
1717
+ };
1718
+ readonly worktree: string;
1719
+ readonly branch: string;
1720
+ readonly title: string;
1721
+ readonly summary: string;
1722
+ readonly detail: string;
1723
+ } | {
1724
+ readonly kind: "work.recover";
1725
+ readonly repository: string;
1726
+ readonly pullRequest: number;
1727
+ readonly reviewUrl: string;
1728
+ readonly goalId: string;
1729
+ readonly laneId: string;
1730
+ readonly operationId: string;
1731
+ readonly expectedGoalEventId: string;
1732
+ readonly expectedGoalUpdatedAt: number;
1733
+ readonly expectedHistoryToken: string;
1734
+ readonly head: string;
1735
+ readonly baseHead: string;
1736
+ readonly owner: {
1737
+ readonly id: string;
1738
+ readonly name: string;
1739
+ };
1740
+ readonly sessionId: string;
1741
+ readonly expectedWork: string;
1742
+ readonly worker: {
1743
+ readonly host: string;
1744
+ readonly agentId: string;
1745
+ readonly name: string;
1746
+ readonly paneId: string;
1747
+ readonly relationship?: {
1748
+ readonly parentAgentId: string;
1749
+ readonly relation: "delegated" | "pair" | "review";
1750
+ };
1751
+ };
1752
+ readonly worktree: string;
1753
+ readonly branch: string;
1754
+ } | {
1755
+ readonly kind: "work.reassign";
1756
+ readonly goalId: string;
1757
+ readonly from: {
1758
+ readonly id: string;
1759
+ readonly name: string;
1760
+ };
1761
+ readonly to: {
1762
+ readonly id: string;
1763
+ readonly name: string;
1764
+ };
1765
+ readonly toAgent: {
1766
+ readonly _tag: "clear";
1767
+ } | {
1768
+ readonly _tag: "keep";
1769
+ } | {
1770
+ readonly _tag: "set";
1771
+ readonly agent: {
1772
+ readonly host: string;
1773
+ readonly agentId: string;
1774
+ readonly name: string;
1775
+ readonly paneId: string;
1776
+ readonly relationship?: {
1777
+ readonly parentAgentId: string;
1778
+ readonly relation: "delegated" | "pair" | "review";
1779
+ };
1780
+ };
1781
+ };
1782
+ readonly reason: string;
1783
+ readonly expectedGoalEventId: string;
1784
+ readonly expectedGoalUpdatedAt: number;
1785
+ } | {
1786
+ readonly kind: "browser.mcp.recover";
1787
+ } | {
1788
+ readonly kind: "nix.check";
1789
+ } | {
1790
+ readonly kind: "nix.apply";
1791
+ readonly ref: string;
489
1792
  } | {
490
1793
  readonly kind: "agent.message";
491
1794
  readonly session: string;
492
1795
  readonly message: string;
493
- } | {
494
- readonly kind: "browser.mcp.recover";
495
1796
  };
496
1797
  readonly result: string | null;
1798
+ readonly acceptedReceipt?: string | null;
1799
+ readonly durableOperation?: true;
497
1800
  readonly error: string | null;
498
1801
  readonly worker?: {
499
1802
  readonly host: string;
@@ -536,24 +1839,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
536
1839
  readonly expiredAt?: number | null;
537
1840
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
538
1841
  readonly payload: {
539
- readonly kind: "nix.check";
540
- } | {
541
- readonly kind: "nix.apply";
542
- readonly ref: string;
543
- } | {
544
1842
  readonly kind: "agent.delegate";
545
1843
  readonly repository: string;
546
1844
  readonly prompt: string;
547
- readonly mode: "consult" | "review" | "work";
1845
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
548
1846
  readonly channel?: "coordinator_chat";
1847
+ } | {
1848
+ readonly kind: "work.reconcile";
1849
+ readonly repository: string;
1850
+ readonly pullRequest: number;
1851
+ readonly goalId: string;
1852
+ readonly laneId: string;
1853
+ readonly operationId: string;
1854
+ readonly expectedRevision: number;
1855
+ readonly expectedHead: string;
1856
+ readonly newHead: string;
1857
+ readonly expectedOwner: {
1858
+ readonly id: string;
1859
+ readonly name: string;
1860
+ };
1861
+ readonly expectedGoalEventId: string;
1862
+ readonly bindingDispatchRequestId: string;
1863
+ readonly sessionId: string;
1864
+ readonly expectedWork: string;
1865
+ readonly worker: {
1866
+ readonly host: string;
1867
+ readonly agentId: string;
1868
+ readonly name: string;
1869
+ readonly paneId: string;
1870
+ readonly relationship?: {
1871
+ readonly parentAgentId: string;
1872
+ readonly relation: "delegated" | "pair" | "review";
1873
+ };
1874
+ };
1875
+ readonly worktree: string;
1876
+ readonly branch: string;
1877
+ } | {
1878
+ readonly kind: "work.admit";
1879
+ readonly repository: string;
1880
+ readonly pullRequest: number;
1881
+ readonly reviewUrl: string;
1882
+ readonly goalId: string;
1883
+ readonly laneId: string;
1884
+ readonly operationId: string;
1885
+ readonly expectedAbsenceToken: string;
1886
+ readonly head: string;
1887
+ readonly baseHead: string;
1888
+ readonly owner: {
1889
+ readonly id: string;
1890
+ readonly name: string;
1891
+ };
1892
+ readonly sessionId: string;
1893
+ readonly expectedWork: string;
1894
+ readonly worker: {
1895
+ readonly host: string;
1896
+ readonly agentId: string;
1897
+ readonly name: string;
1898
+ readonly paneId: string;
1899
+ readonly relationship?: {
1900
+ readonly parentAgentId: string;
1901
+ readonly relation: "delegated" | "pair" | "review";
1902
+ };
1903
+ };
1904
+ readonly worktree: string;
1905
+ readonly branch: string;
1906
+ readonly title: string;
1907
+ readonly summary: string;
1908
+ readonly detail: string;
1909
+ } | {
1910
+ readonly kind: "work.recover";
1911
+ readonly repository: string;
1912
+ readonly pullRequest: number;
1913
+ readonly reviewUrl: string;
1914
+ readonly goalId: string;
1915
+ readonly laneId: string;
1916
+ readonly operationId: string;
1917
+ readonly expectedGoalEventId: string;
1918
+ readonly expectedGoalUpdatedAt: number;
1919
+ readonly expectedHistoryToken: string;
1920
+ readonly head: string;
1921
+ readonly baseHead: string;
1922
+ readonly owner: {
1923
+ readonly id: string;
1924
+ readonly name: string;
1925
+ };
1926
+ readonly sessionId: string;
1927
+ readonly expectedWork: string;
1928
+ readonly worker: {
1929
+ readonly host: string;
1930
+ readonly agentId: string;
1931
+ readonly name: string;
1932
+ readonly paneId: string;
1933
+ readonly relationship?: {
1934
+ readonly parentAgentId: string;
1935
+ readonly relation: "delegated" | "pair" | "review";
1936
+ };
1937
+ };
1938
+ readonly worktree: string;
1939
+ readonly branch: string;
1940
+ } | {
1941
+ readonly kind: "work.reassign";
1942
+ readonly goalId: string;
1943
+ readonly from: {
1944
+ readonly id: string;
1945
+ readonly name: string;
1946
+ };
1947
+ readonly to: {
1948
+ readonly id: string;
1949
+ readonly name: string;
1950
+ };
1951
+ readonly toAgent: {
1952
+ readonly _tag: "clear";
1953
+ } | {
1954
+ readonly _tag: "keep";
1955
+ } | {
1956
+ readonly _tag: "set";
1957
+ readonly agent: {
1958
+ readonly host: string;
1959
+ readonly agentId: string;
1960
+ readonly name: string;
1961
+ readonly paneId: string;
1962
+ readonly relationship?: {
1963
+ readonly parentAgentId: string;
1964
+ readonly relation: "delegated" | "pair" | "review";
1965
+ };
1966
+ };
1967
+ };
1968
+ readonly reason: string;
1969
+ readonly expectedGoalEventId: string;
1970
+ readonly expectedGoalUpdatedAt: number;
1971
+ } | {
1972
+ readonly kind: "browser.mcp.recover";
1973
+ } | {
1974
+ readonly kind: "nix.check";
1975
+ } | {
1976
+ readonly kind: "nix.apply";
1977
+ readonly ref: string;
549
1978
  } | {
550
1979
  readonly kind: "agent.message";
551
1980
  readonly session: string;
552
1981
  readonly message: string;
553
- } | {
554
- readonly kind: "browser.mcp.recover";
555
1982
  };
556
1983
  readonly result: string | null;
1984
+ readonly acceptedReceipt?: string | null;
1985
+ readonly durableOperation?: true;
557
1986
  readonly error: string | null;
558
1987
  readonly worker?: {
559
1988
  readonly host: string;
@@ -592,24 +2021,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
592
2021
  readonly expiredAt?: number | null;
593
2022
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
594
2023
  readonly payload: {
595
- readonly kind: "nix.check";
596
- } | {
597
- readonly kind: "nix.apply";
598
- readonly ref: string;
599
- } | {
600
2024
  readonly kind: "agent.delegate";
601
2025
  readonly repository: string;
602
2026
  readonly prompt: string;
603
- readonly mode: "consult" | "review" | "work";
2027
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
604
2028
  readonly channel?: "coordinator_chat";
2029
+ } | {
2030
+ readonly kind: "work.reconcile";
2031
+ readonly repository: string;
2032
+ readonly pullRequest: number;
2033
+ readonly goalId: string;
2034
+ readonly laneId: string;
2035
+ readonly operationId: string;
2036
+ readonly expectedRevision: number;
2037
+ readonly expectedHead: string;
2038
+ readonly newHead: string;
2039
+ readonly expectedOwner: {
2040
+ readonly id: string;
2041
+ readonly name: string;
2042
+ };
2043
+ readonly expectedGoalEventId: string;
2044
+ readonly bindingDispatchRequestId: string;
2045
+ readonly sessionId: string;
2046
+ readonly expectedWork: string;
2047
+ readonly worker: {
2048
+ readonly host: string;
2049
+ readonly agentId: string;
2050
+ readonly name: string;
2051
+ readonly paneId: string;
2052
+ readonly relationship?: {
2053
+ readonly parentAgentId: string;
2054
+ readonly relation: "delegated" | "pair" | "review";
2055
+ };
2056
+ };
2057
+ readonly worktree: string;
2058
+ readonly branch: string;
2059
+ } | {
2060
+ readonly kind: "work.admit";
2061
+ readonly repository: string;
2062
+ readonly pullRequest: number;
2063
+ readonly reviewUrl: string;
2064
+ readonly goalId: string;
2065
+ readonly laneId: string;
2066
+ readonly operationId: string;
2067
+ readonly expectedAbsenceToken: string;
2068
+ readonly head: string;
2069
+ readonly baseHead: string;
2070
+ readonly owner: {
2071
+ readonly id: string;
2072
+ readonly name: string;
2073
+ };
2074
+ readonly sessionId: string;
2075
+ readonly expectedWork: string;
2076
+ readonly worker: {
2077
+ readonly host: string;
2078
+ readonly agentId: string;
2079
+ readonly name: string;
2080
+ readonly paneId: string;
2081
+ readonly relationship?: {
2082
+ readonly parentAgentId: string;
2083
+ readonly relation: "delegated" | "pair" | "review";
2084
+ };
2085
+ };
2086
+ readonly worktree: string;
2087
+ readonly branch: string;
2088
+ readonly title: string;
2089
+ readonly summary: string;
2090
+ readonly detail: string;
2091
+ } | {
2092
+ readonly kind: "work.recover";
2093
+ readonly repository: string;
2094
+ readonly pullRequest: number;
2095
+ readonly reviewUrl: string;
2096
+ readonly goalId: string;
2097
+ readonly laneId: string;
2098
+ readonly operationId: string;
2099
+ readonly expectedGoalEventId: string;
2100
+ readonly expectedGoalUpdatedAt: number;
2101
+ readonly expectedHistoryToken: string;
2102
+ readonly head: string;
2103
+ readonly baseHead: string;
2104
+ readonly owner: {
2105
+ readonly id: string;
2106
+ readonly name: string;
2107
+ };
2108
+ readonly sessionId: string;
2109
+ readonly expectedWork: string;
2110
+ readonly worker: {
2111
+ readonly host: string;
2112
+ readonly agentId: string;
2113
+ readonly name: string;
2114
+ readonly paneId: string;
2115
+ readonly relationship?: {
2116
+ readonly parentAgentId: string;
2117
+ readonly relation: "delegated" | "pair" | "review";
2118
+ };
2119
+ };
2120
+ readonly worktree: string;
2121
+ readonly branch: string;
2122
+ } | {
2123
+ readonly kind: "work.reassign";
2124
+ readonly goalId: string;
2125
+ readonly from: {
2126
+ readonly id: string;
2127
+ readonly name: string;
2128
+ };
2129
+ readonly to: {
2130
+ readonly id: string;
2131
+ readonly name: string;
2132
+ };
2133
+ readonly toAgent: {
2134
+ readonly _tag: "clear";
2135
+ } | {
2136
+ readonly _tag: "keep";
2137
+ } | {
2138
+ readonly _tag: "set";
2139
+ readonly agent: {
2140
+ readonly host: string;
2141
+ readonly agentId: string;
2142
+ readonly name: string;
2143
+ readonly paneId: string;
2144
+ readonly relationship?: {
2145
+ readonly parentAgentId: string;
2146
+ readonly relation: "delegated" | "pair" | "review";
2147
+ };
2148
+ };
2149
+ };
2150
+ readonly reason: string;
2151
+ readonly expectedGoalEventId: string;
2152
+ readonly expectedGoalUpdatedAt: number;
2153
+ } | {
2154
+ readonly kind: "browser.mcp.recover";
2155
+ } | {
2156
+ readonly kind: "nix.check";
2157
+ } | {
2158
+ readonly kind: "nix.apply";
2159
+ readonly ref: string;
605
2160
  } | {
606
2161
  readonly kind: "agent.message";
607
2162
  readonly session: string;
608
2163
  readonly message: string;
609
- } | {
610
- readonly kind: "browser.mcp.recover";
611
2164
  };
612
2165
  readonly result: string | null;
2166
+ readonly acceptedReceipt?: string | null;
2167
+ readonly durableOperation?: true;
613
2168
  readonly error: string | null;
614
2169
  readonly worker?: {
615
2170
  readonly host: string;
@@ -679,7 +2234,7 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
679
2234
  readonly error: string | null;
680
2235
  };
681
2236
  }, FleetOperationError, never>;
682
- recover: () => Effect.Effect<string[], FleetStoreError | FleetTransitionConflictError, never>;
2237
+ recover: () => Effect.Effect<string[], FleetOperationError | FleetStoreError | FleetTransitionConflictError, never>;
683
2238
  abortSubmission: (jobId: string, detail: string) => Effect.Effect<{
684
2239
  readonly id: string;
685
2240
  readonly createdAt: number;
@@ -695,24 +2250,150 @@ export declare const makeFleetService: (options: Options) => Effect.Effect<{
695
2250
  readonly expiredAt?: number | null;
696
2251
  readonly status: "expired" | "failed" | "interrupted" | "pending_approval" | "queued" | "rejected" | "running" | "succeeded";
697
2252
  readonly payload: {
698
- readonly kind: "nix.check";
699
- } | {
700
- readonly kind: "nix.apply";
701
- readonly ref: string;
702
- } | {
703
2253
  readonly kind: "agent.delegate";
704
2254
  readonly repository: string;
705
2255
  readonly prompt: string;
706
- readonly mode: "consult" | "review" | "work";
2256
+ readonly mode: "consult" | "review" | "transition_summary" | "work";
707
2257
  readonly channel?: "coordinator_chat";
2258
+ } | {
2259
+ readonly kind: "work.reconcile";
2260
+ readonly repository: string;
2261
+ readonly pullRequest: number;
2262
+ readonly goalId: string;
2263
+ readonly laneId: string;
2264
+ readonly operationId: string;
2265
+ readonly expectedRevision: number;
2266
+ readonly expectedHead: string;
2267
+ readonly newHead: string;
2268
+ readonly expectedOwner: {
2269
+ readonly id: string;
2270
+ readonly name: string;
2271
+ };
2272
+ readonly expectedGoalEventId: string;
2273
+ readonly bindingDispatchRequestId: string;
2274
+ readonly sessionId: string;
2275
+ readonly expectedWork: string;
2276
+ readonly worker: {
2277
+ readonly host: string;
2278
+ readonly agentId: string;
2279
+ readonly name: string;
2280
+ readonly paneId: string;
2281
+ readonly relationship?: {
2282
+ readonly parentAgentId: string;
2283
+ readonly relation: "delegated" | "pair" | "review";
2284
+ };
2285
+ };
2286
+ readonly worktree: string;
2287
+ readonly branch: string;
2288
+ } | {
2289
+ readonly kind: "work.admit";
2290
+ readonly repository: string;
2291
+ readonly pullRequest: number;
2292
+ readonly reviewUrl: string;
2293
+ readonly goalId: string;
2294
+ readonly laneId: string;
2295
+ readonly operationId: string;
2296
+ readonly expectedAbsenceToken: string;
2297
+ readonly head: string;
2298
+ readonly baseHead: string;
2299
+ readonly owner: {
2300
+ readonly id: string;
2301
+ readonly name: string;
2302
+ };
2303
+ readonly sessionId: string;
2304
+ readonly expectedWork: string;
2305
+ readonly worker: {
2306
+ readonly host: string;
2307
+ readonly agentId: string;
2308
+ readonly name: string;
2309
+ readonly paneId: string;
2310
+ readonly relationship?: {
2311
+ readonly parentAgentId: string;
2312
+ readonly relation: "delegated" | "pair" | "review";
2313
+ };
2314
+ };
2315
+ readonly worktree: string;
2316
+ readonly branch: string;
2317
+ readonly title: string;
2318
+ readonly summary: string;
2319
+ readonly detail: string;
2320
+ } | {
2321
+ readonly kind: "work.recover";
2322
+ readonly repository: string;
2323
+ readonly pullRequest: number;
2324
+ readonly reviewUrl: string;
2325
+ readonly goalId: string;
2326
+ readonly laneId: string;
2327
+ readonly operationId: string;
2328
+ readonly expectedGoalEventId: string;
2329
+ readonly expectedGoalUpdatedAt: number;
2330
+ readonly expectedHistoryToken: string;
2331
+ readonly head: string;
2332
+ readonly baseHead: string;
2333
+ readonly owner: {
2334
+ readonly id: string;
2335
+ readonly name: string;
2336
+ };
2337
+ readonly sessionId: string;
2338
+ readonly expectedWork: string;
2339
+ readonly worker: {
2340
+ readonly host: string;
2341
+ readonly agentId: string;
2342
+ readonly name: string;
2343
+ readonly paneId: string;
2344
+ readonly relationship?: {
2345
+ readonly parentAgentId: string;
2346
+ readonly relation: "delegated" | "pair" | "review";
2347
+ };
2348
+ };
2349
+ readonly worktree: string;
2350
+ readonly branch: string;
2351
+ } | {
2352
+ readonly kind: "work.reassign";
2353
+ readonly goalId: string;
2354
+ readonly from: {
2355
+ readonly id: string;
2356
+ readonly name: string;
2357
+ };
2358
+ readonly to: {
2359
+ readonly id: string;
2360
+ readonly name: string;
2361
+ };
2362
+ readonly toAgent: {
2363
+ readonly _tag: "clear";
2364
+ } | {
2365
+ readonly _tag: "keep";
2366
+ } | {
2367
+ readonly _tag: "set";
2368
+ readonly agent: {
2369
+ readonly host: string;
2370
+ readonly agentId: string;
2371
+ readonly name: string;
2372
+ readonly paneId: string;
2373
+ readonly relationship?: {
2374
+ readonly parentAgentId: string;
2375
+ readonly relation: "delegated" | "pair" | "review";
2376
+ };
2377
+ };
2378
+ };
2379
+ readonly reason: string;
2380
+ readonly expectedGoalEventId: string;
2381
+ readonly expectedGoalUpdatedAt: number;
2382
+ } | {
2383
+ readonly kind: "browser.mcp.recover";
2384
+ } | {
2385
+ readonly kind: "nix.check";
2386
+ } | {
2387
+ readonly kind: "nix.apply";
2388
+ readonly ref: string;
708
2389
  } | {
709
2390
  readonly kind: "agent.message";
710
2391
  readonly session: string;
711
2392
  readonly message: string;
712
- } | {
713
- readonly kind: "browser.mcp.recover";
714
2393
  };
715
2394
  readonly result: string | null;
2395
+ readonly acceptedReceipt?: string | null;
2396
+ readonly durableOperation?: true;
716
2397
  readonly error: string | null;
717
2398
  readonly worker?: {
718
2399
  readonly host: string;