@wjarka/cezarion 0.14.8 → 0.14.9-dev.842

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 (207) hide show
  1. package/README.md +76 -2
  2. package/dist/application-update/bin-recovery.d.ts +5 -0
  3. package/dist/application-update/bin-recovery.js +96 -0
  4. package/dist/application-update/bin-recovery.js.map +1 -0
  5. package/dist/application-update/discovery.d.ts +22 -0
  6. package/dist/application-update/discovery.js +91 -0
  7. package/dist/application-update/discovery.js.map +1 -0
  8. package/dist/application-update/helper.d.ts +57 -0
  9. package/dist/application-update/helper.js +374 -0
  10. package/dist/application-update/helper.js.map +1 -0
  11. package/dist/application-update/launcher.d.ts +8 -0
  12. package/dist/application-update/launcher.js +53 -0
  13. package/dist/application-update/launcher.js.map +1 -0
  14. package/dist/application-update/lock.d.ts +4 -0
  15. package/dist/application-update/lock.js +70 -0
  16. package/dist/application-update/lock.js.map +1 -0
  17. package/dist/application-update/npm-process.d.ts +17 -0
  18. package/dist/application-update/npm-process.js +133 -0
  19. package/dist/application-update/npm-process.js.map +1 -0
  20. package/dist/application-update/service.d.ts +69 -0
  21. package/dist/application-update/service.js +456 -0
  22. package/dist/application-update/service.js.map +1 -0
  23. package/dist/artifacts/cli.d.ts +1 -0
  24. package/dist/artifacts/cli.js +32 -0
  25. package/dist/artifacts/cli.js.map +1 -0
  26. package/dist/artifacts/lifecycle.d.ts +4 -0
  27. package/dist/artifacts/lifecycle.js +42 -0
  28. package/dist/artifacts/lifecycle.js.map +1 -0
  29. package/dist/artifacts/resolve.d.ts +18 -0
  30. package/dist/artifacts/resolve.js +102 -0
  31. package/dist/artifacts/resolve.js.map +1 -0
  32. package/dist/artifacts/store.d.ts +8 -0
  33. package/dist/artifacts/store.js +323 -0
  34. package/dist/artifacts/store.js.map +1 -0
  35. package/dist/ci-wait/mcp.d.ts +3 -0
  36. package/dist/ci-wait/mcp.js +14 -3
  37. package/dist/ci-wait/mcp.js.map +1 -1
  38. package/dist/contract/application-update.d.ts +32 -0
  39. package/dist/contract/artifacts.d.ts +83 -0
  40. package/dist/contract/ask-schema.d.ts +32 -0
  41. package/dist/contract/ask.d.ts +2 -32
  42. package/dist/contract/conversations.d.ts +165 -0
  43. package/dist/contract/delegation.d.ts +39 -0
  44. package/dist/contract/events.d.ts +49 -0
  45. package/dist/contract/health.d.ts +12 -0
  46. package/dist/contract/index.d.ts +2 -0
  47. package/dist/contract/index.js +1374 -1247
  48. package/dist/contract/runs.d.ts +143 -0
  49. package/dist/contract/skills.d.ts +28 -0
  50. package/dist/core/agent-runner.d.ts +33 -4
  51. package/dist/core/agent-runner.js +5 -0
  52. package/dist/core/agent-runner.js.map +1 -1
  53. package/dist/core/claude-cli-runner.d.ts +6 -12
  54. package/dist/core/claude-cli-runner.js +89 -19
  55. package/dist/core/claude-cli-runner.js.map +1 -1
  56. package/dist/core/codex-app-server-runner.d.ts +2 -1
  57. package/dist/core/codex-app-server-runner.js +327 -92
  58. package/dist/core/codex-app-server-runner.js.map +1 -1
  59. package/dist/core/codex-app-server-transport.d.ts +13 -1
  60. package/dist/core/codex-app-server-transport.js +58 -17
  61. package/dist/core/codex-app-server-transport.js.map +1 -1
  62. package/dist/core/cursor-acp-runner.d.ts +4 -1
  63. package/dist/core/cursor-acp-runner.js +3 -0
  64. package/dist/core/cursor-acp-runner.js.map +1 -1
  65. package/dist/core/cursor-provider-error.js +6 -1
  66. package/dist/core/cursor-provider-error.js.map +1 -1
  67. package/dist/core/input-submissions.d.ts +14 -0
  68. package/dist/core/input-submissions.js +26 -0
  69. package/dist/core/input-submissions.js.map +1 -0
  70. package/dist/core/opencode-server-runner.d.ts +4 -1
  71. package/dist/core/opencode-server-runner.js +144 -21
  72. package/dist/core/opencode-server-runner.js.map +1 -1
  73. package/dist/core/pi-runner.d.ts +2 -1
  74. package/dist/core/pi-runner.js +72 -7
  75. package/dist/core/pi-runner.js.map +1 -1
  76. package/dist/delegation/cli.js +102 -6
  77. package/dist/delegation/cli.js.map +1 -1
  78. package/dist/delegation/conversations.js +13 -5
  79. package/dist/delegation/conversations.js.map +1 -1
  80. package/dist/delegation/input.d.ts +2 -1
  81. package/dist/delegation/input.js +6 -1
  82. package/dist/delegation/input.js.map +1 -1
  83. package/dist/delegation/provision.js +5 -3
  84. package/dist/delegation/provision.js.map +1 -1
  85. package/dist/delegation/questions.d.ts +19 -0
  86. package/dist/delegation/questions.js +45 -0
  87. package/dist/delegation/questions.js.map +1 -0
  88. package/dist/delegation/results.d.ts +1 -1
  89. package/dist/delegation/results.js +23 -13
  90. package/dist/delegation/results.js.map +1 -1
  91. package/dist/delegation/routes.d.ts +142 -15
  92. package/dist/delegation/routes.js +4 -1
  93. package/dist/delegation/routes.js.map +1 -1
  94. package/dist/delegation/service.d.ts +9 -5
  95. package/dist/delegation/service.js +106 -7
  96. package/dist/delegation/service.js.map +1 -1
  97. package/dist/delegation/transport.d.ts +188 -61
  98. package/dist/index.js +72 -26
  99. package/dist/index.js.map +1 -1
  100. package/dist/open-url.d.ts +2 -0
  101. package/dist/open-url.js +20 -0
  102. package/dist/open-url.js.map +1 -0
  103. package/dist/release/snapshot.d.ts +3 -3
  104. package/dist/release/snapshot.js +6 -6
  105. package/dist/release/snapshot.js.map +1 -1
  106. package/dist/runs/client-request.d.ts +11 -0
  107. package/dist/runs/client-request.js +26 -0
  108. package/dist/runs/client-request.js.map +1 -0
  109. package/dist/runs/delegation-state.d.ts +17 -0
  110. package/dist/runs/event-history.js +6 -0
  111. package/dist/runs/event-history.js.map +1 -1
  112. package/dist/runs/store.d.ts +78 -6
  113. package/dist/runs/store.js +163 -1
  114. package/dist/runs/store.js.map +1 -1
  115. package/dist/server/server.d.ts +3761 -1648
  116. package/dist/server/server.js +170 -4
  117. package/dist/server/server.js.map +1 -1
  118. package/dist/task-cli/cli.d.ts +38 -0
  119. package/dist/task-cli/cli.js +463 -0
  120. package/dist/task-cli/cli.js.map +1 -0
  121. package/dist/task-cli/discovery.d.ts +22 -0
  122. package/dist/task-cli/discovery.js +95 -0
  123. package/dist/task-cli/discovery.js.map +1 -0
  124. package/dist/task-cli/http.d.ts +43 -0
  125. package/dist/task-cli/http.js +101 -0
  126. package/dist/task-cli/http.js.map +1 -0
  127. package/dist/task-cli/projections.d.ts +40 -0
  128. package/dist/task-cli/projections.js +45 -0
  129. package/dist/task-cli/projections.js.map +1 -0
  130. package/dist/task-cli/watch.d.ts +78 -0
  131. package/dist/task-cli/watch.js +336 -0
  132. package/dist/task-cli/watch.js.map +1 -0
  133. package/dist/workflows/run.d.ts +93 -0
  134. package/dist/workflows/run.js +816 -81
  135. package/dist/workflows/run.js.map +1 -1
  136. package/dist/workspace/projects-cli.js +1 -1
  137. package/package.json +3 -3
  138. package/scripts/mock-claude.mjs +38 -2
  139. package/scripts/mock-codex-app-server.mjs +98 -1
  140. package/scripts/mock-cursor-acp.mjs +8 -0
  141. package/scripts/mock-opencode-serve.mjs +69 -2
  142. package/scripts/mock-pi-rpc.mjs +63 -2
  143. package/web/dist/assets/agent-accounts-JPfZPgKn.js +1 -0
  144. package/web/dist/assets/centered-state-HwCqQkH3.js +43 -0
  145. package/web/dist/assets/collapsible-CTymFdL7.js +1 -0
  146. package/web/dist/assets/commit-list-BZpYGQl2.js +1 -0
  147. package/web/dist/assets/compare-variants-9VkybaQ7.js +1 -0
  148. package/web/dist/assets/{diff-tRE59UNb2.js → diff-CZcD4D1r2.js} +2 -2
  149. package/web/dist/assets/diff-controls-CpcHG3Mm.js +1 -0
  150. package/web/dist/assets/{diff-stat-Cgnl_hYF.js → diff-stat-Cn7rzy1H.js} +1 -1
  151. package/web/dist/assets/{diff-view-DN1ort7Q.js → diff-view-C46nHiP2.js} +2 -2
  152. package/web/dist/assets/dropdown-menu-_YAzCaoQ.js +1 -0
  153. package/web/dist/assets/git-toolbar-BvKDz6uS.js +1 -0
  154. package/web/dist/assets/github-CgjJCGrD.js +1 -0
  155. package/web/dist/assets/{image-preview-C2JGcBlC.js → image-preview-B618kDBH.js} +1 -1
  156. package/web/dist/assets/index-BJtve0Pm.js +7 -0
  157. package/web/dist/assets/index-D0WAgmTQ.css +1 -0
  158. package/web/dist/assets/markdown-CFWZnvMh.js +2 -0
  159. package/web/dist/assets/pill-QfwkuR50.js +1 -0
  160. package/web/dist/assets/project-router-CkAA39N5.js +1 -0
  161. package/web/dist/assets/prompt-templates-Cfna_S0T.js +15 -0
  162. package/web/dist/assets/repo-git-DgzgJ0cP.js +1 -0
  163. package/web/dist/assets/{run-diff-CyG0Nciv.js → run-diff-YbCEQn5I.js} +2 -2
  164. package/web/dist/assets/run-header-DMgIbr1d.js +1 -0
  165. package/web/dist/assets/skills-BW79kUTd.js +1 -0
  166. package/web/dist/assets/{tab-link-BWNp3mLY.js → tab-link-MIHvczEm.js} +1 -1
  167. package/web/dist/assets/task-changes-C96ekt94.js +1 -0
  168. package/web/dist/assets/task-commits-DBfcMZyG.js +1 -0
  169. package/web/dist/assets/task-files-BKpH8dKQ.js +2 -0
  170. package/web/dist/assets/task-thread-Bw_nQuTx.css +1 -0
  171. package/web/dist/assets/task-thread-Dnq7Ek6W.js +9 -0
  172. package/web/dist/assets/textarea-D2vAVgYW.js +1 -0
  173. package/web/dist/assets/thread-loading-NW8Mthco.js +1 -0
  174. package/web/dist/assets/token-metrics-D188e6_0.js +1 -0
  175. package/web/dist/assets/utils-DKheTxGD.js +64 -0
  176. package/web/dist/assets/workflows-BFY1hgp3.js +11 -0
  177. package/web/dist/assets/{zoomable-image-Z3JDnm0b.js → zoomable-image-YW3Qdrr_.js} +1 -1
  178. package/web/dist/index.html +14 -14
  179. package/web/dist/assets/agent-accounts-BZm_2WAv.js +0 -1
  180. package/web/dist/assets/alert-dialog-B422RI-k.js +0 -43
  181. package/web/dist/assets/collapsible-Cy_Fmkrd.js +0 -1
  182. package/web/dist/assets/commit-list-Dcnk7TnI.js +0 -1
  183. package/web/dist/assets/compare-variants-Ciqwvd_f.js +0 -1
  184. package/web/dist/assets/diff-controls-BGrXGi7O.js +0 -1
  185. package/web/dist/assets/dropdown-menu-dwDGT8MM.js +0 -1
  186. package/web/dist/assets/git-toolbar-UiHnGvE0.js +0 -1
  187. package/web/dist/assets/github-D-MrkbJ7.js +0 -1
  188. package/web/dist/assets/ibm-plex-mono-regular-BF3vfe7_.ttf +0 -0
  189. package/web/dist/assets/index-BszfYvBq.js +0 -7
  190. package/web/dist/assets/index-CWh4pKP3.css +0 -1
  191. package/web/dist/assets/markdown-C_IcKVQd.js +0 -2
  192. package/web/dist/assets/pill-BsbO6G7y.js +0 -1
  193. package/web/dist/assets/project-router-DbLkll25.js +0 -1
  194. package/web/dist/assets/prompt-templates-BlTGJB5W.js +0 -15
  195. package/web/dist/assets/repo-git-Bm3s6Why.js +0 -1
  196. package/web/dist/assets/run-header-IFyIGCey.js +0 -1
  197. package/web/dist/assets/skills-C-C4DVFY.js +0 -1
  198. package/web/dist/assets/task-changes-D2PHtWUW.js +0 -1
  199. package/web/dist/assets/task-commits-N5u9U0_R.js +0 -1
  200. package/web/dist/assets/task-files-BS7c7CFm.js +0 -2
  201. package/web/dist/assets/task-thread-BQFdz1dJ.css +0 -1
  202. package/web/dist/assets/task-thread-DGM2dZV-.js +0 -9
  203. package/web/dist/assets/textarea-FjaU370i.js +0 -1
  204. package/web/dist/assets/thread-loading-77sJ8Yu_.js +0 -1
  205. package/web/dist/assets/token-metrics-Clxh03bE.js +0 -1
  206. package/web/dist/assets/utils-PYYcpCFZ.js +0 -64
  207. package/web/dist/assets/workflows-Czl0ZfXH.js +0 -11
@@ -1,58 +1,100 @@
1
1
  // ../contract/src/events.ts
2
- import { z as z4 } from "zod";
2
+ import { z as z5 } from "zod";
3
3
 
4
4
  // ../contract/src/conversations.ts
5
+ import { z as z2 } from "zod";
6
+
7
+ // ../contract/src/ask-schema.ts
5
8
  import { z } from "zod";
