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