@hearsay-tools/squawk 0.18.0-pr4173.8058.2 → 0.18.0-pr4174.8066

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 (127) hide show
  1. package/dist/contract/conversations.d.ts +2 -0
  2. package/dist/contract/delegation.d.ts +57 -0
  3. package/dist/contract/index.js +187 -144
  4. package/dist/contract/run-predicates.d.ts +9 -0
  5. package/dist/contract/usage-limit-hold.d.ts +7 -0
  6. package/dist/contract/waits.d.ts +2 -2
  7. package/dist/delegation/cli.js +8 -4
  8. package/dist/delegation/cli.js.map +1 -1
  9. package/dist/delegation/conversation-send.js +15 -4
  10. package/dist/delegation/conversation-send.js.map +1 -1
  11. package/dist/delegation/conversations.js +6 -0
  12. package/dist/delegation/conversations.js.map +1 -1
  13. package/dist/delegation/execution-identity.d.ts +53 -9
  14. package/dist/delegation/execution-identity.js +165 -9
  15. package/dist/delegation/execution-identity.js.map +1 -1
  16. package/dist/delegation/park-notice.d.ts +29 -3
  17. package/dist/delegation/park-notice.js +32 -4
  18. package/dist/delegation/park-notice.js.map +1 -1
  19. package/dist/delegation/provision.js +3 -3
  20. package/dist/delegation/provision.js.map +1 -1
  21. package/dist/delegation/routes.d.ts +19 -0
  22. package/dist/delegation/service.d.ts +5 -0
  23. package/dist/delegation/service.js +93 -14
  24. package/dist/delegation/service.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +23 -4
  26. package/dist/delegation/worker-executions.d.ts +2 -0
  27. package/dist/delegation/worker-executions.js +5 -1
  28. package/dist/delegation/worker-executions.js.map +1 -1
  29. package/dist/runs/ports.d.ts +2 -0
  30. package/dist/server/provider-action-gate.js +2 -1
  31. package/dist/server/provider-action-gate.js.map +1 -1
  32. package/dist/server/run-accounts.d.ts +4 -3
  33. package/dist/server/run-accounts.js +20 -5
  34. package/dist/server/run-accounts.js.map +1 -1
  35. package/dist/server/server.d.ts +14 -0
  36. package/dist/server/server.js +1 -1
  37. package/dist/server/server.js.map +1 -1
  38. package/dist/workflows/continuation-admission.d.ts +7 -0
  39. package/dist/workflows/continuation-admission.js +21 -8
  40. package/dist/workflows/continuation-admission.js.map +1 -1
  41. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  42. package/dist/workflows/run/continuation-acceptance.d.ts +5 -1
  43. package/dist/workflows/run/continuation-acceptance.js +94 -29
  44. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  45. package/dist/workflows/run/launch-read-resolver.d.ts +6 -0
  46. package/dist/workflows/run/launch-read-resolver.js +13 -2
  47. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  48. package/dist/workflows/run/run-settlement.js +1 -0
  49. package/dist/workflows/run/run-settlement.js.map +1 -1
  50. package/dist/workflows/run/wait-engine.js +20 -14
  51. package/dist/workflows/run/wait-engine.js.map +1 -1
  52. package/dist/workflows/run/worker-questions.d.ts +4 -0
  53. package/dist/workflows/run/worker-questions.js +42 -8
  54. package/dist/workflows/run/worker-questions.js.map +1 -1
  55. package/package.json +4 -4
  56. package/web/dist/assets/{accounts-section-D3P_Z-Nu.js → accounts-section-TDhV5kKW.js} +1 -1
  57. package/web/dist/assets/{activity-motion-BW-0k8s7.js → activity-motion-BfE9wCn7.js} +1 -1
  58. package/web/dist/assets/{activity-route-Bpgblioe.js → activity-route-DSBv6t6R.js} +1 -1
  59. package/web/dist/assets/{agent-config-section-Cj3w7UIn.js → agent-config-section-3bIgmLYR.js} +1 -1
  60. package/web/dist/assets/{agent-defaults-section-BJ4poe9c.js → agent-defaults-section-Bfu8Tma5.js} +1 -1
  61. package/web/dist/assets/{appearance-BUsUTPF0.js → appearance-DPE7X6-a.js} +1 -1
  62. package/web/dist/assets/{archive-on-merge-field-D_kgBFNv.js → archive-on-merge-field-Bx1bEmI8.js} +1 -1
  63. package/web/dist/assets/attention-otQlgfRj.js +1 -0
  64. package/web/dist/assets/{automation-format-1lHzRTbq.js → automation-format-BsnXeUET.js} +1 -1
  65. package/web/dist/assets/automations-route-YYPPidII.js +1 -0
  66. package/web/dist/assets/{cez-idle-BY3rjM_y.js → cez-idle-Crszm9Ts.js} +1 -1
  67. package/web/dist/assets/{commit-diff-panel-xwLW6Ydr.js → commit-diff-panel-CLg6vURE.js} +1 -1
  68. package/web/dist/assets/{diff-BB8SoL-s.js → diff-DE0Xb0Z5.js} +2 -2
  69. package/web/dist/assets/{diff-view-O8lx1ztb.js → diff-view-CGETvhPt.js} +1 -1
  70. package/web/dist/assets/{file-preview-BS6M2tBo.js → file-preview-DVQ7eTcT.js} +1 -1
  71. package/web/dist/assets/{folder-browser-Dsqz0Z1z.js → folder-browser-G_9ZgDjg.js} +1 -1
  72. package/web/dist/assets/{git-toolbar-DoPFA36c.js → git-toolbar-DOvJwlcb.js} +1 -1
  73. package/web/dist/assets/{github-Bjy3WBvf.js → github-3XgNmHF-.js} +1 -1
  74. package/web/dist/assets/{global-activity-route-BXBZKz_9.js → global-activity-route-7aoJOaT9.js} +1 -1
  75. package/web/dist/assets/index-CYYWiYLX.js +21 -0
  76. package/web/dist/assets/{label-CZp8t0zE.js → label-BWld23ke.js} +1 -1
  77. package/web/dist/assets/live-protocol-BXzu6cSE.js +64 -0
  78. package/web/dist/assets/{markdown-KHcncamw.js → markdown-63jCKOob.js} +1 -1
  79. package/web/dist/assets/{notifications-section-DD21Sd79.js → notifications-section-fQ-nbk6G.js} +1 -1
  80. package/web/dist/assets/{open-in-menu-DdKs6X5r.js → open-in-menu-D03osLGE.js} +1 -1
  81. package/web/dist/assets/{preview-pane-connected-BvTZv2SQ.js → preview-pane-connected-C_LORmfr.js} +1 -1
  82. package/web/dist/assets/{project-location-B3LBvkz2.js → project-location-BM-6wMI3.js} +1 -1
  83. package/web/dist/assets/{project-router-CIKODSHW.js → project-router-DtTvMbeA.js} +1 -1
  84. package/web/dist/assets/project-scope-context-Dgq8_2JZ.js +4 -0
  85. package/web/dist/assets/{projects-section-C0k8kyb-.js → projects-section-WlDXEr2U.js} +1 -1
  86. package/web/dist/assets/{prompt-templates-section-DNkosCni.js → prompt-templates-section-BrRD9W-C.js} +1 -1
  87. package/web/dist/assets/queries-yuG-mM6_.js +1 -0
  88. package/web/dist/assets/{reference-chip-BWViAFIN.js → reference-chip-DeqB7ZMB.js} +1 -1
  89. package/web/dist/assets/{remote-settings-notice-DPCENbhz.js → remote-settings-notice-Dsz5ly3b.js} +1 -1
  90. package/web/dist/assets/{repo-git-jKOnO3ba.js → repo-git-Bjx30PIk.js} +1 -1
  91. package/web/dist/assets/{report-reader-DXYiKNcg.js → report-reader-BIDMrkji.js} +1 -1
  92. package/web/dist/assets/{reports-DEE0bHNv.js → reports-CJmqlXn7.js} +1 -1
  93. package/web/dist/assets/{resources-section-lqXgYTrv.js → resources-section-C8KZ4hre.js} +1 -1
  94. package/web/dist/assets/{run-header-CXlUbvDO.js → run-header-BzuB68Yq.js} +1 -1
  95. package/web/dist/assets/runners-CDw7wLfd.js +1 -0
  96. package/web/dist/assets/{settings-agent-picker-BRvZn4kM.js → settings-agent-picker-CSyeml1b.js} +1 -1
  97. package/web/dist/assets/{settings-shell-DTtd-vIa.js → settings-shell-Cni3kHc9.js} +1 -1
  98. package/web/dist/assets/{sidebar-section-BFW4ZfBR.js → sidebar-section-CCg4QGtg.js} +1 -1
  99. package/web/dist/assets/{skills-AImMlT1T.js → skills-C-in30dy.js} +1 -1
  100. package/web/dist/assets/{tab-link-CM6SDBtV.js → tab-link-Dl5Mmavw.js} +1 -1
  101. package/web/dist/assets/{task-changes-01Z_ppIw.js → task-changes-Bo4ZjMI9.js} +1 -1
  102. package/web/dist/assets/{task-commits-DRNIum3J.js → task-commits-Ca0v06Ow.js} +1 -1
  103. package/web/dist/assets/{task-files-Crz7Fo3C.js → task-files-1XZzDBKI.js} +1 -1
  104. package/web/dist/assets/{task-github-item-psG2V47c.js → task-github-item-vJHng0ie.js} +1 -1
  105. package/web/dist/assets/task-groups-3jn_VZOd.js +1 -0
  106. package/web/dist/assets/task-thread-Cfgc4Wvc.js +9 -0
  107. package/web/dist/assets/{tasks-table-DHTEGteC.js → tasks-table-DUrhAh4g.js} +1 -1
  108. package/web/dist/assets/{thread-state-BWJ2YyXo.js → thread-state-CF0SB2iW.js} +1 -1
  109. package/web/dist/assets/{use-hand-to-agent-state-DNROQerR.js → use-hand-to-agent-state-B3y26akX.js} +1 -1
  110. package/web/dist/assets/{useInfiniteQuery-qJeCNhM7.js → useInfiniteQuery-BnyaEFle.js} +1 -1
  111. package/web/dist/assets/useQuery-BUslvRIM.js +1 -0
  112. package/web/dist/assets/{workflows-Cx9lgrEo.js → workflows-C6YdW7RT.js} +1 -1
  113. package/web/dist/assets/{workspace-tools-CVitt3kE.js → workspace-tools-BDdrgrCg.js} +1 -1
  114. package/web/dist/assets/{worktrees-section-DxUg4l9n.js → worktrees-section-DO1e87cC.js} +1 -1
  115. package/web/dist/assets/{ws-BisMp6U5.js → ws-Bal5BUy2.js} +1 -1
  116. package/web/dist/index.html +17 -17
  117. package/web/dist/live-worker.js +1 -1
  118. package/web/dist/assets/attention-lvUYNNvV.js +0 -1
  119. package/web/dist/assets/automations-route-CZaUrmDs.js +0 -1
  120. package/web/dist/assets/index-CmadQXcg.js +0 -21
  121. package/web/dist/assets/live-protocol-D9ji1YCl.js +0 -64
  122. package/web/dist/assets/project-scope-context-D1bpJixc.js +0 -4
  123. package/web/dist/assets/queries-dHXhD3Hc.js +0 -1
  124. package/web/dist/assets/runners-CGQjSsir.js +0 -1
  125. package/web/dist/assets/task-groups-DF0XoB6U.js +0 -1
  126. package/web/dist/assets/task-thread-Bqg91ZVZ.js +0 -9
  127. package/web/dist/assets/useQuery-C3CQhXsT.js +0 -1
