@wjarka/cezarion 0.14.7-pr488.741 → 0.14.8

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 (66) hide show
  1. package/dist/contract/conversations.d.ts +0 -98
  2. package/dist/contract/delegation.d.ts +0 -15
  3. package/dist/contract/events.d.ts +0 -7
  4. package/dist/contract/index.js +1 -30
  5. package/dist/contract/runs.d.ts +0 -35
  6. package/dist/contract/skills.d.ts +0 -7
  7. package/dist/delegation/cli.js +6 -102
  8. package/dist/delegation/cli.js.map +1 -1
  9. package/dist/delegation/input.d.ts +1 -2
  10. package/dist/delegation/input.js +1 -6
  11. package/dist/delegation/input.js.map +1 -1
  12. package/dist/delegation/provision.js +0 -1
  13. package/dist/delegation/provision.js.map +1 -1
  14. package/dist/delegation/routes.d.ts +0 -67
  15. package/dist/delegation/routes.js +1 -4
  16. package/dist/delegation/routes.js.map +1 -1
  17. package/dist/delegation/service.d.ts +2 -6
  18. package/dist/delegation/service.js +2 -82
  19. package/dist/delegation/service.js.map +1 -1
  20. package/dist/delegation/transport.d.ts +0 -67
  21. package/dist/runs/store.d.ts +1 -21
  22. package/dist/runs/store.js +1 -102
  23. package/dist/runs/store.js.map +1 -1
  24. package/dist/server/server.d.ts +0 -154
  25. package/dist/workflows/run.d.ts +0 -14
  26. package/dist/workflows/run.js +11 -140
  27. package/dist/workflows/run.js.map +1 -1
  28. package/package.json +3 -3
  29. package/web/dist/assets/{agent-accounts-DveiLHoy.js → agent-accounts-BZm_2WAv.js} +1 -1
  30. package/web/dist/assets/{alert-dialog-BRmsCA3M.js → alert-dialog-B422RI-k.js} +1 -1
  31. package/web/dist/assets/{collapsible-BWfM2PdZ.js → collapsible-Cy_Fmkrd.js} +1 -1
  32. package/web/dist/assets/{commit-list-C-rCgcKm.js → commit-list-Dcnk7TnI.js} +1 -1
  33. package/web/dist/assets/{compare-variants-Ccp9IYp-.js → compare-variants-Ciqwvd_f.js} +1 -1
  34. package/web/dist/assets/{diff-controls-BFI8ngtw.js → diff-controls-BGrXGi7O.js} +1 -1
  35. package/web/dist/assets/{diff-stat-CVFxf2Ar.js → diff-stat-Cgnl_hYF.js} +1 -1
  36. package/web/dist/assets/{diff-BvZErqfg2.js → diff-tRE59UNb2.js} +2 -2
  37. package/web/dist/assets/{diff-view-B35r8kQK.js → diff-view-DN1ort7Q.js} +1 -1
  38. package/web/dist/assets/{dropdown-menu-C_fj6kzP.js → dropdown-menu-dwDGT8MM.js} +1 -1
  39. package/web/dist/assets/{git-toolbar-BaqAvRC1.js → git-toolbar-UiHnGvE0.js} +1 -1
  40. package/web/dist/assets/{github-DIkBazPA.js → github-D-MrkbJ7.js} +1 -1
  41. package/web/dist/assets/{image-preview-BBqbaKaq.js → image-preview-C2JGcBlC.js} +1 -1
  42. package/web/dist/assets/{index-BIae70yp.js → index-BszfYvBq.js} +3 -3
  43. package/web/dist/assets/index-CWh4pKP3.css +1 -0
  44. package/web/dist/assets/{markdown-kouQNPB6.js → markdown-C_IcKVQd.js} +1 -1
  45. package/web/dist/assets/{pill-mHX_rKXP.js → pill-BsbO6G7y.js} +1 -1
  46. package/web/dist/assets/{project-router-Ds9EvxjN.js → project-router-DbLkll25.js} +1 -1
  47. package/web/dist/assets/{prompt-templates-AaKKdIiY.js → prompt-templates-BlTGJB5W.js} +1 -1
  48. package/web/dist/assets/{repo-git-6StCwqhj.js → repo-git-Bm3s6Why.js} +1 -1
  49. package/web/dist/assets/{run-diff-fChfUdwr.js → run-diff-CyG0Nciv.js} +1 -1
  50. package/web/dist/assets/{run-header-B3ZPhDZr.js → run-header-IFyIGCey.js} +1 -1
  51. package/web/dist/assets/{skills-DSWaVvcu.js → skills-C-C4DVFY.js} +1 -1
  52. package/web/dist/assets/{tab-link-Db6yDTIQ.js → tab-link-BWNp3mLY.js} +1 -1
  53. package/web/dist/assets/{task-changes-DdmerESW.js → task-changes-D2PHtWUW.js} +1 -1
  54. package/web/dist/assets/{task-commits-Co-bb1P6.js → task-commits-N5u9U0_R.js} +1 -1
  55. package/web/dist/assets/{task-files-B2KASfyL.js → task-files-BS7c7CFm.js} +1 -1
  56. package/web/dist/assets/task-thread-BQFdz1dJ.css +1 -0
  57. package/web/dist/assets/{task-thread-8kGLJO4Q.js → task-thread-DGM2dZV-.js} +1 -1
  58. package/web/dist/assets/{textarea-Qhdzn_oU.js → textarea-FjaU370i.js} +1 -1
  59. package/web/dist/assets/{thread-loading-C6ENzZYk.js → thread-loading-77sJ8Yu_.js} +1 -1
  60. package/web/dist/assets/{token-metrics-BsT6Rqji.js → token-metrics-Clxh03bE.js} +1 -1
  61. package/web/dist/assets/{utils-VFstALJW.js → utils-PYYcpCFZ.js} +1 -1
  62. package/web/dist/assets/{workflows-UKoofNFJ.js → workflows-Czl0ZfXH.js} +1 -1
  63. package/web/dist/assets/{zoomable-image-DpL5gtv4.js → zoomable-image-Z3JDnm0b.js} +1 -1
  64. package/web/dist/index.html +14 -14
  65. package/web/dist/assets/index-CXZukB1O.css +0 -1
  66. package/web/dist/assets/task-thread-Dc3wplva.css +0 -1
