@wjarka/cezarion 0.17.0-dev.5413 → 0.17.0-dev.5423

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 (53) hide show
  1. package/dist/delegation/routes.d.ts +77 -77
  2. package/dist/delegation/transport.d.ts +4 -4
  3. package/dist/server/self-update-routes.d.ts +19 -19
  4. package/dist/workflows/run/compose.d.ts +4 -2
  5. package/dist/workflows/run/compose.js +46 -37
  6. package/dist/workflows/run/compose.js.map +1 -1
  7. package/dist/workflows/run/family-reconciler.d.ts +3 -6
  8. package/dist/workflows/run/family-reconciler.js +5 -18
  9. package/dist/workflows/run/family-reconciler.js.map +1 -1
  10. package/dist/workflows/run/human-waits.d.ts +2 -0
  11. package/dist/workflows/run/human-waits.js +1 -6
  12. package/dist/workflows/run/human-waits.js.map +1 -1
  13. package/dist/workflows/run/input-delivery.d.ts +2 -2
  14. package/dist/workflows/run/input-delivery.js +2 -2
  15. package/dist/workflows/run/input-delivery.js.map +1 -1
  16. package/dist/workflows/run/run-cancel.d.ts +4 -4
  17. package/dist/workflows/run/run-cancel.js +5 -6
  18. package/dist/workflows/run/run-cancel.js.map +1 -1
  19. package/dist/workflows/run/run-finish.d.ts +2 -1
  20. package/dist/workflows/run/run-finish.js +1 -1
  21. package/dist/workflows/run/run-finish.js.map +1 -1
  22. package/dist/workflows/run/run-recovery.d.ts +4 -3
  23. package/dist/workflows/run/run-recovery.js +5 -9
  24. package/dist/workflows/run/run-recovery.js.map +1 -1
  25. package/dist/workflows/run/step-loop.d.ts +2 -0
  26. package/dist/workflows/run/step-loop.js +1 -1
  27. package/dist/workflows/run/step-loop.js.map +1 -1
  28. package/dist/workflows/run/subagent-waits.d.ts +2 -0
  29. package/dist/workflows/run/subagent-waits.js +1 -2
  30. package/dist/workflows/run/subagent-waits.js.map +1 -1
  31. package/dist/workflows/run/turn-settler.d.ts +2 -3
  32. package/dist/workflows/run/turn-settler.js +1 -1
  33. package/dist/workflows/run/turn-settler.js.map +1 -1
  34. package/dist/workflows/run/wait-cancellation.d.ts +34 -0
  35. package/dist/workflows/run/wait-cancellation.js +54 -0
  36. package/dist/workflows/run/wait-cancellation.js.map +1 -0
  37. package/dist/workflows/run/wait-registry.d.ts +3 -24
  38. package/dist/workflows/run/wait-registry.js +4 -55
  39. package/dist/workflows/run/wait-registry.js.map +1 -1
  40. package/dist/workflows/run/wait-resolve.d.ts +1139 -0
  41. package/dist/workflows/run/wait-resolve.js +313 -0
  42. package/dist/workflows/run/wait-resolve.js.map +1 -0
  43. package/dist/workflows/run/wait-watches.d.ts +11 -1117
  44. package/dist/workflows/run/wait-watches.js +10 -233
  45. package/dist/workflows/run/wait-watches.js.map +1 -1
  46. package/dist/workflows/run/wake-admission.d.ts +4 -14
  47. package/dist/workflows/run/wake-admission.js +4 -34
  48. package/dist/workflows/run/wake-admission.js.map +1 -1
  49. package/dist/workflows/run.js +4 -4
  50. package/package.json +3 -3
  51. package/dist/workflows/run/wait-cancel.d.ts +0 -9
  52. package/dist/workflows/run/wait-cancel.js +0 -17
  53. package/dist/workflows/run/wait-cancel.js.map +0 -1