@@ -314,6 +314,8 @@ export declare const conversationSendRequestSchema: z.ZodObject<{
314
314
  text: z.ZodString;
315
315
  timeoutSeconds: z.ZodDefault<z.ZodNumber>;
316
316
  resume: z.ZodOptional<z.ZodBoolean>;
317
+ model: z.ZodOptional<z.ZodString>;
318
+ effort: z.ZodOptional<z.ZodString>;
317
319
  }, z.core.$strict>;
318
320
  export type ConversationSendRequest = z.infer<typeof conversationSendRequestSchema>;
319
321
  /** Effect of this call, independent of the stored delivery receipt and request outcome.
@@ -1251,6 +1251,16 @@ export declare const workerWaitRequestSchema: z.ZodObject<{
1251
1251
  }>>;
1252
1252
  }, z.core.$strict>;
1253
1253
  export type WorkerWaitRequest = z.infer<typeof workerWaitRequestSchema>;
1254
+ export declare const workerHoldSchema: z.ZodObject<{
1255
+ reason: z.ZodEnum<{
1256
+ "provider-error": "provider-error";
1257
+ "usage-limit": "usage-limit";
1258
+ }>;
1259
+ resumeAt: z.ZodISODateTime;
1260
+ attempts: z.ZodOptional<z.ZodNumber>;
1261
+ error: z.ZodOptional<z.ZodString>;
1262
+ }, z.core.$strict>;
1263
+ export type WorkerHold = z.infer<typeof workerHoldSchema>;
1254
1264
  export declare const workerInspectionSchema: z.ZodObject<{
1255
1265
  workerId: z.ZodUUID;
1256
1266
  settled: z.ZodBoolean;
@@ -1283,6 +1293,16 @@ export declare const workerInspectionSchema: z.ZodObject<{
1283
1293
  }, z.core.$strict>], "kind">;
1284
1294
  backend: z.ZodOptional<z.ZodString>;
1285
1295
  model: z.ZodOptional<z.ZodString>;
1296
+ effort: z.ZodOptional<z.ZodString>;
1297
+ hold: z.ZodOptional<z.ZodObject<{
1298
+ reason: z.ZodEnum<{
1299
+ "provider-error": "provider-error";
1300
+ "usage-limit": "usage-limit";
1301
+ }>;
1302
+ resumeAt: z.ZodISODateTime;
1303
+ attempts: z.ZodOptional<z.ZodNumber>;
1304
+ error: z.ZodOptional<z.ZodString>;
1305
+ }, z.core.$strict>>;
1286
1306
  inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1287
1307
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1288
1308
  kind: z.ZodLiteral<"baseline-file">;
@@ -1468,6 +1488,15 @@ export declare const workerListEntrySchema: z.ZodObject<{
1468
1488
  hostRunId: z.ZodUUID;
1469
1489
  baselineSha: z.ZodString;
1470
1490
  }, z.core.$strict>], "kind">;
1491
+ hold: z.ZodOptional<z.ZodObject<{
1492
+ reason: z.ZodEnum<{
1493
+ "provider-error": "provider-error";
1494
+ "usage-limit": "usage-limit";
1495
+ }>;
1496
+ resumeAt: z.ZodISODateTime;
1497
+ attempts: z.ZodOptional<z.ZodNumber>;
1498
+ error: z.ZodOptional<z.ZodString>;
1499
+ }, z.core.$strict>>;
1471
1500
  destroy: z.ZodOptional<z.ZodObject<{
1472
1501
  requestedAt: z.ZodISODateTime;
1473
1502
  phase: z.ZodEnum<{
@@ -1523,6 +1552,15 @@ export declare const workerListResultSchema: z.ZodObject<{
1523
1552
  hostRunId: z.ZodUUID;
1524
1553
  baselineSha: z.ZodString;
1525
1554
  }, z.core.$strict>], "kind">;
1555
+ hold: z.ZodOptional<z.ZodObject<{
1556
+ reason: z.ZodEnum<{
1557
+ "provider-error": "provider-error";
1558
+ "usage-limit": "usage-limit";
1559
+ }>;
1560
+ resumeAt: z.ZodISODateTime;
1561
+ attempts: z.ZodOptional<z.ZodNumber>;
1562
+ error: z.ZodOptional<z.ZodString>;
1563
+ }, z.core.$strict>>;
1526
1564
  destroy: z.ZodOptional<z.ZodObject<{
1527
1565
  requestedAt: z.ZodISODateTime;
1528
1566
  phase: z.ZodEnum<{
@@ -1585,6 +1623,15 @@ export declare const workerListPageSchema: z.ZodObject<{
1585
1623
  hostRunId: z.ZodUUID;
1586
1624
  baselineSha: z.ZodString;
1587
1625
  }, z.core.$strict>], "kind">;
1626
+ hold: z.ZodOptional<z.ZodObject<{
1627
+ reason: z.ZodEnum<{
1628
+ "provider-error": "provider-error";
1629
+ "usage-limit": "usage-limit";
1630
+ }>;
1631
+ resumeAt: z.ZodISODateTime;
1632
+ attempts: z.ZodOptional<z.ZodNumber>;
1633
+ error: z.ZodOptional<z.ZodString>;
1634
+ }, z.core.$strict>>;
1588
1635
  destroy: z.ZodOptional<z.ZodObject<{
1589
1636
  requestedAt: z.ZodISODateTime;
1590
1637
  phase: z.ZodEnum<{
@@ -1724,6 +1771,16 @@ export declare const runRelationshipsSchema: z.ZodObject<{
1724
1771
  }, z.core.$strict>], "kind">;
1725
1772
  backend: z.ZodOptional<z.ZodString>;
1726
1773
  model: z.ZodOptional<z.ZodString>;
1774
+ effort: z.ZodOptional<z.ZodString>;
1775
+ hold: z.ZodOptional<z.ZodObject<{
1776
+ reason: z.ZodEnum<{
1777
+ "provider-error": "provider-error";
1778
+ "usage-limit": "usage-limit";
1779
+ }>;
1780
+ resumeAt: z.ZodISODateTime;
1781
+ attempts: z.ZodOptional<z.ZodNumber>;
1782
+ error: z.ZodOptional<z.ZodString>;
1783
+ }, z.core.$strict>>;
1727
1784
  inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1728
1785
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1729
1786
  kind: z.ZodLiteral<"baseline-file">;
@@ -1,8 +1,8 @@
1
1
  // ../contract/src/events.ts
2
- import { z as z5 } from "zod";
2
+ import { z as z6 } from "zod";
3
3
 
4
4
  // ../contract/src/conversations.ts
5
- import { z as z2 } from "zod";
5
+ import { z as z3 } from "zod";
6
6
 
7
7
  // ../contract/src/ask-schema.ts
8
8
  import { z } from "zod";
@@ -35,38 +35,50 @@ var askRequestSchema = z.object({
35
35
  })
36
36
  }).strict();
37
37
 
38
+ // ../contract/src/effort.ts
39
+ import { z as z2 } from "zod";
40
+ var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
41
+ var effortLevelSchema = z2.enum(EFFORT_LEVELS);
42
+ var effortFieldSchema = z2.string().max(32).optional();
43
+ function parseEffort(value) {
44
+ const trimmed = value?.trim().toLowerCase();
45
+ if (!trimmed || trimmed === "auto") return void 0;
46
+ const parsed = effortLevelSchema.safeParse(trimmed);
47
+ return parsed.success ? parsed.data : void 0;
48
+ }
49
+
38
50
  // ../contract/src/conversations.ts
39
- var conversationRelationshipSchema = z2.enum(["family", "peer"]);
40
- var conversationAttributionSchema = z2.object({
41
- senderRunId: z2.uuid(),
42
- recipientRunId: z2.uuid(),
43
- kind: z2.enum(["request", "progress", "follow-up", "reply"]),
44
- requestId: z2.uuid().optional(),
51
+ var conversationRelationshipSchema = z3.enum(["family", "peer"]);
52
+ var conversationAttributionSchema = z3.object({
53
+ senderRunId: z3.uuid(),
54
+ recipientRunId: z3.uuid(),
55
+ kind: z3.enum(["request", "progress", "follow-up", "reply"]),
56
+ requestId: z3.uuid().optional(),
45
57
  relationship: conversationRelationshipSchema.optional()
46
58
  }).strict();
47
59
  var conversationMessageSchema = conversationAttributionSchema.extend({
48
- id: z2.uuid(),
49
- text: z2.string().min(1).max(1e5),
50
- createdAt: z2.iso.datetime(),
51
- deadline: z2.iso.datetime().optional(),
52
- requestHash: z2.string().regex(/^[0-9a-f]{64}$/),
53
- state: z2.enum(["accepted", "continuation-required", "destroyed", "late"]),
60
+ id: z3.uuid(),
61
+ text: z3.string().min(1).max(1e5),
62
+ createdAt: z3.iso.datetime(),
63
+ deadline: z3.iso.datetime().optional(),
64
+ requestHash: z3.string().regex(/^[0-9a-f]{64}$/),
65
+ state: z3.enum(["accepted", "continuation-required", "destroyed", "late"]),
54
66
  /** A parent-authorized new execution; retained on exact message retries. */
