@hearsay-tools/squawk 0.18.0-dev.8468 → 0.18.0-dev.8489
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/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +866 -804
- package/dist/contract/session-context.d.ts +94 -0
- package/dist/contract/utf8.d.ts +2 -0
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/runs/run-exits.d.ts +336 -336
- package/dist/server/server.d.ts +843 -681
- package/dist/server/server.js +3 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/session-context-routes.d.ts +88 -0
- package/dist/server/session-context-routes.js +26 -0
- package/dist/server/session-context-routes.js.map +1 -0
- package/dist/session-context-file.d.ts +11 -0
- package/dist/session-context-file.js +144 -0
- package/dist/session-context-file.js.map +1 -0
- package/dist/session-context.d.ts +48 -0
- package/dist/session-context.js +180 -19
- package/dist/session-context.js.map +1 -1
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/dist/workflows/run/wait-kinds.d.ts +52 -52
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-CuihHvuE.js +1 -0
- package/web/dist/assets/activity-motion-bKmIl_Ai.js +2 -0
- package/web/dist/assets/{activity-route-BAGYVlk1.js → activity-route-Bnz_NdUs.js} +1 -1
- package/web/dist/assets/agent-config-section-uQrQrvBR.js +1 -0
- package/web/dist/assets/agent-defaults-section-1UTSo5HV.js +1 -0
- package/web/dist/assets/{appearance-Bbmz3RPP.js → appearance-CZ0kce28.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BHtW_R72.js → archive-on-merge-field-CEyCpweg.js} +1 -1
- package/web/dist/assets/attention-BFUaj1mU.js +1 -0
- package/web/dist/assets/automations-route-Dq90emTh.js +1 -0
- package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
- package/web/dist/assets/{commit-diff-panel-CR9lCdYd.js → commit-diff-panel-Btc38N2Q.js} +1 -1
- package/web/dist/assets/{diff-BUihlcHW.js → diff-C3-63Zgu.js} +2 -2
- package/web/dist/assets/{diff-view-Dy1iZUpI.js → diff-view-D2O2Nm5P.js} +1 -1
- package/web/dist/assets/file-preview-Bnq2OKGK.js +2 -0
- package/web/dist/assets/{folder-browser-OPEKYHN1.js → folder-browser-Bn83Rjyn.js} +1 -1
- package/web/dist/assets/{git-toolbar-CUQ8veXw.js → git-toolbar-RA8rF90D.js} +1 -1
- package/web/dist/assets/{github-ClGhwLM1.js → github-BRAMTLRU.js} +1 -1
- package/web/dist/assets/{global-activity-route-DzdSy7Wm.js → global-activity-route-Ii_-Fqqo.js} +1 -1
- package/web/dist/assets/index-2DP8fWMQ.css +1 -0
- package/web/dist/assets/index-DCw_bX8I.js +21 -0
- package/web/dist/assets/{label-Cptt_zCn.js → label-tOtTf55G.js} +1 -1
- package/web/dist/assets/{live-reads-jRSHgWlx.js → live-reads-CR3-q01w.js} +1 -1
- package/web/dist/assets/{markdown-DvutydYG.js → markdown-G8tjpJd_.js} +1 -1
- package/web/dist/assets/{notifications-section-BAqEIyDN.js → notifications-section-Fk_ebhy_.js} +1 -1
- package/web/dist/assets/{open-in-menu-ytsrlsSn.js → open-in-menu-xzDJ4_Tv.js} +1 -1
- package/web/dist/assets/plus-CxRU2X8C.js +1 -0
- package/web/dist/assets/{preview-pane-connected-BU0pxY0y.js → preview-pane-connected-8HkdMxOW.js} +2 -2
- package/web/dist/assets/{project-location-BIWHn5XU.js → project-location-C9WLgY3A.js} +1 -1
- package/web/dist/assets/{project-router-CWwXAsqF.js → project-router-DucFIl_x.js} +1 -1
- package/web/dist/assets/{project-scope-context-Dq-Iq7xE.js → project-scope-context-C912rTJP.js} +2 -2
- package/web/dist/assets/{projects-section-DbCjlMOl.js → projects-section-Dmj4JFoi.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BsAYf057.js → prompt-templates-section-DzfD2GES.js} +1 -1
- package/web/dist/assets/queries-DRpvYgai.js +1 -0
- package/web/dist/assets/{reference-chip-D52WtrZ9.js → reference-chip-zRuFkaGy.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-Buq1mILf.js → remote-settings-notice-CYiMrnys.js} +1 -1
- package/web/dist/assets/repo-git-B3tTtvIQ.js +1 -0
- package/web/dist/assets/report-reader-DBGA_8LA.js +1 -0
- package/web/dist/assets/{reports-D-IUJk8n.js → reports-B-Q6u2X6.js} +1 -1
- package/web/dist/assets/{resources-section-CIF3uOPg.js → resources-section-C5ndEonC.js} +1 -1
- package/web/dist/assets/run-header-DK4CZ3hY.js +2 -0
- package/web/dist/assets/session-context-section-BAw6x6P2.js +119 -0
- package/web/dist/assets/{settings-agent-picker-D7x87Fza.js → settings-agent-picker-fkaIrncp.js} +1 -1
- package/web/dist/assets/settings-shell-dzuuT5tw.js +1 -0
- package/web/dist/assets/{sidebar-section-2j1dPZW-.js → sidebar-section-BIQilcgt.js} +1 -1
- package/web/dist/assets/{skills-BZQKuRIK.js → skills-C-jo20DK.js} +1 -1
- package/web/dist/assets/{tab-link-qPg641SX.js → tab-link-Bh6CcIR7.js} +1 -1
- package/web/dist/assets/{task-changes-CMCstWbh.js → task-changes-DnG-9vJh.js} +1 -1
- package/web/dist/assets/{task-commits-De5jDVRc.js → task-commits-mqs3nfjk.js} +1 -1
- package/web/dist/assets/task-files-DKB3Xp3N.js +1 -0
- package/web/dist/assets/{task-github-item-Da-J1yOO.js → task-github-item-BA7W64bU.js} +1 -1
- package/web/dist/assets/{task-groups-CZAR_voe.js → task-groups-ClNnAPRA.js} +1 -1
- package/web/dist/assets/task-thread-B8zgMgtO.js +9 -0
- package/web/dist/assets/{tasks-table-CPP0rXJp.js → tasks-table-CE_VVk0w.js} +1 -1
- package/web/dist/assets/{thread-state-q7EKE8NY.js → thread-state-8okW1FLM.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-V15iu0Vf.js → use-hand-to-agent-state-BwLk3gNd.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-D9ecHhMH.js → useInfiniteQuery-CPEWc6dl.js} +1 -1
- package/web/dist/assets/useQuery-BOEhMTCg.js +1 -0
- package/web/dist/assets/workflows-BhQJM4JW.js +7 -0
- package/web/dist/assets/{workspace-tools-BSJXB55E.js → workspace-tools-BZs10pQZ.js} +1 -1
- package/web/dist/assets/{worktrees-section-DWfvhcFw.js → worktrees-section-BTNZUVnW.js} +4 -4
- package/web/dist/index.html +15 -15
- package/web/dist/assets/accounts-section-COnLhVcc.js +0 -1
- package/web/dist/assets/activity-motion-BepAhXl7.js +0 -2
- package/web/dist/assets/agent-config-section-D3eY8kW2.js +0 -4
- package/web/dist/assets/agent-defaults-section-BxIztnP5.js +0 -1
- package/web/dist/assets/attention-CexCTxjN.js +0 -1
- package/web/dist/assets/automations-route-vO4VXsmB.js +0 -1
- package/web/dist/assets/file-preview-Cq_WJ308.js +0 -2
- package/web/dist/assets/index-8Pe4JlYM.js +0 -21
- package/web/dist/assets/index-HkNWm2JB.css +0 -1
- package/web/dist/assets/queries-Dd6O2cf-.js +0 -1
- package/web/dist/assets/repo-git-P8s3o1t9.js +0 -1
- package/web/dist/assets/report-reader-BGHRGd46.js +0 -1
- package/web/dist/assets/run-header-x8ZoTs8l.js +0 -2
- package/web/dist/assets/settings-shell-CdsAJa6b.js +0 -1
- package/web/dist/assets/task-files-BTaS-k-o.js +0 -1
- package/web/dist/assets/task-thread-A2rldNuS.js +0 -9
- package/web/dist/assets/useQuery-B0ubYnT2.js +0 -1
- package/web/dist/assets/workflows-BWde25JO.js +0 -7
package/dist/contract/index.js
CHANGED
|
@@ -1487,6 +1487,18 @@ import { z as z21 } from "zod";
|
|
|
1487
1487
|
|
|
1488
1488
|
// ../contract/src/ci-wait.ts
|
|
1489
1489
|
import { z as z20 } from "zod";
|
|
1490
|
+
|
|
1491
|
+
// ../contract/src/utf8.ts
|
|
1492
|
+
function utf8Bytes(value) {
|
|
1493
|
+
let bytes = 0;
|
|
1494
|
+
for (const char of value) {
|
|
1495
|
+
const point = char.codePointAt(0);
|
|
1496
|
+
bytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
|
|
1497
|
+
}
|
|
1498
|
+
return bytes;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
// ../contract/src/ci-wait.ts
|
|
1490
1502
|
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.";
|
|
1491
1503
|
var CI_WAIT_RECEIPT_INSTRUCTION = "End your turn to wait for CI; no marker is needed. " + CI_WAIT_LIMITATION;
|
|
1492
1504
|
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]*)$/;
|
|
@@ -1544,14 +1556,6 @@ var ciWaitErrorCodeSchema = z20.enum([
|
|
|
1544
1556
|
"turn_changed"
|
|
1545
1557
|
]);
|
|
1546
1558
|
var ciWaitErrorSchema = z20.object({ code: ciWaitErrorCodeSchema, message: z20.string().max(4096) }).strict();
|
|
1547
|
-
function utf8Bytes(value) {
|
|
1548
|
-
let bytes = 0;
|
|
1549
|
-
for (const char of value) {
|
|
1550
|
-
const point = char.codePointAt(0);
|
|
1551
|
-
bytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
|
|
1552
|
-
}
|
|
1553
|
-
return bytes;
|
|
1554
|
-
}
|
|
1555
1559
|
var mergeBlockSchema = z20.object({
|
|
1556
1560
|
reason: z20.enum(["conflict", "no_pending_merge"]),
|
|
1557
1561
|
isInMergeQueue: z20.boolean(),
|
|
@@ -4012,27 +4016,77 @@ var setAgentConfigInputSchema = z30.object({
|
|
|
4012
4016
|
version: z30.string().nullable()
|
|
4013
4017
|
});
|
|
4014
4018
|
|
|
4015
|
-
// ../contract/src/
|
|
4019
|
+
// ../contract/src/session-context.ts
|
|
4016
4020
|
import { z as z31 } from "zod";
|
|
4021
|
+
var SESSION_CONTEXT_FILE_MAX_BYTES = 256 * 1024;
|
|
4022
|
+
var fileContentSchema = z31.string().refine((text) => utf8Bytes(text) <= SESSION_CONTEXT_FILE_MAX_BYTES, {
|
|
4023
|
+
error: `context.yaml must be at most ${SESSION_CONTEXT_FILE_MAX_BYTES} bytes`
|
|
4024
|
+
});
|
|
4025
|
+
var sessionContextFileSchema = z31.object({
|
|
4026
|
+
/** Relative to the project root: `.ai/squawk/context.yaml` or `.ai/cezar/context.yaml`. */
|
|
4027
|
+
path: z31.string(),
|
|
4028
|
+
exists: z31.boolean(),
|
|
4029
|
+
content: z31.string(),
|
|
4030
|
+
/** sha256 of the bytes, or null when the file does not exist. */
|
|
4031
|
+
version: z31.string().nullable(),
|
|
4032
|
+
/** False when the file cannot be read as text, or lives in read-only fallback project data. */
|
|
4033
|
+
writable: z31.boolean(),
|
|
4034
|
+
readOnlyReason: z31.string().nullable()
|
|
4035
|
+
});
|
|
4036
|
+
var setSessionContextSchema = z31.object({
|
|
4037
|
+
content: fileContentSchema,
|
|
4038
|
+
version: z31.string().nullable()
|
|
4039
|
+
});
|
|
4040
|
+
var sessionContextRoleSchema = z31.enum(["parent", "worker"]);
|
|
4041
|
+
var sessionContextPreviewRequestSchema = z31.object({
|
|
4042
|
+
content: fileContentSchema,
|
|
4043
|
+
role: sessionContextRoleSchema
|
|
4044
|
+
});
|
|
4045
|
+
var sessionContextProblemSchema = z31.object({
|
|
4046
|
+
line: z31.number().nullable(),
|
|
4047
|
+
rule: z31.number().nullable(),
|
|
4048
|
+
message: z31.string()
|
|
4049
|
+
});
|
|
4050
|
+
var sessionContextPreviewBlockSchema = z31.object({
|
|
4051
|
+
id: z31.string(),
|
|
4052
|
+
/** `built-in` for the handoff block; null when the file names no target for the entry. */
|
|
4053
|
+
target: z31.enum(["built-in", "parent", "worker", "both"]).nullable(),
|
|
4054
|
+
status: z31.enum(["applied", "skipped", "not-for-role"]),
|
|
4055
|
+
bytes: z31.number().nullable(),
|
|
4056
|
+
reason: z31.string().nullable(),
|
|
4057
|
+
sources: z31.array(z31.string()),
|
|
4058
|
+
/** The rendered text, cut short for the preview; null when nothing rendered. */
|
|
4059
|
+
text: z31.string().nullable(),
|
|
4060
|
+
truncated: z31.boolean()
|
|
4061
|
+
});
|
|
4062
|
+
var sessionContextPreviewSchema = z31.object({
|
|
4063
|
+
problems: z31.array(sessionContextProblemSchema),
|
|
4064
|
+
blocks: z31.array(sessionContextPreviewBlockSchema),
|
|
4065
|
+
usedBytes: z31.number(),
|
|
4066
|
+
limitBytes: z31.number()
|
|
4067
|
+
});
|
|
4068
|
+
|
|
4069
|
+
// ../contract/src/agent-profiles.ts
|
|
4070
|
+
import { z as z32 } from "zod";
|
|
4017
4071
|
var DEFAULT_AGENT_ACCOUNT_ID = "default";
|
|
4018
|
-
var agentProfileSchema =
|
|
4072
|
+
var agentProfileSchema = z32.object({
|
|
4019
4073
|
/** `default` for the discovered profile, else the stored slug. */
|
|
4020
|
-
id:
|
|
4074
|
+
id: z32.string(),
|
|
4021
4075
|
provider: providerIdSchema,
|
|
4022
|
-
label:
|
|
4076
|
+
label: z32.string(),
|
|
4023
4077
|
/** As the user wrote it — a literal `~` is preserved, matching `browseRoot`/`projectsDir`.
|
|
4024
4078
|
* Omitted on a remote cockpit without `settingsAdmin` so host paths are not disclosed. */
|
|
4025
|
-
configDir:
|
|
4079
|
+
configDir: z32.string().optional(),
|
|
4026
4080
|
/** Expanded absolute path. Omitted on a remote cockpit without `settingsAdmin`. */
|
|
4027
|
-
path:
|
|
4081
|
+
path: z32.string().optional(),
|
|
4028
4082
|
/** False for a dir the CLI has not created yet — legitimate, and NOT a reason to fall back
|
|
4029
4083
|
* to another account at run time (that would silently bill the wrong subscription). */
|
|
4030
|
-
exists:
|
|
4084
|
+
exists: z32.boolean(),
|
|
4031
4085
|
/** Whether the dir carries this agent's own marker files. ADVISORY: an unrecognised dir is
|
|
4032
4086
|
* still accepted, because "add profile → Connect → the CLI creates it" is the real flow. */
|
|
4033
|
-
looksValid:
|
|
4087
|
+
looksValid: z32.boolean(),
|
|
4034
4088
|
/** True for the profile Squawk discovers from the environment. Never stored, never deletable. */
|
|
4035
|
-
isDefault:
|
|
4089
|
+
isDefault: z32.boolean(),
|
|
4036
4090
|
/** This account's own authentication state — two Claude logins answer independently.
|
|
4037
4091
|
*
|
|
4038
4092
|
* **Absent until the probe has warmed.** Every probe shells out to an agent CLI, and this
|
|
@@ -4046,49 +4100,49 @@ function agentAccountRouteId(profile) {
|
|
|
4046
4100
|
return profile.isDefault ? `default:${profile.provider}` : profile.id;
|
|
4047
4101
|
}
|
|
4048
4102
|
var agentAccountSelectionSchema = perRunnerOptionalStrings();
|
|
4049
|
-
var agentProfilesResponseSchema =
|
|
4050
|
-
editable:
|
|
4051
|
-
profiles:
|
|
4103
|
+
var agentProfilesResponseSchema = z32.object({
|
|
4104
|
+
editable: z32.boolean(),
|
|
4105
|
+
profiles: z32.array(agentProfileSchema),
|
|
4052
4106
|
/** Providers that can carry more than one account at all — what "Add account" is offered for.
|
|
4053
4107
|
* OpenCode and omp are absent: no folder variable moves their credentials, so a config-dir
|
|
4054
4108
|
* profile would swap settings while still billing the other account. */
|
|
4055
|
-
profileCapableProviders:
|
|
4109
|
+
profileCapableProviders: z32.array(providerIdSchema),
|
|
4056
4110
|
/** Which account each project uses, keyed by the project's realpath'd ROOT.
|
|
4057
4111
|
*
|
|
4058
4112
|
* Served here rather than on `GET /api/v1/projects` because it is stored beside the accounts it
|
|
4059
4113
|
* names (`~/.cezar/agent-accounts.json`) — one file, so deleting an account and scrubbing every
|
|
4060
4114
|
* reference to it is one atomic write, and neither can be dropped by a Squawk version that never
|
|
4061
4115
|
* heard of accounts. Empty without `settingsAdmin` so host paths are not disclosed. */
|
|
4062
|
-
selections:
|
|
4116
|
+
selections: z32.record(z32.string(), agentAccountSelectionSchema),
|
|
4063
4117
|
/** Which account each project uses, keyed by canonical project id (plus `'default'` for the boot
|
|
4064
4118
|
* project). Always populated without disclosing host filesystem paths. */
|
|
4065
|
-
projectSelections:
|
|
4119
|
+
projectSelections: z32.record(z32.string(), agentAccountSelectionSchema)
|
|
4066
4120
|
});
|
|
4067
|
-
var selectAgentProfileInputSchema =
|
|
4121
|
+
var selectAgentProfileInputSchema = z32.object({
|
|
4068
4122
|
/** Registry slug, or the reserved `default` boot alias. Resolved to a root server-side. */
|
|
4069
|
-
projectId:
|
|
4123
|
+
projectId: z32.string().min(1).max(64),
|
|
4070
4124
|
provider: providerIdSchema,
|
|
4071
|
-
profileId:
|
|
4125
|
+
profileId: z32.string().max(64).nullable()
|
|
4072
4126
|
});
|
|
4073
|
-
var agentProfileSelectionsResponseSchema =
|
|
4074
|
-
selections:
|
|
4075
|
-
projectSelections:
|
|
4127
|
+
var agentProfileSelectionsResponseSchema = z32.object({
|
|
4128
|
+
selections: z32.record(z32.string(), agentAccountSelectionSchema),
|
|
4129
|
+
projectSelections: z32.record(z32.string(), agentAccountSelectionSchema)
|
|
4076
4130
|
});
|
|
4077
|
-
var agentAccountStatusResponseSchema =
|
|
4078
|
-
var createAgentProfileInputSchema =
|
|
4131
|
+
var agentAccountStatusResponseSchema = z32.object({ status: providerStatusSchema });
|
|
4132
|
+
var createAgentProfileInputSchema = z32.object({
|
|
4079
4133
|
provider: providerIdSchema,
|
|
4080
|
-
label:
|
|
4134
|
+
label: z32.string().trim().max(200).optional(),
|
|
4081
4135
|
/** Stored as written; validated absolute after `~` expansion, server-side. */
|
|
4082
|
-
configDir:
|
|
4136
|
+
configDir: z32.string().trim().min(1).max(4096)
|
|
4083
4137
|
});
|
|
4084
|
-
var agentProfileResponseSchema =
|
|
4085
|
-
var updateAgentProfileInputSchema =
|
|
4086
|
-
label:
|
|
4087
|
-
configDir:
|
|
4138
|
+
var agentProfileResponseSchema = z32.object({ profile: agentProfileSchema });
|
|
4139
|
+
var updateAgentProfileInputSchema = z32.object({
|
|
4140
|
+
label: z32.string().trim().max(200).optional(),
|
|
4141
|
+
configDir: z32.string().trim().min(1).max(4096).optional()
|
|
4088
4142
|
});
|
|
4089
|
-
var removeAgentProfileResponseSchema =
|
|
4090
|
-
removed:
|
|
4091
|
-
id:
|
|
4143
|
+
var removeAgentProfileResponseSchema = z32.object({
|
|
4144
|
+
removed: z32.literal(true),
|
|
4145
|
+
id: z32.string()
|
|
4092
4146
|
});
|
|
4093
4147
|
|
|
4094
4148
|
// ../contract/src/zoned-time.ts
|
|
@@ -4171,7 +4225,7 @@ function localTimeZone() {
|
|
|
4171
4225
|
}
|
|
4172
4226
|
|
|
4173
4227
|
// ../contract/src/automation-schedule.ts
|
|
4174
|
-
import { z as
|
|
4228
|
+
import { z as z33 } from "zod";
|
|
4175
4229
|
var SCHEDULE_TYPES = ["daily", "weekdays", "weekly", "hours", "once"];
|
|
4176
4230
|
var SCHEDULE_HOURS_OPTIONS = [1, 2, 3, 4, 6, 8, 12];
|
|
4177
4231
|
var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
@@ -4182,34 +4236,34 @@ var ONCE_AT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
|
4182
4236
|
var REPEATING_KEYS = ["hour", "minute", "day", "every"];
|
|
4183
4237
|
var ONCE_KEYS = ["at", "timeZone", "latestStartMinutes"];
|
|
4184
4238
|
var ONCE_PAST_DUE_MESSAGE = "the due time has passed; choose a later time or use Run now";
|
|
4185
|
-
var onceStatusSchema =
|
|
4239
|
+
var onceStatusSchema = z33.enum(["paused", "waiting", "failed", "missed", "archived"]);
|
|
4186
4240
|
function unknownTimeZoneMessage(zone) {
|
|
4187
4241
|
return `unknown time zone "${zone}"; use an IANA name such as Europe/Warsaw`;
|
|
4188
4242
|
}
|
|
4189
|
-
var automationScheduleSchema =
|
|
4190
|
-
type:
|
|
4243
|
+
var automationScheduleSchema = z33.object({
|
|
4244
|
+
type: z33.enum(SCHEDULE_TYPES),
|
|
4191
4245
|
/** 0–23; `daily`, `weekdays`, `weekly`. Default 4. */
|
|
4192
|
-
hour:
|
|
4246
|
+
hour: z33.number().int().min(0).max(23).optional(),
|
|
4193
4247
|
/** 0–59; `daily`, `weekdays`, `weekly`. Default 0. */
|
|
4194
|
-
minute:
|
|
4248
|
+
minute: z33.number().int().min(0).max(59).optional(),
|
|
4195
4249
|
/** ISO weekday, Monday = 1 … Sunday = 7; `weekly`. Default 1. */
|
|
4196
|
-
day:
|
|
4250
|
+
day: z33.number().int().min(1).max(7).optional(),
|
|
4197
4251
|
/** Hours between runs, from 00:00; `hours`. Default 6. */
|
|
4198
|
-
every:
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4252
|
+
every: z33.union([
|
|
4253
|
+
z33.literal(1),
|
|
4254
|
+
z33.literal(2),
|
|
4255
|
+
z33.literal(3),
|
|
4256
|
+
z33.literal(4),
|
|
4257
|
+
z33.literal(6),
|
|
4258
|
+
z33.literal(8),
|
|
4259
|
+
z33.literal(12)
|
|
4206
4260
|
]).optional(),
|
|
4207
4261
|
/** `once`: the local wall time `YYYY-MM-DDTHH:MM` in `timeZone`. */
|
|
4208
|
-
at:
|
|
4262
|
+
at: z33.string().regex(ONCE_AT_PATTERN, "at must be YYYY-MM-DDTHH:MM").optional(),
|
|
4209
4263
|
/** `once`: the IANA zone `at` is read in. Required there, refused on the repeating shapes. */
|
|
4210
|
-
timeZone:
|
|
4264
|
+
timeZone: z33.string().optional(),
|
|
4211
4265
|
/** `once`: how late after `at` a start may still launch. Absent = no limit. */
|
|
4212
|
-
latestStartMinutes:
|
|
4266
|
+
latestStartMinutes: z33.number().int().min(ONCE_MIN_LATEST_START_MINUTES).max(ONCE_MAX_LATEST_START_MINUTES).optional()
|
|
4213
4267
|
}).superRefine((schedule, ctx) => {
|
|
4214
4268
|
const present = (key) => schedule[key] !== void 0;
|
|
4215
4269
|
const refuse = (key, message2) => ctx.addIssue({ code: "custom", path: [key], message: message2 });
|
|
@@ -4374,108 +4428,108 @@ function nextOccurrence(schedule, afterMs, timeZone) {
|
|
|
4374
4428
|
}
|
|
4375
4429
|
|
|
4376
4430
|
// ../contract/src/automations.ts
|
|
4377
|
-
import { z as
|
|
4378
|
-
var automationEventSchema =
|
|
4431
|
+
import { z as z34 } from "zod";
|
|
4432
|
+
var automationEventSchema = z34.enum([
|
|
4379
4433
|
"pull_request.opened",
|
|
4380
4434
|
"issue.opened",
|
|
4381
4435
|
"issue.labeled",
|
|
4382
4436
|
"issue.unlabeled"
|
|
4383
4437
|
]);
|
|
4384
|
-
var automationFiltersSchema =
|
|
4438
|
+
var automationFiltersSchema = z34.object({
|
|
4385
4439
|
/** Opt in to matching events before enablement, bounded by lookbackDays. Absent means false. */
|
|
4386
|
-
includeExisting:
|
|
4387
|
-
authors:
|
|
4388
|
-
assignees:
|
|
4440
|
+
includeExisting: z34.boolean().optional(),
|
|
4441
|
+
authors: z34.array(z34.string()).optional(),
|
|
4442
|
+
assignees: z34.array(z34.string()).optional(),
|
|
4389
4443
|
/** Opt-in: require an open item and matching live labels before reservation and launch. */
|
|
4390
|
-
requireCurrentLabels:
|
|
4391
|
-
allLabels:
|
|
4392
|
-
anyLabels:
|
|
4393
|
-
excludeLabels:
|
|
4444
|
+
requireCurrentLabels: z34.boolean().optional(),
|
|
4445
|
+
allLabels: z34.array(z34.string()).optional(),
|
|
4446
|
+
anyLabels: z34.array(z34.string()).optional(),
|
|
4447
|
+
excludeLabels: z34.array(z34.string()).optional(),
|
|
4394
4448
|
/** Required for the two label events — the server rejects a definition without it. */
|
|
4395
|
-
changedLabels:
|
|
4396
|
-
lookbackDays:
|
|
4397
|
-
maxRecords:
|
|
4449
|
+
changedLabels: z34.array(z34.string()).optional(),
|
|
4450
|
+
lookbackDays: z34.number(),
|
|
4451
|
+
maxRecords: z34.number()
|
|
4398
4452
|
});
|
|
4399
|
-
var automationKindSchema =
|
|
4453
|
+
var automationKindSchema = z34.enum(["github", "schedule"]);
|
|
4400
4454
|
var automationTaskSchema = createRunInputBaseSchema.omit({ task: true, images: true, systemPrompt: true }).extend({
|
|
4401
4455
|
/** The prompt template. `{{github.number}}`, `{{github.title}}`, `{{github.url}}` and
|
|
4402
4456
|
* `{{github.labels}}` are substituted per match; GitHub content is appended as untrusted
|
|
4403
4457
|
* context, never interpolated into instructions. */
|
|
4404
|
-
prompt:
|
|
4405
|
-
variants:
|
|
4406
|
-
systemPrompt:
|
|
4407
|
-
});
|
|
4408
|
-
var automationArchiveSchema =
|
|
4409
|
-
at:
|
|
4410
|
-
outcome:
|
|
4411
|
-
runId:
|
|
4412
|
-
receiptId:
|
|
4413
|
-
trigger:
|
|
4414
|
-
});
|
|
4415
|
-
var automationDefinitionSchema =
|
|
4416
|
-
id:
|
|
4458
|
+
prompt: z34.string(),
|
|
4459
|
+
variants: z34.union([z34.literal(1), z34.literal(2), z34.literal(3)]).optional(),
|
|
4460
|
+
systemPrompt: z34.string().optional()
|
|
4461
|
+
});
|
|
4462
|
+
var automationArchiveSchema = z34.object({
|
|
4463
|
+
at: z34.string(),
|
|
4464
|
+
outcome: z34.enum(["launched", "cancelled"]),
|
|
4465
|
+
runId: z34.string().optional(),
|
|
4466
|
+
receiptId: z34.string().optional(),
|
|
4467
|
+
trigger: z34.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
4468
|
+
});
|
|
4469
|
+
var automationDefinitionSchema = z34.object({
|
|
4470
|
+
id: z34.string(),
|
|
4417
4471
|
/** Bumped on every edit; a PUT must echo the revision it read (optimistic concurrency). */
|
|
4418
|
-
revision:
|
|
4419
|
-
name:
|
|
4420
|
-
description:
|
|
4472
|
+
revision: z34.number(),
|
|
4473
|
+
name: z34.string(),
|
|
4474
|
+
description: z34.string().optional(),
|
|
4421
4475
|
/** Always present: the storage schema defaults it to `false`, so a definition is created
|
|
4422
4476
|
* PAUSED and enabling it is a separate, baseline-establishing act. */
|
|
4423
|
-
enabled:
|
|
4477
|
+
enabled: z34.boolean(),
|
|
4424
4478
|
kind: automationKindSchema,
|
|
4425
4479
|
/** `github` kind: always present. `schedule` kind: absent. */
|
|
4426
|
-
events:
|
|
4427
|
-
intervalSeconds:
|
|
4480
|
+
events: z34.array(automationEventSchema).optional(),
|
|
4481
|
+
intervalSeconds: z34.number().optional(),
|
|
4428
4482
|
filters: automationFiltersSchema.optional(),
|
|
4429
4483
|
/** `schedule` kind: always present. `github` kind: absent. */
|
|
4430
4484
|
schedule: automationScheduleSchema.optional(),
|
|
4431
4485
|
task: automationTaskSchema,
|
|
4432
4486
|
/** `once` schedules only: present once its task exists or it was cancelled. */
|
|
4433
4487
|
archived: automationArchiveSchema.optional(),
|
|
4434
|
-
createdAt:
|
|
4435
|
-
updatedAt:
|
|
4436
|
-
});
|
|
4437
|
-
var automationCursorSchema =
|
|
4438
|
-
timestamp:
|
|
4439
|
-
tieBreaker:
|
|
4440
|
-
});
|
|
4441
|
-
var automationHistoryScanSchema =
|
|
4442
|
-
since:
|
|
4443
|
-
until:
|
|
4444
|
-
source:
|
|
4445
|
-
page:
|
|
4446
|
-
item:
|
|
4488
|
+
createdAt: z34.string(),
|
|
4489
|
+
updatedAt: z34.string()
|
|
4490
|
+
});
|
|
4491
|
+
var automationCursorSchema = z34.object({
|
|
4492
|
+
timestamp: z34.string(),
|
|
4493
|
+
tieBreaker: z34.string().optional()
|
|
4494
|
+
});
|
|
4495
|
+
var automationHistoryScanSchema = z34.object({
|
|
4496
|
+
since: z34.string().datetime(),
|
|
4497
|
+
until: z34.string().datetime(),
|
|
4498
|
+
source: z34.number().int().min(0).max(2),
|
|
4499
|
+
page: z34.number().int().min(1).max(10),
|
|
4500
|
+
item: z34.number().int().min(0).max(100),
|
|
4447
4501
|
// One item can contain ten pages of 100 timeline entries, independent of the new-work cap.
|
|
4448
|
-
event:
|
|
4502
|
+
event: z34.number().int().min(0).max(1e3),
|
|
4449
4503
|
cursor: automationCursorSchema.optional()
|
|
4450
4504
|
});
|
|
4451
4505
|
var AUTOMATION_LAST_ERROR_MAX = 1e3;
|
|
4452
4506
|
var automationLastErrorShape = {
|
|
4453
|
-
lastError:
|
|
4454
|
-
lastErrorAt:
|
|
4507
|
+
lastError: z34.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
|
|
4508
|
+
lastErrorAt: z34.string().datetime().optional()
|
|
4455
4509
|
};
|
|
4456
|
-
var automationRuntimeStateSchema =
|
|
4510
|
+
var automationRuntimeStateSchema = z34.object({
|
|
4457
4511
|
/** The definition revision this state belongs to; activation or history-policy changes re-arm. */
|
|
4458
|
-
revision:
|
|
4512
|
+
revision: z34.number().optional(),
|
|
4459
4513
|
/** Earliest eligible event: enablement time, or the lookback start when includeExisting is on. */
|
|
4460
|
-
baselineAt:
|
|
4514
|
+
baselineAt: z34.string().optional(),
|
|
4461
4515
|
/** When discovery was armed, independent of the historical baseline. */
|
|
4462
|
-
armedAt:
|
|
4516
|
+
armedAt: z34.string().optional(),
|
|
4463
4517
|
historyScan: automationHistoryScanSchema.optional(),
|
|
4464
4518
|
cursor: automationCursorSchema.optional(),
|
|
4465
|
-
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker:
|
|
4466
|
-
backlogAfter: automationCursorSchema.extend({ tieBreaker:
|
|
4467
|
-
nextCheckAt:
|
|
4468
|
-
lastSuccessAt:
|
|
4519
|
+
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z34.string() }).optional(),
|
|
4520
|
+
backlogAfter: automationCursorSchema.extend({ tieBreaker: z34.string() }).optional(),
|
|
4521
|
+
nextCheckAt: z34.string().optional(),
|
|
4522
|
+
lastSuccessAt: z34.string().optional(),
|
|
4469
4523
|
/** `schedule` kind: the next occurrence's instant and the last fired one's. */
|
|
4470
|
-
nextRunAt:
|
|
4471
|
-
lastRunAt:
|
|
4524
|
+
nextRunAt: z34.string().optional(),
|
|
4525
|
+
lastRunAt: z34.string().optional(),
|
|
4472
4526
|
/** Per-query GitHub ETags, so an unchanged page costs no rate-limit budget. */
|
|
4473
|
-
etags:
|
|
4474
|
-
backoffUntil:
|
|
4475
|
-
consecutiveFailures:
|
|
4527
|
+
etags: z34.record(z34.string(), z34.string()).optional(),
|
|
4528
|
+
backoffUntil: z34.string().optional(),
|
|
4529
|
+
consecutiveFailures: z34.number().optional(),
|
|
4476
4530
|
...automationLastErrorShape,
|
|
4477
4531
|
/** `once` schedules: why it stopped without a task — its launch failed, or it started past its cutoff. */
|
|
4478
|
-
onceOutcome:
|
|
4532
|
+
onceOutcome: z34.enum(["failed", "missed"]).optional()
|
|
4479
4533
|
});
|
|
4480
4534
|
var AUTOMATION_FAILURE_NOTICE_AFTER = 3;
|
|
4481
4535
|
function automationFailureNotice(state) {
|
|
@@ -4488,7 +4542,7 @@ function automationFailureNotice(state) {
|
|
|
4488
4542
|
...state.backoffUntil ? { retryAt: state.backoffUntil } : {}
|
|
4489
4543
|
};
|
|
4490
4544
|
}
|
|
4491
|
-
var automationLogResultSchema =
|
|
4545
|
+
var automationLogResultSchema = z34.enum([
|
|
4492
4546
|
"launched",
|
|
4493
4547
|
"no-match",
|
|
4494
4548
|
"duplicate",
|
|
@@ -4504,36 +4558,36 @@ var automationLogResultSchema = z33.enum([
|
|
|
4504
4558
|
// once schedule: Squawk started after its latest start, so nothing launched.
|
|
4505
4559
|
"missed"
|
|
4506
4560
|
]);
|
|
4507
|
-
var automationLogRecordSchema =
|
|
4508
|
-
seq:
|
|
4509
|
-
ts:
|
|
4510
|
-
automationId:
|
|
4511
|
-
revision:
|
|
4561
|
+
var automationLogRecordSchema = z34.object({
|
|
4562
|
+
seq: z34.number(),
|
|
4563
|
+
ts: z34.string(),
|
|
4564
|
+
automationId: z34.string(),
|
|
4565
|
+
revision: z34.number(),
|
|
4512
4566
|
event: automationEventSchema.optional(),
|
|
4513
4567
|
result: automationLogResultSchema,
|
|
4514
|
-
reason:
|
|
4515
|
-
durationMs:
|
|
4516
|
-
receiptId:
|
|
4517
|
-
runId:
|
|
4518
|
-
githubNumber:
|
|
4519
|
-
githubTitle:
|
|
4520
|
-
githubUrl:
|
|
4521
|
-
rateLimit:
|
|
4522
|
-
bucket:
|
|
4523
|
-
remaining:
|
|
4524
|
-
resetAt:
|
|
4568
|
+
reason: z34.string().optional(),
|
|
4569
|
+
durationMs: z34.number().optional(),
|
|
4570
|
+
receiptId: z34.string().optional(),
|
|
4571
|
+
runId: z34.string().optional(),
|
|
4572
|
+
githubNumber: z34.number().optional(),
|
|
4573
|
+
githubTitle: z34.string().optional(),
|
|
4574
|
+
githubUrl: z34.string().optional(),
|
|
4575
|
+
rateLimit: z34.object({
|
|
4576
|
+
bucket: z34.enum(["core", "search"]),
|
|
4577
|
+
remaining: z34.number().optional(),
|
|
4578
|
+
resetAt: z34.string().optional()
|
|
4525
4579
|
}).optional()
|
|
4526
4580
|
});
|
|
4527
|
-
var automationCountsSchema =
|
|
4581
|
+
var automationCountsSchema = z34.object({
|
|
4528
4582
|
/** GitHub candidates that matched a filter: `launched` + `duplicate` rows. */
|
|
4529
|
-
matches:
|
|
4583
|
+
matches: z34.number(),
|
|
4530
4584
|
/** Stored tasks with this automation's provenance, including each variant, finished and archived
|
|
4531
4585
|
* tasks, across all revisions. Independent of log/receipt retention; deleting a task removes it. */
|
|
4532
|
-
launched:
|
|
4586
|
+
launched: z34.number(),
|
|
4533
4587
|
/** `duplicate` rows: a match whose receipt already existed, so nothing launched. */
|
|
4534
|
-
duplicates:
|
|
4588
|
+
duplicates: z34.number(),
|
|
4535
4589
|
/** `error` and `rate-limited` rows, plus a schedule's `failed` launches. */
|
|
4536
|
-
errors:
|
|
4590
|
+
errors: z34.number()
|
|
4537
4591
|
});
|
|
4538
4592
|
var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
4539
4593
|
state: automationRuntimeStateSchema.optional(),
|
|
@@ -4541,74 +4595,74 @@ var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
|
4541
4595
|
counts: automationCountsSchema,
|
|
4542
4596
|
/** Enabled only: a schedule's armed `state.nextRunAt`, a poll's `state.nextCheckAt`. Absent
|
|
4543
4597
|
* while paused, and for a schedule the timer has not armed yet. */
|
|
4544
|
-
nextRunAt:
|
|
4598
|
+
nextRunAt: z34.string().optional(),
|
|
4545
4599
|
/** `once` schedules only. */
|
|
4546
4600
|
onceStatus: onceStatusSchema.optional()
|
|
4547
4601
|
});
|
|
4548
|
-
var automationsResponseSchema =
|
|
4549
|
-
available:
|
|
4550
|
-
reason:
|
|
4551
|
-
timeZone:
|
|
4552
|
-
scheduler:
|
|
4553
|
-
state:
|
|
4554
|
-
nextDue:
|
|
4602
|
+
var automationsResponseSchema = z34.object({
|
|
4603
|
+
available: z34.boolean(),
|
|
4604
|
+
reason: z34.string().optional(),
|
|
4605
|
+
timeZone: z34.string(),
|
|
4606
|
+
scheduler: z34.object({
|
|
4607
|
+
state: z34.enum(["scheduled", "idle"]),
|
|
4608
|
+
nextDue: z34.string().optional()
|
|
4555
4609
|
}),
|
|
4556
|
-
automations:
|
|
4610
|
+
automations: z34.array(automationListEntrySchema)
|
|
4557
4611
|
});
|
|
4558
|
-
var automationResponseSchema =
|
|
4612
|
+
var automationResponseSchema = z34.object({ automation: automationDefinitionSchema });
|
|
4559
4613
|
var automationCreateResponseSchema = automationResponseSchema.extend({
|
|
4560
|
-
once:
|
|
4614
|
+
once: z34.object({ dueAt: z34.string(), timeZone: z34.string(), resolvedInstant: z34.string(), note: z34.string() }).optional()
|
|
4561
4615
|
});
|
|
4562
|
-
var automationDetailResponseSchema =
|
|
4616
|
+
var automationDetailResponseSchema = z34.object({
|
|
4563
4617
|
automation: automationDefinitionSchema,
|
|
4564
4618
|
state: automationRuntimeStateSchema.optional(),
|
|
4565
4619
|
latestLog: automationLogRecordSchema.optional(),
|
|
4566
4620
|
/** `once` schedules only. */
|
|
4567
4621
|
onceStatus: onceStatusSchema.optional()
|
|
4568
4622
|
});
|
|
4569
|
-
var automationCheckSchema =
|
|
4570
|
-
id:
|
|
4571
|
-
automationId:
|
|
4572
|
-
mode:
|
|
4573
|
-
status:
|
|
4574
|
-
createdAt:
|
|
4575
|
-
completedAt:
|
|
4576
|
-
matches:
|
|
4577
|
-
truncated:
|
|
4578
|
-
error:
|
|
4579
|
-
});
|
|
4580
|
-
var automationCheckQueuedResponseSchema =
|
|
4581
|
-
var automationLogResponseSchema =
|
|
4582
|
-
records:
|
|
4583
|
-
});
|
|
4584
|
-
var automationRetryResponseSchema =
|
|
4585
|
-
receiptId:
|
|
4586
|
-
runId:
|
|
4587
|
-
});
|
|
4588
|
-
var automationRunResponseSchema =
|
|
4623
|
+
var automationCheckSchema = z34.object({
|
|
4624
|
+
id: z34.string(),
|
|
4625
|
+
automationId: z34.string(),
|
|
4626
|
+
mode: z34.enum(["preview", "execute"]),
|
|
4627
|
+
status: z34.enum(["queued", "running", "complete", "error"]),
|
|
4628
|
+
createdAt: z34.string(),
|
|
4629
|
+
completedAt: z34.string().optional(),
|
|
4630
|
+
matches: z34.number().optional(),
|
|
4631
|
+
truncated: z34.boolean().optional(),
|
|
4632
|
+
error: z34.string().optional()
|
|
4633
|
+
});
|
|
4634
|
+
var automationCheckQueuedResponseSchema = z34.object({ checkId: z34.string() });
|
|
4635
|
+
var automationLogResponseSchema = z34.object({
|
|
4636
|
+
records: z34.array(automationLogRecordSchema)
|
|
4637
|
+
});
|
|
4638
|
+
var automationRetryResponseSchema = z34.object({
|
|
4639
|
+
receiptId: z34.string(),
|
|
4640
|
+
runId: z34.string()
|
|
4641
|
+
});
|
|
4642
|
+
var automationRunResponseSchema = z34.object({ runId: z34.string() });
|
|
4589
4643
|
var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true, kind: true, archived: true }).extend({
|
|
4590
4644
|
/** Omitted = `github` on create, the shape every pre-schedule client sends; omitted on
|
|
4591
4645
|
* update = the stored kind. */
|
|
4592
4646
|
kind: automationKindSchema.optional(),
|
|
4593
4647
|
task: automationTaskSchema.omit({ variants: true }).strict(),
|
|
4594
|
-
enable:
|
|
4648
|
+
enable: z34.boolean().optional()
|
|
4595
4649
|
});
|
|
4596
4650
|
var updateAutomationInputSchema = createAutomationInputSchema.omit({ enable: true }).extend({
|
|
4597
|
-
enabled:
|
|
4598
|
-
expectedRevision:
|
|
4651
|
+
enabled: z34.boolean().optional(),
|
|
4652
|
+
expectedRevision: z34.number()
|
|
4599
4653
|
});
|
|
4600
|
-
var automationListQuerySchema =
|
|
4601
|
-
archived:
|
|
4654
|
+
var automationListQuerySchema = z34.object({
|
|
4655
|
+
archived: z34.enum(["include", "only"]).optional()
|
|
4602
4656
|
});
|
|
4603
|
-
var automationCheckInputSchema =
|
|
4604
|
-
mode:
|
|
4657
|
+
var automationCheckInputSchema = z34.object({
|
|
4658
|
+
mode: z34.enum(["preview", "execute"])
|
|
4605
4659
|
});
|
|
4606
4660
|
|
|
4607
4661
|
// ../contract/src/scheduled-tasks.ts
|
|
4608
|
-
import { z as
|
|
4662
|
+
import { z as z35 } from "zod";
|
|
4609
4663
|
var SCHEDULED_TASK_LIMITS = { prompt: 1e5, list: 50, wireBytes: 1048576 };
|
|
4610
4664
|
var DURATION = /^(\d+)\s*([mhd])$/;
|
|
4611
|
-
var durationField =
|
|
4665
|
+
var durationField = z35.string().regex(DURATION, "a duration such as 30m, 6h or 7d");
|
|
4612
4666
|
function parseDurationMinutes(value) {
|
|
4613
4667
|
const match = DURATION.exec(value.trim());
|
|
4614
4668
|
if (!match) throw new Error(`"${value}" is not a duration; use 30m, 6h or 7d`);
|
|
@@ -4632,201 +4686,201 @@ function wallTimeAtOrAfter(targetMs, timeZone) {
|
|
|
4632
4686
|
var UTC_MINUTE_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})Z$/;
|
|
4633
4687
|
var utcMinute = (instantMs) => `${new Date(instantMs).toISOString().slice(0, 16)}Z`;
|
|
4634
4688
|
var scheduleFields = {
|
|
4635
|
-
at:
|
|
4689
|
+
at: z35.string().regex(UTC_MINUTE_PATTERN, "a UTC time YYYY-MM-DDTHH:MMZ").refine((value) => isRealOnceAt(value.slice(0, -1)), "not a real date and time").optional(),
|
|
4636
4690
|
delay: durationField.optional(),
|
|
4637
4691
|
latest_start: durationField.optional(),
|
|
4638
|
-
workflow:
|
|
4639
|
-
runner:
|
|
4640
|
-
model:
|
|
4641
|
-
effort:
|
|
4692
|
+
workflow: z35.string().trim().min(1).max(200).optional(),
|
|
4693
|
+
runner: z35.string().trim().min(1).max(32).optional(),
|
|
4694
|
+
model: z35.string().trim().min(1).max(200).optional(),
|
|
4695
|
+
effort: z35.string().trim().min(1).max(32).optional()
|
|
4642
4696
|
};
|
|
4643
4697
|
var notBoth = (value) => !(value.at && value.delay);
|
|
4644
|
-
var scheduleTaskRequestSchema =
|
|
4645
|
-
name:
|
|
4646
|
-
prompt:
|
|
4698
|
+
var scheduleTaskRequestSchema = z35.object({
|
|
4699
|
+
name: z35.string().trim().min(1).max(200),
|
|
4700
|
+
prompt: z35.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt),
|
|
4647
4701
|
...scheduleFields,
|
|
4648
|
-
enable:
|
|
4702
|
+
enable: z35.boolean().optional()
|
|
4649
4703
|
}).strict().refine(notBoth, { message: "give at or delay, not both", path: ["delay"] }).refine((value) => Boolean(value.at || value.delay), { message: "give at or delay", path: ["at"] });
|
|
4650
|
-
var idField =
|
|
4651
|
-
var scheduledTasksRequestSchema =
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
action:
|
|
4704
|
+
var idField = z35.string().min(1).max(100);
|
|
4705
|
+
var scheduledTasksRequestSchema = z35.discriminatedUnion("action", [
|
|
4706
|
+
z35.object({ action: z35.literal("list"), archived: z35.enum(["include", "only"]).optional() }).strict(),
|
|
4707
|
+
z35.object({ action: z35.literal("show"), id: idField }).strict(),
|
|
4708
|
+
z35.object({
|
|
4709
|
+
action: z35.literal("update"),
|
|
4656
4710
|
id: idField,
|
|
4657
|
-
name:
|
|
4658
|
-
prompt:
|
|
4711
|
+
name: z35.string().trim().min(1).max(200).optional(),
|
|
4712
|
+
prompt: z35.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt).optional(),
|
|
4659
4713
|
...scheduleFields
|
|
4660
4714
|
}).strict().refine(notBoth, { message: "give at or delay, not both", path: ["delay"] }),
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4715
|
+
z35.object({ action: z35.literal("pause"), id: idField }).strict(),
|
|
4716
|
+
z35.object({ action: z35.literal("enable"), id: idField }).strict(),
|
|
4717
|
+
z35.object({ action: z35.literal("cancel"), id: idField }).strict()
|
|
4664
4718
|
]);
|
|
4665
|
-
var scheduledTaskSchema =
|
|
4666
|
-
id:
|
|
4667
|
-
name:
|
|
4719
|
+
var scheduledTaskSchema = z35.object({
|
|
4720
|
+
id: z35.string(),
|
|
4721
|
+
name: z35.string(),
|
|
4668
4722
|
status: onceStatusSchema,
|
|
4669
4723
|
/** When it is due, in UTC: `YYYY-MM-DDTHH:MMZ`, the form `at` takes. */
|
|
4670
|
-
due_at:
|
|
4671
|
-
latest_start_minutes:
|
|
4724
|
+
due_at: z35.string(),
|
|
4725
|
+
latest_start_minutes: z35.number().optional(),
|
|
4672
4726
|
/** The task it launched, once archived with one. */
|
|
4673
|
-
run_id:
|
|
4727
|
+
run_id: z35.string().optional(),
|
|
4674
4728
|
/** The cockpit page of the schedule, when the cockpit's address is known. */
|
|
4675
|
-
url:
|
|
4729
|
+
url: z35.string().optional()
|
|
4676
4730
|
});
|
|
4677
|
-
var scheduledTaskRefusalCodeSchema =
|
|
4678
|
-
var refusal =
|
|
4731
|
+
var scheduledTaskRefusalCodeSchema = z35.enum(["invalid_request", "unavailable", "not_found", "conflict", "automations_off"]);
|
|
4732
|
+
var refusal = z35.object({ ok: z35.literal(false), code: scheduledTaskRefusalCodeSchema, message: z35.string() });
|
|
4679
4733
|
var SCHEDULED_TASK_NOTE = "The cockpit must be running at the due time, or start again before the latest start, for this task to launch.";
|
|
4680
|
-
var scheduleTaskAnswerSchema =
|
|
4681
|
-
|
|
4734
|
+
var scheduleTaskAnswerSchema = z35.union([
|
|
4735
|
+
z35.object({ ok: z35.literal(true), task: scheduledTaskSchema, note: z35.string() }),
|
|
4682
4736
|
refusal
|
|
4683
4737
|
]);
|
|
4684
|
-
var scheduledTasksAnswerSchema =
|
|
4685
|
-
|
|
4686
|
-
|
|
4738
|
+
var scheduledTasksAnswerSchema = z35.union([
|
|
4739
|
+
z35.object({ ok: z35.literal(true), tasks: z35.array(scheduledTaskSchema).max(SCHEDULED_TASK_LIMITS.list) }),
|
|
4740
|
+
z35.object({ ok: z35.literal(true), task: scheduledTaskSchema }),
|
|
4687
4741
|
refusal
|
|
4688
4742
|
]);
|
|
4689
4743
|
|
|
4690
4744
|
// ../contract/src/wait-tools.ts
|
|
4691
|
-
import { z as
|
|
4692
|
-
var pidSchema2 =
|
|
4745
|
+
import { z as z36 } from "zod";
|
|
4746
|
+
var pidSchema2 = z36.number().int().min(PID_MIN);
|
|
4693
4747
|
var oneModeTakesOneId = (ids, mode, ctx) => {
|
|
4694
4748
|
if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
|
|
4695
4749
|
};
|
|
4696
|
-
var waitTimeoutSeconds =
|
|
4697
|
-
var registrationFields = { operation_id:
|
|
4698
|
-
var builtInSquawkWaitRequestSchema =
|
|
4699
|
-
ciWaitRequestSchema.extend({ kind:
|
|
4700
|
-
|
|
4701
|
-
kind:
|
|
4750
|
+
var waitTimeoutSeconds = z36.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
|
|
4751
|
+
var registrationFields = { operation_id: z36.uuid().optional() };
|
|
4752
|
+
var builtInSquawkWaitRequestSchema = z36.discriminatedUnion("kind", [
|
|
4753
|
+
ciWaitRequestSchema.extend({ kind: z36.literal("pr"), ...registrationFields }).strict(),
|
|
4754
|
+
z36.object({
|
|
4755
|
+
kind: z36.literal("worker"),
|
|
4702
4756
|
...registrationFields,
|
|
4703
4757
|
worker_ids: workerIdsSchema,
|
|
4704
4758
|
mode: workerWaitModeSchema.optional(),
|
|
4705
4759
|
timeout_seconds: waitTimeoutSeconds
|
|
4706
4760
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
|
|
4707
|
-
|
|
4708
|
-
kind:
|
|
4761
|
+
z36.object({
|
|
4762
|
+
kind: z36.literal("request"),
|
|
4709
4763
|
...registrationFields,
|
|
4710
4764
|
request_ids: workerIdsSchema,
|
|
4711
4765
|
mode: workerWaitModeSchema.optional(),
|
|
4712
4766
|
timeout_seconds: waitTimeoutSeconds
|
|
4713
4767
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
|
|
4714
|
-
|
|
4715
|
-
kind:
|
|
4768
|
+
z36.object({
|
|
4769
|
+
kind: z36.literal("peer"),
|
|
4716
4770
|
...registrationFields,
|
|
4717
4771
|
peer_ids: workerIdsSchema,
|
|
4718
4772
|
timeout_seconds: waitTimeoutSeconds
|
|
4719
4773
|
}).strict(),
|
|
4720
|
-
|
|
4721
|
-
kind:
|
|
4774
|
+
z36.object({
|
|
4775
|
+
kind: z36.literal("timer"),
|
|
4722
4776
|
...registrationFields,
|
|
4723
|
-
seconds:
|
|
4724
|
-
note:
|
|
4777
|
+
seconds: z36.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
4778
|
+
note: z36.string().max(NOTE_MAX).optional()
|
|
4725
4779
|
}).strict(),
|
|
4726
|
-
|
|
4727
|
-
kind:
|
|
4780
|
+
z36.object({
|
|
4781
|
+
kind: z36.literal("process"),
|
|
4728
4782
|
...registrationFields,
|
|
4729
4783
|
pid: pidSchema2,
|
|
4730
|
-
exit_file:
|
|
4731
|
-
timeout_seconds:
|
|
4732
|
-
note:
|
|
4784
|
+
exit_file: z36.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
4785
|
+
timeout_seconds: z36.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
|
|
4786
|
+
note: z36.string().max(NOTE_MAX).optional()
|
|
4733
4787
|
}).strict()
|
|
4734
4788
|
]);
|
|
4735
4789
|
var builtInRequestKinds = /* @__PURE__ */ new Set(["pr", "worker", "request", "peer", "timer", "process"]);
|
|
4736
|
-
var pluginWaitRequestSchema =
|
|
4737
|
-
kind:
|
|
4790
|
+
var pluginWaitRequestSchema = z36.object({
|
|
4791
|
+
kind: z36.string().min(1).max(64),
|
|
4738
4792
|
...registrationFields
|
|
4739
|
-
}).catchall(
|
|
4740
|
-
var waitRequestInputSchema =
|
|
4741
|
-
var squawkWaitRequestSchema =
|
|
4793
|
+
}).catchall(z36.unknown()).refine((request) => !builtInRequestKinds.has(request.kind), { path: ["kind"], message: "built-in wait kinds require their built-in request shape" });
|
|
4794
|
+
var waitRequestInputSchema = z36.union([builtInSquawkWaitRequestSchema, pluginWaitRequestSchema]);
|
|
4795
|
+
var squawkWaitRequestSchema = z36.custom().transform((request, ctx) => {
|
|
4742
4796
|
const kind = request && typeof request === "object" && "kind" in request ? request.kind : void 0;
|
|
4743
4797
|
const schema = typeof kind === "string" && builtInRequestKinds.has(kind) ? builtInSquawkWaitRequestSchema : pluginWaitRequestSchema;
|
|
4744
4798
|
const parsed = schema.safeParse(request);
|
|
4745
4799
|
if (!parsed.success) {
|
|
4746
4800
|
for (const issue of parsed.error.issues) ctx.addIssue({ ...issue });
|
|
4747
|
-
return
|
|
4801
|
+
return z36.NEVER;
|
|
4748
4802
|
}
|
|
4749
4803
|
return parsed.data;
|
|
4750
4804
|
});
|
|
4751
|
-
var squawkCancelWaitRequestSchema =
|
|
4752
|
-
var message =
|
|
4805
|
+
var squawkCancelWaitRequestSchema = z36.object({ wait_id: z36.uuid() }).strict();
|
|
4806
|
+
var message = z36.string().max(WAIT_MESSAGE_MAX);
|
|
4753
4807
|
var registrationAnswerFields = {
|
|
4754
|
-
operation_id:
|
|
4808
|
+
operation_id: z36.uuid().optional()
|
|
4755
4809
|
};
|
|
4756
|
-
var squawkWaitAnswerSchema =
|
|
4757
|
-
|
|
4758
|
-
ok:
|
|
4810
|
+
var squawkWaitAnswerSchema = z36.discriminatedUnion("ok", [
|
|
4811
|
+
z36.object({
|
|
4812
|
+
ok: z36.literal(true),
|
|
4759
4813
|
...registrationAnswerFields,
|
|
4760
|
-
effect:
|
|
4761
|
-
deduplicated:
|
|
4762
|
-
replayed:
|
|
4763
|
-
wait_phase:
|
|
4764
|
-
wait_id:
|
|
4814
|
+
effect: z36.enum(["applied", "unchanged"]).optional(),
|
|
4815
|
+
deduplicated: z36.boolean().optional(),
|
|
4816
|
+
replayed: z36.boolean().optional(),
|
|
4817
|
+
wait_phase: z36.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
|
|
4818
|
+
wait_id: z36.uuid(),
|
|
4765
4819
|
/** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
|
|
4766
|
-
kind:
|
|
4767
|
-
deadline:
|
|
4768
|
-
open_waits:
|
|
4820
|
+
kind: z36.string().min(1).max(64),
|
|
4821
|
+
deadline: z36.iso.datetime().optional(),
|
|
4822
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4769
4823
|
}).strict().superRefine((answer, ctx) => {
|
|
4770
4824
|
if (builtInRequestKinds.has(answer.kind) && answer.deadline === void 0) {
|
|
4771
4825
|
ctx.addIssue({ code: "invalid_type", expected: "string", path: ["deadline"], message: "Invalid input: expected string, received undefined" });
|
|
4772
4826
|
}
|
|
4773
4827
|
}),
|
|
4774
|
-
|
|
4775
|
-
ok:
|
|
4828
|
+
z36.object({
|
|
4829
|
+
ok: z36.literal(false),
|
|
4776
4830
|
...registrationAnswerFields,
|
|
4777
|
-
effect:
|
|
4831
|
+
effect: z36.enum(["refused", "unknown"]).optional(),
|
|
4778
4832
|
retained_wait: openWaitSchema.optional(),
|
|
4779
4833
|
code: waitErrorCodeSchema,
|
|
4780
4834
|
message,
|
|
4781
|
-
open_waits:
|
|
4835
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4782
4836
|
}).strict()
|
|
4783
4837
|
]);
|
|
4784
4838
|
var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
|
|
4785
|
-
var squawkAskAnswerSchema =
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
ok:
|
|
4839
|
+
var squawkAskAnswerSchema = z36.discriminatedUnion("ok", [
|
|
4840
|
+
z36.object({ ok: z36.literal(true), wait_id: z36.uuid(), open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
4841
|
+
z36.object({
|
|
4842
|
+
ok: z36.literal(false),
|
|
4789
4843
|
code: askErrorCodeSchema,
|
|
4790
4844
|
message,
|
|
4791
|
-
open_waits:
|
|
4845
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4792
4846
|
}).strict()
|
|
4793
4847
|
]);
|
|
4794
|
-
var squawkCancelWaitAnswerSchema =
|
|
4795
|
-
|
|
4796
|
-
cancelled:
|
|
4797
|
-
wait_id:
|
|
4798
|
-
open_waits:
|
|
4848
|
+
var squawkCancelWaitAnswerSchema = z36.discriminatedUnion("cancelled", [
|
|
4849
|
+
z36.object({
|
|
4850
|
+
cancelled: z36.literal(true),
|
|
4851
|
+
wait_id: z36.uuid(),
|
|
4852
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4799
4853
|
}).strict(),
|
|
4800
|
-
|
|
4801
|
-
cancelled:
|
|
4802
|
-
code:
|
|
4854
|
+
z36.object({
|
|
4855
|
+
cancelled: z36.literal(false),
|
|
4856
|
+
code: z36.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
|
|
4803
4857
|
message,
|
|
4804
|
-
open_waits:
|
|
4858
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4805
4859
|
}).strict()
|
|
4806
4860
|
]);
|
|
4807
|
-
var squawkDoneRequestSchema =
|
|
4861
|
+
var squawkDoneRequestSchema = z36.object({ summary: z36.string().max(2e3).optional() }).strict();
|
|
4808
4862
|
var doneAccepted = {
|
|
4809
|
-
ok:
|
|
4810
|
-
finishes:
|
|
4811
|
-
open_waits:
|
|
4863
|
+
ok: z36.literal(true),
|
|
4864
|
+
finishes: z36.literal("at_turn_end"),
|
|
4865
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4812
4866
|
};
|
|
4813
|
-
var squawkDoneAnswerSchema =
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4867
|
+
var squawkDoneAnswerSchema = z36.discriminatedUnion("ok", [
|
|
4868
|
+
z36.discriminatedUnion("completes", [
|
|
4869
|
+
z36.object({ ...doneAccepted, completes: z36.literal("task") }).strict(),
|
|
4870
|
+
z36.object({ ...doneAccepted, completes: z36.literal("step"), next_step: z36.string().min(1) }).strict()
|
|
4817
4871
|
]),
|
|
4818
|
-
|
|
4819
|
-
ok:
|
|
4872
|
+
z36.object({
|
|
4873
|
+
ok: z36.literal(false),
|
|
4820
4874
|
code: doneErrorCodeSchema,
|
|
4821
4875
|
message,
|
|
4822
4876
|
/** The workers that block the finish, and why each one does. */
|
|
4823
|
-
workers:
|
|
4824
|
-
worker_id:
|
|
4825
|
-
reason:
|
|
4877
|
+
workers: z36.array(z36.object({
|
|
4878
|
+
worker_id: z36.string(),
|
|
4879
|
+
reason: z36.enum(["outstanding", "uncollected", "question"])
|
|
4826
4880
|
}).strict()).max(64).optional(),
|
|
4827
|
-
open_waits:
|
|
4881
|
+
open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional(),
|
|
4828
4882
|
/** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
|
|
4829
|
-
owed:
|
|
4883
|
+
owed: z36.array(doneOwedInputSchema).max(64).optional()
|
|
4830
4884
|
}).strict()
|
|
4831
4885
|
]);
|
|
4832
4886
|
|
|
@@ -5029,75 +5083,75 @@ function sqlPrefilterTokens(query, options = {}) {
|
|
|
5029
5083
|
}
|
|
5030
5084
|
|
|
5031
5085
|
// ../contract/src/artifacts.ts
|
|
5032
|
-
import { z as
|
|
5033
|
-
var pathSchema =
|
|
5034
|
-
var publishedArtifactSchema =
|
|
5035
|
-
id:
|
|
5036
|
-
runId:
|
|
5037
|
-
name:
|
|
5038
|
-
title:
|
|
5086
|
+
import { z as z37 } from "zod";
|
|
5087
|
+
var pathSchema = z37.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
|
|
5088
|
+
var publishedArtifactSchema = z37.object({
|
|
5089
|
+
id: z37.uuid(),
|
|
5090
|
+
runId: z37.uuid(),
|
|
5091
|
+
name: z37.string().min(1).max(255),
|
|
5092
|
+
title: z37.string().max(200).optional(),
|
|
5039
5093
|
sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
|
|
5040
|
-
createdAt:
|
|
5041
|
-
size:
|
|
5042
|
-
sha256:
|
|
5094
|
+
createdAt: z37.iso.datetime(),
|
|
5095
|
+
size: z37.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5096
|
+
sha256: z37.string().regex(/^[a-f0-9]{64}$/)
|
|
5043
5097
|
}).strict();
|
|
5044
|
-
var filePreviewDataSchema =
|
|
5045
|
-
type:
|
|
5098
|
+
var filePreviewDataSchema = z37.object({
|
|
5099
|
+
type: z37.literal("file"),
|
|
5046
5100
|
path: pathSchema,
|
|
5047
|
-
size:
|
|
5048
|
-
binary:
|
|
5049
|
-
tooLarge:
|
|
5050
|
-
content:
|
|
5051
|
-
source:
|
|
5101
|
+
size: z37.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5102
|
+
binary: z37.boolean(),
|
|
5103
|
+
tooLarge: z37.boolean(),
|
|
5104
|
+
content: z37.string().optional(),
|
|
5105
|
+
source: z37.enum(["worktree", "project", "artifact"]),
|
|
5052
5106
|
artifact: publishedArtifactSchema.optional()
|
|
5053
5107
|
}).strict();
|
|
5054
|
-
var fileLinkResultSchema =
|
|
5108
|
+
var fileLinkResultSchema = z37.union([
|
|
5055
5109
|
filePreviewDataSchema,
|
|
5056
|
-
|
|
5057
|
-
type:
|
|
5110
|
+
z37.object({
|
|
5111
|
+
type: z37.enum(["unavailable", "unpublished"]),
|
|
5058
5112
|
path: pathSchema,
|
|
5059
|
-
reason:
|
|
5113
|
+
reason: z37.string().min(1).max(4096)
|
|
5060
5114
|
}).strict()
|
|
5061
5115
|
]);
|
|
5062
|
-
var artifactMetadataResponseSchema =
|
|
5063
|
-
var artifactListSchema =
|
|
5064
|
-
var fileLinkQuerySchema =
|
|
5065
|
-
var artifactParamsSchema =
|
|
5116
|
+
var artifactMetadataResponseSchema = z37.object({ artifact: publishedArtifactSchema }).strict();
|
|
5117
|
+
var artifactListSchema = z37.object({ artifacts: z37.array(publishedArtifactSchema).max(64) }).strict();
|
|
5118
|
+
var fileLinkQuerySchema = z37.object({ path: pathSchema, raw: z37.literal("1").optional() }).strict();
|
|
5119
|
+
var artifactParamsSchema = z37.object({ id: z37.uuid(), artifactId: z37.uuid() });
|
|
5066
5120
|
|
|
5067
5121
|
// ../contract/src/discovery.ts
|
|
5068
|
-
import { z as
|
|
5069
|
-
var hostDiscoveryRequestSchema =
|
|
5070
|
-
|
|
5071
|
-
|
|
5122
|
+
import { z as z38 } from "zod";
|
|
5123
|
+
var hostDiscoveryRequestSchema = z38.discriminatedUnion("kind", [
|
|
5124
|
+
z38.object({ kind: z38.literal("runners") }).strict(),
|
|
5125
|
+
z38.object({ kind: z38.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
|
|
5072
5126
|
]);
|
|
5073
|
-
var discoveryRequestSchema =
|
|
5127
|
+
var discoveryRequestSchema = z38.discriminatedUnion("kind", [
|
|
5074
5128
|
...hostDiscoveryRequestSchema.options,
|
|
5075
|
-
|
|
5129
|
+
z38.object({ kind: z38.literal("tasks"), all: z38.boolean().optional(), offset: z38.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
|
|
5076
5130
|
]);
|
|
5077
5131
|
var discoveredRunnerSchema = providerStatusSchema.omit({ provider: true, profileId: true }).extend({ runner: modelDiscoveryRunnerSchema });
|
|
5078
|
-
var discoveredRunnersSchema =
|
|
5079
|
-
scope:
|
|
5080
|
-
runners:
|
|
5081
|
-
});
|
|
5082
|
-
var discoveredTasksSchema =
|
|
5083
|
-
tasks:
|
|
5084
|
-
id:
|
|
5085
|
-
title:
|
|
5132
|
+
var discoveredRunnersSchema = z38.object({
|
|
5133
|
+
scope: z38.literal("host-default-account"),
|
|
5134
|
+
runners: z38.array(discoveredRunnerSchema)
|
|
5135
|
+
});
|
|
5136
|
+
var discoveredTasksSchema = z38.object({
|
|
5137
|
+
tasks: z38.array(z38.object({
|
|
5138
|
+
id: z38.string(),
|
|
5139
|
+
title: z38.string(),
|
|
5086
5140
|
runner: runnerSchema.optional(),
|
|
5087
5141
|
status: runStatusSchema,
|
|
5088
|
-
attention:
|
|
5089
|
-
attentionLabel:
|
|
5090
|
-
accepts:
|
|
5091
|
-
reason:
|
|
5142
|
+
attention: z38.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
|
|
5143
|
+
attentionLabel: z38.string(),
|
|
5144
|
+
accepts: z38.boolean(),
|
|
5145
|
+
reason: z38.string().optional()
|
|
5092
5146
|
})).max(32),
|
|
5093
|
-
nextOffset:
|
|
5147
|
+
nextOffset: z38.number().int().nonnegative().optional(),
|
|
5094
5148
|
/** The caller's own family ledger load; no recipient inbox. */
|
|
5095
5149
|
capacity: conversationCapacitySchema.optional()
|
|
5096
5150
|
});
|
|
5097
|
-
var discoveryResponseSchema =
|
|
5151
|
+
var discoveryResponseSchema = z38.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
|
|
5098
5152
|
|
|
5099
5153
|
// ../contract/src/live.ts
|
|
5100
|
-
import { z as
|
|
5154
|
+
import { z as z39 } from "zod";
|
|
5101
5155
|
|
|
5102
5156
|
// ../contract/src/live-limits.ts
|
|
5103
5157
|
var LIVE_RUN_LIMIT = 32;
|
|
@@ -5105,46 +5159,46 @@ var LIVE_EVENT_LIMIT = 256;
|
|
|
5105
5159
|
var LIVE_BYTE_LIMIT = 1024 * 1024;
|
|
5106
5160
|
|
|
5107
5161
|
// ../contract/src/live.ts
|
|
5108
|
-
var liveRunDemandSchema =
|
|
5109
|
-
projectId:
|
|
5162
|
+
var liveRunDemandSchema = z39.object({
|
|
5163
|
+
projectId: z39.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
|
|
5110
5164
|
runId: runIdParamSchema.shape.id,
|
|
5111
5165
|
cursor: runHistoryCursorSchema.optional(),
|
|
5112
|
-
afterSeq:
|
|
5166
|
+
afterSeq: z39.number().int().nonnegative().safe()
|
|
5113
5167
|
});
|
|
5114
|
-
var liveRunsRequestSchema =
|
|
5115
|
-
runs:
|
|
5168
|
+
var liveRunsRequestSchema = z39.object({
|
|
5169
|
+
runs: z39.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
|
|
5116
5170
|
}).refine(({ runs }) => new Set(runs.map((r) => `${r.projectId}/${r.runId}`)).size === runs.length, {
|
|
5117
5171
|
message: "duplicate run demand"
|
|
5118
5172
|
});
|
|
5119
5173
|
var identity = liveRunDemandSchema.pick({ projectId: true, runId: true });
|
|
5120
5174
|
var liveRunErrorSchema = identity.extend({
|
|
5121
|
-
type:
|
|
5122
|
-
status:
|
|
5123
|
-
error:
|
|
5175
|
+
type: z39.enum(["error", "reset"]),
|
|
5176
|
+
status: z39.union([z39.literal(400), z39.literal(404), z39.literal(409), z39.literal(413), z39.literal(503)]),
|
|
5177
|
+
error: z39.string()
|
|
5124
5178
|
});
|
|
5125
5179
|
var liveRunBatchSchema = identity.extend({
|
|
5126
|
-
type:
|
|
5127
|
-
events:
|
|
5128
|
-
snapshots:
|
|
5180
|
+
type: z39.literal("batch"),
|
|
5181
|
+
events: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
|
|
5182
|
+
snapshots: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT).optional(),
|
|
5129
5183
|
cursor: runHistoryCursorSchema,
|
|
5130
|
-
afterSeq:
|
|
5131
|
-
hasMore:
|
|
5132
|
-
});
|
|
5133
|
-
var liveRunBatchResultSchema =
|
|
5134
|
-
var liveRunBatchResponseSchema =
|
|
5135
|
-
generation:
|
|
5136
|
-
results:
|
|
5137
|
-
});
|
|
5138
|
-
var liveRunFrameSchema =
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
identity.extend({ type:
|
|
5142
|
-
identity.extend({ type:
|
|
5184
|
+
afterSeq: z39.number().int().nonnegative(),
|
|
5185
|
+
hasMore: z39.boolean()
|
|
5186
|
+
});
|
|
5187
|
+
var liveRunBatchResultSchema = z39.union([liveRunBatchSchema, liveRunErrorSchema]);
|
|
5188
|
+
var liveRunBatchResponseSchema = z39.object({
|
|
5189
|
+
generation: z39.string(),
|
|
5190
|
+
results: z39.array(liveRunBatchResultSchema)
|
|
5191
|
+
});
|
|
5192
|
+
var liveRunFrameSchema = z39.union([
|
|
5193
|
+
z39.object({ type: z39.literal("ready"), generation: z39.string() }),
|
|
5194
|
+
z39.object({ type: z39.literal("ping") }),
|
|
5195
|
+
identity.extend({ type: z39.literal("event"), name: z39.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
|
|
5196
|
+
identity.extend({ type: z39.literal("snapshot"), name: z39.literal("ui-event"), event: runHistoryEventSchema }),
|
|
5143
5197
|
liveRunErrorSchema
|
|
5144
5198
|
]);
|
|
5145
5199
|
|
|
5146
5200
|
// ../contract/src/activity.ts
|
|
5147
|
-
import { z as
|
|
5201
|
+
import { z as z40 } from "zod";
|
|
5148
5202
|
var ACTIVITY_RATE_SECONDS = 30;
|
|
5149
5203
|
var ACTIVITY_TEXT_MAX = 500;
|
|
5150
5204
|
var ACTIVITY_ERROR_MAX = 200;
|
|
@@ -5152,145 +5206,145 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
|
|
|
5152
5206
|
var ACTIVITY_CHECKS_MAX = 100;
|
|
5153
5207
|
var ACTIVITY_CHECK_NAME_MAX = 100;
|
|
5154
5208
|
var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
|
|
5155
|
-
var iso =
|
|
5156
|
-
var count =
|
|
5157
|
-
var runId =
|
|
5209
|
+
var iso = z40.iso.datetime();
|
|
5210
|
+
var count = z40.number().int().nonnegative();
|
|
5211
|
+
var runId = z40.string().min(1);
|
|
5158
5212
|
var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
|
|
5159
|
-
var activityToolSchema =
|
|
5160
|
-
title:
|
|
5161
|
-
toolKind:
|
|
5162
|
-
status:
|
|
5213
|
+
var activityToolSchema = z40.object({
|
|
5214
|
+
title: z40.string().max(ACTIVITY_TOOL_TITLE_MAX),
|
|
5215
|
+
toolKind: z40.enum(ACTIVITY_TOOL_KINDS),
|
|
5216
|
+
status: z40.enum(["pending", "running", "completed", "failed", "declined"]),
|
|
5163
5217
|
startedAt: iso,
|
|
5164
5218
|
endedAt: iso.optional()
|
|
5165
5219
|
}).strict();
|
|
5166
|
-
var activityCheckBucketSchema =
|
|
5167
|
-
var activityPrProgressSchema =
|
|
5168
|
-
checks:
|
|
5169
|
-
counts:
|
|
5170
|
-
truncated:
|
|
5220
|
+
var activityCheckBucketSchema = z40.enum(["pass", "fail", "pending", "skipping", "cancel"]);
|
|
5221
|
+
var activityPrProgressSchema = z40.object({
|
|
5222
|
+
checks: z40.array(z40.object({ name: z40.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
|
|
5223
|
+
counts: z40.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
|
|
5224
|
+
truncated: z40.literal(true).optional()
|
|
5171
5225
|
}).strict();
|
|
5172
|
-
var activityWaitSchema =
|
|
5173
|
-
|
|
5174
|
-
kind:
|
|
5226
|
+
var activityWaitSchema = z40.discriminatedUnion("kind", [
|
|
5227
|
+
z40.object({
|
|
5228
|
+
kind: z40.literal("human"),
|
|
5175
5229
|
since: iso,
|
|
5176
|
-
detail:
|
|
5230
|
+
detail: z40.object({
|
|
5177
5231
|
/** The ask card's first question. */
|
|
5178
|
-
question:
|
|
5232
|
+
question: z40.string().max(ACTIVITY_TEXT_MAX).optional(),
|
|
5179
5233
|
/** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
|
|
5180
5234
|
* automatic-wake budget is spent; `completion`: Squawk's completion gate. */
|
|
5181
|
-
reason:
|
|
5235
|
+
reason: z40.enum(["question", "turn-end", "budget", "completion"]),
|
|
5182
5236
|
/** Inputs not delivered yet, when there are any. */
|
|
5183
|
-
queuedMessages:
|
|
5237
|
+
queuedMessages: z40.number().int().positive().optional()
|
|
5184
5238
|
}).strict()
|
|
5185
5239
|
}).strict(),
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
kind:
|
|
5240
|
+
z40.object({ kind: z40.literal("usage-limit"), detail: z40.object({ resumeAt: z40.string() }).strict() }).strict(),
|
|
5241
|
+
z40.object({
|
|
5242
|
+
kind: z40.literal("workers"),
|
|
5189
5243
|
since: iso,
|
|
5190
5244
|
deadline: iso.optional(),
|
|
5191
|
-
detail:
|
|
5245
|
+
detail: z40.object({
|
|
5192
5246
|
/** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
|
|
5193
5247
|
owed: count,
|
|
5194
5248
|
/** Targets named and targets settled, summed over the entries. */
|
|
5195
5249
|
total: count,
|
|
5196
5250
|
settled: count,
|
|
5197
5251
|
/** Every open entry waits on request replies. */
|
|
5198
|
-
replies:
|
|
5252
|
+
replies: z40.literal(true).optional(),
|
|
5199
5253
|
/** Only when one entry is open. */
|
|
5200
5254
|
mode: workerWaitModeSchema.optional(),
|
|
5201
5255
|
/** Who owes the awaited replies, each once. */
|
|
5202
|
-
recipientRunIds:
|
|
5256
|
+
recipientRunIds: z40.array(runId)
|
|
5203
5257
|
}).strict()
|
|
5204
5258
|
}).strict(),
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
kind:
|
|
5259
|
+
z40.object({ kind: z40.literal("peers"), since: iso, deadline: iso, detail: z40.object({ peerRunIds: z40.array(runId) }).strict() }).strict(),
|
|
5260
|
+
z40.object({ kind: z40.literal("subagents"), since: iso, deadline: iso, detail: z40.object({ running: count }).strict() }).strict(),
|
|
5261
|
+
z40.object({
|
|
5262
|
+
kind: z40.literal("pr"),
|
|
5209
5263
|
since: iso,
|
|
5210
5264
|
deadline: iso,
|
|
5211
|
-
detail:
|
|
5212
|
-
number:
|
|
5265
|
+
detail: z40.object({
|
|
5266
|
+
number: z40.number().int().positive(),
|
|
5213
5267
|
target: prWaitUntilSchema,
|
|
5214
5268
|
/** Check progress, while the CI progress registry holds some for this wait. */
|
|
5215
5269
|
checks: activityPrProgressSchema.shape.checks.optional(),
|
|
5216
5270
|
counts: activityPrProgressSchema.shape.counts.optional(),
|
|
5217
|
-
truncated:
|
|
5271
|
+
truncated: z40.literal(true).optional()
|
|
5218
5272
|
}).strict()
|
|
5219
5273
|
}).strict(),
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5274
|
+
z40.object({ kind: z40.literal("process"), since: iso, deadline: iso, detail: z40.object({ pid: z40.number().int(), note: z40.string().optional() }).strict() }).strict(),
|
|
5275
|
+
z40.object({ kind: z40.literal("plugin"), since: iso, deadline: iso.optional(), detail: z40.object({ pluginKind: z40.string().min(1).max(64), summary: z40.string().max(256) }).strict() }).strict(),
|
|
5276
|
+
z40.object({ kind: z40.literal("timer"), since: iso, deadline: iso, detail: z40.object({ wakeAt: iso, note: z40.string().optional() }).strict() }).strict()
|
|
5223
5277
|
]);
|
|
5224
5278
|
var activityRunShape = {
|
|
5225
5279
|
runId,
|
|
5226
5280
|
/** The display title: `titleSummary ?? title`. */
|
|
5227
|
-
title:
|
|
5281
|
+
title: z40.string(),
|
|
5228
5282
|
status: runStatusSchema,
|
|
5229
5283
|
/** The `deriveAttention` rung id, never a label. */
|
|
5230
|
-
rung:
|
|
5284
|
+
rung: z40.enum(ATTENTION_RUNGS),
|
|
5231
5285
|
runner: runnerSchema.optional(),
|
|
5232
|
-
model:
|
|
5233
|
-
currentStepId:
|
|
5234
|
-
startedAt:
|
|
5286
|
+
model: z40.string().optional(),
|
|
5287
|
+
currentStepId: z40.string().optional(),
|
|
5288
|
+
startedAt: z40.string().optional(),
|
|
5235
5289
|
wait: activityWaitSchema.optional(),
|
|
5236
5290
|
tool: activityToolSchema.optional(),
|
|
5237
5291
|
/** Tool calls started per second, oldest first. */
|
|
5238
|
-
rate:
|
|
5292
|
+
rate: z40.array(count).length(ACTIVITY_RATE_SECONDS),
|
|
5239
5293
|
/** One line of `RunRecord.error`. */
|
|
5240
|
-
error:
|
|
5294
|
+
error: z40.string().max(ACTIVITY_ERROR_MAX).optional()
|
|
5241
5295
|
};
|
|
5242
|
-
var activityWorkerSchema =
|
|
5296
|
+
var activityWorkerSchema = z40.object({
|
|
5243
5297
|
...activityRunShape,
|
|
5244
5298
|
/** The worker's current execution revision. */
|
|
5245
5299
|
revision: count,
|
|
5246
5300
|
/** The parent holds a collected result for this revision. */
|
|
5247
|
-
collected:
|
|
5301
|
+
collected: z40.boolean()
|
|
5248
5302
|
}).strict();
|
|
5249
|
-
var activityRunSchema =
|
|
5250
|
-
var activityRequestSchema =
|
|
5251
|
-
requestId:
|
|
5252
|
-
relationship:
|
|
5303
|
+
var activityRunSchema = z40.object({ ...activityRunShape, workers: z40.array(activityWorkerSchema) }).strict();
|
|
5304
|
+
var activityRequestSchema = z40.object({
|
|
5305
|
+
requestId: z40.uuid(),
|
|
5306
|
+
relationship: z40.enum(["family", "peer"]),
|
|
5253
5307
|
senderRunId: runId,
|
|
5254
5308
|
recipientRunId: runId,
|
|
5255
|
-
text:
|
|
5256
|
-
senderTitle:
|
|
5257
|
-
recipientTitle:
|
|
5309
|
+
text: z40.string().max(ACTIVITY_TEXT_MAX),
|
|
5310
|
+
senderTitle: z40.string().optional(),
|
|
5311
|
+
recipientTitle: z40.string().optional(),
|
|
5258
5312
|
createdAt: iso,
|
|
5259
5313
|
deadline: iso.optional()
|
|
5260
5314
|
}).strict();
|
|
5261
|
-
var activityClosedRequestSchema =
|
|
5262
|
-
requestId:
|
|
5315
|
+
var activityClosedRequestSchema = z40.object({
|
|
5316
|
+
requestId: z40.uuid(),
|
|
5263
5317
|
senderRunId: runId,
|
|
5264
5318
|
recipientRunId: runId,
|
|
5265
5319
|
status: requestOutcomeSchema.shape.status,
|
|
5266
5320
|
observedAt: iso
|
|
5267
5321
|
}).strict();
|
|
5268
|
-
var activityProjectSchema =
|
|
5269
|
-
projectId:
|
|
5270
|
-
name:
|
|
5322
|
+
var activityProjectSchema = z40.object({
|
|
5323
|
+
projectId: z40.string(),
|
|
5324
|
+
name: z40.string(),
|
|
5271
5325
|
/** False for a project this process has not loaded: its lists are empty because nothing was read. */
|
|
5272
|
-
loaded:
|
|
5326
|
+
loaded: z40.boolean(),
|
|
5273
5327
|
/** The project is loaded but its run store cannot open: the failure its project routes answer.
|
|
5274
5328
|
* The lists are empty because nothing could be read, not because nothing runs. */
|
|
5275
|
-
unavailable:
|
|
5329
|
+
unavailable: z40.object({ status: z40.union([z40.literal(404), z40.literal(409), z40.literal(503)]), error: z40.string() }).strict().optional(),
|
|
5276
5330
|
/** Root tasks in review: the summary chip (D8). */
|
|
5277
5331
|
inReview: count,
|
|
5278
|
-
tasks:
|
|
5279
|
-
requests:
|
|
5280
|
-
closed:
|
|
5332
|
+
tasks: z40.array(activityRunSchema),
|
|
5333
|
+
requests: z40.array(activityRequestSchema),
|
|
5334
|
+
closed: z40.array(activityClosedRequestSchema)
|
|
5281
5335
|
}).strict();
|
|
5282
|
-
var activitySnapshotSchema =
|
|
5336
|
+
var activitySnapshotSchema = z40.object({
|
|
5283
5337
|
/** The server clock; the client ticks ages from it. */
|
|
5284
5338
|
generatedAt: iso,
|
|
5285
5339
|
/** One entry, or every visible project for the global read. */
|
|
5286
|
-
projects:
|
|
5340
|
+
projects: z40.array(activityProjectSchema)
|
|
5287
5341
|
}).strict();
|
|
5288
|
-
var activityQuerySchema =
|
|
5289
|
-
project:
|
|
5342
|
+
var activityQuerySchema = z40.object({
|
|
5343
|
+
project: z40.union([z40.literal("default"), z40.string().regex(PROJECT_ID_PATTERN)]).optional()
|
|
5290
5344
|
});
|
|
5291
5345
|
|
|
5292
5346
|
// ../contract/src/live-coordination.ts
|
|
5293
|
-
import { z as
|
|
5347
|
+
import { z as z41 } from "zod";
|
|
5294
5348
|
var LIVE_PROTOCOL = 4;
|
|
5295
5349
|
var LIVE_WORKER_NAME = "cezar-live-v4";
|
|
5296
5350
|
var LEASE_MS = 15e3;
|
|
@@ -5299,112 +5353,112 @@ function allowedLiveRead(path) {
|
|
|
5299
5353
|
if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
|
|
5300
5354
|
return /^\/api\/v1\/(?:workspace\/(?:runs-index|activity)|p\/[a-zA-Z0-9_-]+\/(?:reports\/state|runs\/[a-zA-Z0-9._-]+\/(?:changes|commits)|github(?:\/(?:checks|ref-status))?))(?:\?[^#]*)?$/.test(path);
|
|
5301
5355
|
}
|
|
5302
|
-
var liveDemandSchema =
|
|
5303
|
-
|
|
5304
|
-
liveRunDemandSchema.extend({ kind:
|
|
5305
|
-
|
|
5356
|
+
var liveDemandSchema = z41.discriminatedUnion("kind", [
|
|
5357
|
+
z41.object({ kind: z41.literal("workspace") }),
|
|
5358
|
+
liveRunDemandSchema.extend({ kind: z41.literal("run") }),
|
|
5359
|
+
z41.object({ kind: z41.literal("topic"), topic: z41.string().min(1).max(128) }),
|
|
5306
5360
|
// Preserve server-directed cadence (settled references use ten minutes). Only
|
|
5307
5361
|
// bound the timer itself: larger delays overflow setTimeout into a tight loop.
|
|
5308
|
-
|
|
5362
|
+
z41.object({ kind: z41.literal("read"), path: z41.string().max(4096).refine(allowedLiveRead), intervalMs: z41.number().int().min(1e3).max(2147483647) })
|
|
5309
5363
|
]);
|
|
5310
|
-
var liveEntrySchema =
|
|
5311
|
-
var envelope =
|
|
5312
|
-
var ownerInputSchema =
|
|
5364
|
+
var liveEntrySchema = z41.object({ id: z41.string().min(1).max(128), demand: liveDemandSchema });
|
|
5365
|
+
var envelope = z41.object({ version: z41.literal(LIVE_PROTOCOL), documentId: z41.string().min(1).max(128), epoch: z41.number().int().nonnegative() });
|
|
5366
|
+
var ownerInputSchema = z41.discriminatedUnion("type", [
|
|
5313
5367
|
envelope.extend({
|
|
5314
|
-
type:
|
|
5315
|
-
entries:
|
|
5368
|
+
type: z41.literal("sync"),
|
|
5369
|
+
entries: z41.array(liveEntrySchema).max(64),
|
|
5316
5370
|
/** The document knows no workspace stream generation (its `ready` was lost, for example to
|
|
5317
5371
|
* an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
|
|
5318
|
-
workspaceReady:
|
|
5372
|
+
workspaceReady: z41.literal(true).optional()
|
|
5319
5373
|
}).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
|
|
5320
|
-
envelope.extend({ type:
|
|
5321
|
-
envelope.extend({ type:
|
|
5322
|
-
envelope.extend({ type:
|
|
5374
|
+
envelope.extend({ type: z41.literal("ack"), id: z41.string(), seq: z41.number().int().nonnegative() }),
|
|
5375
|
+
envelope.extend({ type: z41.literal("ack-snapshot"), id: z41.string() }),
|
|
5376
|
+
envelope.extend({ type: z41.literal("refresh"), id: z41.string() })
|
|
5323
5377
|
]);
|
|
5324
|
-
var wireFrameSchema =
|
|
5325
|
-
var ownerOutputSchema =
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5378
|
+
var wireFrameSchema = z41.object({ event: z41.string(), data: z41.string(), id: z41.string() });
|
|
5379
|
+
var ownerOutputSchema = z41.discriminatedUnion("type", [
|
|
5380
|
+
z41.object({ type: z41.literal("unavailable"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), reason: z41.string() }),
|
|
5381
|
+
z41.object({ type: z41.literal("hello"), version: z41.literal(LIVE_PROTOCOL) }),
|
|
5382
|
+
z41.object({ type: z41.literal("alive"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number() }),
|
|
5383
|
+
z41.object({ type: z41.literal("frame"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), frame: z41.union([wireFrameSchema, liveRunFrameSchema]) }),
|
|
5384
|
+
z41.object({ type: z41.literal("value"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), value: z41.unknown(), error: z41.string().optional() }),
|
|
5385
|
+
z41.object({ type: z41.literal("reset"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), reason: z41.string() })
|
|
5332
5386
|
]);
|
|
5333
5387
|
var runKey = (run) => `${run.projectId}/${run.runId}`;
|
|
5334
5388
|
|
|
5335
5389
|
// ../contract/src/workspace-events.ts
|
|
5336
|
-
import { z as
|
|
5337
|
-
var workspaceEventsQuerySchema =
|
|
5338
|
-
runs:
|
|
5390
|
+
import { z as z42 } from "zod";
|
|
5391
|
+
var workspaceEventsQuerySchema = z42.object({
|
|
5392
|
+
runs: z42.literal("summary").optional()
|
|
5339
5393
|
});
|
|
5340
|
-
var projectStamp =
|
|
5341
|
-
var frameSeq =
|
|
5342
|
-
var workspaceRunSummaryEventSchema =
|
|
5394
|
+
var projectStamp = z42.string().min(1);
|
|
5395
|
+
var frameSeq = z42.number().int().positive();
|
|
5396
|
+
var workspaceRunSummaryEventSchema = z42.object({
|
|
5343
5397
|
project: projectStamp,
|
|
5344
5398
|
seq: frameSeq,
|
|
5345
5399
|
run: runSummarySchema,
|
|
5346
|
-
relationships:
|
|
5400
|
+
relationships: z42.string().min(1)
|
|
5347
5401
|
});
|
|
5348
|
-
var workspaceRunDeletedEventSchema =
|
|
5402
|
+
var workspaceRunDeletedEventSchema = z42.object({
|
|
5349
5403
|
project: projectStamp,
|
|
5350
5404
|
seq: frameSeq,
|
|
5351
|
-
id:
|
|
5405
|
+
id: z42.string().min(1)
|
|
5352
5406
|
});
|
|
5353
|
-
var workspaceReadyEventSchema =
|
|
5354
|
-
generation:
|
|
5355
|
-
seq:
|
|
5407
|
+
var workspaceReadyEventSchema = z42.object({
|
|
5408
|
+
generation: z42.string().min(1),
|
|
5409
|
+
seq: z42.number().int().nonnegative()
|
|
5356
5410
|
});
|
|
5357
|
-
var workspaceUsageEventSchema =
|
|
5411
|
+
var workspaceUsageEventSchema = z42.object({
|
|
5358
5412
|
project: projectStamp,
|
|
5359
|
-
usage:
|
|
5413
|
+
usage: z42.record(z42.string(), processUsageSchema)
|
|
5360
5414
|
});
|
|
5361
|
-
var runsIndexResponseSchema =
|
|
5415
|
+
var runsIndexResponseSchema = z42.object({
|
|
5362
5416
|
/** Newest first, across every registered project: each project's window
|
|
5363
5417
|
* (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
|
|
5364
5418
|
* archived root runs. Owned workers are never included. Older archived runs are reached
|
|
5365
5419
|
* through `GET /workspace/runs-search`. */
|
|
5366
|
-
runs:
|
|
5420
|
+
runs: z42.array(runIndexEntrySchema),
|
|
5367
5421
|
/** Additive: absent statuses mean "nothing warm", never "nothing to show". */
|
|
5368
5422
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
5369
5423
|
/** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
|
|
5370
|
-
perProjectLimit:
|
|
5424
|
+
perProjectLimit: z42.number(),
|
|
5371
5425
|
/** Ids of the projects that had more archived root runs than `perProjectLimit`. */
|
|
5372
|
-
truncated:
|
|
5426
|
+
truncated: z42.array(z42.string()),
|
|
5373
5427
|
/** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
|
|
5374
5428
|
* compares only within one generation. */
|
|
5375
|
-
generation:
|
|
5429
|
+
generation: z42.string().min(1),
|
|
5376
5430
|
/** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
|
|
5377
5431
|
* frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
|
|
5378
|
-
eventSeq:
|
|
5432
|
+
eventSeq: z42.number().int().nonnegative()
|
|
5379
5433
|
});
|
|
5380
5434
|
|
|
5381
5435
|
// ../contract/src/permissions.ts
|
|
5382
|
-
import { z as
|
|
5383
|
-
var permissionOptionKindSchema =
|
|
5384
|
-
var permissionOptionSchema =
|
|
5385
|
-
id:
|
|
5386
|
-
label:
|
|
5436
|
+
import { z as z43 } from "zod";
|
|
5437
|
+
var permissionOptionKindSchema = z43.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
|
|
5438
|
+
var permissionOptionSchema = z43.object({
|
|
5439
|
+
id: z43.string().min(1).max(128),
|
|
5440
|
+
label: z43.string().min(1),
|
|
5387
5441
|
kind: permissionOptionKindSchema
|
|
5388
5442
|
}).strict();
|
|
5389
|
-
var permissionRequestedSchema =
|
|
5390
|
-
type:
|
|
5391
|
-
requestId:
|
|
5392
|
-
itemId:
|
|
5393
|
-
title:
|
|
5394
|
-
details:
|
|
5395
|
-
options:
|
|
5443
|
+
var permissionRequestedSchema = z43.object({
|
|
5444
|
+
type: z43.literal("permission.requested"),
|
|
5445
|
+
requestId: z43.string().min(1).max(128),
|
|
5446
|
+
itemId: z43.string().optional(),
|
|
5447
|
+
title: z43.string().min(1),
|
|
5448
|
+
details: z43.string().optional(),
|
|
5449
|
+
options: z43.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
|
|
5396
5450
|
}).strict();
|
|
5397
|
-
var permissionResolvedSchema =
|
|
5398
|
-
type:
|
|
5399
|
-
requestId:
|
|
5400
|
-
optionId:
|
|
5401
|
-
reason:
|
|
5451
|
+
var permissionResolvedSchema = z43.object({
|
|
5452
|
+
type: z43.literal("permission.resolved"),
|
|
5453
|
+
requestId: z43.string().min(1).max(128),
|
|
5454
|
+
optionId: z43.string().optional(),
|
|
5455
|
+
reason: z43.string().optional()
|
|
5402
5456
|
}).strict();
|
|
5403
|
-
var permissionDecisionSchema =
|
|
5404
|
-
requestId:
|
|
5405
|
-
optionId:
|
|
5457
|
+
var permissionDecisionSchema = z43.object({
|
|
5458
|
+
requestId: z43.string().min(1).max(128),
|
|
5459
|
+
optionId: z43.string().min(1).max(128)
|
|
5406
5460
|
}).strict();
|
|
5407
|
-
var permissionDecisionResponseSchema =
|
|
5461
|
+
var permissionDecisionResponseSchema = z43.object({ delivered: z43.literal(true) });
|
|
5408
5462
|
|
|
5409
5463
|
// ../contract/src/defined.ts
|
|
5410
5464
|
function defined(value) {
|
|
@@ -5674,83 +5728,83 @@ function isImagePath(path) {
|
|
|
5674
5728
|
}
|
|
5675
5729
|
|
|
5676
5730
|
// ../contract/src/provider-requests.ts
|
|
5677
|
-
import { z as
|
|
5678
|
-
var providerConnectSchema =
|
|
5731
|
+
import { z as z44 } from "zod";
|
|
5732
|
+
var providerConnectSchema = z44.object({
|
|
5679
5733
|
provider: runnerSchema,
|
|
5680
5734
|
/** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
|
|
5681
5735
|
* default, which is what every pre-profiles client sends. Without this, "Connect" on a second
|
|
5682
5736
|
* Claude account would open a login for the FIRST one and report success. */
|
|
5683
|
-
profileId:
|
|
5737
|
+
profileId: z44.string().max(64).optional()
|
|
5684
5738
|
}).strict();
|
|
5685
|
-
var createAgentProfileSchema =
|
|
5739
|
+
var createAgentProfileSchema = z44.object({
|
|
5686
5740
|
provider: runnerSchema,
|
|
5687
|
-
label:
|
|
5688
|
-
configDir:
|
|
5741
|
+
label: z44.string().trim().max(200).optional(),
|
|
5742
|
+
configDir: z44.string().trim().min(1).max(4096)
|
|
5689
5743
|
}).strict();
|
|
5690
|
-
var updateAgentProfileSchema =
|
|
5691
|
-
label:
|
|
5692
|
-
configDir:
|
|
5744
|
+
var updateAgentProfileSchema = z44.object({
|
|
5745
|
+
label: z44.string().trim().max(200).optional(),
|
|
5746
|
+
configDir: z44.string().trim().min(1).max(4096).optional()
|
|
5693
5747
|
}).strict().refine(
|
|
5694
5748
|
(value) => value.label !== void 0 || value.configDir !== void 0,
|
|
5695
5749
|
"send label or configDir"
|
|
5696
5750
|
);
|
|
5697
|
-
var selectAgentProfileSchema =
|
|
5698
|
-
projectId:
|
|
5751
|
+
var selectAgentProfileSchema = z44.object({
|
|
5752
|
+
projectId: z44.string().min(1).max(64),
|
|
5699
5753
|
provider: runnerSchema,
|
|
5700
|
-
profileId:
|
|
5754
|
+
profileId: z44.string().max(64).nullable()
|
|
5701
5755
|
}).strict();
|
|
5702
5756
|
var providerParamSchema = runnerSchema;
|
|
5703
|
-
var providerEnabledSchema =
|
|
5704
|
-
var providerRetrySchema =
|
|
5705
|
-
authFailureId:
|
|
5757
|
+
var providerEnabledSchema = z44.object({ enabled: z44.boolean() }).strict();
|
|
5758
|
+
var providerRetrySchema = z44.object({
|
|
5759
|
+
authFailureId: z44.string().min(1).max(128)
|
|
5706
5760
|
}).strict();
|
|
5707
|
-
var providerRouteParamsSchema =
|
|
5708
|
-
var agentProfileRouteParamsSchema =
|
|
5709
|
-
var providerSignInParamsSchema =
|
|
5710
|
-
var providerSignInRedirectSchema =
|
|
5761
|
+
var providerRouteParamsSchema = z44.object({ provider: providerParamSchema });
|
|
5762
|
+
var agentProfileRouteParamsSchema = z44.object({ id: z44.string() });
|
|
5763
|
+
var providerSignInParamsSchema = z44.object({ id: z44.uuid() });
|
|
5764
|
+
var providerSignInRedirectSchema = z44.object({
|
|
5711
5765
|
/** The address the browser landed on after consent, or the code that page shows. */
|
|
5712
|
-
redirectUrl:
|
|
5766
|
+
redirectUrl: z44.string().trim().min(1).max(8192)
|
|
5713
5767
|
}).strict();
|
|
5714
5768
|
|
|
5715
5769
|
// ../contract/src/automation-requests.ts
|
|
5716
|
-
import { z as
|
|
5770
|
+
import { z as z46 } from "zod";
|
|
5717
5771
|
|
|
5718
5772
|
// ../contract/src/automation-storage.ts
|
|
5719
|
-
import { z as
|
|
5720
|
-
var storedAutomationEventSchema =
|
|
5773
|
+
import { z as z45 } from "zod";
|
|
5774
|
+
var storedAutomationEventSchema = z45.enum([
|
|
5721
5775
|
"pull_request.opened",
|
|
5722
5776
|
"issue.opened",
|
|
5723
5777
|
"issue.labeled",
|
|
5724
5778
|
"issue.unlabeled"
|
|
5725
5779
|
]);
|
|
5726
|
-
var boundedString =
|
|
5727
|
-
var stringList =
|
|
5728
|
-
var storedAutomationFiltersSchema =
|
|
5729
|
-
includeExisting:
|
|
5780
|
+
var boundedString = z45.string().trim().min(1).max(200);
|
|
5781
|
+
var stringList = z45.array(boundedString).max(100).optional();
|
|
5782
|
+
var storedAutomationFiltersSchema = z45.object({
|
|
5783
|
+
includeExisting: z45.boolean().optional(),
|
|
5730
5784
|
/** Require an open item and matching live labels before reservation and launch. */
|
|
5731
|
-
requireCurrentLabels:
|
|
5785
|
+
requireCurrentLabels: z45.boolean().optional(),
|
|
5732
5786
|
authors: stringList,
|
|
5733
5787
|
assignees: stringList,
|
|
5734
5788
|
allLabels: stringList,
|
|
5735
5789
|
anyLabels: stringList,
|
|
5736
5790
|
excludeLabels: stringList,
|
|
5737
5791
|
changedLabels: stringList,
|
|
5738
|
-
lookbackDays:
|
|
5739
|
-
maxRecords:
|
|
5792
|
+
lookbackDays: z45.number().int().min(1).max(90).default(7),
|
|
5793
|
+
maxRecords: z45.number().int().min(1).max(100).default(25)
|
|
5740
5794
|
}).passthrough();
|
|
5741
|
-
var storedAutomationTaskSchema =
|
|
5742
|
-
prompt:
|
|
5743
|
-
workflow:
|
|
5744
|
-
steps:
|
|
5795
|
+
var storedAutomationTaskSchema = z45.object({
|
|
5796
|
+
prompt: z45.string().min(1).max(1e5),
|
|
5797
|
+
workflow: z45.string().trim().min(1).max(200).optional(),
|
|
5798
|
+
steps: z45.array(workflowStepDefSchema).min(1).max(100).optional(),
|
|
5745
5799
|
runner: runnerSchema.optional(),
|
|
5746
|
-
model:
|
|
5747
|
-
effort:
|
|
5748
|
-
variants:
|
|
5749
|
-
worktree:
|
|
5750
|
-
autonomous:
|
|
5800
|
+
model: z45.string().trim().min(1).max(200).optional(),
|
|
5801
|
+
effort: z45.string().trim().min(1).max(32).optional(),
|
|
5802
|
+
variants: z45.union([z45.literal(1), z45.literal(2), z45.literal(3)]).optional(),
|
|
5803
|
+
worktree: z45.boolean().optional(),
|
|
5804
|
+
autonomous: z45.boolean().optional(),
|
|
5751
5805
|
...completionControlsShape,
|
|
5752
5806
|
...taskAccessShape,
|
|
5753
|
-
systemPrompt:
|
|
5807
|
+
systemPrompt: z45.string().max(1e5).optional()
|
|
5754
5808
|
}).passthrough().refine((task) => !(task.workflow && task.steps), {
|
|
5755
5809
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5756
5810
|
});
|
|
@@ -5768,122 +5822,122 @@ var fillGithubDefaults = (raw) => {
|
|
|
5768
5822
|
filters: record.filters ?? {}
|
|
5769
5823
|
};
|
|
5770
5824
|
};
|
|
5771
|
-
var storedAutomationDefinitionObjectSchema =
|
|
5772
|
-
id:
|
|
5773
|
-
revision:
|
|
5774
|
-
name:
|
|
5775
|
-
description:
|
|
5776
|
-
enabled:
|
|
5825
|
+
var storedAutomationDefinitionObjectSchema = z45.object({
|
|
5826
|
+
id: z45.string().min(1).max(100),
|
|
5827
|
+
revision: z45.number().int().positive(),
|
|
5828
|
+
name: z45.string().trim().min(1).max(200),
|
|
5829
|
+
description: z45.string().max(2e3).optional(),
|
|
5830
|
+
enabled: z45.boolean().default(false),
|
|
5777
5831
|
/** A definition written before schedules has no `kind`: it is a poll. */
|
|
5778
5832
|
kind: automationKindSchema.default("github"),
|
|
5779
|
-
events:
|
|
5780
|
-
intervalSeconds:
|
|
5833
|
+
events: z45.array(storedAutomationEventSchema).min(1).max(4).optional(),
|
|
5834
|
+
intervalSeconds: z45.number().int().min(60).max(86400).optional(),
|
|
5781
5835
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5782
5836
|
// Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
|
|
5783
5837
|
schedule: automationScheduleSchema.passthrough().optional(),
|
|
5784
5838
|
task: storedAutomationTaskSchema,
|
|
5785
5839
|
/** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
|
|
5786
|
-
archived:
|
|
5787
|
-
at:
|
|
5788
|
-
outcome:
|
|
5789
|
-
runId:
|
|
5790
|
-
receiptId:
|
|
5791
|
-
trigger:
|
|
5840
|
+
archived: z45.object({
|
|
5841
|
+
at: z45.string().datetime(),
|
|
5842
|
+
outcome: z45.enum(["launched", "cancelled"]),
|
|
5843
|
+
runId: z45.string().optional(),
|
|
5844
|
+
receiptId: z45.string().optional(),
|
|
5845
|
+
trigger: z45.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
5792
5846
|
}).passthrough().optional(),
|
|
5793
|
-
createdAt:
|
|
5794
|
-
updatedAt:
|
|
5847
|
+
createdAt: z45.string().datetime(),
|
|
5848
|
+
updatedAt: z45.string().datetime()
|
|
5795
5849
|
}).passthrough().superRefine((definition, ctx) => {
|
|
5796
5850
|
if (definition.kind === "schedule") {
|
|
5797
5851
|
if (!definition.schedule) {
|
|
5798
|
-
ctx.addIssue({ code:
|
|
5852
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
|
|
5799
5853
|
}
|
|
5800
5854
|
return;
|
|
5801
5855
|
}
|
|
5802
5856
|
if (!definition.events?.length) {
|
|
5803
|
-
ctx.addIssue({ code:
|
|
5857
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
|
|
5804
5858
|
}
|
|
5805
5859
|
if (definition.intervalSeconds === void 0) {
|
|
5806
|
-
ctx.addIssue({ code:
|
|
5860
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
|
|
5807
5861
|
}
|
|
5808
5862
|
if (!definition.filters) {
|
|
5809
|
-
ctx.addIssue({ code:
|
|
5863
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
|
|
5810
5864
|
}
|
|
5811
5865
|
if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
|
|
5812
5866
|
ctx.addIssue({
|
|
5813
|
-
code:
|
|
5867
|
+
code: z45.ZodIssueCode.custom,
|
|
5814
5868
|
path: ["filters", "changedLabels"],
|
|
5815
5869
|
message: "changedLabels is required for issue label events"
|
|
5816
5870
|
});
|
|
5817
5871
|
}
|
|
5818
5872
|
});
|
|
5819
|
-
var storedAutomationDefinitionSchema =
|
|
5820
|
-
var storedAutomationDefinitionsFileSchema =
|
|
5821
|
-
version:
|
|
5822
|
-
automations:
|
|
5823
|
-
tombstones:
|
|
5873
|
+
var storedAutomationDefinitionSchema = z45.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
|
|
5874
|
+
var storedAutomationDefinitionsFileSchema = z45.object({
|
|
5875
|
+
version: z45.literal(1).default(1),
|
|
5876
|
+
automations: z45.array(z45.unknown()).default([]),
|
|
5877
|
+
tombstones: z45.record(z45.string(), z45.string().datetime()).optional()
|
|
5824
5878
|
}).passthrough();
|
|
5825
|
-
var storedAutomationCursorSchema =
|
|
5826
|
-
timestamp:
|
|
5827
|
-
tieBreaker:
|
|
5879
|
+
var storedAutomationCursorSchema = z45.object({
|
|
5880
|
+
timestamp: z45.string().datetime(),
|
|
5881
|
+
tieBreaker: z45.string().optional()
|
|
5828
5882
|
}).passthrough();
|
|
5829
5883
|
var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
|
|
5830
5884
|
cursor: storedAutomationCursorSchema.optional()
|
|
5831
5885
|
});
|
|
5832
|
-
var storedAutomationRuntimeStateSchema =
|
|
5833
|
-
revision:
|
|
5834
|
-
baselineAt:
|
|
5886
|
+
var storedAutomationRuntimeStateSchema = z45.object({
|
|
5887
|
+
revision: z45.number().int().positive().optional(),
|
|
5888
|
+
baselineAt: z45.string().datetime().optional(),
|
|
5835
5889
|
/** Arming time, independent of a history window's older lower bound. */
|
|
5836
|
-
armedAt:
|
|
5890
|
+
armedAt: z45.string().datetime().optional(),
|
|
5837
5891
|
historyScan: storedAutomationHistoryScanSchema.optional(),
|
|
5838
5892
|
cursor: storedAutomationCursorSchema.optional(),
|
|
5839
|
-
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5840
|
-
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5841
|
-
nextCheckAt:
|
|
5842
|
-
lastSuccessAt:
|
|
5893
|
+
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
|
|
5894
|
+
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
|
|
5895
|
+
nextCheckAt: z45.string().datetime().optional(),
|
|
5896
|
+
lastSuccessAt: z45.string().datetime().optional(),
|
|
5843
5897
|
/** schedule kind: the next occurrence's instant and the last fired one's. */
|
|
5844
|
-
nextRunAt:
|
|
5845
|
-
lastRunAt:
|
|
5846
|
-
etags:
|
|
5847
|
-
backoffUntil:
|
|
5848
|
-
consecutiveFailures:
|
|
5898
|
+
nextRunAt: z45.string().datetime().optional(),
|
|
5899
|
+
lastRunAt: z45.string().datetime().optional(),
|
|
5900
|
+
etags: z45.record(z45.string(), z45.string()).optional(),
|
|
5901
|
+
backoffUntil: z45.string().datetime().optional(),
|
|
5902
|
+
consecutiveFailures: z45.number().int().nonnegative().optional(),
|
|
5849
5903
|
...automationLastErrorShape,
|
|
5850
5904
|
/** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
|
|
5851
|
-
onceOutcome:
|
|
5905
|
+
onceOutcome: z45.enum(["failed", "missed"]).optional()
|
|
5852
5906
|
}).passthrough();
|
|
5853
|
-
var storedAutomationStateFileSchema =
|
|
5854
|
-
version:
|
|
5855
|
-
states:
|
|
5907
|
+
var storedAutomationStateFileSchema = z45.object({
|
|
5908
|
+
version: z45.literal(1).default(1),
|
|
5909
|
+
states: z45.record(z45.string(), storedAutomationRuntimeStateSchema).default({})
|
|
5856
5910
|
}).passthrough();
|
|
5857
|
-
var storedAutomationReceiptSchema =
|
|
5858
|
-
receiptId:
|
|
5859
|
-
receiptKey:
|
|
5860
|
-
eventId:
|
|
5861
|
-
automationId:
|
|
5862
|
-
revision:
|
|
5863
|
-
status:
|
|
5864
|
-
runId:
|
|
5865
|
-
observedAt:
|
|
5866
|
-
updatedAt:
|
|
5867
|
-
error:
|
|
5911
|
+
var storedAutomationReceiptSchema = z45.object({
|
|
5912
|
+
receiptId: z45.string().min(1),
|
|
5913
|
+
receiptKey: z45.string().min(1),
|
|
5914
|
+
eventId: z45.string().min(1),
|
|
5915
|
+
automationId: z45.string().min(1),
|
|
5916
|
+
revision: z45.number().int().positive(),
|
|
5917
|
+
status: z45.enum(["reserved", "launched", "launch-error", "released"]),
|
|
5918
|
+
runId: z45.string().optional(),
|
|
5919
|
+
observedAt: z45.string().datetime(),
|
|
5920
|
+
updatedAt: z45.string().datetime(),
|
|
5921
|
+
error: z45.string().max(2e3).optional(),
|
|
5868
5922
|
/** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
|
|
5869
|
-
occurrenceAt:
|
|
5870
|
-
candidate:
|
|
5871
|
-
eventId:
|
|
5923
|
+
occurrenceAt: z45.string().datetime().optional(),
|
|
5924
|
+
candidate: z45.object({
|
|
5925
|
+
eventId: z45.string(),
|
|
5872
5926
|
event: storedAutomationEventSchema,
|
|
5873
|
-
timestamp:
|
|
5874
|
-
tieBreaker:
|
|
5875
|
-
repo:
|
|
5876
|
-
nodeId:
|
|
5877
|
-
number:
|
|
5878
|
-
title:
|
|
5879
|
-
url:
|
|
5880
|
-
author:
|
|
5881
|
-
assignees:
|
|
5882
|
-
labels:
|
|
5883
|
-
changedLabel:
|
|
5927
|
+
timestamp: z45.string().datetime(),
|
|
5928
|
+
tieBreaker: z45.string(),
|
|
5929
|
+
repo: z45.string(),
|
|
5930
|
+
nodeId: z45.string(),
|
|
5931
|
+
number: z45.number().int().positive(),
|
|
5932
|
+
title: z45.string().max(500),
|
|
5933
|
+
url: z45.string().url(),
|
|
5934
|
+
author: z45.string().max(200),
|
|
5935
|
+
assignees: z45.array(z45.string().max(200)).max(100),
|
|
5936
|
+
labels: z45.array(z45.string().max(200)).max(100),
|
|
5937
|
+
changedLabel: z45.string().max(200).optional()
|
|
5884
5938
|
}).passthrough().optional()
|
|
5885
5939
|
}).passthrough();
|
|
5886
|
-
var storedAutomationLogResultSchema =
|
|
5940
|
+
var storedAutomationLogResultSchema = z45.enum([
|
|
5887
5941
|
"launched",
|
|
5888
5942
|
"no-match",
|
|
5889
5943
|
"duplicate",
|
|
@@ -5899,24 +5953,24 @@ var storedAutomationLogResultSchema = z44.enum([
|
|
|
5899
5953
|
// once schedule
|
|
5900
5954
|
"missed"
|
|
5901
5955
|
]);
|
|
5902
|
-
var storedAutomationLogRecordSchema =
|
|
5903
|
-
seq:
|
|
5904
|
-
ts:
|
|
5905
|
-
automationId:
|
|
5906
|
-
revision:
|
|
5956
|
+
var storedAutomationLogRecordSchema = z45.object({
|
|
5957
|
+
seq: z45.number().int().positive(),
|
|
5958
|
+
ts: z45.string().datetime(),
|
|
5959
|
+
automationId: z45.string().min(1),
|
|
5960
|
+
revision: z45.number().int().positive(),
|
|
5907
5961
|
event: storedAutomationEventSchema.optional(),
|
|
5908
5962
|
result: storedAutomationLogResultSchema,
|
|
5909
|
-
reason:
|
|
5910
|
-
durationMs:
|
|
5911
|
-
receiptId:
|
|
5912
|
-
runId:
|
|
5913
|
-
githubNumber:
|
|
5914
|
-
githubTitle:
|
|
5915
|
-
githubUrl:
|
|
5916
|
-
rateLimit:
|
|
5917
|
-
bucket:
|
|
5918
|
-
remaining:
|
|
5919
|
-
resetAt:
|
|
5963
|
+
reason: z45.string().max(2e3).optional(),
|
|
5964
|
+
durationMs: z45.number().int().nonnegative().optional(),
|
|
5965
|
+
receiptId: z45.string().optional(),
|
|
5966
|
+
runId: z45.string().optional(),
|
|
5967
|
+
githubNumber: z45.number().int().positive().optional(),
|
|
5968
|
+
githubTitle: z45.string().max(500).optional(),
|
|
5969
|
+
githubUrl: z45.string().url().optional(),
|
|
5970
|
+
rateLimit: z45.object({
|
|
5971
|
+
bucket: z45.enum(["core", "search"]),
|
|
5972
|
+
remaining: z45.number().int().nonnegative().optional(),
|
|
5973
|
+
resetAt: z45.string().datetime().optional()
|
|
5920
5974
|
}).passthrough().optional()
|
|
5921
5975
|
}).passthrough();
|
|
5922
5976
|
function storedIsOnceSchedule(definition) {
|
|
@@ -5930,210 +5984,210 @@ function storedIsScheduleAutomation(definition) {
|
|
|
5930
5984
|
}
|
|
5931
5985
|
|
|
5932
5986
|
// ../contract/src/automation-requests.ts
|
|
5933
|
-
var automationEditableSchema =
|
|
5934
|
-
name:
|
|
5935
|
-
description:
|
|
5936
|
-
enabled:
|
|
5987
|
+
var automationEditableSchema = z46.object({
|
|
5988
|
+
name: z46.string().trim().min(1).max(200),
|
|
5989
|
+
description: z46.string().max(2e3).optional(),
|
|
5990
|
+
enabled: z46.boolean().optional(),
|
|
5937
5991
|
kind: automationKindSchema.optional(),
|
|
5938
|
-
events:
|
|
5939
|
-
intervalSeconds:
|
|
5992
|
+
events: z46.array(automationEventSchema).min(1).max(4).optional(),
|
|
5993
|
+
intervalSeconds: z46.number().int().min(60).max(86400).optional(),
|
|
5940
5994
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5941
5995
|
schedule: automationScheduleSchema.optional(),
|
|
5942
|
-
task:
|
|
5996
|
+
task: z46.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
|
|
5943
5997
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5944
5998
|
})
|
|
5945
5999
|
}).strict();
|
|
5946
|
-
var automationCreateSchema = automationEditableSchema.extend({ enable:
|
|
5947
|
-
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision:
|
|
5948
|
-
var automationCheckRequestSchema =
|
|
5949
|
-
var automationLogQuerySchema =
|
|
5950
|
-
automationId:
|
|
6000
|
+
var automationCreateSchema = automationEditableSchema.extend({ enable: z46.boolean().optional() });
|
|
6001
|
+
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z46.number().int().positive() });
|
|
6002
|
+
var automationCheckRequestSchema = z46.object({ mode: z46.enum(["preview", "execute"]) }).strict();
|
|
6003
|
+
var automationLogQuerySchema = z46.object({
|
|
6004
|
+
automationId: z46.string().optional(),
|
|
5951
6005
|
result: automationLogResultSchema.optional(),
|
|
5952
6006
|
event: automationEventSchema.optional(),
|
|
5953
|
-
since:
|
|
5954
|
-
cursor:
|
|
6007
|
+
since: z46.string().datetime().optional(),
|
|
6008
|
+
cursor: z46.coerce.number().int().positive().optional(),
|
|
5955
6009
|
// Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
|
|
5956
6010
|
// 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
|
|
5957
6011
|
// request type `queryZodValidator` publishes (see validators.ts on why the request side falls
|
|
5958
6012
|
// back to the schema's output), which would have made every caller send a `?limit=` this route
|
|
5959
6013
|
// never needed.
|
|
5960
|
-
limit:
|
|
6014
|
+
limit: z46.coerce.number().int().min(1).max(100).optional()
|
|
5961
6015
|
});
|
|
5962
6016
|
|
|
5963
6017
|
// ../contract/src/workflow-requests.ts
|
|
5964
|
-
import { z as
|
|
5965
|
-
var planSchema =
|
|
6018
|
+
import { z as z47 } from "zod";
|
|
6019
|
+
var planSchema = z47.object({
|
|
5966
6020
|
// Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
|
|
5967
|
-
task:
|
|
6021
|
+
task: z47.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
|
|
5968
6022
|
/** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
|
|
5969
6023
|
* selection (hearsay-tools/squawk#4116). */
|
|
5970
|
-
agentProfile:
|
|
6024
|
+
agentProfile: z47.string().max(64).optional()
|
|
5971
6025
|
});
|
|
5972
|
-
var parseWorkflowSchema =
|
|
5973
|
-
yaml:
|
|
6026
|
+
var parseWorkflowSchema = z47.object({
|
|
6027
|
+
yaml: z47.string().min(1).max(1e5)
|
|
5974
6028
|
});
|
|
5975
6029
|
|
|
5976
6030
|
// ../contract/src/ui-state-requests.ts
|
|
5977
|
-
import { z as
|
|
6031
|
+
import { z as z48 } from "zod";
|
|
5978
6032
|
var SKILL_USAGE_MAX_ENTRIES = 200;
|
|
5979
6033
|
var UI_STATE_MAX_KEYS = 200;
|
|
5980
6034
|
var uiStateSchema2 = uiStateSchema.extend({
|
|
5981
6035
|
// null records a quick task with no selected skill or workflow.
|
|
5982
|
-
lastTask:
|
|
5983
|
-
source:
|
|
5984
|
-
ref:
|
|
6036
|
+
lastTask: z48.object({
|
|
6037
|
+
source: z48.enum(["workflow", "skill"]),
|
|
6038
|
+
ref: z48.string().min(1).max(200)
|
|
5985
6039
|
}).nullable().optional(),
|
|
5986
6040
|
// Most recent source choices, newest first.
|
|
5987
|
-
recentSources:
|
|
5988
|
-
|
|
5989
|
-
source:
|
|
5990
|
-
ref:
|
|
6041
|
+
recentSources: z48.array(
|
|
6042
|
+
z48.object({
|
|
6043
|
+
source: z48.enum(["workflow", "skill"]),
|
|
6044
|
+
ref: z48.string().min(1).max(200)
|
|
5991
6045
|
})
|
|
5992
6046
|
).max(50).optional(),
|
|
5993
|
-
skillUsage:
|
|
6047
|
+
skillUsage: z48.record(z48.string().min(1).max(200), z48.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
|
|
5994
6048
|
message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
|
|
5995
6049
|
}).optional(),
|
|
5996
|
-
promptTemplates:
|
|
5997
|
-
|
|
5998
|
-
id:
|
|
5999
|
-
label:
|
|
6000
|
-
text:
|
|
6050
|
+
promptTemplates: z48.array(
|
|
6051
|
+
z48.object({
|
|
6052
|
+
id: z48.string().min(1).max(64),
|
|
6053
|
+
label: z48.string().trim().min(1).max(80),
|
|
6054
|
+
text: z48.string().trim().min(1).max(2e3),
|
|
6001
6055
|
// Skill names this template auto-applies for. Optional and additive: templates
|
|
6002
6056
|
// written before this key existed keep validating, and stay manual-only.
|
|
6003
|
-
skills:
|
|
6057
|
+
skills: z48.array(z48.string().trim().min(1).max(200)).max(50).optional()
|
|
6004
6058
|
})
|
|
6005
6059
|
).max(50).optional()
|
|
6006
6060
|
}).passthrough();
|
|
6007
6061
|
function capUiStateKeys(data, ctx) {
|
|
6008
6062
|
if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
|
|
6009
|
-
ctx.addIssue({ code:
|
|
6063
|
+
ctx.addIssue({ code: z48.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
|
|
6010
6064
|
}
|
|
6011
6065
|
}
|
|
6012
6066
|
var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
|
|
6013
6067
|
|
|
6014
6068
|
// ../contract/src/run-requests.ts
|
|
6015
|
-
import { z as
|
|
6016
|
-
var queuedMessagePatchSchema =
|
|
6017
|
-
text:
|
|
6018
|
-
images:
|
|
6069
|
+
import { z as z49 } from "zod";
|
|
6070
|
+
var queuedMessagePatchSchema = z49.object({
|
|
6071
|
+
text: z49.string().max(1e5).optional(),
|
|
6072
|
+
images: z49.array(attachmentInputSchema).max(4).optional()
|
|
6019
6073
|
}).refine((m) => m.text !== void 0 || m.images !== void 0, {
|
|
6020
6074
|
message: "message edit needs text or attachments"
|
|
6021
6075
|
});
|
|
6022
|
-
var continueSchema =
|
|
6023
|
-
text:
|
|
6024
|
-
images:
|
|
6076
|
+
var continueSchema = z49.object({
|
|
6077
|
+
text: z49.string().max(1e5, "must be at most 100000 characters").optional(),
|
|
6078
|
+
images: z49.array(attachmentInputSchema).max(4).optional(),
|
|
6025
6079
|
runner: runnerSchema.optional(),
|
|
6026
|
-
model:
|
|
6080
|
+
model: z49.string().max(200).optional(),
|
|
6027
6081
|
/** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
|
|
6028
|
-
effort:
|
|
6082
|
+
effort: z49.string().max(32).optional()
|
|
6029
6083
|
});
|
|
6030
|
-
var archiveSchema =
|
|
6031
|
-
archived:
|
|
6084
|
+
var archiveSchema = z49.object({
|
|
6085
|
+
archived: z49.boolean().optional()
|
|
6032
6086
|
});
|
|
6033
|
-
var openInSchema =
|
|
6087
|
+
var openInSchema = z49.object({
|
|
6034
6088
|
// A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
|
|
6035
|
-
target:
|
|
6036
|
-
path:
|
|
6089
|
+
target: z49.string().trim().min(1, "target required").max(200),
|
|
6090
|
+
path: z49.string().max(1e3).optional()
|
|
6037
6091
|
});
|
|
6038
6092
|
|
|
6039
6093
|
// ../contract/src/query-requests.ts
|
|
6040
|
-
import { z as
|
|
6041
|
-
var queryValue =
|
|
6042
|
-
var refreshQuery =
|
|
6043
|
-
var waitQuery =
|
|
6044
|
-
var queryRunnerSchema =
|
|
6045
|
-
var modelDiscoveryQuerySchema =
|
|
6046
|
-
var strictRefreshQuerySchema =
|
|
6047
|
-
var browseQuerySchema =
|
|
6048
|
-
var worktreeFilesQuerySchema =
|
|
6049
|
-
var commitQuerySchema =
|
|
6094
|
+
import { z as z50 } from "zod";
|
|
6095
|
+
var queryValue = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).optional();
|
|
6096
|
+
var refreshQuery = z50.object({ refresh: queryValue });
|
|
6097
|
+
var waitQuery = z50.object({ wait: queryValue });
|
|
6098
|
+
var queryRunnerSchema = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
|
|
6099
|
+
var modelDiscoveryQuerySchema = z50.object({ runner: queryRunnerSchema, profileId: z50.string().max(64).optional() });
|
|
6100
|
+
var strictRefreshQuerySchema = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6101
|
+
var browseQuerySchema = z50.object({ path: queryValue, showHidden: queryValue });
|
|
6102
|
+
var worktreeFilesQuerySchema = z50.object({ path: queryValue, raw: queryValue });
|
|
6103
|
+
var commitQuerySchema = z50.object({ structured: queryValue });
|
|
6050
6104
|
|
|
6051
6105
|
// ../contract/src/github-requests.ts
|
|
6052
|
-
import { z as
|
|
6053
|
-
var mergeNumberParams =
|
|
6054
|
-
var prChangesParams =
|
|
6055
|
-
var prChangesQuery =
|
|
6056
|
-
var mergeBodySchema =
|
|
6057
|
-
method:
|
|
6058
|
-
expectedHeadSha:
|
|
6059
|
-
overrideRules:
|
|
6106
|
+
import { z as z51 } from "zod";
|
|
6107
|
+
var mergeNumberParams = z51.object({ number: z51.coerce.number().int().positive() });
|
|
6108
|
+
var prChangesParams = z51.object({ number: z51.coerce.number().int().positive().safe() });
|
|
6109
|
+
var prChangesQuery = z51.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6110
|
+
var mergeBodySchema = z51.object({
|
|
6111
|
+
method: z51.enum(["merge", "squash", "rebase"]),
|
|
6112
|
+
expectedHeadSha: z51.string().regex(/^[0-9a-f]{40}$/),
|
|
6113
|
+
overrideRules: z51.boolean().optional().default(false)
|
|
6060
6114
|
}).strict();
|
|
6061
|
-
var githubChecksQuerySchema =
|
|
6062
|
-
var githubRefsQuerySchema =
|
|
6115
|
+
var githubChecksQuerySchema = z51.object({ prs: z51.string().min(1) });
|
|
6116
|
+
var githubRefsQuerySchema = z51.object({ prs: z51.string().optional(), issues: z51.string().optional() });
|
|
6063
6117
|
|
|
6064
6118
|
// ../contract/src/repo-requests.ts
|
|
6065
|
-
import { z as
|
|
6066
|
-
var gitCommitSchema =
|
|
6067
|
-
message:
|
|
6119
|
+
import { z as z52 } from "zod";
|
|
6120
|
+
var gitCommitSchema = z52.object({
|
|
6121
|
+
message: z52.string().trim().min(1, "must not be empty").max(5e3)
|
|
6068
6122
|
});
|
|
6069
|
-
var reclaimBodySchema =
|
|
6070
|
-
var repoBranchSchema =
|
|
6071
|
-
name:
|
|
6072
|
-
from:
|
|
6123
|
+
var reclaimBodySchema = z52.object({}).passthrough();
|
|
6124
|
+
var repoBranchSchema = z52.object({
|
|
6125
|
+
name: z52.string().trim().min(1).max(200),
|
|
6126
|
+
from: z52.string().trim().min(1).max(200).optional()
|
|
6073
6127
|
});
|
|
6074
|
-
var reclaimRunParamsSchema =
|
|
6128
|
+
var reclaimRunParamsSchema = z52.object({ runId: z52.string().min(1) });
|
|
6075
6129
|
|
|
6076
6130
|
// ../contract/src/config-requests.ts
|
|
6077
|
-
import { z as
|
|
6131
|
+
import { z as z53 } from "zod";
|
|
6078
6132
|
var setConfigSchema = setConfigInputSchema.extend({
|
|
6079
|
-
systemPrompt:
|
|
6133
|
+
systemPrompt: z53.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
|
|
6080
6134
|
});
|
|
6081
|
-
var setAgentConfigSchema =
|
|
6082
|
-
content:
|
|
6083
|
-
version:
|
|
6135
|
+
var setAgentConfigSchema = z53.object({
|
|
6136
|
+
content: z53.string().max(2e6),
|
|
6137
|
+
version: z53.string().nullable()
|
|
6084
6138
|
});
|
|
6085
6139
|
|
|
6086
6140
|
// ../contract/src/workflow-file.ts
|
|
6087
|
-
import { z as
|
|
6088
|
-
var workflowFileSchema =
|
|
6089
|
-
name:
|
|
6090
|
-
description:
|
|
6091
|
-
steps:
|
|
6092
|
-
skills:
|
|
6141
|
+
import { z as z54 } from "zod";
|
|
6142
|
+
var workflowFileSchema = z54.object({
|
|
6143
|
+
name: z54.string().min(1),
|
|
6144
|
+
description: z54.string().optional(),
|
|
6145
|
+
steps: z54.array(workflowStepDefSchema).min(1).optional(),
|
|
6146
|
+
skills: z54.array(z54.string().trim().min(1)).min(1).optional()
|
|
6093
6147
|
}).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
|
|
6094
6148
|
message: 'a workflow lists either "steps" or "skills", not both'
|
|
6095
6149
|
});
|
|
6096
6150
|
|
|
6097
6151
|
// ../contract/src/reports.ts
|
|
6098
|
-
import { z as
|
|
6152
|
+
import { z as z55 } from "zod";
|
|
6099
6153
|
var REPORTS_QUERY_MAX = 1e3;
|
|
6100
|
-
var cursorSchema =
|
|
6101
|
-
var reportsQuerySchema =
|
|
6102
|
-
q:
|
|
6154
|
+
var cursorSchema = z55.string().min(1).max(1024);
|
|
6155
|
+
var reportsQuerySchema = z55.object({
|
|
6156
|
+
q: z55.string().max(REPORTS_QUERY_MAX).optional(),
|
|
6103
6157
|
before: cursorSchema.optional(),
|
|
6104
|
-
limit:
|
|
6158
|
+
limit: z55.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
|
|
6105
6159
|
}).strict();
|
|
6106
|
-
var reportSchema =
|
|
6107
|
-
id:
|
|
6108
|
-
runId:
|
|
6109
|
-
name:
|
|
6110
|
-
title:
|
|
6111
|
-
createdAt:
|
|
6112
|
-
size:
|
|
6113
|
-
taskTitle:
|
|
6160
|
+
var reportSchema = z55.object({
|
|
6161
|
+
id: z55.uuid(),
|
|
6162
|
+
runId: z55.uuid(),
|
|
6163
|
+
name: z55.string(),
|
|
6164
|
+
title: z55.string(),
|
|
6165
|
+
createdAt: z55.iso.datetime(),
|
|
6166
|
+
size: z55.number().int().nonnegative(),
|
|
6167
|
+
taskTitle: z55.string(),
|
|
6114
6168
|
taskStatus: runStatusSchema
|
|
6115
6169
|
}).strict();
|
|
6116
|
-
var reportsResponseSchema =
|
|
6117
|
-
reports:
|
|
6170
|
+
var reportsResponseSchema = z55.object({
|
|
6171
|
+
reports: z55.array(reportSchema),
|
|
6118
6172
|
nextCursor: cursorSchema.nullable(),
|
|
6119
6173
|
// Counts all matching cached rows with readable source summaries before page content checks.
|
|
6120
6174
|
// A missing-content row dropped while filling this page can lower total on the next request.
|
|
6121
|
-
total:
|
|
6175
|
+
total: z55.number().int().nonnegative()
|
|
6122
6176
|
}).strict();
|
|
6123
|
-
var reportsStateSchema =
|
|
6124
|
-
epoch:
|
|
6125
|
-
generation:
|
|
6126
|
-
metadataGeneration:
|
|
6177
|
+
var reportsStateSchema = z55.object({
|
|
6178
|
+
epoch: z55.uuid(),
|
|
6179
|
+
generation: z55.number().int().nonnegative(),
|
|
6180
|
+
metadataGeneration: z55.number().int().nonnegative()
|
|
6127
6181
|
}).strict();
|
|
6128
|
-
var reportsMetadataSchema =
|
|
6129
|
-
runId:
|
|
6130
|
-
taskTitle:
|
|
6182
|
+
var reportsMetadataSchema = z55.object({
|
|
6183
|
+
runId: z55.uuid(),
|
|
6184
|
+
taskTitle: z55.string(),
|
|
6131
6185
|
taskStatus: runStatusSchema
|
|
6132
6186
|
}).strict();
|
|
6133
|
-
var reportsFrameSchema =
|
|
6134
|
-
reportsStateSchema.extend({ type:
|
|
6135
|
-
reportsStateSchema.extend({ type:
|
|
6136
|
-
reportsStateSchema.extend({ type:
|
|
6187
|
+
var reportsFrameSchema = z55.discriminatedUnion("type", [
|
|
6188
|
+
reportsStateSchema.extend({ type: z55.literal("snapshot") }),
|
|
6189
|
+
reportsStateSchema.extend({ type: z55.literal("content") }),
|
|
6190
|
+
reportsStateSchema.extend({ type: z55.literal("metadata"), runs: z55.array(reportsMetadataSchema) })
|
|
6137
6191
|
]);
|
|
6138
6192
|
|
|
6139
6193
|
// ../contract/src/report-title.ts
|
|
@@ -6155,108 +6209,108 @@ function controlLocation(control, separator = " \u2192 ") {
|
|
|
6155
6209
|
}
|
|
6156
6210
|
|
|
6157
6211
|
// ../contract/src/home-recovery.ts
|
|
6158
|
-
import { z as
|
|
6212
|
+
import { z as z56 } from "zod";
|
|
6159
6213
|
var HOME_FILE_PATTERN = /^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/;
|
|
6160
|
-
var homeFileSchema =
|
|
6161
|
-
var recoveryFile =
|
|
6214
|
+
var homeFileSchema = z56.string().regex(HOME_FILE_PATTERN);
|
|
6215
|
+
var recoveryFile = z56.object({
|
|
6162
6216
|
file: homeFileSchema,
|
|
6163
|
-
detectedAt:
|
|
6164
|
-
canRestore:
|
|
6217
|
+
detectedAt: z56.iso.datetime(),
|
|
6218
|
+
canRestore: z56.boolean()
|
|
6165
6219
|
});
|
|
6166
6220
|
var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
|
|
6167
|
-
var homeRecoveryFileSchema =
|
|
6168
|
-
recoveryFile.extend({ reason:
|
|
6169
|
-
recoveryFile.extend({ reason:
|
|
6170
|
-
recoveryFile.extend({ reason:
|
|
6221
|
+
var homeRecoveryFileSchema = z56.discriminatedUnion("reason", [
|
|
6222
|
+
recoveryFile.extend({ reason: z56.literal("reset") }),
|
|
6223
|
+
recoveryFile.extend({ reason: z56.literal("outside-write") }),
|
|
6224
|
+
recoveryFile.extend({ reason: z56.literal("legacy-change"), canImport: z56.boolean() })
|
|
6171
6225
|
]);
|
|
6172
|
-
var homeRecoverySchema =
|
|
6226
|
+
var homeRecoverySchema = z56.object({ files: z56.array(homeRecoveryFileSchema) });
|
|
6173
6227
|
function filterHomeRecoveryReasons(value, reasons) {
|
|
6174
6228
|
if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
|
|
6175
6229
|
return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
|
|
6176
6230
|
}
|
|
6177
|
-
var homeRecoveryReaderSchema =
|
|
6231
|
+
var homeRecoveryReaderSchema = z56.preprocess(
|
|
6178
6232
|
(value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
|
|
6179
6233
|
homeRecoverySchema
|
|
6180
6234
|
);
|
|
6181
|
-
var homeRecoveryActionSchema =
|
|
6235
|
+
var homeRecoveryActionSchema = z56.object({ file: homeFileSchema, detectedAt: z56.iso.datetime() }).strict();
|
|
6182
6236
|
|
|
6183
6237
|
// ../contract/src/runner-skills.ts
|
|
6184
|
-
import { z as
|
|
6185
|
-
var runnerSkillScopeSchema =
|
|
6186
|
-
var runnerSkillsQuerySchema =
|
|
6238
|
+
import { z as z57 } from "zod";
|
|
6239
|
+
var runnerSkillScopeSchema = z57.enum(["repo", "user", "system", "other"]);
|
|
6240
|
+
var runnerSkillsQuerySchema = z57.object({
|
|
6187
6241
|
runner: queryRunnerSchema,
|
|
6188
|
-
account:
|
|
6189
|
-
refresh:
|
|
6242
|
+
account: z57.string().min(1).max(64).optional(),
|
|
6243
|
+
refresh: z57.literal("1").optional()
|
|
6190
6244
|
});
|
|
6191
|
-
var runnerSkillSchema =
|
|
6192
|
-
id:
|
|
6193
|
-
name:
|
|
6194
|
-
description:
|
|
6245
|
+
var runnerSkillSchema = z57.object({
|
|
6246
|
+
id: z57.string(),
|
|
6247
|
+
name: z57.string(),
|
|
6248
|
+
description: z57.string().optional(),
|
|
6195
6249
|
scope: runnerSkillScopeSchema.optional(),
|
|
6196
|
-
plugin:
|
|
6197
|
-
path:
|
|
6250
|
+
plugin: z57.string().optional(),
|
|
6251
|
+
path: z57.string().optional()
|
|
6198
6252
|
});
|
|
6199
|
-
var runnerSkillProblemSchema =
|
|
6200
|
-
var runnerSkillListSchema =
|
|
6253
|
+
var runnerSkillProblemSchema = z57.object({ message: z57.string(), path: z57.string().optional() });
|
|
6254
|
+
var runnerSkillListSchema = z57.object({
|
|
6201
6255
|
runner: runnerSchema,
|
|
6202
|
-
skills:
|
|
6203
|
-
problems:
|
|
6204
|
-
source:
|
|
6205
|
-
reason:
|
|
6256
|
+
skills: z57.array(runnerSkillSchema),
|
|
6257
|
+
problems: z57.array(runnerSkillProblemSchema),
|
|
6258
|
+
source: z57.enum(["live", "cache", "unavailable"]),
|
|
6259
|
+
reason: z57.string().optional()
|
|
6206
6260
|
});
|
|
6207
6261
|
|
|
6208
6262
|
// ../contract/src/runner-install.ts
|
|
6209
|
-
import { z as
|
|
6210
|
-
var runnerInstallParamsSchema =
|
|
6211
|
-
var runnerInstallActionSchema =
|
|
6212
|
-
var runnerInstallPhaseSchema =
|
|
6213
|
-
var runnerInstallStatusSchema =
|
|
6214
|
-
supported:
|
|
6215
|
-
installedVersion:
|
|
6216
|
-
latestVersion:
|
|
6217
|
-
updateAvailable:
|
|
6263
|
+
import { z as z58 } from "zod";
|
|
6264
|
+
var runnerInstallParamsSchema = z58.object({ runner: runnerSchema });
|
|
6265
|
+
var runnerInstallActionSchema = z58.object({ action: z58.enum(["check", "install", "update", "remove"]) });
|
|
6266
|
+
var runnerInstallPhaseSchema = z58.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
|
|
6267
|
+
var runnerInstallStatusSchema = z58.object({
|
|
6268
|
+
supported: z58.boolean(),
|
|
6269
|
+
installedVersion: z58.string().nullable(),
|
|
6270
|
+
latestVersion: z58.string().nullable(),
|
|
6271
|
+
updateAvailable: z58.boolean(),
|
|
6218
6272
|
phase: runnerInstallPhaseSchema,
|
|
6219
|
-
error:
|
|
6273
|
+
error: z58.string().nullable()
|
|
6220
6274
|
});
|
|
6221
6275
|
|
|
6222
6276
|
// ../contract/src/automation-tool.ts
|
|
6223
|
-
import { z as
|
|
6277
|
+
import { z as z59 } from "zod";
|
|
6224
6278
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
6225
|
-
var id =
|
|
6226
|
-
var automationToolRequestSchema =
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6279
|
+
var id = z59.string().min(1).max(100);
|
|
6280
|
+
var automationToolRequestSchema = z59.discriminatedUnion("action", [
|
|
6281
|
+
z59.object({ action: z59.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
6282
|
+
z59.object({ action: z59.literal("show"), id }).strict(),
|
|
6283
|
+
z59.object({ action: z59.literal("preview"), id }).strict(),
|
|
6284
|
+
z59.object({ action: z59.literal("enable"), id, explicit: z59.boolean().optional() }).strict()
|
|
6231
6285
|
]);
|
|
6232
|
-
var automationToolAnswerSchema =
|
|
6233
|
-
|
|
6234
|
-
ok:
|
|
6286
|
+
var automationToolAnswerSchema = z59.union([
|
|
6287
|
+
z59.object({
|
|
6288
|
+
ok: z59.literal(true),
|
|
6235
6289
|
automation: storedAutomationDefinitionSchema,
|
|
6236
|
-
url:
|
|
6237
|
-
next_run_at:
|
|
6238
|
-
preview:
|
|
6290
|
+
url: z59.string().optional(),
|
|
6291
|
+
next_run_at: z59.string().optional(),
|
|
6292
|
+
preview: z59.object({ matches: z59.number().int().nonnegative(), truncated: z59.boolean() }).optional()
|
|
6239
6293
|
}),
|
|
6240
|
-
|
|
6294
|
+
z59.object({ ok: z59.literal(false), code: z59.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z59.string() })
|
|
6241
6295
|
]);
|
|
6242
6296
|
|
|
6243
6297
|
// ../contract/src/agent-tools.ts
|
|
6244
|
-
import { z as
|
|
6245
|
-
var agentToolResultSchema =
|
|
6246
|
-
content:
|
|
6247
|
-
isError:
|
|
6248
|
-
details:
|
|
6249
|
-
});
|
|
6250
|
-
var agentToolMetadataSchema =
|
|
6251
|
-
timeoutMs:
|
|
6298
|
+
import { z as z60 } from "zod";
|
|
6299
|
+
var agentToolResultSchema = z60.object({
|
|
6300
|
+
content: z60.array(z60.object({ type: z60.literal("text"), text: z60.string() })),
|
|
6301
|
+
isError: z60.boolean().optional(),
|
|
6302
|
+
details: z60.unknown()
|
|
6303
|
+
});
|
|
6304
|
+
var agentToolMetadataSchema = z60.object({
|
|
6305
|
+
timeoutMs: z60.number().positive(),
|
|
6252
6306
|
unavailable: agentToolResultSchema,
|
|
6253
|
-
name:
|
|
6254
|
-
description:
|
|
6255
|
-
trigger:
|
|
6256
|
-
label:
|
|
6257
|
-
inputSchema:
|
|
6307
|
+
name: z60.string(),
|
|
6308
|
+
description: z60.string(),
|
|
6309
|
+
trigger: z60.string(),
|
|
6310
|
+
label: z60.string(),
|
|
6311
|
+
inputSchema: z60.object({ type: z60.literal("object"), properties: z60.record(z60.string(), z60.unknown()).optional() }).catchall(z60.unknown())
|
|
6258
6312
|
});
|
|
6259
|
-
var agentToolCatalogSchema =
|
|
6313
|
+
var agentToolCatalogSchema = z60.object({ tools: z60.array(agentToolMetadataSchema), instructions: z60.string() });
|
|
6260
6314
|
export {
|
|
6261
6315
|
ACTIVITY_CHECKS_MAX,
|
|
6262
6316
|
ACTIVITY_CHECK_NAME_MAX,
|
|
@@ -6334,6 +6388,7 @@ export {
|
|
|
6334
6388
|
SCHEDULED_TASK_NOTE,
|
|
6335
6389
|
SCHEDULE_HOURS_OPTIONS,
|
|
6336
6390
|
SCHEDULE_TYPES,
|
|
6391
|
+
SESSION_CONTEXT_FILE_MAX_BYTES,
|
|
6337
6392
|
SHARED_ATTACH_REFUSAL,
|
|
6338
6393
|
SHARED_BASELINE,
|
|
6339
6394
|
SHARED_BASELINE_REFUSAL,
|
|
@@ -6860,12 +6915,19 @@ export {
|
|
|
6860
6915
|
selectAgentProfileSchema,
|
|
6861
6916
|
sendAgentReportInputSchema,
|
|
6862
6917
|
sendAgentReportResponseSchema,
|
|
6918
|
+
sessionContextFileSchema,
|
|
6919
|
+
sessionContextPreviewBlockSchema,
|
|
6920
|
+
sessionContextPreviewRequestSchema,
|
|
6921
|
+
sessionContextPreviewSchema,
|
|
6922
|
+
sessionContextProblemSchema,
|
|
6923
|
+
sessionContextRoleSchema,
|
|
6863
6924
|
sessionRunner,
|
|
6864
6925
|
setAgentConfigInputSchema,
|
|
6865
6926
|
setAgentConfigSchema,
|
|
6866
6927
|
setConfigInputSchema,
|
|
6867
6928
|
setConfigResponseSchema,
|
|
6868
6929
|
setConfigSchema,
|
|
6930
|
+
setSessionContextSchema,
|
|
6869
6931
|
setWorkspaceConfigInputSchema,
|
|
6870
6932
|
setWorkspaceUiStateInputSchema,
|
|
6871
6933
|
sharedSpawnRefusal,
|