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