@wjarka/cezarion 0.14.7-pr488.741 → 0.14.8-dev.817

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