@@ -2588,13 +2588,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
2588
2588
  text: string;
2589
2589
  createdAt: string;
2590
2590
  deliveredAt?: string | undefined;
2591
- inboxClaim?: {
2592
- receiptId: string;
2593
- generation: string;
2594
- expiresAt: string;
2595
- acknowledgedAt?: string | undefined;
2596
- memberIds?: string[] | undefined;
2597
- } | undefined;
2598
2591
  }[] | undefined;
2599
2592
  ciWait?: {
2600
2593
  prUrl: string;
@@ -3440,13 +3433,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3440
3433
  text: string;
3441
3434
  createdAt: string;
3442
3435
  deliveredAt?: string | undefined;
3443
- inboxClaim?: {
3444
- receiptId: string;
3445
- generation: string;
3446
- expiresAt: string;
3447
- acknowledgedAt?: string | undefined;
3448
- memberIds?: string[] | undefined;
3449
- } | undefined;
3450
3436
  }[] | undefined;
3451
3437
  ciWait?: {
3452
3438
  prUrl: string;
@@ -6075,13 +6061,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
6075
6061
  text: string;
6076
6062
  createdAt: string;
6077
6063
  deliveredAt?: string | undefined;
6078
- inboxClaim?: {
6079
- receiptId: string;
6080
- generation: string;
6081
- expiresAt: string;
6082
- acknowledgedAt?: string | undefined;
6083
- memberIds?: string[] | undefined;
6084
- } | undefined;
6085
6064
  }[] | undefined;
6086
6065
  ciWait?: {
6087
6066
  prUrl: string;
@@ -6739,13 +6718,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
6739
6718
  text: string;
6740
6719
  createdAt: string;
6741
6720
  deliveredAt?: string | undefined;
6742
- inboxClaim?: {
6743
- receiptId: string;
6744
- generation: string;
6745
- expiresAt: string;
6746
- acknowledgedAt?: string | undefined;
6747
- memberIds?: string[] | undefined;
6748
- } | undefined;
6749
6721
  }[] | undefined;
6750
6722
  ciWait?: {
6751
6723
  prUrl: string;
@@ -7201,13 +7173,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7201
7173
  text: string;
7202
7174
  createdAt: string;
7203
7175
  deliveredAt?: string | undefined;
7204
- inboxClaim?: {
7205
- receiptId: string;
7206
- generation: string;
7207
- expiresAt: string;
7208
- acknowledgedAt?: string | undefined;
7209
- memberIds?: string[] | undefined;
7210
- } | undefined;
7211
7176
  }[] | undefined;
7212
7177
  ciWait?: {
7213
7178
  prUrl: string;
@@ -7673,13 +7638,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7673
7638
  text: string;
7674
7639
  createdAt: string;
7675
7640
  deliveredAt?: string | undefined;
7676
- inboxClaim?: {
7677
- receiptId: string;
7678
- generation: string;
7679
- expiresAt: string;
7680
- acknowledgedAt?: string | undefined;
7681
- memberIds?: string[] | undefined;
7682
- } | undefined;
7683
7641
  }[] | undefined;