6
- var conversationAttributionSchema = z.object({
7
- senderRunId: z.uuid(),
8
- recipientRunId: z.uuid(),
9
- kind: z.enum(["request", "progress", "follow-up", "reply"]),
10
- requestId: z.uuid().optional()
9
+ var askOptionSchema = z.object({
10
+ label: z.string().min(1).max(60),
11
+ description: z.string().max(280).optional()
12
+ }).strict();
13
+ var askQuestionSchema = z.object({
14
+ /** Stable key for the answer; defaults to the array index when omitted. */
15
+ id: z.string().min(1).max(64).optional(),
16
+ /** ≤12-char chip label (matches AskUserQuestion's `header`). */
17
+ header: z.string().min(1).max(12),
18
+ question: z.string().min(1).max(400),
19
+ options: z.array(askOptionSchema).min(2).max(4).refine((opts) => new Set(opts.map((o) => o.label)).size === opts.length, {
20
+ message: "option labels must be unique within a question"
21
+ }),
22
+ multiSelect: z.boolean().optional()
23
+ }).strict();
24
+ var askRequestSchema = z.object({
25
+ questions: z.array(askQuestionSchema).min(1).max(4).refine((qs) => new Set(qs.map((q) => q.question)).size === qs.length, {
26
+ message: "question texts must be unique"
27
+ })
28
+ }).strict();
29
+
30
+ // ../contract/src/conversations.ts
31
+ var conversationAttributionSchema = z2.object({
32
+ senderRunId: z2.uuid(),
33
+ recipientRunId: z2.uuid(),
34
+ kind: z2.enum(["request", "progress", "follow-up", "reply"]),
35
+ requestId: z2.uuid().optional()
11
36
  }).strict();
12
37
  var conversationMessageSchema = conversationAttributionSchema.extend({
13
- id: z.uuid(),
14
- text: z.string().min(1).max(1e5),
15
- createdAt: z.iso.datetime(),
16
- deadline: z.iso.datetime().optional(),
17
- requestHash: z.string().regex(/^[0-9a-f]{64}$/),
18
- state: z.enum(["accepted", "continuation-required", "destroyed", "late"]),
38
+ id: z2.uuid(),
39
+ text: z2.string().min(1).max(1e5),
40
+ createdAt: z2.iso.datetime(),
41
+ deadline: z2.iso.datetime().optional(),
42
+ requestHash: z2.string().regex(/^[0-9a-f]{64}$/),
43
+ state: z2.enum(["accepted", "continuation-required", "destroyed", "late"]),
19
44
  /** A parent-authorized new execution; retained on exact message retries. */
20
- resumed: z.literal(true).optional(),
21
- instruction: z.string().max(2048).optional()
22
- });
23
- var requestOutcomeSchema = z.object({
24
- requestId: z.uuid(),
25
- status: z.enum(["replied", "completed-without-reply", "failed", "cancelled", "destroyed", "timed-out", "sender-closed"]),
26
- observedAt: z.iso.datetime(),
27
- replyId: z.uuid().optional()
45
+ resumed: z2.literal(true).optional(),
46
+ instruction: z2.string().max(2048).optional(),
47
+ /** A worker's question routed to its parent (#505): answered only by a reply naming it. */
48
+ question: askRequestSchema.optional()
49
+ });
50
+ var requestOutcomeSchema = z2.object({
51
+ requestId: z2.uuid(),
52
+ status: z2.enum(["replied", "completed-without-reply", "failed", "cancelled", "destroyed", "timed-out", "sender-closed", "human-fallback"]),
53
+ observedAt: z2.iso.datetime(),
54
+ replyId: z2.uuid().optional()
55
+ }).strict();
56
+ var conversationStateSchema = z2.object({ messages: z2.array(conversationMessageSchema).max(1024), outcomes: z2.array(requestOutcomeSchema).max(1024) }).strict();
57
+ var conversationInspectResultSchema = conversationStateSchema.extend({ hint: z2.string().optional() });
58
+ var inboxReserveResultSchema = z2.object({
59
+ messages: z2.array(conversationMessageSchema).max(32),
60
+ outcomes: z2.array(requestOutcomeSchema).max(32),
61
+ receiptId: z2.uuid().optional(),
62
+ expiresAt: z2.iso.datetime().optional()
63
+ }).strict().refine(
64
+ (value) => value.messages.length > 0 ? value.receiptId !== void 0 && value.expiresAt !== void 0 : value.receiptId === void 0 && value.expiresAt === void 0,
65
+ { message: "A nonempty inbox batch requires a receipt and expiry" }
66
+ );
67
+ var inboxReceiptRequestSchema = z2.object({ receiptId: z2.uuid() }).strict();
68
+ var inboxReceiptResultSchema = z2.object({
69
+ receiptId: z2.uuid(),
70
+ status: z2.enum(["acknowledged", "already-acknowledged", "released"])
28
71
  }).strict();
29
- var conversationStateSchema = z.object({ messages: z.array(conversationMessageSchema).max(1024), outcomes: z.array(requestOutcomeSchema).max(1024) }).strict();
30
- var conversationSendRequestSchema = z.object({
31
- id: z.uuid(),
32
- recipientRunId: z.uuid(),
72
+ var conversationSendRequestSchema = z2.object({
73
+ id: z2.uuid(),
74
+ recipientRunId: z2.uuid(),
33
75
  kind: conversationAttributionSchema.shape.kind,
34
- requestId: z.uuid().optional(),
35
- text: z.string().min(1).max(1e5).refine((text) => text.trim().length > 0),
36
- timeoutSeconds: z.number().int().min(1).max(1800).default(600),
37
- resume: z.boolean().optional()
76
+ requestId: z2.uuid().optional(),
77
+ text: z2.string().min(1).max(1e5).refine((text) => text.trim().length > 0),
78
+ timeoutSeconds: z2.number().int().min(1).max(1800).default(600),
79
+ resume: z2.boolean().optional()
38
80
  }).strict().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" });
39
- var conversationSendResultSchema = z.object({ message: conversationMessageSchema, delivery: z.enum(["queued", "delivered", "not-delivered"]), outcome: requestOutcomeSchema.optional() }).strict();
40
- var conversationInspectRequestSchema = z.object({ recipientRunId: z.uuid() }).strict();
41
- var conversationCancelRequestSchema = z.object({ requestId: z.uuid() }).strict();
42
- var requestWaitRequestSchema = z.object({
43
- requestIds: z.array(z.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length),
44
- mode: z.enum(["one", "any", "all"]).optional(),
45
- timeoutSeconds: z.number().int().min(1).max(1800).default(600)
81
+ var conversationSendResultSchema = z2.object({ message: conversationMessageSchema, delivery: z2.enum(["queued", "delivered", "consumed", "not-delivered"]), outcome: requestOutcomeSchema.optional() }).strict();
82
+ var conversationInspectRequestSchema = z2.object({ recipientRunId: z2.uuid() }).strict();
83
+ var conversationCancelRequestSchema = z2.object({ requestId: z2.uuid() }).strict();
84
+ var requestWaitRequestSchema = z2.object({
85
+ requestIds: z2.array(z2.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length),
86
+ mode: z2.enum(["one", "any", "all"]).optional(),
87
+ timeoutSeconds: z2.number().int().min(1).max(1800).default(600)
46
88
  }).strict().refine((value) => value.mode !== "one" || value.requestIds.length === 1, { message: "one requires exactly one request" });
47
89
 
48
90
  // ../contract/src/delegation.ts
49
- import { z as z3 } from "zod";
91
+ import { z as z4 } from "zod";
50
92
 
51
93
  // ../contract/src/effort.ts
52
- import { z as z2 } from "zod";
94
+ import { z as z3 } from "zod";
53
95
  var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
54
- var effortLevelSchema = z2.enum(EFFORT_LEVELS);
55
- var effortFieldSchema = z2.string().max(32).optional();
96
+ var effortLevelSchema = z3.enum(EFFORT_LEVELS);
97
+ var effortFieldSchema = z3.string().max(32).optional();
56
98
  function parseEffort(value) {
57
99
  const trimmed = value?.trim().toLowerCase();
58
100
  if (!trimmed || trimmed === "auto") return void 0;
@@ -61,162 +103,162 @@ function parseEffort(value) {
61
103
  }
62
104
 
63
105
  // ../contract/src/delegation.ts
64
- var workerOperationSchema = z3.enum(["spawn", "inspect", "steer", "stop", "destroy", "diff", "wait"]);
65
- var commitShaSchema = z3.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/);
66
- var requestHashSchema = z3.string().regex(/^[0-9a-f]{64}$/);
67
- var workerIdsSchema = z3.array(z3.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length);
68
- var permissionsSchema = z3.array(workerOperationSchema).max(7).refine((operations) => new Set(operations).size === operations.length);
69
- var remainingSchema = z3.array(z3.enum(["process", "worktree", "branch"])).max(3).refine((resources) => new Set(resources).size === resources.length);
70
- var errorSchema = z3.string().max(2e3);
71
- var workerWorkspaceSchema = z3.object({
72
- ownerRunId: z3.uuid(),
73
- resourceId: z3.uuid(),
74
- kind: z3.literal("owned-isolated"),
106
+ var workerOperationSchema = z4.enum(["spawn", "inspect", "steer", "stop", "destroy", "diff", "wait"]);
107
+ var commitShaSchema = z4.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/);
108
+ var requestHashSchema = z4.string().regex(/^[0-9a-f]{64}$/);
109
+ var workerIdsSchema = z4.array(z4.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length);
110
+ var permissionsSchema = z4.array(workerOperationSchema).max(7).refine((operations) => new Set(operations).size === operations.length);
111
+ var remainingSchema = z4.array(z4.enum(["process", "worktree", "branch"])).max(3).refine((resources) => new Set(resources).size === resources.length);
112
+ var errorSchema = z4.string().max(2e3);
113
+ var workerWorkspaceSchema = z4.object({
114
+ ownerRunId: z4.uuid(),
115
+ resourceId: z4.uuid(),
116
+ kind: z4.literal("owned-isolated"),
75
117
  /** Canonical creation path and original branch, never inferred from execution cwd. */
76
- path: z3.string().min(1),
77
- branch: z3.string().min(1),
118
+ path: z4.string().min(1),
119
+ branch: z4.string().min(1),
78
120
  baselineSha: commitShaSchema
79
121
  }).strict();
80
- var workerOutcomeSchema = z3.object({
81
- workerId: z3.uuid(),
82
- status: z3.enum(["review", "done", "failed", "cancelled"]),
83
- observedAt: z3.iso.datetime(),
84
- summary: z3.string().max(4e3).optional(),
85
- revision: z3.number().int().nonnegative().optional()
122
+ var workerOutcomeSchema = z4.object({
123
+ workerId: z4.uuid(),
124
+ status: z4.enum(["review", "done", "failed", "cancelled"]),
125
+ observedAt: z4.iso.datetime(),
126
+ summary: z4.string().max(4e3).optional(),
127
+ revision: z4.number().int().nonnegative().optional()
86
128
  }).strict();
87
- var workerWaitModeSchema = z3.enum(["one", "any", "all"]);
88
- var workerWaitSchema = z3.object({
89
- id: z3.uuid(),
90
- workerIds: z3.array(z3.uuid()).max(32).refine((ids) => new Set(ids).size === ids.length),
91
- requestIds: z3.array(z3.uuid()).min(1).max(32).optional(),
92
- requestOutcomes: z3.array(requestOutcomeSchema).max(32).optional(),
93
- deadline: z3.iso.datetime(),
129
+ var workerWaitModeSchema = z4.enum(["one", "any", "all"]);
130
+ var workerWaitSchema = z4.object({
131
+ id: z4.uuid(),
132
+ workerIds: z4.array(z4.uuid()).max(32).refine((ids) => new Set(ids).size === ids.length),
133
+ requestIds: z4.array(z4.uuid()).min(1).max(32).optional(),
134
+ requestOutcomes: z4.array(requestOutcomeSchema).max(32).optional(),
135
+ deadline: z4.iso.datetime(),
94
136
  mode: workerWaitModeSchema.optional(),
95
- revisions: z3.array(z3.object({ workerId: z3.uuid(), revision: z3.number().int().nonnegative() }).strict()).max(32).optional(),
96
- reason: z3.enum(["outcome", "timeout", "cancelled", "message"]).optional(),
97
- phase: z3.enum(["registered", "parked", "wake-pending"]),
98
- outcomes: z3.array(workerOutcomeSchema).max(32),
99
- wakeId: z3.uuid().optional()
137
+ revisions: z4.array(z4.object({ workerId: z4.uuid(), revision: z4.number().int().nonnegative() }).strict()).max(32).optional(),
138
+ reason: z4.enum(["outcome", "timeout", "cancelled", "message"]).optional(),
139
+ phase: z4.enum(["registered", "parked", "wake-pending"]),
140
+ outcomes: z4.array(workerOutcomeSchema).max(32),
141
+ wakeId: z4.uuid().optional()
100
142
  }).strict();
101
- var workerDestroySchema = z3.object({
102
- requestedAt: z3.iso.datetime(),
103
- phase: z3.enum(["requested", "terminating", "cleaning", "complete", "incomplete"]),
143
+ var workerDestroySchema = z4.object({
144
+ requestedAt: z4.iso.datetime(),
145
+ phase: z4.enum(["requested", "terminating", "cleaning", "complete", "incomplete"]),
104
146
  remaining: remainingSchema,
105
147
  error: errorSchema.optional()
106
148
  }).strict();
107
- var workerCreationReceiptSchema = z3.object({
108
- requestId: z3.uuid(),
109
- workerId: z3.uuid(),
149
+ var workerCreationReceiptSchema = z4.object({
150
+ requestId: z4.uuid(),
151
+ workerId: z4.uuid(),
110
152
  /** Hash of the original normalized spawn request, NOT the resolved commit or inherited settings. */
111
153
  requestHash: requestHashSchema,
112
- deletion: z3.object({ phase: z3.enum(["pending", "complete"]), revision: z3.number().int().nonnegative(), resourceId: z3.uuid(), generation: z3.uuid() }).strict().optional()
154
+ deletion: z4.object({ phase: z4.enum(["pending", "complete"]), revision: z4.number().int().nonnegative(), resourceId: z4.uuid(), generation: z4.uuid() }).strict().optional()
113
155
  }).strict();
114
- var workerBackendSchema = z3.enum(["claude", "codex", "opencode", "pi", "cursor"]);
115
- var relativeInputPath = z3.string().min(1).max(4096).refine((path) => !/[\\\u0000-\u001f\u007f:]/.test(path) && !path.startsWith("/") && path.split("/").every((part) => part !== "" && part !== "." && part !== ".."));
116
- var workerContextReferenceSchema = z3.discriminatedUnion("kind", [
117
- z3.object({ kind: z3.literal("baseline-file"), path: relativeInputPath }).strict(),
118
- z3.object({ kind: z3.literal("parent-attachment"), id: z3.string().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine((id) => !id.includes("..")) }).strict()
156
+ var workerBackendSchema = z4.enum(["claude", "codex", "opencode", "pi", "cursor"]);
157
+ var relativeInputPath = z4.string().min(1).max(4096).refine((path) => !/[\\\u0000-\u001f\u007f:]/.test(path) && !path.startsWith("/") && path.split("/").every((part) => part !== "" && part !== "." && part !== ".."));
158
+ var workerContextReferenceSchema = z4.discriminatedUnion("kind", [
159
+ z4.object({ kind: z4.literal("baseline-file"), path: relativeInputPath }).strict(),
160
+ z4.object({ kind: z4.literal("parent-attachment"), id: z4.string().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine((id) => !id.includes("..")) }).strict()
119
161
  ]);
120
- var workerContextSchema = z3.object({
121
- text: z3.string().max(1e5).optional(),
122
- artifacts: z3.array(workerContextReferenceSchema).max(32).optional()
162
+ var workerContextSchema = z4.object({
163
+ text: z4.string().max(1e5).optional(),
164
+ artifacts: z4.array(workerContextReferenceSchema).max(32).optional()
123
165
  }).strict();
124
- var workerInputSchema = z3.object({
166
+ var workerInputSchema = z4.object({
125
167
  source: workerContextReferenceSchema,
126
- path: z3.string().min(1).max(8192),
168
+ path: z4.string().min(1).max(8192),
127
169
  /** Parent attachment: SHA-256 of copied bytes. Baseline file: SHA-256 of the pinned Git blob ID
128
170
  * (the lowercase hexadecimal ID as UTF-8 text), not of file contents. Interpret by source.kind. */
129
171
  sha256: requestHashSchema,
130
- bytes: z3.number().int().min(0).max(Number.MAX_SAFE_INTEGER)
172
+ bytes: z4.number().int().min(0).max(Number.MAX_SAFE_INTEGER)
131
173
  }).strict();
132
- var workerInputRecipeSchema = z3.object({
133
- text: z3.string().max(1e5).optional(),
134
- inputs: z3.array(workerInputSchema).max(32)
174
+ var workerInputRecipeSchema = z4.object({
175
+ text: z4.string().max(1e5).optional(),
176
+ inputs: z4.array(workerInputSchema).max(32)
135
177
  }).strict();
136
- var unavailableEvidenceSchema = z3.object({ state: z3.literal("unavailable"), reason: z3.enum(["no-assistant-output", "missing", "unreadable", "unverified"]), detail: errorSchema.optional() }).strict();
137
- var deletedEvidenceSchema = z3.object({ state: z3.literal("deleted"), reason: z3.literal("missing") }).strict();
138
- var executionOutcomeSchema = z3.enum(["running", "review-ready", "completed", "failed", "cancelled"]);
139
- var workerArtifactSchema = z3.discriminatedUnion("state", [
140
- z3.object({ state: z3.literal("available"), id: z3.string().max(255), path: z3.string().max(8192) }).strict(),
141
- unavailableEvidenceSchema.extend({ id: z3.string().max(255), path: z3.string().max(8192) }),
142
- deletedEvidenceSchema.extend({ id: z3.string().max(255), path: z3.string().max(8192) })
178
+ var unavailableEvidenceSchema = z4.object({ state: z4.literal("unavailable"), reason: z4.enum(["no-assistant-output", "missing", "unreadable", "unverified"]), detail: errorSchema.optional() }).strict();
179
+ var deletedEvidenceSchema = z4.object({ state: z4.literal("deleted"), reason: z4.literal("missing") }).strict();
180
+ var executionOutcomeSchema = z4.enum(["running", "review-ready", "completed", "failed", "cancelled"]);
181
+ var workerArtifactSchema = z4.discriminatedUnion("state", [
182
+ z4.object({ state: z4.literal("available"), id: z4.string().max(255), path: z4.string().max(8192) }).strict(),
183
+ unavailableEvidenceSchema.extend({ id: z4.string().max(255), path: z4.string().max(8192) }),
184
+ deletedEvidenceSchema.extend({ id: z4.string().max(255), path: z4.string().max(8192) })
143
185
  ]);
144
- var workerCollectedResultSchema = z3.object({
145
- workerId: z3.uuid(),
146
- parentRunId: z3.uuid(),
147
- revision: z3.number().int().nonnegative(),
148
- observedAt: z3.iso.datetime(),
149
- status: z3.enum(["queued", "running", "waiting", "review", "done", "failed", "cancelled"]),
150
- outcome: z3.enum(["running", "review-ready", "completed", "failed", "cancelled", "destroyed"]),
186
+ var workerCollectedResultSchema = z4.object({
187
+ workerId: z4.uuid(),
188
+ parentRunId: z4.uuid(),
189
+ revision: z4.number().int().nonnegative(),
190
+ observedAt: z4.iso.datetime(),
191
+ status: z4.enum(["queued", "running", "waiting", "review", "done", "failed", "cancelled"]),
192
+ outcome: z4.enum(["running", "review-ready", "completed", "failed", "cancelled", "destroyed"]),
151
193
  lastExecutionOutcome: executionOutcomeSchema,
152
- partial: z3.boolean(),
153
- settled: z3.boolean(),
194
+ partial: z4.boolean(),
195
+ settled: z4.boolean(),
154
196
  error: errorSchema.optional(),
155
197
  backend: workerBackendSchema.optional(),
156
- model: z3.string().max(512).optional(),
198
+ model: z4.string().max(512).optional(),
157
199
  baselineSha: commitShaSchema,
158
- workspace: workerWorkspaceSchema.extend({ state: z3.enum(["available", "unavailable", "deleted"]).optional() }),
159
- cleanup: z3.enum(["retained", "requested", "terminating", "cleaning", "complete", "incomplete"]),
160
- summary: z3.discriminatedUnion("state", [
161
- z3.object({ state: z3.literal("available"), text: z3.string().min(1).max(4e3), source: z3.literal("assistant"), seq: z3.number().int().nonnegative(), truncated: z3.boolean() }).strict(),
200
+ workspace: workerWorkspaceSchema.extend({ state: z4.enum(["available", "unavailable", "deleted"]).optional() }),
201
+ cleanup: z4.enum(["retained", "requested", "terminating", "cleaning", "complete", "incomplete"]),
202
+ summary: z4.discriminatedUnion("state", [
203
+ z4.object({ state: z4.literal("available"), text: z4.string().min(1).max(4e3), source: z4.literal("assistant"), seq: z4.number().int().nonnegative(), truncated: z4.boolean() }).strict(),
162
204
  unavailableEvidenceSchema,
163
205
  deletedEvidenceSchema
164
206
  ]),
165
- head: z3.discriminatedUnion("state", [
166
- z3.object({ state: z3.literal("available"), sha: commitShaSchema }).strict(),
207
+ head: z4.discriminatedUnion("state", [
208
+ z4.object({ state: z4.literal("available"), sha: commitShaSchema }).strict(),
167
209
  unavailableEvidenceSchema.extend({ sha: commitShaSchema.optional() }),
168
210
  deletedEvidenceSchema.extend({ sha: commitShaSchema.optional() })
169
211
  ]),
170
- diff: z3.discriminatedUnion("state", [
212
+ diff: z4.discriminatedUnion("state", [
171
213
  // path addresses a workerResultFileSchema JSON document; its diffSnapshot field contains the patch.
172
- z3.object({ state: z3.literal("available"), snapshotId: z3.uuid(), path: z3.string().min(1).max(8192), truncated: z3.boolean() }).strict(),
214
+ z4.object({ state: z4.literal("available"), snapshotId: z4.uuid(), path: z4.string().min(1).max(8192), truncated: z4.boolean() }).strict(),
173
215
  unavailableEvidenceSchema,
174
216
  deletedEvidenceSchema
175
217
  ]),
176
- artifacts: z3.discriminatedUnion("state", [
177
- z3.object({ state: z3.literal("available"), items: z3.array(workerArtifactSchema).max(32), truncated: z3.boolean() }).strict(),
218
+ artifacts: z4.discriminatedUnion("state", [
219
+ z4.object({ state: z4.literal("available"), items: z4.array(workerArtifactSchema).max(32), truncated: z4.boolean() }).strict(),
178
220
  unavailableEvidenceSchema,
179
221
  deletedEvidenceSchema
180
222
  ])
181
223
  }).strict();
182
- var workerResultFileSchema = z3.object({ result: workerCollectedResultSchema, diffSnapshot: z3.string().max(4e5).optional() }).strict();
183
- var workerResultReferenceSchema = z3.object({
184
- workerId: z3.uuid(),
185
- revision: z3.number().int().nonnegative(),
186
- snapshotId: z3.uuid(),
187
- observedAt: z3.iso.datetime(),
224
+ var workerResultFileSchema = z4.object({ result: workerCollectedResultSchema, diffSnapshot: z4.string().max(4e5).optional() }).strict();
225
+ var workerResultReferenceSchema = z4.object({
226
+ workerId: z4.uuid(),
227
+ revision: z4.number().int().nonnegative(),
228
+ snapshotId: z4.uuid(),
229
+ observedAt: z4.iso.datetime(),
188
230
  lastExecutionOutcome: executionOutcomeSchema,
189
- previous: z3.object({ revision: z3.number().int().nonnegative(), observedAt: z3.iso.datetime(), lastExecutionOutcome: executionOutcomeSchema }).strict().optional()
231
+ previous: z4.object({ revision: z4.number().int().nonnegative(), observedAt: z4.iso.datetime(), lastExecutionOutcome: executionOutcomeSchema }).strict().optional()
190
232
  }).strict();
191
- var delegationStateSchema = z3.discriminatedUnion("role", [
192
- z3.object({
193
- role: z3.literal("root"),
233
+ var delegationStateSchema = z4.discriminatedUnion("role", [
234
+ z4.object({
235
+ role: z4.literal("root"),
194
236
  conversation: conversationStateSchema.optional(),
195
237
  permissions: permissionsSchema,
196
- receipts: z3.array(workerCreationReceiptSchema).max(32).refine((receipts) => new Set(receipts.map((receipt) => receipt.requestId)).size === receipts.length && new Set(receipts.map((receipt) => receipt.workerId)).size === receipts.length),
238
+ receipts: z4.array(workerCreationReceiptSchema).max(32).refine((receipts) => new Set(receipts.map((receipt) => receipt.requestId)).size === receipts.length && new Set(receipts.map((receipt) => receipt.workerId)).size === receipts.length),
197
239
  wait: workerWaitSchema.optional(),
198
240
  lastWait: workerWaitSchema.optional(),
199
- results: z3.array(workerResultReferenceSchema).max(32).refine((results) => new Set(results.map((result) => result.workerId)).size === results.length).optional(),
200
- finishRequestedAt: z3.iso.datetime().optional(),
201
- historyDeletion: z3.literal("pending").optional(),
202
- completion: z3.object({ phase: z3.enum(["waiting", "attention"]), waitId: z3.uuid().optional() }).strict().optional()
241
+ results: z4.array(workerResultReferenceSchema).max(32).refine((results) => new Set(results.map((result) => result.workerId)).size === results.length).optional(),
242
+ finishRequestedAt: z4.iso.datetime().optional(),
243
+ historyDeletion: z4.literal("pending").optional(),
244
+ completion: z4.object({ phase: z4.enum(["waiting", "attention"]), waitId: z4.uuid().optional() }).strict().optional()
203
245
  }).strict(),
204
- z3.object({
205
- role: z3.literal("worker"),
246
+ z4.object({
247
+ role: z4.literal("worker"),
206
248
  wait: workerWaitSchema.optional(),
207
249
  lastWait: workerWaitSchema.optional(),
208
250
  permissions: permissionsSchema,
209
- parentRunId: z3.uuid(),
251
+ parentRunId: z4.uuid(),
210
252
  workspace: workerWorkspaceSchema,
211
253
  destroy: workerDestroySchema.optional(),
212
254
  context: workerInputRecipeSchema.optional(),
213
- executionRevision: z3.number().int().nonnegative().optional(),
214
- executionStartSeq: z3.number().int().nonnegative().optional()
255
+ executionRevision: z4.number().int().nonnegative().optional(),
256
+ executionStartSeq: z4.number().int().nonnegative().optional()
215
257
  }).strict(),
216
258
  // A persisted quarantine is distinct from absent legacy metadata and grants no authority.
217
- z3.object({ role: z3.literal("invalid") }).strict()
259
+ z4.object({ role: z4.literal("invalid") }).strict()
218
260
  ]);
219
- var runDelegationSummarySchema = z3.discriminatedUnion("role", [
261
+ var runDelegationSummarySchema = z4.discriminatedUnion("role", [
220
262
  delegationStateSchema.options[0].pick({ role: true }).strip().extend({
221
263
  wait: workerWaitSchema.pick({ phase: true, requestIds: true }).strip().optional()
222
264
  }),
@@ -225,74 +267,89 @@ var runDelegationSummarySchema = z3.discriminatedUnion("role", [
225
267
  }),
226
268
  delegationStateSchema.options[2].strip()
227
269
  ]);
228
- var workerSpawnRequestSchema = z3.object({
229
- task: z3.string().min(1).max(1e5),
230
- baseline: z3.string().min(1).max(1024),
231
- requestId: z3.uuid(),
270
+ var workerSpawnRequestSchema = z4.object({
271
+ task: z4.string().min(1).max(1e5),
272
+ baseline: z4.string().min(1).max(1024),
273
+ requestId: z4.uuid(),
232
274
  context: workerContextSchema.optional(),
233
275
  backend: workerBackendSchema.optional(),
234
- model: z3.string().trim().min(1).max(512).optional(),
276
+ model: z4.string().trim().min(1).max(512).optional(),
235
277
  effort: effortFieldSchema,
236
278
  /** Catalog workflow name (built-in quick-task or `.ai/cezar/workflows/*.yaml`, #451). Absent means quick-task. */
237
- workflow: z3.string().trim().min(1).max(200).optional()
279
+ workflow: z4.string().trim().min(1).max(200).optional()
238
280
  }).strict().refine((request) => request.task.length + (request.context?.text?.length ?? 0) <= 1e5, { message: "Combined task and context exceed 100000 characters" });
239
- var workerSteerRequestSchema = z3.object({
240
- text: z3.string().max(1e5).refine((text) => text.trim().length > 0)
281
+ var workerSteerRequestSchema = z4.object({
282
+ text: z4.string().max(1e5).refine((text) => text.trim().length > 0)
241
283
  }).strict();
242
- var workerWaitRequestSchema = z3.object({
284
+ var workerWaitRequestSchema = z4.object({
243
285
  workerIds: workerIdsSchema,
244
- timeoutSeconds: z3.number().int().min(1).max(1800).default(600),
286
+ timeoutSeconds: z4.number().int().min(1).max(1800).default(600),
245
287
  mode: workerWaitModeSchema.optional()
246
288
  }).strict().refine((request) => request.mode !== "one" || request.workerIds.length === 1, { message: "one mode requires exactly one worker" });
247
- var agentInputSchema = z3.object({
289
+ var inboxClaimSchema = z4.object({
290
+ receiptId: z4.uuid(),
291
+ generation: z4.uuid(),
292
+ expiresAt: z4.iso.datetime(),
293
+ acknowledgedAt: z4.iso.datetime().optional(),
294
+ /** Optional on read for receipts persisted before member manifests existed. */
295
+ memberIds: z4.array(z4.uuid()).min(1).max(32).refine((ids) => new Set(ids).size === ids.length).optional()
296
+ }).strict();
297
+ var agentInputSchema = z4.object({
248
298
  conversation: conversationAttributionSchema.optional(),
249
- id: z3.uuid(),
250
- source: z3.enum(["agent", "lifecycle"]),
251
- parentRunId: z3.uuid(),
252
- text: z3.string().min(1).max(1e5),
253
- createdAt: z3.iso.datetime(),
254
- deliveredAt: z3.iso.datetime().optional()
299
+ id: z4.uuid(),
300
+ source: z4.enum(["agent", "lifecycle"]),
301
+ parentRunId: z4.uuid(),
302
+ text: z4.string().min(1).max(1e5),
303
+ createdAt: z4.iso.datetime(),
304
+ deliveredAt: z4.iso.datetime().optional(),
305
+ /** The model received it, when the harness can show that (#505). Absent on
306
+ * unobservable backends and on records written before #505. */
307
+ consumedAt: z4.iso.datetime().optional(),
308
+ /** Accepted by a harness that reports reading, and not read yet. A restart replays
309
+ * such input; records written before #505 never carry it, so nothing historical replays. */
310
+ awaitingRead: z4.literal(true).optional(),
311
+ inboxClaim: inboxClaimSchema.optional()
255
312
  }).strict();
256
- var workerInspectionSchema = z3.object({
257
- workerId: z3.uuid(),
258
- parentRunId: z3.uuid(),
259
- status: z3.enum(["queued", "running", "waiting", ...workerOutcomeSchema.shape.status.options]),
260
- currentStepId: z3.string().optional(),
261
- activity: z3.enum(["monitoring"]).optional(),
313
+ var workerInspectionSchema = z4.object({
314
+ workerId: z4.uuid(),
315
+ parentRunId: z4.uuid(),
316
+ status: z4.enum(["queued", "running", "waiting", ...workerOutcomeSchema.shape.status.options]),
317
+ currentStepId: z4.string().optional(),
318
+ activity: z4.enum(["monitoring"]).optional(),
262
319
  workspace: workerWorkspaceSchema,
263
320
  backend: workerBackendSchema.optional(),
264
- model: z3.string().max(512).optional(),
265
- inputs: z3.array(workerInputSchema).max(32).optional(),
321
+ model: z4.string().max(512).optional(),
322
+ inputs: z4.array(workerInputSchema).max(32).optional(),
266
323
  wait: workerWaitSchema.optional(),
267
324
  destroy: workerDestroySchema.optional(),
268
325
  outcome: workerOutcomeSchema.optional()
269
326
  });
270
- var workerDiffSchema = z3.object({
271
- workerId: z3.uuid(),
327
+ var workerDiffSchema = z4.object({
328
+ workerId: z4.uuid(),
272
329
  baselineSha: commitShaSchema,
273
- diff: z3.string().max(4e5),
274
- truncated: z3.boolean()
275
- });
276
- var workerStopResultSchema = z3.object({
277
- workerId: z3.uuid(),
278
- state: z3.enum(["stopping", "terminated"])
279
- });
280
- var workerDestroyResultSchema = z3.object({
281
- workerId: z3.uuid(),
282
- state: z3.enum(["complete", "incomplete"]),
283
- deleted: z3.array(z3.discriminatedUnion("kind", [
284
- z3.object({ kind: z3.literal("worktree"), path: z3.string().max(8192) }).strict(),
285
- z3.object({ kind: z3.literal("branch"), ref: z3.string().max(1024) }).strict()
330
+ diff: z4.string().max(4e5),
331
+ truncated: z4.boolean()
332
+ });
333
+ var workerStopResultSchema = z4.object({
334
+ workerId: z4.uuid(),
335
+ state: z4.enum(["stopping", "terminated"])
336
+ });
337
+ var workerDestroyResultSchema = z4.object({
338
+ workerId: z4.uuid(),
339
+ state: z4.enum(["complete", "incomplete"]),
340
+ deleted: z4.array(z4.discriminatedUnion("kind", [
341
+ z4.object({ kind: z4.literal("worktree"), path: z4.string().max(8192) }).strict(),
342
+ z4.object({ kind: z4.literal("branch"), ref: z4.string().max(1024) }).strict()
286
343
  ])).max(2).optional(),
287
344
  remaining: remainingSchema,
288
345
  error: errorSchema.optional()
289
346
  });
290
- var runRelationshipsSchema = z3.object({
291
- parentRunId: z3.uuid().optional(),
292
- workers: z3.array(workerInspectionSchema).max(32)
347
+ var runRelationshipsSchema = z4.object({
348
+ parentRunId: z4.uuid().optional(),
349
+ workers: z4.array(workerInspectionSchema).max(32)
293
350
  });
294
- var delegationErrorResponseSchema = z3.object({
295
- code: z3.enum([
351
+ var delegationErrorResponseSchema = z4.object({
352
+ code: z4.enum([
296
353
  "unavailable_transport",
297
354
  "unauthenticated",
298
355
  "denied_scope",
@@ -305,96 +362,89 @@ var delegationErrorResponseSchema = z3.object({
305
362
  ]),
306
363
  error: errorSchema
307
364
  });
308
- var workerParamsSchema = z3.object({ workerId: z3.uuid() }).strict();
309
- var workerSpawnResultSchema = z3.object({ workerId: z3.uuid(), baselineSha: commitShaSchema }).strict();
310
- var workerSteerResultSchema = z3.object({ workerId: z3.uuid(), state: z3.enum(["queued", "delivered"]) }).strict();
311
- var workerWaitResultSchema = z3.object({ wait: workerWaitSchema, instruction: z3.string().min(1).max(1e3) }).strict();
312
- var workerEmptyRequestSchema = z3.object({}).strict();
313
- var workerCancelWaitRequestSchema = z3.object({ waitId: z3.uuid() }).strict();
314
- var workerCancelWaitResultSchema = z3.object({ wait: workerWaitSchema }).strict();
365
+ var workerParamsSchema = z4.object({ workerId: z4.uuid() }).strict();
366
+ var workerSpawnResultSchema = z4.object({ workerId: z4.uuid(), baselineSha: commitShaSchema }).strict();
367
+ var workerSteerResultSchema = z4.object({ workerId: z4.uuid(), state: z4.enum(["queued", "delivered"]) }).strict();
368
+ var workerWaitResultSchema = z4.object({ wait: workerWaitSchema, instruction: z4.string().min(1).max(1e3) }).strict();
369
+ var workerEmptyRequestSchema = z4.object({}).strict();
370
+ var workerCancelWaitRequestSchema = z4.object({ waitId: z4.uuid() }).strict();
371
+ var workerCancelWaitResultSchema = z4.object({ wait: workerWaitSchema }).strict();
315
372
 
316
373
  // ../contract/src/events.ts
317
- var runEventSchema = z4.looseObject({
318
- seq: z4.number(),
319
- ts: z4.string(),
320
- stepId: z4.string().optional(),
321
- type: z4.string()
322
- });
323
- var conversationMessageEventSchema = runEventSchema.extend({ type: z4.literal("conversation-message"), message: conversationMessageSchema, delivery: z4.enum(["queued", "delivered", "not-delivered"]), deliveredAt: z4.iso.datetime().optional() });
324
- var requestOutcomeEventSchema = runEventSchema.extend({ type: z4.literal("request-outcome"), outcome: requestOutcomeSchema });
374
+ var runEventSchema = z5.looseObject({
375
+ seq: z5.number(),
376
+ ts: z5.string(),
377
+ stepId: z5.string().optional(),
378
+ type: z5.string()
379
+ });
380
+ 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() });
381
+ var requestOutcomeEventSchema = runEventSchema.extend({ type: z5.literal("request-outcome"), outcome: requestOutcomeSchema });
325
382
  var agentInputEventSchema = runEventSchema.extend({
326
- type: z4.literal("agent-input"),
383
+ type: z5.literal("agent-input"),
327
384
  input: agentInputSchema
328
385
  });
329
386
  var humanInputDeliveredEventSchema = runEventSchema.extend({
330
- type: z4.literal("human-input-delivered"),
331
- askSeq: z4.number().int().nonnegative()
387
+ type: z5.literal("human-input-delivered"),
388
+ askSeq: z5.number().int().nonnegative(),
389
+ /** Who answered: absent (records before #505) or `human` is a person; `parent` is the
390
+ * owning parent's reply to a routed worker question. */
391
+ source: z5.enum(["human", "parent"]).optional()
392
+ });
393
+ var workerQuestionRoutedEventSchema = runEventSchema.extend({
394
+ type: z5.literal("worker-question-routed"),
395
+ askSeq: z5.number().int().nonnegative(),
396
+ messageId: z5.uuid(),
397
+ parentRunId: z5.uuid()
398
+ });
399
+ var workerQuestionFallbackEventSchema = runEventSchema.extend({
400
+ type: z5.literal("worker-question-fallback"),
401
+ askSeq: z5.number().int().nonnegative(),
402
+ reason: z5.string().min(1).max(200)
332
403
  });
333
404
  var workerOutcomeEventSchema = runEventSchema.extend({
334
- type: z4.literal("worker-outcome"),
405
+ type: z5.literal("worker-outcome"),
335
406
  outcome: workerOutcomeSchema
336
407
  });
337
408
  var RUN_HISTORY_PAGE_ITEMS = 100;
338
- var runIdParamSchema = z4.object({
339
- id: z4.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)
409
+ var runIdParamSchema = z5.object({
410
+ id: z5.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)
340
411
  });
341
- var runHistoryCursorSchema = z4.string().min(1).max(2048);
342
- var runHistoryQuerySchema = z4.object({
412
+ var runHistoryCursorSchema = z5.string().min(1).max(2048);
413
+ var runHistoryQuerySchema = z5.object({
343
414
  cursor: runHistoryCursorSchema.optional()
344
415
  });
345
- var runEventsQuerySchema = z4.object({
416
+ var runEventsQuerySchema = z5.object({
346
417
  cursor: runHistoryCursorSchema.optional(),
347
- afterSeq: z4.coerce.number().int().nonnegative().optional()
348
- });
349
- var runHistoryEventSchema = z4.object({
350
- seq: z4.number(),
351
- ts: z4.string(),
352
- stepId: z4.string().optional(),
353
- type: z4.string()
354
- }).catchall(z4.any());
355
- var runHistoryPageSchema = z4.object({
356
- events: z4.array(runHistoryEventSchema),
357
- itemCount: z4.number().int().min(0).max(RUN_HISTORY_PAGE_ITEMS),
418
+ afterSeq: z5.coerce.number().int().nonnegative().optional()
419
+ });
420
+ var runHistoryEventSchema = z5.object({
421
+ seq: z5.number(),
422
+ ts: z5.string(),
423
+ stepId: z5.string().optional(),
424
+ type: z5.string()
425
+ }).catchall(z5.any());
426
+ var runHistoryPageSchema = z5.object({
427
+ events: z5.array(runHistoryEventSchema),
428
+ itemCount: z5.number().int().min(0).max(RUN_HISTORY_PAGE_ITEMS),
358
429
  olderCursor: runHistoryCursorSchema.optional(),
359
430
  newerCursor: runHistoryCursorSchema.optional(),
360
431
  liveCursor: runHistoryCursorSchema,
361
- asOfSeq: z4.number().int().nonnegative(),
362
- hasOlder: z4.boolean()
432
+ asOfSeq: z5.number().int().nonnegative(),
433
+ hasOlder: z5.boolean()
363
434
  });
364
- var runHistoryContextSchema = z4.object({
365
- contextEvents: z4.array(runHistoryEventSchema),
366
- asOfSeq: z4.number().int().nonnegative()
435
+ var runHistoryContextSchema = z5.object({
436
+ contextEvents: z5.array(runHistoryEventSchema),
437
+ asOfSeq: z5.number().int().nonnegative()
367
438
  });
368
- var checkoutProgressEventSchema = z4.object({
369
- checkoutId: z4.string().optional(),
370
- name: z4.string(),
371
- phase: z4.enum(["cloning", "done", "error"]),
372
- line: z4.string().optional(),
373
- error: z4.string().optional()
439
+ var checkoutProgressEventSchema = z5.object({
440
+ checkoutId: z5.string().optional(),
441
+ name: z5.string(),
442
+ phase: z5.enum(["cloning", "done", "error"]),
443
+ line: z5.string().optional(),
444
+ error: z5.string().optional()
374
445
  });
375
446
 
376
447
  // ../contract/src/ask.ts
377
- import { z as z5 } from "zod";
378
- var askOptionSchema = z5.object({
379
- label: z5.string().min(1).max(60),
380
- description: z5.string().max(280).optional()
381
- }).strict();
382
- var askQuestionSchema = z5.object({
383
- /** Stable key for the answer; defaults to the array index when omitted. */
384
- id: z5.string().min(1).max(64).optional(),
385
- /** ≤12-char chip label (matches AskUserQuestion's `header`). */
386
- header: z5.string().min(1).max(12),
387
- question: z5.string().min(1).max(400),
388
- options: z5.array(askOptionSchema).min(2).max(4).refine((opts) => new Set(opts.map((o) => o.label)).size === opts.length, {
389
- message: "option labels must be unique within a question"
390
- }),
391
- multiSelect: z5.boolean().optional()
392
- }).strict();
393
- var askRequestSchema = z5.object({
394
- questions: z5.array(askQuestionSchema).min(1).max(4).refine((qs) => new Set(qs.map((q) => q.question)).size === qs.length, {
395
- message: "question texts must be unique"
396
- })
397
- }).strict();
398
448
  function advancePendingHumanAsk(pending, event) {
399
449
  if (event.type === "ask.requested" && typeof event.requestId === "string" && askRequestSchema.safeParse({ questions: event.questions }).success) return event;
400
450
  if (event.type === "human-input-delivered") {
@@ -410,21 +460,34 @@ function pendingHumanAsk(events) {
410
460
  }
411
461
 
412
462
  // ../contract/src/health.ts
463
+ import { z as z7 } from "zod";
464
+
465
+ // ../contract/src/application-update.ts
413
466
  import { z as z6 } from "zod";
414
- var runnerSchema = z6.enum(["claude", "codex", "opencode", "pi", "cursor"]);
415
- var repoInfoSchema = z6.object({
416
- root: z6.string(),
417
- branch: z6.string(),
418
- remote: z6.string().optional()
419
- });
420
- var backendCheckSchema = z6.object({
421
- name: z6.enum(["claude", "codex", "opencode", "pi", "cursor", "gh", "git"]),
422
- available: z6.boolean(),
423
- version: z6.string().optional(),
424
- hint: z6.string().optional()
425
- });
426
- var forgeInfoSchema = z6.object({
427
- kind: z6.literal("github"),
467
+ var applicationUpdateStateSchema = z6.object({
468
+ status: z6.enum(["idle", "preparing", "ready", "restarting", "error"]),
469
+ supported: z6.boolean(),
470
+ targetVersion: z6.string().optional(),
471
+ message: z6.string().optional()
472
+ });
473
+ var applicationUpdateInputSchema = z6.record(z6.string(), z6.never());
474
+ var applicationUpdateResponseSchema = z6.object({ state: applicationUpdateStateSchema });
475
+
476
+ // ../contract/src/health.ts
477
+ var runnerSchema = z7.enum(["claude", "codex", "opencode", "pi", "cursor"]);
478
+ var repoInfoSchema = z7.object({
479
+ root: z7.string(),
480
+ branch: z7.string(),
481
+ remote: z7.string().optional()
482
+ });
483
+ var backendCheckSchema = z7.object({
484
+ name: z7.enum(["claude", "codex", "opencode", "pi", "cursor", "gh", "git"]),
485
+ available: z7.boolean(),
486
+ version: z7.string().optional(),
487
+ hint: z7.string().optional()
488
+ });
489
+ var forgeInfoSchema = z7.object({
490
+ kind: z7.literal("github"),
428
491
  /**
429
492
  * Whether the forge is reachable — **absent until the availability probe has warmed**.
430
493
  *
@@ -432,13 +495,13 @@ var forgeInfoSchema = z6.object({
432
495
  * "not determined yet", which is not the same as `false`, and the cockpit renders the two
433
496
  * differently. Declaring it required is what made an earlier hand-written mirror wrong.
434
497
  */
435
- available: z6.boolean().optional(),
436
- reason: z6.string().optional()
498
+ available: z7.boolean().optional(),
499
+ reason: z7.string().optional()
437
500
  });
438
- var capabilitiesSchema = z6.object({
439
- localHandoff: z6.boolean(),
440
- followups: z6.boolean(),
441
- singleProject: z6.boolean(),
501
+ var capabilitiesSchema = z7.object({
502
+ localHandoff: z7.boolean(),
503
+ followups: z7.boolean(),
504
+ singleProject: z7.boolean(),
442
505
  /**
443
506
  * `true` means `CEZ_AUTOMATIONS=1` opted this server into GitHub automations (#801). Off — the
444
507
  * default — the whole feature is absent: no `Automations` nav item anywhere it is rendered, the
@@ -446,7 +509,7 @@ var capabilitiesSchema = z6.object({
446
509
  *
447
510
  * REQUIRED for the same reason as `tokenMetrics` below: this server always sends it.
448
511
  */
449
- automations: z6.boolean(),
512
+ automations: z7.boolean(),
450
513
  /**
451
514
  * `false` means `CEZ_HIDE_TOKEN_METRICS=1` asks the browser to omit token counts and monetary
452
515
  * cost (#481). The telemetry itself still rides in run/event payloads — this is presentation
@@ -459,52 +522,53 @@ var capabilitiesSchema = z6.object({
459
522
  * `web/src/lib/token-metrics.ts`, whose `!== false` read still treats an absent field as
460
523
  * visible.
461
524
  */
462
- tokenMetrics: z6.boolean(),
525
+ tokenMetrics: z7.boolean(),
463
526
  /** Current token-count presentation policy. Required on current servers;
464
527
  * older payload tolerance belongs in the browser resolver. */
465
- tokenUsageMetrics: z6.boolean(),
528
+ tokenUsageMetrics: z7.boolean(),
466
529
  /** Current backend-reported-cost presentation policy. */
467
- costMetrics: z6.boolean()
530
+ costMetrics: z7.boolean()
468
531
  });
469
- var healthResponseSchema = z6.object({
470
- version: z6.string(),
471
- latestVersion: z6.string().optional(),
472
- repoRoot: z6.string(),
532
+ var healthResponseSchema = z7.object({
533
+ version: z7.string(),
534
+ latestVersion: z7.string().optional(),
535
+ repoRoot: z7.string(),
473
536
  repo: repoInfoSchema.nullable(),
474
- checks: z6.array(backendCheckSchema),
537
+ checks: z7.array(backendCheckSchema),
475
538
  defaultRunner: runnerSchema,
476
539
  forge: forgeInfoSchema.nullable(),
477
540
  capabilities: capabilitiesSchema,
478
541
  // Always sent: `workspaceSummary()` returns both unconditionally, and an unreadable workspace
479
542
  // degrades to `projects: []` rather than to an absent key. The hand-written DTO declared them
480
543
  // optional, which was wider than the server has ever been.
481
- projects: z6.array(z6.object({ id: z6.string(), name: z6.string() })),
482
- bootProject: z6.string()
544
+ projects: z7.array(z7.object({ id: z7.string(), name: z7.string() })),
545
+ bootProject: z7.string(),
546
+ applicationUpdate: applicationUpdateStateSchema.optional()
483
547
  });
484
548
 
485
549
  // ../contract/src/ci-wait.ts
486
- import { z as z7 } from "zod";
550
+ import { z as z8 } from "zod";
487
551
  var CI_WAIT_LIMITATION = "Passing reported checks does not prove that every expected workflow has appeared or that the PR is merge-ready. This observation is not merge approval.";
488
552
  var CI_WAIT_RECEIPT_INSTRUCTION = "End your turn to wait for CI; no marker is needed. " + CI_WAIT_LIMITATION;
489
553
  var prPattern = /^https:\/\/([a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)$/;
490
- var ciPrUrlSchema = z7.string().max(2048).regex(prPattern).refine((value) => {
554
+ var ciPrUrlSchema = z8.string().max(2048).regex(prPattern).refine((value) => {
491
555
  const match = prPattern.exec(value);
492
556
  return !!match && Number.isSafeInteger(Number(match[4])) && match[3] !== "." && match[3] !== "..";
493
557
  }, "Expected an HTTPS GitHub PR URL with a positive integer PR number");
494
- var ciWaitRequestSchema = z7.object({
558
+ var ciWaitRequestSchema = z8.object({
495
559
  pr: ciPrUrlSchema,
496
- timeout_seconds: z7.number().int().min(1).max(7200).default(1800)
560
+ timeout_seconds: z8.number().int().min(1).max(7200).default(1800)
497
561
  }).strict();
498
- var sha = z7.string().regex(/^[0-9a-f]{40}$/i);
499
- var ciPrIdentitySchema = z7.object({
562
+ var sha = z8.string().regex(/^[0-9a-f]{40}$/i);
563
+ var ciPrIdentitySchema = z8.object({
500
564
  prUrl: ciPrUrlSchema,
501
- repository: z7.string().max(2048).regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),
502
- prNumber: z7.number().int().positive().max(Number.MAX_SAFE_INTEGER),
565
+ repository: z8.string().max(2048).regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),
566
+ prNumber: z8.number().int().positive().max(Number.MAX_SAFE_INTEGER),
503
567
  headSha: sha
504
568
  }).strict();
505
- var ciWaitOutcomeSchema = z7.enum(["passed", "failed", "cancelled", "skipped", "no_checks", "head_changed", "deadline", "error"]);
506
- var ciWaitErrorCodeSchema = z7.enum(["invalid_request", "unsupported_host", "gh_missing", "authentication", "inaccessible_pr", "malformed_data", "output_limit", "query_timeout", "command_failed", "wait_conflict", "capacity", "unavailable", "unauthorized", "persistence"]);
507
- var ciWaitErrorSchema = z7.object({ code: ciWaitErrorCodeSchema, message: z7.string().max(4096) }).strict();
569
+ var ciWaitOutcomeSchema = z8.enum(["passed", "failed", "cancelled", "skipped", "no_checks", "head_changed", "deadline", "error"]);
570
+ var ciWaitErrorCodeSchema = z8.enum(["invalid_request", "unsupported_host", "gh_missing", "authentication", "inaccessible_pr", "malformed_data", "output_limit", "query_timeout", "command_failed", "wait_conflict", "capacity", "unavailable", "unauthorized", "persistence"]);
571
+ var ciWaitErrorSchema = z8.object({ code: ciWaitErrorCodeSchema, message: z8.string().max(4096) }).strict();
508
572
  function utf8Bytes(value) {
509
573
  let bytes = 0;
510
574
  for (const char of value) {
@@ -513,113 +577,113 @@ function utf8Bytes(value) {
513
577
  }
514
578
  return bytes;
515
579
  }
516
- var ciWaitResultSchema = z7.object({
580
+ var ciWaitResultSchema = z8.object({
517
581
  outcome: ciWaitOutcomeSchema,
518
582
  headSha: sha,
519
583
  observedHeadSha: sha.optional(),
520
- observedAt: z7.iso.datetime(),
521
- checks: z7.array(z7.object({ name: z7.string().max(256), state: z7.string().max(256), link: z7.string().max(2048) }).strict()).max(100),
522
- totalChecks: z7.number().int().nonnegative(),
523
- truncated: z7.boolean(),
524
- diagnostic: z7.string().max(4096).refine((value) => utf8Bytes(value) <= 4096).optional()
584
+ observedAt: z8.iso.datetime(),
585
+ checks: z8.array(z8.object({ name: z8.string().max(256), state: z8.string().max(256), link: z8.string().max(2048) }).strict()).max(100),
586
+ totalChecks: z8.number().int().nonnegative(),
587
+ truncated: z8.boolean(),
588
+ diagnostic: z8.string().max(4096).refine((value) => utf8Bytes(value) <= 4096).optional()
525
589
  }).strict().refine((value) => utf8Bytes(JSON.stringify(value)) <= 32 * 1024, "CI result exceeds 32 KiB");
526
590
  var ciWaitSchema = ciPrIdentitySchema.extend({
527
- id: z7.uuid(),
528
- generation: z7.string().min(1).max(256),
529
- turnId: z7.string().min(1).max(256),
530
- timeoutSeconds: z7.number().int().min(1).max(7200),
531
- registeredAt: z7.iso.datetime(),
532
- deadline: z7.iso.datetime(),
533
- phase: z7.enum(["registered", "parked", "wake-pending", "delivered", "withdrawn"]),
591
+ id: z8.uuid(),
592
+ generation: z8.string().min(1).max(256),
593
+ turnId: z8.string().min(1).max(256),
594
+ timeoutSeconds: z8.number().int().min(1).max(7200),
595
+ registeredAt: z8.iso.datetime(),
596
+ deadline: z8.iso.datetime(),
597
+ phase: z8.enum(["registered", "parked", "wake-pending", "delivered", "withdrawn"]),
534
598
  result: ciWaitResultSchema.optional(),
535
- wakeId: z7.string().min(1).max(256).optional(),
536
- deliveredAt: z7.iso.datetime().optional()
599
+ wakeId: z8.string().min(1).max(256).optional(),
600
+ deliveredAt: z8.iso.datetime().optional()
537
601
  }).strict();
538
602
  var ciWaitReceiptSchema = ciPrIdentitySchema.extend({
539
- waitId: z7.uuid(),
540
- registeredAt: z7.iso.datetime(),
541
- deadline: z7.iso.datetime(),
603
+ waitId: z8.uuid(),
604
+ registeredAt: z8.iso.datetime(),
605
+ deadline: z8.iso.datetime(),
542
606
  phase: ciWaitSchema.shape.phase
543
607
  }).strict();
544
608
 
545
609
  // ../contract/src/runs.ts
546
- import { z as z10 } from "zod";
610
+ import { z as z11 } from "zod";
547
611
 
548
612
  // ../contract/src/github.ts
549
- import { z as z8 } from "zod";
550
- var checksGlyphSchema = z8.enum(["passing", "failing", "pending"]).nullable();
551
- var githubItemSchema = z8.object({
552
- kind: z8.enum(["issue", "pr"]),
553
- number: z8.number(),
554
- title: z8.string(),
555
- author: z8.string(),
556
- createdAt: z8.string(),
557
- labels: z8.array(z8.string()),
558
- body: z8.string(),
559
- url: z8.string(),
560
- comments: z8.number(),
613
+ import { z as z9 } from "zod";
614
+ var checksGlyphSchema = z9.enum(["passing", "failing", "pending"]).nullable();
615
+ var githubItemSchema = z9.object({
616
+ kind: z9.enum(["issue", "pr"]),
617
+ number: z9.number(),
618
+ title: z9.string(),
619
+ author: z9.string(),
620
+ createdAt: z9.string(),
621
+ labels: z9.array(z9.string()),
622
+ body: z9.string(),
623
+ url: z9.string(),
624
+ comments: z9.number(),
561
625
  /** Issues only; absent on older servers. */
562
- assignees: z8.array(z8.string()).optional(),
563
- projectIds: z8.array(z8.string()).optional(),
626
+ assignees: z9.array(z9.string()).optional(),
627
+ projectIds: z9.array(z9.string()).optional(),
564
628
  /** PRs only. */
565
- isDraft: z8.boolean().optional(),
566
- additions: z8.number().optional(),
567
- deletions: z8.number().optional(),
629
+ isDraft: z9.boolean().optional(),
630
+ additions: z9.number().optional(),
631
+ deletions: z9.number().optional(),
568
632
  checks: checksGlyphSchema.optional()
569
633
  });
570
- var githubProjectSchema = z8.object({
571
- id: z8.string(),
572
- title: z8.string(),
573
- url: z8.string()
634
+ var githubProjectSchema = z9.object({
635
+ id: z9.string(),
636
+ title: z9.string(),
637
+ url: z9.string()
574
638
  });
575
- var githubDataSchema = z8.object({
576
- available: z8.boolean(),
639
+ var githubDataSchema = z9.object({
640
+ available: z9.boolean(),
577
641
  /** Why it is unavailable (`gh` missing, no remote, offline…). Never an error — a hint. */
578
- reason: z8.string().optional(),
642
+ reason: z9.string().optional(),
579
643
  /** owner/name, when known. */
580
- repo: z8.string().optional(),
581
- syncedAt: z8.string().optional(),
582
- issues: z8.array(githubItemSchema),
583
- prs: z8.array(githubItemSchema),
644
+ repo: z9.string().optional(),
645
+ syncedAt: z9.string().optional(),
646
+ issues: z9.array(githubItemSchema),
647
+ prs: z9.array(githubItemSchema),
584
648
  /** Repo-wide label name → 6-hex color (no `#`); lets chips tint like GitHub. Additive. */
585
- labelColors: z8.record(z8.string(), z8.string()).optional(),
586
- viewerLogin: z8.string().optional(),
649
+ labelColors: z9.record(z9.string(), z9.string()).optional(),
650
+ viewerLogin: z9.string().optional(),
587
651
  /** Repository-linked Projects v2. Absent when lookup is unavailable; [] means none. */
588
- projects: z8.array(githubProjectSchema).optional(),
589
- projectsReason: z8.string().optional()
652
+ projects: z9.array(githubProjectSchema).optional(),
653
+ projectsReason: z9.string().optional()
590
654
  });
591
- var githubChecksDataSchema = z8.discriminatedUnion("available", [
592
- z8.object({
593
- available: z8.literal(true),
594
- checks: z8.record(z8.number(), checksGlyphSchema)
655
+ var githubChecksDataSchema = z9.discriminatedUnion("available", [
656
+ z9.object({
657
+ available: z9.literal(true),
658
+ checks: z9.record(z9.number(), checksGlyphSchema)
595
659
  }),
596
- z8.object({
597
- available: z8.literal(false),
598
- reason: z8.string()
660
+ z9.object({
661
+ available: z9.literal(false),
662
+ reason: z9.string()
599
663
  })
600
664
  ]);
601
665
  var GITHUB_SEARCH_MAX = 50;
602
- var githubSearchQuerySchema = z8.object({
603
- kind: z8.enum(["issue", "pr"]),
604
- q: z8.string().trim().min(1).max(256),
605
- limit: z8.coerce.number().int().positive().max(GITHUB_SEARCH_MAX).optional()
666
+ var githubSearchQuerySchema = z9.object({
667
+ kind: z9.enum(["issue", "pr"]),
668
+ q: z9.string().trim().min(1).max(256),
669
+ limit: z9.coerce.number().int().positive().max(GITHUB_SEARCH_MAX).optional()
606
670
  });
607
- var githubSearchDataSchema = z8.object({
608
- available: z8.boolean(),
671
+ var githubSearchDataSchema = z9.object({
672
+ available: z9.boolean(),
609
673
  /** Membership is unknown when lookup fails; never substitute empty projectIds. */
610
- projectsReason: z8.string().optional(),
674
+ projectsReason: z9.string().optional(),
611
675
  /** Why it could not search (`gh` missing, no remote, rate-limited…). A hint, never an error. */
612
- reason: z8.string().optional(),
676
+ reason: z9.string().optional(),
613
677
  /** The same rows the list ships. `checks` is always `null` here — hydrated lazily through
614
678
  * `/github/checks`, exactly as list rows have been since #664. */
615
- items: z8.array(githubItemSchema),
679
+ items: z9.array(githubItemSchema),
616
680
  /** The hit list filled the server's cap; there may be more matches on the forge. */
617
- truncated: z8.boolean().optional(),
681
+ truncated: z9.boolean().optional(),
618
682
  /** Label name → 6-hex color for the labels these hits carry. A closed item often wears labels
619
683
  * no open one does, which the repo-wide map from the list call would not cover. Additive. */
620
- labelColors: z8.record(z8.string(), z8.string()).optional()
684
+ labelColors: z9.record(z9.string(), z9.string()).optional()
621
685
  });
622
- var referenceStatusSchema = z8.enum([
686
+ var referenceStatusSchema = z9.enum([
623
687
  "draft",
624
688
  "review-required",
625
689
  "changes-requested",
@@ -632,13 +696,13 @@ var referenceStatusSchema = z8.enum([
632
696
  "completed",
633
697
  "not-planned"
634
698
  ]);
635
- var recheckAfterMsSchema = z8.number().nullable();
699
+ var recheckAfterMsSchema = z9.number().nullable();
636
700
  var REFERENCE_STATUS_MAX = 100;
637
- var githubRefStatusDataSchema = z8.discriminatedUnion("available", [
638
- z8.object({
639
- available: z8.literal(true),
640
- prs: z8.record(z8.number(), referenceStatusSchema),
641
- issues: z8.record(z8.number(), referenceStatusSchema),
701
+ var githubRefStatusDataSchema = z9.discriminatedUnion("available", [
702
+ z9.object({
703
+ available: z9.literal(true),
704
+ prs: z9.record(z9.number(), referenceStatusSchema),
705
+ issues: z9.record(z9.number(), referenceStatusSchema),
642
706
  /**
643
707
  * The pull request numbers that do NOT merge cleanly into their base right now.
644
708
  *
@@ -658,28 +722,28 @@ var githubRefStatusDataSchema = z8.discriminatedUnion("available", [
658
722
  * ever named — GitHub reports `UNKNOWN` for merged and closed ones, and `UNKNOWN` (which is
659
723
  * also what it answers while it is still computing) is never listed.
660
724
  */
661
- conflicts: z8.array(z8.number()).optional(),
725
+ conflicts: z9.array(z9.number()).optional(),
662
726
  recheckAfterMs: recheckAfterMsSchema
663
727
  }),
664
- z8.object({
665
- available: z8.literal(false),
666
- reason: z8.string(),
728
+ z9.object({
729
+ available: z9.literal(false),
730
+ reason: z9.string(),
667
731
  recheckAfterMs: recheckAfterMsSchema
668
732
  })
669
733
  ]);
670
- var githubCommentSchema = z8.object({
671
- id: z8.number(),
734
+ var githubCommentSchema = z9.object({
735
+ id: z9.number(),
672
736
  /** Author login, `'?'` fallback when gh omits the user. */
673
- author: z8.string(),
674
- avatarUrl: z8.string().optional(),
675
- createdAt: z8.string(),
676
- body: z8.string(),
677
- kind: z8.enum(["comment", "review"]),
737
+ author: z9.string(),
738
+ avatarUrl: z9.string().optional(),
739
+ createdAt: z9.string(),
740
+ body: z9.string(),
741
+ kind: z9.enum(["comment", "review"]),
678
742
  /** Reviews only — drives the state chip. */
679
- reviewState: z8.enum(["approved", "changes_requested", "commented", "dismissed"]).optional(),
680
- url: z8.string()
743
+ reviewState: z9.enum(["approved", "changes_requested", "commented", "dismissed"]).optional(),
744
+ url: z9.string()
681
745
  });
682
- var githubTimelineEventKindSchema = z8.enum([
746
+ var githubTimelineEventKindSchema = z9.enum([
683
747
  "committed",
684
748
  "labeled",
685
749
  "unlabeled",
@@ -692,134 +756,134 @@ var githubTimelineEventKindSchema = z8.enum([
692
756
  "cross-referenced",
693
757
  "renamed"
694
758
  ]);
695
- var githubTimelineEventSchema = z8.object({
696
- id: z8.string(),
759
+ var githubTimelineEventSchema = z9.object({
760
+ id: z9.string(),
697
761
  kind: githubTimelineEventKindSchema,
698
762
  /** Login — or the git author name for `committed`, which carries no GitHub actor. */
699
- actor: z8.string(),
763
+ actor: z9.string(),
700
764
  /** Absent for `committed`. */
701
- avatarUrl: z8.string().optional(),
702
- createdAt: z8.string(),
703
- url: z8.string().optional(),
765
+ avatarUrl: z9.string().optional(),
766
+ createdAt: z9.string(),
767
+ url: z9.string().optional(),
704
768
  /** `committed` — full 40-char SHA. */
705
- sha: z8.string().optional(),
769
+ sha: z9.string().optional(),
706
770
  /** `committed` — first line, capped at 120 chars. */
707
- message: z8.string().optional(),
771
+ message: z9.string().optional(),
708
772
  /** `committed` — **absent** (lookup failed/skipped) and **`null`** (no CI configured) both
709
773
  * render no glyph, but stay distinct values. */
710
774
  checks: checksGlyphSchema.optional(),
711
- label: z8.object({ name: z8.string(), color: z8.string().optional() }).optional(),
775
+ label: z9.object({ name: z9.string(), color: z9.string().optional() }).optional(),
712
776
  /** `assigned`/`unassigned` login, or the new title for `renamed`. */
713
- subject: z8.string().optional(),
714
- refNumber: z8.number().optional(),
715
- refTitle: z8.string().optional(),
716
- refIsPr: z8.boolean().optional()
717
- });
718
- var githubCommentsDataSchema = z8.object({
719
- available: z8.boolean(),
720
- reason: z8.string().optional(),
777
+ subject: z9.string().optional(),
778
+ refNumber: z9.number().optional(),
779
+ refTitle: z9.string().optional(),
780
+ refIsPr: z9.boolean().optional()
781
+ });
782
+ var githubCommentsDataSchema = z9.object({
783
+ available: z9.boolean(),
784
+ reason: z9.string().optional(),
721
785
  /** Chronological, oldest first. */
722
- comments: z8.array(githubCommentSchema),
786
+ comments: z9.array(githubCommentSchema),
723
787
  /** True when either stream hit its cap, or the timeline fetch stopped short. */
724
- truncated: z8.boolean().optional(),
788
+ truncated: z9.boolean().optional(),
725
789
  /** Timeline events (#525) — additive; absent when the server degraded to the legacy
726
790
  * comments-only fetch. Capped independently of `comments`. */
727
- events: z8.array(githubTimelineEventSchema).optional()
728
- });
729
- var githubMergeMethodSchema = z8.enum(["merge", "squash", "rebase"]);
730
- var githubPrCheckSchema = z8.object({
731
- name: z8.string(),
732
- state: z8.enum(["passing", "failing", "pending", "unknown"]),
733
- required: z8.boolean().nullable(),
734
- url: z8.string().optional()
735
- });
736
- var githubPrMergeStateSchema = z8.object({
737
- number: z8.number(),
738
- title: z8.string(),
739
- url: z8.string(),
740
- state: z8.enum(["open", "closed", "merged"]),
741
- isDraft: z8.boolean(),
742
- headRef: z8.string(),
743
- baseRef: z8.string(),
744
- headSha: z8.string(),
745
- mergeable: z8.enum(["mergeable", "conflicting", "unknown"]),
746
- reviewDecision: z8.enum(["approved", "changes-requested", "review-required", "unknown"]),
747
- checks: z8.array(githubPrCheckSchema),
748
- methods: z8.array(githubMergeMethodSchema),
791
+ events: z9.array(githubTimelineEventSchema).optional()
792
+ });
793
+ var githubMergeMethodSchema = z9.enum(["merge", "squash", "rebase"]);
794
+ var githubPrCheckSchema = z9.object({
795
+ name: z9.string(),
796
+ state: z9.enum(["passing", "failing", "pending", "unknown"]),
797
+ required: z9.boolean().nullable(),
798
+ url: z9.string().optional()
799
+ });
800
+ var githubPrMergeStateSchema = z9.object({
801
+ number: z9.number(),
802
+ title: z9.string(),
803
+ url: z9.string(),
804
+ state: z9.enum(["open", "closed", "merged"]),
805
+ isDraft: z9.boolean(),
806
+ headRef: z9.string(),
807
+ baseRef: z9.string(),
808
+ headSha: z9.string(),
809
+ mergeable: z9.enum(["mergeable", "conflicting", "unknown"]),
810
+ reviewDecision: z9.enum(["approved", "changes-requested", "review-required", "unknown"]),
811
+ checks: z9.array(githubPrCheckSchema),
812
+ methods: z9.array(githubMergeMethodSchema),
749
813
  defaultMethod: githubMergeMethodSchema.nullable(),
750
- eligibility: z8.enum(["ready", "blocked", "pending", "unauthorized", "terminal", "unknown"]),
751
- blockers: z8.array(z8.object({ code: z8.string(), message: z8.string() })),
752
- canMerge: z8.boolean(),
753
- canOverride: z8.boolean()
754
- });
755
- var githubPrMergeStateResponseSchema = z8.discriminatedUnion("available", [
756
- z8.object({ available: z8.literal(true), mergeState: githubPrMergeStateSchema }),
757
- z8.object({ available: z8.literal(false), reason: z8.string() })
814
+ eligibility: z9.enum(["ready", "blocked", "pending", "unauthorized", "terminal", "unknown"]),
815
+ blockers: z9.array(z9.object({ code: z9.string(), message: z9.string() })),
816
+ canMerge: z9.boolean(),
817
+ canOverride: z9.boolean()
818
+ });
819
+ var githubPrMergeStateResponseSchema = z9.discriminatedUnion("available", [
820
+ z9.object({ available: z9.literal(true), mergeState: githubPrMergeStateSchema }),
821
+ z9.object({ available: z9.literal(false), reason: z9.string() })
758
822
  ]);
759
- var githubMergeResponseSchema = z8.object({
760
- merged: z8.literal(true),
761
- number: z8.number(),
762
- url: z8.string(),
823
+ var githubMergeResponseSchema = z9.object({
824
+ merged: z9.literal(true),
825
+ number: z9.number(),
826
+ url: z9.string(),
763
827
  method: githubMergeMethodSchema,
764
- mergeCommitSha: z8.string().optional()
765
- });
766
- var githubPrChangeSchema = z8.object({
767
- path: z8.string(),
768
- previousPath: z8.string().optional(),
769
- status: z8.enum(["added", "modified", "removed", "renamed", "copied", "changed"]),
770
- additions: z8.number(),
771
- deletions: z8.number(),
772
- patch: z8.string().optional(),
773
- patchUnavailableReason: z8.enum(["binary", "too-large", "not-provided"]).optional(),
774
- truncated: z8.boolean().optional()
775
- });
776
- var githubPrChangesDataSchema = z8.discriminatedUnion("available", [
777
- z8.object({
778
- available: z8.literal(true),
779
- number: z8.number(),
780
- headSha: z8.string(),
781
- files: z8.array(githubPrChangeSchema),
782
- additions: z8.number(),
783
- deletions: z8.number(),
784
- truncated: z8.boolean(),
828
+ mergeCommitSha: z9.string().optional()
829
+ });
830
+ var githubPrChangeSchema = z9.object({
831
+ path: z9.string(),
832
+ previousPath: z9.string().optional(),
833
+ status: z9.enum(["added", "modified", "removed", "renamed", "copied", "changed"]),
834
+ additions: z9.number(),
835
+ deletions: z9.number(),
836
+ patch: z9.string().optional(),
837
+ patchUnavailableReason: z9.enum(["binary", "too-large", "not-provided"]).optional(),
838
+ truncated: z9.boolean().optional()
839
+ });
840
+ var githubPrChangesDataSchema = z9.discriminatedUnion("available", [
841
+ z9.object({
842
+ available: z9.literal(true),
843
+ number: z9.number(),
844
+ headSha: z9.string(),
845
+ files: z9.array(githubPrChangeSchema),
846
+ additions: z9.number(),
847
+ deletions: z9.number(),
848
+ truncated: z9.boolean(),
785
849
  /** Present when the payload is complete but partial in some other way (a capped patch). */
786
- reason: z8.string().optional()
850
+ reason: z9.string().optional()
787
851
  }),
788
- z8.object({ available: z8.literal(false), reason: z8.string() })
852
+ z9.object({ available: z9.literal(false), reason: z9.string() })
789
853
  ]);
790
854
 
791
855
  // ../contract/src/workflows.ts
792
- import { z as z9 } from "zod";
793
- var workflowStepDefSchema = z9.object({
794
- id: z9.string().min(1),
795
- name: z9.string().optional(),
856
+ import { z as z10 } from "zod";
857
+ var workflowStepDefSchema = z10.object({
858
+ id: z10.string().min(1),
859
+ name: z10.string().optional(),
796
860
  // agent step
797
- prompt: z9.string().optional(),
798
- skill: z9.string().optional(),
799
- model: z9.string().optional(),
800
- effort: z9.string().max(32).optional(),
861
+ prompt: z10.string().optional(),
862
+ skill: z10.string().optional(),
863
+ model: z10.string().optional(),
864
+ effort: z10.string().max(32).optional(),
801
865
  /** Per-step agent backend override (falls back to the task / config default). */
802
866
  runner: runnerSchema.optional(),
803
867
  /** Agent account id for this step (spec 2026-07-29-agent-profiles); resolved per step for owned workers (#452). */
804
- agentProfile: z9.string().min(1).max(64).optional(),
805
- allowedTools: z9.array(z9.string()).optional(),
806
- bashAllowlist: z9.array(z9.string()).optional(),
868
+ agentProfile: z10.string().min(1).max(64).optional(),
869
+ allowedTools: z10.array(z10.string()).optional(),
870
+ bashAllowlist: z10.array(z10.string()).optional(),
807
871
  // check step
808
- command: z9.string().optional(),
809
- onFail: z9.object({
810
- retry: z9.string().min(1),
811
- max: z9.number().int().positive().default(2)
872
+ command: z10.string().optional(),
873
+ onFail: z10.object({
874
+ retry: z10.string().min(1),
875
+ max: z10.number().int().positive().default(2)
812
876
  }).optional()
813
877
  }).refine((s) => Boolean(s.command) !== Boolean(s.prompt ?? s.skill), {
814
878
  message: "a step is either an agent step (prompt/skill) or a check step (command), not both"
815
879
  });
816
- var workflowDefSchema = z9.object({
817
- name: z9.string(),
818
- description: z9.string().optional(),
819
- steps: z9.array(workflowStepDefSchema),
820
- source: z9.enum(["built-in", "file"]),
880
+ var workflowDefSchema = z10.object({
881
+ name: z10.string(),
882
+ description: z10.string().optional(),
883
+ steps: z10.array(workflowStepDefSchema),
884
+ source: z10.enum(["built-in", "file"]),
821
885
  /** Absent on built-ins — which is exactly what makes them undeletable. */
822
- path: z9.string().optional()
886
+ path: z10.string().optional()
823
887
  });
824
888
  function providersRequiredByWorkflow(workflow, fallback) {
825
889
  const required = /* @__PURE__ */ new Set();
@@ -828,46 +892,46 @@ function providersRequiredByWorkflow(workflow, fallback) {
828
892
  }
829
893
  return runnerSchema.options.filter((provider) => required.has(provider));
830
894
  }
831
- var workflowLoadIssueSchema = z9.object({
832
- path: z9.string(),
833
- message: z9.string()
834
- });
835
- var workflowsResponseSchema = z9.object({
836
- workflows: z9.array(workflowDefSchema),
837
- issues: z9.array(workflowLoadIssueSchema)
838
- });
839
- var saveWorkflowInputSchema = z9.object({
840
- name: z9.string().trim().min(1).max(80),
841
- description: z9.string().max(2e3, "must be at most 2000 characters").optional(),
842
- steps: z9.array(workflowStepDefSchema).min(1).max(8).optional(),
843
- skills: z9.array(z9.string().trim().min(1)).min(1).max(8).optional(),
844
- overwrite: z9.boolean().optional()
895
+ var workflowLoadIssueSchema = z10.object({
896
+ path: z10.string(),
897
+ message: z10.string()
898
+ });
899
+ var workflowsResponseSchema = z10.object({
900
+ workflows: z10.array(workflowDefSchema),
901
+ issues: z10.array(workflowLoadIssueSchema)
902
+ });
903
+ var saveWorkflowInputSchema = z10.object({
904
+ name: z10.string().trim().min(1).max(80),
905
+ description: z10.string().max(2e3, "must be at most 2000 characters").optional(),
906
+ steps: z10.array(workflowStepDefSchema).min(1).max(8).optional(),
907
+ skills: z10.array(z10.string().trim().min(1)).min(1).max(8).optional(),
908
+ overwrite: z10.boolean().optional()
845
909
  }).refine((b) => Boolean(b.steps) !== Boolean(b.skills), {
846
910
  message: 'provide either "steps" or "skills", not both'
847
911
  });
848
- var saveWorkflowResponseSchema = z9.object({
849
- path: z9.string(),
850
- name: z9.string()
912
+ var saveWorkflowResponseSchema = z10.object({
913
+ path: z10.string(),
914
+ name: z10.string()
851
915
  });
852
- var parsedWorkflowSchema = z9.object({
853
- name: z9.string(),
854
- description: z9.string().optional(),
855
- steps: z9.array(workflowStepDefSchema)
916
+ var parsedWorkflowSchema = z10.object({
917
+ name: z10.string(),
918
+ description: z10.string().optional(),
919
+ steps: z10.array(workflowStepDefSchema)
856
920
  });
857
- var deleteWorkflowResponseSchema = z9.object({
858
- ok: z9.literal(true),
859
- path: z9.string()
921
+ var deleteWorkflowResponseSchema = z10.object({
922
+ ok: z10.literal(true),
923
+ path: z10.string()
860
924
  });
861
- var planResponseSchema = z9.object({
925
+ var planResponseSchema = z10.object({
862
926
  /** The kebab-case workflow title the planner proposed. Absent on the degraded fallback. */
863
- name: z9.string().optional(),
864
- steps: z9.array(workflowStepDefSchema),
865
- rationale: z9.string(),
866
- fallback: z9.boolean()
927
+ name: z10.string().optional(),
928
+ steps: z10.array(workflowStepDefSchema),
929
+ rationale: z10.string(),
930
+ fallback: z10.boolean()
867
931
  });
868
932
 
869
933
  // ../contract/src/runs.ts
870
- var runStatusSchema = z10.enum([
934
+ var runStatusSchema = z11.enum([
871
935
  "queued",
872
936
  "running",
873
937
  "waiting",
@@ -876,8 +940,8 @@ var runStatusSchema = z10.enum([
876
940
  "failed",
877
941
  "cancelled"
878
942
  ]);
879
- var runActivitySchema = z10.enum(["monitoring"]);
880
- var stepStatusSchema = z10.enum([
943
+ var runActivitySchema = z11.enum(["monitoring"]);
944
+ var stepStatusSchema = z11.enum([
881
945
  "pending",
882
946
  "running",
883
947
  "waiting",
@@ -887,16 +951,16 @@ var stepStatusSchema = z10.enum([
887
951
  "cancelled",
888
952
  "skipped"
889
953
  ]);
890
- var usageCounterSchema = z10.number().finite().nonnegative();
891
- var stepStateSchema = z10.object({
892
- id: z10.string(),
893
- name: z10.string(),
894
- kind: z10.enum(["agent", "check"]),
954
+ var usageCounterSchema = z11.number().finite().nonnegative();
955
+ var stepStateSchema = z11.object({
956
+ id: z11.string(),
957
+ name: z11.string(),
958
+ kind: z11.enum(["agent", "check"]),
895
959
  status: stepStatusSchema,
896
- iterations: z10.number(),
960
+ iterations: z11.number(),
897
961
  /** Durable count of onFail retry loops consumed by this check. */
898
- retriesUsed: z10.number().int().nonnegative().optional(),
899
- tokensUsed: z10.number(),
962
+ retriesUsed: z11.number().int().nonnegative().optional(),
963
+ tokensUsed: z11.number(),
900
964
  inputTokens: usageCounterSchema.optional(),
901
965
  outputTokens: usageCounterSchema.optional(),
902
966
  usageInvocationsStarted: usageCounterSchema.optional(),
@@ -904,99 +968,99 @@ var stepStateSchema = z10.object({
904
968
  usageTurnsStarted: usageCounterSchema.optional(),
905
969
  usageTurnsRecorded: usageCounterSchema.optional(),
906
970
  usageInvocationEpoch: usageCounterSchema.optional(),
907
- startedAt: z10.string().optional(),
908
- finishedAt: z10.string().optional(),
909
- error: z10.string().optional(),
971
+ startedAt: z11.string().optional(),
972
+ finishedAt: z11.string().optional(),
973
+ error: z11.string().optional(),
910
974
  /** Latest agent session id — `claude --resume <id>` and friends. */
911
- sessionId: z10.string().optional(),
975
+ sessionId: z11.string().optional(),
912
976
  /** Backend that owns `sessionId`; absent on records written before backend affinity. */
913
977
  backend: runnerSchema.optional(),
914
978
  /** Agent account (spec 2026-07-29-agent-profiles) that owns `sessionId` — `default`, or a
915
979
  * stored profile id. The two are a PAIR: a session id only resolves inside the config dir
916
980
  * that created it, so resume and Continue read this rather than the project's current
917
981
  * selection. Absent on records written before accounts existed. */
918
- profileId: z10.string().optional(),
919
- costUsd: z10.number().optional(),
982
+ profileId: z11.string().optional(),
983
+ costUsd: z11.number().optional(),
920
984
  /** Explicit provenance for engine-generated continuation steps. */
921
- synthetic: z10.literal("continuation").optional()
985
+ synthetic: z11.literal("continuation").optional()
922
986
  });
923
- var diffStatSchema = z10.object({
924
- adds: z10.number(),
925
- dels: z10.number(),
926
- files: z10.number(),
987
+ var diffStatSchema = z11.object({
988
+ adds: z11.number(),
989
+ dels: z11.number(),
990
+ files: z11.number(),
927
991
  /** Additive since #751, and present ONLY when true: the numbers were measured against a
928
992
  * branch the agent checked out into the task's worktree, as the run found it, because the
929
993
  * worktree's HEAD had been repointed off the task's own branch (every review/QA run does
930
994
  * this) and the merge-base anchor would otherwise have reported that branch's entire diff
931
995
  * as this task's. Absent on every normal run and on every record written before #751 — a
932
996
  * consumer that ignores it sees exactly the old shape. */
933
- repointed: z10.boolean().optional()
997
+ repointed: z11.boolean().optional()
934
998
  });
935
- var queuedMessageSchema = z10.object({
936
- id: z10.string(),
937
- text: z10.string(),
999
+ var queuedMessageSchema = z11.object({
1000
+ id: z11.string(),
1001
+ text: z11.string(),
938
1002
  /** `/api/v1/runs/:id/images/…` URLs — attachments are persisted, never inlined. Images and
939
1003
  * files share this one list; read `isImageAttachmentName` on the file name to tell them apart. */
940
- images: z10.array(z10.string()).optional(),
941
- createdAt: z10.string()
1004
+ images: z11.array(z11.string()).optional(),
1005
+ createdAt: z11.string()
942
1006
  });
943
1007
  var continuationMessageSchema = queuedMessageSchema.extend({
944
- origin: z10.enum(["human", "lifecycle"]).optional(),
1008
+ origin: z11.enum(["human", "lifecycle"]).optional(),
945
1009
  /** An attributed parent message used as the opening prompt, never a human answer. */
946
- agentInputId: z10.uuid().optional()
1010
+ agentInputId: z11.uuid().optional()
947
1011
  });
948
- var processUsageSchema = z10.object({
1012
+ var processUsageSchema = z11.object({
949
1013
  /** Sum of `%cpu` across the tree — can exceed 100 on multi-core work. */
950
- cpuPct: z10.number(),
951
- rssBytes: z10.number(),
952
- procCount: z10.number()
1014
+ cpuPct: z11.number(),
1015
+ rssBytes: z11.number(),
1016
+ procCount: z11.number()
953
1017
  });
954
- var runRecordSchema = z10.object({
955
- id: z10.string(),
956
- title: z10.string(),
1018
+ var runRecordSchema = z11.object({
1019
+ id: z11.string(),
1020
+ title: z11.string(),
957
1021
  /** Display title (#389): auto-derived from the first agent turn, or the user's inline edit
958
1022
  * (`PATCH /runs/:id` sets it together with `title`). Show `titleSummary ?? title`. */
959
- titleSummary: z10.string().optional(),
1023
+ titleSummary: z11.string().optional(),
960
1024
  /** Refreshed on every turn-end; absent until the first turn ends (and on worktree-less runs). */
961
1025
  diffStat: diffStatSchema.optional(),
962
- workflow: z10.string(),
963
- task: z10.string(),
1026
+ workflow: z11.string(),
1027
+ task: z11.string(),
964
1028
  /** Prompt messages stacked onto the run while it waited for a free agent slot (#472). Folded
965
1029
  * into the prompt at dequeue — never delivered as their own turns. Absent on pre-#472 runs. */
966
- queuedMessages: z10.array(queuedMessageSchema).optional(),
1030
+ queuedMessages: z11.array(queuedMessageSchema).optional(),
967
1031
  /** Stop was accepted; execution termination is still pending. */
968
- stopping: z10.boolean().optional(),
1032
+ stopping: z11.boolean().optional(),
969
1033
  /** Opening Continue message, retained until its first completed turn for crash recovery. */
970
1034
  continuationMessage: continuationMessageSchema.optional(),
971
1035
  /** The last turn carried a malformed explicit structured question. */
972
- invalidAsk: z10.boolean().optional(),
1036
+ invalidAsk: z11.boolean().optional(),
973
1037
  /** Owned-run authority; absence is legacy, invalid is explicitly quarantined. */
974
1038
  delegation: delegationStateSchema.optional(),
975
1039
  /** Durable non-human input, kept separate from human prompt/answer queues. */
976
- agentInputs: z10.array(agentInputSchema).optional(),
1040
+ agentInputs: z11.array(agentInputSchema).optional(),
977
1041
  ciWait: ciWaitSchema.optional(),
978
1042
  lastCiWait: ciWaitSchema.optional(),
979
1043
  /** Retained recovery observation when previous CI metadata cannot be trusted. */
980
- lastCiWaitError: z10.string().max(256).optional(),
1044
+ lastCiWaitError: z11.string().max(256).optional(),
981
1045
  /** URLs of images and document attachments on the initial task prompt; branch on isImageAttachmentName. */
982
- taskImages: z10.array(z10.string()).optional(),
983
- model: z10.string().optional(),
1046
+ taskImages: z11.array(z11.string()).optional(),
1047
+ model: z11.string().optional(),
984
1048
  /** Reasoning-effort pin (#45). Canonical `low`/`medium`/`high`/`xhigh`/`max`.
985
1049
  * Absent = harness default. Additive: pre-#45 records omit it and still parse. */
986
- effort: z10.string().max(32).optional(),
1050
+ effort: z11.string().max(32).optional(),
987
1051
  /** Normalized provider/model identity used for attribution and reproducible replay. */
988
- modelIdentity: z10.string().optional(),
1052
+ modelIdentity: z11.string().optional(),
989
1053
  runner: runnerSchema.optional(),
990
1054
  /** The composer's per-task agent account (spec 2026-07-29-agent-profiles), applying to steps
991
1055
  * on `runner`. Absent = the run follows the project's own selection. */
992
- agentProfile: z10.string().optional(),
1056
+ agentProfile: z11.string().optional(),
993
1057
  /** Echo of the extra system prompt the run used (POST override or config default). */
994
- systemPrompt: z10.string().optional(),
1058
+ systemPrompt: z11.string().optional(),
995
1059
  /** false when the run deliberately disabled follow-up todo generation. Absent means enabled. */
996
- generateFollowups: z10.boolean().optional(),
1060
+ generateFollowups: z11.boolean().optional(),
997
1061
  /** Autonomous mode (#autonomous): the run never parks at `waiting` or the terminal `review`
998
1062
  * gate. Absent = falsy = not autonomous. */
999
- autonomous: z10.boolean().optional(),
1063
+ autonomous: z11.boolean().optional(),
1000
1064
  /**
1001
1065
  * Provenance for a task a project GitHub automation launched (#694). Absent on every ordinary
1002
1066
  * run, which is what makes it additive — the cockpit shows the "from automation" link only when
@@ -1006,12 +1070,12 @@ var runRecordSchema = z10.object({
1006
1070
  * launching definition matched, recorded on the run for the audit trail, and `src/runs/store.ts`
1007
1071
  * persists it as free text so an older cezar can still read a record written by a newer one.
1008
1072
  */
1009
- automation: z10.object({
1010
- automationId: z10.string(),
1011
- automationRevision: z10.number(),
1012
- receiptId: z10.string(),
1013
- event: z10.string(),
1014
- githubUrl: z10.string()
1073
+ automation: z11.object({
1074
+ automationId: z11.string(),
1075
+ automationRevision: z11.number(),
1076
+ receiptId: z11.string(),
1077
+ event: z11.string(),
1078
+ githubUrl: z11.string()
1015
1079
  }).optional(),
1016
1080
  status: runStatusSchema,
1017
1081
  /** `monitoring` while `status === 'running'` and the agent is working on downstream work.
@@ -1019,84 +1083,88 @@ var runRecordSchema = z10.object({
1019
1083
  activity: runActivitySchema.optional(),
1020
1084
  /** Derived from valid human questions and matching delivery receipts in durable history.
1021
1085
  * List attention only; never authorization to deliver an answer or wake a worker. */
1022
- hasPendingHumanAsk: z10.boolean().optional(),
1086
+ hasPendingHumanAsk: z11.boolean().optional(),
1023
1087
  /** Exact ISO-8601 deadline for the next automatic monitoring check. */
1024
- monitoringWakeAt: z10.string().optional(),
1088
+ monitoringWakeAt: z11.string().optional(),
1025
1089
  /** The current live monitoring epoch exhausted its 40 automatic checks. */
1026
- monitoringWakeCapReached: z10.boolean().optional(),
1090
+ monitoringWakeCapReached: z11.boolean().optional(),
1027
1091
  /** Exact ISO-8601 instant this run resumes itself after a provider usage limit stopped it
1028
1092
  * (spec 2026-08-03-auto-resume-after-usage-limit). Present only on a `failed` run with a
1029
1093
  * pending automatic resume — its absence is what "no resume is scheduled" looks like. */
1030
- autoResumeAt: z10.string().optional(),
1094
+ autoResumeAt: z11.string().optional(),
1031
1095
  /** Consecutive automatic resumes since the last human turn, against the safety cap. */
1032
- autoResumeAttempts: z10.number().optional(),
1033
- createdAt: z10.string(),
1034
- startedAt: z10.string().optional(),
1035
- finishedAt: z10.string().optional(),
1036
- tokensUsed: z10.number(),
1096
+ autoResumeAttempts: z11.number().optional(),
1097
+ createdAt: z11.string(),
1098
+ startedAt: z11.string().optional(),
1099
+ finishedAt: z11.string().optional(),
1100
+ tokensUsed: z11.number(),
1037
1101
  inputTokens: usageCounterSchema.optional(),
1038
1102
  outputTokens: usageCounterSchema.optional(),
1039
- costUsd: z10.number().optional(),
1040
- pullRequestUrl: z10.string().optional(),
1103
+ costUsd: z11.number().optional(),
1104
+ pullRequestUrl: z11.string().optional(),
1041
1105
  /** The PR this task is ABOUT (#407) — auto-discovered from conversation references. Display
1042
1106
  * tier only: `pullRequestUrl` (the PR this task CREATED) wins, and the action gates ignore it. */
1043
- referencedPullRequestUrl: z10.string().optional(),
1107
+ referencedPullRequestUrl: z11.string().optional(),
1044
1108
  /** The PR/issue number this task is ABOUT (task auto-naming spec) — display tier only. */
1045
- prNumber: z10.number().optional(),
1046
- issueNumber: z10.number().optional(),
1109
+ prNumber: z11.number().optional(),
1110
+ issueNumber: z11.number().optional(),
1047
1111
  /** Server-side provenance: referenced-issue discovery currently owns `issueNumber`. */
1048
- referencedIssueNumberSeeded: z10.boolean().optional(),
1112
+ referencedIssueNumberSeeded: z11.boolean().optional(),
1049
1113
  /** 'user' = renamed via PATCH, never auto-overwritten; 'marker' = agent-declared via
1050
1114
  * CEZ:TITLE (spec 2026-07-18-task-ref-markers); 'auto' = namer-owned. */
1051
- titleOrigin: z10.enum(["user", "auto", "marker"]).optional(),
1115
+ titleOrigin: z11.enum(["user", "auto", "marker"]).optional(),
1052
1116
  /** References the agent declared via CEZ:PR/CEZ:ISSUE markers — authoritative over the namer
1053
1117
  * for the matching kind. */
1054
- markerRefs: z10.object({ pr: z10.number().optional(), issue: z10.number().optional() }).optional(),
1118
+ markerRefs: z11.object({ pr: z11.number().optional(), issue: z11.number().optional() }).optional(),
1055
1119
  /** The referenced tier's working set (distinct PR URLs spotted, capped server-side). */
1056
- referencedPrCandidates: z10.array(z10.string()).optional(),
1120
+ referencedPrCandidates: z11.array(z11.string()).optional(),
1057
1121
  /** The issue this task is ABOUT (spec 2026-07-21-report-ref-discovery). Display-only. */
1058
- referencedIssueUrl: z10.string().optional(),
1122
+ referencedIssueUrl: z11.string().optional(),
1059
1123
  /** The referenced-issue working set, persisted like `referencedPrCandidates`. Capped. */
1060
- referencedIssueCandidates: z10.array(z10.string()).optional(),
1124
+ referencedIssueCandidates: z11.array(z11.string()).optional(),
1061
1125
  /** Explicit execution policy. `false` means the run intentionally uses the repo root;
1062
1126
  * absent on older runs and for the default isolated-worktree mode. */
1063
- worktree: z10.literal(false).optional(),
1127
+ worktree: z11.literal(false).optional(),
1064
1128
  /** Absent for in-place runs and after an isolated worktree is removed. */
1065
- worktreePath: z10.string().optional(),
1066
- branch: z10.string().optional(),
1129
+ worktreePath: z11.string().optional(),
1130
+ branch: z11.string().optional(),
1067
1131
  /** Stable baseline for session git views: a worktree's fork ref, or an in-place run's starting commit. */
1068
- baseBranch: z10.string().optional(),
1132
+ baseBranch: z11.string().optional(),
1069
1133
  /** Set when count-based retention (#483) reclaimed the worktree DIRECTORY (the branch is
1070
1134
  * kept): the dir is gone but recoverable. */
1071
- worktreeReclaimedAt: z10.string().optional(),
1135
+ worktreeReclaimedAt: z11.string().optional(),
1072
1136
  /** Parallel variants (spec 010): runs sharing a groupId are one group. */
1073
- groupId: z10.string().optional(),
1137
+ groupId: z11.string().optional(),
1074
1138
  /** Variant letter within the group — 'A' | 'B' | 'C'. */
1075
- variant: z10.string().optional(),
1076
- peakRssBytes: z10.number().optional(),
1077
- peakProcCount: z10.number().optional(),
1078
- archived: z10.boolean(),
1079
- archivedAt: z10.string().optional(),
1139
+ variant: z11.string().optional(),
1140
+ /** Idempotent start (#504): the caller's request id and the hash of the start payload it
1141
+ * named (`src/runs/client-request.ts`). Absent on every run started without one. */
1142
+ clientRequestId: z11.string().optional(),
1143
+ clientRequestHash: z11.string().optional(),
1144
+ peakRssBytes: z11.number().optional(),
1145
+ peakProcCount: z11.number().optional(),
1146
+ archived: z11.boolean(),
1147
+ archivedAt: z11.string().optional(),
1080
1148
  /** Pinned to the top of this project's task list (#935) — the `Pinned` group above
1081
1149
  * `Needs you`. Optional, unlike `archived`: absent IS "not pinned", which is what every
1082
1150
  * record written before this carries, and the store never writes `false`. Archiving
1083
1151
  * clears it, because archiving is how a user resigns from a task. */
1084
- pinned: z10.boolean().optional(),
1152
+ pinned: z11.boolean().optional(),
1085
1153
  /** When the pin was set. Deliberately WRITE-ONLY today, like the `archivedAt` above it:
1086
1154
  * ordering inside `Pinned` uses the ordinary status/recency rules, so nothing reads this
1087
1155
  * yet. It is here because a field on a protected surface is far cheaper to add now than to
1088
1156
  * add later — "pinned oldest first" and "unpin what you pinned a month ago" both need it,
1089
1157
  * and neither can be reconstructed after the fact. */
1090
- pinnedAt: z10.string().optional(),
1158
+ pinnedAt: z11.string().optional(),
1091
1159
  /** Read receipt (#unread-done-items): ISO time the cockpit last opened this run's
1092
1160
  * thread. A finished (`done`/`failed`) run reads as *unread* until seen since it
1093
1161
  * finished — see `isUnread()` in the cockpit's `lib/read-state.ts`. Absent on old
1094
1162
  * runs, on any run not yet opened, and on one deliberately put back to unread via
1095
1163
  * `POST /runs/:id/unread` (#775) — all three count as unread. */
1096
- seenAt: z10.string().optional(),
1097
- currentStepId: z10.string().optional(),
1098
- error: z10.string().optional(),
1099
- steps: z10.array(stepStateSchema),
1164
+ seenAt: z11.string().optional(),
1165
+ currentStepId: z11.string().optional(),
1166
+ error: z11.string().optional(),
1167
+ steps: z11.array(stepStateSchema),
1100
1168
  /**
1101
1169
  * The persisted workflow definition, so a `queued` run survives a restart — including the ad-hoc
1102
1170
  * "(planned)" chains that exist nowhere else.
@@ -1114,48 +1182,48 @@ var runRecordSchema = z10.object({
1114
1182
  var apiRunSchema = runRecordSchema.extend({
1115
1183
  /** Read-only GET /runs/:id verdict: null permits Finish, a string explains refusal.
1116
1184
  * Absent on lists, stored records and mutation responses; absence is not permission. */
1117
- finishBlocked: z10.string().nullable().optional(),
1185
+ finishBlocked: z11.string().nullable().optional(),
1118
1186
  /** Server-resolved Cursor CLI command, including the configured executable. Never persisted. */
1119
- cliResumeCommand: z10.string().optional(),
1187
+ cliResumeCommand: z11.string().optional(),
1120
1188
  usage: processUsageSchema.optional()
1121
1189
  });
1122
- var runIndexEntrySchema = z10.object({
1190
+ var runIndexEntrySchema = z11.object({
1123
1191
  /** The registered project this run belongs to. Joins against `GET /projects`. */
1124
- projectId: z10.string(),
1125
- id: z10.string(),
1126
- title: z10.string(),
1127
- titleSummary: z10.string().optional(),
1128
- titleOrigin: z10.enum(["user", "auto", "marker"]).optional(),
1192
+ projectId: z11.string(),
1193
+ id: z11.string(),
1194
+ title: z11.string(),
1195
+ titleSummary: z11.string().optional(),
1196
+ titleOrigin: z11.enum(["user", "auto", "marker"]).optional(),
1129
1197
  status: runStatusSchema,
1130
1198
  activity: runActivitySchema.optional(),
1131
1199
  hasPendingHumanAsk: runRecordSchema.shape.hasPendingHumanAsk,
1132
1200
  /** Only the relationship role and wait phase used by list attention. */
1133
1201
  delegation: runDelegationSummarySchema.optional(),
1134
- createdAt: z10.string(),
1135
- finishedAt: z10.string().optional(),
1202
+ createdAt: z11.string(),
1203
+ finishedAt: z11.string().optional(),
1136
1204
  /** With `status`/`finishedAt`/`archived`, the four inputs `isUnread` reads — what lets the
1137
1205
  * palette lead with "finished while you weren't looking" across every project, not just the
1138
1206
  * one you happen to be standing in. */
1139
- seenAt: z10.string().optional(),
1207
+ seenAt: z11.string().optional(),
1140
1208
  /** Always present, like `RunRecord.archived`: absent would read as "not archived", and the
1141
1209
  * unread rule treats archiving as a stronger "done with this" than reading. */
1142
- archived: z10.boolean(),
1210
+ archived: z11.boolean(),
1143
1211
  /** A run parked by a provider usage limit is `failed` on the record with a resume booked
1144
1212
  * (spec 2026-08-03-auto-resume-after-usage-limit). Both `deriveAttention` and `isUnread` read
1145
1213
  * it, so without it here a cross-project row would show a red "failed" dot and land in
1146
1214
  * Recently finished for work that is simply waiting for its appointment. */
1147
- autoResumeAt: z10.string().optional(),
1215
+ autoResumeAt: z11.string().optional(),
1148
1216
  /** The workflow the run executes — the global Tasks page shows it in a column and groups by
1149
1217
  * it. Always present on the record (`RunRecord.workflow`), so required here; the display
1150
1218
  * refinement `workflowLabel` applies needs `steps[]`, which this row deliberately omits, so
1151
1219
  * a `(planned)` chain reads as itself here rather than as its first agent's name. */
1152
- workflow: z10.string(),
1220
+ workflow: z11.string(),
1153
1221
  /** The task's branch, when it has one — a column on the global page, and the one field that
1154
1222
  * makes a cross-project row identifiable at a glance without opening it. */
1155
- branch: z10.string().optional(),
1223
+ branch: z11.string().optional(),
1156
1224
  /** When the agent actually started, as opposed to when the task was created. The global page's
1157
1225
  * age column prefers it and falls back to `createdAt`, exactly as the per-project table does. */
1158
- startedAt: z10.string().optional(),
1226
+ startedAt: z11.string().optional(),
1159
1227
  /**
1160
1228
  * The six fields `taskReference()` (`web/src/lib/tasks-table.ts`) reads to decide a task's PR
1161
1229
  * or issue chip. Carried verbatim rather than pre-resolved into a `{kind, number, url}` on the
@@ -1167,20 +1235,20 @@ var runIndexEntrySchema = z10.object({
1167
1235
  * Six scalars is still the slim row this schema exists to keep: `steps[]` and `workflowDef`,
1168
1236
  * the expensive half, stay off it.
1169
1237
  */
1170
- pullRequestUrl: z10.string().optional(),
1171
- referencedPullRequestUrl: z10.string().optional(),
1172
- prNumber: z10.number().optional(),
1173
- issueNumber: z10.number().optional(),
1174
- referencedIssueUrl: z10.string().optional(),
1175
- markerRefs: z10.object({ pr: z10.number().optional(), issue: z10.number().optional() }).optional(),
1238
+ pullRequestUrl: z11.string().optional(),
1239
+ referencedPullRequestUrl: z11.string().optional(),
1240
+ prNumber: z11.number().optional(),
1241
+ issueNumber: z11.number().optional(),
1242
+ referencedIssueUrl: z11.string().optional(),
1243
+ markerRefs: z11.object({ pr: z11.number().optional(), issue: z11.number().optional() }).optional(),
1176
1244
  /** What the run has cost so far. Absent means nothing was recorded, which is NOT `$0` — the
1177
1245
  * cockpit prints an em dash rather than claiming a measurement that never happened. */
1178
- costUsd: z10.number().optional(),
1246
+ costUsd: z11.number().optional(),
1179
1247
  /** The persisted high-water marks a FINISHED run leaves behind. `usage` below stops existing
1180
1248
  * the moment the process tree does, so without these a finished row could say nothing at all
1181
1249
  * about what it took to run. */
1182
- peakRssBytes: z10.number().optional(),
1183
- peakProcCount: z10.number().optional(),
1250
+ peakRssBytes: z11.number().optional(),
1251
+ peakProcCount: z11.number().optional(),
1184
1252
  /**
1185
1253
  * The live CPU/RSS sample of this run's process tree, attached on the way out exactly as
1186
1254
  * `GET /runs` attaches it (`withUsage`) — never persisted.
@@ -1192,90 +1260,90 @@ var runIndexEntrySchema = z10.object({
1192
1260
  */
1193
1261
  usage: processUsageSchema.optional()
1194
1262
  });
1195
- var referenceStatusesByProjectSchema = z10.record(
1196
- z10.string(),
1197
- z10.object({
1198
- prs: z10.record(z10.number(), referenceStatusSchema),
1199
- issues: z10.record(z10.number(), referenceStatusSchema)
1263
+ var referenceStatusesByProjectSchema = z11.record(
1264
+ z11.string(),
1265
+ z11.object({
1266
+ prs: z11.record(z11.number(), referenceStatusSchema),
1267
+ issues: z11.record(z11.number(), referenceStatusSchema)
1200
1268
  })
1201
1269
  );
1202
- var runsIndexResponseSchema = z10.object({
1270
+ var runsIndexResponseSchema = z11.object({
1203
1271
  /** Newest first, across every registered project. Archived runs are included — `GET /runs`
1204
1272
  * carries them for the project you are standing in, and a finder that dropped them elsewhere
1205
1273
  * would make a task vanish the moment you left its project. */
1206
- runs: z10.array(runIndexEntrySchema),
1274
+ runs: z11.array(runIndexEntrySchema),
1207
1275
  /** Additive: absent statuses mean "nothing warm", never "nothing to show". */
1208
1276
  referenceStatuses: referenceStatusesByProjectSchema,
1209
1277
  /** The per-project cap that produced this list. */
1210
- perProjectLimit: z10.number(),
1278
+ perProjectLimit: z11.number(),
1211
1279
  /** Ids of the projects that had more runs than the cap allowed. */
1212
- truncated: z10.array(z10.string())
1280
+ truncated: z11.array(z11.string())
1213
1281
  });
1214
- var createRunResponseSchema = z10.union([
1282
+ var createRunResponseSchema = z11.union([
1215
1283
  runRecordSchema,
1216
- z10.object({ runs: z10.array(runRecordSchema) })
1284
+ z11.object({ runs: z11.array(runRecordSchema) })
1217
1285
  ]);
1218
- var cancelResponseSchema = z10.object({ cancelled: z10.boolean() });
1219
- var cancelAutoResumeResponseSchema = z10.object({ cancelled: z10.literal(true) });
1220
- var archiveFinishedResponseSchema = z10.object({ archived: z10.number() });
1221
- var markAllReadResponseSchema = z10.object({ read: z10.number() });
1222
- var deleteRunResponseSchema = z10.object({ deleted: z10.literal(true) });
1223
- var finishResponseSchema = z10.object({ finished: z10.literal(true) });
1224
- var continueResponseSchema = z10.object({ continued: z10.literal(true) });
1225
- var createPrResponseSchema = z10.object({
1226
- url: z10.string(),
1227
- dryRun: z10.boolean()
1228
- });
1229
- var messageResponseSchema = z10.union([
1230
- z10.object({ delivered: z10.literal(true) }),
1231
- z10.object({ queued: z10.literal(true), message: queuedMessageSchema }),
1232
- z10.object({ deferred: z10.literal(true) })
1286
+ var cancelResponseSchema = z11.object({ cancelled: z11.boolean() });
1287
+ var cancelAutoResumeResponseSchema = z11.object({ cancelled: z11.literal(true) });
1288
+ var archiveFinishedResponseSchema = z11.object({ archived: z11.number() });
1289
+ var markAllReadResponseSchema = z11.object({ read: z11.number() });
1290
+ var deleteRunResponseSchema = z11.object({ deleted: z11.literal(true) });
1291
+ var finishResponseSchema = z11.object({ finished: z11.literal(true) });
1292
+ var continueResponseSchema = z11.object({ continued: z11.literal(true) });
1293
+ var createPrResponseSchema = z11.object({
1294
+ url: z11.string(),
1295
+ dryRun: z11.boolean()
1296
+ });
1297
+ var messageResponseSchema = z11.union([
1298
+ z11.object({ delivered: z11.literal(true) }),
1299
+ z11.object({ queued: z11.literal(true), message: queuedMessageSchema }),
1300
+ z11.object({ deferred: z11.literal(true) })
1233
1301
  ]);
1234
- var editQueuedMessageResponseSchema = z10.object({ message: queuedMessageSchema });
1235
- var removeQueuedMessageResponseSchema = z10.object({ removed: z10.literal(true) });
1236
- var openInCliResponseSchema = z10.object({
1237
- opened: z10.literal(true),
1238
- command: z10.string()
1239
- });
1240
- var removeWorktreeResponseSchema = z10.object({ removed: z10.literal(true) });
1241
- var gitCommitResponseSchema = z10.object({
1242
- committed: z10.literal(true),
1243
- sha: z10.string()
1244
- });
1245
- var gitPushResponseSchema = z10.object({
1246
- pushed: z10.literal(true),
1247
- branch: z10.string(),
1248
- remote: z10.string(),
1249
- upstreamSet: z10.boolean()
1250
- });
1251
- var runCommitSchema = z10.object({
1252
- sha: z10.string(),
1253
- subject: z10.string(),
1254
- author: z10.string(),
1302
+ var editQueuedMessageResponseSchema = z11.object({ message: queuedMessageSchema });
1303
+ var removeQueuedMessageResponseSchema = z11.object({ removed: z11.literal(true) });
1304
+ var openInCliResponseSchema = z11.object({
1305
+ opened: z11.literal(true),
1306
+ command: z11.string()
1307
+ });
1308
+ var removeWorktreeResponseSchema = z11.object({ removed: z11.literal(true) });
1309
+ var gitCommitResponseSchema = z11.object({
1310
+ committed: z11.literal(true),
1311
+ sha: z11.string()
1312
+ });
1313
+ var gitPushResponseSchema = z11.object({
1314
+ pushed: z11.literal(true),
1315
+ branch: z11.string(),
1316
+ remote: z11.string(),
1317
+ upstreamSet: z11.boolean()
1318
+ });
1319
+ var runCommitSchema = z11.object({
1320
+ sha: z11.string(),
1321
+ subject: z11.string(),
1322
+ author: z11.string(),
1255
1323
  /** Relative time ("3 hours ago") — git's `%cr`. */
1256
- when: z10.string()
1324
+ when: z11.string()
1257
1325
  });
1258
- var runCommitsResponseSchema = z10.object({ commits: z10.array(runCommitSchema) });
1259
- var groupVariantSchema = z10.object({
1260
- id: z10.string(),
1326
+ var runCommitsResponseSchema = z11.object({ commits: z11.array(runCommitSchema) });
1327
+ var groupVariantSchema = z11.object({
1328
+ id: z11.string(),
1261
1329
  /** 'A' | 'B' | 'C' in practice; `'?'` for a record that lost its letter. */
1262
- variant: z10.string(),
1263
- title: z10.string(),
1330
+ variant: z11.string(),
1331
+ title: z11.string(),
1264
1332
  status: runStatusSchema,
1265
- archived: z10.boolean(),
1266
- tokensUsed: z10.number(),
1333
+ archived: z11.boolean(),
1334
+ tokensUsed: z11.number(),
1267
1335
  inputTokens: usageCounterSchema.optional(),
1268
1336
  outputTokens: usageCounterSchema.optional(),
1269
- costUsd: z10.number().optional(),
1270
- diffStat: z10.string(),
1337
+ costUsd: z11.number().optional(),
1338
+ diffStat: z11.string(),
1271
1339
  /** First lines of the handoff journal's "## Progress log" section, as markdown. */
1272
- handoffExcerpt: z10.string()
1340
+ handoffExcerpt: z11.string()
1273
1341
  });
1274
- var groupResponseSchema = z10.object({
1275
- groupId: z10.string(),
1276
- runs: z10.array(groupVariantSchema)
1342
+ var groupResponseSchema = z11.object({
1343
+ groupId: z11.string(),
1344
+ runs: z11.array(groupVariantSchema)
1277
1345
  });
1278
- var pickVariantResponseSchema = z10.object({
1346
+ var pickVariantResponseSchema = z11.object({
1279
1347
  winner: runRecordSchema.optional()
1280
1348
  });
1281
1349
  var FILE_ATTACHMENT_MEDIA_TYPES = [
@@ -1298,174 +1366,182 @@ function isImageAttachmentName(name) {
1298
1366
  const ext = name.split(".").pop()?.toLowerCase();
1299
1367
  return ext !== void 0 && IMAGE_ATTACHMENT_EXTENSIONS.has(ext);
1300
1368
  }
1301
- var attachmentFileParamSchema = z10.object({
1302
- id: z10.string().min(1),
1303
- file: z10.string().regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine((name) => !name.includes(".."))
1369
+ var attachmentFileParamSchema = z11.object({
1370
+ id: z11.string().min(1),
1371
+ file: z11.string().regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine((name) => !name.includes(".."))
1304
1372
  });
1305
- var attachmentInputSchema = z10.object({
1306
- mediaType: z10.string().refine(isAttachmentMediaType, {
1373
+ var attachmentInputSchema = z11.object({
1374
+ mediaType: z11.string().refine(isAttachmentMediaType, {
1307
1375
  message: "unsupported attachment type \u2014 images, plain text, markdown and PDF only"
1308
1376
  }),
1309
- data: z10.string().min(1).max(7e6)
1377
+ data: z11.string().min(1).max(7e6)
1310
1378
  });
1311
1379
  var imageInputSchema = attachmentInputSchema;
1312
- var createRunInputBaseSchema = z10.object({
1313
- workflow: z10.string().min(1).optional(),
1380
+ var CLIENT_REQUEST_VARIANTS_ERROR = "clientRequestId names one run; it cannot be combined with variants > 1";
1381
+ var createRunInputBaseSchema = z11.object({
1382
+ workflow: z11.string().min(1).optional(),
1314
1383
  /** An inline chain (spec 008 — an approved plan runs as an ad-hoc workflow, never written to
1315
1384
  * a file). The catalog's own step shape, not a copy of it. */
1316
- steps: z10.array(workflowStepDefSchema).min(1).max(8).optional(),
1317
- task: z10.string().min(1).max(1e5, "must be at most 100000 characters"),
1318
- model: z10.string().optional(),
1385
+ steps: z11.array(workflowStepDefSchema).min(1).max(8).optional(),
1386
+ task: z11.string().min(1).max(1e5, "must be at most 100000 characters"),
1387
+ model: z11.string().optional(),
1319
1388
  /** Reasoning-effort pin (#45). Omit for the harness default; empty/`auto` stay implicit. */
1320
- effort: z10.string().max(32).optional(),
1389
+ effort: z11.string().max(32).optional(),
1321
1390
  runner: runnerSchema.optional(),
1322
1391
  /** Agent account for this task (spec 2026-07-29-agent-profiles). Omit to follow the
1323
1392
  * project's own selection; an id that no longer exists is a 400, not a silent default. */
1324
- agentProfile: z10.string().max(64).optional(),
1393
+ agentProfile: z11.string().max(64).optional(),
1325
1394
  /** 1–3. Above 1 the response is `{ runs }` rather than a single record. */
1326
- variants: z10.number().int().min(1).max(3).optional(),
1395
+ variants: z11.number().int().min(1).max(3).optional(),
1327
1396
  /** false → run in the repo working tree instead of an isolated worktree (read-only skills).
1328
1397
  * Omit for the default. Ignored server-side when variants > 1. */
1329
- worktree: z10.boolean().optional(),
1398
+ worktree: z11.boolean().optional(),
1330
1399
  /** true → autonomous run: never parks at "waiting"; auto-continues until done. */
1331
- autonomous: z10.boolean().optional(),
1400
+ autonomous: z11.boolean().optional(),
1332
1401
  /** false → keep the handoff journal but do not expose or request a follow-up todos file.
1333
1402
  * Omit for the default (enabled); a server with the capability off pins it to false. */
1334
- generateFollowups: z10.boolean().optional(),
1403
+ generateFollowups: z11.boolean().optional(),
1335
1404
  /** Per-run system-prompt override (R2 2.3) — programmatic callers only. Wins over the
1336
1405
  * config.json default; whitespace-only degrades to absent. */
1337
- systemPrompt: z10.string().trim().max(2e4, "must be at most 20000 characters").optional().transform((s) => s ? s : void 0),
1406
+ systemPrompt: z11.string().trim().max(2e4, "must be at most 20000 characters").optional().transform((s) => s ? s : void 0),
1338
1407
  /** Attachments pasted into the new-task form — screenshots, and since #950 PDF/TXT/MD files
1339
1408
  * too; delivered with the first agent step. The key keeps its name: the wire contract widened
1340
1409
  * in place rather than growing a second list. */
1341
- images: z10.array(attachmentInputSchema).max(4).optional(),
1410
+ images: z11.array(attachmentInputSchema).max(4).optional(),
1342
1411
  /** The inbox entry this task came from (#374). Best-effort bookkeeping: an unknown or
1343
1412
  * already-started id never fails the run. For ×2/×3 the FIRST variant is recorded. */
1344
- todoId: z10.string().min(1).max(200, "must be at most 200 characters").optional()
1413
+ todoId: z11.string().min(1).max(200, "must be at most 200 characters").optional()
1345
1414
  });
1346
- var createRunInputSchema = createRunInputBaseSchema.refine(
1415
+ var createRunInputSchema = createRunInputBaseSchema.extend({
1416
+ /** Idempotent start (#504): a retry with the same id and payload answers `200` with the run
1417
+ * the first request created; a different payload answers `409`. Scoped to the project. Not
1418
+ * on the base schema, so an automation's task definition cannot carry one. */
1419
+ clientRequestId: z11.string().uuid().optional()
1420
+ }).refine(
1347
1421
  (b) => Boolean(b.workflow) !== Boolean(b.steps),
1348
1422
  { message: 'provide either "workflow" or "steps", not both' }
1349
- );
1350
- var messageInputSchema = z10.object({
1351
- text: z10.string().max(1e5).default(""),
1352
- images: z10.array(attachmentInputSchema).max(4).default([])
1423
+ ).refine((b) => !(b.clientRequestId && (b.variants ?? 1) > 1), {
1424
+ message: CLIENT_REQUEST_VARIANTS_ERROR
1425
+ });
1426
+ var messageInputSchema = z11.object({
1427
+ text: z11.string().max(1e5).default(""),
1428
+ images: z11.array(attachmentInputSchema).max(4).default([])
1353
1429
  }).refine((m) => m.text.trim().length > 0 || m.images.length > 0, {
1354
1430
  message: "message needs text or at least one attachment"
1355
1431
  });
1356
- var patchRunInputSchema = z10.object({
1357
- title: z10.string().trim().min(1).max(300).optional(),
1358
- task: z10.string().trim().min(1).max(1e5).optional()
1432
+ var patchRunInputSchema = z11.object({
1433
+ title: z11.string().trim().min(1).max(300).optional(),
1434
+ task: z11.string().trim().min(1).max(1e5).optional()
1359
1435
  });
1360
- var pinRunInputSchema = z10.object({ pinned: z10.boolean().optional() });
1436
+ var pinRunInputSchema = z11.object({ pinned: z11.boolean().optional() });
1361
1437
 
1362
1438
  // ../contract/src/repo.ts
1363
- import { z as z11 } from "zod";
1364
- var statusEntrySchema = z11.object({
1365
- status: z11.string(),
1366
- path: z11.string()
1367
- });
1368
- var logEntrySchema = z11.object({
1369
- hash: z11.string(),
1370
- subject: z11.string(),
1371
- author: z11.string(),
1372
- when: z11.string()
1373
- });
1374
- var repoResponseSchema = z11.union([
1375
- z11.object({
1376
- info: z11.null(),
1377
- status: z11.array(z11.never()),
1378
- log: z11.array(z11.never()),
1379
- branches: z11.array(z11.never()),
1380
- baseBranch: z11.null()
1439
+ import { z as z12 } from "zod";
1440
+ var statusEntrySchema = z12.object({
1441
+ status: z12.string(),
1442
+ path: z12.string()
1443
+ });
1444
+ var logEntrySchema = z12.object({
1445
+ hash: z12.string(),
1446
+ subject: z12.string(),
1447
+ author: z12.string(),
1448
+ when: z12.string()
1449
+ });
1450
+ var repoResponseSchema = z12.union([
1451
+ z12.object({
1452
+ info: z12.null(),
1453
+ status: z12.array(z12.never()),
1454
+ log: z12.array(z12.never()),
1455
+ branches: z12.array(z12.never()),
1456
+ baseBranch: z12.null()
1381
1457
  }),
1382
- z11.object({
1458
+ z12.object({
1383
1459
  info: repoInfoSchema,
1384
- status: z11.array(statusEntrySchema),
1385
- log: z11.array(logEntrySchema),
1386
- branches: z11.array(z11.string()),
1387
- baseBranch: z11.string().nullable()
1460
+ status: z12.array(statusEntrySchema),
1461
+ log: z12.array(logEntrySchema),
1462
+ branches: z12.array(z12.string()),
1463
+ baseBranch: z12.string().nullable()
1388
1464
  })
1389
1465
  ]);
1390
- var repoBranchResponseSchema = z11.object({
1391
- branch: z11.string(),
1392
- created: z11.boolean()
1393
- });
1394
- var repoPullBranchesResponseSchema = z11.object({ branches: z11.array(z11.string()) });
1395
- var repoPullInputSchema = z11.object({
1396
- branch: z11.string().trim().min(1).max(200).optional(),
1397
- confirm: z11.boolean().optional()
1398
- });
1399
- var repoPullResponseSchema = z11.object({
1400
- branch: z11.string(),
1401
- pulled: z11.literal(true),
1402
- summary: z11.string()
1403
- });
1404
- var repoPullConfirmationSchema = z11.object({
1405
- error: z11.string(),
1406
- branch: z11.string(),
1407
- risks: z11.array(z11.enum(["active_runs", "dirty_tree"]))
1408
- });
1409
- var repoPullErrorSchema = z11.union([
1466
+ var repoBranchResponseSchema = z12.object({
1467
+ branch: z12.string(),
1468
+ created: z12.boolean()
1469
+ });
1470
+ var repoPullBranchesResponseSchema = z12.object({ branches: z12.array(z12.string()) });
1471
+ var repoPullInputSchema = z12.object({
1472
+ branch: z12.string().trim().min(1).max(200).optional(),
1473
+ confirm: z12.boolean().optional()
1474
+ });
1475
+ var repoPullResponseSchema = z12.object({
1476
+ branch: z12.string(),
1477
+ pulled: z12.literal(true),
1478
+ summary: z12.string()
1479
+ });
1480
+ var repoPullConfirmationSchema = z12.object({
1481
+ error: z12.string(),
1482
+ branch: z12.string(),
1483
+ risks: z12.array(z12.enum(["active_runs", "dirty_tree"]))
1484
+ });
1485
+ var repoPullErrorSchema = z12.union([
1410
1486
  repoPullConfirmationSchema,
1411
- z11.object({ error: z11.string() })
1487
+ z12.object({ error: z12.string() })
1412
1488
  ]);
1413
- var diffStatSchema2 = z11.object({
1414
- adds: z11.number(),
1415
- dels: z11.number(),
1416
- files: z11.number()
1489
+ var diffStatSchema2 = z12.object({
1490
+ adds: z12.number(),
1491
+ dels: z12.number(),
1492
+ files: z12.number()
1417
1493
  });
1418
- var changedFileSchema = z11.object({
1419
- path: z11.string(),
1494
+ var changedFileSchema = z12.object({
1495
+ path: z12.string(),
1420
1496
  /** Rename/copy source — present only when `status` is renamed/copied. */
1421
- oldPath: z11.string().optional(),
1422
- status: z11.enum(["added", "modified", "deleted", "renamed", "copied"]),
1423
- adds: z11.number(),
1424
- dels: z11.number(),
1497
+ oldPath: z12.string().optional(),
1498
+ status: z12.enum(["added", "modified", "deleted", "renamed", "copied"]),
1499
+ adds: z12.number(),
1500
+ dels: z12.number(),
1425
1501
  /** Binary per numstat — there is no text patch to render. */
1426
- binary: z11.boolean(),
1502
+ binary: z12.boolean(),
1427
1503
  /** True when the path is one the raw-bytes route serves as an `<img>` (#365) — present only
1428
1504
  * when true, so old clients that never read it stay correct. */
1429
- image: z11.boolean().optional(),
1505
+ image: z12.boolean().optional(),
1430
1506
  /** This file's unified-diff section; possibly `… (patch truncated)`, possibly empty. */
1431
- patch: z11.string()
1507
+ patch: z12.string()
1432
1508
  });
1433
- var changesPayloadSchema = z11.object({
1434
- files: z11.array(changedFileSchema),
1509
+ var changesPayloadSchema = z12.object({
1510
+ files: z12.array(changedFileSchema),
1435
1511
  stat: diffStatSchema2,
1436
1512
  /** Additive context for review tasks whose worktree HEAD no longer matches their own branch. */
1437
- repointedHead: z11.object({ headBranch: z11.string(), taskBranch: z11.string() }).optional()
1513
+ repointedHead: z12.object({ headBranch: z12.string(), taskBranch: z12.string() }).optional()
1438
1514
  });
1439
- var repoCommitPayloadSchema = z11.object({
1440
- sha: z11.string(),
1441
- subject: z11.string(),
1442
- author: z11.string(),
1515
+ var repoCommitPayloadSchema = z12.object({
1516
+ sha: z12.string(),
1517
+ subject: z12.string(),
1518
+ author: z12.string(),
1443
1519
  /** Relative time ("3 hours ago") — same `%cr` format as the /api/v1/repo log. */
1444
- when: z11.string(),
1445
- files: z11.array(changedFileSchema),
1520
+ when: z12.string(),
1521
+ files: z12.array(changedFileSchema),
1446
1522
  stat: diffStatSchema2
1447
1523
  });
1448
- var worktreeDirEntrySchema = z11.object({
1449
- name: z11.string(),
1450
- type: z11.enum(["dir", "file"]),
1451
- size: z11.number().optional()
1452
- });
1453
- var worktreeEntrySchema = z11.discriminatedUnion("type", [
1454
- z11.object({
1455
- type: z11.literal("dir"),
1456
- path: z11.string(),
1457
- entries: z11.array(worktreeDirEntrySchema)
1524
+ var worktreeDirEntrySchema = z12.object({
1525
+ name: z12.string(),
1526
+ type: z12.enum(["dir", "file"]),
1527
+ size: z12.number().optional()
1528
+ });
1529
+ var worktreeEntrySchema = z12.discriminatedUnion("type", [
1530
+ z12.object({
1531
+ type: z12.literal("dir"),
1532
+ path: z12.string(),
1533
+ entries: z12.array(worktreeDirEntrySchema)
1458
1534
  }),
1459
- z11.object({
1460
- type: z11.literal("file"),
1461
- path: z11.string(),
1462
- size: z11.number(),
1463
- binary: z11.boolean(),
1464
- tooLarge: z11.boolean(),
1465
- content: z11.string().optional()
1535
+ z12.object({
1536
+ type: z12.literal("file"),
1537
+ path: z12.string(),
1538
+ size: z12.number(),
1539
+ binary: z12.boolean(),
1540
+ tooLarge: z12.boolean(),
1541
+ content: z12.string().optional()
1466
1542
  })
1467
1543
  ]);
1468
- var worktreeRunStatusSchema = z11.enum([
1544
+ var worktreeRunStatusSchema = z12.enum([
1469
1545
  "queued",
1470
1546
  "running",
1471
1547
  "waiting",
@@ -1474,41 +1550,41 @@ var worktreeRunStatusSchema = z11.enum([
1474
1550
  "failed",
1475
1551
  "cancelled"
1476
1552
  ]);
1477
- var worktreeInfoSchema = z11.object({
1478
- runId: z11.string(),
1479
- title: z11.string(),
1553
+ var worktreeInfoSchema = z12.object({
1554
+ runId: z12.string(),
1555
+ title: z12.string(),
1480
1556
  status: worktreeRunStatusSchema,
1481
- branch: z11.string().nullable(),
1482
- sizeBytes: z11.number().nullable(),
1483
- finishedAt: z11.string().nullable(),
1484
- reclaimable: z11.boolean()
1557
+ branch: z12.string().nullable(),
1558
+ sizeBytes: z12.number().nullable(),
1559
+ finishedAt: z12.string().nullable(),
1560
+ reclaimable: z12.boolean()
1485
1561
  });
1486
- var worktreesResponseSchema = z11.object({
1487
- worktrees: z11.array(worktreeInfoSchema),
1488
- totalBytes: z11.number().nullable(),
1489
- keep: z11.number()
1562
+ var worktreesResponseSchema = z12.object({
1563
+ worktrees: z12.array(worktreeInfoSchema),
1564
+ totalBytes: z12.number().nullable(),
1565
+ keep: z12.number()
1490
1566
  });
1491
- var reclaimWorktreesResponseSchema = z11.object({
1492
- reclaimed: z11.array(z11.string())
1567
+ var reclaimWorktreesResponseSchema = z12.object({
1568
+ reclaimed: z12.array(z12.string())
1493
1569
  });
1494
1570
 
1495
1571
  // ../contract/src/projects.ts
1496
- import { z as z12 } from "zod";
1497
- var projectListEntrySchema = z12.object({
1498
- id: z12.string(),
1499
- name: z12.string(),
1572
+ import { z as z13 } from "zod";
1573
+ var projectListEntrySchema = z13.object({
1574
+ id: z13.string(),
1575
+ name: z13.string(),
1500
1576
  /** Absolute, realpath-normalized repo root. */
1501
- root: z12.string(),
1502
- addedAt: z12.string(),
1503
- lastOpenedAt: z12.string(),
1504
- source: z12.enum(["local", "checkout"]),
1577
+ root: z13.string(),
1578
+ addedAt: z13.string(),
1579
+ lastOpenedAt: z13.string(),
1580
+ source: z13.enum(["local", "checkout"]),
1505
1581
  /** `not-git` is fully usable (degraded single-queue mode); only `missing` blocks. */
1506
- status: z12.enum(["ok", "missing", "not-git"]),
1582
+ status: z13.enum(["ok", "missing", "not-git"]),
1507
1583
  /** Current branch when cheaply available (omitted e.g. on an unborn HEAD). */
1508
- branch: z12.string().optional(),
1584
+ branch: z13.string().optional(),
1509
1585
  /** Which forge this project's remote belongs to (#698) — classified server-side from the
1510
1586
  * remote URL alone. Gates the project group's GitHub nav item; omitted = no forge remote. */
1511
- forge: z12.literal("github").optional(),
1587
+ forge: z13.literal("github").optional(),
1512
1588
  /**
1513
1589
  * The remote's web root, `https://github.com/owner/repo`. Rebuilt server-side from the parsed
1514
1590
  * remote rather than passed through, so a remote carrying credentials cannot leak into the
@@ -1518,10 +1594,10 @@ var projectListEntrySchema = z12.object({
1518
1594
  * the global Tasks page has one row per project, so it cannot use any single repo's base the
1519
1595
  * way a project-scoped view can. With this, every reference it shows is a link.
1520
1596
  */
1521
- repoUrl: z12.string().optional(),
1597
+ repoUrl: z13.string().optional(),
1522
1598
  /** Per-project cap on concurrently running tasks (spec 2026-07-22). Omitted = inherit the
1523
1599
  * workspace `resources.maxParallel`; a number pins this project. */
1524
- maxParallel: z12.number().optional(),
1600
+ maxParallel: z13.number().optional(),
1525
1601
  /**
1526
1602
  * Free-form labels grouping CONNECTED repositories — a `storefront` tag on the API, the web
1527
1603
  * app and the design system says those three are one piece of work spread over three repos.
@@ -1533,85 +1609,85 @@ var projectListEntrySchema = z12.object({
1533
1609
  * server-side (trimmed, deduped case-insensitively, sorted), so a consumer may compare them
1534
1610
  * directly.
1535
1611
  */
1536
- tags: z12.array(z12.string()).optional()
1612
+ tags: z13.array(z13.string()).optional()
1537
1613
  });
1538
- var projectsResponseSchema = z12.object({
1539
- projects: z12.array(projectListEntrySchema),
1540
- bootProject: z12.string(),
1541
- projectsDir: z12.string()
1614
+ var projectsResponseSchema = z13.object({
1615
+ projects: z13.array(projectListEntrySchema),
1616
+ bootProject: z13.string(),
1617
+ projectsDir: z13.string()
1542
1618
  });
1543
- var registerProjectResponseSchema = z12.object({
1619
+ var registerProjectResponseSchema = z13.object({
1544
1620
  project: projectListEntrySchema,
1545
- error: z12.string().optional()
1621
+ error: z13.string().optional()
1546
1622
  });
1547
- var removeProjectResponseSchema = z12.object({
1548
- removed: z12.literal(true),
1549
- id: z12.string()
1623
+ var removeProjectResponseSchema = z13.object({
1624
+ removed: z13.literal(true),
1625
+ id: z13.string()
1550
1626
  });
1551
- var updateProjectResponseSchema = z12.object({
1627
+ var updateProjectResponseSchema = z13.object({
1552
1628
  project: projectListEntrySchema
1553
1629
  });
1554
1630
  var PROJECT_TAG_MAX_LENGTH = 32;
1555
1631
  var PROJECT_TAGS_MAX = 20;
1556
- var updateProjectInputSchema = z12.object({
1557
- maxParallel: z12.number().int().min(1).max(16).nullable().optional(),
1558
- tags: z12.array(z12.string().trim().min(1).max(PROJECT_TAG_MAX_LENGTH)).max(PROJECT_TAGS_MAX).nullable().optional()
1632
+ var updateProjectInputSchema = z13.object({
1633
+ maxParallel: z13.number().int().min(1).max(16).nullable().optional(),
1634
+ tags: z13.array(z13.string().trim().min(1).max(PROJECT_TAG_MAX_LENGTH)).max(PROJECT_TAGS_MAX).nullable().optional()
1559
1635
  }).refine(
1560
1636
  (body) => body.maxParallel !== void 0 || body.tags !== void 0,
1561
1637
  "specify maxParallel or tags"
1562
1638
  );
1563
- var checkoutProjectInputSchema = z12.object({
1564
- url: z12.string().trim().min(1).max(512),
1565
- name: z12.string().trim().max(128).optional(),
1566
- checkoutId: z12.string().trim().max(128).optional()
1567
- });
1568
- var fsBrowseDirSchema = z12.object({
1569
- name: z12.string(),
1570
- path: z12.string(),
1639
+ var checkoutProjectInputSchema = z13.object({
1640
+ url: z13.string().trim().min(1).max(512),
1641
+ name: z13.string().trim().max(128).optional(),
1642
+ checkoutId: z13.string().trim().max(128).optional()
1643
+ });
1644
+ var fsBrowseDirSchema = z13.object({
1645
+ name: z13.string(),
1646
+ path: z13.string(),
1571
1647
  /** Has a `.git` entry — drives the "git" badge. A non-repo folder is still selectable. */
1572
- isRepo: z12.boolean()
1648
+ isRepo: z13.boolean()
1573
1649
  });
1574
- var fsBrowseResponseSchema = z12.object({
1650
+ var fsBrowseResponseSchema = z13.object({
1575
1651
  /** The realpath'd directory actually listed — never the spelling asked for, so the breadcrumb
1576
1652
  * shows where the picker really is. */
1577
- path: z12.string(),
1653
+ path: z13.string(),
1578
1654
  /** `null` AT the browse root: there is no "up" out of it, and the dialog must render no parent
1579
1655
  * row rather than one that 400s. */
1580
- parent: z12.string().nullable(),
1581
- dirs: z12.array(fsBrowseDirSchema),
1656
+ parent: z13.string().nullable(),
1657
+ dirs: z13.array(fsBrowseDirSchema),
1582
1658
  /** True when the listing was capped server-side — surfaced honestly instead of showing a
1583
1659
  * silently short list. */
1584
- truncated: z12.boolean()
1660
+ truncated: z13.boolean()
1585
1661
  });
1586
- var launchKeyResponseSchema = z12.object({
1587
- key: z12.string()
1662
+ var launchKeyResponseSchema = z13.object({
1663
+ key: z13.string()
1588
1664
  });
1589
1665
 
1590
1666
  // ../contract/src/workspace.ts
1591
- import { z as z13 } from "zod";
1592
- var workspaceConfigResponseSchema = z13.object({
1667
+ import { z as z14 } from "zod";
1668
+ var workspaceConfigResponseSchema = z14.object({
1593
1669
  /** Root exposed by the Add-project directory browser — stored as written (`~` kept). */
1594
- browseRoot: z13.string(),
1670
+ browseRoot: z14.string(),
1595
1671
  /** Checkout root for GUI-cloned projects — stored as written (`~` kept). */
1596
- projectsDir: z13.string(),
1672
+ projectsDir: z14.string(),
1597
1673
  /** Stored override; `null` means inherit `CEZ_SKILLS_AUTO_UPDATE`, then true. */
1598
- skillsAutoUpdate: z13.boolean().nullable(),
1599
- effectiveSkillsAutoUpdate: z13.boolean(),
1600
- composerDefaults: z13.object({
1601
- autonomous: z13.boolean().nullable(),
1602
- worktree: z13.boolean().nullable(),
1674
+ skillsAutoUpdate: z14.boolean().nullable(),
1675
+ effectiveSkillsAutoUpdate: z14.boolean(),
1676
+ composerDefaults: z14.object({
1677
+ autonomous: z14.boolean().nullable(),
1678
+ worktree: z14.boolean().nullable(),
1603
1679
  /** `'source-dependent'` when no `CEZ_AUTONOMOUS_DEFAULT` pins it either way. */
1604
- inheritedAutonomous: z13.union([z13.boolean(), z13.literal("source-dependent")]),
1605
- inheritedWorktree: z13.boolean()
1680
+ inheritedAutonomous: z14.union([z14.boolean(), z14.literal("source-dependent")]),
1681
+ inheritedWorktree: z14.boolean()
1606
1682
  }),
1607
- resources: z13.object({
1608
- maxParallel: z13.number(),
1609
- maxMonitoringSessions: z13.number(),
1610
- monitoringWakeIntervalMinutes: z13.number().nullable(),
1683
+ resources: z14.object({
1684
+ maxParallel: z14.number(),
1685
+ maxMonitoringSessions: z14.number(),
1686
+ monitoringWakeIntervalMinutes: z14.number().nullable(),
1611
1687
  /** Resume a run a provider usage limit stopped, once the limit resets. Default `true`. */
1612
- autoResumeOnUsageLimit: z13.boolean(),
1613
- memoryLimitMb: z13.number().nullable(),
1614
- worktreeRetentionDefault: z13.number()
1688
+ autoResumeOnUsageLimit: z14.boolean(),
1689
+ memoryLimitMb: z14.number().nullable(),
1690
+ worktreeRetentionDefault: z14.number()
1615
1691
  }),
1616
1692
  /**
1617
1693
  * What a repo that has set none of its own runs (spec 2026-07-29-agent-profiles).
@@ -1621,121 +1697,121 @@ var workspaceConfigResponseSchema = z13.object({
1621
1697
  * from a value someone chose or the fallback collapses into "always claude". Consulted only where
1622
1698
  * the repo's own `.ai/cezar/config.json` is silent — a repo that chose is never overruled.
1623
1699
  */
1624
- agentDefaults: z13.object({
1700
+ agentDefaults: z14.object({
1625
1701
  runner: runnerSchema.optional(),
1626
- models: z13.object({
1627
- claude: z13.string().optional(),
1628
- codex: z13.string().optional(),
1629
- opencode: z13.string().optional(),
1630
- pi: z13.string().optional(),
1631
- cursor: z13.string().optional()
1702
+ models: z14.object({
1703
+ claude: z14.string().optional(),
1704
+ codex: z14.string().optional(),
1705
+ opencode: z14.string().optional(),
1706
+ pi: z14.string().optional(),
1707
+ cursor: z14.string().optional()
1632
1708
  }).optional()
1633
1709
  })
1634
1710
  });
1635
- var setWorkspaceConfigInputSchema = z13.object({
1636
- browseRoot: z13.string().trim().min(1).max(4096).optional(),
1637
- projectsDir: z13.string().trim().min(1).max(4096).optional(),
1638
- skillsAutoUpdate: z13.boolean().nullable().optional(),
1639
- composerDefaults: z13.object({
1640
- autonomous: z13.boolean().nullable().optional(),
1641
- worktree: z13.boolean().nullable().optional()
1711
+ var setWorkspaceConfigInputSchema = z14.object({
1712
+ browseRoot: z14.string().trim().min(1).max(4096).optional(),
1713
+ projectsDir: z14.string().trim().min(1).max(4096).optional(),
1714
+ skillsAutoUpdate: z14.boolean().nullable().optional(),
1715
+ composerDefaults: z14.object({
1716
+ autonomous: z14.boolean().nullable().optional(),
1717
+ worktree: z14.boolean().nullable().optional()
1642
1718
  }).optional(),
1643
1719
  /** Machine-wide agent defaults. `null` on a key CLEARS it back to "no opinion", which a bare
1644
1720
  * absent key cannot say in a partial patch. */
1645
- agentDefaults: z13.object({
1721
+ agentDefaults: z14.object({
1646
1722
  runner: runnerSchema.nullable().optional(),
1647
- models: z13.object({
1648
- claude: z13.string().trim().min(1).max(200).nullable().optional(),
1649
- codex: z13.string().trim().min(1).max(200).nullable().optional(),
1650
- opencode: z13.string().trim().min(1).max(200).nullable().optional(),
1651
- pi: z13.string().trim().min(1).max(200).nullable().optional(),
1652
- cursor: z13.string().trim().min(1).max(200).nullable().optional()
1723
+ models: z14.object({
1724
+ claude: z14.string().trim().min(1).max(200).nullable().optional(),
1725
+ codex: z14.string().trim().min(1).max(200).nullable().optional(),
1726
+ opencode: z14.string().trim().min(1).max(200).nullable().optional(),
1727
+ pi: z14.string().trim().min(1).max(200).nullable().optional(),
1728
+ cursor: z14.string().trim().min(1).max(200).nullable().optional()
1653
1729
  }).optional()
1654
1730
  }).optional(),
1655
- resources: z13.object({
1656
- maxParallel: z13.number().int().min(1).max(16).optional(),
1657
- maxMonitoringSessions: z13.number().int().min(0).max(16).optional(),
1658
- monitoringWakeIntervalMinutes: z13.number().int().min(1).max(60).nullable().optional(),
1659
- autoResumeOnUsageLimit: z13.boolean().optional(),
1660
- memoryLimitMb: z13.number().int().min(0).max(1048576).nullable().optional(),
1661
- worktreeRetentionDefault: z13.number().int().min(0).max(1e3).optional()
1731
+ resources: z14.object({
1732
+ maxParallel: z14.number().int().min(1).max(16).optional(),
1733
+ maxMonitoringSessions: z14.number().int().min(0).max(16).optional(),
1734
+ monitoringWakeIntervalMinutes: z14.number().int().min(1).max(60).nullable().optional(),
1735
+ autoResumeOnUsageLimit: z14.boolean().optional(),
1736
+ memoryLimitMb: z14.number().int().min(0).max(1048576).nullable().optional(),
1737
+ worktreeRetentionDefault: z14.number().int().min(0).max(1e3).optional()
1662
1738
  }).optional()
1663
1739
  });
1664
- var appearanceSchema = z13.object({
1665
- accent: z13.enum(["cezarion", "lime", "violet"]).optional(),
1666
- density: z13.enum(["comfortable", "compact", "ultra"]).optional(),
1667
- width: z13.enum(["narrow", "wide"]).optional()
1740
+ var appearanceSchema = z14.object({
1741
+ accent: z14.enum(["cezarion", "lime", "violet"]).optional(),
1742
+ density: z14.enum(["comfortable", "compact", "ultra"]).optional(),
1743
+ width: z14.enum(["narrow", "wide"]).optional()
1668
1744
  });
1669
- var taskTableUiStateSchema = z13.looseObject({
1745
+ var taskTableUiStateSchema = z14.looseObject({
1670
1746
  /** Explicit user choices only. Missing ids keep the registry-owned default. */
1671
- expandedColumns: z13.record(z13.string(), z13.boolean()).optional()
1747
+ expandedColumns: z14.record(z14.string(), z14.boolean()).optional()
1672
1748
  });
1673
- var uiStateSchema = z13.looseObject({
1749
+ var uiStateSchema = z14.looseObject({
1674
1750
  /** What the last started run used. `null` is a VALUE, not an absence: it records a run that
1675
1751
  * chose neither a skill nor a workflow (the plain built-in `quick-task`), which the composer
1676
1752
  * can now express since the source picker grew an empty state. Absent still means "no
1677
1753
  * run has been recorded here" — a cockpit reading either one selects nothing. */
1678
- lastTask: z13.object({ source: z13.enum(["workflow", "skill"]), ref: z13.string() }).nullable().optional(),
1754
+ lastTask: z14.object({ source: z14.enum(["workflow", "skill"]), ref: z14.string() }).nullable().optional(),
1679
1755
  /** Most-recently-run sources, newest first (deduped, capped). Feeds the composer picker's
1680
1756
  * recency sort. */
1681
- recentSources: z13.array(z13.object({ source: z13.enum(["workflow", "skill"]), ref: z13.string() })).optional(),
1757
+ recentSources: z14.array(z14.object({ source: z14.enum(["workflow", "skill"]), ref: z14.string() })).optional(),
1682
1758
  /** The last worktree choice for a single-skill run. Absent → the default (isolated worktree). */
1683
- lastWorktree: z13.boolean().optional(),
1759
+ lastWorktree: z14.boolean().optional(),
1684
1760
  /** The last autonomous choice — remembered like `lastWorktree`. Absent → off. */
1685
- lastAutonomous: z13.boolean().optional(),
1761
+ lastAutonomous: z14.boolean().optional(),
1686
1762
  /** Whether new runs should ask agents to append follow-up work. Absent → on. */
1687
- lastGenerateFollowups: z13.boolean().optional(),
1763
+ lastGenerateFollowups: z14.boolean().optional(),
1688
1764
  /** Skill selection frequency (#408): name → times chosen, across BOTH composers. */
1689
- skillUsage: z13.record(z13.string(), z13.number()).optional(),
1690
- runsView: z13.enum(["list", "table"]).optional(),
1765
+ skillUsage: z14.record(z14.string(), z14.number()).optional(),
1766
+ runsView: z14.enum(["list", "table"]).optional(),
1691
1767
  /** The GitHub tab's last-selected sub-tab (#417). Absent → issues. */
1692
- githubView: z13.enum(["issues", "prs"]).optional(),
1768
+ githubView: z14.enum(["issues", "prs"]).optional(),
1693
1769
  /** Settings → Appearance. The theme itself stays in localStorage (`cez-theme`) — it must
1694
1770
  * pre-paint, and it is per-browser by design. */
1695
1771
  appearance: appearanceSchema.optional(),
1696
1772
  /** Follow-up prompt templates (#413). Absent → the built-in defaults; present (even `[]`) is
1697
1773
  * the user's own edited list. `skills` are the skill names the template auto-applies for. */
1698
- promptTemplates: z13.array(
1699
- z13.object({
1700
- id: z13.string(),
1701
- label: z13.string(),
1702
- text: z13.string(),
1703
- skills: z13.array(z13.string()).optional()
1774
+ promptTemplates: z14.array(
1775
+ z14.object({
1776
+ id: z14.string(),
1777
+ label: z14.string(),
1778
+ text: z14.string(),
1779
+ skills: z14.array(z14.string()).optional()
1704
1780
  })
1705
1781
  ).optional(),
1706
1782
  /** The open-mercato/skills promo banner (#391), dismissed for good. Legacy — the banner is
1707
1783
  * gone, replaced by `WorkspaceUiState.importedSkills`; retained so old files round-trip. */
1708
- dismissedSkillsBanner: z13.boolean().optional()
1784
+ dismissedSkillsBanner: z14.boolean().optional()
1709
1785
  });
1710
- var workspaceLastLocationSchema = z13.strictObject({
1711
- projectId: z13.string().min(1).max(64),
1712
- pathname: z13.string().min(1).max(2048).startsWith("/p/"),
1713
- search: z13.string().max(4096).startsWith("?").optional(),
1714
- hash: z13.string().max(2048).startsWith("#").optional()
1786
+ var workspaceLastLocationSchema = z14.strictObject({
1787
+ projectId: z14.string().min(1).max(64),
1788
+ pathname: z14.string().min(1).max(2048).startsWith("/p/"),
1789
+ search: z14.string().max(4096).startsWith("?").optional(),
1790
+ hash: z14.string().max(2048).startsWith("#").optional()
1715
1791
  });
1716
- var workspaceUiStateSchema = z13.looseObject({
1792
+ var workspaceUiStateSchema = z14.looseObject({
1717
1793
  /** LEGACY — the sidebar's per-project collapse map (step 3.3). Still accepted and still
1718
1794
  * round-tripped so an older cockpit sharing this home keeps working, but the current cockpit
1719
1795
  * neither reads nor writes it: which groups are shut describes the WINDOW, not the workspace,
1720
1796
  * so it lives in that browser's localStorage (`packages/web/src/lib/sidebar-collapse.ts`).
1721
1797
  * One shared answer meant a phone collapsing a group collapsed it on the desktop too. */
1722
- sidebar: z13.looseObject({ collapsed: z13.record(z13.string(), z13.boolean()).optional() }).optional(),
1798
+ sidebar: z14.looseObject({ collapsed: z14.record(z14.string(), z14.boolean()).optional() }).optional(),
1723
1799
  /** Dismissed runtime-auth incident IDs, keyed by provider. An ID is only dismissed until the
1724
1800
  * provider reports a different incident, so this stays workspace-global with the browser
1725
1801
  * rather than one project checkout. */
1726
- dismissedProviderAuthFailures: z13.object({
1727
- claude: z13.string().optional(),
1728
- codex: z13.string().optional(),
1729
- opencode: z13.string().optional(),
1730
- pi: z13.string().optional(),
1731
- cursor: z13.string().optional()
1802
+ dismissedProviderAuthFailures: z14.object({
1803
+ claude: z14.string().optional(),
1804
+ codex: z14.string().optional(),
1805
+ opencode: z14.string().optional(),
1806
+ pi: z14.string().optional(),
1807
+ cursor: z14.string().optional()
1732
1808
  }).optional(),
1733
1809
  /** Settings → Appearance, GLOBAL since step 3.5: accent + density describe the person at the
1734
1810
  * keyboard, not a repo. */
1735
1811
  appearance: appearanceSchema.optional(),
1736
1812
  /** Settings → Notifications, GLOBAL since step 3.5 — one answer for the whole workspace, since
1737
1813
  * the delivering browser is one browser whichever project you are looking at. */
1738
- notifications: z13.looseObject({ enabled: z13.boolean().optional() }).optional(),
1814
+ notifications: z14.looseObject({ enabled: z14.boolean().optional() }).optional(),
1739
1815
  /** Desktop Tasks-table density, shared across every project in this workspace. */
1740
1816
  taskTable: taskTableUiStateSchema.optional(),
1741
1817
  /** LEGACY, exactly like `sidebar` above — the last settled project-scoped page, restored when
@@ -1746,27 +1822,27 @@ var workspaceUiStateSchema = z13.looseObject({
1746
1822
  /** The user's curated selection of default (vendor) skills. Tri-state: ABSENT means "not
1747
1823
  * curated", so every default skill shows; a PRESENT array (even `[]`) means only those names
1748
1824
  * show from that repo. */
1749
- importedSkills: z13.array(z13.string()).optional()
1825
+ importedSkills: z14.array(z14.string()).optional()
1750
1826
  });
1751
1827
  var WORKSPACE_UI_STATE_MAX_KEYS = 200;
1752
1828
  var TASK_TABLE_MAX_COLUMNS = 50;
1753
- var setWorkspaceUiStateInputSchema = z13.looseObject({
1829
+ var setWorkspaceUiStateInputSchema = z14.looseObject({
1754
1830
  ...workspaceUiStateSchema.shape,
1755
- sidebar: z13.looseObject({
1756
- collapsed: z13.record(z13.string().min(1).max(64), z13.boolean()).refine((map) => Object.keys(map).length <= WORKSPACE_UI_STATE_MAX_KEYS, {
1831
+ sidebar: z14.looseObject({
1832
+ collapsed: z14.record(z14.string().min(1).max(64), z14.boolean()).refine((map) => Object.keys(map).length <= WORKSPACE_UI_STATE_MAX_KEYS, {
1757
1833
  message: `sidebar.collapsed must have at most ${WORKSPACE_UI_STATE_MAX_KEYS} entries`
1758
1834
  }).optional()
1759
1835
  }).optional(),
1760
- dismissedProviderAuthFailures: z13.strictObject({
1761
- claude: z13.string().min(1).max(128).optional(),
1762
- codex: z13.string().min(1).max(128).optional(),
1763
- opencode: z13.string().min(1).max(128).optional(),
1764
- pi: z13.string().min(1).max(128).optional(),
1765
- cursor: z13.string().min(1).max(128).optional()
1836
+ dismissedProviderAuthFailures: z14.strictObject({
1837
+ claude: z14.string().min(1).max(128).optional(),
1838
+ codex: z14.string().min(1).max(128).optional(),
1839
+ opencode: z14.string().min(1).max(128).optional(),
1840
+ pi: z14.string().min(1).max(128).optional(),
1841
+ cursor: z14.string().min(1).max(128).optional()
1766
1842
  }).optional(),
1767
- importedSkills: z13.array(z13.string().min(1).max(200)).max(WORKSPACE_UI_STATE_MAX_KEYS).optional(),
1843
+ importedSkills: z14.array(z14.string().min(1).max(200)).max(WORKSPACE_UI_STATE_MAX_KEYS).optional(),
1768
1844
  taskTable: taskTableUiStateSchema.extend({
1769
- expandedColumns: z13.record(z13.string().min(1).max(64), z13.boolean()).refine((map) => Object.keys(map).length <= TASK_TABLE_MAX_COLUMNS, {
1845
+ expandedColumns: z14.record(z14.string().min(1).max(64), z14.boolean()).refine((map) => Object.keys(map).length <= TASK_TABLE_MAX_COLUMNS, {
1770
1846
  message: `taskTable.expandedColumns must have at most ${TASK_TABLE_MAX_COLUMNS} entries`
1771
1847
  }).optional()
1772
1848
  }).optional()
@@ -1778,56 +1854,56 @@ var setWorkspaceUiStateInputSchema = z13.looseObject({
1778
1854
  });
1779
1855
  }
1780
1856
  });
1781
- var runnerModelsSchema = z13.object({
1782
- claude: z13.string().optional(),
1783
- codex: z13.string().optional(),
1784
- opencode: z13.string().optional(),
1785
- pi: z13.string().optional(),
1786
- cursor: z13.string().optional()
1857
+ var runnerModelsSchema = z14.object({
1858
+ claude: z14.string().optional(),
1859
+ codex: z14.string().optional(),
1860
+ opencode: z14.string().optional(),
1861
+ pi: z14.string().optional(),
1862
+ cursor: z14.string().optional()
1787
1863
  });
1788
- var configResponseSchema = z13.object({
1789
- baseBranch: z13.string().nullable(),
1864
+ var configResponseSchema = z14.object({
1865
+ baseBranch: z14.string().nullable(),
1790
1866
  defaultRunner: runnerSchema,
1791
- systemPrompt: z13.string().nullable(),
1867
+ systemPrompt: z14.string().nullable(),
1792
1868
  defaultModels: runnerModelsSchema,
1793
1869
  /** True when native coding-agent settings are authoritative and model picks are read-only. */
1794
- modelsLocked: z13.boolean(),
1870
+ modelsLocked: z14.boolean(),
1795
1871
  /** How many tasks run at once (1–16). */
1796
- maxParallel: z13.number(),
1872
+ maxParallel: z14.number(),
1797
1873
  /** Per-task memory ceiling in MiB (whole process tree); null = no limit. */
1798
- memoryLimitMb: z13.number().nullable(),
1874
+ memoryLimitMb: z14.number().nullable(),
1799
1875
  /** Keep the last N finished worktrees on disk (#483); 0 = unlimited. Older ones are reclaimed
1800
1876
  * (directory only — branch kept, so work is recoverable). */
1801
- worktreeRetention: z13.number(),
1877
+ worktreeRetention: z14.number(),
1802
1878
  /** Live title updates: null = no config key, the `CEZ_TITLE_UPDATES` env default (ON) decides. */
1803
- liveTitleUpdates: z13.boolean().nullable(),
1879
+ liveTitleUpdates: z14.boolean().nullable(),
1804
1880
  /** Optional review gate (#489): null = no config key, the `CEZ_REVIEW_GATE` env default (OFF)
1805
1881
  * decides. */
1806
- reviewGate: z13.boolean().nullable()
1882
+ reviewGate: z14.boolean().nullable()
1807
1883
  });
1808
1884
  var setConfigResponseSchema = configResponseSchema;
1809
- var setConfigInputSchema = z13.object({
1810
- baseBranch: z13.string().trim().min(1).max(200).nullable().optional(),
1885
+ var setConfigInputSchema = z14.object({
1886
+ baseBranch: z14.string().trim().min(1).max(200).nullable().optional(),
1811
1887
  defaultRunner: runnerSchema.optional(),
1812
- systemPrompt: z13.string().trim().max(2e4).nullable().optional(),
1813
- defaultModels: z13.object({
1814
- claude: z13.string().trim().max(200).nullable().optional(),
1815
- codex: z13.string().trim().max(200).nullable().optional(),
1816
- opencode: z13.string().trim().max(200).nullable().optional(),
1817
- pi: z13.string().trim().max(200).nullable().optional(),
1818
- cursor: z13.string().trim().max(200).nullable().optional()
1888
+ systemPrompt: z14.string().trim().max(2e4).nullable().optional(),
1889
+ defaultModels: z14.object({
1890
+ claude: z14.string().trim().max(200).nullable().optional(),
1891
+ codex: z14.string().trim().max(200).nullable().optional(),
1892
+ opencode: z14.string().trim().max(200).nullable().optional(),
1893
+ pi: z14.string().trim().max(200).nullable().optional(),
1894
+ cursor: z14.string().trim().max(200).nullable().optional()
1819
1895
  }).optional(),
1820
- maxParallel: z13.number().int().min(1).max(16).optional(),
1896
+ maxParallel: z14.number().int().min(1).max(16).optional(),
1821
1897
  /** null or 0 clears the ceiling back to "no limit". */
1822
- memoryLimitMb: z13.number().int().min(0).max(1048576).nullable().optional(),
1898
+ memoryLimitMb: z14.number().int().min(0).max(1048576).nullable().optional(),
1823
1899
  /** Keep last N finished worktrees (#483); 0 = unlimited, null clears back to the default (10). */
1824
- worktreeRetention: z13.number().int().min(0).max(1e3).nullable().optional(),
1900
+ worktreeRetention: z14.number().int().min(0).max(1e3).nullable().optional(),
1825
1901
  /** null clears the key back to the env-default behavior. */
1826
- liveTitleUpdates: z13.boolean().nullable().optional(),
1902
+ liveTitleUpdates: z14.boolean().nullable().optional(),
1827
1903
  /** null clears the key back to the env-default behavior (OFF). */
1828
- reviewGate: z13.boolean().nullable().optional()
1904
+ reviewGate: z14.boolean().nullable().optional()
1829
1905
  });
1830
- var skillsUpdateStatusSchema = z13.enum([
1906
+ var skillsUpdateStatusSchema = z14.enum([
1831
1907
  "idle",
1832
1908
  "checking",
1833
1909
  "available",
@@ -1836,225 +1912,225 @@ var skillsUpdateStatusSchema = z13.enum([
1836
1912
  "unavailable",
1837
1913
  "error"
1838
1914
  ]);
1839
- var skillsUpdateScopeStateSchema = z13.object({
1840
- scope: z13.enum(["project", "global"]),
1915
+ var skillsUpdateScopeStateSchema = z14.object({
1916
+ scope: z14.enum(["project", "global"]),
1841
1917
  status: skillsUpdateStatusSchema,
1842
- available: z13.boolean(),
1843
- skills: z13.array(z13.string()),
1844
- checkedAt: z13.string().nullable(),
1845
- updatedAt: z13.string().nullable(),
1846
- reason: z13.string().optional()
1918
+ available: z14.boolean(),
1919
+ skills: z14.array(z14.string()),
1920
+ checkedAt: z14.string().nullable(),
1921
+ updatedAt: z14.string().nullable(),
1922
+ reason: z14.string().optional()
1847
1923
  });
1848
- var skillsUpdateStateSchema = z13.object({
1924
+ var skillsUpdateStateSchema = z14.object({
1849
1925
  status: skillsUpdateStatusSchema,
1850
- available: z13.boolean(),
1851
- autoUpdateEnabled: z13.boolean(),
1852
- inherited: z13.boolean(),
1853
- checkedAt: z13.string().nullable(),
1854
- updatedAt: z13.string().nullable(),
1855
- scopes: z13.array(skillsUpdateScopeStateSchema),
1856
- needsUpgradeNotes: z13.boolean()
1926
+ available: z14.boolean(),
1927
+ autoUpdateEnabled: z14.boolean(),
1928
+ inherited: z14.boolean(),
1929
+ checkedAt: z14.string().nullable(),
1930
+ updatedAt: z14.string().nullable(),
1931
+ scopes: z14.array(skillsUpdateScopeStateSchema),
1932
+ needsUpgradeNotes: z14.boolean()
1857
1933
  });
1858
1934
  var providerIdSchema = runnerSchema;
1859
- var providerConnectionStateSchema = z13.enum([
1935
+ var providerConnectionStateSchema = z14.enum([
1860
1936
  "connected",
1861
1937
  "disconnected",
1862
1938
  "not-installed",
1863
1939
  "unknown"
1864
1940
  ]);
1865
- var providerStatusSchema = z13.object({
1941
+ var providerStatusSchema = z14.object({
1866
1942
  provider: providerIdSchema,
1867
1943
  status: providerConnectionStateSchema,
1868
- enabled: z13.boolean().optional(),
1869
- hint: z13.string().optional(),
1870
- authFailureId: z13.string().optional(),
1944
+ enabled: z14.boolean().optional(),
1945
+ hint: z14.string().optional(),
1946
+ authFailureId: z14.string().optional(),
1871
1947
  /** Which agent account this row describes (spec 2026-07-29-agent-profiles). ABSENT on
1872
1948
  * `GET /api/v1/providers/status`, which deliberately keeps answering exactly one row per
1873
1949
  * provider — the discovered default — so an older client sees no change at all. Per-account
1874
1950
  * rows are carried by `GET /api/v1/workspace/agent-profiles` instead. */
1875
- profileId: z13.string().optional()
1951
+ profileId: z14.string().optional()
1876
1952
  });
1877
- var providerStatusResponseSchema = z13.object({
1878
- providers: z13.array(providerStatusSchema)
1953
+ var providerStatusResponseSchema = z14.object({
1954
+ providers: z14.array(providerStatusSchema)
1879
1955
  });
1880
- var providerConnectResponseSchema = z13.discriminatedUnion("opened", [
1881
- z13.object({ opened: z13.literal(true), command: z13.string() }),
1882
- z13.object({ opened: z13.literal(false), connected: z13.literal(true), command: z13.string() })
1956
+ var providerConnectResponseSchema = z14.discriminatedUnion("opened", [
1957
+ z14.object({ opened: z14.literal(true), command: z14.string() }),
1958
+ z14.object({ opened: z14.literal(false), connected: z14.literal(true), command: z14.string() })
1883
1959
  ]);
1884
- var modelDiscoveryRunnerSchema = z13.enum(["claude", "codex", "opencode", "pi", "cursor"]);
1960
+ var modelDiscoveryRunnerSchema = z14.enum(["claude", "codex", "opencode", "pi", "cursor"]);
1885
1961
  var MODEL_DISCOVERY_RUNNERS = modelDiscoveryRunnerSchema.options;
1886
1962
  function runnerDiscoversModels(runner) {
1887
1963
  return MODEL_DISCOVERY_RUNNERS.includes(runner);
1888
1964
  }
1889
- var runnerModelOptionSchema = z13.object({
1890
- id: z13.string(),
1891
- label: z13.string(),
1892
- description: z13.string(),
1893
- effortLevels: z13.array(effortLevelSchema).optional()
1965
+ var runnerModelOptionSchema = z14.object({
1966
+ id: z14.string(),
1967
+ label: z14.string(),
1968
+ description: z14.string(),
1969
+ effortLevels: z14.array(effortLevelSchema).optional()
1894
1970
  });
1895
- var runnerModelCatalogResponseSchema = z13.object({
1971
+ var runnerModelCatalogResponseSchema = z14.object({
1896
1972
  runner: runnerSchema,
1897
- models: z13.array(runnerModelOptionSchema),
1898
- source: z13.enum(["live", "cache", "unavailable"]),
1899
- stale: z13.boolean(),
1900
- reason: z13.string().optional()
1973
+ models: z14.array(runnerModelOptionSchema),
1974
+ source: z14.enum(["live", "cache", "unavailable"]),
1975
+ stale: z14.boolean(),
1976
+ reason: z14.string().optional()
1901
1977
  });
1902
- var openTargetSchema = z13.object({
1903
- id: z13.string(),
1904
- label: z13.string(),
1978
+ var openTargetSchema = z14.object({
1979
+ id: z14.string(),
1980
+ label: z14.string(),
1905
1981
  /** A stable icon key (#361) the UI maps to a concrete icon. Optional: an older server omitting
1906
1982
  * it just renders the generic fallback icon. */
1907
- icon: z13.string().optional()
1983
+ icon: z14.string().optional()
1908
1984
  });
1909
- var openTargetsResponseSchema = z13.object({
1910
- targets: z13.array(openTargetSchema)
1985
+ var openTargetsResponseSchema = z14.object({
1986
+ targets: z14.array(openTargetSchema)
1911
1987
  });
1912
- var openProjectInSchema = z13.object({
1988
+ var openProjectInSchema = z14.object({
1913
1989
  // A short bound (#429): matched against a downstream allowlist, so an app id is never long.
1914
- target: z13.string().trim().min(1, "target required").max(200)
1990
+ target: z14.string().trim().min(1, "target required").max(200)
1915
1991
  });
1916
- var openProjectInResponseSchema = z13.object({
1917
- opened: z13.literal(true),
1918
- path: z13.string()
1992
+ var openProjectInResponseSchema = z14.object({
1993
+ opened: z14.literal(true),
1994
+ path: z14.string()
1919
1995
  });
1920
1996
 
1921
1997
  // ../contract/src/skills.ts
1922
- import { z as z14 } from "zod";
1923
- var skillSchema = z14.object({
1924
- name: z14.string(),
1925
- description: z14.string().optional(),
1998
+ import { z as z15 } from "zod";
1999
+ var skillSchema = z15.object({
2000
+ name: z15.string(),
2001
+ description: z15.string().optional(),
1926
2002
  /** Advisory hint for untouched composer run-mode choices. */
1927
- interactive: z14.literal(true).optional(),
1928
- body: z14.string(),
1929
- path: z14.string(),
1930
- source: z14.enum(["ai", "cezar", "agents", "global", "team"]),
2003
+ interactive: z15.literal(true).optional(),
2004
+ body: z15.string(),
2005
+ path: z15.string(),
2006
+ source: z15.enum(["ai", "cezar", "agents", "global", "team"]),
1931
2007
  /** Team skills only: where the definition lives in its skills repo. */
1932
- team: z14.object({
1933
- repo: z14.string(),
1934
- ref: z14.string(),
1935
- path: z14.string(),
2008
+ team: z15.object({
2009
+ repo: z15.string(),
2010
+ ref: z15.string(),
2011
+ path: z15.string(),
1936
2012
  /** True for the `SKILL.md` convention — a whole directory (references/…). */
1937
- dir: z14.boolean(),
2013
+ dir: z15.boolean(),
1938
2014
  /**
1939
2015
  * The exact commit `ref` resolved to when the skill was read (#428).
1940
2016
  *
1941
2017
  * The hand-written DTO omitted this field entirely — it was NARROWER than the route,
1942
2018
  * which has served it since #428.
1943
2019
  */
1944
- commit: z14.string().optional()
2020
+ commit: z15.string().optional()
1945
2021
  }).optional()
1946
2022
  });
1947
- var importableSkillSchema = z14.object({
1948
- name: z14.string(),
1949
- description: z14.string().optional()
2023
+ var importableSkillSchema = z15.object({
2024
+ name: z15.string(),
2025
+ description: z15.string().optional()
1950
2026
  });
1951
- var todoItemSchema = z14.object({
1952
- id: z14.string(),
1953
- ts: z14.string().optional(),
1954
- taskId: z14.string().optional(),
1955
- summary: z14.string().min(1),
1956
- action: z14.string().optional(),
1957
- prUrl: z14.string().optional(),
1958
- suggestedSkill: z14.string().optional(),
1959
- suggestedArgs: z14.string().optional(),
1960
- suggestedPrompt: z14.string().optional(),
2027
+ var todoItemSchema = z15.object({
2028
+ id: z15.string(),
2029
+ ts: z15.string().optional(),
2030
+ taskId: z15.string().optional(),
2031
+ summary: z15.string().min(1),
2032
+ action: z15.string().optional(),
2033
+ prUrl: z15.string().optional(),
2034
+ suggestedSkill: z15.string().optional(),
2035
+ suggestedArgs: z15.string().optional(),
2036
+ suggestedPrompt: z15.string().optional(),
1961
2037
  /** Explicit intent; missing infers from suggestedSkill/suggestedPrompt for old files. */
1962
- runnable: z14.boolean().optional(),
2038
+ runnable: z15.boolean().optional(),
1963
2039
  /** Set once a task was started from this entry — it then leaves the inbox and stays as
1964
2040
  * the audit trail. A later launch never overwrites the first. */
1965
- startedTaskId: z14.string().optional()
2041
+ startedTaskId: z15.string().optional()
1966
2042
  });
1967
- var removeTodoResponseSchema = z14.object({
1968
- removed: z14.literal(true)
2043
+ var removeTodoResponseSchema = z15.object({
2044
+ removed: z15.literal(true)
1969
2045
  });
1970
- var startTodoResponseSchema = z14.object({
2046
+ var startTodoResponseSchema = z15.object({
1971
2047
  run: runRecordSchema
1972
2048
  });
1973
2049
 
1974
2050
  // ../contract/src/agent-config.ts
1975
- import { z as z15 } from "zod";
1976
- var agentConfigFormatSchema = z15.enum(["json", "jsonc", "toml", "markdown"]);
1977
- var agentConfigScopeSchema = z15.enum(["user", "project", "local"]);
1978
- var agentConfigKindSchema = z15.enum(["settings", "memory", "mcp"]);
1979
- var agentConfigTrackedSchema = z15.enum(["tracked", "gitignored", "outside-repo"]);
1980
- var agentConfigFileSchema = z15.object({
2051
+ import { z as z16 } from "zod";
2052
+ var agentConfigFormatSchema = z16.enum(["json", "jsonc", "toml", "markdown"]);
2053
+ var agentConfigScopeSchema = z16.enum(["user", "project", "local"]);
2054
+ var agentConfigKindSchema = z16.enum(["settings", "memory", "mcp"]);
2055
+ var agentConfigTrackedSchema = z16.enum(["tracked", "gitignored", "outside-repo"]);
2056
+ var agentConfigFileSchema = z16.object({
1981
2057
  /** Stable, opaque, URL-safe — the ONLY thing a client may name (traversal-proof). */
1982
- id: z15.string(),
2058
+ id: z16.string(),
1983
2059
  /** Every runner that reads this file: `<repo>/AGENTS.md` is one file, two readers. */
1984
- runners: z15.array(runnerSchema),
2060
+ runners: z16.array(runnerSchema),
1985
2061
  kind: agentConfigKindSchema,
1986
2062
  scope: agentConfigScopeSchema,
1987
- label: z15.string(),
1988
- path: z15.string(),
2063
+ label: z16.string(),
2064
+ path: z16.string(),
1989
2065
  format: agentConfigFormatSchema,
1990
2066
  tracked: agentConfigTrackedSchema,
1991
- seeded: z15.boolean(),
1992
- holdsMcp: z15.boolean(),
2067
+ seeded: z16.boolean(),
2068
+ holdsMcp: z16.boolean(),
1993
2069
  /** VERBATIM from the vendor docs. Never computed, never generic. */
1994
- precedence: z15.string(),
2070
+ precedence: z16.string(),
1995
2071
  /** Documented mid-run reload behaviour, or absent when the vendor is silent. */
1996
- hotReload: z15.string().optional(),
1997
- docsUrl: z15.string(),
1998
- exists: z15.boolean(),
1999
- size: z15.number(),
2072
+ hotReload: z16.string().optional(),
2073
+ docsUrl: z16.string(),
2074
+ exists: z16.boolean(),
2075
+ size: z16.number(),
2000
2076
  /** sha256 of the bytes, or null when absent. */
2001
- version: z15.string().nullable(),
2077
+ version: z16.string().nullable(),
2002
2078
  /** False in hosted mode (whole feature) — the client renders read-only up front. */
2003
- writable: z15.boolean(),
2004
- readOnlyReason: z15.string().optional()
2079
+ writable: z16.boolean(),
2080
+ readOnlyReason: z16.string().optional()
2005
2081
  });
2006
- var userMcpListingSchema = z15.object({
2007
- path: z15.string(),
2008
- servers: z15.array(z15.string()),
2009
- readable: z15.boolean()
2082
+ var userMcpListingSchema = z16.object({
2083
+ path: z16.string(),
2084
+ servers: z16.array(z16.string()),
2085
+ readable: z16.boolean()
2010
2086
  });
2011
- var agentConfigListingSchema = z15.object({
2012
- editable: z15.boolean(),
2013
- files: z15.array(agentConfigFileSchema),
2087
+ var agentConfigListingSchema = z16.object({
2088
+ editable: z16.boolean(),
2089
+ files: z16.array(agentConfigFileSchema),
2014
2090
  /** null in hosted mode (host-state disclosure guard). */
2015
2091
  userMcp: userMcpListingSchema.nullable()
2016
2092
  });
2017
- var agentConfigFileContentSchema = z15.object({
2018
- id: z15.string(),
2019
- path: z15.string(),
2020
- exists: z15.boolean(),
2021
- content: z15.string(),
2093
+ var agentConfigFileContentSchema = z16.object({
2094
+ id: z16.string(),
2095
+ path: z16.string(),
2096
+ exists: z16.boolean(),
2097
+ content: z16.string(),
2022
2098
  /** sha256 of the bytes, or null when the file does not exist yet. */
2023
- version: z15.string().nullable()
2099
+ version: z16.string().nullable()
2024
2100
  });
2025
- var setAgentConfigInputSchema = z15.object({
2026
- content: z15.string().max(2e6),
2027
- version: z15.string().nullable()
2101
+ var setAgentConfigInputSchema = z16.object({
2102
+ content: z16.string().max(2e6),
2103
+ version: z16.string().nullable()
2028
2104
  });
2029
2105
 
2030
2106
  // ../contract/src/agent-profiles.ts
2031
- import { z as z16 } from "zod";
2107
+ import { z as z17 } from "zod";
2032
2108
  var DEFAULT_AGENT_ACCOUNT_ID = "default";
2033
- var agentAccountFileSchema = z16.object({
2034
- id: z16.string(),
2109
+ var agentAccountFileSchema = z17.object({
2110
+ id: z17.string(),
2035
2111
  /** e.g. `settings.json` — the file's own name, since the folder is shown once on the account. */
2036
- label: z16.string(),
2112
+ label: z17.string(),
2037
2113
  /** Absolute, resolved inside this account's config folder. */
2038
- path: z16.string(),
2039
- exists: z16.boolean()
2114
+ path: z17.string(),
2115
+ exists: z17.boolean()
2040
2116
  });
2041
- var agentProfileSchema = z16.object({
2117
+ var agentProfileSchema = z17.object({
2042
2118
  /** `default` for the discovered profile, else the stored slug. */
2043
- id: z16.string(),
2119
+ id: z17.string(),
2044
2120
  provider: providerIdSchema,
2045
- label: z16.string(),
2121
+ label: z17.string(),
2046
2122
  /** As the user wrote it — a literal `~` is preserved, matching `browseRoot`/`projectsDir`. */
2047
- configDir: z16.string(),
2123
+ configDir: z17.string(),
2048
2124
  /** Expanded absolute path. Same-origin route, like `ProjectListEntry.root`. */
2049
- path: z16.string(),
2125
+ path: z17.string(),
2050
2126
  /** False for a dir the CLI has not created yet — legitimate, and NOT a reason to fall back
2051
2127
  * to another account at run time (that would silently bill the wrong subscription). */
2052
- exists: z16.boolean(),
2128
+ exists: z17.boolean(),
2053
2129
  /** Whether the dir carries this agent's own marker files. ADVISORY: an unrecognised dir is
2054
2130
  * still accepted, because "add profile → Connect → the CLI creates it" is the real flow. */
2055
- looksValid: z16.boolean(),
2131
+ looksValid: z17.boolean(),
2056
2132
  /** True for the profile cezar discovers from the environment. Never stored, never deletable. */
2057
- isDefault: z16.boolean(),
2133
+ isDefault: z17.boolean(),
2058
2134
  /** This account's own authentication state — two Claude logins answer independently.
2059
2135
  *
2060
2136
  * **Absent until the probe has warmed.** Every probe shells out to an agent CLI, and this
@@ -2065,36 +2141,36 @@ var agentProfileSchema = z16.object({
2065
2141
  status: providerStatusSchema.optional(),
2066
2142
  /** This agent's own user-scope config files, resolved inside THIS account's folder — so a
2067
2143
  * second login's `settings.json` is the one you open, not the default account's. */
2068
- files: z16.array(agentAccountFileSchema)
2144
+ files: z17.array(agentAccountFileSchema)
2069
2145
  });
2070
2146
  function agentAccountRouteId(profile) {
2071
2147
  return profile.isDefault ? `default:${profile.provider}` : profile.id;
2072
2148
  }
2073
- var agentAccountSelectionSchema = z16.object({
2074
- claude: z16.string().optional(),
2075
- codex: z16.string().optional(),
2076
- opencode: z16.string().optional(),
2077
- pi: z16.string().optional(),
2078
- cursor: z16.string().optional()
2079
- });
2080
- var agentProfilesResponseSchema = z16.object({
2081
- editable: z16.boolean(),
2082
- profiles: z16.array(agentProfileSchema),
2149
+ var agentAccountSelectionSchema = z17.object({
2150
+ claude: z17.string().optional(),
2151
+ codex: z17.string().optional(),
2152
+ opencode: z17.string().optional(),
2153
+ pi: z17.string().optional(),
2154
+ cursor: z17.string().optional()
2155
+ });
2156
+ var agentProfilesResponseSchema = z17.object({
2157
+ editable: z17.boolean(),
2158
+ profiles: z17.array(agentProfileSchema),
2083
2159
  /** Providers that can carry more than one account at all — what "Add account" is offered for.
2084
2160
  * OpenCode is absent: its credentials live in a SQLite DB behind a separate `OPENCODE_DB`, so
2085
2161
  * a config-dir profile would swap settings while still billing the other account. */
2086
- profileCapableProviders: z16.array(providerIdSchema),
2162
+ profileCapableProviders: z17.array(providerIdSchema),
2087
2163
  /** Which account each project uses, keyed by the project's realpath'd ROOT.
2088
2164
  *
2089
2165
  * Served here rather than on `GET /api/v1/projects` because it is stored beside the accounts it
2090
2166
  * names (`~/.cezar/agent-accounts.json`) — one file, so deleting an account and scrubbing every
2091
2167
  * reference to it is one atomic write, and neither can be dropped by a cezar version that never
2092
2168
  * heard of accounts. Empty in hosted mode, where the whole family is withheld. */
2093
- selections: z16.record(z16.string(), agentAccountSelectionSchema),
2169
+ selections: z17.record(z17.string(), agentAccountSelectionSchema),
2094
2170
  /** The machine-wide fallback account per provider, used by any repo that has chosen none. */
2095
2171
  defaults: agentAccountSelectionSchema
2096
2172
  });
2097
- var selectAgentProfileInputSchema = z16.object({
2173
+ var selectAgentProfileInputSchema = z17.object({
2098
2174
  /**
2099
2175
  * Registry slug, or the reserved `default` boot alias. Resolved to a root server-side.
2100
2176
  *
@@ -2102,108 +2178,108 @@ var selectAgentProfileInputSchema = z16.object({
2102
2178
  * chosen nothing uses, so a second login is set up once rather than per checkout. A repo's own
2103
2179
  * choice always wins over it, which is what keeps this a default and not an override.
2104
2180
  */
2105
- projectId: z16.string().min(1).max(64).nullable(),
2181
+ projectId: z17.string().min(1).max(64).nullable(),
2106
2182
  provider: providerIdSchema,
2107
- profileId: z16.string().max(64).nullable()
2183
+ profileId: z17.string().max(64).nullable()
2108
2184
  });
2109
- var agentProfileSelectionsResponseSchema = z16.object({
2110
- selections: z16.record(z16.string(), agentAccountSelectionSchema),
2185
+ var agentProfileSelectionsResponseSchema = z17.object({
2186
+ selections: z17.record(z17.string(), agentAccountSelectionSchema),
2111
2187
  /** The machine-wide fallback, for repos with no selection of their own. */
2112
2188
  defaults: agentAccountSelectionSchema
2113
2189
  });
2114
- var agentAccountStatusResponseSchema = z16.object({ status: providerStatusSchema });
2115
- var agentAccountDetailsResponseSchema = z16.object({
2116
- available: z16.boolean(),
2117
- reason: z16.string().optional(),
2118
- fields: z16.array(z16.object({ label: z16.string(), value: z16.string() }))
2190
+ var agentAccountStatusResponseSchema = z17.object({ status: providerStatusSchema });
2191
+ var agentAccountDetailsResponseSchema = z17.object({
2192
+ available: z17.boolean(),
2193
+ reason: z17.string().optional(),
2194
+ fields: z17.array(z17.object({ label: z17.string(), value: z17.string() }))
2119
2195
  });
2120
- var openAgentAccountFileInputSchema = z16.object({
2121
- file: z16.string().min(1).max(200),
2122
- target: z16.string().min(1).max(64).optional()
2196
+ var openAgentAccountFileInputSchema = z17.object({
2197
+ file: z17.string().min(1).max(200),
2198
+ target: z17.string().min(1).max(64).optional()
2123
2199
  });
2124
- var openAgentAccountFileResponseSchema = z16.object({
2125
- opened: z16.literal(true),
2126
- path: z16.string()
2200
+ var openAgentAccountFileResponseSchema = z17.object({
2201
+ opened: z17.literal(true),
2202
+ path: z17.string()
2127
2203
  });
2128
- var createAgentProfileInputSchema = z16.object({
2204
+ var createAgentProfileInputSchema = z17.object({
2129
2205
  provider: providerIdSchema,
2130
- label: z16.string().trim().max(200).optional(),
2206
+ label: z17.string().trim().max(200).optional(),
2131
2207
  /** Stored as written; validated absolute after `~` expansion, server-side. */
2132
- configDir: z16.string().trim().min(1).max(4096)
2208
+ configDir: z17.string().trim().min(1).max(4096)
2133
2209
  });
2134
- var agentProfileResponseSchema = z16.object({ profile: agentProfileSchema });
2135
- var updateAgentProfileInputSchema = z16.object({
2136
- label: z16.string().trim().max(200).optional(),
2137
- configDir: z16.string().trim().min(1).max(4096).optional()
2210
+ var agentProfileResponseSchema = z17.object({ profile: agentProfileSchema });
2211
+ var updateAgentProfileInputSchema = z17.object({
2212
+ label: z17.string().trim().max(200).optional(),
2213
+ configDir: z17.string().trim().min(1).max(4096).optional()
2138
2214
  });
2139
- var removeAgentProfileResponseSchema = z16.object({
2140
- removed: z16.literal(true),
2141
- id: z16.string()
2215
+ var removeAgentProfileResponseSchema = z17.object({
2216
+ removed: z17.literal(true),
2217
+ id: z17.string()
2142
2218
  });
2143
2219
 
2144
2220
  // ../contract/src/automations.ts
2145
- import { z as z17 } from "zod";
2146
- var automationEventSchema = z17.enum([
2221
+ import { z as z18 } from "zod";
2222
+ var automationEventSchema = z18.enum([
2147
2223
  "pull_request.opened",
2148
2224
  "issue.opened",
2149
2225
  "issue.labeled",
2150
2226
  "issue.unlabeled"
2151
2227
  ]);
2152
- var automationFiltersSchema = z17.object({
2153
- authors: z17.array(z17.string()).optional(),
2154
- assignees: z17.array(z17.string()).optional(),
2155
- allLabels: z17.array(z17.string()).optional(),
2156
- anyLabels: z17.array(z17.string()).optional(),
2157
- excludeLabels: z17.array(z17.string()).optional(),
2228
+ var automationFiltersSchema = z18.object({
2229
+ authors: z18.array(z18.string()).optional(),
2230
+ assignees: z18.array(z18.string()).optional(),
2231
+ allLabels: z18.array(z18.string()).optional(),
2232
+ anyLabels: z18.array(z18.string()).optional(),
2233
+ excludeLabels: z18.array(z18.string()).optional(),
2158
2234
  /** Required for the two label events — the server rejects a definition without it. */
2159
- changedLabels: z17.array(z17.string()).optional(),
2160
- lookbackDays: z17.number(),
2161
- maxRecords: z17.number()
2235
+ changedLabels: z18.array(z18.string()).optional(),
2236
+ lookbackDays: z18.number(),
2237
+ maxRecords: z18.number()
2162
2238
  });
2163
2239
  var automationTaskSchema = createRunInputBaseSchema.omit({ task: true, images: true, todoId: true, systemPrompt: true }).extend({
2164
2240
  /** The prompt template. `{{github.number}}`, `{{github.title}}`, `{{github.url}}` and
2165
2241
  * `{{github.labels}}` are substituted per match; GitHub content is appended as untrusted
2166
2242
  * context, never interpolated into instructions. */
2167
- prompt: z17.string(),
2168
- variants: z17.union([z17.literal(1), z17.literal(2), z17.literal(3)]).optional(),
2169
- systemPrompt: z17.string().optional()
2243
+ prompt: z18.string(),
2244
+ variants: z18.union([z18.literal(1), z18.literal(2), z18.literal(3)]).optional(),
2245
+ systemPrompt: z18.string().optional()
2170
2246
  });
2171
- var automationDefinitionSchema = z17.object({
2172
- id: z17.string(),
2247
+ var automationDefinitionSchema = z18.object({
2248
+ id: z18.string(),
2173
2249
  /** Bumped on every edit; a PUT must echo the revision it read (optimistic concurrency). */
2174
- revision: z17.number(),
2175
- name: z17.string(),
2176
- description: z17.string().optional(),
2250
+ revision: z18.number(),
2251
+ name: z18.string(),
2252
+ description: z18.string().optional(),
2177
2253
  /** Always present: the storage schema defaults it to `false`, so a definition is created
2178
2254
  * PAUSED and enabling it is a separate, baseline-establishing act. */
2179
- enabled: z17.boolean(),
2180
- events: z17.array(automationEventSchema),
2181
- intervalSeconds: z17.number(),
2255
+ enabled: z18.boolean(),
2256
+ events: z18.array(automationEventSchema),
2257
+ intervalSeconds: z18.number(),
2182
2258
  filters: automationFiltersSchema,
2183
2259
  task: automationTaskSchema,
2184
- createdAt: z17.string(),
2185
- updatedAt: z17.string()
2260
+ createdAt: z18.string(),
2261
+ updatedAt: z18.string()
2186
2262
  });
2187
- var automationCursorSchema = z17.object({
2188
- timestamp: z17.string(),
2189
- tieBreaker: z17.string().optional()
2263
+ var automationCursorSchema = z18.object({
2264
+ timestamp: z18.string(),
2265
+ tieBreaker: z18.string().optional()
2190
2266
  });
2191
- var automationRuntimeStateSchema = z17.object({
2267
+ var automationRuntimeStateSchema = z18.object({
2192
2268
  /** The definition revision this state belongs to; a bumped revision re-baselines. */
2193
- revision: z17.number().optional(),
2269
+ revision: z18.number().optional(),
2194
2270
  /** Enabling establishes a CURRENT-TIME baseline: records older than this never launch. */
2195
- baselineAt: z17.string().optional(),
2271
+ baselineAt: z18.string().optional(),
2196
2272
  cursor: automationCursorSchema.optional(),
2197
- frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z17.string() }).optional(),
2198
- backlogAfter: automationCursorSchema.extend({ tieBreaker: z17.string() }).optional(),
2199
- nextCheckAt: z17.string().optional(),
2200
- lastSuccessAt: z17.string().optional(),
2273
+ frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z18.string() }).optional(),
2274
+ backlogAfter: automationCursorSchema.extend({ tieBreaker: z18.string() }).optional(),
2275
+ nextCheckAt: z18.string().optional(),
2276
+ lastSuccessAt: z18.string().optional(),
2201
2277
  /** Per-query GitHub ETags, so an unchanged page costs no rate-limit budget. */
2202
- etags: z17.record(z17.string(), z17.string()).optional(),
2203
- backoffUntil: z17.string().optional(),
2204
- consecutiveFailures: z17.number().optional()
2278
+ etags: z18.record(z18.string(), z18.string()).optional(),
2279
+ backoffUntil: z18.string().optional(),
2280
+ consecutiveFailures: z18.number().optional()
2205
2281
  });
2206
- var automationLogResultSchema = z17.enum([
2282
+ var automationLogResultSchema = z18.enum([
2207
2283
  "launched",
2208
2284
  "no-match",
2209
2285
  "duplicate",
@@ -2212,82 +2288,117 @@ var automationLogResultSchema = z17.enum([
2212
2288
  "baseline",
2213
2289
  "preview"
2214
2290
  ]);
2215
- var automationLogRecordSchema = z17.object({
2216
- seq: z17.number(),
2217
- ts: z17.string(),
2218
- automationId: z17.string(),
2219
- revision: z17.number(),
2291
+ var automationLogRecordSchema = z18.object({
2292
+ seq: z18.number(),
2293
+ ts: z18.string(),
2294
+ automationId: z18.string(),
2295
+ revision: z18.number(),
2220
2296
  event: automationEventSchema.optional(),
2221
2297
  result: automationLogResultSchema,
2222
- reason: z17.string().optional(),
2223
- durationMs: z17.number().optional(),
2224
- receiptId: z17.string().optional(),
2225
- runId: z17.string().optional(),
2226
- githubNumber: z17.number().optional(),
2227
- githubTitle: z17.string().optional(),
2228
- githubUrl: z17.string().optional(),
2229
- rateLimit: z17.object({
2230
- bucket: z17.enum(["core", "search"]),
2231
- remaining: z17.number().optional(),
2232
- resetAt: z17.string().optional()
2298
+ reason: z18.string().optional(),
2299
+ durationMs: z18.number().optional(),
2300
+ receiptId: z18.string().optional(),
2301
+ runId: z18.string().optional(),
2302
+ githubNumber: z18.number().optional(),
2303
+ githubTitle: z18.string().optional(),
2304
+ githubUrl: z18.string().optional(),
2305
+ rateLimit: z18.object({
2306
+ bucket: z18.enum(["core", "search"]),
2307
+ remaining: z18.number().optional(),
2308
+ resetAt: z18.string().optional()
2233
2309
  }).optional()
2234
2310
  });
2235
- var automationCountsSchema = z17.object({
2236
- matches: z17.number(),
2237
- launched: z17.number(),
2238
- duplicates: z17.number(),
2239
- errors: z17.number()
2311
+ var automationCountsSchema = z18.object({
2312
+ matches: z18.number(),
2313
+ launched: z18.number(),
2314
+ duplicates: z18.number(),
2315
+ errors: z18.number()
2240
2316
  });
2241
2317
  var automationListEntrySchema = automationDefinitionSchema.extend({
2242
2318
  state: automationRuntimeStateSchema.optional(),
2243
2319
  latestLog: automationLogRecordSchema.optional(),
2244
2320
  counts: automationCountsSchema
2245
2321
  });
2246
- var automationsResponseSchema = z17.object({
2247
- available: z17.boolean(),
2248
- reason: z17.string().optional(),
2249
- scheduler: z17.object({
2250
- state: z17.enum(["scheduled", "idle"]),
2251
- nextDue: z17.string().optional()
2322
+ var automationsResponseSchema = z18.object({
2323
+ available: z18.boolean(),
2324
+ reason: z18.string().optional(),
2325
+ scheduler: z18.object({
2326
+ state: z18.enum(["scheduled", "idle"]),
2327
+ nextDue: z18.string().optional()
2252
2328
  }),
2253
- automations: z17.array(automationListEntrySchema)
2329
+ automations: z18.array(automationListEntrySchema)
2254
2330
  });
2255
- var automationResponseSchema = z17.object({ automation: automationDefinitionSchema });
2256
- var automationDetailResponseSchema = z17.object({
2331
+ var automationResponseSchema = z18.object({ automation: automationDefinitionSchema });
2332
+ var automationDetailResponseSchema = z18.object({
2257
2333
  automation: automationDefinitionSchema,
2258
2334
  state: automationRuntimeStateSchema.optional(),
2259
2335
  latestLog: automationLogRecordSchema.optional()
2260
2336
  });
2261
- var automationCheckSchema = z17.object({
2262
- id: z17.string(),
2263
- automationId: z17.string(),
2264
- mode: z17.enum(["preview", "execute"]),
2265
- status: z17.enum(["queued", "running", "complete", "error"]),
2266
- createdAt: z17.string(),
2267
- completedAt: z17.string().optional(),
2268
- matches: z17.number().optional(),
2269
- truncated: z17.boolean().optional(),
2270
- error: z17.string().optional()
2271
- });
2272
- var automationCheckQueuedResponseSchema = z17.object({ checkId: z17.string() });
2273
- var automationLogResponseSchema = z17.object({
2274
- records: z17.array(automationLogRecordSchema)
2275
- });
2276
- var automationRetryResponseSchema = z17.object({
2277
- receiptId: z17.string(),
2278
- runId: z17.string()
2279
- });
2280
- var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true }).extend({ enable: z17.boolean().optional() });
2337
+ var automationCheckSchema = z18.object({
2338
+ id: z18.string(),
2339
+ automationId: z18.string(),
2340
+ mode: z18.enum(["preview", "execute"]),
2341
+ status: z18.enum(["queued", "running", "complete", "error"]),
2342
+ createdAt: z18.string(),
2343
+ completedAt: z18.string().optional(),
2344
+ matches: z18.number().optional(),
2345
+ truncated: z18.boolean().optional(),
2346
+ error: z18.string().optional()
2347
+ });
2348
+ var automationCheckQueuedResponseSchema = z18.object({ checkId: z18.string() });
2349
+ var automationLogResponseSchema = z18.object({
2350
+ records: z18.array(automationLogRecordSchema)
2351
+ });
2352
+ var automationRetryResponseSchema = z18.object({
2353
+ receiptId: z18.string(),
2354
+ runId: z18.string()
2355
+ });
2356
+ var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true }).extend({ enable: z18.boolean().optional() });
2281
2357
  var updateAutomationInputSchema = createAutomationInputSchema.omit({ enable: true }).extend({
2282
- enabled: z17.boolean().optional(),
2283
- expectedRevision: z17.number()
2358
+ enabled: z18.boolean().optional(),
2359
+ expectedRevision: z18.number()
2284
2360
  });
2285
- var automationCheckInputSchema = z17.object({
2286
- mode: z17.enum(["preview", "execute"])
2361
+ var automationCheckInputSchema = z18.object({
2362
+ mode: z18.enum(["preview", "execute"])
2287
2363
  });
2364
+
2365
+ // ../contract/src/artifacts.ts
2366
+ import { z as z19 } from "zod";
2367
+ var pathSchema = z19.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
2368
+ var publishedArtifactSchema = z19.object({
2369
+ id: z19.uuid(),
2370
+ runId: z19.uuid(),
2371
+ name: z19.string().min(1).max(255),
2372
+ sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
2373
+ createdAt: z19.iso.datetime(),
2374
+ size: z19.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
2375
+ sha256: z19.string().regex(/^[a-f0-9]{64}$/)
2376
+ }).strict();
2377
+ var filePreviewDataSchema = z19.object({
2378
+ type: z19.literal("file"),
2379
+ path: pathSchema,
2380
+ size: z19.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
2381
+ binary: z19.boolean(),
2382
+ tooLarge: z19.boolean(),
2383
+ content: z19.string().optional(),
2384
+ source: z19.enum(["worktree", "project", "artifact"]),
2385
+ artifact: publishedArtifactSchema.optional()
2386
+ }).strict();
2387
+ var fileLinkResultSchema = z19.union([
2388
+ filePreviewDataSchema,
2389
+ z19.object({
2390
+ type: z19.enum(["unavailable", "unpublished"]),
2391
+ path: pathSchema,
2392
+ reason: z19.string().min(1).max(4096)
2393
+ }).strict()
2394
+ ]);
2395
+ var artifactListSchema = z19.object({ artifacts: z19.array(publishedArtifactSchema).max(64) }).strict();
2396
+ var fileLinkQuerySchema = z19.object({ path: pathSchema, raw: z19.literal("1").optional() }).strict();
2397
+ var artifactParamsSchema = z19.object({ id: z19.uuid(), artifactId: z19.uuid() });
2288
2398
  export {
2289
2399
  CI_WAIT_LIMITATION,
2290
2400
  CI_WAIT_RECEIPT_INSTRUCTION,
2401
+ CLIENT_REQUEST_VARIANTS_ERROR,
2291
2402
  DEFAULT_AGENT_ACCOUNT_ID,
2292
2403
  EFFORT_LEVELS,
2293
2404
  FILE_ATTACHMENT_MEDIA_TYPES,
@@ -2317,7 +2428,12 @@ export {
2317
2428
  agentProfileSelectionsResponseSchema,
2318
2429
  agentProfilesResponseSchema,
2319
2430
  apiRunSchema,
2431
+ applicationUpdateInputSchema,
2432
+ applicationUpdateResponseSchema,
2433
+ applicationUpdateStateSchema,
2320
2434
  archiveFinishedResponseSchema,
2435
+ artifactListSchema,
2436
+ artifactParamsSchema,
2321
2437
  askOptionSchema,
2322
2438
  askQuestionSchema,
2323
2439
  askRequestSchema,
@@ -2365,6 +2481,7 @@ export {
2365
2481
  conversationAttributionSchema,
2366
2482
  conversationCancelRequestSchema,
2367
2483
  conversationInspectRequestSchema,
2484
+ conversationInspectResultSchema,
2368
2485
  conversationMessageEventSchema,
2369
2486
  conversationMessageSchema,
2370
2487
  conversationSendRequestSchema,
@@ -2384,6 +2501,9 @@ export {
2384
2501
  editQueuedMessageResponseSchema,
2385
2502
  effortFieldSchema,
2386
2503
  effortLevelSchema,
2504
+ fileLinkQuerySchema,
2505
+ fileLinkResultSchema,
2506
+ filePreviewDataSchema,
2387
2507
  finishResponseSchema,
2388
2508
  forgeInfoSchema,
2389
2509
  fsBrowseDirSchema,
@@ -2414,6 +2534,10 @@ export {
2414
2534
  humanInputDeliveredEventSchema,
2415
2535
  imageInputSchema,
2416
2536
  importableSkillSchema,
2537
+ inboxClaimSchema,
2538
+ inboxReceiptRequestSchema,
2539
+ inboxReceiptResultSchema,
2540
+ inboxReserveResultSchema,
2417
2541
  isAttachmentMediaType,
2418
2542
  isImageAttachmentName,
2419
2543
  isImageMediaType,
@@ -2446,6 +2570,7 @@ export {
2446
2570
  providerStatusResponseSchema,
2447
2571
  providerStatusSchema,
2448
2572
  providersRequiredByWorkflow,
2573
+ publishedArtifactSchema,
2449
2574
  queuedMessageSchema,
2450
2575
  reclaimWorktreesResponseSchema,
2451
2576
  referenceStatusSchema,
@@ -2531,6 +2656,8 @@ export {
2531
2656
  workerOutcomeEventSchema,
2532
2657
  workerOutcomeSchema,
2533
2658
  workerParamsSchema,
2659
+ workerQuestionFallbackEventSchema,
2660
+ workerQuestionRoutedEventSchema,
2534
2661
  workerResultFileSchema,
2535
2662
  workerResultReferenceSchema,
2536
2663
  workerSpawnRequestSchema,