@hearsay-tools/squawk 0.18.0-pr4307.8368 → 0.18.0-pr4311.8381
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 +863 -801
- package/dist/contract/session-context.d.ts +94 -0
- package/dist/contract/utf8.d.ts +2 -0
- package/dist/delegation/routes.d.ts +10 -10
- package/dist/delegation/transport.d.ts +11 -11
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +31 -31
- package/dist/server/server.d.ts +757 -595
- 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 +137 -0
- package/dist/session-context-file.js.map +1 -0
- package/dist/session-context.d.ts +48 -0
- package/dist/session-context.js +146 -18
- package/dist/session-context.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-BJvE9Zln.js +1 -0
- package/web/dist/assets/activity-motion-C7V2Zytw.js +2 -0
- package/web/dist/assets/{activity-route-HvdWBepL.js → activity-route-CTqpLmA9.js} +1 -1
- package/web/dist/assets/agent-config-section-DJRFuip3.js +1 -0
- package/web/dist/assets/agent-defaults-section-CeMUJzwV.js +1 -0
- package/web/dist/assets/{appearance-ZpysBpxH.js → appearance-V0sfM4Xw.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BlGo3o7a.js → archive-on-merge-field-ChwFDgN8.js} +1 -1
- package/web/dist/assets/attention-DJIQDiO5.js +1 -0
- package/web/dist/assets/automations-route-RV6ad8dC.js +1 -0
- package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
- package/web/dist/assets/{commit-diff-panel-BzAqXG0p.js → commit-diff-panel-C8BKEM91.js} +1 -1
- package/web/dist/assets/{diff-lVUk7FAR.js → diff-DN710SrG.js} +2 -2
- package/web/dist/assets/{diff-view-B5RGiepv.js → diff-view-BOORW_QD.js} +1 -1
- package/web/dist/assets/file-preview-DUHn3plI.js +2 -0
- package/web/dist/assets/{folder-browser-CffyHz8w.js → folder-browser-O-QkHs8B.js} +1 -1
- package/web/dist/assets/{git-toolbar-xLFz5nnr.js → git-toolbar-DLn0htp2.js} +1 -1
- package/web/dist/assets/{github-DxiILmDg.js → github-rSbXwKu9.js} +1 -1
- package/web/dist/assets/{global-activity-route-BmqMaZug.js → global-activity-route-C_SjZHhE.js} +1 -1
- package/web/dist/assets/index-2DP8fWMQ.css +1 -0
- package/web/dist/assets/index-VOxZqw61.js +21 -0
- package/web/dist/assets/{label-6PgIe3Ny.js → label-DaF3ftAD.js} +1 -1
- package/web/dist/assets/{live-reads-BxjlQXfN.js → live-reads-CfCVkYjf.js} +1 -1
- package/web/dist/assets/{markdown-DHYxiDex.js → markdown-DQj6hGSX.js} +1 -1
- package/web/dist/assets/{notifications-section-xHvjaRxV.js → notifications-section-CREk2cYf.js} +1 -1
- package/web/dist/assets/{open-in-menu-AZMtej8C.js → open-in-menu-BY4TapRQ.js} +1 -1
- package/web/dist/assets/plus-CxRU2X8C.js +1 -0
- package/web/dist/assets/{preview-pane-connected-C5Lsjf2P.js → preview-pane-connected-BS8M7HRF.js} +2 -2
- package/web/dist/assets/{project-location-DzOgHfcA.js → project-location-DkjkVltT.js} +1 -1
- package/web/dist/assets/{project-router-CDPfL2Jz.js → project-router-C-7SCaQu.js} +1 -1
- package/web/dist/assets/{project-scope-context-D9axDY18.js → project-scope-context-CMu1TeV7.js} +2 -2
- package/web/dist/assets/{projects-section-0ov7IK9p.js → projects-section-DmI2vrR9.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DgLWN4ZB.js → prompt-templates-section-C_ZkFDJ2.js} +1 -1
- package/web/dist/assets/queries-B6x1ADXB.js +1 -0
- package/web/dist/assets/{reference-chip-BnIoiMgY.js → reference-chip-Ch3mSHpR.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-kmlL_JEi.js → remote-settings-notice-B97QRJRX.js} +1 -1
- package/web/dist/assets/repo-git-D3Hc5dTH.js +1 -0
- package/web/dist/assets/report-reader-C3ZbGANg.js +1 -0
- package/web/dist/assets/{reports--yxm1Dbp.js → reports-B8UQJmqx.js} +1 -1
- package/web/dist/assets/{resources-section-CZu7afz7.js → resources-section-C_z6IH9E.js} +1 -1
- package/web/dist/assets/run-header--tUbnd6U.js +2 -0
- package/web/dist/assets/session-context-section-B3h6gyn4.js +118 -0
- package/web/dist/assets/{settings-agent-picker-XdHS0cXP.js → settings-agent-picker-CwgrzYYC.js} +1 -1
- package/web/dist/assets/settings-shell-DBkzg_Zm.js +1 -0
- package/web/dist/assets/{sidebar-section-Dgf9Tda6.js → sidebar-section-C6-ecxDw.js} +1 -1
- package/web/dist/assets/{skills-CVoGqJeT.js → skills-BBSOi-c_.js} +1 -1
- package/web/dist/assets/{tab-link-BaKE6KnE.js → tab-link-BGx4dJyd.js} +1 -1
- package/web/dist/assets/{task-changes-Cd30VNwk.js → task-changes-rlBta9iZ.js} +1 -1
- package/web/dist/assets/{task-commits-33kwaiVP.js → task-commits-Bw6PH9bn.js} +1 -1
- package/web/dist/assets/task-files-DWvHKsMk.js +1 -0
- package/web/dist/assets/{task-github-item-C7dEQxMN.js → task-github-item-CCTkPQrv.js} +1 -1
- package/web/dist/assets/{task-groups-DoiPFEfM.js → task-groups-BJTO_lzF.js} +1 -1
- package/web/dist/assets/task-thread-cCwjVK3w.js +9 -0
- package/web/dist/assets/{tasks-table-CmESFng9.js → tasks-table-DfjsK2ZU.js} +1 -1
- package/web/dist/assets/{thread-state-DI7JLoTx.js → thread-state-BsoWER7_.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-B869bBKO.js → use-hand-to-agent-state-CuIPrVeu.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-GZp9laKm.js → useInfiniteQuery-EIYt3KXs.js} +1 -1
- package/web/dist/assets/useQuery-CQLBQlcy.js +1 -0
- package/web/dist/assets/workflows-BxqDHhP6.js +7 -0
- package/web/dist/assets/{workspace-tools-YqTAoyv7.js → workspace-tools-2UqOWOET.js} +1 -1
- package/web/dist/assets/{worktrees-section-9fwC5DGp.js → worktrees-section-C2_py7HS.js} +4 -4
- package/web/dist/index.html +15 -15
- package/web/dist/assets/accounts-section-D3rKSj1e.js +0 -1
- package/web/dist/assets/activity-motion-CFgok4CI.js +0 -2
- package/web/dist/assets/agent-config-section-DbmhTCJA.js +0 -4
- package/web/dist/assets/agent-defaults-section-5fBA2FMV.js +0 -1
- package/web/dist/assets/attention-CvHM4cjG.js +0 -1
- package/web/dist/assets/automations-route-aINxoEQX.js +0 -1
- package/web/dist/assets/file-preview-Bn5u5k1W.js +0 -2
- package/web/dist/assets/index-DndX-kC-.js +0 -21
- package/web/dist/assets/index-HkNWm2JB.css +0 -1
- package/web/dist/assets/queries-DzwCG927.js +0 -1
- package/web/dist/assets/repo-git-D-L0KYwh.js +0 -1
- package/web/dist/assets/report-reader-Fb02sGC6.js +0 -1
- package/web/dist/assets/run-header-Bajufo9w.js +0 -2
- package/web/dist/assets/settings-shell-63smMna1.js +0 -1
- package/web/dist/assets/task-files-W2NkAX0s.js +0 -1
- package/web/dist/assets/task-thread-Bi5cKYmZ.js +0 -9
- package/web/dist/assets/useQuery-CzVHT8UE.js +0 -1
- package/web/dist/assets/workflows-CeRdeF9n.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,44 +5159,44 @@ 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:
|
|
5180
|
+
type: z39.literal("batch"),
|
|
5181
|
+
events: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
|
|
5128
5182
|
cursor: runHistoryCursorSchema,
|
|
5129
|
-
afterSeq:
|
|
5130
|
-
hasMore:
|
|
5131
|
-
});
|
|
5132
|
-
var liveRunBatchResultSchema =
|
|
5133
|
-
var liveRunBatchResponseSchema =
|
|
5134
|
-
generation:
|
|
5135
|
-
results:
|
|
5136
|
-
});
|
|
5137
|
-
var liveRunFrameSchema =
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
identity.extend({ type:
|
|
5183
|
+
afterSeq: z39.number().int().nonnegative(),
|
|
5184
|
+
hasMore: z39.boolean()
|
|
5185
|
+
});
|
|
5186
|
+
var liveRunBatchResultSchema = z39.union([liveRunBatchSchema, liveRunErrorSchema]);
|
|
5187
|
+
var liveRunBatchResponseSchema = z39.object({
|
|
5188
|
+
generation: z39.string(),
|
|
5189
|
+
results: z39.array(liveRunBatchResultSchema)
|
|
5190
|
+
});
|
|
5191
|
+
var liveRunFrameSchema = z39.union([
|
|
5192
|
+
z39.object({ type: z39.literal("ready"), generation: z39.string() }),
|
|
5193
|
+
z39.object({ type: z39.literal("ping") }),
|
|
5194
|
+
identity.extend({ type: z39.literal("event"), name: z39.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
|
|
5141
5195
|
liveRunErrorSchema
|
|
5142
5196
|
]);
|
|
5143
5197
|
|
|
5144
5198
|
// ../contract/src/activity.ts
|
|
5145
|
-
import { z as
|
|
5199
|
+
import { z as z40 } from "zod";
|
|
5146
5200
|
var ACTIVITY_RATE_SECONDS = 30;
|
|
5147
5201
|
var ACTIVITY_TEXT_MAX = 500;
|
|
5148
5202
|
var ACTIVITY_ERROR_MAX = 200;
|
|
@@ -5150,145 +5204,145 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
|
|
|
5150
5204
|
var ACTIVITY_CHECKS_MAX = 100;
|
|
5151
5205
|
var ACTIVITY_CHECK_NAME_MAX = 100;
|
|
5152
5206
|
var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
|
|
5153
|
-
var iso =
|
|
5154
|
-
var count =
|
|
5155
|
-
var runId =
|
|
5207
|
+
var iso = z40.iso.datetime();
|
|
5208
|
+
var count = z40.number().int().nonnegative();
|
|
5209
|
+
var runId = z40.string().min(1);
|
|
5156
5210
|
var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
|
|
5157
|
-
var activityToolSchema =
|
|
5158
|
-
title:
|
|
5159
|
-
toolKind:
|
|
5160
|
-
status:
|
|
5211
|
+
var activityToolSchema = z40.object({
|
|
5212
|
+
title: z40.string().max(ACTIVITY_TOOL_TITLE_MAX),
|
|
5213
|
+
toolKind: z40.enum(ACTIVITY_TOOL_KINDS),
|
|
5214
|
+
status: z40.enum(["pending", "running", "completed", "failed", "declined"]),
|
|
5161
5215
|
startedAt: iso,
|
|
5162
5216
|
endedAt: iso.optional()
|
|
5163
5217
|
}).strict();
|
|
5164
|
-
var activityCheckBucketSchema =
|
|
5165
|
-
var activityPrProgressSchema =
|
|
5166
|
-
checks:
|
|
5167
|
-
counts:
|
|
5168
|
-
truncated:
|
|
5218
|
+
var activityCheckBucketSchema = z40.enum(["pass", "fail", "pending", "skipping", "cancel"]);
|
|
5219
|
+
var activityPrProgressSchema = z40.object({
|
|
5220
|
+
checks: z40.array(z40.object({ name: z40.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
|
|
5221
|
+
counts: z40.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
|
|
5222
|
+
truncated: z40.literal(true).optional()
|
|
5169
5223
|
}).strict();
|
|
5170
|
-
var activityWaitSchema =
|
|
5171
|
-
|
|
5172
|
-
kind:
|
|
5224
|
+
var activityWaitSchema = z40.discriminatedUnion("kind", [
|
|
5225
|
+
z40.object({
|
|
5226
|
+
kind: z40.literal("human"),
|
|
5173
5227
|
since: iso,
|
|
5174
|
-
detail:
|
|
5228
|
+
detail: z40.object({
|
|
5175
5229
|
/** The ask card's first question. */
|
|
5176
|
-
question:
|
|
5230
|
+
question: z40.string().max(ACTIVITY_TEXT_MAX).optional(),
|
|
5177
5231
|
/** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
|
|
5178
5232
|
* automatic-wake budget is spent; `completion`: Squawk's completion gate. */
|
|
5179
|
-
reason:
|
|
5233
|
+
reason: z40.enum(["question", "turn-end", "budget", "completion"]),
|
|
5180
5234
|
/** Inputs not delivered yet, when there are any. */
|
|
5181
|
-
queuedMessages:
|
|
5235
|
+
queuedMessages: z40.number().int().positive().optional()
|
|
5182
5236
|
}).strict()
|
|
5183
5237
|
}).strict(),
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
kind:
|
|
5238
|
+
z40.object({ kind: z40.literal("usage-limit"), detail: z40.object({ resumeAt: z40.string() }).strict() }).strict(),
|
|
5239
|
+
z40.object({
|
|
5240
|
+
kind: z40.literal("workers"),
|
|
5187
5241
|
since: iso,
|
|
5188
5242
|
deadline: iso.optional(),
|
|
5189
|
-
detail:
|
|
5243
|
+
detail: z40.object({
|
|
5190
5244
|
/** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
|
|
5191
5245
|
owed: count,
|
|
5192
5246
|
/** Targets named and targets settled, summed over the entries. */
|
|
5193
5247
|
total: count,
|
|
5194
5248
|
settled: count,
|
|
5195
5249
|
/** Every open entry waits on request replies. */
|
|
5196
|
-
replies:
|
|
5250
|
+
replies: z40.literal(true).optional(),
|
|
5197
5251
|
/** Only when one entry is open. */
|
|
5198
5252
|
mode: workerWaitModeSchema.optional(),
|
|
5199
5253
|
/** Who owes the awaited replies, each once. */
|
|
5200
|
-
recipientRunIds:
|
|
5254
|
+
recipientRunIds: z40.array(runId)
|
|
5201
5255
|
}).strict()
|
|
5202
5256
|
}).strict(),
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
kind:
|
|
5257
|
+
z40.object({ kind: z40.literal("peers"), since: iso, deadline: iso, detail: z40.object({ peerRunIds: z40.array(runId) }).strict() }).strict(),
|
|
5258
|
+
z40.object({ kind: z40.literal("subagents"), since: iso, deadline: iso, detail: z40.object({ running: count }).strict() }).strict(),
|
|
5259
|
+
z40.object({
|
|
5260
|
+
kind: z40.literal("pr"),
|
|
5207
5261
|
since: iso,
|
|
5208
5262
|
deadline: iso,
|
|
5209
|
-
detail:
|
|
5210
|
-
number:
|
|
5263
|
+
detail: z40.object({
|
|
5264
|
+
number: z40.number().int().positive(),
|
|
5211
5265
|
target: prWaitUntilSchema,
|
|
5212
5266
|
/** Check progress, while the CI progress registry holds some for this wait. */
|
|
5213
5267
|
checks: activityPrProgressSchema.shape.checks.optional(),
|
|
5214
5268
|
counts: activityPrProgressSchema.shape.counts.optional(),
|
|
5215
|
-
truncated:
|
|
5269
|
+
truncated: z40.literal(true).optional()
|
|
5216
5270
|
}).strict()
|
|
5217
5271
|
}).strict(),
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5272
|
+
z40.object({ kind: z40.literal("process"), since: iso, deadline: iso, detail: z40.object({ pid: z40.number().int(), note: z40.string().optional() }).strict() }).strict(),
|
|
5273
|
+
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(),
|
|
5274
|
+
z40.object({ kind: z40.literal("timer"), since: iso, deadline: iso, detail: z40.object({ wakeAt: iso, note: z40.string().optional() }).strict() }).strict()
|
|
5221
5275
|
]);
|
|
5222
5276
|
var activityRunShape = {
|
|
5223
5277
|
runId,
|
|
5224
5278
|
/** The display title: `titleSummary ?? title`. */
|
|
5225
|
-
title:
|
|
5279
|
+
title: z40.string(),
|
|
5226
5280
|
status: runStatusSchema,
|
|
5227
5281
|
/** The `deriveAttention` rung id, never a label. */
|
|
5228
|
-
rung:
|
|
5282
|
+
rung: z40.enum(ATTENTION_RUNGS),
|
|
5229
5283
|
runner: runnerSchema.optional(),
|
|
5230
|
-
model:
|
|
5231
|
-
currentStepId:
|
|
5232
|
-
startedAt:
|
|
5284
|
+
model: z40.string().optional(),
|
|
5285
|
+
currentStepId: z40.string().optional(),
|
|
5286
|
+
startedAt: z40.string().optional(),
|
|
5233
5287
|
wait: activityWaitSchema.optional(),
|
|
5234
5288
|
tool: activityToolSchema.optional(),
|
|
5235
5289
|
/** Tool calls started per second, oldest first. */
|
|
5236
|
-
rate:
|
|
5290
|
+
rate: z40.array(count).length(ACTIVITY_RATE_SECONDS),
|
|
5237
5291
|
/** One line of `RunRecord.error`. */
|
|
5238
|
-
error:
|
|
5292
|
+
error: z40.string().max(ACTIVITY_ERROR_MAX).optional()
|
|
5239
5293
|
};
|
|
5240
|
-
var activityWorkerSchema =
|
|
5294
|
+
var activityWorkerSchema = z40.object({
|
|
5241
5295
|
...activityRunShape,
|
|
5242
5296
|
/** The worker's current execution revision. */
|
|
5243
5297
|
revision: count,
|
|
5244
5298
|
/** The parent holds a collected result for this revision. */
|
|
5245
|
-
collected:
|
|
5299
|
+
collected: z40.boolean()
|
|
5246
5300
|
}).strict();
|
|
5247
|
-
var activityRunSchema =
|
|
5248
|
-
var activityRequestSchema =
|
|
5249
|
-
requestId:
|
|
5250
|
-
relationship:
|
|
5301
|
+
var activityRunSchema = z40.object({ ...activityRunShape, workers: z40.array(activityWorkerSchema) }).strict();
|
|
5302
|
+
var activityRequestSchema = z40.object({
|
|
5303
|
+
requestId: z40.uuid(),
|
|
5304
|
+
relationship: z40.enum(["family", "peer"]),
|
|
5251
5305
|
senderRunId: runId,
|
|
5252
5306
|
recipientRunId: runId,
|
|
5253
|
-
text:
|
|
5254
|
-
senderTitle:
|
|
5255
|
-
recipientTitle:
|
|
5307
|
+
text: z40.string().max(ACTIVITY_TEXT_MAX),
|
|
5308
|
+
senderTitle: z40.string().optional(),
|
|
5309
|
+
recipientTitle: z40.string().optional(),
|
|
5256
5310
|
createdAt: iso,
|
|
5257
5311
|
deadline: iso.optional()
|
|
5258
5312
|
}).strict();
|
|
5259
|
-
var activityClosedRequestSchema =
|
|
5260
|
-
requestId:
|
|
5313
|
+
var activityClosedRequestSchema = z40.object({
|
|
5314
|
+
requestId: z40.uuid(),
|
|
5261
5315
|
senderRunId: runId,
|
|
5262
5316
|
recipientRunId: runId,
|
|
5263
5317
|
status: requestOutcomeSchema.shape.status,
|
|
5264
5318
|
observedAt: iso
|
|
5265
5319
|
}).strict();
|
|
5266
|
-
var activityProjectSchema =
|
|
5267
|
-
projectId:
|
|
5268
|
-
name:
|
|
5320
|
+
var activityProjectSchema = z40.object({
|
|
5321
|
+
projectId: z40.string(),
|
|
5322
|
+
name: z40.string(),
|
|
5269
5323
|
/** False for a project this process has not loaded: its lists are empty because nothing was read. */
|
|
5270
|
-
loaded:
|
|
5324
|
+
loaded: z40.boolean(),
|
|
5271
5325
|
/** The project is loaded but its run store cannot open: the failure its project routes answer.
|
|
5272
5326
|
* The lists are empty because nothing could be read, not because nothing runs. */
|
|
5273
|
-
unavailable:
|
|
5327
|
+
unavailable: z40.object({ status: z40.union([z40.literal(404), z40.literal(409), z40.literal(503)]), error: z40.string() }).strict().optional(),
|
|
5274
5328
|
/** Root tasks in review: the summary chip (D8). */
|
|
5275
5329
|
inReview: count,
|
|
5276
|
-
tasks:
|
|
5277
|
-
requests:
|
|
5278
|
-
closed:
|
|
5330
|
+
tasks: z40.array(activityRunSchema),
|
|
5331
|
+
requests: z40.array(activityRequestSchema),
|
|
5332
|
+
closed: z40.array(activityClosedRequestSchema)
|
|
5279
5333
|
}).strict();
|
|
5280
|
-
var activitySnapshotSchema =
|
|
5334
|
+
var activitySnapshotSchema = z40.object({
|
|
5281
5335
|
/** The server clock; the client ticks ages from it. */
|
|
5282
5336
|
generatedAt: iso,
|
|
5283
5337
|
/** One entry, or every visible project for the global read. */
|
|
5284
|
-
projects:
|
|
5338
|
+
projects: z40.array(activityProjectSchema)
|
|
5285
5339
|
}).strict();
|
|
5286
|
-
var activityQuerySchema =
|
|
5287
|
-
project:
|
|
5340
|
+
var activityQuerySchema = z40.object({
|
|
5341
|
+
project: z40.union([z40.literal("default"), z40.string().regex(PROJECT_ID_PATTERN)]).optional()
|
|
5288
5342
|
});
|
|
5289
5343
|
|
|
5290
5344
|
// ../contract/src/live-coordination.ts
|
|
5291
|
-
import { z as
|
|
5345
|
+
import { z as z41 } from "zod";
|
|
5292
5346
|
var LIVE_PROTOCOL = 3;
|
|
5293
5347
|
var LIVE_WORKER_NAME = "cezar-live-v3";
|
|
5294
5348
|
var LEASE_MS = 15e3;
|
|
@@ -5297,111 +5351,111 @@ function allowedLiveRead(path) {
|
|
|
5297
5351
|
if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
|
|
5298
5352
|
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);
|
|
5299
5353
|
}
|
|
5300
|
-
var liveDemandSchema =
|
|
5301
|
-
|
|
5302
|
-
liveRunDemandSchema.extend({ kind:
|
|
5303
|
-
|
|
5354
|
+
var liveDemandSchema = z41.discriminatedUnion("kind", [
|
|
5355
|
+
z41.object({ kind: z41.literal("workspace") }),
|
|
5356
|
+
liveRunDemandSchema.extend({ kind: z41.literal("run") }),
|
|
5357
|
+
z41.object({ kind: z41.literal("topic"), topic: z41.string().min(1).max(128) }),
|
|
5304
5358
|
// Preserve server-directed cadence (settled references use ten minutes). Only
|
|
5305
5359
|
// bound the timer itself: larger delays overflow setTimeout into a tight loop.
|
|
5306
|
-
|
|
5360
|
+
z41.object({ kind: z41.literal("read"), path: z41.string().max(4096).refine(allowedLiveRead), intervalMs: z41.number().int().min(1e3).max(2147483647) })
|
|
5307
5361
|
]);
|
|
5308
|
-
var liveEntrySchema =
|
|
5309
|
-
var envelope =
|
|
5310
|
-
var ownerInputSchema =
|
|
5362
|
+
var liveEntrySchema = z41.object({ id: z41.string().min(1).max(128), demand: liveDemandSchema });
|
|
5363
|
+
var envelope = z41.object({ version: z41.literal(LIVE_PROTOCOL), documentId: z41.string().min(1).max(128), epoch: z41.number().int().nonnegative() });
|
|
5364
|
+
var ownerInputSchema = z41.discriminatedUnion("type", [
|
|
5311
5365
|
envelope.extend({
|
|
5312
|
-
type:
|
|
5313
|
-
entries:
|
|
5366
|
+
type: z41.literal("sync"),
|
|
5367
|
+
entries: z41.array(liveEntrySchema).max(64),
|
|
5314
5368
|
/** The document knows no workspace stream generation (its `ready` was lost, for example to
|
|
5315
5369
|
* an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
|
|
5316
|
-
workspaceReady:
|
|
5370
|
+
workspaceReady: z41.literal(true).optional()
|
|
5317
5371
|
}).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
|
|
5318
|
-
envelope.extend({ type:
|
|
5319
|
-
envelope.extend({ type:
|
|
5372
|
+
envelope.extend({ type: z41.literal("ack"), id: z41.string(), seq: z41.number().int().nonnegative() }),
|
|
5373
|
+
envelope.extend({ type: z41.literal("refresh"), id: z41.string() })
|
|
5320
5374
|
]);
|
|
5321
|
-
var wireFrameSchema =
|
|
5322
|
-
var ownerOutputSchema =
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5375
|
+
var wireFrameSchema = z41.object({ event: z41.string(), data: z41.string(), id: z41.string() });
|
|
5376
|
+
var ownerOutputSchema = z41.discriminatedUnion("type", [
|
|
5377
|
+
z41.object({ type: z41.literal("unavailable"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), reason: z41.string() }),
|
|
5378
|
+
z41.object({ type: z41.literal("hello"), version: z41.literal(LIVE_PROTOCOL) }),
|
|
5379
|
+
z41.object({ type: z41.literal("alive"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number() }),
|
|
5380
|
+
z41.object({ type: z41.literal("frame"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), frame: z41.union([wireFrameSchema, liveRunFrameSchema]) }),
|
|
5381
|
+
z41.object({ type: z41.literal("value"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), value: z41.unknown(), error: z41.string().optional() }),
|
|
5382
|
+
z41.object({ type: z41.literal("reset"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), reason: z41.string() })
|
|
5329
5383
|
]);
|
|
5330
5384
|
var runKey = (run) => `${run.projectId}/${run.runId}`;
|
|
5331
5385
|
|
|
5332
5386
|
// ../contract/src/workspace-events.ts
|
|
5333
|
-
import { z as
|
|
5334
|
-
var workspaceEventsQuerySchema =
|
|
5335
|
-
runs:
|
|
5387
|
+
import { z as z42 } from "zod";
|
|
5388
|
+
var workspaceEventsQuerySchema = z42.object({
|
|
5389
|
+
runs: z42.literal("summary").optional()
|
|
5336
5390
|
});
|
|
5337
|
-
var projectStamp =
|
|
5338
|
-
var frameSeq =
|
|
5339
|
-
var workspaceRunSummaryEventSchema =
|
|
5391
|
+
var projectStamp = z42.string().min(1);
|
|
5392
|
+
var frameSeq = z42.number().int().positive();
|
|
5393
|
+
var workspaceRunSummaryEventSchema = z42.object({
|
|
5340
5394
|
project: projectStamp,
|
|
5341
5395
|
seq: frameSeq,
|
|
5342
5396
|
run: runSummarySchema,
|
|
5343
|
-
relationships:
|
|
5397
|
+
relationships: z42.string().min(1)
|
|
5344
5398
|
});
|
|
5345
|
-
var workspaceRunDeletedEventSchema =
|
|
5399
|
+
var workspaceRunDeletedEventSchema = z42.object({
|
|
5346
5400
|
project: projectStamp,
|
|
5347
5401
|
seq: frameSeq,
|
|
5348
|
-
id:
|
|
5402
|
+
id: z42.string().min(1)
|
|
5349
5403
|
});
|
|
5350
|
-
var workspaceReadyEventSchema =
|
|
5351
|
-
generation:
|
|
5352
|
-
seq:
|
|
5404
|
+
var workspaceReadyEventSchema = z42.object({
|
|
5405
|
+
generation: z42.string().min(1),
|
|
5406
|
+
seq: z42.number().int().nonnegative()
|
|
5353
5407
|
});
|
|
5354
|
-
var workspaceUsageEventSchema =
|
|
5408
|
+
var workspaceUsageEventSchema = z42.object({
|
|
5355
5409
|
project: projectStamp,
|
|
5356
|
-
usage:
|
|
5410
|
+
usage: z42.record(z42.string(), processUsageSchema)
|
|
5357
5411
|
});
|
|
5358
|
-
var runsIndexResponseSchema =
|
|
5412
|
+
var runsIndexResponseSchema = z42.object({
|
|
5359
5413
|
/** Newest first, across every registered project: each project's window
|
|
5360
5414
|
* (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
|
|
5361
5415
|
* archived root runs. Owned workers are never included. Older archived runs are reached
|
|
5362
5416
|
* through `GET /workspace/runs-search`. */
|
|
5363
|
-
runs:
|
|
5417
|
+
runs: z42.array(runIndexEntrySchema),
|
|
5364
5418
|
/** Additive: absent statuses mean "nothing warm", never "nothing to show". */
|
|
5365
5419
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
5366
5420
|
/** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
|
|
5367
|
-
perProjectLimit:
|
|
5421
|
+
perProjectLimit: z42.number(),
|
|
5368
5422
|
/** Ids of the projects that had more archived root runs than `perProjectLimit`. */
|
|
5369
|
-
truncated:
|
|
5423
|
+
truncated: z42.array(z42.string()),
|
|
5370
5424
|
/** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
|
|
5371
5425
|
* compares only within one generation. */
|
|
5372
|
-
generation:
|
|
5426
|
+
generation: z42.string().min(1),
|
|
5373
5427
|
/** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
|
|
5374
5428
|
* frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
|
|
5375
|
-
eventSeq:
|
|
5429
|
+
eventSeq: z42.number().int().nonnegative()
|
|
5376
5430
|
});
|
|
5377
5431
|
|
|
5378
5432
|
// ../contract/src/permissions.ts
|
|
5379
|
-
import { z as
|
|
5380
|
-
var permissionOptionKindSchema =
|
|
5381
|
-
var permissionOptionSchema =
|
|
5382
|
-
id:
|
|
5383
|
-
label:
|
|
5433
|
+
import { z as z43 } from "zod";
|
|
5434
|
+
var permissionOptionKindSchema = z43.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
|
|
5435
|
+
var permissionOptionSchema = z43.object({
|
|
5436
|
+
id: z43.string().min(1).max(128),
|
|
5437
|
+
label: z43.string().min(1),
|
|
5384
5438
|
kind: permissionOptionKindSchema
|
|
5385
5439
|
}).strict();
|
|
5386
|
-
var permissionRequestedSchema =
|
|
5387
|
-
type:
|
|
5388
|
-
requestId:
|
|
5389
|
-
itemId:
|
|
5390
|
-
title:
|
|
5391
|
-
details:
|
|
5392
|
-
options:
|
|
5440
|
+
var permissionRequestedSchema = z43.object({
|
|
5441
|
+
type: z43.literal("permission.requested"),
|
|
5442
|
+
requestId: z43.string().min(1).max(128),
|
|
5443
|
+
itemId: z43.string().optional(),
|
|
5444
|
+
title: z43.string().min(1),
|
|
5445
|
+
details: z43.string().optional(),
|
|
5446
|
+
options: z43.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
|
|
5393
5447
|
}).strict();
|
|
5394
|
-
var permissionResolvedSchema =
|
|
5395
|
-
type:
|
|
5396
|
-
requestId:
|
|
5397
|
-
optionId:
|
|
5398
|
-
reason:
|
|
5448
|
+
var permissionResolvedSchema = z43.object({
|
|
5449
|
+
type: z43.literal("permission.resolved"),
|
|
5450
|
+
requestId: z43.string().min(1).max(128),
|
|
5451
|
+
optionId: z43.string().optional(),
|
|
5452
|
+
reason: z43.string().optional()
|
|
5399
5453
|
}).strict();
|
|
5400
|
-
var permissionDecisionSchema =
|
|
5401
|
-
requestId:
|
|
5402
|
-
optionId:
|
|
5454
|
+
var permissionDecisionSchema = z43.object({
|
|
5455
|
+
requestId: z43.string().min(1).max(128),
|
|
5456
|
+
optionId: z43.string().min(1).max(128)
|
|
5403
5457
|
}).strict();
|
|
5404
|
-
var permissionDecisionResponseSchema =
|
|
5458
|
+
var permissionDecisionResponseSchema = z43.object({ delivered: z43.literal(true) });
|
|
5405
5459
|
|
|
5406
5460
|
// ../contract/src/defined.ts
|
|
5407
5461
|
function defined(value) {
|
|
@@ -5671,83 +5725,83 @@ function isImagePath(path) {
|
|
|
5671
5725
|
}
|
|
5672
5726
|
|
|
5673
5727
|
// ../contract/src/provider-requests.ts
|
|
5674
|
-
import { z as
|
|
5675
|
-
var providerConnectSchema =
|
|
5728
|
+
import { z as z44 } from "zod";
|
|
5729
|
+
var providerConnectSchema = z44.object({
|
|
5676
5730
|
provider: runnerSchema,
|
|
5677
5731
|
/** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
|
|
5678
5732
|
* default, which is what every pre-profiles client sends. Without this, "Connect" on a second
|
|
5679
5733
|
* Claude account would open a login for the FIRST one and report success. */
|
|
5680
|
-
profileId:
|
|
5734
|
+
profileId: z44.string().max(64).optional()
|
|
5681
5735
|
}).strict();
|
|
5682
|
-
var createAgentProfileSchema =
|
|
5736
|
+
var createAgentProfileSchema = z44.object({
|
|
5683
5737
|
provider: runnerSchema,
|
|
5684
|
-
label:
|
|
5685
|
-
configDir:
|
|
5738
|
+
label: z44.string().trim().max(200).optional(),
|
|
5739
|
+
configDir: z44.string().trim().min(1).max(4096)
|
|
5686
5740
|
}).strict();
|
|
5687
|
-
var updateAgentProfileSchema =
|
|
5688
|
-
label:
|
|
5689
|
-
configDir:
|
|
5741
|
+
var updateAgentProfileSchema = z44.object({
|
|
5742
|
+
label: z44.string().trim().max(200).optional(),
|
|
5743
|
+
configDir: z44.string().trim().min(1).max(4096).optional()
|
|
5690
5744
|
}).strict().refine(
|
|
5691
5745
|
(value) => value.label !== void 0 || value.configDir !== void 0,
|
|
5692
5746
|
"send label or configDir"
|
|
5693
5747
|
);
|
|
5694
|
-
var selectAgentProfileSchema =
|
|
5695
|
-
projectId:
|
|
5748
|
+
var selectAgentProfileSchema = z44.object({
|
|
5749
|
+
projectId: z44.string().min(1).max(64),
|
|
5696
5750
|
provider: runnerSchema,
|
|
5697
|
-
profileId:
|
|
5751
|
+
profileId: z44.string().max(64).nullable()
|
|
5698
5752
|
}).strict();
|
|
5699
5753
|
var providerParamSchema = runnerSchema;
|
|
5700
|
-
var providerEnabledSchema =
|
|
5701
|
-
var providerRetrySchema =
|
|
5702
|
-
authFailureId:
|
|
5754
|
+
var providerEnabledSchema = z44.object({ enabled: z44.boolean() }).strict();
|
|
5755
|
+
var providerRetrySchema = z44.object({
|
|
5756
|
+
authFailureId: z44.string().min(1).max(128)
|
|
5703
5757
|
}).strict();
|
|
5704
|
-
var providerRouteParamsSchema =
|
|
5705
|
-
var agentProfileRouteParamsSchema =
|
|
5706
|
-
var providerSignInParamsSchema =
|
|
5707
|
-
var providerSignInRedirectSchema =
|
|
5758
|
+
var providerRouteParamsSchema = z44.object({ provider: providerParamSchema });
|
|
5759
|
+
var agentProfileRouteParamsSchema = z44.object({ id: z44.string() });
|
|
5760
|
+
var providerSignInParamsSchema = z44.object({ id: z44.uuid() });
|
|
5761
|
+
var providerSignInRedirectSchema = z44.object({
|
|
5708
5762
|
/** The address the browser landed on after consent, or the code that page shows. */
|
|
5709
|
-
redirectUrl:
|
|
5763
|
+
redirectUrl: z44.string().trim().min(1).max(8192)
|
|
5710
5764
|
}).strict();
|
|
5711
5765
|
|
|
5712
5766
|
// ../contract/src/automation-requests.ts
|
|
5713
|
-
import { z as
|
|
5767
|
+
import { z as z46 } from "zod";
|
|
5714
5768
|
|
|
5715
5769
|
// ../contract/src/automation-storage.ts
|
|
5716
|
-
import { z as
|
|
5717
|
-
var storedAutomationEventSchema =
|
|
5770
|
+
import { z as z45 } from "zod";
|
|
5771
|
+
var storedAutomationEventSchema = z45.enum([
|
|
5718
5772
|
"pull_request.opened",
|
|
5719
5773
|
"issue.opened",
|
|
5720
5774
|
"issue.labeled",
|
|
5721
5775
|
"issue.unlabeled"
|
|
5722
5776
|
]);
|
|
5723
|
-
var boundedString =
|
|
5724
|
-
var stringList =
|
|
5725
|
-
var storedAutomationFiltersSchema =
|
|
5726
|
-
includeExisting:
|
|
5777
|
+
var boundedString = z45.string().trim().min(1).max(200);
|
|
5778
|
+
var stringList = z45.array(boundedString).max(100).optional();
|
|
5779
|
+
var storedAutomationFiltersSchema = z45.object({
|
|
5780
|
+
includeExisting: z45.boolean().optional(),
|
|
5727
5781
|
/** Require an open item and matching live labels before reservation and launch. */
|
|
5728
|
-
requireCurrentLabels:
|
|
5782
|
+
requireCurrentLabels: z45.boolean().optional(),
|
|
5729
5783
|
authors: stringList,
|
|
5730
5784
|
assignees: stringList,
|
|
5731
5785
|
allLabels: stringList,
|
|
5732
5786
|
anyLabels: stringList,
|
|
5733
5787
|
excludeLabels: stringList,
|
|
5734
5788
|
changedLabels: stringList,
|
|
5735
|
-
lookbackDays:
|
|
5736
|
-
maxRecords:
|
|
5789
|
+
lookbackDays: z45.number().int().min(1).max(90).default(7),
|
|
5790
|
+
maxRecords: z45.number().int().min(1).max(100).default(25)
|
|
5737
5791
|
}).passthrough();
|
|
5738
|
-
var storedAutomationTaskSchema =
|
|
5739
|
-
prompt:
|
|
5740
|
-
workflow:
|
|
5741
|
-
steps:
|
|
5792
|
+
var storedAutomationTaskSchema = z45.object({
|
|
5793
|
+
prompt: z45.string().min(1).max(1e5),
|
|
5794
|
+
workflow: z45.string().trim().min(1).max(200).optional(),
|
|
5795
|
+
steps: z45.array(workflowStepDefSchema).min(1).max(100).optional(),
|
|
5742
5796
|
runner: runnerSchema.optional(),
|
|
5743
|
-
model:
|
|
5744
|
-
effort:
|
|
5745
|
-
variants:
|
|
5746
|
-
worktree:
|
|
5747
|
-
autonomous:
|
|
5797
|
+
model: z45.string().trim().min(1).max(200).optional(),
|
|
5798
|
+
effort: z45.string().trim().min(1).max(32).optional(),
|
|
5799
|
+
variants: z45.union([z45.literal(1), z45.literal(2), z45.literal(3)]).optional(),
|
|
5800
|
+
worktree: z45.boolean().optional(),
|
|
5801
|
+
autonomous: z45.boolean().optional(),
|
|
5748
5802
|
...completionControlsShape,
|
|
5749
5803
|
...taskAccessShape,
|
|
5750
|
-
systemPrompt:
|
|
5804
|
+
systemPrompt: z45.string().max(1e5).optional()
|
|
5751
5805
|
}).passthrough().refine((task) => !(task.workflow && task.steps), {
|
|
5752
5806
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5753
5807
|
});
|
|
@@ -5765,122 +5819,122 @@ var fillGithubDefaults = (raw) => {
|
|
|
5765
5819
|
filters: record.filters ?? {}
|
|
5766
5820
|
};
|
|
5767
5821
|
};
|
|
5768
|
-
var storedAutomationDefinitionObjectSchema =
|
|
5769
|
-
id:
|
|
5770
|
-
revision:
|
|
5771
|
-
name:
|
|
5772
|
-
description:
|
|
5773
|
-
enabled:
|
|
5822
|
+
var storedAutomationDefinitionObjectSchema = z45.object({
|
|
5823
|
+
id: z45.string().min(1).max(100),
|
|
5824
|
+
revision: z45.number().int().positive(),
|
|
5825
|
+
name: z45.string().trim().min(1).max(200),
|
|
5826
|
+
description: z45.string().max(2e3).optional(),
|
|
5827
|
+
enabled: z45.boolean().default(false),
|
|
5774
5828
|
/** A definition written before schedules has no `kind`: it is a poll. */
|
|
5775
5829
|
kind: automationKindSchema.default("github"),
|
|
5776
|
-
events:
|
|
5777
|
-
intervalSeconds:
|
|
5830
|
+
events: z45.array(storedAutomationEventSchema).min(1).max(4).optional(),
|
|
5831
|
+
intervalSeconds: z45.number().int().min(60).max(86400).optional(),
|
|
5778
5832
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5779
5833
|
// Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
|
|
5780
5834
|
schedule: automationScheduleSchema.passthrough().optional(),
|
|
5781
5835
|
task: storedAutomationTaskSchema,
|
|
5782
5836
|
/** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
|
|
5783
|
-
archived:
|
|
5784
|
-
at:
|
|
5785
|
-
outcome:
|
|
5786
|
-
runId:
|
|
5787
|
-
receiptId:
|
|
5788
|
-
trigger:
|
|
5837
|
+
archived: z45.object({
|
|
5838
|
+
at: z45.string().datetime(),
|
|
5839
|
+
outcome: z45.enum(["launched", "cancelled"]),
|
|
5840
|
+
runId: z45.string().optional(),
|
|
5841
|
+
receiptId: z45.string().optional(),
|
|
5842
|
+
trigger: z45.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
5789
5843
|
}).passthrough().optional(),
|
|
5790
|
-
createdAt:
|
|
5791
|
-
updatedAt:
|
|
5844
|
+
createdAt: z45.string().datetime(),
|
|
5845
|
+
updatedAt: z45.string().datetime()
|
|
5792
5846
|
}).passthrough().superRefine((definition, ctx) => {
|
|
5793
5847
|
if (definition.kind === "schedule") {
|
|
5794
5848
|
if (!definition.schedule) {
|
|
5795
|
-
ctx.addIssue({ code:
|
|
5849
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
|
|
5796
5850
|
}
|
|
5797
5851
|
return;
|
|
5798
5852
|
}
|
|
5799
5853
|
if (!definition.events?.length) {
|
|
5800
|
-
ctx.addIssue({ code:
|
|
5854
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
|
|
5801
5855
|
}
|
|
5802
5856
|
if (definition.intervalSeconds === void 0) {
|
|
5803
|
-
ctx.addIssue({ code:
|
|
5857
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
|
|
5804
5858
|
}
|
|
5805
5859
|
if (!definition.filters) {
|
|
5806
|
-
ctx.addIssue({ code:
|
|
5860
|
+
ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
|
|
5807
5861
|
}
|
|
5808
5862
|
if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
|
|
5809
5863
|
ctx.addIssue({
|
|
5810
|
-
code:
|
|
5864
|
+
code: z45.ZodIssueCode.custom,
|
|
5811
5865
|
path: ["filters", "changedLabels"],
|
|
5812
5866
|
message: "changedLabels is required for issue label events"
|
|
5813
5867
|
});
|
|
5814
5868
|
}
|
|
5815
5869
|
});
|
|
5816
|
-
var storedAutomationDefinitionSchema =
|
|
5817
|
-
var storedAutomationDefinitionsFileSchema =
|
|
5818
|
-
version:
|
|
5819
|
-
automations:
|
|
5820
|
-
tombstones:
|
|
5870
|
+
var storedAutomationDefinitionSchema = z45.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
|
|
5871
|
+
var storedAutomationDefinitionsFileSchema = z45.object({
|
|
5872
|
+
version: z45.literal(1).default(1),
|
|
5873
|
+
automations: z45.array(z45.unknown()).default([]),
|
|
5874
|
+
tombstones: z45.record(z45.string(), z45.string().datetime()).optional()
|
|
5821
5875
|
}).passthrough();
|
|
5822
|
-
var storedAutomationCursorSchema =
|
|
5823
|
-
timestamp:
|
|
5824
|
-
tieBreaker:
|
|
5876
|
+
var storedAutomationCursorSchema = z45.object({
|
|
5877
|
+
timestamp: z45.string().datetime(),
|
|
5878
|
+
tieBreaker: z45.string().optional()
|
|
5825
5879
|
}).passthrough();
|
|
5826
5880
|
var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
|
|
5827
5881
|
cursor: storedAutomationCursorSchema.optional()
|
|
5828
5882
|
});
|
|
5829
|
-
var storedAutomationRuntimeStateSchema =
|
|
5830
|
-
revision:
|
|
5831
|
-
baselineAt:
|
|
5883
|
+
var storedAutomationRuntimeStateSchema = z45.object({
|
|
5884
|
+
revision: z45.number().int().positive().optional(),
|
|
5885
|
+
baselineAt: z45.string().datetime().optional(),
|
|
5832
5886
|
/** Arming time, independent of a history window's older lower bound. */
|
|
5833
|
-
armedAt:
|
|
5887
|
+
armedAt: z45.string().datetime().optional(),
|
|
5834
5888
|
historyScan: storedAutomationHistoryScanSchema.optional(),
|
|
5835
5889
|
cursor: storedAutomationCursorSchema.optional(),
|
|
5836
|
-
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5837
|
-
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5838
|
-
nextCheckAt:
|
|
5839
|
-
lastSuccessAt:
|
|
5890
|
+
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
|
|
5891
|
+
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
|
|
5892
|
+
nextCheckAt: z45.string().datetime().optional(),
|
|
5893
|
+
lastSuccessAt: z45.string().datetime().optional(),
|
|
5840
5894
|
/** schedule kind: the next occurrence's instant and the last fired one's. */
|
|
5841
|
-
nextRunAt:
|
|
5842
|
-
lastRunAt:
|
|
5843
|
-
etags:
|
|
5844
|
-
backoffUntil:
|
|
5845
|
-
consecutiveFailures:
|
|
5895
|
+
nextRunAt: z45.string().datetime().optional(),
|
|
5896
|
+
lastRunAt: z45.string().datetime().optional(),
|
|
5897
|
+
etags: z45.record(z45.string(), z45.string()).optional(),
|
|
5898
|
+
backoffUntil: z45.string().datetime().optional(),
|
|
5899
|
+
consecutiveFailures: z45.number().int().nonnegative().optional(),
|
|
5846
5900
|
...automationLastErrorShape,
|
|
5847
5901
|
/** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
|
|
5848
|
-
onceOutcome:
|
|
5902
|
+
onceOutcome: z45.enum(["failed", "missed"]).optional()
|
|
5849
5903
|
}).passthrough();
|
|
5850
|
-
var storedAutomationStateFileSchema =
|
|
5851
|
-
version:
|
|
5852
|
-
states:
|
|
5904
|
+
var storedAutomationStateFileSchema = z45.object({
|
|
5905
|
+
version: z45.literal(1).default(1),
|
|
5906
|
+
states: z45.record(z45.string(), storedAutomationRuntimeStateSchema).default({})
|
|
5853
5907
|
}).passthrough();
|
|
5854
|
-
var storedAutomationReceiptSchema =
|
|
5855
|
-
receiptId:
|
|
5856
|
-
receiptKey:
|
|
5857
|
-
eventId:
|
|
5858
|
-
automationId:
|
|
5859
|
-
revision:
|
|
5860
|
-
status:
|
|
5861
|
-
runId:
|
|
5862
|
-
observedAt:
|
|
5863
|
-
updatedAt:
|
|
5864
|
-
error:
|
|
5908
|
+
var storedAutomationReceiptSchema = z45.object({
|
|
5909
|
+
receiptId: z45.string().min(1),
|
|
5910
|
+
receiptKey: z45.string().min(1),
|
|
5911
|
+
eventId: z45.string().min(1),
|
|
5912
|
+
automationId: z45.string().min(1),
|
|
5913
|
+
revision: z45.number().int().positive(),
|
|
5914
|
+
status: z45.enum(["reserved", "launched", "launch-error", "released"]),
|
|
5915
|
+
runId: z45.string().optional(),
|
|
5916
|
+
observedAt: z45.string().datetime(),
|
|
5917
|
+
updatedAt: z45.string().datetime(),
|
|
5918
|
+
error: z45.string().max(2e3).optional(),
|
|
5865
5919
|
/** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
|
|
5866
|
-
occurrenceAt:
|
|
5867
|
-
candidate:
|
|
5868
|
-
eventId:
|
|
5920
|
+
occurrenceAt: z45.string().datetime().optional(),
|
|
5921
|
+
candidate: z45.object({
|
|
5922
|
+
eventId: z45.string(),
|
|
5869
5923
|
event: storedAutomationEventSchema,
|
|
5870
|
-
timestamp:
|
|
5871
|
-
tieBreaker:
|
|
5872
|
-
repo:
|
|
5873
|
-
nodeId:
|
|
5874
|
-
number:
|
|
5875
|
-
title:
|
|
5876
|
-
url:
|
|
5877
|
-
author:
|
|
5878
|
-
assignees:
|
|
5879
|
-
labels:
|
|
5880
|
-
changedLabel:
|
|
5924
|
+
timestamp: z45.string().datetime(),
|
|
5925
|
+
tieBreaker: z45.string(),
|
|
5926
|
+
repo: z45.string(),
|
|
5927
|
+
nodeId: z45.string(),
|
|
5928
|
+
number: z45.number().int().positive(),
|
|
5929
|
+
title: z45.string().max(500),
|
|
5930
|
+
url: z45.string().url(),
|
|
5931
|
+
author: z45.string().max(200),
|
|
5932
|
+
assignees: z45.array(z45.string().max(200)).max(100),
|
|
5933
|
+
labels: z45.array(z45.string().max(200)).max(100),
|
|
5934
|
+
changedLabel: z45.string().max(200).optional()
|
|
5881
5935
|
}).passthrough().optional()
|
|
5882
5936
|
}).passthrough();
|
|
5883
|
-
var storedAutomationLogResultSchema =
|
|
5937
|
+
var storedAutomationLogResultSchema = z45.enum([
|
|
5884
5938
|
"launched",
|
|
5885
5939
|
"no-match",
|
|
5886
5940
|
"duplicate",
|
|
@@ -5896,24 +5950,24 @@ var storedAutomationLogResultSchema = z44.enum([
|
|
|
5896
5950
|
// once schedule
|
|
5897
5951
|
"missed"
|
|
5898
5952
|
]);
|
|
5899
|
-
var storedAutomationLogRecordSchema =
|
|
5900
|
-
seq:
|
|
5901
|
-
ts:
|
|
5902
|
-
automationId:
|
|
5903
|
-
revision:
|
|
5953
|
+
var storedAutomationLogRecordSchema = z45.object({
|
|
5954
|
+
seq: z45.number().int().positive(),
|
|
5955
|
+
ts: z45.string().datetime(),
|
|
5956
|
+
automationId: z45.string().min(1),
|
|
5957
|
+
revision: z45.number().int().positive(),
|
|
5904
5958
|
event: storedAutomationEventSchema.optional(),
|
|
5905
5959
|
result: storedAutomationLogResultSchema,
|
|
5906
|
-
reason:
|
|
5907
|
-
durationMs:
|
|
5908
|
-
receiptId:
|
|
5909
|
-
runId:
|
|
5910
|
-
githubNumber:
|
|
5911
|
-
githubTitle:
|
|
5912
|
-
githubUrl:
|
|
5913
|
-
rateLimit:
|
|
5914
|
-
bucket:
|
|
5915
|
-
remaining:
|
|
5916
|
-
resetAt:
|
|
5960
|
+
reason: z45.string().max(2e3).optional(),
|
|
5961
|
+
durationMs: z45.number().int().nonnegative().optional(),
|
|
5962
|
+
receiptId: z45.string().optional(),
|
|
5963
|
+
runId: z45.string().optional(),
|
|
5964
|
+
githubNumber: z45.number().int().positive().optional(),
|
|
5965
|
+
githubTitle: z45.string().max(500).optional(),
|
|
5966
|
+
githubUrl: z45.string().url().optional(),
|
|
5967
|
+
rateLimit: z45.object({
|
|
5968
|
+
bucket: z45.enum(["core", "search"]),
|
|
5969
|
+
remaining: z45.number().int().nonnegative().optional(),
|
|
5970
|
+
resetAt: z45.string().datetime().optional()
|
|
5917
5971
|
}).passthrough().optional()
|
|
5918
5972
|
}).passthrough();
|
|
5919
5973
|
function storedIsOnceSchedule(definition) {
|
|
@@ -5927,210 +5981,210 @@ function storedIsScheduleAutomation(definition) {
|
|
|
5927
5981
|
}
|
|
5928
5982
|
|
|
5929
5983
|
// ../contract/src/automation-requests.ts
|
|
5930
|
-
var automationEditableSchema =
|
|
5931
|
-
name:
|
|
5932
|
-
description:
|
|
5933
|
-
enabled:
|
|
5984
|
+
var automationEditableSchema = z46.object({
|
|
5985
|
+
name: z46.string().trim().min(1).max(200),
|
|
5986
|
+
description: z46.string().max(2e3).optional(),
|
|
5987
|
+
enabled: z46.boolean().optional(),
|
|
5934
5988
|
kind: automationKindSchema.optional(),
|
|
5935
|
-
events:
|
|
5936
|
-
intervalSeconds:
|
|
5989
|
+
events: z46.array(automationEventSchema).min(1).max(4).optional(),
|
|
5990
|
+
intervalSeconds: z46.number().int().min(60).max(86400).optional(),
|
|
5937
5991
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5938
5992
|
schedule: automationScheduleSchema.optional(),
|
|
5939
|
-
task:
|
|
5993
|
+
task: z46.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
|
|
5940
5994
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5941
5995
|
})
|
|
5942
5996
|
}).strict();
|
|
5943
|
-
var automationCreateSchema = automationEditableSchema.extend({ enable:
|
|
5944
|
-
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision:
|
|
5945
|
-
var automationCheckRequestSchema =
|
|
5946
|
-
var automationLogQuerySchema =
|
|
5947
|
-
automationId:
|
|
5997
|
+
var automationCreateSchema = automationEditableSchema.extend({ enable: z46.boolean().optional() });
|
|
5998
|
+
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z46.number().int().positive() });
|
|
5999
|
+
var automationCheckRequestSchema = z46.object({ mode: z46.enum(["preview", "execute"]) }).strict();
|
|
6000
|
+
var automationLogQuerySchema = z46.object({
|
|
6001
|
+
automationId: z46.string().optional(),
|
|
5948
6002
|
result: automationLogResultSchema.optional(),
|
|
5949
6003
|
event: automationEventSchema.optional(),
|
|
5950
|
-
since:
|
|
5951
|
-
cursor:
|
|
6004
|
+
since: z46.string().datetime().optional(),
|
|
6005
|
+
cursor: z46.coerce.number().int().positive().optional(),
|
|
5952
6006
|
// Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
|
|
5953
6007
|
// 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
|
|
5954
6008
|
// request type `queryZodValidator` publishes (see validators.ts on why the request side falls
|
|
5955
6009
|
// back to the schema's output), which would have made every caller send a `?limit=` this route
|
|
5956
6010
|
// never needed.
|
|
5957
|
-
limit:
|
|
6011
|
+
limit: z46.coerce.number().int().min(1).max(100).optional()
|
|
5958
6012
|
});
|
|
5959
6013
|
|
|
5960
6014
|
// ../contract/src/workflow-requests.ts
|
|
5961
|
-
import { z as
|
|
5962
|
-
var planSchema =
|
|
6015
|
+
import { z as z47 } from "zod";
|
|
6016
|
+
var planSchema = z47.object({
|
|
5963
6017
|
// Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
|
|
5964
|
-
task:
|
|
6018
|
+
task: z47.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
|
|
5965
6019
|
/** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
|
|
5966
6020
|
* selection (hearsay-tools/squawk#4116). */
|
|
5967
|
-
agentProfile:
|
|
6021
|
+
agentProfile: z47.string().max(64).optional()
|
|
5968
6022
|
});
|
|
5969
|
-
var parseWorkflowSchema =
|
|
5970
|
-
yaml:
|
|
6023
|
+
var parseWorkflowSchema = z47.object({
|
|
6024
|
+
yaml: z47.string().min(1).max(1e5)
|
|
5971
6025
|
});
|
|
5972
6026
|
|
|
5973
6027
|
// ../contract/src/ui-state-requests.ts
|
|
5974
|
-
import { z as
|
|
6028
|
+
import { z as z48 } from "zod";
|
|
5975
6029
|
var SKILL_USAGE_MAX_ENTRIES = 200;
|
|
5976
6030
|
var UI_STATE_MAX_KEYS = 200;
|
|
5977
6031
|
var uiStateSchema2 = uiStateSchema.extend({
|
|
5978
6032
|
// null records a quick task with no selected skill or workflow.
|
|
5979
|
-
lastTask:
|
|
5980
|
-
source:
|
|
5981
|
-
ref:
|
|
6033
|
+
lastTask: z48.object({
|
|
6034
|
+
source: z48.enum(["workflow", "skill"]),
|
|
6035
|
+
ref: z48.string().min(1).max(200)
|
|
5982
6036
|
}).nullable().optional(),
|
|
5983
6037
|
// Most recent source choices, newest first.
|
|
5984
|
-
recentSources:
|
|
5985
|
-
|
|
5986
|
-
source:
|
|
5987
|
-
ref:
|
|
6038
|
+
recentSources: z48.array(
|
|
6039
|
+
z48.object({
|
|
6040
|
+
source: z48.enum(["workflow", "skill"]),
|
|
6041
|
+
ref: z48.string().min(1).max(200)
|
|
5988
6042
|
})
|
|
5989
6043
|
).max(50).optional(),
|
|
5990
|
-
skillUsage:
|
|
6044
|
+
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, {
|
|
5991
6045
|
message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
|
|
5992
6046
|
}).optional(),
|
|
5993
|
-
promptTemplates:
|
|
5994
|
-
|
|
5995
|
-
id:
|
|
5996
|
-
label:
|
|
5997
|
-
text:
|
|
6047
|
+
promptTemplates: z48.array(
|
|
6048
|
+
z48.object({
|
|
6049
|
+
id: z48.string().min(1).max(64),
|
|
6050
|
+
label: z48.string().trim().min(1).max(80),
|
|
6051
|
+
text: z48.string().trim().min(1).max(2e3),
|
|
5998
6052
|
// Skill names this template auto-applies for. Optional and additive: templates
|
|
5999
6053
|
// written before this key existed keep validating, and stay manual-only.
|
|
6000
|
-
skills:
|
|
6054
|
+
skills: z48.array(z48.string().trim().min(1).max(200)).max(50).optional()
|
|
6001
6055
|
})
|
|
6002
6056
|
).max(50).optional()
|
|
6003
6057
|
}).passthrough();
|
|
6004
6058
|
function capUiStateKeys(data, ctx) {
|
|
6005
6059
|
if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
|
|
6006
|
-
ctx.addIssue({ code:
|
|
6060
|
+
ctx.addIssue({ code: z48.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
|
|
6007
6061
|
}
|
|
6008
6062
|
}
|
|
6009
6063
|
var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
|
|
6010
6064
|
|
|
6011
6065
|
// ../contract/src/run-requests.ts
|
|
6012
|
-
import { z as
|
|
6013
|
-
var queuedMessagePatchSchema =
|
|
6014
|
-
text:
|
|
6015
|
-
images:
|
|
6066
|
+
import { z as z49 } from "zod";
|
|
6067
|
+
var queuedMessagePatchSchema = z49.object({
|
|
6068
|
+
text: z49.string().max(1e5).optional(),
|
|
6069
|
+
images: z49.array(attachmentInputSchema).max(4).optional()
|
|
6016
6070
|
}).refine((m) => m.text !== void 0 || m.images !== void 0, {
|
|
6017
6071
|
message: "message edit needs text or attachments"
|
|
6018
6072
|
});
|
|
6019
|
-
var continueSchema =
|
|
6020
|
-
text:
|
|
6021
|
-
images:
|
|
6073
|
+
var continueSchema = z49.object({
|
|
6074
|
+
text: z49.string().max(1e5, "must be at most 100000 characters").optional(),
|
|
6075
|
+
images: z49.array(attachmentInputSchema).max(4).optional(),
|
|
6022
6076
|
runner: runnerSchema.optional(),
|
|
6023
|
-
model:
|
|
6077
|
+
model: z49.string().max(200).optional(),
|
|
6024
6078
|
/** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
|
|
6025
|
-
effort:
|
|
6079
|
+
effort: z49.string().max(32).optional()
|
|
6026
6080
|
});
|
|
6027
|
-
var archiveSchema =
|
|
6028
|
-
archived:
|
|
6081
|
+
var archiveSchema = z49.object({
|
|
6082
|
+
archived: z49.boolean().optional()
|
|
6029
6083
|
});
|
|
6030
|
-
var openInSchema =
|
|
6084
|
+
var openInSchema = z49.object({
|
|
6031
6085
|
// A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
|
|
6032
|
-
target:
|
|
6033
|
-
path:
|
|
6086
|
+
target: z49.string().trim().min(1, "target required").max(200),
|
|
6087
|
+
path: z49.string().max(1e3).optional()
|
|
6034
6088
|
});
|
|
6035
6089
|
|
|
6036
6090
|
// ../contract/src/query-requests.ts
|
|
6037
|
-
import { z as
|
|
6038
|
-
var queryValue =
|
|
6039
|
-
var refreshQuery =
|
|
6040
|
-
var waitQuery =
|
|
6041
|
-
var queryRunnerSchema =
|
|
6042
|
-
var modelDiscoveryQuerySchema =
|
|
6043
|
-
var strictRefreshQuerySchema =
|
|
6044
|
-
var browseQuerySchema =
|
|
6045
|
-
var worktreeFilesQuerySchema =
|
|
6046
|
-
var commitQuerySchema =
|
|
6091
|
+
import { z as z50 } from "zod";
|
|
6092
|
+
var queryValue = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).optional();
|
|
6093
|
+
var refreshQuery = z50.object({ refresh: queryValue });
|
|
6094
|
+
var waitQuery = z50.object({ wait: queryValue });
|
|
6095
|
+
var queryRunnerSchema = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
|
|
6096
|
+
var modelDiscoveryQuerySchema = z50.object({ runner: queryRunnerSchema, profileId: z50.string().max(64).optional() });
|
|
6097
|
+
var strictRefreshQuerySchema = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6098
|
+
var browseQuerySchema = z50.object({ path: queryValue, showHidden: queryValue });
|
|
6099
|
+
var worktreeFilesQuerySchema = z50.object({ path: queryValue, raw: queryValue });
|
|
6100
|
+
var commitQuerySchema = z50.object({ structured: queryValue });
|
|
6047
6101
|
|
|
6048
6102
|
// ../contract/src/github-requests.ts
|
|
6049
|
-
import { z as
|
|
6050
|
-
var mergeNumberParams =
|
|
6051
|
-
var prChangesParams =
|
|
6052
|
-
var prChangesQuery =
|
|
6053
|
-
var mergeBodySchema =
|
|
6054
|
-
method:
|
|
6055
|
-
expectedHeadSha:
|
|
6056
|
-
overrideRules:
|
|
6103
|
+
import { z as z51 } from "zod";
|
|
6104
|
+
var mergeNumberParams = z51.object({ number: z51.coerce.number().int().positive() });
|
|
6105
|
+
var prChangesParams = z51.object({ number: z51.coerce.number().int().positive().safe() });
|
|
6106
|
+
var prChangesQuery = z51.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6107
|
+
var mergeBodySchema = z51.object({
|
|
6108
|
+
method: z51.enum(["merge", "squash", "rebase"]),
|
|
6109
|
+
expectedHeadSha: z51.string().regex(/^[0-9a-f]{40}$/),
|
|
6110
|
+
overrideRules: z51.boolean().optional().default(false)
|
|
6057
6111
|
}).strict();
|
|
6058
|
-
var githubChecksQuerySchema =
|
|
6059
|
-
var githubRefsQuerySchema =
|
|
6112
|
+
var githubChecksQuerySchema = z51.object({ prs: z51.string().min(1) });
|
|
6113
|
+
var githubRefsQuerySchema = z51.object({ prs: z51.string().optional(), issues: z51.string().optional() });
|
|
6060
6114
|
|
|
6061
6115
|
// ../contract/src/repo-requests.ts
|
|
6062
|
-
import { z as
|
|
6063
|
-
var gitCommitSchema =
|
|
6064
|
-
message:
|
|
6116
|
+
import { z as z52 } from "zod";
|
|
6117
|
+
var gitCommitSchema = z52.object({
|
|
6118
|
+
message: z52.string().trim().min(1, "must not be empty").max(5e3)
|
|
6065
6119
|
});
|
|
6066
|
-
var reclaimBodySchema =
|
|
6067
|
-
var repoBranchSchema =
|
|
6068
|
-
name:
|
|
6069
|
-
from:
|
|
6120
|
+
var reclaimBodySchema = z52.object({}).passthrough();
|
|
6121
|
+
var repoBranchSchema = z52.object({
|
|
6122
|
+
name: z52.string().trim().min(1).max(200),
|
|
6123
|
+
from: z52.string().trim().min(1).max(200).optional()
|
|
6070
6124
|
});
|
|
6071
|
-
var reclaimRunParamsSchema =
|
|
6125
|
+
var reclaimRunParamsSchema = z52.object({ runId: z52.string().min(1) });
|
|
6072
6126
|
|
|
6073
6127
|
// ../contract/src/config-requests.ts
|
|
6074
|
-
import { z as
|
|
6128
|
+
import { z as z53 } from "zod";
|
|
6075
6129
|
var setConfigSchema = setConfigInputSchema.extend({
|
|
6076
|
-
systemPrompt:
|
|
6130
|
+
systemPrompt: z53.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
|
|
6077
6131
|
});
|
|
6078
|
-
var setAgentConfigSchema =
|
|
6079
|
-
content:
|
|
6080
|
-
version:
|
|
6132
|
+
var setAgentConfigSchema = z53.object({
|
|
6133
|
+
content: z53.string().max(2e6),
|
|
6134
|
+
version: z53.string().nullable()
|
|
6081
6135
|
});
|
|
6082
6136
|
|
|
6083
6137
|
// ../contract/src/workflow-file.ts
|
|
6084
|
-
import { z as
|
|
6085
|
-
var workflowFileSchema =
|
|
6086
|
-
name:
|
|
6087
|
-
description:
|
|
6088
|
-
steps:
|
|
6089
|
-
skills:
|
|
6138
|
+
import { z as z54 } from "zod";
|
|
6139
|
+
var workflowFileSchema = z54.object({
|
|
6140
|
+
name: z54.string().min(1),
|
|
6141
|
+
description: z54.string().optional(),
|
|
6142
|
+
steps: z54.array(workflowStepDefSchema).min(1).optional(),
|
|
6143
|
+
skills: z54.array(z54.string().trim().min(1)).min(1).optional()
|
|
6090
6144
|
}).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
|
|
6091
6145
|
message: 'a workflow lists either "steps" or "skills", not both'
|
|
6092
6146
|
});
|
|
6093
6147
|
|
|
6094
6148
|
// ../contract/src/reports.ts
|
|
6095
|
-
import { z as
|
|
6149
|
+
import { z as z55 } from "zod";
|
|
6096
6150
|
var REPORTS_QUERY_MAX = 1e3;
|
|
6097
|
-
var cursorSchema =
|
|
6098
|
-
var reportsQuerySchema =
|
|
6099
|
-
q:
|
|
6151
|
+
var cursorSchema = z55.string().min(1).max(1024);
|
|
6152
|
+
var reportsQuerySchema = z55.object({
|
|
6153
|
+
q: z55.string().max(REPORTS_QUERY_MAX).optional(),
|
|
6100
6154
|
before: cursorSchema.optional(),
|
|
6101
|
-
limit:
|
|
6155
|
+
limit: z55.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
|
|
6102
6156
|
}).strict();
|
|
6103
|
-
var reportSchema =
|
|
6104
|
-
id:
|
|
6105
|
-
runId:
|
|
6106
|
-
name:
|
|
6107
|
-
title:
|
|
6108
|
-
createdAt:
|
|
6109
|
-
size:
|
|
6110
|
-
taskTitle:
|
|
6157
|
+
var reportSchema = z55.object({
|
|
6158
|
+
id: z55.uuid(),
|
|
6159
|
+
runId: z55.uuid(),
|
|
6160
|
+
name: z55.string(),
|
|
6161
|
+
title: z55.string(),
|
|
6162
|
+
createdAt: z55.iso.datetime(),
|
|
6163
|
+
size: z55.number().int().nonnegative(),
|
|
6164
|
+
taskTitle: z55.string(),
|
|
6111
6165
|
taskStatus: runStatusSchema
|
|
6112
6166
|
}).strict();
|
|
6113
|
-
var reportsResponseSchema =
|
|
6114
|
-
reports:
|
|
6167
|
+
var reportsResponseSchema = z55.object({
|
|
6168
|
+
reports: z55.array(reportSchema),
|
|
6115
6169
|
nextCursor: cursorSchema.nullable(),
|
|
6116
6170
|
// Counts all matching cached rows with readable source summaries before page content checks.
|
|
6117
6171
|
// A missing-content row dropped while filling this page can lower total on the next request.
|
|
6118
|
-
total:
|
|
6172
|
+
total: z55.number().int().nonnegative()
|
|
6119
6173
|
}).strict();
|
|
6120
|
-
var reportsStateSchema =
|
|
6121
|
-
epoch:
|
|
6122
|
-
generation:
|
|
6123
|
-
metadataGeneration:
|
|
6174
|
+
var reportsStateSchema = z55.object({
|
|
6175
|
+
epoch: z55.uuid(),
|
|
6176
|
+
generation: z55.number().int().nonnegative(),
|
|
6177
|
+
metadataGeneration: z55.number().int().nonnegative()
|
|
6124
6178
|
}).strict();
|
|
6125
|
-
var reportsMetadataSchema =
|
|
6126
|
-
runId:
|
|
6127
|
-
taskTitle:
|
|
6179
|
+
var reportsMetadataSchema = z55.object({
|
|
6180
|
+
runId: z55.uuid(),
|
|
6181
|
+
taskTitle: z55.string(),
|
|
6128
6182
|
taskStatus: runStatusSchema
|
|
6129
6183
|
}).strict();
|
|
6130
|
-
var reportsFrameSchema =
|
|
6131
|
-
reportsStateSchema.extend({ type:
|
|
6132
|
-
reportsStateSchema.extend({ type:
|
|
6133
|
-
reportsStateSchema.extend({ type:
|
|
6184
|
+
var reportsFrameSchema = z55.discriminatedUnion("type", [
|
|
6185
|
+
reportsStateSchema.extend({ type: z55.literal("snapshot") }),
|
|
6186
|
+
reportsStateSchema.extend({ type: z55.literal("content") }),
|
|
6187
|
+
reportsStateSchema.extend({ type: z55.literal("metadata"), runs: z55.array(reportsMetadataSchema) })
|
|
6134
6188
|
]);
|
|
6135
6189
|
|
|
6136
6190
|
// ../contract/src/report-title.ts
|
|
@@ -6152,108 +6206,108 @@ function controlLocation(control, separator = " \u2192 ") {
|
|
|
6152
6206
|
}
|
|
6153
6207
|
|
|
6154
6208
|
// ../contract/src/home-recovery.ts
|
|
6155
|
-
import { z as
|
|
6209
|
+
import { z as z56 } from "zod";
|
|
6156
6210
|
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))$/;
|
|
6157
|
-
var homeFileSchema =
|
|
6158
|
-
var recoveryFile =
|
|
6211
|
+
var homeFileSchema = z56.string().regex(HOME_FILE_PATTERN);
|
|
6212
|
+
var recoveryFile = z56.object({
|
|
6159
6213
|
file: homeFileSchema,
|
|
6160
|
-
detectedAt:
|
|
6161
|
-
canRestore:
|
|
6214
|
+
detectedAt: z56.iso.datetime(),
|
|
6215
|
+
canRestore: z56.boolean()
|
|
6162
6216
|
});
|
|
6163
6217
|
var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
|
|
6164
|
-
var homeRecoveryFileSchema =
|
|
6165
|
-
recoveryFile.extend({ reason:
|
|
6166
|
-
recoveryFile.extend({ reason:
|
|
6167
|
-
recoveryFile.extend({ reason:
|
|
6218
|
+
var homeRecoveryFileSchema = z56.discriminatedUnion("reason", [
|
|
6219
|
+
recoveryFile.extend({ reason: z56.literal("reset") }),
|
|
6220
|
+
recoveryFile.extend({ reason: z56.literal("outside-write") }),
|
|
6221
|
+
recoveryFile.extend({ reason: z56.literal("legacy-change"), canImport: z56.boolean() })
|
|
6168
6222
|
]);
|
|
6169
|
-
var homeRecoverySchema =
|
|
6223
|
+
var homeRecoverySchema = z56.object({ files: z56.array(homeRecoveryFileSchema) });
|
|
6170
6224
|
function filterHomeRecoveryReasons(value, reasons) {
|
|
6171
6225
|
if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
|
|
6172
6226
|
return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
|
|
6173
6227
|
}
|
|
6174
|
-
var homeRecoveryReaderSchema =
|
|
6228
|
+
var homeRecoveryReaderSchema = z56.preprocess(
|
|
6175
6229
|
(value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
|
|
6176
6230
|
homeRecoverySchema
|
|
6177
6231
|
);
|
|
6178
|
-
var homeRecoveryActionSchema =
|
|
6232
|
+
var homeRecoveryActionSchema = z56.object({ file: homeFileSchema, detectedAt: z56.iso.datetime() }).strict();
|
|
6179
6233
|
|
|
6180
6234
|
// ../contract/src/runner-skills.ts
|
|
6181
|
-
import { z as
|
|
6182
|
-
var runnerSkillScopeSchema =
|
|
6183
|
-
var runnerSkillsQuerySchema =
|
|
6235
|
+
import { z as z57 } from "zod";
|
|
6236
|
+
var runnerSkillScopeSchema = z57.enum(["repo", "user", "system", "other"]);
|
|
6237
|
+
var runnerSkillsQuerySchema = z57.object({
|
|
6184
6238
|
runner: queryRunnerSchema,
|
|
6185
|
-
account:
|
|
6186
|
-
refresh:
|
|
6239
|
+
account: z57.string().min(1).max(64).optional(),
|
|
6240
|
+
refresh: z57.literal("1").optional()
|
|
6187
6241
|
});
|
|
6188
|
-
var runnerSkillSchema =
|
|
6189
|
-
id:
|
|
6190
|
-
name:
|
|
6191
|
-
description:
|
|
6242
|
+
var runnerSkillSchema = z57.object({
|
|
6243
|
+
id: z57.string(),
|
|
6244
|
+
name: z57.string(),
|
|
6245
|
+
description: z57.string().optional(),
|
|
6192
6246
|
scope: runnerSkillScopeSchema.optional(),
|
|
6193
|
-
plugin:
|
|
6194
|
-
path:
|
|
6247
|
+
plugin: z57.string().optional(),
|
|
6248
|
+
path: z57.string().optional()
|
|
6195
6249
|
});
|
|
6196
|
-
var runnerSkillProblemSchema =
|
|
6197
|
-
var runnerSkillListSchema =
|
|
6250
|
+
var runnerSkillProblemSchema = z57.object({ message: z57.string(), path: z57.string().optional() });
|
|
6251
|
+
var runnerSkillListSchema = z57.object({
|
|
6198
6252
|
runner: runnerSchema,
|
|
6199
|
-
skills:
|
|
6200
|
-
problems:
|
|
6201
|
-
source:
|
|
6202
|
-
reason:
|
|
6253
|
+
skills: z57.array(runnerSkillSchema),
|
|
6254
|
+
problems: z57.array(runnerSkillProblemSchema),
|
|
6255
|
+
source: z57.enum(["live", "cache", "unavailable"]),
|
|
6256
|
+
reason: z57.string().optional()
|
|
6203
6257
|
});
|
|
6204
6258
|
|
|
6205
6259
|
// ../contract/src/runner-install.ts
|
|
6206
|
-
import { z as
|
|
6207
|
-
var runnerInstallParamsSchema =
|
|
6208
|
-
var runnerInstallActionSchema =
|
|
6209
|
-
var runnerInstallPhaseSchema =
|
|
6210
|
-
var runnerInstallStatusSchema =
|
|
6211
|
-
supported:
|
|
6212
|
-
installedVersion:
|
|
6213
|
-
latestVersion:
|
|
6214
|
-
updateAvailable:
|
|
6260
|
+
import { z as z58 } from "zod";
|
|
6261
|
+
var runnerInstallParamsSchema = z58.object({ runner: runnerSchema });
|
|
6262
|
+
var runnerInstallActionSchema = z58.object({ action: z58.enum(["check", "install", "update", "remove"]) });
|
|
6263
|
+
var runnerInstallPhaseSchema = z58.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
|
|
6264
|
+
var runnerInstallStatusSchema = z58.object({
|
|
6265
|
+
supported: z58.boolean(),
|
|
6266
|
+
installedVersion: z58.string().nullable(),
|
|
6267
|
+
latestVersion: z58.string().nullable(),
|
|
6268
|
+
updateAvailable: z58.boolean(),
|
|
6215
6269
|
phase: runnerInstallPhaseSchema,
|
|
6216
|
-
error:
|
|
6270
|
+
error: z58.string().nullable()
|
|
6217
6271
|
});
|
|
6218
6272
|
|
|
6219
6273
|
// ../contract/src/automation-tool.ts
|
|
6220
|
-
import { z as
|
|
6274
|
+
import { z as z59 } from "zod";
|
|
6221
6275
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
6222
|
-
var id =
|
|
6223
|
-
var automationToolRequestSchema =
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6276
|
+
var id = z59.string().min(1).max(100);
|
|
6277
|
+
var automationToolRequestSchema = z59.discriminatedUnion("action", [
|
|
6278
|
+
z59.object({ action: z59.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
6279
|
+
z59.object({ action: z59.literal("show"), id }).strict(),
|
|
6280
|
+
z59.object({ action: z59.literal("preview"), id }).strict(),
|
|
6281
|
+
z59.object({ action: z59.literal("enable"), id, explicit: z59.boolean().optional() }).strict()
|
|
6228
6282
|
]);
|
|
6229
|
-
var automationToolAnswerSchema =
|
|
6230
|
-
|
|
6231
|
-
ok:
|
|
6283
|
+
var automationToolAnswerSchema = z59.union([
|
|
6284
|
+
z59.object({
|
|
6285
|
+
ok: z59.literal(true),
|
|
6232
6286
|
automation: storedAutomationDefinitionSchema,
|
|
6233
|
-
url:
|
|
6234
|
-
next_run_at:
|
|
6235
|
-
preview:
|
|
6287
|
+
url: z59.string().optional(),
|
|
6288
|
+
next_run_at: z59.string().optional(),
|
|
6289
|
+
preview: z59.object({ matches: z59.number().int().nonnegative(), truncated: z59.boolean() }).optional()
|
|
6236
6290
|
}),
|
|
6237
|
-
|
|
6291
|
+
z59.object({ ok: z59.literal(false), code: z59.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z59.string() })
|
|
6238
6292
|
]);
|
|
6239
6293
|
|
|
6240
6294
|
// ../contract/src/agent-tools.ts
|
|
6241
|
-
import { z as
|
|
6242
|
-
var agentToolResultSchema =
|
|
6243
|
-
content:
|
|
6244
|
-
isError:
|
|
6245
|
-
details:
|
|
6246
|
-
});
|
|
6247
|
-
var agentToolMetadataSchema =
|
|
6248
|
-
timeoutMs:
|
|
6295
|
+
import { z as z60 } from "zod";
|
|
6296
|
+
var agentToolResultSchema = z60.object({
|
|
6297
|
+
content: z60.array(z60.object({ type: z60.literal("text"), text: z60.string() })),
|
|
6298
|
+
isError: z60.boolean().optional(),
|
|
6299
|
+
details: z60.unknown()
|
|
6300
|
+
});
|
|
6301
|
+
var agentToolMetadataSchema = z60.object({
|
|
6302
|
+
timeoutMs: z60.number().positive(),
|
|
6249
6303
|
unavailable: agentToolResultSchema,
|
|
6250
|
-
name:
|
|
6251
|
-
description:
|
|
6252
|
-
trigger:
|
|
6253
|
-
label:
|
|
6254
|
-
inputSchema:
|
|
6304
|
+
name: z60.string(),
|
|
6305
|
+
description: z60.string(),
|
|
6306
|
+
trigger: z60.string(),
|
|
6307
|
+
label: z60.string(),
|
|
6308
|
+
inputSchema: z60.object({ type: z60.literal("object"), properties: z60.record(z60.string(), z60.unknown()).optional() }).catchall(z60.unknown())
|
|
6255
6309
|
});
|
|
6256
|
-
var agentToolCatalogSchema =
|
|
6310
|
+
var agentToolCatalogSchema = z60.object({ tools: z60.array(agentToolMetadataSchema), instructions: z60.string() });
|
|
6257
6311
|
export {
|
|
6258
6312
|
ACTIVITY_CHECKS_MAX,
|
|
6259
6313
|
ACTIVITY_CHECK_NAME_MAX,
|
|
@@ -6331,6 +6385,7 @@ export {
|
|
|
6331
6385
|
SCHEDULED_TASK_NOTE,
|
|
6332
6386
|
SCHEDULE_HOURS_OPTIONS,
|
|
6333
6387
|
SCHEDULE_TYPES,
|
|
6388
|
+
SESSION_CONTEXT_FILE_MAX_BYTES,
|
|
6334
6389
|
SHARED_ATTACH_REFUSAL,
|
|
6335
6390
|
SHARED_BASELINE,
|
|
6336
6391
|
SHARED_BASELINE_REFUSAL,
|
|
@@ -6857,12 +6912,19 @@ export {
|
|
|
6857
6912
|
selectAgentProfileSchema,
|
|
6858
6913
|
sendAgentReportInputSchema,
|
|
6859
6914
|
sendAgentReportResponseSchema,
|
|
6915
|
+
sessionContextFileSchema,
|
|
6916
|
+
sessionContextPreviewBlockSchema,
|
|
6917
|
+
sessionContextPreviewRequestSchema,
|
|
6918
|
+
sessionContextPreviewSchema,
|
|
6919
|
+
sessionContextProblemSchema,
|
|
6920
|
+
sessionContextRoleSchema,
|
|
6860
6921
|
sessionRunner,
|
|
6861
6922
|
setAgentConfigInputSchema,
|
|
6862
6923
|
setAgentConfigSchema,
|
|
6863
6924
|
setConfigInputSchema,
|
|
6864
6925
|
setConfigResponseSchema,
|
|
6865
6926
|
setConfigSchema,
|
|
6927
|
+
setSessionContextSchema,
|
|
6866
6928
|
setWorkspaceConfigInputSchema,
|
|
6867
6929
|
setWorkspaceUiStateInputSchema,
|
|
6868
6930
|
sharedSpawnRefusal,
|