7684
7642
  ciWait?: {
7685
7643
  prUrl: string;
@@ -8111,13 +8069,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8111
8069
  text: string;
8112
8070
  createdAt: string;
8113
8071
  deliveredAt?: string | undefined;
8114
- inboxClaim?: {
8115
- receiptId: string;
8116
- generation: string;
8117
- expiresAt: string;
8118
- acknowledgedAt?: string | undefined;
8119
- memberIds?: string[] | undefined;
8120
- } | undefined;
8121
8072
  }[] | undefined;
8122
8073
  ciWait?: {
8123
8074
  prUrl: string;
@@ -8549,13 +8500,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8549
8500
  text: string;
8550
8501
  createdAt: string;
8551
8502
  deliveredAt?: string | undefined;
8552
- inboxClaim?: {
8553
- receiptId: string;
8554
- generation: string;
8555
- expiresAt: string;
8556
- acknowledgedAt?: string | undefined;
8557
- memberIds?: string[] | undefined;
8558
- } | undefined;
8559
8503
  }[] | undefined;
8560
8504
  ciWait?: {
8561
8505
  prUrl: string;
@@ -9134,13 +9078,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
9134
9078
  text: string;
9135
9079
  createdAt: string;
9136
9080
  deliveredAt?: string | undefined;
9137
- inboxClaim?: {
9138
- receiptId: string;
9139
- generation: string;
9140
- expiresAt: string;
9141
- acknowledgedAt?: string | undefined;
9142
- memberIds?: string[] | undefined;
9143
- } | undefined;
9144
9081
  }[] | undefined;
9145
9082
  ciWait?: {
9146
9083
  prUrl: string;
@@ -9595,13 +9532,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
9595
9532
  text: string;
9596
9533
  createdAt: string;
9597
9534
  deliveredAt?: string | undefined;
9598
- inboxClaim?: {
9599
- receiptId: string;
9600
- generation: string;
9601
- expiresAt: string;
9602
- acknowledgedAt?: string | undefined;
9603
- memberIds?: string[] | undefined;
9604
- } | undefined;
9605
9535
  }[] | undefined;
9606
9536
  ciWait?: {
9607
9537
  prUrl: string;
@@ -10161,13 +10091,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
10161
10091
  text: string;
10162
10092
  createdAt: string;
10163
10093
  deliveredAt?: string | undefined;
10164
- inboxClaim?: {
10165
- receiptId: string;
10166
- generation: string;
10167
- expiresAt: string;
10168
- acknowledgedAt?: string | undefined;
10169
- memberIds?: string[] | undefined;
10170
- } | undefined;
10171
10094
  }[] | undefined;
10172
10095
  ciWait?: {
10173
10096
  prUrl: string;
@@ -11994,13 +11917,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
11994
11917
  text: string;
11995
11918
  createdAt: string;
11996
11919
  deliveredAt?: string | undefined;
11997
- inboxClaim?: {
11998
- receiptId: string;
11999
- generation: string;
12000
- expiresAt: string;
12001
- acknowledgedAt?: string | undefined;
12002
- memberIds?: string[] | undefined;
12003
- } | undefined;
12004
11920
  }[] | undefined;
12005
11921
  ciWait?: {
12006
11922
  prUrl: string;
@@ -12846,13 +12762,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12846
12762
  text: string;
12847
12763
  createdAt: string;
12848
12764
  deliveredAt?: string | undefined;
12849
- inboxClaim?: {
12850
- receiptId: string;
12851
- generation: string;
12852
- expiresAt: string;
12853
- acknowledgedAt?: string | undefined;
12854
- memberIds?: string[] | undefined;
12855
- } | undefined;
12856
12765
  }[] | undefined;
12857
12766
  ciWait?: {
12858
12767
  prUrl: string;
@@ -15481,13 +15390,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15481
15390
  text: string;
15482
15391
  createdAt: string;
15483
15392
  deliveredAt?: string | undefined;
15484
- inboxClaim?: {
15485
- receiptId: string;
15486
- generation: string;
15487
- expiresAt: string;
15488
- acknowledgedAt?: string | undefined;
15489
- memberIds?: string[] | undefined;
15490
- } | undefined;
15491
15393
  }[] | undefined;
15492
15394
  ciWait?: {
15493
15395
  prUrl: string;
@@ -16145,13 +16047,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
16145
16047
  text: string;
16146
16048
  createdAt: string;
16147
16049
  deliveredAt?: string | undefined;
16148
- inboxClaim?: {
16149
- receiptId: string;
16150
- generation: string;
16151
- expiresAt: string;
16152
- acknowledgedAt?: string | undefined;
16153
- memberIds?: string[] | undefined;
16154
- } | undefined;
16155
16050
  }[] | undefined;
