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