55
- resumed: z2.literal(true).optional(),
56
- instruction: z2.string().max(2048).optional(),
67
+ resumed: z3.literal(true).optional(),
68
+ instruction: z3.string().max(2048).optional(),
57
69
  /** A worker's question routed to its parent (#505): answered only by a reply naming it. */
58
70
  question: askRequestSchema.optional()
59
71
  });
60
- var requestOutcomeSchema = z2.object({
61
- requestId: z2.uuid(),
72
+ var requestOutcomeSchema = z3.object({
73
+ requestId: z3.uuid(),
62
74
  /** `deleted`: a peer recipient's record was deleted while the request was open. */
63
- status: z2.enum(["replied", "replied-late", "completed-without-reply", "failed", "cancelled", "destroyed", "timed-out", "sender-closed", "human-fallback", "deleted"]),
64
- observedAt: z2.iso.datetime(),
65
- replyId: z2.uuid().optional()
75
+ status: z3.enum(["replied", "replied-late", "completed-without-reply", "failed", "cancelled", "destroyed", "timed-out", "sender-closed", "human-fallback", "deleted"]),
76
+ observedAt: z3.iso.datetime(),
77
+ replyId: z3.uuid().optional()
66
78
  }).strict();
67
- var conversationStateSchema = z2.object({ messages: z2.array(conversationMessageSchema).max(1024), outcomes: z2.array(requestOutcomeSchema).max(1024) }).strict();
79
+ var conversationStateSchema = z3.object({ messages: z3.array(conversationMessageSchema).max(1024), outcomes: z3.array(requestOutcomeSchema).max(1024) }).strict();
68
80
  var CURSOR = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
69
- var conversationCursorSchema = z2.string().max(128).regex(CURSOR, "Not a history cursor; pass nextBefore from an earlier page");
81
+ var conversationCursorSchema = z3.string().max(128).regex(CURSOR, "Not a history cursor; pass nextBefore from an earlier page");
70
82
  function encodeConversationCursor(message2) {
71
83
  return `${message2.createdAt}~${message2.id}`;
72
84
  }
@@ -77,180 +89,182 @@ function decodeConversationCursor(cursor) {
77
89
  }
78
90
  var CONVERSATION_PAGE_MESSAGES = 1024;
79
91
  var conversationInspectResultSchema = conversationStateSchema.extend({
80
- hint: z2.string().optional(),
92
+ hint: z3.string().optional(),
81
93
  /** Present when older messages exist: pass it as `before` to read the page before this one. */
82
94
  nextBefore: conversationCursorSchema.optional()
83
95
  });
84
- var inboxReserveResultSchema = z2.object({
85
- messages: z2.array(conversationMessageSchema).max(32),
86
- outcomes: z2.array(requestOutcomeSchema).max(32),
87
- receiptId: z2.uuid().optional(),
88
- expiresAt: z2.iso.datetime().optional()
96
+ var inboxReserveResultSchema = z3.object({
97
+ messages: z3.array(conversationMessageSchema).max(32),
98
+ outcomes: z3.array(requestOutcomeSchema).max(32),
99
+ receiptId: z3.uuid().optional(),
100
+ expiresAt: z3.iso.datetime().optional()
89
101
  }).strict().refine(
90
102
  (value) => value.messages.length > 0 ? value.receiptId !== void 0 && value.expiresAt !== void 0 : value.receiptId === void 0 && value.expiresAt === void 0,
91
103
  { message: "A nonempty inbox batch requires a receipt and expiry" }
92
104
  );
93
- var inboxReceiptRequestSchema = z2.object({ receiptId: z2.uuid() }).strict();
94
- var inboxReceiptResultSchema = z2.object({
95
- receiptId: z2.uuid(),
96
- status: z2.enum(["acknowledged", "already-acknowledged", "released"])
105
+ var inboxReceiptRequestSchema = z3.object({ receiptId: z3.uuid() }).strict();
106
+ var inboxReceiptResultSchema = z3.object({
107
+ receiptId: z3.uuid(),
108
+ status: z3.enum(["acknowledged", "already-acknowledged", "released"])
97
109
  }).strict();
98
110
  var MAX_RESUME_REQUEST_SECONDS = 86400;
99
111
  var MAX_CONVERSATION_REQUEST_SECONDS = 7200;
100
112
  var DEFAULT_CONVERSATION_REQUEST_SECONDS = 600;
101
- var conversationSendRequestSchema = z2.object({
102
- id: z2.uuid(),
103
- recipientRunId: z2.uuid(),
113
+ var conversationSendRequestSchema = z3.object({
114
+ id: z3.uuid(),
115
+ recipientRunId: z3.uuid(),
104
116
  kind: conversationAttributionSchema.shape.kind,
105
- requestId: z2.uuid().optional(),
106
- text: z2.string().min(1).max(1e5).refine((text) => text.trim().length > 0),
107
- timeoutSeconds: z2.number().int().min(1).max(MAX_RESUME_REQUEST_SECONDS).default(DEFAULT_CONVERSATION_REQUEST_SECONDS),
108
- resume: z2.boolean().optional()
109
- }).strict().refine((value) => value.timeoutSeconds <= MAX_CONVERSATION_REQUEST_SECONDS || value.resume === true && value.kind === "request", { path: ["timeoutSeconds"], message: "Only --resume requests accept deadlines above 7200 seconds (maximum 86400)" }).refine((value) => (value.kind === "reply" || value.kind === "follow-up") === (value.requestId !== void 0), { message: "Replies and follow-ups require a request ID; new messages must omit it" }).refine((value) => !value.resume || value.kind === "request" || value.kind === "progress", { message: "--resume requires a new request or progress instruction" });
110
- var conversationSendEffectSchema = z2.enum(["applied", "unchanged", "refused", "unknown"]);
111
- var conversationSendResultSchema = z2.object({ message: conversationMessageSchema, delivery: z2.enum(["queued", "delivered", "consumed", "not-delivered"]), outcome: requestOutcomeSchema.optional(), effect: conversationSendEffectSchema.optional() }).strict();
112
- var conversationInspectRequestSchema = z2.object({ recipientRunId: z2.uuid(), before: conversationCursorSchema.optional() }).strict();
113
- var conversationCancelRequestSchema = z2.object({ requestId: z2.uuid() }).strict();
114
- var requestWaitRequestSchema = z2.object({
115
- requestIds: z2.array(z2.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length),
116
- mode: z2.enum(["one", "any", "all"]).optional(),
117
- timeoutSeconds: z2.number().int().min(1).max(7200).default(600)
117
+ requestId: z3.uuid().optional(),
118
+ text: z3.string().min(1).max(1e5).refine((text) => text.trim().length > 0),
119
+ timeoutSeconds: z3.number().int().min(1).max(MAX_RESUME_REQUEST_SECONDS).default(DEFAULT_CONVERSATION_REQUEST_SECONDS),
120
+ resume: z3.boolean().optional(),
121
+ model: z3.string().trim().min(1).max(512).optional(),
122
+ effort: effortFieldSchema
123
+ }).strict().refine((value) => value.timeoutSeconds <= MAX_CONVERSATION_REQUEST_SECONDS || value.resume === true && value.kind === "request", { path: ["timeoutSeconds"], message: "Only --resume requests accept deadlines above 7200 seconds (maximum 86400)" }).refine((value) => (value.kind === "reply" || value.kind === "follow-up") === (value.requestId !== void 0), { message: "Replies and follow-ups require a request ID; new messages must omit it" }).refine((value) => !value.resume || value.kind === "request" || value.kind === "progress", { message: "--resume requires a new request or progress instruction" }).refine((value) => value.resume === true || value.model === void 0 && value.effort === void 0, { message: "--model and --effort require --resume" });
124
+ var conversationSendEffectSchema = z3.enum(["applied", "unchanged", "refused", "unknown"]);
125
+ var conversationSendResultSchema = z3.object({ message: conversationMessageSchema, delivery: z3.enum(["queued", "delivered", "consumed", "not-delivered"]), outcome: requestOutcomeSchema.optional(), effect: conversationSendEffectSchema.optional() }).strict();
126
+ var conversationInspectRequestSchema = z3.object({ recipientRunId: z3.uuid(), before: conversationCursorSchema.optional() }).strict();
127
+ var conversationCancelRequestSchema = z3.object({ requestId: z3.uuid() }).strict();
128
+ var requestWaitRequestSchema = z3.object({
129
+ requestIds: z3.array(z3.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length),
130
+ mode: z3.enum(["one", "any", "all"]).optional(),
131
+ timeoutSeconds: z3.number().int().min(1).max(7200).default(600)
118
132
  }).strict().refine((value) => value.mode !== "one" || value.requestIds.length === 1, { message: "one requires exactly one request" });
119
133
 
120
134
  // ../contract/src/agent-input.ts
121
- import { z as z3 } from "zod";
122
- var inboxClaimSchema = z3.object({
123
- receiptId: z3.uuid(),
124
- generation: z3.uuid(),
125
- expiresAt: z3.iso.datetime(),
126
- acknowledgedAt: z3.iso.datetime().optional(),
135
+ import { z as z4 } from "zod";
136
+ var inboxClaimSchema = z4.object({
137
+ receiptId: z4.uuid(),
138
+ generation: z4.uuid(),
139
+ expiresAt: z4.iso.datetime(),
140
+ acknowledgedAt: z4.iso.datetime().optional(),
127
141
  /** Optional on read for receipts persisted before member manifests existed. */
128
- memberIds: z3.array(z3.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length).optional()
142
+ memberIds: z4.array(z4.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length).optional()
129
143
  }).strict();
130
- var agentInputSchema = z3.object({
144
+ var agentInputSchema = z4.object({
131
145
  conversation: conversationAttributionSchema.optional(),
132
- id: z3.uuid(),
133
- source: z3.enum(["agent", "lifecycle"]),
134
- parentRunId: z3.uuid(),
135
- text: z3.string().min(1).max(1e5),
136
- createdAt: z3.iso.datetime(),
137
- deliveredAt: z3.iso.datetime().optional(),
146
+ id: z4.uuid(),
147
+ source: z4.enum(["agent", "lifecycle"]),
148
+ parentRunId: z4.uuid(),
149
+ text: z4.string().min(1).max(1e5),
150
+ createdAt: z4.iso.datetime(),
151
+ deliveredAt: z4.iso.datetime().optional(),
138
152
  /** The model received it, when the harness can show that (#505). Absent on
139
153
  * unobservable backends and on records written before #505. */
140
- consumedAt: z3.iso.datetime().optional(),
154
+ consumedAt: z4.iso.datetime().optional(),
141
155
  /** Accepted by a harness that reports reading, and not read yet. A restart replays
142
156
  * such input; records written before #505 never carry it, so nothing historical replays. */
143
- awaitingRead: z3.literal(true).optional(),
157
+ awaitingRead: z4.literal(true).optional(),
144
158
  inboxClaim: inboxClaimSchema.optional(),
145
159
  /** A completion refusal Squawk queued for a closed session (hearsay-tools/cezarion#1301): its
146
160
  * delivery is the nudge's turn, bounded by the nudge's reply bound, and a session that closes
147
161
  * before it is a failed delivery. `undelivered-question` is Squawk's answer to a worker question
148
162
  * that could not reach its live parent (hearsay-tools/cezarion#2410). Absent on every other input
149
163
  * and on records written before. */
150
- purpose: z3.enum(["completion-refusal", "undelivered-question"]).optional(),
164
+ purpose: z4.enum(["completion-refusal", "undelivered-question"]).optional(),
151
165
  /** A peer message's own hash and request deadline (hearsay-tools/cezarion#1990): the sender's
152
166
  * ledger can be deleted before the recipient reads it. Absent on family and lifecycle inputs. */
153
- requestHash: z3.string().regex(/^[0-9a-f]{64}$/).optional(),
154
- deadline: z3.iso.datetime().optional()
167
+ requestHash: z4.string().regex(/^[0-9a-f]{64}$/).optional(),
168
+ deadline: z4.iso.datetime().optional()
155
169
  }).strict();
156
170
 
157
171
  // ../contract/src/worker-outcome.ts
158
- import { z as z4 } from "zod";
159
- var workerOutcomeSchema = z4.object({
160
- workerId: z4.uuid(),
161
- status: z4.enum(["review", "done", "failed", "cancelled"]),
162
- observedAt: z4.iso.datetime(),
163
- summary: z4.string().max(4e3).optional(),
164
- revision: z4.number().int().nonnegative().optional()
172
+ import { z as z5 } from "zod";
173
+ var workerOutcomeSchema = z5.object({
174
+ workerId: z5.uuid(),
175
+ status: z5.enum(["review", "done", "failed", "cancelled"]),
176
+ observedAt: z5.iso.datetime(),
177
+ summary: z5.string().max(4e3).optional(),
178
+ revision: z5.number().int().nonnegative().optional()
165
179
  }).strict();
166
- var workerWaitModeSchema = z4.enum(["one", "any", "all"]);
180
+ var workerWaitModeSchema = z5.enum(["one", "any", "all"]);
167
181
 
168
182
  // ../contract/src/events.ts
169
- var runEventSchema = z5.looseObject({
170
- seq: z5.number(),
171
- ts: z5.string(),
172
- stepId: z5.string().optional(),
173
- type: z5.string()
174
- });
175
- var conversationMessageEventSchema = runEventSchema.extend({ type: z5.literal("conversation-message"), message: conversationMessageSchema, delivery: z5.enum(["queued", "delivered", "consumed", "not-delivered"]), deliveredAt: z5.iso.datetime().optional(), consumedAt: z5.iso.datetime().optional() });
176
- var requestOutcomeEventSchema = runEventSchema.extend({ type: z5.literal("request-outcome"), outcome: requestOutcomeSchema });
183
+ var runEventSchema = z6.looseObject({
184
+ seq: z6.number(),
185
+ ts: z6.string(),
186
+ stepId: z6.string().optional(),
187
+ type: z6.string()
188
+ });
189
+ var conversationMessageEventSchema = runEventSchema.extend({ type: z6.literal("conversation-message"), message: conversationMessageSchema, delivery: z6.enum(["queued", "delivered", "consumed", "not-delivered"]), deliveredAt: z6.iso.datetime().optional(), consumedAt: z6.iso.datetime().optional() });
190
+ var requestOutcomeEventSchema = runEventSchema.extend({ type: z6.literal("request-outcome"), outcome: requestOutcomeSchema });
177
191
  var agentInputEventSchema = runEventSchema.extend({
178
- type: z5.literal("agent-input"),
192
+ type: z6.literal("agent-input"),
179
193
  input: agentInputSchema
180
194
  });
181
195
  var humanInputDeliveredEventSchema = runEventSchema.extend({
182
- type: z5.literal("human-input-delivered"),
183
- askSeq: z5.number().int().nonnegative(),
196
+ type: z6.literal("human-input-delivered"),
197
+ askSeq: z6.number().int().nonnegative(),
184
198
  /** Who answered: absent (records before #505) or `human` is a person; `parent` is the
185
199
  * owning parent's reply to a routed worker question; `cezar` is Squawk's notice that the question
186
200
  * could not reach a live parent (hearsay-tools/cezarion#2410). */
187
- source: z5.enum(["human", "parent", "cezar"]).optional()
201
+ source: z6.enum(["human", "parent", "cezar"]).optional()
188
202
  });
189
203
  var humanAskClosedEventSchema = runEventSchema.extend({
190
- type: z5.literal("human-ask-closed"),
191
- askSeq: z5.number().int().nonnegative(),
192
- reason: z5.enum(["finish", "superseded", "parent-stopped", "worker-stopped", "undeliverable"])
204
+ type: z6.literal("human-ask-closed"),
205
+ askSeq: z6.number().int().nonnegative(),
206
+ reason: z6.enum(["finish", "superseded", "parent-stopped", "worker-stopped", "undeliverable"])
193
207
  });
194
208
  var workerQuestionRoutedEventSchema = runEventSchema.extend({
195
- type: z5.literal("worker-question-routed"),
196
- askSeq: z5.number().int().nonnegative(),
197
- messageId: z5.uuid(),
198
- parentRunId: z5.uuid()
209
+ type: z6.literal("worker-question-routed"),
210
+ askSeq: z6.number().int().nonnegative(),
211
+ messageId: z6.uuid(),
212
+ parentRunId: z6.uuid()
199
213
  });
200
214
  var workerQuestionFallbackEventSchema = runEventSchema.extend({
201
- type: z5.literal("worker-question-fallback"),
202
- askSeq: z5.number().int().nonnegative(),
203
- reason: z5.string().min(1).max(200)
215
+ type: z6.literal("worker-question-fallback"),
216
+ askSeq: z6.number().int().nonnegative(),
217
+ reason: z6.string().min(1).max(200)
204
218
  });
205
219
  var workerQuestionUndeliveredEventSchema = runEventSchema.extend({
206
- type: z5.literal("worker-question-undelivered"),
207
- askSeq: z5.number().int().nonnegative(),
208
- reason: z5.string().min(1).max(200)
220
+ type: z6.literal("worker-question-undelivered"),
221
+ askSeq: z6.number().int().nonnegative(),
222
+ reason: z6.string().min(1).max(200)
209
223
  });
210
224
  var workerOutcomeEventSchema = runEventSchema.extend({
211
- type: z5.literal("worker-outcome"),
225
+ type: z6.literal("worker-outcome"),
212
226
  outcome: workerOutcomeSchema
213
227
  });
214
228
  var RUN_HISTORY_PAGE_ITEMS = 100;
215
- var runIdParamSchema = z5.object({
216
- id: z5.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)
229
+ var runIdParamSchema = z6.object({
230
+ id: z6.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)
217
231
  });
218
- var runHistoryCursorSchema = z5.string().min(1).max(2048);
219
- var runHistoryQuerySchema = z5.object({
232
+ var runHistoryCursorSchema = z6.string().min(1).max(2048);
233
+ var runHistoryQuerySchema = z6.object({
220
234
  cursor: runHistoryCursorSchema.optional()
221
235
  });
222
- var runEventsQuerySchema = z5.object({
236
+ var runEventsQuerySchema = z6.object({
223
237
  cursor: runHistoryCursorSchema.optional(),
224
- afterSeq: z5.coerce.number().int().nonnegative().optional()
225
- });
226
- var runHistoryEventSchema = z5.object({
227
- seq: z5.number(),
228
- ts: z5.string(),
229
- stepId: z5.string().optional(),
230
- type: z5.string()
231
- }).catchall(z5.any());
232
- var runHistoryPageSchema = z5.object({
233
- events: z5.array(runHistoryEventSchema),
234
- itemCount: z5.number().int().min(0).max(RUN_HISTORY_PAGE_ITEMS),
238
+ afterSeq: z6.coerce.number().int().nonnegative().optional()
239
+ });
240
+ var runHistoryEventSchema = z6.object({
241
+ seq: z6.number(),
242
+ ts: z6.string(),
243
+ stepId: z6.string().optional(),
244
+ type: z6.string()
245
+ }).catchall(z6.any());
246
+ var runHistoryPageSchema = z6.object({
247
+ events: z6.array(runHistoryEventSchema),
248
+ itemCount: z6.number().int().min(0).max(RUN_HISTORY_PAGE_ITEMS),
235
249
  olderCursor: runHistoryCursorSchema.optional(),
236
250
  newerCursor: runHistoryCursorSchema.optional(),
237
251
  liveCursor: runHistoryCursorSchema,
238
- asOfSeq: z5.number().int().nonnegative(),
239
- hasOlder: z5.boolean()
240
- });
241
- var runHistoryContextSchema = z5.object({
242
- contextEvents: z5.array(runHistoryEventSchema),
243
- asOfSeq: z5.number().int().nonnegative()
244
- });
245
- var checkoutProgressEventSchema = z5.object({
246
- checkoutId: z5.string().optional(),
247
- name: z5.string(),
248
- phase: z5.enum(["cloning", "done", "error"]),
249
- line: z5.string().optional(),
250
- error: z5.string().optional(),
252
+ asOfSeq: z6.number().int().nonnegative(),
253
+ hasOlder: z6.boolean()
254
+ });
255
+ var runHistoryContextSchema = z6.object({
256
+ contextEvents: z6.array(runHistoryEventSchema),
257
+ asOfSeq: z6.number().int().nonnegative()
258
+ });
259
+ var checkoutProgressEventSchema = z6.object({
260
+ checkoutId: z6.string().optional(),
261
+ name: z6.string(),
262
+ phase: z6.enum(["cloning", "done", "error"]),
263
+ line: z6.string().optional(),
264
+ error: z6.string().optional(),
251
265
  /** On `done` only: the project was created and registered, but a later step did not finish
252
266
  * (new-project flow, spec 2026-10-15-create-new-project). Names what exists and how to finish. */
253
- warning: z5.string().optional()
267
+ warning: z6.string().optional()
254
268
  });
255
269
 
256
270
  // ../contract/src/ask.ts
@@ -300,18 +314,6 @@ function askCardOf(ask) {
300
314
  // ../contract/src/delegation.ts
301
315
  import { z as z10 } from "zod";
302
316
 
303
- // ../contract/src/effort.ts
304
- import { z as z6 } from "zod";
305
- var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
306
- var effortLevelSchema = z6.enum(EFFORT_LEVELS);
307
- var effortFieldSchema = z6.string().max(32).optional();
308
- function parseEffort(value) {
309
- const trimmed = value?.trim().toLowerCase();
310
- if (!trimmed || trimmed === "auto") return void 0;
311
- const parsed = effortLevelSchema.safeParse(trimmed);
312
- return parsed.success ? parsed.data : void 0;
313
- }
314
-
315
317
  // ../contract/src/run-status.ts
316
318
  import { z as z7 } from "zod";
317
319
  var runStatusSchema = z7.enum([
@@ -706,6 +708,12 @@ var workerWaitRequestSchema = z10.object({
706
708
  timeoutSeconds: z10.number().int().min(1).max(7200).default(600),
707
709
  mode: workerWaitModeSchema.optional()
708
710
  }).strict().refine((request) => request.mode !== "one" || request.workerIds.length === 1, { message: "one mode requires exactly one worker" });
711
+ var workerHoldSchema = z10.object({
712
+ reason: z10.enum(["usage-limit", "provider-error"]),
713
+ resumeAt: z10.iso.datetime(),
714
+ attempts: z10.number().int().min(0).optional(),
715
+ error: z10.string().max(2e3).optional()
716
+ }).strict();
709
717
  var workerInspectionSchema = z10.object({
710
718
  workerId: z10.uuid(),
711
719
  settled: z10.boolean(),
@@ -718,6 +726,8 @@ var workerInspectionSchema = z10.object({
718
726
  workspace: workerWorkspaceSchema,
719
727
  backend: workerBackendSchema.optional(),
720
728
  model: z10.string().max(512).optional(),
729
+ effort: effortFieldSchema,
730
+ hold: workerHoldSchema.optional(),
721
731
  inputs: z10.array(workerInputSchema).max(32).optional(),
722
732
  wait: workerWaitSchema.optional(),
723
733
  /** The parent's deadline-less completion wait on this worker (hearsay-tools/cezarion#1301). */
@@ -734,6 +744,7 @@ var workerListEntrySchema = workerInspectionSchema.pick({
734
744
  supervisorRunId: true,
735
745
  status: true,
736
746
  workspace: true,
747
+ hold: true,
737
748
  destroy: true
738
749
  }).extend({
739
750
  revision: z10.number().int().nonnegative(),
@@ -1567,6 +1578,15 @@ var ciWaitReceiptSchema = ciPrIdentitySchema.extend({
1567
1578
  function isUsageLimitHold(run) {
1568
1579
  return run.status === "waiting" && run.autoResumeAt !== void 0;
1569
1580
  }
1581
+ function usageLimitHoldOf(run) {
1582
+ if (!isUsageLimitHold(run)) return void 0;
1583
+ return {
1584
+ reason: run.autoResumeReason ?? "usage-limit",
1585
+ resumeAt: run.autoResumeAt,
1586
+ ...run.autoResumeAttempts === void 0 ? {} : { attempts: run.autoResumeAttempts },
1587
+ ...run.error === void 0 ? {} : { error: run.error.slice(0, 2e3) }
1588
+ };
1589
+ }
1570
1590
 
1571
1591
  // ../contract/src/wait-limits.ts
1572
1592
  var WAIT_LIMIT = 16;
@@ -4799,6 +4819,26 @@ function latestSession(run) {
4799
4819
  const step = removedRunnerStepAfter(run.steps, latest?.sessionId) ? void 0 : latest;
4800
4820
  return { sessionId: step?.sessionId, backend: sessionRunner(step, run), profileId: step?.profileId };
4801
4821
  }
4822
+ function isAgentWorkflowStep(step) {
4823
+ return step.command === void 0 && step.kind !== "plugin";
4824
+ }
4825
+ function workerContinuationStepId(run) {
4826
+ const cursorId = run.workflowCursor?.mode === "resume" ? run.workflowCursor.stepId : void 0;
4827
+ if (cursorId && run.steps.find((step) => step.id === cursorId)?.status !== "done") return cursorId;
4828
+ const session = latestSessionStep(run.steps);
4829
+ if (!session) return void 0;
4830
+ if (session.synthetic === "continuation" && session.continuesStepId !== void 0) return session.continuesStepId;
4831
+ return run.steps.find((step) => step.sessionId === session.sessionId)?.id ?? session.id;
4832
+ }
4833
+ function workerContinuationStep(run, untouched = false) {
4834
+ if (run.delegation?.role !== "worker") return void 0;
4835
+ const steps = run.workflowDef?.steps;
4836
+ if (!steps?.length) return void 0;
4837
+ if (untouched) return steps.find(isAgentWorkflowStep);
4838
+ const targetId = workerContinuationStepId(run);
4839
+ const targeted = targetId ? steps.find((step) => step.id === targetId && isAgentWorkflowStep(step)) : void 0;
4840
+ return targeted ?? [...steps].reverse().find(isAgentWorkflowStep);
4841
+ }
4802
4842
  var LIVE_STATUSES = /* @__PURE__ */ new Set(["queued", "running", "waiting"]);
4803
4843
  function isLiveStatus(status) {
4804
4844
  return LIVE_STATUSES.has(status);
@@ -6837,6 +6877,7 @@ export {
6837
6877
  updateProjectInputSchema,
6838
6878
  updateProjectResponseSchema,
6839
6879
  updateProjectWebhookInputSchema,
6880
+ usageLimitHoldOf,
6840
6881
  userMcpListingSchema,
6841
6882
  utcMinute,
6842
6883
  waitErrorCodeSchema,
@@ -6860,6 +6901,7 @@ export {
6860
6901
  workerCompletionWaitSchema,
6861
6902
  workerContextReferenceSchema,
6862
6903
  workerContextSchema,
6904
+ workerContinuationStep,
6863
6905
  workerCreationReceiptSchema,
6864
6906
  workerDestroyRequestSchema,
6865
6907
  workerDestroyResultSchema,
@@ -6869,6 +6911,7 @@ export {
6869
6911
  workerDestroyWorkSchema,
6870
6912
  workerDiffSchema,
6871
6913
  workerEmptyRequestSchema,
6914
+ workerHoldSchema,
6872
6915
  workerIdsSchema,
6873
6916
  workerInputRecipeSchema,
6874
6917
  workerInputSchema,
@@ -32,6 +32,15 @@ export declare function latestSession(run: {
32
32
  backend: NonNullable<RunRecord['runner']>;
33
33
  profileId: string | undefined;
34
34
  };
35
+ type WorkerContinuationRun = Partial<Pick<RunRecord, 'delegation' | 'workflowDef' | 'workflowCursor'>> & {
36
+ steps: readonly Pick<StepState, 'id' | 'sessionId' | 'startedAt' | 'continuesStepId' | 'synthetic' | 'status'>[];
37
+ };
38
+ type WorkflowStepEntry = NonNullable<RunRecord['workflowDef']>['steps'][number];
39
+ /**
40
+ * The workflow agent step an owned worker's Continue extends: the first agent step when untouched,
41
+ * else the resumed cursor step, else the step owning the latest session, else the last agent step.
42
+ */
43
+ export declare function workerContinuationStep(run: WorkerContinuationRun, untouched?: boolean): WorkflowStepEntry | undefined;
35
44
  /** Status-only live predicate: queued, running or waiting. */
36
45
  export declare function isLiveStatus(status: string): boolean;
37
46
  type OwnershipInput = Pick<RunRecord, 'status'> & Partial<Pick<RunRecord, 'autoResumeAt'>>;
@@ -13,3 +13,10 @@ import type { RunRecord } from './runs.ts';
13
13
  export declare function isUsageLimitHold<T extends Partial<Pick<RunRecord, 'status' | 'autoResumeAt'>>>(run: T): run is T & {
14
14
  autoResumeAt: string;
15
15
  };
16
+ /** Structured hold details when a run is on a usage-limit or provider-error hold; undefined otherwise. */
17
+ export declare function usageLimitHoldOf(run: Partial<Pick<RunRecord, 'status' | 'autoResumeAt' | 'autoResumeReason' | 'autoResumeAttempts' | 'error'>>): {
18
+ reason: 'usage-limit' | 'provider-error';
19
+ resumeAt: string;
20
+ attempts?: number;
21
+ error?: string;
22
+ } | undefined;
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import type { PeerWaitView, WorkerCompletionWait, WorkerWait } from './delegation.ts';
3
3
  import type { RunRecord } from './runs.ts';
4
- import { isUsageLimitHold } from './usage-limit-hold.ts';
4
+ import { isUsageLimitHold, usageLimitHoldOf } from './usage-limit-hold.ts';
5
5
  import { WAIT_LIMIT, LAST_WAITS_LIMIT, TIMER_MIN_SECONDS, TIMER_MAX_SECONDS, PROCESS_TIMEOUT_DEFAULT_SECONDS, PROCESS_TIMEOUT_MAX_SECONDS, PROCESS_EXIT_FILE_MAX, PEER_WAIT_DEFAULT_SECONDS, PEER_WAIT_MAX_SECONDS, SUBAGENT_WAIT_DEADLINE_SECONDS, SUBAGENT_WAIT_GRACE_SECONDS, SUBAGENT_WAIT_CHILD_LIMIT, WAIT_MESSAGE_MAX, NOTE_MAX, PID_MIN } from './wait-limits.ts';
6
6
  export { withRootLedger, requestsToPeers, workerWaitTargets, computeWaitingOn, asksHuman, asksQuestion, hasResolvedWait, resolveWaitingOn, type WaitingOnInput, type WorkerWaitTarget, } from './waiting-on.ts';
7
- export { isUsageLimitHold, WAIT_LIMIT, LAST_WAITS_LIMIT, TIMER_MIN_SECONDS, TIMER_MAX_SECONDS, PROCESS_TIMEOUT_DEFAULT_SECONDS, PROCESS_TIMEOUT_MAX_SECONDS, PROCESS_EXIT_FILE_MAX, PEER_WAIT_DEFAULT_SECONDS, PEER_WAIT_MAX_SECONDS, SUBAGENT_WAIT_DEADLINE_SECONDS, SUBAGENT_WAIT_GRACE_SECONDS, SUBAGENT_WAIT_CHILD_LIMIT, WAIT_MESSAGE_MAX, NOTE_MAX, PID_MIN, };
7
+ export { isUsageLimitHold, usageLimitHoldOf, WAIT_LIMIT, LAST_WAITS_LIMIT, TIMER_MIN_SECONDS, TIMER_MAX_SECONDS, PROCESS_TIMEOUT_DEFAULT_SECONDS, PROCESS_TIMEOUT_MAX_SECONDS, PROCESS_EXIT_FILE_MAX, PEER_WAIT_DEFAULT_SECONDS, PEER_WAIT_MAX_SECONDS, SUBAGENT_WAIT_DEADLINE_SECONDS, SUBAGENT_WAIT_GRACE_SECONDS, SUBAGENT_WAIT_CHILD_LIMIT, WAIT_MESSAGE_MAX, NOTE_MAX, PID_MIN, };
8
8
  /** `open` → `resolved` (its event fired or its deadline passed) → `delivered`, or `cancelled`. */
9
9
  export declare const waitPhaseSchema: z.ZodEnum<{
10
10
  cancelled: "cancelled";