16156
16051
  ciWait?: {
16157
16052
  prUrl: string;
@@ -16607,13 +16502,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
16607
16502
  text: string;
16608
16503
  createdAt: string;
16609
16504
  deliveredAt?: string | undefined;
16610
- inboxClaim?: {
16611
- receiptId: string;
16612
- generation: string;
16613
- expiresAt: string;
16614
- acknowledgedAt?: string | undefined;
16615
- memberIds?: string[] | undefined;
16616
- } | undefined;
16617
16505
  }[] | undefined;
16618
16506
  ciWait?: {
16619
16507
  prUrl: string;
@@ -17079,13 +16967,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17079
16967
  text: string;
17080
16968
  createdAt: string;
17081
16969
  deliveredAt?: string | undefined;
17082
- inboxClaim?: {
17083
- receiptId: string;
17084
- generation: string;
17085
- expiresAt: string;
17086
- acknowledgedAt?: string | undefined;
17087
- memberIds?: string[] | undefined;
17088
- } | undefined;
17089
16970
  }[] | undefined;
17090
16971
  ciWait?: {
17091
16972
  prUrl: string;
@@ -17517,13 +17398,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17517
17398
  text: string;
17518
17399
  createdAt: string;
17519
17400
  deliveredAt?: string | undefined;
17520
- inboxClaim?: {
17521
- receiptId: string;
17522
- generation: string;
17523
- expiresAt: string;
17524
- acknowledgedAt?: string | undefined;
17525
- memberIds?: string[] | undefined;
17526
- } | undefined;
17527
17401
  }[] | undefined;
17528
17402
  ciWait?: {
17529
17403
  prUrl: string;
@@ -17955,13 +17829,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17955
17829
  text: string;
17956
17830
  createdAt: string;
17957
17831
  deliveredAt?: string | undefined;
17958
- inboxClaim?: {
17959
- receiptId: string;
17960
- generation: string;
17961
- expiresAt: string;
17962
- acknowledgedAt?: string | undefined;
17963
- memberIds?: string[] | undefined;
17964
- } | undefined;
17965
17832
  }[] | undefined;
17966
17833
  ciWait?: {
17967
17834
  prUrl: string;
@@ -18540,13 +18407,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18540
18407
  text: string;
18541
18408
  createdAt: string;
18542
18409
  deliveredAt?: string | undefined;
18543
- inboxClaim?: {
18544
- receiptId: string;
18545
- generation: string;
18546
- expiresAt: string;
18547
- acknowledgedAt?: string | undefined;
18548
- memberIds?: string[] | undefined;
18549
- } | undefined;
18550
18410
  }[] | undefined;
18551
18411
  ciWait?: {
18552
18412
  prUrl: string;
@@ -19001,13 +18861,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19001
18861
  text: string;
19002
18862
  createdAt: string;
19003
18863
  deliveredAt?: string | undefined;
19004
- inboxClaim?: {
19005
- receiptId: string;
19006
- generation: string;
19007
- expiresAt: string;
19008
- acknowledgedAt?: string | undefined;
19009
- memberIds?: string[] | undefined;
19010
- } | undefined;
19011
18864
  }[] | undefined;
19012
18865
  ciWait?: {
19013
18866
  prUrl: string;
@@ -19567,13 +19420,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19567
19420
  text: string;
19568
19421
  createdAt: string;
19569
19422
  deliveredAt?: string | undefined;
19570
- inboxClaim?: {
19571
- receiptId: string;
19572
- generation: string;
19573
- expiresAt: string;
19574
- acknowledgedAt?: string | undefined;
19575
- memberIds?: string[] | undefined;
19576
- } | undefined;
19577
19423
  }[] | undefined;