@@ -27,6 +27,18 @@ export declare function delegationFailure(error: unknown): {
27
27
  export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
28
28
  "/list": {
29
29
  $get: {
30
+ output: {
31
+ error: string;
32
+ code?: "invalid_input" | undefined;
33
+ };
34
+ outputFormat: "json";
35
+ status: 400;
36
+ input: {
37
+ query: {
38
+ offset?: string | undefined;
39
+ };
40
+ };
41
+ } | {
30
42
  output: {
31
43
  workers: {
32
44
  workerId: string;
@@ -64,18 +76,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
64
76
  offset?: string | undefined;
65
77
  };
66
78
  };
67
- } | {
68
- output: {
69
- error: string;
70
- code?: "invalid_input" | undefined;
71
- };
72
- outputFormat: "json";
73
- status: 400;
74
- input: {
75
- query: {
76
- offset?: string | undefined;
77
- };
78
- };
79
79
  };
80
80
  };
81
81
  } & {
@@ -90,6 +90,17 @@ export declare function createDelegationRoutes(service: DelegationService, crede
90
90
  authFailureId?: string | undefined;
91
91
  runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
92
92
  }[];
93
+ } | {
94
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
95
+ models: {
96
+ id: string;
97
+ label: string;
98
+ description: string;
99
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
100
+ }[];
101
+ source: "cache" | "live" | "unavailable";
102
+ stale: boolean;
103
+ reason?: string | undefined;
93
104
  } | {
94
105
  tasks: {
95
106
  id: string;
@@ -102,17 +113,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
102
113
  reason?: string | undefined;
103
114
  }[];
104
115
  nextOffset?: number | undefined;
105
- } | {
106
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
107
- models: {
108
- id: string;
109
- label: string;
110
- description: string;
111
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
112
- }[];
113
- source: "cache" | "live" | "unavailable";
114
- stale: boolean;
115
- reason?: string | undefined;
116
116
  };
117
117
  outputFormat: "json";
118
118
  status: 200;
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
221
221
  status: 200;