19578
19424
  ciWait?: {
19579
19425
  prUrl: string;
@@ -267,7 +267,6 @@ export declare class RunManager {
267
267
  private readonly workerWakeAdmitted;
268
268
  private readonly workerWakeQueuedAt;
269
269
  private readonly workerWaitTimers;
270
- private readonly inboxClaimTimers;
271
270
  private reconcilingWorkers;
272
271
  private recovering;
273
272
  private disposed;
@@ -750,19 +749,6 @@ export declare class RunManager {
750
749
  private hasUnansweredHumanAsk;
751
750
  /** Both roles can select their own requests without acquiring worker-management authority. */
752
751
  registerRequestWait(runId: string, request: RequestWaitRequest): WorkerWait;
753
- /** A wait wake is only a pointer. Only provider submission/opening prompts own delivery. */
754
- private providerOwnsInboxInput;
755
- canClaimInboxInput(runId: string, id: string): boolean;
756
- /** The service supplies authorized, bounded IDs; claim and flight reservations are synchronous. */
757
- reserveInboxInputs(runId: string, generation: string, ids: readonly string[]): {
758
- receiptId: string;
759
- expiresAt: string;
760
- inputIds: string[];
761
- } | undefined;
762
- acknowledgeInbox(runId: string, generation: string, receiptId: string): 'acknowledged' | 'already-acknowledged';
763
- releaseInbox(runId: string, generation: string, receiptId: string): 'released';
764
- /** Expiry is an independent wake source, including after the provider's last turn. */
765
- private armInboxClaimExpiry;
766
752
  /** Accepted conversation input uses the existing scheduler admission for idle recipients. */
767
753
  deliverConversationInput(runId: string): void;
768
754
  /** Cancel only the wait; persist its settlement before ordinary wake admission. */
@@ -29,7 +29,7 @@ import { autosaveCommit, createWorktree, resolveBaseRef, worktreeDiff, worktreeS
29
29
  import { getHeadCommit, getRepoInfo } from '../server/git.js';
30
30
  import { ensureOwnedWorkspace, verifyOwnedWorkspace } from '../delegation/workspace.js';
31
31
  import { verifyWorkerContext } from '../delegation/context.js';
32
- import { enqueueAgentInput, agentInputBatch, hasLiveInboxClaim } from '../delegation/input.js';
32
+ import { enqueueAgentInput, agentInputBatch } from '../delegation/input.js';
33
33
  import { parseDelegationEffort } from '../delegation/effort.js';
34
34
  import { DelegationPolicyError } from '../delegation/policy.js';
35
35
  import { reconcileWorkerWait } from '../delegation/wait.js';
@@ -593,7 +593,6 @@ export class RunManager {
593
593
  workerWakeAdmitted = new Set();
594
594
  workerWakeQueuedAt = new Map();
595
595
  workerWaitTimers = new Map();
596
- inboxClaimTimers = new Map();
597
596
  reconcilingWorkers = false;
598
597
  recovering = false;
599
598
  disposed = false;
@@ -712,9 +711,6 @@ export class RunManager {
712
711
  for (const timer of this.workerWaitTimers.values())
713
712
  clearTimeout(timer);
714
713
  this.workerWaitTimers.clear();
715
- for (const timer of this.inboxClaimTimers.values())
716
- clearTimeout(timer);
717
- this.inboxClaimTimers.clear();
718
714
  this.workerWaiting.clear();
719
715
  this.workerWakeAdmitted.clear();
720
716
  this.workerWakeQueuedAt.clear();
@@ -1431,14 +1427,6 @@ export class RunManager {
1431
1427
  // than being dequeued and re-queued (which would churn its position and its record).
1432
1428
  const next = this.queue.findIndex((id) => {
1433
1429
  const queued = this.store.getRun(id);
1434
- // An inbox claim may arrive after a wake was queued but before admission.
1435
- // Preserve its place and slot exemption until ACK/release/expiry re-pumps.
1436
- if (this.workerWakeQueuedAt.has(id)) {
1437
- const first = queued?.agentInputs?.find(input => !input.deliveredAt);
1438
- const wake = queued?.agentInputs?.find(input => input.id === this.workerWait(id)?.wakeId);
1439
- if ((first && hasLiveInboxClaim(first)) || (wake && hasLiveInboxClaim(wake)))
1440
- return false;
1441
- }
1442
1430
  return (capacity() || chargedCiWake(id)) && (!queued || this.historyDeletionPending(id) || ((!this.executions.get(id)?.admitted || this.active.has(id)) && !this.executionBlockedByRootFinish(queued) &&
1443
1431
  (!anyHold || !accountHeldFor(queued, holds, defaultRunner ?? 'claude'))));
1444
1432
  });
@@ -1679,10 +1667,6 @@ export class RunManager {
1679
1667
  return;
1680
1668
  this.recovering = true;
1681
1669
  try {
1682
- for (const run of this.store.listRuns()) {
1683
- this.store.clearExpiredInboxClaims(run.id, new Date().toISOString());
1684
- this.armInboxClaimExpiry(run.id);
1685
- }
1686
1670
  this.reconcileWorkerWaits();
1687
1671
  const live = this.store
1688
1672
  .listRuns()
@@ -1759,8 +1743,7 @@ export class RunManager {
1759
1743
  // runs. A worker reaches here only when it has neither a recoverable ask
1760
1744
  // nor a worker wait; preserving that record would strand both it and its
1761
1745
  // parent because workers cannot accept an ordinary inactive Continue.
1762
- if (run.status === 'waiting' && (run.delegation?.role !== 'worker' ||
1763
- run.agentInputs?.some(input => !input.deliveredAt && hasLiveInboxClaim(input))))
1746
+ if (run.status === 'waiting' && run.delegation?.role !== 'worker')
1764
1747
  continue;
1765
1748
  if (run.status === 'waiting') {
1766
1749
  const finishedAt = new Date().toISOString();
@@ -2900,90 +2883,6 @@ export class RunManager {
2900
2883
  this.parkWorkerWait(runId, state);
2901
2884
  return registered;
2902
2885
  }
2903
- /** A wait wake is only a pointer. Only provider submission/opening prompts own delivery. */
2904
- providerOwnsInboxInput(runId, id) {
2905
- const state = this.active.get(runId);
2906
- return !!state?.agentInputFlight?.inputIds.includes(id) || state?.openingAgentInputId === id ||
2907
- this.store.getRun(runId)?.continuationMessage?.agentInputId === id;
2908
- }
2909
- canClaimInboxInput(runId, id) {
2910
- const run = this.store.getRun(runId);
2911
- const input = run?.agentInputs?.find(entry => entry.id === id);
2912
- return !this.disposed && !!run && ['queued', 'running', 'waiting'].includes(run.status) &&
2913
- !this.historyDeletionPending(runId) && !this.executionBlockedByRootFinish(run) && !this.workerExecutionStopped(runId) &&
2914
- !!input && input.source === 'agent' && !!input.conversation && !input.deliveredAt &&
2915
- !hasLiveInboxClaim(input) && !this.providerOwnsInboxInput(runId, id);
2916
- }
2917
- /** The service supplies authorized, bounded IDs; claim and flight reservations are synchronous. */
2918
- reserveInboxInputs(runId, generation, ids) {
2919
- if (!ids.length || ids.some(id => !this.canClaimInboxInput(runId, id)) ||
2920
- this.store.getRun(runId)?.agentInputs?.some(input => !input.deliveredAt && hasLiveInboxClaim(input)))
2921
- return undefined;
2922
- const claim = { receiptId: randomUUID(), generation, expiresAt: new Date(Date.now() + 120_000).toISOString() };
2923
- this.store.claimInboxInputs(runId, ids, claim);
2924
- this.armInboxClaimExpiry(runId);
2925
- return { receiptId: claim.receiptId, expiresAt: claim.expiresAt, inputIds: [...ids] };
2926
- }
2927
- acknowledgeInbox(runId, generation, receiptId) {
2928
- if (this.disposed || this.store.getRun(runId)?.agentInputs?.some(input => input.inboxClaim?.receiptId === receiptId &&
2929
- !input.deliveredAt && this.providerOwnsInboxInput(runId, input.id)))
2930
- throw new Error('inbox receipt displaced');
2931
- const result = this.store.ackInboxInputs(runId, receiptId, generation, new Date().toISOString());
2932
- this.armInboxClaimExpiry(runId);
2933
- this.reconcileWorkerWaits();
2934
- this.deliverConversationInput(runId);
2935
- this.active.get(runId)?.resumeInboxAutoEnd?.();
2936
- this.releaseSlot();
2937
- return result;
2938
- }
2939
- releaseInbox(runId, generation, receiptId) {
2940
- if (this.disposed)
2941
- throw new Error('inbox manager disposed');
2942
- const result = this.store.releaseInboxInputs(runId, receiptId, generation);
2943
- this.armInboxClaimExpiry(runId);
2944
- this.reconcileWorkerWaits();
2945
- this.deliverConversationInput(runId);
2946
- this.releaseSlot();
2947
- return result;
2948
- }
2949
- /** Expiry is an independent wake source, including after the provider's last turn. */
2950
- armInboxClaimExpiry(runId) {
2951
- const previous = this.inboxClaimTimers.get(runId);
2952
- if (previous)
2953
- clearTimeout(previous);
2954
- this.inboxClaimTimers.delete(runId);
2955
- if (this.disposed)
2956
- return;
2957
- const deadlines = (this.store.getRun(runId)?.agentInputs ?? []).flatMap(input => input.inboxClaim && !input.inboxClaim.acknowledgedAt ? [Date.parse(input.inboxClaim.expiresAt)] : []);
2958
- if (!deadlines.length)
2959
- return;
2960
- let warned = false;
2961
- const expire = () => {
2962
- this.inboxClaimTimers.delete(runId);
2963
- if (this.disposed || !this.store.getRun(runId))
2964
- return;
2965
- try {
2966
- this.store.clearExpiredInboxClaims(runId, new Date().toISOString());
2967
- this.reconcileWorkerWaits();
2968
- this.deliverConversationInput(runId);
2969
- this.armInboxClaimExpiry(runId);
2970
- this.releaseSlot();
2971
- }
2972
- catch {
2973
- if (!warned)
2974
- console.warn('[cez] inbox expiry checkpoint failed; retrying in 1 second');
2975
- warned = true;
2976
- if (!this.disposed)
2977
- arm(1_000);
2978
- }
2979
- };
2980
- const arm = (delay) => {
2981
- const timer = setTimeout(expire, delay);
2982
- timer.unref?.();
2983
- this.inboxClaimTimers.set(runId, timer);
2984
- };
2985
- arm(Math.max(0, Math.min(...deadlines) - Date.now()));
2986
- }
2987
2886
  /** Accepted conversation input uses the existing scheduler admission for idle recipients. */
2988
2887
  deliverConversationInput(runId) {
2989
2888
  if (this.disposed)
@@ -2999,7 +2898,7 @@ export class RunManager {
2999
2898
  this.queueCiWake(runId);
3000
2899
  return;
3001
2900
  }
3002
- const input = run.agentInputs?.find(entry => entry.conversation && !entry.deliveredAt && !hasLiveInboxClaim(entry));
2901
+ const input = run.agentInputs?.find(entry => entry.conversation && !entry.deliveredAt);
3003
2902
  if (!input)
3004
2903
  return;
3005
2904
  const state = this.active.get(runId);
@@ -3150,24 +3049,14 @@ export class RunManager {
3150
3049
  const wait = parent.delegation.wait;
3151
3050
  if (!wait)
3152
3051
  continue;
3153
- const delivered = parent.agentInputs?.find(input => input.id === wait.wakeId && input.deliveredAt);
3052
+ const delivered = wait.wakeId && parent.agentInputs?.find(input => input.id === wait.wakeId)?.deliveredAt;
3154
3053
  if (delivered) {
3155
3054
  // Receipt persistence precedes the live status update. After a crash
3156
3055
  // this is interrupted execution, not generic waiting-run success.
3157
- if (this.recovering && !delivered.inboxClaim?.acknowledgedAt && parent.status === 'waiting' && !this.hasPendingHumanAsk(parent.id)) {
3056
+ if (this.recovering && parent.status === 'waiting' && !this.hasPendingHumanAsk(parent.id)) {
3158
3057
  this.store.updateRun(parent.id, { status: 'running', activity: undefined });
3159
3058
  }
3160
- const state = this.active.get(parent.id);
3161
- const inboxParked = delivered.inboxClaim?.acknowledgedAt &&
3162
- (this.workerWaiting.has(parent.id) || this.workerWakeAdmitted.has(parent.id)) &&
3163
- state?.session?.open && state.atTurnBoundary === state.session;
3164
3059
  this.withdrawWorkerWait(parent.id);
3165
- // Inbox ACK starts no provider turn. Retain the completed turn's slot
3166
- // exemption if its registered wait parked while that ACK was in transit.
3167
- if (inboxParked && state) {
3168
- this.waiting.add(parent.id);
3169
- this.armIdleTimer(parent.id, state);
3170
- }
3171
3060
  continue;
3172
3061
  }
3173
3062
  const now = new Date().toISOString();
@@ -3209,8 +3098,8 @@ export class RunManager {
3209
3098
  // already being processed. Their delayed receipts cannot interrupt a wait
3210
3099
  // registered by that very turn. Only inputs still awaiting a turn can.
3211
3100
  const flight = this.active.get(parent.id)?.agentInputFlight;
3212
- const pendingInputs = parent.agentInputs?.filter(input => !input.deliveredAt && !hasLiveInboxClaim(input) &&
3213
- input.id !== this.active.get(parent.id)?.openingAgentInputId && input.id !== parent.continuationMessage?.agentInputId && !flight?.inputIds.includes(input.id)) ?? [];
3101
+ const pendingInputs = parent.agentInputs?.filter(input => !input.deliveredAt &&
3102
+ input.id !== parent.continuationMessage?.agentInputId && !flight?.inputIds.includes(input.id)) ?? [];
3214
3103
  const incoming = pendingInputs.find(input => input.conversation &&
3215
3104
  !(input.conversation.kind === 'reply' && input.conversation.requestId && wait.requestIds?.includes(input.conversation.requestId)));
3216
3105
  if (incoming && next.phase !== 'wake-pending')
@@ -3218,8 +3107,7 @@ export class RunManager {
3218
3107
  // A full queue of selected replies still needs admission. Use the last
3219
3108
  // already accepted input as the checkpoint rather than adding a 33rd input.
3220
3109
  // Its content is preserved; delivery includes the wait receipt separately.
3221
- if (next.phase === 'wake-pending' && pendingInputs.length &&
3222
- (parent.agentInputs ?? []).filter(input => !input.deliveredAt).length >= 32 &&
3110
+ if (next.phase === 'wake-pending' && pendingInputs.length >= 32 &&
3223
3111
  !parent.agentInputs?.some(input => input.id === next.wakeId)) {
3224
3112
  next = { ...next, wakeId: pendingInputs.at(-1).id };
3225
3113
  }
@@ -3284,7 +3172,7 @@ export class RunManager {
3284
3172
  !['queued', 'running', 'waiting'].includes(run.status))
3285
3173
  return;
3286
3174
  const existing = run.agentInputs?.find(input => input.id === wait.wakeId);
3287
- if (existing?.deliveredAt || (existing && hasLiveInboxClaim(existing)))
3175
+ if (existing?.deliveredAt)
3288
3176
  return;
3289
3177
  // 32 summaries, including worst-case JSON escaping, must fit the ordinary
3290
3178
  // input bound. Full 4k summaries remain in durable outcomes and events.
@@ -3304,10 +3192,6 @@ export class RunManager {
3304
3192
  return;
3305
3193
  }
3306
3194
  else if (!existing) {
3307
- // A full inbox snapshot can temporarily own every reply. ACK/expiry will
3308
- // reconcile again when a lifecycle input can fit or adopt an unread reply.
3309
- if ((run.agentInputs ?? []).filter(input => !input.deliveredAt).length >= 32)
3310
- return;
3311
3195
  this.store.commitAgentInputs(parentId, enqueueAgentInput(run, input));
3312
3196
  this.store.appendEvent(parentId, { type: 'agent-input', input });
3313
3197
  }
@@ -5348,10 +5232,6 @@ export class RunManager {
5348
5232
  const runner = createRunner(stepBackend);
5349
5233
  state.agentSessionError = undefined;
5350
5234
  let session;
5351
- const shouldAutoEnd = () => this.active.get(runId) !== state || state.session !== session ||
5352
- (!this.workerWait(runId) && !this.store.getRun(runId)?.ciWait && !this.parentCompletionPending(runId) &&
5353
- state.workerWakeTurn !== session && state.ciWakeTurn !== session && !state.agentInputFlight &&
5354
- !this.hasQueuedAgentInputs(runId));
5355
5235
  state.currentStepId = step.id;
5356
5236
  this.beginUsageInvocation(runId, state, step.id);
5357
5237
  const delegation = this.provisionSession(runId, state);
@@ -5384,8 +5264,8 @@ export class RunManager {
5384
5264
  timeoutMs: interactive ? 0 : undefined,
5385
5265
  }, onEvent, {
5386
5266
  autoEndAfterFirstTurn: !interactive,
5387
- // Unread inbox claims must survive this window so release/expiry can replay them.
5388
- shouldAutoEnd,
5267
+ shouldAutoEnd: () => this.active.get(runId) !== state || state.session !== session ||
5268
+ (!this.workerWait(runId) && !this.store.getRun(runId)?.ciWait && !this.parentCompletionPending(runId) && state.workerWakeTurn !== session && state.ciWakeTurn !== session && !state.agentInputFlight),
5389
5269
  onUiEvent: (event) => {
5390
5270
  completedAssistantText = appendCompletedAssistantText(completedAssistantText, event);
5391
5271
  this.handleRunnerUiEvent(runId, state, sink, event);
@@ -5403,14 +5283,6 @@ export class RunManager {
5403
5283
  }
5404
5284
  const sessionClosed = this.trackWorkerSessionResult(runId, session);
5405
5285
  state.session = session;
5406
- state.resumeInboxAutoEnd = interactive ? undefined : () => {
5407
- // ACK may consume the last input after the runner's one-shot close timer fired.
5408
- // Release/expiry instead submit a provider turn through normal admission.
5409
- if (this.active.get(runId) === state && state.session === session && session?.open &&
5410
- state.atTurnBoundary === session && !state.cancelled && !state.pendingHumanAsk &&
5411
- !this.hasPendingHumanAsk(runId) && shouldAutoEnd())
5412
- session.end();
5413
- };
5414
5286
  state.sessionEverOpened = true;
5415
5287
  state.currentStepId = step.id;
5416
5288
  state.interrupt = () => session?.interrupt();
@@ -5469,7 +5341,6 @@ export class RunManager {
5469
5341
  if (at >= 0)
5470
5342
  this.queue.splice(at, 1);
5471
5343
  }
5472
- state.resumeInboxAutoEnd = undefined;
5473
5344
  state.workerWakeTurn = undefined;
5474
5345
  state.ciWakeTurn = undefined;
5475
5346
  state.atTurnBoundary = undefined;