222
222
  input: {
223
223
  json: {
224
- workerIds: string[];
225
- timeoutSeconds?: number | undefined;
226
- mode?: "all" | "any" | "one" | undefined;
227
- } | {
228
224
  requestIds: string[];
229
225
  mode?: "all" | "any" | "one" | undefined;
230
226
  timeoutSeconds?: number | undefined;
227
+ } | {
228
+ workerIds: string[];
229
+ timeoutSeconds?: number | undefined;
230
+ mode?: "all" | "any" | "one" | undefined;
231
231
  } | {
232
232
  peerIds: string[];
233
233
  timeoutSeconds?: number | undefined;
@@ -613,6 +613,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
613
613
  } & {
614
614
  "/:workerId": {
615
615
  $get: {
616
+ output: {
617
+ error: string;
618
+ code?: "invalid_input" | undefined;
619
+ };
620
+ outputFormat: "json";
621
+ status: 400;
622
+ input: {
623
+ param: {
624
+ workerId: string;
625
+ };
626
+ };
627
+ } | {
616
628
  output: {
617
629
  workerId: string;
618
630
  parentRunId: string;
@@ -716,7 +728,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
716
728
  workerId: string;
717
729
  };
718
730
  };
719
- } | {
731
+ };
732
+ };
733
+ } & {
734
+ "/:workerId/collect": {
735
+ $post: {
720
736
  output: {
721
737
  error: string;
722
738
  code?: "invalid_input" | undefined;
@@ -727,12 +743,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
727
743
  param: {
728
744
  workerId: string;
729
745
  };
746
+ } & {
747
+ json: Record<string, never>;
730
748
  };
731
- };
732
- };
733
- } & {
734
- "/:workerId/collect": {
735
- $post: {
749
+ } | {
736
750
  output: {
737
751
  workerId: string;
738
752
  parentRunId: string;
@@ -834,7 +848,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
834
848
  } & {
835
849
  json: Record<string, never>;
836
850
  };
837
- } | {
851
+ };
852
+ };
853
+ } & {
854
+ "/:workerId/steer": {
855
+ $post: {
838
856
  output: {
839
857
  error: string;
840
858
  code?: "invalid_input" | undefined;
@@ -846,13 +864,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
846
864
  workerId: string;
847
865
  };
848
866
  } & {
849
- json: Record<string, never>;
867
+ json: {
868
+ text: string;
869
+ };
850
870
  };
851
- };
852
- };
853
- } & {
854
- "/:workerId/steer": {
855
- $post: {
871
+ } | {
856
872
  output: {
857
873
  workerId: string;
858
874
  state: "delivered" | "queued";
@@ -868,7 +884,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
868
884
  text: string;
869
885
  };
870
886
  };
871
- } | {
887
+ };
888
+ };
889
+ } & {
890
+ "/:workerId/stop": {
891
+ $post: {
872
892
  output: {
873
893
  error: string;
874
894
  code?: "invalid_input" | undefined;
@@ -880,15 +900,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
880
900
  workerId: string;
881
901
  };
882
902
  } & {
883
- json: {
884
- text: string;
885
- };
903
+ json: Record<string, never>;
886
904
  };
887
- };
888
- };
889
- } & {
890
- "/:workerId/stop": {
891
- $post: {
905
+ } | {
892
906
  output: {
893
907
  workerId: string;
894
908
  state: "stopping" | "terminated";
@@ -902,7 +916,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
902
916
  } & {
903
917
  json: Record<string, never>;
904
918
  };
905
- } | {
919
+ };
920
+ };
921
+ } & {
922
+ "/:workerId/destroy": {
923
+ $post: {
906
924
  output: {
907
925
  error: string;
908
926
  code?: "invalid_input" | undefined;
@@ -916,11 +934,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
916
934
  } & {
917
935
  json: Record<string, never>;
918
936
  };
919
- };
920
- };
921
- } & {
922
- "/:workerId/destroy": {
923
- $post: {
937
+ } | {
924
938
  output: {
925
939
  workerId: string;
926
940
  state: "complete" | "incomplete";
@@ -943,20 +957,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
943
957
  } & {
944
958
  json: Record<string, never>;
945
959
  };
946
- } | {
947
- output: {
948
- error: string;
949
- code?: "invalid_input" | undefined;
950
- };
951
- outputFormat: "json";
952
- status: 400;
953
- input: {
954
- param: {
955
- workerId: string;
956
- };
957
- } & {
958
- json: Record<string, never>;
959
- };
960
960
  } | {
961
961
  output: {
962
962
  workerId: string;
@@ -986,13 +986,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
986
986
  "/:workerId/diff": {
987
987
  $get: {
988
988
  output: {
989
- workerId: string;
990
- baselineSha: string;
991
- diff: string;
992
- truncated: boolean;
989
+ error: string;
990
+ code?: "invalid_input" | undefined;
993
991
  };
994
992
  outputFormat: "json";
995
- status: 200;
993
+ status: 400;
996
994
  input: {
997
995
  param: {
998
996
  workerId: string;
@@ -1000,11 +998,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1000
998
  };
1001
999
  } | {
1002
1000
  output: {
1003
- error: string;
1004
- code?: "invalid_input" | undefined;
1001
+ workerId: string;
1002
+ baselineSha: string;
1003
+ diff: string;
1004
+ truncated: boolean;
1005
1005
  };
1006
1006
  outputFormat: "json";
1007
- status: 400;
1007
+ status: 200;
1008
1008
  input: {
1009
1009
  param: {
1010
1010
  workerId: string;
@@ -196,13 +196,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
196
196
  status: 200;
197
197
  input: {
198
198
  json: {
199
- requestIds: string[];
200
- mode?: "all" | "any" | "one" | undefined;
201
- timeoutSeconds?: number | undefined;
202
- } | {
203
199
  workerIds: string[];
204
200
  timeoutSeconds?: number | undefined;
205
201
  mode?: "all" | "any" | "one" | undefined;
202
+ } | {
203
+ requestIds: string[];
204
+ mode?: "all" | "any" | "one" | undefined;
205
+ timeoutSeconds?: number | undefined;
206
206
  } | {
207
207
  peerIds: string[];
208
208
  timeoutSeconds?: number | undefined;
@@ -184,6 +184,17 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
184
184
  } & {
185
185
  "/workspace/self-update/channel": {
186
186
  $put: {
187
+ output: {
188
+ error: string;
189
+ };
190
+ outputFormat: "json";
191
+ status: 500;
192
+ input: {
193
+ json: {
194
+ channel: "development" | "nightly" | "stable";
195
+ };
196
+ };
197
+ } | {
187
198
  output: {
188
199
  version: string;
189
200
  installKind: "checkout" | "global-npm" | "managed" | "npx" | "unknown";
@@ -230,22 +241,22 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
230
241
  channel: "development" | "nightly" | "stable";
231
242
  };
232
243
  };
233
- } | {
244
+ };
245
+ };
246
+ } & {
247
+ "/workspace/self-update/apply": {
248
+ $post: {
234
249
  output: {
235
250
  error: string;
236
251
  };
237
252
  outputFormat: "json";
238
- status: 500;
253
+ status: 409;
239
254
  input: {
240
255
  json: {
241
- channel: "development" | "nightly" | "stable";
256
+ version: string;
242
257
  };
243
258
  };
244
- };
245
- };
246
- } & {
247
- "/workspace/self-update/apply": {
248
- $post: {
259
+ } | {
249
260
  output: {
250
261
  version: string;
251
262
  installKind: "checkout" | "global-npm" | "managed" | "npx" | "unknown";
@@ -292,17 +303,6 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
292
303
  version: string;
293
304
  };
294
305
  };
295
- } | {
296
- output: {
297
- error: string;
298
- };
299
- outputFormat: "json";
300
- status: 409;
301
- input: {
302
- json: {
303
- version: string;
304
- };
305
- };
306
306
  };
307
307
  };
308
308
  }, "/", "/workspace/self-update/apply">;
@@ -1,3 +1,4 @@
1
+ import { WaitCancellation } from './wait-cancellation.ts';
1
2
  import { WaitEngine } from './wait-engine.ts';
2
3
  import { MemoryGuard } from './memory-guard.ts';
3
4
  import { RunCancel } from './run-cancel.ts';
@@ -17,7 +18,7 @@ import { FamilyReconciler } from './family-reconciler.ts';
17
18
  import * as completionGateReads from './completion-gate.ts';
18
19
  import { WaitRegistry } from './wait-registry.ts';
19
20
  import { WakeRetries } from './wake-retries.ts';
20
- import { WaitWatches } from './wait-watches.ts';
21
+ import { WaitResolve } from './wait-resolve.ts';
21
22
  import { HumanWaits } from './human-waits.ts';
22
23
  import { SubagentWaits } from './subagent-waits.ts';
23
24
  import { RunStart } from './run-start.ts';
@@ -72,9 +73,10 @@ export interface RunModules {
72
73
  line: RunLine;
73
74
  workerQuestions: WorkerQuestions;
74
75
  familyReconciler: FamilyReconciler;
75
- waitWatches: WaitWatches;
76
+ waitResolve: WaitResolve;
76
77
  waitRegistry: WaitRegistry;
77
78
  waitEngine: WaitEngine;
79
+ waitCancellation: WaitCancellation;
78
80
  subagentWaits: SubagentWaits;
79
81
  humanWaits: HumanWaits;
80
82
  sessionHelperHost: sessionEvents.SessionHelperHost;
@@ -1,3 +1,4 @@
1
+ import { WaitCancellation } from './wait-cancellation.js';
1
2
  import { WaitEngine } from './wait-engine.js';
2
3
  import { transitionTurnBoundary } from './turn-boundary.js';
3
4
  import { MemoryGuard } from './memory-guard.js';
@@ -22,7 +23,7 @@ import { WorkerQuestions } from './worker-questions.js';
22
23
  import { FamilyReconciler } from './family-reconciler.js';
23
24
  import { WaitRegistry } from './wait-registry.js';
24
25
  import { WakeRetries } from './wake-retries.js';
25
- import { WaitWatches } from './wait-watches.js';
26
+ import { WaitResolve } from './wait-resolve.js';
26
27
  import { HumanWaits } from './human-waits.js';
27
28
  import { SubagentWaits } from './subagent-waits.js';
28
29
  import { RunStart } from './run-start.js';
@@ -146,57 +147,63 @@ export function composeRunModules(context, host) {
146
147
  transitionTurnBoundary(state, { kind: 'human-wait-opened', phase: 'refresh-question', session: state.liveSession.session, pending: value }); },
147
148
  }, MAX_AUTO_CONTINUES);
148
149
  modules.familyReconciler = new FamilyReconciler(context, {
149
- reapTerminalScratch: id => modules.runSettlement.reapTerminalScratch(id), cancelOpenWaits: id => modules.wakeAdmission.cancelOpenWaits(id),
150
- resolvePeerWaits: runs => modules.waitRegistry.resolvePeerWaits(runs),
150
+ get waitCancellation() { return modules.waitCancellation; },
151
+ reapTerminalScratch: id => modules.runSettlement.reapTerminalScratch(id),
152
+ resolvePeerWaits: runs => modules.waitResolve.resolvePeerWaits(runs),
151
153
  active: id => host.active.get(id), isActive: id => host.isActive(id), recoveringRun: run => modules.recovery.recoveringRun(run),
152
- cancel: id => host.cancel(id), armWait: (id, wait) => modules.waitWatches.armWait(id, wait),
153
- armWorkerDeadline: (id, wait, delay) => modules.waitWatches.armWorkerDeadline(id, wait, delay), disarmWait: id => host.disarmWait(id),
154
- resolveWait: (id, waitId, result, observed) => modules.waitRegistry.resolveWait(id, waitId, result, observed),
155
- hasWorkerResolveRetry: id => modules.waitWatches.hasWorkerResolveRetry(id),
156
- recordWorkerResolveRetry: id => modules.waitWatches.recordWorkerResolveRetry(id),
154
+ cancel: id => host.cancel(id), armWait: (id, wait) => modules.waitResolve.armWait(id, wait),
155
+ resolveWorkerWait: (id, entry, observed) => modules.waitResolve.resolveWorkerWait(id, entry, observed),
157
156
  retireSettledQuestions: id => modules.workerQuestions.retireSettledQuestions(id), closeRoutedQuestions: id => modules.workerQuestions.closeRoutedQuestions(id),
158
157
  reconcileWorkerWaits: id => host.reconcileWorkerWaits(id),
159
158
  });
160
- modules.waitWatches = new WaitWatches(context, {
159
+ modules.waitResolve = new WaitResolve(context, {
160
+ active: id => host.active.get(id), countAutomaticWakes: id => modules.wakeAdmission.automaticWakes(id),
161
+ cancelAutomaticAtCap: (id, waits) => modules.wakeAdmission.cancelAutomaticAtCap(id, waits),
162
+ reparkWithoutWaits: (id, state) => modules.wakeAdmission.reparkWithoutWaits(id, state),
163
+ waitOnUserWithoutSession: id => modules.wakeAdmission.waitOnUserWithoutSession(id),
164
+ queueWaitWake: id => modules.wakeAdmission.queueWaitWake(id), retryWaitAdmission: id => modules.retries.retryWaitAdmission(id),
161
165
  canProceedWithRun: (id, run) => host.canProceedWithRun(id, run), ciSupervisor: () => host.ciSupervisor,
162
- resolveWait: (id, waitId, result) => modules.waitRegistry.resolveWait(id, waitId, result),
163
- reconcileWorkerWaits: family => host.reconcileWorkerWaits(family),
164
- resolvePeerWait: (id, wait) => modules.waitRegistry.resolvePeerWait(id, wait), disarmWait: id => host.disarmWait(id),
165
- armWorkerDeadline: (id, wait, delay) => modules.waitWatches.armWorkerDeadline(id, wait, delay),
166
- settleWait: (id, waitId, result) => modules.waitWatches.settleWait(id, waitId, result), exitFileRoots: id => modules.waitWatches.exitFileRoots(id),
166
+ reconcileWorkerWaits: family => host.reconcileWorkerWaits(family), disarmWait: id => host.disarmWait(id),
167
167
  subagentSessionLive: id => modules.subagentWaits.sessionLive(id),
168
168
  interruptSubagentWait: (id, waitId) => modules.subagentWaits.interrupt(id, waitId),
169
+ }, MAX_AUTO_CONTINUES);
170
+ modules.waitCancellation = new WaitCancellation(context, {
171
+ disarmWait: id => host.disarmWait(id),
172
+ abortRegistrations: id => modules.waitRegistry.abortRegistrations(id),
173
+ disarmRun: id => modules.waitResolve.disarmRun(id),
174
+ forgetRetries: id => modules.retries.forget(id),
175
+ resetWakeDelivery: id => modules.wakeAdmission.resetWakeDelivery(id),
176
+ removeWake: (id, active) => modules.line.removeWake(id, active),
177
+ retireAdmission: id => modules.line.retireAdmission(id),
178
+ hasActive: id => host.active.has(id),
169
179
  });
170
180
  modules.waitEngine = new WaitEngine(context, {
171
181
  reconcileWorkerWaits: family => host.reconcileWorkerWaits(family),
172
182
  noticeParkedWorkers: id => modules.workerQuestions.noticeParkedWorkers(id),
173
183
  withdrawCezarHumanWaits: id => modules.humanWaits.withdrawCezarHumanWaits(id),
174
- armWait: (id, wait) => modules.waitWatches.armWait(id, wait),
184
+ armWait: (id, wait) => modules.waitResolve.armWait(id, wait),
175
185
  isParked: id => modules.line.isParked(id),
176
186
  parkOnWaits: (id, state) => modules.wakeAdmission.parkOnWaits(id, state),
177
187
  });
178
188
  modules.waitRegistry = new WaitRegistry(context, {
189
+ waitCancellation: modules.waitCancellation,
179
190
  waitEngine: modules.waitEngine,
180
191
  active: id => host.active.get(id), workerExecutionStopped: id => host.workerExecutionStopped(id),
181
192
  executionBlockedByRootFinish: run => host.executionBlockedByRootFinish(run), ciSupervisor: () => host.ciSupervisor,
182
- isParked: id => modules.line.isParked(id), countAutomaticWakes: id => modules.wakeAdmission.automaticWakes(id),
183
- reconcileWorkerWaits: family => host.reconcileWorkerWaits(family), noticeParkedWorkers: id => modules.workerQuestions.noticeParkedWorkers(id),
184
- canProceedWithRun: (id, run) => host.canProceedWithRun(id, run),
185
- exitFileRoots: (id, run) => modules.waitWatches.exitFileRoots(id, run), disarmWait: id => host.disarmWait(id),
186
- settleWait: (id, waitId, result) => modules.waitWatches.settleWait(id, waitId, result),
187
- withdrawCezarHumanWaits: id => modules.humanWaits.withdrawCezarHumanWaits(id), armWait: (id, wait) => modules.waitWatches.armWait(id, wait),
188
- parkOnWaits: (id, state) => modules.wakeAdmission.parkOnWaits(id, state), cancelAutomaticAtCap: (id, waits) => modules.wakeAdmission.cancelAutomaticAtCap(id, waits),
189
- reparkWithoutWaits: (id, state) => modules.wakeAdmission.reparkWithoutWaits(id, state), waitOnUserWithoutSession: id => modules.wakeAdmission.waitOnUserWithoutSession(id),
190
- queueWaitWake: id => modules.wakeAdmission.queueWaitWake(id), retryWaitAdmission: id => modules.retries.retryWaitAdmission(id),
193
+ countAutomaticWakes: id => modules.wakeAdmission.automaticWakes(id),
194
+ reconcileWorkerWaits: family => host.reconcileWorkerWaits(family),
195
+ exitFileRoots: (id, run) => modules.waitResolve.exitFileRoots(id, run), disarmWait: id => host.disarmWait(id),
196
+ settleWait: (id, waitId, result) => modules.waitResolve.settleWait(id, waitId, result),
191
197
  }, MAX_AUTO_CONTINUES);
192
198
  modules.subagentWaits = new SubagentWaits(context, {
199
+ waitCancellation: modules.waitCancellation,
193
200
  waitEngine: modules.waitEngine,
194
201
  active: host.active, isParked: id => modules.line.isParked(id), isAdmitted: id => modules.line.isAdmitted(id),
195
- settleWait: (id, waitId, result) => modules.waitWatches.settleWait(id, waitId, result),
196
- armWait: (id, wait) => modules.waitWatches.armWait(id, wait), disarmWait: id => host.disarmWait(id),
202
+ settleWait: (id, waitId, result) => modules.waitResolve.settleWait(id, waitId, result),
203
+ armWait: (id, wait) => modules.waitResolve.armWait(id, wait), disarmWait: id => host.disarmWait(id),
197
204
  releaseHeldPark: (id, state) => { modules.wakeAdmission.leaveMonitoringPool(id); modules.turnSettler.armIdleTimer(id, state); },
198
205
  }, host.subagentWaitMs().graceMs, host.subagentWaitMs().deadlineMs);
199
- modules.humanWaits = new HumanWaits(context, { waitEngine: modules.waitEngine, routeWorkerQuestion: id => modules.workerQuestions.routeWorkerQuestion(id) }, MAX_AUTO_CONTINUES);
206
+ modules.humanWaits = new HumanWaits(context, { waitCancellation: modules.waitCancellation, waitEngine: modules.waitEngine, routeWorkerQuestion: id => modules.workerQuestions.routeWorkerQuestion(id) }, MAX_AUTO_CONTINUES);
200
207
  modules.sessionHelperHost = {
201
208
  active: host.active, line: modules.line, humanWaits: modules.humanWaits, inputReceiptHost: modules.inputReceiptHost,
202
209
  move: (...args) => host.move(...args),
@@ -273,7 +280,7 @@ export function composeRunModules(context, host) {
273
280
  continueRun: (id, opts, defer) => host.continueRun(id, opts, defer), pump: () => modules.line.pump() });
274
281
  modules.recovery = new RunRecovery(context, modules.familyReconciler, modules.workerQuestions, modules.autoResumeScheduler, {
275
282
  waitEngine: modules.waitEngine, workerScratchCleanup: modules.workerScratchCleanup, humanWaits: modules.humanWaits,
276
- waitWatches: modules.waitWatches, inboxClaims: modules.inboxClaims, orphans: modules.orphans,
283
+ waitResolve: modules.waitResolve, inboxClaims: modules.inboxClaims, orphans: modules.orphans,
277
284
  isActive: (...args) => host.isActive(...args),
278
285
  workerExecutionStopped: (...args) => host.workerExecutionStopped(...args),
279
286
  move: (...args) => host.move(...args),
@@ -286,7 +293,7 @@ export function composeRunModules(context, host) {
286
293
  answerRoutedQuestion: (...args) => modules.inputDelivery.answerRoutedQuestion(...args),
287
294
  queueWaitWake: (...args) => modules.wakeAdmission.queueWaitWake(...args),
288
295
  owesWake: (...args) => modules.wakeAdmission.owesWake(...args),
289
- cancelOpenWaits: (...args) => modules.wakeAdmission.cancelOpenWaits(...args),
296
+ waitCancellation: modules.waitCancellation,
290
297
  settleOrphanedWorkerExecution: (...args) => host.settleOrphanedWorkerExecution(...args),
291
298
  settleRequestedRootFinish: (...args) => modules.runFinish.settleRequestedRootFinish(...args),
292
299
  settleSuccess: (...args) => modules.runSettlement.settleSuccess(...args),
@@ -295,11 +302,12 @@ export function composeRunModules(context, host) {
295
302
  recover: (...args) => host.recover(...args),
296
303
  }, RESTART_CONTINUATION_PROMPT);
297
304
  modules.wakeAdmission = new WakeAdmission(context, {
298
- active: host.active, retries: modules.retries, line: modules.line, waitWatches: modules.waitWatches, waitRegistry: modules.waitRegistry,
305
+ waitCancellation: modules.waitCancellation,
306
+ active: host.active, retries: modules.retries, line: modules.line, waitResolve: modules.waitResolve,
299
307
  inboxClaims: modules.inboxClaims, workerQuestions: modules.workerQuestions, humanWaits: modules.humanWaits,
300
308
  isActive: id => host.isActive(id), move: (...args) => host.move(...args),
301
309
  recoveringRun: run => modules.recovery.recoveringRun(run),
302
- continueRun: (id, opts, defer) => host.continueRun(id, opts, defer), disarmWait: id => host.disarmWait(id),
310
+ continueRun: (id, opts, defer) => host.continueRun(id, opts, defer),
303
311
  reconcileWorkerWaits: id => host.reconcileWorkerWaits(id), releaseSlot: () => modules.line.releaseSlot(),
304
312
  parkForUser: (id, state, step) => modules.turnSettler.parkForUser(id, state, step), armIdleTimer: (id, state) => modules.turnSettler.armIdleTimer(id, state),
305
313
  flushAgentInputs: id => modules.inputDelivery.flushAgentInputs(id), answerRoutedQuestion: (id, flush) => modules.inputDelivery.answerRoutedQuestion(id, flush),
@@ -348,6 +356,7 @@ export function composeRunModules(context, host) {
348
356
  holdContinuationForRootFinish: (...args) => modules.runFinish.holdContinuationForRootFinish(...args),
349
357
  }, modules.line, modules.sessionHelperHost, modules.repoRootLease, modules.worktreeAutosave, modules.runSkills, sessionEventHost(), launchPreambleHost(), modules.inputReceiptHost, modules.inputReceiptSteps, modules.humanWaits, modules.queuedInput, modules.workerQuestions, modules.runSettlement);
350
358
  modules.stepLoop = new WorkflowStepLoop(context, {
359
+ waitCancellation: modules.waitCancellation,
351
360
  active: host.active, move: (id, exit, patch) => host.move(id, exit, patch), dropActive: id => host.dropActive(id),
352
361
  closingWakeDecision: (id, holds, cancelled, error) => modules.wakeAdmission.closingWakeDecision(id, holds, cancelled, error),
353
362
  owesDelivery: id => modules.wakeAdmission.owesDelivery(id),
@@ -362,10 +371,10 @@ export function composeRunModules(context, host) {
362
371
  }, modules.line, modules.attachments, modules.turnBookkeeper, modules.queuedInput, modules.continuationAcceptance, modules.workerExecutions);
363
372
  modules.turnSettler = new TurnSettler(context, {
364
373
  waitEngine: modules.waitEngine,
365
- humanWaits: modules.humanWaits, line: modules.line, waitWatches: modules.waitWatches, waitRegistry: modules.waitRegistry,
374
+ humanWaits: modules.humanWaits, line: modules.line, waitRegistry: modules.waitRegistry,
366
375
  workerQuestions: modules.workerQuestions, completionGateHost: modules.completionGateHost, subagentWaits: modules.subagentWaits,
367
376
  move: (...args) => host.move(...args), releaseSlot: () => modules.line.releaseSlot(), completionGate: id => modules.runFinish.completionGate(id),
368
- cancelOpenWaits: id => modules.wakeAdmission.cancelOpenWaits(id), countAutomaticWakes: id => modules.wakeAdmission.automaticWakes(id),
377
+ get waitCancellation() { return modules.waitCancellation; }, countAutomaticWakes: id => modules.wakeAdmission.automaticWakes(id),
369
378
  workerExecutionStopped: id => host.workerExecutionStopped(id), executionBlockedByRootFinish: run => host.executionBlockedByRootFinish(run),
370
379
  submitAgentInput: (id, state, content) => modules.inputDelivery.submitAgentInput(id, state, content), flushAgentInputs: id => modules.inputDelivery.flushAgentInputs(id),
371
380
  hasQueuedAgentInputs: (id, except) => modules.inputDelivery.hasQueuedAgentInputs(id, except), armUnreadInputTimer: (id, state) => modules.inputDelivery.armUnreadInputTimer(id, state),
@@ -379,19 +388,19 @@ export function composeRunModules(context, host) {
379
388
  }, IDLE_TIMEOUT_MS, MAX_AUTO_CONTINUES, COMPLETION_WILL_WAIT, SCHEDULE_WAKEUP_MAX_SECONDS);
380
389
  modules.runFinish = new RunFinish(context, modules.completionGateHost, modules.runSettlement, modules.turnSettler, modules.turnNudges, modules.line, {
381
390
  move: (...args) => host.move(...args), dropActive: id => host.dropActive(id),
382
- cancelOpenWaits: id => modules.wakeAdmission.cancelOpenWaits(id), reconcileWorkerWaits: id => host.reconcileWorkerWaits(id),
391
+ get waitCancellation() { return modules.waitCancellation; }, reconcileWorkerWaits: id => host.reconcileWorkerWaits(id),
383
392
  executionBlockedByRootFinish: run => host.executionBlockedByRootFinish(run), hasUnansweredHumanAsk: id => host.hasUnansweredHumanAsk(id),
384
393
  });
385
- modules.runCancel = new RunCancel(context, modules.line, modules.workerExecutions, modules.wakeAdmission, modules.turnNudges, {
394
+ modules.runCancel = new RunCancel(context, modules.line, modules.workerExecutions, modules.waitCancellation, modules.turnNudges, {
386
395
  active: host.active, cancel: id => host.cancel(id), isActive: id => host.isActive(id),
387
396
  cancelAutoResume: id => host.cancelAutoResume(id), rootFinishRequested: id => host.rootFinishRequested(id),
388
- historyDeletionPending: id => host.historyDeletionPending(id), disarmWait: id => host.disarmWait(id),
397
+ waitCancellation: modules.waitCancellation, historyDeletionPending: id => host.historyDeletionPending(id),
389
398
  move: (id, exit, patch) => host.move(id, exit, patch),
390
399
  });
391
400
  modules.inputDelivery = new InputDelivery(context, {
392
401
  active: host.active, line: modules.line, workerExecutions: modules.workerExecutions, runSkills: modules.runSkills,
393
402
  attachments: modules.attachments, humanWaits: modules.humanWaits, workerQuestions: modules.workerQuestions,
394
- waitRegistry: modules.waitRegistry, inputReceiptHost: modules.inputReceiptHost,
403
+ waitResolve: modules.waitResolve, inputReceiptHost: modules.inputReceiptHost,
395
404
  isActive: id => host.isActive(id), move: (id, exit) => host.move(id, exit),
396
405
  canProceedWithRun: (id, run) => host.canProceedWithRun(id, run),
397
406
  workerExecutionStopped: id => host.workerExecutionStopped(id), executionBlockedByRootFinish: run => host.executionBlockedByRootFinish(run),