@hearsay-tools/squawk 0.19.0-dev.9291 → 0.19.0-dev.9292
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/hosts.d.ts +76 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1354 -1288
- package/dist/contract/project-signal.d.ts +31 -0
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/transport.d.ts +10 -10
- package/dist/features/automations/tools.d.ts +8 -8
- package/dist/features/hosts/index.js +2 -0
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/routes.d.ts +45 -1
- package/dist/features/hosts/routes.js +109 -1
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/runs-index-patch.d.ts +5 -0
- package/dist/features/hosts/runs-index-patch.js +36 -0
- package/dist/features/hosts/runs-index-patch.js.map +1 -1
- package/dist/features/hosts/runs-index.d.ts +9 -1
- package/dist/features/hosts/runs-index.js +27 -0
- package/dist/features/hosts/runs-index.js.map +1 -1
- package/dist/runs/run-exits.d.ts +352 -352
- package/dist/runs/run-index.d.ts +2 -0
- package/dist/runs/run-index.js +9 -1
- package/dist/runs/run-index.js.map +1 -1
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/server.d.ts +1379 -1379
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-BHP8K_nY.js +1 -0
- package/web/dist/assets/activity-motion-DEEIuaki.js +1 -0
- package/web/dist/assets/{activity-route-CruXBXE5.js → activity-route-vtZmQsDB.js} +1 -1
- package/web/dist/assets/agent-accounts-BC78GKYv.js +1 -0
- package/web/dist/assets/{agent-config-section-BUxTgHrB.js → agent-config-section-CbnVaIx7.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BXUzcpEv.js → agent-defaults-section-Blxd9IpY.js} +1 -1
- package/web/dist/assets/{appearance-DnPsNI40.js → appearance-B_y9StVj.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DR-KA2nj.js → archive-on-merge-field-DlChylWt.js} +1 -1
- package/web/dist/assets/{ask-card-DqWVy7zb.js → ask-card-DzWKRJ1x.js} +3 -3
- package/web/dist/assets/attention-C33sN0aA.js +1 -0
- package/web/dist/assets/automations-route-DxE9u9p0.js +2 -0
- package/web/dist/assets/{commit-list-zMKEapLK.js → commit-list-SxBDO_q5.js} +1 -1
- package/web/dist/assets/diff-B6Ye5Xg9.js +3 -0
- package/web/dist/assets/{diff-controls-DbkfJxfp.js → diff-controls-BFQOIJ97.js} +1 -1
- package/web/dist/assets/{diff-view-Cl7rXVa_.js → diff-view-BkF3xtYW.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-BYLEBMpG.js → discard-changes-dialog-CaS0koto.js} +1 -1
- package/web/dist/assets/{file-preview-CBjQS3sX.js → file-preview-ByWn2eDz.js} +1 -1
- package/web/dist/assets/{folder-browser-_2PCbZWK.js → folder-browser-CHTNDBIU.js} +1 -1
- package/web/dist/assets/{git-toolbar-CAAZ5T8F.js → git-toolbar-COI-N232.js} +1 -1
- package/web/dist/assets/github-CAQJIg-J.js +1 -0
- package/web/dist/assets/{global-activity-route-BQz9m_XA.js → global-activity-route-99-UqSlC.js} +1 -1
- package/web/dist/assets/hosts-BDfuQnus.js +1 -0
- package/web/dist/assets/index-BAXboPqe.js +21 -0
- package/web/dist/assets/label-Qj4HjGeN.js +1 -0
- package/web/dist/assets/{markdown-CcQNTOHx.js → markdown-D7p7x8Pe.js} +1 -1
- package/web/dist/assets/{open-in-menu-WJ8dhdTo.js → open-in-menu-D07DgRwh.js} +1 -1
- package/web/dist/assets/{option-select-DGRezng8.js → option-select-BvsSDWBz.js} +1 -1
- package/web/dist/assets/{preferences-section-DfiqoVZx.js → preferences-section-DkdcKxmS.js} +1 -1
- package/web/dist/assets/{preview-DXX3jdRy.js → preview-7NPVVq1D.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Bf6SWOsM.js → preview-pane-connected-B3f0fR6q.js} +2 -2
- package/web/dist/assets/{project-location-8EYHMbCE.js → project-location-CvZY7aOx.js} +1 -1
- package/web/dist/assets/{project-router-TP6DSj1S.js → project-router-l_pJCK5X.js} +1 -1
- package/web/dist/assets/project-scope-context-_6sNMsAf.js +4 -0
- package/web/dist/assets/{projects-section-CaKm84OL.js → projects-section-DGzDfKN_.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Bh6YEqh0.js → prompt-templates-section-DbHe-j9Z.js} +1 -1
- package/web/dist/assets/queries-CPNrCEon.js +1 -0
- package/web/dist/assets/read-state-BXLUf0Xi.js +1 -0
- package/web/dist/assets/reference-chip-B32qTHb5.js +1 -0
- package/web/dist/assets/{remote-settings-notice-cNffux8C.js → remote-settings-notice-ByPYNQyB.js} +1 -1
- package/web/dist/assets/{repo-git-nFi9DHBQ.js → repo-git-4rKalM-L.js} +1 -1
- package/web/dist/assets/{report-reader-BbA7ERJe.js → report-reader-IAYhP0KQ.js} +1 -1
- package/web/dist/assets/{report-selection-DOq2dcjz.js → report-selection-DCC-F7i6.js} +1 -1
- package/web/dist/assets/{reports-iMUK2IiW.js → reports-BP_hajNp.js} +1 -1
- package/web/dist/assets/{resources-section-BsPU-yD9.js → resources-section-QNbLbu3j.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BncrXliY.js → review-notes-drafts-CB8u-M0E.js} +1 -1
- package/web/dist/assets/{review-panel-CTc1ypIJ.js → review-panel-Bw8yG2xg.js} +1 -1
- package/web/dist/assets/{review-strip-D1gmgNIH.js → review-strip-BojRnCkg.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-B4t_zvMa.js → run-detail-refresh-CZ7VyCgP.js} +1 -1
- package/web/dist/assets/{run-diff-CbyXSgBK.js → run-diff-CMZgQG9B.js} +1 -1
- package/web/dist/assets/run-header-D7LZBbaL.js +2 -0
- package/web/dist/assets/{select--NKdUD0C.js → select-D9BIA_Kn.js} +1 -1
- package/web/dist/assets/{session-context-section-D02yRmGY.js → session-context-section-CxFRidmv.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-GPhOc6Lz.js → settings-agent-picker-Cy_ZpuNd.js} +1 -1
- package/web/dist/assets/{settings-save-bar-CroXxZIi.js → settings-save-bar-DzbndGGQ.js} +1 -1
- package/web/dist/assets/settings-shell-DS8k_xP6.js +1 -0
- package/web/dist/assets/{sidebar-section-BOtjR98E.js → sidebar-section-CY978tNF.js} +1 -1
- package/web/dist/assets/{skills-C7MuiePR.js → skills-WZ5YRCbF.js} +1 -1
- package/web/dist/assets/{status-dot-Bn3O77El.js → status-dot-Dvy-rnDJ.js} +1 -1
- package/web/dist/assets/{tab-link-BeONvGY1.js → tab-link-BPkGPOYd.js} +1 -1
- package/web/dist/assets/task-changes-Dd2KHRQ6.js +5 -0
- package/web/dist/assets/task-commits-De0FVgKP.js +1 -0
- package/web/dist/assets/{task-file-scope-BfJ7TDbf.js → task-file-scope-C_cr_ix-.js} +1 -1
- package/web/dist/assets/{task-files-CNz4PSKs.js → task-files-resMdu9u.js} +1 -1
- package/web/dist/assets/{task-github-item-B0mRxbLm.js → task-github-item-Hz1RbO88.js} +1 -1
- package/web/dist/assets/task-groups-Bc_WNTMe.js +1 -0
- package/web/dist/assets/task-thread-D7vUf0g7.js +2 -0
- package/web/dist/assets/{thread-state-B_uTIWzc.js → thread-state-Bjh3rImx.js} +1 -1
- package/web/dist/assets/{unified-diff-JD9Q6oCe.js → unified-diff-weWjKedZ.js} +1 -1
- package/web/dist/assets/use-finish-run-BuyJkeEN.js +1 -0
- package/web/dist/assets/{use-hand-to-agent-state-zwUimLza.js → use-hand-to-agent-state-CSDPzpM7.js} +1 -1
- package/web/dist/assets/use-path-bases-DgEkRWYi.js +1 -0
- package/web/dist/assets/use-workspace-config-save-M2ethek2.js +1 -0
- package/web/dist/assets/{workflows-BXDmsEl-.js → workflows-DtnnAq4w.js} +1 -1
- package/web/dist/assets/{workspace-tools-Ehk2KrtT.js → workspace-tools-CSLTEwLa.js} +1 -1
- package/web/dist/assets/{worktrees-section-DWZwtc3-.js → worktrees-section-Crp31i8F.js} +1 -1
- package/web/dist/index.html +17 -14
- package/web/dist/assets/accounts-section-uuhrLHok.js +0 -1
- package/web/dist/assets/activity-motion-CHyZRjxl.js +0 -1
- package/web/dist/assets/agent-accounts-CSU96w_T.js +0 -1
- package/web/dist/assets/automations-route-BmCWqncy.js +0 -2
- package/web/dist/assets/diff-BPw0S-BU.js +0 -3
- package/web/dist/assets/github-DehUrgzW.js +0 -1
- package/web/dist/assets/hosts-BEeMKHcf.js +0 -1
- package/web/dist/assets/index-D0RESQCN.js +0 -21
- package/web/dist/assets/label-VKt-7Z5C.js +0 -1
- package/web/dist/assets/project-scope-context-BWHk0niI.js +0 -4
- package/web/dist/assets/queries-Byfl3YoC.js +0 -1
- package/web/dist/assets/reference-chip-rDOAte2y.js +0 -1
- package/web/dist/assets/run-header-BREol2Ej.js +0 -2
- package/web/dist/assets/settings-shell-CEDsPkJW.js +0 -1
- package/web/dist/assets/task-changes-CPDdG-BK.js +0 -5
- package/web/dist/assets/task-commits-BFWXi7xF.js +0 -1
- package/web/dist/assets/task-thread-DH9xiw7O.js +0 -2
- package/web/dist/assets/use-finish-run-D7Ll1bwP.js +0 -1
- package/web/dist/assets/use-path-bases-BmFE7O79.js +0 -1
- package/web/dist/assets/use-workspace-config-save-71tIi9IP.js +0 -1
package/dist/contract/index.js
CHANGED
|
@@ -4061,41 +4061,182 @@ var registerProjectInputSchema = z27.object({
|
|
|
4061
4061
|
root: z27.string().trim().min(1).max(4096)
|
|
4062
4062
|
});
|
|
4063
4063
|
|
|
4064
|
+
// ../contract/src/project-signal.ts
|
|
4065
|
+
import { z as z28 } from "zod";
|
|
4066
|
+
|
|
4067
|
+
// ../contract/src/run-predicates.ts
|
|
4068
|
+
function latestSessionStep(steps, except) {
|
|
4069
|
+
let latest;
|
|
4070
|
+
for (const step of steps) {
|
|
4071
|
+
if (!step.sessionId || step.id === except) continue;
|
|
4072
|
+
if (!latest || !step.startedAt || !latest.startedAt || step.startedAt >= latest.startedAt) latest = step;
|
|
4073
|
+
}
|
|
4074
|
+
return latest;
|
|
4075
|
+
}
|
|
4076
|
+
function sessionRunner(step, run) {
|
|
4077
|
+
return step?.backend ?? run?.runner ?? "claude";
|
|
4078
|
+
}
|
|
4079
|
+
function removedRunnerStepAfter(steps, sessionId) {
|
|
4080
|
+
let latest;
|
|
4081
|
+
for (const step of steps) {
|
|
4082
|
+
if (step.removedBackend === void 0 && (sessionId === void 0 || step.sessionId !== sessionId)) continue;
|
|
4083
|
+
if (!latest || !step.startedAt || !latest.startedAt || step.startedAt >= latest.startedAt) latest = step;
|
|
4084
|
+
}
|
|
4085
|
+
return latest?.removedBackend !== void 0 ? latest : void 0;
|
|
4086
|
+
}
|
|
4087
|
+
function latestSession(run) {
|
|
4088
|
+
const latest = latestSessionStep(run.steps);
|
|
4089
|
+
const step = removedRunnerStepAfter(run.steps, latest?.sessionId) ? void 0 : latest;
|
|
4090
|
+
return { sessionId: step?.sessionId, backend: sessionRunner(step, run), profileId: step?.profileId };
|
|
4091
|
+
}
|
|
4092
|
+
function isAgentWorkflowStep(step) {
|
|
4093
|
+
return step.command === void 0 && step.kind !== "plugin";
|
|
4094
|
+
}
|
|
4095
|
+
function workerContinuationStepId(run) {
|
|
4096
|
+
const cursorId = run.workflowCursor?.mode === "resume" ? run.workflowCursor.stepId : void 0;
|
|
4097
|
+
if (cursorId && run.steps.find((step) => step.id === cursorId)?.status === "failed") return cursorId;
|
|
4098
|
+
const session = latestSessionStep(run.steps);
|
|
4099
|
+
if (!session) return void 0;
|
|
4100
|
+
if (session.synthetic === "continuation" && session.continuesStepId !== void 0) return session.continuesStepId;
|
|
4101
|
+
return run.steps.find((step) => step.sessionId === session.sessionId)?.id ?? session.id;
|
|
4102
|
+
}
|
|
4103
|
+
function workerContinuationStep(run, untouched = false) {
|
|
4104
|
+
if (run.delegation?.role !== "worker") return void 0;
|
|
4105
|
+
const steps = run.workflowDef?.steps;
|
|
4106
|
+
if (!steps?.length) return void 0;
|
|
4107
|
+
if (untouched) return steps.find(isAgentWorkflowStep);
|
|
4108
|
+
const targetId = workerContinuationStepId(run);
|
|
4109
|
+
const targeted = targetId ? steps.find((step) => step.id === targetId && isAgentWorkflowStep(step)) : void 0;
|
|
4110
|
+
return targeted ?? [...steps].reverse().find(isAgentWorkflowStep);
|
|
4111
|
+
}
|
|
4112
|
+
var LIVE_STATUSES = /* @__PURE__ */ new Set(["queued", "running", "waiting"]);
|
|
4113
|
+
function isLiveStatus(status) {
|
|
4114
|
+
return LIVE_STATUSES.has(status);
|
|
4115
|
+
}
|
|
4116
|
+
function engineOwnsRun(run) {
|
|
4117
|
+
if (isUsageLimitHold(run)) return false;
|
|
4118
|
+
return run.status === "queued" || run.status === "running" || run.status === "waiting";
|
|
4119
|
+
}
|
|
4120
|
+
function isSessionOpen(run) {
|
|
4121
|
+
return engineOwnsRun(run) && run.status !== "queued";
|
|
4122
|
+
}
|
|
4123
|
+
function isSweepable(run, scope, automation) {
|
|
4124
|
+
if (run.archived || !(run.status === "done" || run.status === "failed" || run.status === "cancelled")) return false;
|
|
4125
|
+
if (run.delegation?.role === "worker") return false;
|
|
4126
|
+
if (automation !== void 0 && isAutomationTask(run) !== automation) return false;
|
|
4127
|
+
if (scope === "unpinned") return !run.pinned;
|
|
4128
|
+
if (scope === "pinned") return run.pinned === true;
|
|
4129
|
+
return true;
|
|
4130
|
+
}
|
|
4131
|
+
var UNREAD_ELIGIBLE = ["done", "failed"];
|
|
4132
|
+
function canBeUnread(run) {
|
|
4133
|
+
if (run.archived) return false;
|
|
4134
|
+
if (isUsageLimitHold(run)) return false;
|
|
4135
|
+
if (!UNREAD_ELIGIBLE.includes(run.status)) return false;
|
|
4136
|
+
return run.finishedAt !== void 0;
|
|
4137
|
+
}
|
|
4138
|
+
function isUnread(run) {
|
|
4139
|
+
const finishedAt = run.finishedAt;
|
|
4140
|
+
if (finishedAt === void 0) return false;
|
|
4141
|
+
if (!canBeUnread(run)) return false;
|
|
4142
|
+
return run.seenAt === void 0 || run.seenAt < finishedAt;
|
|
4143
|
+
}
|
|
4144
|
+
function isRetentionCandidate(run) {
|
|
4145
|
+
const settled = run.status === "done" || run.status === "failed" || run.status === "cancelled";
|
|
4146
|
+
return settled && (!run.delegation || run.delegation.role === "root") && !run.pinned;
|
|
4147
|
+
}
|
|
4148
|
+
function hasReferencedRun(run) {
|
|
4149
|
+
return run.referencedPullRequestUrl !== void 0 || run.referencedIssueUrl !== void 0;
|
|
4150
|
+
}
|
|
4151
|
+
var UNREAD_RUN_RULE = {
|
|
4152
|
+
sql: "archived = 0 AND status IN ('done', 'failed') AND finished_at IS NOT NULL AND (json_extract(summary, '$.seenAt') IS NULL OR json_extract(summary, '$.seenAt') < finished_at)",
|
|
4153
|
+
matches: isUnread
|
|
4154
|
+
};
|
|
4155
|
+
var SWEEPABLE_RUN_RULE = {
|
|
4156
|
+
sql: "archived = 0 AND status IN ('done', 'failed', 'cancelled') AND parent_run_id IS NULL",
|
|
4157
|
+
matches: isSweepable
|
|
4158
|
+
};
|
|
4159
|
+
var RETENTION_RUN_RULE = {
|
|
4160
|
+
sql: "id IN (SELECT value FROM json_each(?)) AND status IN ('done', 'failed', 'cancelled') AND parent_run_id IS NULL AND json_extract(summary, '$.delegation.role') IS NOT 'worker' AND json_extract(summary, '$.delegation.role') IS NOT 'invalid' AND json_extract(summary, '$.pinned') IS NOT 1",
|
|
4161
|
+
matches: isRetentionCandidate
|
|
4162
|
+
};
|
|
4163
|
+
var REFERENCED_RUN_RULE = {
|
|
4164
|
+
sql: "json_extract(summary, '$.referencedPullRequestUrl') IS NOT NULL OR json_extract(summary, '$.referencedIssueUrl') IS NOT NULL",
|
|
4165
|
+
matches: hasReferencedRun
|
|
4166
|
+
};
|
|
4167
|
+
|
|
4168
|
+
// ../contract/src/project-signal.ts
|
|
4169
|
+
var projectSignalSchema = z28.object({
|
|
4170
|
+
needsYou: z28.number().int().nonnegative(),
|
|
4171
|
+
failedUnread: z28.number().int().nonnegative(),
|
|
4172
|
+
inMotion: z28.number().int().nonnegative(),
|
|
4173
|
+
finishedUnread: z28.number().int().nonnegative()
|
|
4174
|
+
});
|
|
4175
|
+
function emptyProjectSignal() {
|
|
4176
|
+
return { needsYou: 0, failedUnread: 0, inMotion: 0, finishedUnread: 0 };
|
|
4177
|
+
}
|
|
4178
|
+
function isZeroProjectSignal(signal) {
|
|
4179
|
+
return signal.needsYou === 0 && signal.failedUnread === 0 && signal.inMotion === 0 && signal.finishedUnread === 0;
|
|
4180
|
+
}
|
|
4181
|
+
function projectSignalsEqual(a, b) {
|
|
4182
|
+
if (a === b) return true;
|
|
4183
|
+
if (!a || !b) return false;
|
|
4184
|
+
return a.needsYou === b.needsYou && a.failedUnread === b.failedUnread && a.inMotion === b.inMotion && a.finishedUnread === b.finishedUnread;
|
|
4185
|
+
}
|
|
4186
|
+
function runSignalCategory(run) {
|
|
4187
|
+
if (run.archived || run.delegation?.role === "worker") return null;
|
|
4188
|
+
if (needsYou(run)) return "needsYou";
|
|
4189
|
+
if (deriveAttention(run).tone === "running") return "inMotion";
|
|
4190
|
+
if (isUnread(run)) {
|
|
4191
|
+
if (run.status === "failed") return "failedUnread";
|
|
4192
|
+
if (run.status === "done") return "finishedUnread";
|
|
4193
|
+
}
|
|
4194
|
+
return null;
|
|
4195
|
+
}
|
|
4196
|
+
function projectSignal(runs) {
|
|
4197
|
+
const signal = emptyProjectSignal();
|
|
4198
|
+
for (const run of runs) {
|
|
4199
|
+
const category = runSignalCategory(run);
|
|
4200
|
+
if (category) signal[category] += 1;
|
|
4201
|
+
}
|
|
4202
|
+
return signal;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4064
4205
|
// ../contract/src/workspace.ts
|
|
4065
|
-
import { z as
|
|
4206
|
+
import { z as z30 } from "zod";
|
|
4066
4207
|
|
|
4067
4208
|
// ../contract/src/per-runner-optional-strings.ts
|
|
4068
|
-
import { z as
|
|
4209
|
+
import { z as z29 } from "zod";
|
|
4069
4210
|
function perRunnerOptionalStrings() {
|
|
4070
|
-
return
|
|
4211
|
+
return z29.record(z29.string(), z29.string().optional());
|
|
4071
4212
|
}
|
|
4072
4213
|
|
|
4073
4214
|
// ../contract/src/workspace.ts
|
|
4074
|
-
var workspaceConfigResponseSchema =
|
|
4215
|
+
var workspaceConfigResponseSchema = z30.object({
|
|
4075
4216
|
/** The server user's home folder, so the cockpit can show paths under it as `~/…`. */
|
|
4076
|
-
homeDir:
|
|
4217
|
+
homeDir: z30.string(),
|
|
4077
4218
|
/** Root exposed by the Add-project directory browser — stored as written (`~` kept). */
|
|
4078
|
-
browseRoot:
|
|
4219
|
+
browseRoot: z30.string(),
|
|
4079
4220
|
/** Checkout root for GUI-cloned projects — stored as written (`~` kept). */
|
|
4080
|
-
projectsDir:
|
|
4081
|
-
archiveOnMerge:
|
|
4082
|
-
effectiveArchiveOnMerge:
|
|
4083
|
-
archiveOnMergeSource:
|
|
4084
|
-
composerDefaults:
|
|
4085
|
-
autonomous:
|
|
4086
|
-
worktree:
|
|
4221
|
+
projectsDir: z30.string(),
|
|
4222
|
+
archiveOnMerge: z30.boolean().nullable(),
|
|
4223
|
+
effectiveArchiveOnMerge: z30.boolean(),
|
|
4224
|
+
archiveOnMergeSource: z30.enum(["global", "environment", "default"]),
|
|
4225
|
+
composerDefaults: z30.object({
|
|
4226
|
+
autonomous: z30.boolean().nullable(),
|
|
4227
|
+
worktree: z30.boolean().nullable(),
|
|
4087
4228
|
/** `'source-dependent'` when no `CEZ_AUTONOMOUS_DEFAULT` pins it either way. */
|
|
4088
|
-
inheritedAutonomous:
|
|
4089
|
-
inheritedWorktree:
|
|
4229
|
+
inheritedAutonomous: z30.union([z30.boolean(), z30.literal("source-dependent")]),
|
|
4230
|
+
inheritedWorktree: z30.boolean()
|
|
4090
4231
|
}),
|
|
4091
|
-
resources:
|
|
4092
|
-
maxParallel:
|
|
4093
|
-
maxMonitoringSessions:
|
|
4094
|
-
monitoringWakeIntervalMinutes:
|
|
4232
|
+
resources: z30.object({
|
|
4233
|
+
maxParallel: z30.number(),
|
|
4234
|
+
maxMonitoringSessions: z30.number(),
|
|
4235
|
+
monitoringWakeIntervalMinutes: z30.number().nullable(),
|
|
4095
4236
|
/** Resume a run a provider usage limit stopped, once the limit resets. Default `true`. */
|
|
4096
|
-
autoResumeOnUsageLimit:
|
|
4097
|
-
memoryLimitMb:
|
|
4098
|
-
worktreeRetentionDefault:
|
|
4237
|
+
autoResumeOnUsageLimit: z30.boolean(),
|
|
4238
|
+
memoryLimitMb: z30.number().nullable(),
|
|
4239
|
+
worktreeRetentionDefault: z30.number()
|
|
4099
4240
|
}),
|
|
4100
4241
|
/**
|
|
4101
4242
|
* What a repo that has set none of its own runs (spec 2026-07-29-agent-profiles).
|
|
@@ -4105,49 +4246,49 @@ var workspaceConfigResponseSchema = z29.object({
|
|
|
4105
4246
|
* from a value someone chose or the fallback collapses into "always claude". Consulted only where
|
|
4106
4247
|
* the repo's own `.ai/cezar/config.json` is silent — a repo that chose is never overruled.
|
|
4107
4248
|
*/
|
|
4108
|
-
agentDefaults:
|
|
4249
|
+
agentDefaults: z30.object({
|
|
4109
4250
|
runner: runnerSchema.optional(),
|
|
4110
4251
|
models: perRunnerOptionalStrings().optional()
|
|
4111
4252
|
})
|
|
4112
4253
|
});
|
|
4113
|
-
var setWorkspaceConfigInputSchema =
|
|
4114
|
-
browseRoot:
|
|
4115
|
-
projectsDir:
|
|
4116
|
-
archiveOnMerge:
|
|
4117
|
-
composerDefaults:
|
|
4118
|
-
autonomous:
|
|
4119
|
-
worktree:
|
|
4254
|
+
var setWorkspaceConfigInputSchema = z30.object({
|
|
4255
|
+
browseRoot: z30.string().trim().min(1).max(4096).optional(),
|
|
4256
|
+
projectsDir: z30.string().trim().min(1).max(4096).optional(),
|
|
4257
|
+
archiveOnMerge: z30.boolean().nullable().optional(),
|
|
4258
|
+
composerDefaults: z30.object({
|
|
4259
|
+
autonomous: z30.boolean().nullable().optional(),
|
|
4260
|
+
worktree: z30.boolean().nullable().optional()
|
|
4120
4261
|
}).optional(),
|
|
4121
4262
|
/** Machine-wide agent defaults. `null` on a key CLEARS it back to "no opinion", which a bare
|
|
4122
4263
|
* absent key cannot say in a partial patch. */
|
|
4123
|
-
agentDefaults:
|
|
4264
|
+
agentDefaults: z30.object({
|
|
4124
4265
|
runner: runnerSchema.nullable().optional(),
|
|
4125
4266
|
/** Keyed by runner id; the server keeps only the keys of registered runners. */
|
|
4126
|
-
models:
|
|
4267
|
+
models: z30.record(z30.string(), z30.string().trim().min(1).max(200).nullable().optional()).optional()
|
|
4127
4268
|
}).optional(),
|
|
4128
|
-
resources:
|
|
4129
|
-
maxParallel:
|
|
4130
|
-
maxMonitoringSessions:
|
|
4131
|
-
monitoringWakeIntervalMinutes:
|
|
4132
|
-
autoResumeOnUsageLimit:
|
|
4133
|
-
memoryLimitMb:
|
|
4134
|
-
worktreeRetentionDefault:
|
|
4269
|
+
resources: z30.object({
|
|
4270
|
+
maxParallel: z30.number().int().min(1).max(16).optional(),
|
|
4271
|
+
maxMonitoringSessions: z30.number().int().min(0).max(16).optional(),
|
|
4272
|
+
monitoringWakeIntervalMinutes: z30.number().int().min(1).max(60).nullable().optional(),
|
|
4273
|
+
autoResumeOnUsageLimit: z30.boolean().optional(),
|
|
4274
|
+
memoryLimitMb: z30.number().int().min(0).max(1048576).nullable().optional(),
|
|
4275
|
+
worktreeRetentionDefault: z30.number().int().min(0).max(1e3).optional()
|
|
4135
4276
|
}).optional()
|
|
4136
4277
|
});
|
|
4137
|
-
var appearanceSchema =
|
|
4138
|
-
accent:
|
|
4139
|
-
density:
|
|
4140
|
-
width:
|
|
4278
|
+
var appearanceSchema = z30.object({
|
|
4279
|
+
accent: z30.enum(["cezarion", "lime", "violet"]).optional(),
|
|
4280
|
+
density: z30.enum(["comfortable", "compact", "ultra"]).optional(),
|
|
4281
|
+
width: z30.enum(["narrow", "wide"]).optional()
|
|
4141
4282
|
});
|
|
4142
|
-
var taskTableUiStateSchema =
|
|
4283
|
+
var taskTableUiStateSchema = z30.looseObject({
|
|
4143
4284
|
/** Explicit user choices only. Missing ids keep the registry-owned default. */
|
|
4144
|
-
expandedColumns:
|
|
4285
|
+
expandedColumns: z30.record(z30.string(), z30.boolean()).optional()
|
|
4145
4286
|
});
|
|
4146
|
-
var sidebarLimitsSchema =
|
|
4147
|
-
overall:
|
|
4148
|
-
needsYou:
|
|
4149
|
-
finished:
|
|
4150
|
-
working:
|
|
4287
|
+
var sidebarLimitsSchema = z30.object({
|
|
4288
|
+
overall: z30.number().int().positive().nullable().optional(),
|
|
4289
|
+
needsYou: z30.number().int().positive().nullable().optional(),
|
|
4290
|
+
finished: z30.number().int().positive().nullable().optional(),
|
|
4291
|
+
working: z30.number().int().positive().nullable().optional()
|
|
4151
4292
|
});
|
|
4152
4293
|
function normalizeSidebarLimits(value) {
|
|
4153
4294
|
const defaults = { overall: 10, needsYou: null, finished: null, working: null };
|
|
@@ -4158,54 +4299,54 @@ function normalizeSidebarLimits(value) {
|
|
|
4158
4299
|
}
|
|
4159
4300
|
return defaults;
|
|
4160
4301
|
}
|
|
4161
|
-
var uiStateSchema =
|
|
4302
|
+
var uiStateSchema = z30.looseObject({
|
|
4162
4303
|
sidebarLimits: sidebarLimitsSchema.optional(),
|
|
4163
4304
|
/** What the last started run used. `null` is a VALUE, not an absence: it records a run that
|
|
4164
4305
|
* chose neither a skill nor a workflow (the plain built-in `quick-task`), which the composer
|
|
4165
4306
|
* can now express since the source picker grew an empty state. Absent still means "no
|
|
4166
4307
|
* run has been recorded here" — a cockpit reading either one selects nothing. */
|
|
4167
|
-
lastTask:
|
|
4308
|
+
lastTask: z30.object({ source: z30.enum(["workflow", "skill"]), ref: z30.string() }).nullable().optional(),
|
|
4168
4309
|
/** Most-recently-run sources, newest first (deduped, capped). Feeds the composer picker's
|
|
4169
4310
|
* recency sort. */
|
|
4170
|
-
recentSources:
|
|
4311
|
+
recentSources: z30.array(z30.object({ source: z30.enum(["workflow", "skill"]), ref: z30.string() })).optional(),
|
|
4171
4312
|
/** The last worktree choice for a single-skill run. Absent → the default (isolated worktree). */
|
|
4172
|
-
lastWorktree:
|
|
4313
|
+
lastWorktree: z30.boolean().optional(),
|
|
4173
4314
|
/** The last autonomous choice — remembered like `lastWorktree`. Absent → off. */
|
|
4174
|
-
lastAutonomous:
|
|
4315
|
+
lastAutonomous: z30.boolean().optional(),
|
|
4175
4316
|
/** Skill selection frequency (#408): name → times chosen, across BOTH composers. */
|
|
4176
|
-
skillUsage:
|
|
4177
|
-
runsView:
|
|
4317
|
+
skillUsage: z30.record(z30.string(), z30.number()).optional(),
|
|
4318
|
+
runsView: z30.enum(["list", "table"]).optional(),
|
|
4178
4319
|
/** The GitHub tab's last-selected sub-tab (#417). Absent → issues. */
|
|
4179
|
-
githubView:
|
|
4320
|
+
githubView: z30.enum(["issues", "prs"]).optional(),
|
|
4180
4321
|
/** Settings → Appearance. The theme itself stays in localStorage (`cez-theme`) — it must
|
|
4181
4322
|
* pre-paint, and it is per-browser by design. */
|
|
4182
4323
|
appearance: appearanceSchema.optional(),
|
|
4183
4324
|
/** Follow-up prompt templates (#413). Absent → the built-in defaults; present (even `[]`) is
|
|
4184
4325
|
* the user's own edited list. `skills` are the skill names the template auto-applies for. */
|
|
4185
|
-
promptTemplates:
|
|
4186
|
-
|
|
4187
|
-
id:
|
|
4188
|
-
label:
|
|
4189
|
-
text:
|
|
4190
|
-
skills:
|
|
4326
|
+
promptTemplates: z30.array(
|
|
4327
|
+
z30.object({
|
|
4328
|
+
id: z30.string(),
|
|
4329
|
+
label: z30.string(),
|
|
4330
|
+
text: z30.string(),
|
|
4331
|
+
skills: z30.array(z30.string()).optional()
|
|
4191
4332
|
})
|
|
4192
4333
|
).optional()
|
|
4193
4334
|
});
|
|
4194
|
-
var workspaceLastLocationSchema =
|
|
4195
|
-
projectId:
|
|
4196
|
-
pathname:
|
|
4197
|
-
search:
|
|
4198
|
-
hash:
|
|
4335
|
+
var workspaceLastLocationSchema = z30.strictObject({
|
|
4336
|
+
projectId: z30.string().min(1).max(64),
|
|
4337
|
+
pathname: z30.string().min(1).max(2048).startsWith("/p/"),
|
|
4338
|
+
search: z30.string().max(4096).startsWith("?").optional(),
|
|
4339
|
+
hash: z30.string().max(2048).startsWith("#").optional()
|
|
4199
4340
|
});
|
|
4200
|
-
var workspaceUiStateSchema =
|
|
4201
|
-
sidebar:
|
|
4341
|
+
var workspaceUiStateSchema = z30.looseObject({
|
|
4342
|
+
sidebar: z30.looseObject({
|
|
4202
4343
|
/** LEGACY — the sidebar's per-project collapse map (step 3.3). Still accepted and still
|
|
4203
4344
|
* round-tripped so an older cockpit sharing this home keeps working, but the current
|
|
4204
4345
|
* cockpit neither reads nor writes it: which groups are shut describes the WINDOW, not the
|
|
4205
4346
|
* workspace, so it lives in that browser's localStorage
|
|
4206
4347
|
* (`packages/web/src/lib/sidebar-collapse.ts`). One shared answer meant a phone collapsing
|
|
4207
4348
|
* a group collapsed it on the desktop too. */
|
|
4208
|
-
collapsed:
|
|
4349
|
+
collapsed: z30.record(z30.string(), z30.boolean()).optional(),
|
|
4209
4350
|
/** The user's hand-picked project order (hearsay-tools/cezarion#438, port of
|
|
4210
4351
|
* open-mercato/cezar#952), most-wanted first — WORKSPACE state on purpose, unlike
|
|
4211
4352
|
* `collapsed` above. Which order your repos sit in is a considered choice made once, so
|
|
@@ -4216,7 +4357,7 @@ var workspaceUiStateSchema = z29.looseObject({
|
|
|
4216
4357
|
* Ids that are no longer registered are ignored on read; registered projects missing from
|
|
4217
4358
|
* the list are not dropped — they keep registry order ahead of the picked ones
|
|
4218
4359
|
* (`packages/web/src/lib/project-order.ts`). */
|
|
4219
|
-
projectOrder:
|
|
4360
|
+
projectOrder: z30.array(z30.string()).optional()
|
|
4220
4361
|
}).optional(),
|
|
4221
4362
|
/** Dismissed runtime-auth incident IDs, keyed by provider. An ID is only dismissed until the
|
|
4222
4363
|
* provider reports a different incident, so this stays workspace-global with the browser
|
|
@@ -4227,7 +4368,7 @@ var workspaceUiStateSchema = z29.looseObject({
|
|
|
4227
4368
|
appearance: appearanceSchema.optional(),
|
|
4228
4369
|
/** Settings → Notifications, GLOBAL since step 3.5 — one answer for the whole workspace, since
|
|
4229
4370
|
* the delivering browser is one browser whichever project you are looking at. */
|
|
4230
|
-
notifications:
|
|
4371
|
+
notifications: z30.looseObject({ enabled: z30.boolean().optional() }).optional(),
|
|
4231
4372
|
/** Desktop Tasks-table density, shared across every project in this workspace. */
|
|
4232
4373
|
taskTable: taskTableUiStateSchema.optional(),
|
|
4233
4374
|
/** LEGACY, exactly like `sidebar` above — the last settled project-scoped page, restored when
|
|
@@ -4238,21 +4379,21 @@ var workspaceUiStateSchema = z29.looseObject({
|
|
|
4238
4379
|
});
|
|
4239
4380
|
var WORKSPACE_UI_STATE_MAX_KEYS = 200;
|
|
4240
4381
|
var TASK_TABLE_MAX_COLUMNS = 50;
|
|
4241
|
-
var setWorkspaceUiStateInputSchema =
|
|
4382
|
+
var setWorkspaceUiStateInputSchema = z30.looseObject({
|
|
4242
4383
|
...workspaceUiStateSchema.shape,
|
|
4243
|
-
sidebar:
|
|
4244
|
-
collapsed:
|
|
4384
|
+
sidebar: z30.looseObject({
|
|
4385
|
+
collapsed: z30.record(z30.string().min(1).max(64), z30.boolean()).refine((map) => Object.keys(map).length <= WORKSPACE_UI_STATE_MAX_KEYS, {
|
|
4245
4386
|
message: `sidebar.collapsed must have at most ${WORKSPACE_UI_STATE_MAX_KEYS} entries`
|
|
4246
4387
|
}).optional(),
|
|
4247
4388
|
// Project ids, so the same 64-char bound the registry's slug rule and `collapsed`'s keys
|
|
4248
4389
|
// already use. Duplicates are not rejected — the cockpit dedupes on read, and a 400 on a
|
|
4249
4390
|
// sidebar drag would be a worse answer than a self-healing one.
|
|
4250
|
-
projectOrder:
|
|
4391
|
+
projectOrder: z30.array(z30.string().min(1).max(64)).max(WORKSPACE_UI_STATE_MAX_KEYS).optional()
|
|
4251
4392
|
}).optional(),
|
|
4252
4393
|
/** Keyed by runner id; the server refuses a key that names no registered or removed runner. */
|
|
4253
|
-
dismissedProviderAuthFailures:
|
|
4394
|
+
dismissedProviderAuthFailures: z30.record(z30.string(), z30.string().min(1).max(128).optional()).optional(),
|
|
4254
4395
|
taskTable: taskTableUiStateSchema.extend({
|
|
4255
|
-
expandedColumns:
|
|
4396
|
+
expandedColumns: z30.record(z30.string().min(1).max(64), z30.boolean()).refine((map) => Object.keys(map).length <= TASK_TABLE_MAX_COLUMNS, {
|
|
4256
4397
|
message: `taskTable.expandedColumns must have at most ${TASK_TABLE_MAX_COLUMNS} entries`
|
|
4257
4398
|
}).optional()
|
|
4258
4399
|
}).optional()
|
|
@@ -4269,62 +4410,62 @@ var WORKTREE_SETUP_MAX_COMMANDS = 20;
|
|
|
4269
4410
|
var WORKTREE_SETUP_MAX_COMMAND_LENGTH = 4e3;
|
|
4270
4411
|
var WORKTREE_SETUP_DEFAULT_TIMEOUT_SECONDS = 900;
|
|
4271
4412
|
var WORKTREE_SETUP_MAX_TIMEOUT_SECONDS = 7200;
|
|
4272
|
-
var worktreeSetupConfigSchema =
|
|
4273
|
-
commands:
|
|
4413
|
+
var worktreeSetupConfigSchema = z30.object({
|
|
4414
|
+
commands: z30.array(z30.string().trim().min(1).max(WORKTREE_SETUP_MAX_COMMAND_LENGTH)).max(WORKTREE_SETUP_MAX_COMMANDS),
|
|
4274
4415
|
/** Per command. Absent = `WORKTREE_SETUP_DEFAULT_TIMEOUT_SECONDS`. */
|
|
4275
|
-
timeoutSeconds:
|
|
4416
|
+
timeoutSeconds: z30.number().int().min(1).max(WORKTREE_SETUP_MAX_TIMEOUT_SECONDS).optional()
|
|
4276
4417
|
}).strict();
|
|
4277
|
-
var configResponseSchema =
|
|
4278
|
-
archiveOnMerge:
|
|
4279
|
-
effectiveArchiveOnMerge:
|
|
4280
|
-
archiveOnMergeSource:
|
|
4281
|
-
baseBranch:
|
|
4418
|
+
var configResponseSchema = z30.object({
|
|
4419
|
+
archiveOnMerge: z30.boolean().nullable(),
|
|
4420
|
+
effectiveArchiveOnMerge: z30.boolean(),
|
|
4421
|
+
archiveOnMergeSource: z30.enum(["project", "global", "environment", "default"]),
|
|
4422
|
+
baseBranch: z30.string().nullable(),
|
|
4282
4423
|
defaultRunner: runnerSchema,
|
|
4283
|
-
systemPrompt:
|
|
4424
|
+
systemPrompt: z30.string().nullable(),
|
|
4284
4425
|
defaultModels: runnerModelsSchema,
|
|
4285
4426
|
/** True when native coding-agent settings are authoritative and model picks are read-only. */
|
|
4286
|
-
modelsLocked:
|
|
4427
|
+
modelsLocked: z30.boolean(),
|
|
4287
4428
|
/** How many tasks run at once (1–16). */
|
|
4288
|
-
maxParallel:
|
|
4429
|
+
maxParallel: z30.number(),
|
|
4289
4430
|
/** Per-task memory ceiling in MiB (whole process tree); null = no limit. */
|
|
4290
|
-
memoryLimitMb:
|
|
4431
|
+
memoryLimitMb: z30.number().nullable(),
|
|
4291
4432
|
/** Keep the last N finished worktrees on disk (#483); 0 = unlimited. Older ones are reclaimed
|
|
4292
4433
|
* (directory only — branch kept, so work is recoverable). */
|
|
4293
|
-
worktreeRetention:
|
|
4434
|
+
worktreeRetention: z30.number(),
|
|
4294
4435
|
/** Live title updates: null = no config key, the `CEZ_TITLE_UPDATES` env default (ON) decides. */
|
|
4295
|
-
liveTitleUpdates:
|
|
4436
|
+
liveTitleUpdates: z30.boolean().nullable(),
|
|
4296
4437
|
/** Optional review gate (#489): null = no config key, the `CEZ_REVIEW_GATE` env default (OFF)
|
|
4297
4438
|
* decides. */
|
|
4298
|
-
reviewGate:
|
|
4439
|
+
reviewGate: z30.boolean().nullable(),
|
|
4299
4440
|
/** Worktree setup (#917): the commands that prepare a new task or worker worktree, with the
|
|
4300
4441
|
* timeout filled in. null = no setup, or an invalid value (then `worktreeSetupIssue` says why). */
|
|
4301
|
-
worktreeSetup:
|
|
4442
|
+
worktreeSetup: z30.object({ commands: z30.array(z30.string()), timeoutSeconds: z30.number() }).nullable(),
|
|
4302
4443
|
/** Why `config.json`'s `worktreeSetup` is invalid; null when it is valid or absent. */
|
|
4303
|
-
worktreeSetupIssue:
|
|
4444
|
+
worktreeSetupIssue: z30.string().nullable(),
|
|
4304
4445
|
/** Worktree teardown (hearsay-tools/squawk#914): the commands worker destroy runs in the worker's
|
|
4305
4446
|
* worktree before it looks for holders, with the timeout filled in. null = no teardown, or an
|
|
4306
4447
|
* invalid value (then `worktreeTeardownIssue` says why). */
|
|
4307
|
-
worktreeTeardown:
|
|
4448
|
+
worktreeTeardown: z30.object({ commands: z30.array(z30.string()), timeoutSeconds: z30.number() }).nullable(),
|
|
4308
4449
|
/** Why `config.json`'s `worktreeTeardown` is invalid; null when it is valid or absent. */
|
|
4309
|
-
worktreeTeardownIssue:
|
|
4450
|
+
worktreeTeardownIssue: z30.string().nullable()
|
|
4310
4451
|
});
|
|
4311
4452
|
var setConfigResponseSchema = configResponseSchema;
|
|
4312
|
-
var setConfigInputSchema =
|
|
4313
|
-
archiveOnMerge:
|
|
4314
|
-
baseBranch:
|
|
4453
|
+
var setConfigInputSchema = z30.object({
|
|
4454
|
+
archiveOnMerge: z30.boolean().nullable().optional(),
|
|
4455
|
+
baseBranch: z30.string().trim().min(1).max(200).nullable().optional(),
|
|
4315
4456
|
defaultRunner: runnerSchema.optional(),
|
|
4316
|
-
systemPrompt:
|
|
4457
|
+
systemPrompt: z30.string().trim().max(2e4).nullable().optional(),
|
|
4317
4458
|
/** Keyed by runner id; the server keeps only the keys of registered runners. */
|
|
4318
|
-
defaultModels:
|
|
4319
|
-
maxParallel:
|
|
4459
|
+
defaultModels: z30.record(z30.string(), z30.string().trim().max(200).nullable().optional()).optional(),
|
|
4460
|
+
maxParallel: z30.number().int().min(1).max(16).optional(),
|
|
4320
4461
|
/** null or 0 clears the ceiling back to "no limit". */
|
|
4321
|
-
memoryLimitMb:
|
|
4462
|
+
memoryLimitMb: z30.number().int().min(0).max(1048576).nullable().optional(),
|
|
4322
4463
|
/** Keep last N finished worktrees (#483); 0 = unlimited, null clears back to the default (10). */
|
|
4323
|
-
worktreeRetention:
|
|
4464
|
+
worktreeRetention: z30.number().int().min(0).max(1e3).nullable().optional(),
|
|
4324
4465
|
/** null clears the key back to the env-default behavior. */
|
|
4325
|
-
liveTitleUpdates:
|
|
4466
|
+
liveTitleUpdates: z30.boolean().nullable().optional(),
|
|
4326
4467
|
/** null clears the key back to the env-default behavior (OFF). */
|
|
4327
|
-
reviewGate:
|
|
4468
|
+
reviewGate: z30.boolean().nullable().optional(),
|
|
4328
4469
|
/** Worktree setup (#917). null or an empty command list deletes the key. Refused with 409 by a
|
|
4329
4470
|
* hosted cockpit: these are commands the host runs. */
|
|
4330
4471
|
worktreeSetup: worktreeSetupConfigSchema.nullable().optional(),
|
|
@@ -4333,238 +4474,238 @@ var setConfigInputSchema = z29.object({
|
|
|
4333
4474
|
worktreeTeardown: worktreeSetupConfigSchema.nullable().optional()
|
|
4334
4475
|
});
|
|
4335
4476
|
var providerIdSchema = runnerSchema;
|
|
4336
|
-
var providerConnectionStateSchema =
|
|
4477
|
+
var providerConnectionStateSchema = z30.enum([
|
|
4337
4478
|
"connected",
|
|
4338
4479
|
"disconnected",
|
|
4339
4480
|
"not-installed",
|
|
4340
4481
|
"unknown"
|
|
4341
4482
|
]);
|
|
4342
|
-
var providerStatusSchema =
|
|
4343
|
-
requiresAccountHome:
|
|
4483
|
+
var providerStatusSchema = z30.object({
|
|
4484
|
+
requiresAccountHome: z30.boolean().optional(),
|
|
4344
4485
|
provider: providerIdSchema,
|
|
4345
4486
|
status: providerConnectionStateSchema,
|
|
4346
|
-
enabled:
|
|
4347
|
-
hint:
|
|
4348
|
-
authFailureId:
|
|
4487
|
+
enabled: z30.boolean().optional(),
|
|
4488
|
+
hint: z30.string().optional(),
|
|
4489
|
+
authFailureId: z30.string().optional(),
|
|
4349
4490
|
/** Which agent account this row describes (spec 2026-07-29-agent-profiles). ABSENT on
|
|
4350
4491
|
* `GET /api/v1/providers/status`, which deliberately keeps answering exactly one row per
|
|
4351
4492
|
* provider — the discovered default — so an older client sees no change at all. Per-account
|
|
4352
4493
|
* rows are carried by `GET /api/v1/workspace/agent-profiles` instead. */
|
|
4353
|
-
profileId:
|
|
4494
|
+
profileId: z30.string().optional()
|
|
4354
4495
|
});
|
|
4355
|
-
var providerStatusResponseSchema =
|
|
4356
|
-
providers:
|
|
4496
|
+
var providerStatusResponseSchema = z30.object({
|
|
4497
|
+
providers: z30.array(providerStatusSchema)
|
|
4357
4498
|
});
|
|
4358
|
-
var providerConnectResponseSchema =
|
|
4359
|
-
|
|
4360
|
-
|
|
4499
|
+
var providerConnectResponseSchema = z30.discriminatedUnion("opened", [
|
|
4500
|
+
z30.object({ opened: z30.literal(true), command: z30.string() }),
|
|
4501
|
+
z30.object({ opened: z30.literal(false), connected: z30.literal(true), command: z30.string() })
|
|
4361
4502
|
]);
|
|
4362
|
-
var providerSignInSchema =
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4503
|
+
var providerSignInSchema = z30.discriminatedUnion("state", [
|
|
4504
|
+
z30.object({ id: z30.uuid(), state: z30.literal("waiting"), url: z30.string().url() }),
|
|
4505
|
+
z30.object({ id: z30.uuid(), state: z30.enum(["connected", "cancelled"]) }),
|
|
4506
|
+
z30.object({ id: z30.uuid(), state: z30.literal("failed"), error: z30.string() })
|
|
4366
4507
|
]);
|
|
4367
|
-
var runnerModelCatalogResponseSchema =
|
|
4508
|
+
var runnerModelCatalogResponseSchema = z30.object({
|
|
4368
4509
|
runner: runnerSchema,
|
|
4369
|
-
models:
|
|
4370
|
-
source:
|
|
4371
|
-
stale:
|
|
4372
|
-
reason:
|
|
4373
|
-
});
|
|
4374
|
-
var openTargetSchema =
|
|
4375
|
-
id:
|
|
4376
|
-
label:
|
|
4510
|
+
models: z30.array(runnerModelOptionSchema),
|
|
4511
|
+
source: z30.enum(["live", "cache", "unavailable"]),
|
|
4512
|
+
stale: z30.boolean(),
|
|
4513
|
+
reason: z30.string().optional()
|
|
4514
|
+
});
|
|
4515
|
+
var openTargetSchema = z30.object({
|
|
4516
|
+
id: z30.string(),
|
|
4517
|
+
label: z30.string(),
|
|
4377
4518
|
/** A stable icon key (#361) the UI maps to a concrete icon. Optional: an older server omitting
|
|
4378
4519
|
* it just renders the generic fallback icon. */
|
|
4379
|
-
icon:
|
|
4520
|
+
icon: z30.string().optional()
|
|
4380
4521
|
});
|
|
4381
|
-
var openTargetsResponseSchema =
|
|
4382
|
-
targets:
|
|
4522
|
+
var openTargetsResponseSchema = z30.object({
|
|
4523
|
+
targets: z30.array(openTargetSchema)
|
|
4383
4524
|
});
|
|
4384
|
-
var openProjectInSchema =
|
|
4525
|
+
var openProjectInSchema = z30.object({
|
|
4385
4526
|
// A short bound (#429): matched against a downstream allowlist, so an app id is never long.
|
|
4386
|
-
target:
|
|
4527
|
+
target: z30.string().trim().min(1, "target required").max(200)
|
|
4387
4528
|
});
|
|
4388
|
-
var openProjectInResponseSchema =
|
|
4389
|
-
opened:
|
|
4390
|
-
path:
|
|
4529
|
+
var openProjectInResponseSchema = z30.object({
|
|
4530
|
+
opened: z30.literal(true),
|
|
4531
|
+
path: z30.string()
|
|
4391
4532
|
});
|
|
4392
|
-
var workspaceIdentityResponseSchema =
|
|
4393
|
-
installId:
|
|
4394
|
-
version:
|
|
4533
|
+
var workspaceIdentityResponseSchema = z30.object({
|
|
4534
|
+
installId: z30.uuid(),
|
|
4535
|
+
version: z30.string()
|
|
4395
4536
|
});
|
|
4396
4537
|
|
|
4397
4538
|
// ../contract/src/skills.ts
|
|
4398
|
-
import { z as
|
|
4399
|
-
var skillSchema =
|
|
4400
|
-
name:
|
|
4401
|
-
description:
|
|
4402
|
-
body:
|
|
4403
|
-
path:
|
|
4539
|
+
import { z as z31 } from "zod";
|
|
4540
|
+
var skillSchema = z31.object({
|
|
4541
|
+
name: z31.string(),
|
|
4542
|
+
description: z31.string().optional(),
|
|
4543
|
+
body: z31.string(),
|
|
4544
|
+
path: z31.string(),
|
|
4404
4545
|
/** `builtin`: shipped by Squawk itself and listed last (#774), so a repo skill of the same name wins. */
|
|
4405
|
-
source:
|
|
4546
|
+
source: z31.enum(["ai", "cezar", "agents", "global", "team", "builtin"]),
|
|
4406
4547
|
/** Team skills only: where the definition lives in its skills repo. */
|
|
4407
|
-
team:
|
|
4408
|
-
repo:
|
|
4409
|
-
ref:
|
|
4410
|
-
path:
|
|
4548
|
+
team: z31.object({
|
|
4549
|
+
repo: z31.string(),
|
|
4550
|
+
ref: z31.string(),
|
|
4551
|
+
path: z31.string(),
|
|
4411
4552
|
/** True for the `SKILL.md` convention — a whole directory (references/…). */
|
|
4412
|
-
dir:
|
|
4553
|
+
dir: z31.boolean(),
|
|
4413
4554
|
/**
|
|
4414
4555
|
* The exact commit `ref` resolved to when the skill was read (#428).
|
|
4415
4556
|
*
|
|
4416
4557
|
* The hand-written DTO omitted this field entirely — it was NARROWER than the route,
|
|
4417
4558
|
* which has served it since #428.
|
|
4418
4559
|
*/
|
|
4419
|
-
commit:
|
|
4560
|
+
commit: z31.string().optional()
|
|
4420
4561
|
}).optional()
|
|
4421
4562
|
});
|
|
4422
4563
|
|
|
4423
4564
|
// ../contract/src/agent-config.ts
|
|
4424
|
-
import { z as
|
|
4425
|
-
var agentConfigFormatSchema =
|
|
4426
|
-
var agentConfigScopeSchema =
|
|
4427
|
-
var agentConfigKindSchema =
|
|
4428
|
-
var agentConfigTrackedSchema =
|
|
4429
|
-
var agentConfigFileSchema =
|
|
4565
|
+
import { z as z32 } from "zod";
|
|
4566
|
+
var agentConfigFormatSchema = z32.enum(["json", "jsonc", "toml", "yaml", "markdown"]);
|
|
4567
|
+
var agentConfigScopeSchema = z32.enum(["user", "project", "local"]);
|
|
4568
|
+
var agentConfigKindSchema = z32.enum(["settings", "memory", "mcp"]);
|
|
4569
|
+
var agentConfigTrackedSchema = z32.enum(["tracked", "gitignored", "outside-repo"]);
|
|
4570
|
+
var agentConfigFileSchema = z32.object({
|
|
4430
4571
|
/** Stable, opaque, URL-safe — the ONLY thing a client may name (traversal-proof). */
|
|
4431
|
-
id:
|
|
4572
|
+
id: z32.string(),
|
|
4432
4573
|
/** Every runner that reads this file: `<repo>/AGENTS.md` is one file, two readers. */
|
|
4433
|
-
runners:
|
|
4574
|
+
runners: z32.array(runnerSchema),
|
|
4434
4575
|
kind: agentConfigKindSchema,
|
|
4435
4576
|
scope: agentConfigScopeSchema,
|
|
4436
|
-
label:
|
|
4437
|
-
path:
|
|
4577
|
+
label: z32.string(),
|
|
4578
|
+
path: z32.string(),
|
|
4438
4579
|
format: agentConfigFormatSchema,
|
|
4439
4580
|
tracked: agentConfigTrackedSchema,
|
|
4440
|
-
seeded:
|
|
4441
|
-
holdsMcp:
|
|
4581
|
+
seeded: z32.boolean(),
|
|
4582
|
+
holdsMcp: z32.boolean(),
|
|
4442
4583
|
/** VERBATIM from the vendor docs. Never computed, never generic. */
|
|
4443
|
-
precedence:
|
|
4584
|
+
precedence: z32.string(),
|
|
4444
4585
|
/** Documented mid-run reload behaviour, or absent when the vendor is silent. */
|
|
4445
|
-
hotReload:
|
|
4446
|
-
docsUrl:
|
|
4447
|
-
exists:
|
|
4448
|
-
size:
|
|
4586
|
+
hotReload: z32.string().optional(),
|
|
4587
|
+
docsUrl: z32.string(),
|
|
4588
|
+
exists: z32.boolean(),
|
|
4589
|
+
size: z32.number(),
|
|
4449
4590
|
/** sha256 of the bytes, or null when absent. */
|
|
4450
|
-
version:
|
|
4591
|
+
version: z32.string().nullable(),
|
|
4451
4592
|
/** False in hosted mode (whole feature) — the client renders read-only up front. */
|
|
4452
|
-
writable:
|
|
4453
|
-
readOnlyReason:
|
|
4593
|
+
writable: z32.boolean(),
|
|
4594
|
+
readOnlyReason: z32.string().optional()
|
|
4454
4595
|
});
|
|
4455
|
-
var userMcpListingSchema =
|
|
4456
|
-
path:
|
|
4457
|
-
servers:
|
|
4458
|
-
readable:
|
|
4596
|
+
var userMcpListingSchema = z32.object({
|
|
4597
|
+
path: z32.string(),
|
|
4598
|
+
servers: z32.array(z32.string()),
|
|
4599
|
+
readable: z32.boolean()
|
|
4459
4600
|
});
|
|
4460
|
-
var agentConfigListingSchema =
|
|
4461
|
-
editable:
|
|
4462
|
-
files:
|
|
4601
|
+
var agentConfigListingSchema = z32.object({
|
|
4602
|
+
editable: z32.boolean(),
|
|
4603
|
+
files: z32.array(agentConfigFileSchema),
|
|
4463
4604
|
/** null in hosted mode (host-state disclosure guard). */
|
|
4464
4605
|
userMcp: userMcpListingSchema.nullable()
|
|
4465
4606
|
});
|
|
4466
|
-
var agentConfigFileContentSchema =
|
|
4467
|
-
id:
|
|
4468
|
-
path:
|
|
4469
|
-
exists:
|
|
4470
|
-
content:
|
|
4607
|
+
var agentConfigFileContentSchema = z32.object({
|
|
4608
|
+
id: z32.string(),
|
|
4609
|
+
path: z32.string(),
|
|
4610
|
+
exists: z32.boolean(),
|
|
4611
|
+
content: z32.string(),
|
|
4471
4612
|
/** sha256 of the bytes, or null when the file does not exist yet. */
|
|
4472
|
-
version:
|
|
4613
|
+
version: z32.string().nullable()
|
|
4473
4614
|
});
|
|
4474
|
-
var setAgentConfigInputSchema =
|
|
4475
|
-
content:
|
|
4476
|
-
version:
|
|
4615
|
+
var setAgentConfigInputSchema = z32.object({
|
|
4616
|
+
content: z32.string().max(2e6),
|
|
4617
|
+
version: z32.string().nullable()
|
|
4477
4618
|
});
|
|
4478
4619
|
|
|
4479
4620
|
// ../contract/src/session-context.ts
|
|
4480
|
-
import { z as
|
|
4621
|
+
import { z as z33 } from "zod";
|
|
4481
4622
|
var SESSION_CONTEXT_FILE_MAX_BYTES = 256 * 1024;
|
|
4482
|
-
var fileContentSchema =
|
|
4623
|
+
var fileContentSchema = z33.string().refine((text) => utf8Bytes(text) <= SESSION_CONTEXT_FILE_MAX_BYTES, {
|
|
4483
4624
|
error: `context.local.yaml must be at most ${SESSION_CONTEXT_FILE_MAX_BYTES} bytes`
|
|
4484
4625
|
});
|
|
4485
|
-
var sessionContextSourceSchema =
|
|
4486
|
-
var sessionContextFileSchema =
|
|
4626
|
+
var sessionContextSourceSchema = z33.enum(["built-in", "shared", "local"]);
|
|
4627
|
+
var sessionContextFileSchema = z33.object({
|
|
4487
4628
|
/** Relative to the project root: `.ai/squawk/context.local.yaml` or `.ai/cezar/context.local.yaml`. */
|
|
4488
|
-
path:
|
|
4489
|
-
exists:
|
|
4490
|
-
content:
|
|
4629
|
+
path: z33.string(),
|
|
4630
|
+
exists: z33.boolean(),
|
|
4631
|
+
content: z33.string(),
|
|
4491
4632
|
/** sha256 of the bytes, or null when the file does not exist. */
|
|
4492
|
-
version:
|
|
4633
|
+
version: z33.string().nullable(),
|
|
4493
4634
|
/** False when the file cannot be read as text, or lives in read-only fallback project data. */
|
|
4494
|
-
writable:
|
|
4495
|
-
readOnlyReason:
|
|
4635
|
+
writable: z33.boolean(),
|
|
4636
|
+
readOnlyReason: z33.string().nullable()
|
|
4496
4637
|
});
|
|
4497
|
-
var sessionContextSharedFileSchema =
|
|
4638
|
+
var sessionContextSharedFileSchema = z33.object({
|
|
4498
4639
|
/** Relative to the project root: `.ai/squawk/context.yaml` or `.ai/cezar/context.yaml`. */
|
|
4499
|
-
path:
|
|
4500
|
-
exists:
|
|
4501
|
-
content:
|
|
4640
|
+
path: z33.string(),
|
|
4641
|
+
exists: z33.boolean(),
|
|
4642
|
+
content: z33.string(),
|
|
4502
4643
|
/** True when Git tracks this file in the repository index. */
|
|
4503
|
-
tracked:
|
|
4644
|
+
tracked: z33.boolean(),
|
|
4504
4645
|
/** Non-null when the file cannot be read as UTF-8 text (e.g. symlink, binary, oversized). */
|
|
4505
|
-
unreadableReason:
|
|
4646
|
+
unreadableReason: z33.string().nullable()
|
|
4506
4647
|
});
|
|
4507
|
-
var sessionContextStateSchema =
|
|
4648
|
+
var sessionContextStateSchema = z33.object({
|
|
4508
4649
|
local: sessionContextFileSchema,
|
|
4509
4650
|
shared: sessionContextSharedFileSchema
|
|
4510
4651
|
});
|
|
4511
|
-
var setSessionContextSchema =
|
|
4652
|
+
var setSessionContextSchema = z33.object({
|
|
4512
4653
|
content: fileContentSchema,
|
|
4513
|
-
version:
|
|
4654
|
+
version: z33.string().nullable()
|
|
4514
4655
|
});
|
|
4515
|
-
var sessionContextRoleSchema =
|
|
4516
|
-
var sessionContextPreviewRequestSchema =
|
|
4656
|
+
var sessionContextRoleSchema = z33.enum(["parent", "worker"]);
|
|
4657
|
+
var sessionContextPreviewRequestSchema = z33.object({
|
|
4517
4658
|
content: fileContentSchema,
|
|
4518
4659
|
role: sessionContextRoleSchema
|
|
4519
4660
|
});
|
|
4520
|
-
var sessionContextProblemSchema =
|
|
4521
|
-
line:
|
|
4522
|
-
rule:
|
|
4523
|
-
message:
|
|
4661
|
+
var sessionContextProblemSchema = z33.object({
|
|
4662
|
+
line: z33.number().nullable(),
|
|
4663
|
+
rule: z33.number().nullable(),
|
|
4664
|
+
message: z33.string()
|
|
4524
4665
|
});
|
|
4525
|
-
var sessionContextPreviewBlockSchema =
|
|
4526
|
-
id:
|
|
4666
|
+
var sessionContextPreviewBlockSchema = z33.object({
|
|
4667
|
+
id: z33.string(),
|
|
4527
4668
|
source: sessionContextSourceSchema,
|
|
4528
4669
|
/** `built-in` for the handoff block; null when the file names no target for the entry. */
|
|
4529
|
-
target:
|
|
4530
|
-
status:
|
|
4670
|
+
target: z33.enum(["built-in", "parent", "worker", "both"]).nullable(),
|
|
4671
|
+
status: z33.enum(["applied", "skipped", "not-for-role"]),
|
|
4531
4672
|
/** True when a local rule replaced or muted a shared rule with the same id. */
|
|
4532
|
-
overridesShared:
|
|
4533
|
-
bytes:
|
|
4534
|
-
reason:
|
|
4535
|
-
sources:
|
|
4673
|
+
overridesShared: z33.boolean(),
|
|
4674
|
+
bytes: z33.number().nullable(),
|
|
4675
|
+
reason: z33.string().nullable(),
|
|
4676
|
+
sources: z33.array(z33.string()),
|
|
4536
4677
|
/** The rendered text, cut short for the preview; null when nothing rendered. */
|
|
4537
|
-
text:
|
|
4538
|
-
truncated:
|
|
4678
|
+
text: z33.string().nullable(),
|
|
4679
|
+
truncated: z33.boolean()
|
|
4539
4680
|
});
|
|
4540
|
-
var sessionContextPreviewSchema =
|
|
4541
|
-
problems:
|
|
4542
|
-
blocks:
|
|
4543
|
-
usedBytes:
|
|
4544
|
-
limitBytes:
|
|
4681
|
+
var sessionContextPreviewSchema = z33.object({
|
|
4682
|
+
problems: z33.array(sessionContextProblemSchema),
|
|
4683
|
+
blocks: z33.array(sessionContextPreviewBlockSchema),
|
|
4684
|
+
usedBytes: z33.number(),
|
|
4685
|
+
limitBytes: z33.number()
|
|
4545
4686
|
});
|
|
4546
4687
|
|
|
4547
4688
|
// ../contract/src/agent-profiles.ts
|
|
4548
|
-
import { z as
|
|
4689
|
+
import { z as z34 } from "zod";
|
|
4549
4690
|
var DEFAULT_AGENT_ACCOUNT_ID = "default";
|
|
4550
|
-
var agentProfileSchema =
|
|
4691
|
+
var agentProfileSchema = z34.object({
|
|
4551
4692
|
/** `default` for the discovered profile, else the stored slug. */
|
|
4552
|
-
id:
|
|
4693
|
+
id: z34.string(),
|
|
4553
4694
|
provider: providerIdSchema,
|
|
4554
|
-
label:
|
|
4695
|
+
label: z34.string(),
|
|
4555
4696
|
/** As the user wrote it — a literal `~` is preserved, matching `browseRoot`/`projectsDir`.
|
|
4556
4697
|
* Omitted on a remote cockpit without `settingsAdmin` so host paths are not disclosed. */
|
|
4557
|
-
configDir:
|
|
4698
|
+
configDir: z34.string().optional(),
|
|
4558
4699
|
/** Expanded absolute path. Omitted on a remote cockpit without `settingsAdmin`. */
|
|
4559
|
-
path:
|
|
4700
|
+
path: z34.string().optional(),
|
|
4560
4701
|
/** False for a dir the CLI has not created yet — legitimate, and NOT a reason to fall back
|
|
4561
4702
|
* to another account at run time (that would silently bill the wrong subscription). */
|
|
4562
|
-
exists:
|
|
4703
|
+
exists: z34.boolean(),
|
|
4563
4704
|
/** Whether the dir carries this agent's own marker files. ADVISORY: an unrecognised dir is
|
|
4564
4705
|
* still accepted, because "add profile → Connect → the CLI creates it" is the real flow. */
|
|
4565
|
-
looksValid:
|
|
4706
|
+
looksValid: z34.boolean(),
|
|
4566
4707
|
/** True for the profile Squawk discovers from the environment. Never stored, never deletable. */
|
|
4567
|
-
isDefault:
|
|
4708
|
+
isDefault: z34.boolean(),
|
|
4568
4709
|
/** This account's own authentication state — two Claude logins answer independently.
|
|
4569
4710
|
*
|
|
4570
4711
|
* **Absent until the probe has warmed.** Every probe shells out to an agent CLI, and this
|
|
@@ -4578,49 +4719,49 @@ function agentAccountRouteId(profile) {
|
|
|
4578
4719
|
return profile.isDefault ? `default:${profile.provider}` : profile.id;
|
|
4579
4720
|
}
|
|
4580
4721
|
var agentAccountSelectionSchema = perRunnerOptionalStrings();
|
|
4581
|
-
var agentProfilesResponseSchema =
|
|
4582
|
-
editable:
|
|
4583
|
-
profiles:
|
|
4722
|
+
var agentProfilesResponseSchema = z34.object({
|
|
4723
|
+
editable: z34.boolean(),
|
|
4724
|
+
profiles: z34.array(agentProfileSchema),
|
|
4584
4725
|
/** Providers that can carry more than one account at all — what "Add account" is offered for.
|
|
4585
4726
|
* OpenCode and omp are absent: no folder variable moves their credentials, so a config-dir
|
|
4586
4727
|
* profile would swap settings while still billing the other account. */
|
|
4587
|
-
profileCapableProviders:
|
|
4728
|
+
profileCapableProviders: z34.array(providerIdSchema),
|
|
4588
4729
|
/** Which account each project uses, keyed by the project's realpath'd ROOT.
|
|
4589
4730
|
*
|
|
4590
4731
|
* Served here rather than on `GET /api/v1/projects` because it is stored beside the accounts it
|
|
4591
4732
|
* names (`~/.cezar/agent-accounts.json`) — one file, so deleting an account and scrubbing every
|
|
4592
4733
|
* reference to it is one atomic write, and neither can be dropped by a Squawk version that never
|
|
4593
4734
|
* heard of accounts. Empty without `settingsAdmin` so host paths are not disclosed. */
|
|
4594
|
-
selections:
|
|
4735
|
+
selections: z34.record(z34.string(), agentAccountSelectionSchema),
|
|
4595
4736
|
/** Which account each project uses, keyed by canonical project id (plus `'default'` for the boot
|
|
4596
4737
|
* project). Always populated without disclosing host filesystem paths. */
|
|
4597
|
-
projectSelections:
|
|
4738
|
+
projectSelections: z34.record(z34.string(), agentAccountSelectionSchema)
|
|
4598
4739
|
});
|
|
4599
|
-
var selectAgentProfileInputSchema =
|
|
4740
|
+
var selectAgentProfileInputSchema = z34.object({
|
|
4600
4741
|
/** Registry slug, or the reserved `default` boot alias. Resolved to a root server-side. */
|
|
4601
|
-
projectId:
|
|
4742
|
+
projectId: z34.string().min(1).max(64),
|
|
4602
4743
|
provider: providerIdSchema,
|
|
4603
|
-
profileId:
|
|
4744
|
+
profileId: z34.string().max(64).nullable()
|
|
4604
4745
|
});
|
|
4605
|
-
var agentProfileSelectionsResponseSchema =
|
|
4606
|
-
selections:
|
|
4607
|
-
projectSelections:
|
|
4746
|
+
var agentProfileSelectionsResponseSchema = z34.object({
|
|
4747
|
+
selections: z34.record(z34.string(), agentAccountSelectionSchema),
|
|
4748
|
+
projectSelections: z34.record(z34.string(), agentAccountSelectionSchema)
|
|
4608
4749
|
});
|
|
4609
|
-
var agentAccountStatusResponseSchema =
|
|
4610
|
-
var createAgentProfileInputSchema =
|
|
4750
|
+
var agentAccountStatusResponseSchema = z34.object({ status: providerStatusSchema });
|
|
4751
|
+
var createAgentProfileInputSchema = z34.object({
|
|
4611
4752
|
provider: providerIdSchema,
|
|
4612
|
-
label:
|
|
4753
|
+
label: z34.string().trim().max(200).optional(),
|
|
4613
4754
|
/** Stored as written; validated absolute after `~` expansion, server-side. */
|
|
4614
|
-
configDir:
|
|
4755
|
+
configDir: z34.string().trim().min(1).max(4096)
|
|
4615
4756
|
});
|
|
4616
|
-
var agentProfileResponseSchema =
|
|
4617
|
-
var updateAgentProfileInputSchema =
|
|
4618
|
-
label:
|
|
4619
|
-
configDir:
|
|
4757
|
+
var agentProfileResponseSchema = z34.object({ profile: agentProfileSchema });
|
|
4758
|
+
var updateAgentProfileInputSchema = z34.object({
|
|
4759
|
+
label: z34.string().trim().max(200).optional(),
|
|
4760
|
+
configDir: z34.string().trim().min(1).max(4096).optional()
|
|
4620
4761
|
});
|
|
4621
|
-
var removeAgentProfileResponseSchema =
|
|
4622
|
-
removed:
|
|
4623
|
-
id:
|
|
4762
|
+
var removeAgentProfileResponseSchema = z34.object({
|
|
4763
|
+
removed: z34.literal(true),
|
|
4764
|
+
id: z34.string()
|
|
4624
4765
|
});
|
|
4625
4766
|
|
|
4626
4767
|
// ../contract/src/zoned-time.ts
|
|
@@ -4703,7 +4844,7 @@ function localTimeZone() {
|
|
|
4703
4844
|
}
|
|
4704
4845
|
|
|
4705
4846
|
// ../contract/src/automation-schedule.ts
|
|
4706
|
-
import { z as
|
|
4847
|
+
import { z as z35 } from "zod";
|
|
4707
4848
|
var SCHEDULE_TYPES = ["daily", "weekdays", "weekly", "hours", "once"];
|
|
4708
4849
|
var SCHEDULE_HOURS_OPTIONS = [1, 2, 3, 4, 6, 8, 12];
|
|
4709
4850
|
var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
@@ -4714,34 +4855,34 @@ var ONCE_AT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
|
4714
4855
|
var REPEATING_KEYS = ["hour", "minute", "day", "every"];
|
|
4715
4856
|
var ONCE_KEYS = ["at", "timeZone", "latestStartMinutes"];
|
|
4716
4857
|
var ONCE_PAST_DUE_MESSAGE = "the due time has passed; choose a later time or use Run now";
|
|
4717
|
-
var onceStatusSchema =
|
|
4858
|
+
var onceStatusSchema = z35.enum(["paused", "waiting", "failed", "missed", "archived"]);
|
|
4718
4859
|
function unknownTimeZoneMessage(zone) {
|
|
4719
4860
|
return `unknown time zone "${zone}"; use an IANA name such as Europe/Warsaw`;
|
|
4720
4861
|
}
|
|
4721
|
-
var automationScheduleSchema =
|
|
4722
|
-
type:
|
|
4862
|
+
var automationScheduleSchema = z35.object({
|
|
4863
|
+
type: z35.enum(SCHEDULE_TYPES),
|
|
4723
4864
|
/** 0–23; `daily`, `weekdays`, `weekly`. Default 4. */
|
|
4724
|
-
hour:
|
|
4865
|
+
hour: z35.number().int().min(0).max(23).optional(),
|
|
4725
4866
|
/** 0–59; `daily`, `weekdays`, `weekly`. Default 0. */
|
|
4726
|
-
minute:
|
|
4867
|
+
minute: z35.number().int().min(0).max(59).optional(),
|
|
4727
4868
|
/** ISO weekday, Monday = 1 … Sunday = 7; `weekly`. Default 1. */
|
|
4728
|
-
day:
|
|
4869
|
+
day: z35.number().int().min(1).max(7).optional(),
|
|
4729
4870
|
/** Hours between runs, from 00:00; `hours`. Default 6. */
|
|
4730
|
-
every:
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4871
|
+
every: z35.union([
|
|
4872
|
+
z35.literal(1),
|
|
4873
|
+
z35.literal(2),
|
|
4874
|
+
z35.literal(3),
|
|
4875
|
+
z35.literal(4),
|
|
4876
|
+
z35.literal(6),
|
|
4877
|
+
z35.literal(8),
|
|
4878
|
+
z35.literal(12)
|
|
4738
4879
|
]).optional(),
|
|
4739
4880
|
/** `once`: the local wall time `YYYY-MM-DDTHH:MM` in `timeZone`. */
|
|
4740
|
-
at:
|
|
4881
|
+
at: z35.string().regex(ONCE_AT_PATTERN, "at must be YYYY-MM-DDTHH:MM").optional(),
|
|
4741
4882
|
/** `once`: the IANA zone `at` is read in. Required there, refused on the repeating shapes. */
|
|
4742
|
-
timeZone:
|
|
4883
|
+
timeZone: z35.string().optional(),
|
|
4743
4884
|
/** `once`: how late after `at` a start may still launch. Absent = no limit. */
|
|
4744
|
-
latestStartMinutes:
|
|
4885
|
+
latestStartMinutes: z35.number().int().min(ONCE_MIN_LATEST_START_MINUTES).max(ONCE_MAX_LATEST_START_MINUTES).optional()
|
|
4745
4886
|
}).superRefine((schedule, ctx) => {
|
|
4746
4887
|
const present = (key) => schedule[key] !== void 0;
|
|
4747
4888
|
const refuse = (key, message2) => ctx.addIssue({ code: "custom", path: [key], message: message2 });
|
|
@@ -4906,108 +5047,108 @@ function nextOccurrence(schedule, afterMs, timeZone) {
|
|
|
4906
5047
|
}
|
|
4907
5048
|
|
|
4908
5049
|
// ../contract/src/automations.ts
|
|
4909
|
-
import { z as
|
|
4910
|
-
var automationEventSchema =
|
|
5050
|
+
import { z as z36 } from "zod";
|
|
5051
|
+
var automationEventSchema = z36.enum([
|
|
4911
5052
|
"pull_request.opened",
|
|
4912
5053
|
"issue.opened",
|
|
4913
5054
|
"issue.labeled",
|
|
4914
5055
|
"issue.unlabeled"
|
|
4915
5056
|
]);
|
|
4916
|
-
var automationFiltersSchema =
|
|
5057
|
+
var automationFiltersSchema = z36.object({
|
|
4917
5058
|
/** Opt in to matching events before enablement, bounded by lookbackDays. Absent means false. */
|
|
4918
|
-
includeExisting:
|
|
4919
|
-
authors:
|
|
4920
|
-
assignees:
|
|
5059
|
+
includeExisting: z36.boolean().optional(),
|
|
5060
|
+
authors: z36.array(z36.string()).optional(),
|
|
5061
|
+
assignees: z36.array(z36.string()).optional(),
|
|
4921
5062
|
/** Opt-in: require an open item and matching live labels before reservation and launch. */
|
|
4922
|
-
requireCurrentLabels:
|
|
4923
|
-
allLabels:
|
|
4924
|
-
anyLabels:
|
|
4925
|
-
excludeLabels:
|
|
5063
|
+
requireCurrentLabels: z36.boolean().optional(),
|
|
5064
|
+
allLabels: z36.array(z36.string()).optional(),
|
|
5065
|
+
anyLabels: z36.array(z36.string()).optional(),
|
|
5066
|
+
excludeLabels: z36.array(z36.string()).optional(),
|
|
4926
5067
|
/** Required for the two label events — the server rejects a definition without it. */
|
|
4927
|
-
changedLabels:
|
|
4928
|
-
lookbackDays:
|
|
4929
|
-
maxRecords:
|
|
5068
|
+
changedLabels: z36.array(z36.string()).optional(),
|
|
5069
|
+
lookbackDays: z36.number(),
|
|
5070
|
+
maxRecords: z36.number()
|
|
4930
5071
|
});
|
|
4931
|
-
var automationKindSchema =
|
|
5072
|
+
var automationKindSchema = z36.enum(["github", "schedule"]);
|
|
4932
5073
|
var automationTaskSchema = createRunInputBaseSchema.omit({ task: true, images: true, systemPrompt: true }).extend({
|
|
4933
5074
|
/** The prompt template. `{{github.number}}`, `{{github.title}}`, `{{github.url}}` and
|
|
4934
5075
|
* `{{github.labels}}` are substituted per match; GitHub content is appended as untrusted
|
|
4935
5076
|
* context, never interpolated into instructions. */
|
|
4936
|
-
prompt:
|
|
4937
|
-
variants:
|
|
4938
|
-
systemPrompt:
|
|
4939
|
-
});
|
|
4940
|
-
var automationArchiveSchema =
|
|
4941
|
-
at:
|
|
4942
|
-
outcome:
|
|
4943
|
-
runId:
|
|
4944
|
-
receiptId:
|
|
4945
|
-
trigger:
|
|
4946
|
-
});
|
|
4947
|
-
var automationDefinitionSchema =
|
|
4948
|
-
id:
|
|
5077
|
+
prompt: z36.string(),
|
|
5078
|
+
variants: z36.union([z36.literal(1), z36.literal(2), z36.literal(3)]).optional(),
|
|
5079
|
+
systemPrompt: z36.string().optional()
|
|
5080
|
+
});
|
|
5081
|
+
var automationArchiveSchema = z36.object({
|
|
5082
|
+
at: z36.string(),
|
|
5083
|
+
outcome: z36.enum(["launched", "cancelled"]),
|
|
5084
|
+
runId: z36.string().optional(),
|
|
5085
|
+
receiptId: z36.string().optional(),
|
|
5086
|
+
trigger: z36.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
5087
|
+
});
|
|
5088
|
+
var automationDefinitionSchema = z36.object({
|
|
5089
|
+
id: z36.string(),
|
|
4949
5090
|
/** Bumped on every edit; a PUT must echo the revision it read (optimistic concurrency). */
|
|
4950
|
-
revision:
|
|
4951
|
-
name:
|
|
4952
|
-
description:
|
|
5091
|
+
revision: z36.number(),
|
|
5092
|
+
name: z36.string(),
|
|
5093
|
+
description: z36.string().optional(),
|
|
4953
5094
|
/** Always present: the storage schema defaults it to `false`, so a definition is created
|
|
4954
5095
|
* PAUSED and enabling it is a separate, baseline-establishing act. */
|
|
4955
|
-
enabled:
|
|
5096
|
+
enabled: z36.boolean(),
|
|
4956
5097
|
kind: automationKindSchema,
|
|
4957
5098
|
/** `github` kind: always present. `schedule` kind: absent. */
|
|
4958
|
-
events:
|
|
4959
|
-
intervalSeconds:
|
|
5099
|
+
events: z36.array(automationEventSchema).optional(),
|
|
5100
|
+
intervalSeconds: z36.number().optional(),
|
|
4960
5101
|
filters: automationFiltersSchema.optional(),
|
|
4961
5102
|
/** `schedule` kind: always present. `github` kind: absent. */
|
|
4962
5103
|
schedule: automationScheduleSchema.optional(),
|
|
4963
5104
|
task: automationTaskSchema,
|
|
4964
5105
|
/** `once` schedules only: present once its task exists or it was cancelled. */
|
|
4965
5106
|
archived: automationArchiveSchema.optional(),
|
|
4966
|
-
createdAt:
|
|
4967
|
-
updatedAt:
|
|
4968
|
-
});
|
|
4969
|
-
var automationCursorSchema =
|
|
4970
|
-
timestamp:
|
|
4971
|
-
tieBreaker:
|
|
4972
|
-
});
|
|
4973
|
-
var automationHistoryScanSchema =
|
|
4974
|
-
since:
|
|
4975
|
-
until:
|
|
4976
|
-
source:
|
|
4977
|
-
page:
|
|
4978
|
-
item:
|
|
5107
|
+
createdAt: z36.string(),
|
|
5108
|
+
updatedAt: z36.string()
|
|
5109
|
+
});
|
|
5110
|
+
var automationCursorSchema = z36.object({
|
|
5111
|
+
timestamp: z36.string(),
|
|
5112
|
+
tieBreaker: z36.string().optional()
|
|
5113
|
+
});
|
|
5114
|
+
var automationHistoryScanSchema = z36.object({
|
|
5115
|
+
since: z36.string().datetime(),
|
|
5116
|
+
until: z36.string().datetime(),
|
|
5117
|
+
source: z36.number().int().min(0).max(2),
|
|
5118
|
+
page: z36.number().int().min(1).max(10),
|
|
5119
|
+
item: z36.number().int().min(0).max(100),
|
|
4979
5120
|
// One item can contain ten pages of 100 timeline entries, independent of the new-work cap.
|
|
4980
|
-
event:
|
|
5121
|
+
event: z36.number().int().min(0).max(1e3),
|
|
4981
5122
|
cursor: automationCursorSchema.optional()
|
|
4982
5123
|
});
|
|
4983
5124
|
var AUTOMATION_LAST_ERROR_MAX = 1e3;
|
|
4984
5125
|
var automationLastErrorShape = {
|
|
4985
|
-
lastError:
|
|
4986
|
-
lastErrorAt:
|
|
5126
|
+
lastError: z36.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
|
|
5127
|
+
lastErrorAt: z36.string().datetime().optional()
|
|
4987
5128
|
};
|
|
4988
|
-
var automationRuntimeStateSchema =
|
|
5129
|
+
var automationRuntimeStateSchema = z36.object({
|
|
4989
5130
|
/** The definition revision this state belongs to; activation or history-policy changes re-arm. */
|
|
4990
|
-
revision:
|
|
5131
|
+
revision: z36.number().optional(),
|
|
4991
5132
|
/** Earliest eligible event: enablement time, or the lookback start when includeExisting is on. */
|
|
4992
|
-
baselineAt:
|
|
5133
|
+
baselineAt: z36.string().optional(),
|
|
4993
5134
|
/** When discovery was armed, independent of the historical baseline. */
|
|
4994
|
-
armedAt:
|
|
5135
|
+
armedAt: z36.string().optional(),
|
|
4995
5136
|
historyScan: automationHistoryScanSchema.optional(),
|
|
4996
5137
|
cursor: automationCursorSchema.optional(),
|
|
4997
|
-
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker:
|
|
4998
|
-
backlogAfter: automationCursorSchema.extend({ tieBreaker:
|
|
4999
|
-
nextCheckAt:
|
|
5000
|
-
lastSuccessAt:
|
|
5138
|
+
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z36.string() }).optional(),
|
|
5139
|
+
backlogAfter: automationCursorSchema.extend({ tieBreaker: z36.string() }).optional(),
|
|
5140
|
+
nextCheckAt: z36.string().optional(),
|
|
5141
|
+
lastSuccessAt: z36.string().optional(),
|
|
5001
5142
|
/** `schedule` kind: the next occurrence's instant and the last fired one's. */
|
|
5002
|
-
nextRunAt:
|
|
5003
|
-
lastRunAt:
|
|
5143
|
+
nextRunAt: z36.string().optional(),
|
|
5144
|
+
lastRunAt: z36.string().optional(),
|
|
5004
5145
|
/** Per-query GitHub ETags, so an unchanged page costs no rate-limit budget. */
|
|
5005
|
-
etags:
|
|
5006
|
-
backoffUntil:
|
|
5007
|
-
consecutiveFailures:
|
|
5146
|
+
etags: z36.record(z36.string(), z36.string()).optional(),
|
|
5147
|
+
backoffUntil: z36.string().optional(),
|
|
5148
|
+
consecutiveFailures: z36.number().optional(),
|
|
5008
5149
|
...automationLastErrorShape,
|
|
5009
5150
|
/** `once` schedules: why it stopped without a task — its launch failed, or it started past its cutoff. */
|
|
5010
|
-
onceOutcome:
|
|
5151
|
+
onceOutcome: z36.enum(["failed", "missed"]).optional()
|
|
5011
5152
|
});
|
|
5012
5153
|
var AUTOMATION_FAILURE_NOTICE_AFTER = 3;
|
|
5013
5154
|
function automationFailureNotice(state) {
|
|
@@ -5020,7 +5161,7 @@ function automationFailureNotice(state) {
|
|
|
5020
5161
|
...state.backoffUntil ? { retryAt: state.backoffUntil } : {}
|
|
5021
5162
|
};
|
|
5022
5163
|
}
|
|
5023
|
-
var automationLogResultSchema =
|
|
5164
|
+
var automationLogResultSchema = z36.enum([
|
|
5024
5165
|
"launched",
|
|
5025
5166
|
"no-match",
|
|
5026
5167
|
"duplicate",
|
|
@@ -5036,36 +5177,36 @@ var automationLogResultSchema = z35.enum([
|
|
|
5036
5177
|
// once schedule: Squawk started after its latest start, so nothing launched.
|
|
5037
5178
|
"missed"
|
|
5038
5179
|
]);
|
|
5039
|
-
var automationLogRecordSchema =
|
|
5040
|
-
seq:
|
|
5041
|
-
ts:
|
|
5042
|
-
automationId:
|
|
5043
|
-
revision:
|
|
5180
|
+
var automationLogRecordSchema = z36.object({
|
|
5181
|
+
seq: z36.number(),
|
|
5182
|
+
ts: z36.string(),
|
|
5183
|
+
automationId: z36.string(),
|
|
5184
|
+
revision: z36.number(),
|
|
5044
5185
|
event: automationEventSchema.optional(),
|
|
5045
5186
|
result: automationLogResultSchema,
|
|
5046
|
-
reason:
|
|
5047
|
-
durationMs:
|
|
5048
|
-
receiptId:
|
|
5049
|
-
runId:
|
|
5050
|
-
githubNumber:
|
|
5051
|
-
githubTitle:
|
|
5052
|
-
githubUrl:
|
|
5053
|
-
rateLimit:
|
|
5054
|
-
bucket:
|
|
5055
|
-
remaining:
|
|
5056
|
-
resetAt:
|
|
5187
|
+
reason: z36.string().optional(),
|
|
5188
|
+
durationMs: z36.number().optional(),
|
|
5189
|
+
receiptId: z36.string().optional(),
|
|
5190
|
+
runId: z36.string().optional(),
|
|
5191
|
+
githubNumber: z36.number().optional(),
|
|
5192
|
+
githubTitle: z36.string().optional(),
|
|
5193
|
+
githubUrl: z36.string().optional(),
|
|
5194
|
+
rateLimit: z36.object({
|
|
5195
|
+
bucket: z36.enum(["core", "search"]),
|
|
5196
|
+
remaining: z36.number().optional(),
|
|
5197
|
+
resetAt: z36.string().optional()
|
|
5057
5198
|
}).optional()
|
|
5058
5199
|
});
|
|
5059
|
-
var automationCountsSchema =
|
|
5200
|
+
var automationCountsSchema = z36.object({
|
|
5060
5201
|
/** GitHub candidates that matched a filter: `launched` + `duplicate` rows. */
|
|
5061
|
-
matches:
|
|
5202
|
+
matches: z36.number(),
|
|
5062
5203
|
/** Stored tasks with this automation's provenance, including each variant, finished and archived
|
|
5063
5204
|
* tasks, across all revisions. Independent of log/receipt retention; deleting a task removes it. */
|
|
5064
|
-
launched:
|
|
5205
|
+
launched: z36.number(),
|
|
5065
5206
|
/** `duplicate` rows: a match whose receipt already existed, so nothing launched. */
|
|
5066
|
-
duplicates:
|
|
5207
|
+
duplicates: z36.number(),
|
|
5067
5208
|
/** `error` and `rate-limited` rows, plus a schedule's `failed` launches. */
|
|
5068
|
-
errors:
|
|
5209
|
+
errors: z36.number()
|
|
5069
5210
|
});
|
|
5070
5211
|
var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
5071
5212
|
state: automationRuntimeStateSchema.optional(),
|
|
@@ -5073,74 +5214,74 @@ var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
|
5073
5214
|
counts: automationCountsSchema,
|
|
5074
5215
|
/** Enabled only: a schedule's armed `state.nextRunAt`, a poll's `state.nextCheckAt`. Absent
|
|
5075
5216
|
* while paused, and for a schedule the timer has not armed yet. */
|
|
5076
|
-
nextRunAt:
|
|
5217
|
+
nextRunAt: z36.string().optional(),
|
|
5077
5218
|
/** `once` schedules only. */
|
|
5078
5219
|
onceStatus: onceStatusSchema.optional()
|
|
5079
5220
|
});
|
|
5080
|
-
var automationsResponseSchema =
|
|
5081
|
-
available:
|
|
5082
|
-
reason:
|
|
5083
|
-
timeZone:
|
|
5084
|
-
scheduler:
|
|
5085
|
-
state:
|
|
5086
|
-
nextDue:
|
|
5221
|
+
var automationsResponseSchema = z36.object({
|
|
5222
|
+
available: z36.boolean(),
|
|
5223
|
+
reason: z36.string().optional(),
|
|
5224
|
+
timeZone: z36.string(),
|
|
5225
|
+
scheduler: z36.object({
|
|
5226
|
+
state: z36.enum(["scheduled", "idle"]),
|
|
5227
|
+
nextDue: z36.string().optional()
|
|
5087
5228
|
}),
|
|
5088
|
-
automations:
|
|
5229
|
+
automations: z36.array(automationListEntrySchema)
|
|
5089
5230
|
});
|
|
5090
|
-
var automationResponseSchema =
|
|
5231
|
+
var automationResponseSchema = z36.object({ automation: automationDefinitionSchema });
|
|
5091
5232
|
var automationCreateResponseSchema = automationResponseSchema.extend({
|
|
5092
|
-
once:
|
|
5233
|
+
once: z36.object({ dueAt: z36.string(), timeZone: z36.string(), resolvedInstant: z36.string(), note: z36.string() }).optional()
|
|
5093
5234
|
});
|
|
5094
|
-
var automationDetailResponseSchema =
|
|
5235
|
+
var automationDetailResponseSchema = z36.object({
|
|
5095
5236
|
automation: automationDefinitionSchema,
|
|
5096
5237
|
state: automationRuntimeStateSchema.optional(),
|
|
5097
5238
|
latestLog: automationLogRecordSchema.optional(),
|
|
5098
5239
|
/** `once` schedules only. */
|
|
5099
5240
|
onceStatus: onceStatusSchema.optional()
|
|
5100
5241
|
});
|
|
5101
|
-
var automationCheckSchema =
|
|
5102
|
-
id:
|
|
5103
|
-
automationId:
|
|
5104
|
-
mode:
|
|
5105
|
-
status:
|
|
5106
|
-
createdAt:
|
|
5107
|
-
completedAt:
|
|
5108
|
-
matches:
|
|
5109
|
-
truncated:
|
|
5110
|
-
error:
|
|
5111
|
-
});
|
|
5112
|
-
var automationCheckQueuedResponseSchema =
|
|
5113
|
-
var automationLogResponseSchema =
|
|
5114
|
-
records:
|
|
5115
|
-
});
|
|
5116
|
-
var automationRetryResponseSchema =
|
|
5117
|
-
receiptId:
|
|
5118
|
-
runId:
|
|
5119
|
-
});
|
|
5120
|
-
var automationRunResponseSchema =
|
|
5242
|
+
var automationCheckSchema = z36.object({
|
|
5243
|
+
id: z36.string(),
|
|
5244
|
+
automationId: z36.string(),
|
|
5245
|
+
mode: z36.enum(["preview", "execute"]),
|
|
5246
|
+
status: z36.enum(["queued", "running", "complete", "error"]),
|
|
5247
|
+
createdAt: z36.string(),
|
|
5248
|
+
completedAt: z36.string().optional(),
|
|
5249
|
+
matches: z36.number().optional(),
|
|
5250
|
+
truncated: z36.boolean().optional(),
|
|
5251
|
+
error: z36.string().optional()
|
|
5252
|
+
});
|
|
5253
|
+
var automationCheckQueuedResponseSchema = z36.object({ checkId: z36.string() });
|
|
5254
|
+
var automationLogResponseSchema = z36.object({
|
|
5255
|
+
records: z36.array(automationLogRecordSchema)
|
|
5256
|
+
});
|
|
5257
|
+
var automationRetryResponseSchema = z36.object({
|
|
5258
|
+
receiptId: z36.string(),
|
|
5259
|
+
runId: z36.string()
|
|
5260
|
+
});
|
|
5261
|
+
var automationRunResponseSchema = z36.object({ runId: z36.string() });
|
|
5121
5262
|
var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true, kind: true, archived: true }).extend({
|
|
5122
5263
|
/** Omitted = `github` on create, the shape every pre-schedule client sends; omitted on
|
|
5123
5264
|
* update = the stored kind. */
|
|
5124
5265
|
kind: automationKindSchema.optional(),
|
|
5125
5266
|
task: automationTaskSchema.omit({ variants: true }).strict(),
|
|
5126
|
-
enable:
|
|
5267
|
+
enable: z36.boolean().optional()
|
|
5127
5268
|
});
|
|
5128
5269
|
var updateAutomationInputSchema = createAutomationInputSchema.omit({ enable: true }).extend({
|
|
5129
|
-
enabled:
|
|
5130
|
-
expectedRevision:
|
|
5270
|
+
enabled: z36.boolean().optional(),
|
|
5271
|
+
expectedRevision: z36.number()
|
|
5131
5272
|
});
|
|
5132
|
-
var automationListQuerySchema =
|
|
5133
|
-
archived:
|
|
5273
|
+
var automationListQuerySchema = z36.object({
|
|
5274
|
+
archived: z36.enum(["include", "only"]).optional()
|
|
5134
5275
|
});
|
|
5135
|
-
var automationCheckInputSchema =
|
|
5136
|
-
mode:
|
|
5276
|
+
var automationCheckInputSchema = z36.object({
|
|
5277
|
+
mode: z36.enum(["preview", "execute"])
|
|
5137
5278
|
});
|
|
5138
5279
|
|
|
5139
5280
|
// ../contract/src/scheduled-tasks.ts
|
|
5140
|
-
import { z as
|
|
5281
|
+
import { z as z37 } from "zod";
|
|
5141
5282
|
var SCHEDULED_TASK_LIMITS = { prompt: 1e5, list: 50, wireBytes: 1048576 };
|
|
5142
5283
|
var DURATION = /^(\d+)\s*([mhd])$/;
|
|
5143
|
-
var durationField =
|
|
5284
|
+
var durationField = z37.string().regex(DURATION, "a duration such as 30m, 6h or 7d");
|
|
5144
5285
|
function parseDurationMinutes(value) {
|
|
5145
5286
|
const match = DURATION.exec(value.trim());
|
|
5146
5287
|
if (!match) throw new Error(`"${value}" is not a duration; use 30m, 6h or 7d`);
|
|
@@ -5164,309 +5305,208 @@ function wallTimeAtOrAfter(targetMs, timeZone) {
|
|
|
5164
5305
|
var UTC_MINUTE_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})Z$/;
|
|
5165
5306
|
var utcMinute = (instantMs) => `${new Date(instantMs).toISOString().slice(0, 16)}Z`;
|
|
5166
5307
|
var scheduleFields = {
|
|
5167
|
-
at:
|
|
5308
|
+
at: z37.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(),
|
|
5168
5309
|
delay: durationField.optional(),
|
|
5169
5310
|
latest_start: durationField.optional(),
|
|
5170
|
-
workflow:
|
|
5171
|
-
runner:
|
|
5172
|
-
model:
|
|
5173
|
-
effort:
|
|
5311
|
+
workflow: z37.string().trim().min(1).max(200).optional(),
|
|
5312
|
+
runner: z37.string().trim().min(1).max(32).optional(),
|
|
5313
|
+
model: z37.string().trim().min(1).max(200).optional(),
|
|
5314
|
+
effort: z37.string().trim().min(1).max(32).optional(),
|
|
5174
5315
|
/** `false` lets the task ask the user (`cezar_ask`) and wait for the answer. A create defaults to `true`. */
|
|
5175
|
-
autonomous:
|
|
5316
|
+
autonomous: z37.boolean().optional()
|
|
5176
5317
|
};
|
|
5177
5318
|
var notBoth = (value) => !(value.at && value.delay);
|
|
5178
|
-
var scheduleTaskRequestSchema =
|
|
5179
|
-
name:
|
|
5180
|
-
prompt:
|
|
5319
|
+
var scheduleTaskRequestSchema = z37.object({
|
|
5320
|
+
name: z37.string().trim().min(1).max(200),
|
|
5321
|
+
prompt: z37.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt),
|
|
5181
5322
|
...scheduleFields,
|
|
5182
|
-
enable:
|
|
5323
|
+
enable: z37.boolean().optional()
|
|
5183
5324
|
}).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"] });
|
|
5184
|
-
var idField =
|
|
5185
|
-
var scheduledTasksRequestSchema =
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
action:
|
|
5325
|
+
var idField = z37.string().min(1).max(100);
|
|
5326
|
+
var scheduledTasksRequestSchema = z37.discriminatedUnion("action", [
|
|
5327
|
+
z37.object({ action: z37.literal("list"), archived: z37.enum(["include", "only"]).optional() }).strict(),
|
|
5328
|
+
z37.object({ action: z37.literal("show"), id: idField }).strict(),
|
|
5329
|
+
z37.object({
|
|
5330
|
+
action: z37.literal("update"),
|
|
5190
5331
|
id: idField,
|
|
5191
|
-
name:
|
|
5192
|
-
prompt:
|
|
5332
|
+
name: z37.string().trim().min(1).max(200).optional(),
|
|
5333
|
+
prompt: z37.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt).optional(),
|
|
5193
5334
|
...scheduleFields
|
|
5194
5335
|
}).strict().refine(notBoth, { message: "give at or delay, not both", path: ["delay"] }),
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5336
|
+
z37.object({ action: z37.literal("pause"), id: idField }).strict(),
|
|
5337
|
+
z37.object({ action: z37.literal("enable"), id: idField }).strict(),
|
|
5338
|
+
z37.object({ action: z37.literal("cancel"), id: idField }).strict()
|
|
5198
5339
|
]);
|
|
5199
|
-
var scheduledTaskSchema =
|
|
5200
|
-
id:
|
|
5201
|
-
name:
|
|
5340
|
+
var scheduledTaskSchema = z37.object({
|
|
5341
|
+
id: z37.string(),
|
|
5342
|
+
name: z37.string(),
|
|
5202
5343
|
status: onceStatusSchema,
|
|
5203
5344
|
/** When it is due, in UTC: `YYYY-MM-DDTHH:MMZ`, the form `at` takes. */
|
|
5204
|
-
due_at:
|
|
5205
|
-
latest_start_minutes:
|
|
5345
|
+
due_at: z37.string(),
|
|
5346
|
+
latest_start_minutes: z37.number().optional(),
|
|
5206
5347
|
/** Whether the launched task runs autonomous: it never waits for the user's answer. */
|
|
5207
|
-
autonomous:
|
|
5348
|
+
autonomous: z37.boolean(),
|
|
5208
5349
|
/** The task it launched, once archived with one. */
|
|
5209
|
-
run_id:
|
|
5350
|
+
run_id: z37.string().optional(),
|
|
5210
5351
|
/** The cockpit page of the schedule, when the cockpit's address is known. */
|
|
5211
|
-
url:
|
|
5352
|
+
url: z37.string().optional()
|
|
5212
5353
|
});
|
|
5213
|
-
var scheduledTaskRefusalCodeSchema =
|
|
5214
|
-
var refusal =
|
|
5354
|
+
var scheduledTaskRefusalCodeSchema = z37.enum(["invalid_request", "unavailable", "not_found", "conflict", "automations_off"]);
|
|
5355
|
+
var refusal = z37.object({ ok: z37.literal(false), code: scheduledTaskRefusalCodeSchema, message: z37.string() });
|
|
5215
5356
|
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.";
|
|
5216
|
-
var scheduleTaskAnswerSchema =
|
|
5217
|
-
|
|
5357
|
+
var scheduleTaskAnswerSchema = z37.union([
|
|
5358
|
+
z37.object({ ok: z37.literal(true), task: scheduledTaskSchema, note: z37.string() }),
|
|
5218
5359
|
refusal
|
|
5219
5360
|
]);
|
|
5220
|
-
var scheduledTasksAnswerSchema =
|
|
5221
|
-
|
|
5222
|
-
|
|
5361
|
+
var scheduledTasksAnswerSchema = z37.union([
|
|
5362
|
+
z37.object({ ok: z37.literal(true), tasks: z37.array(scheduledTaskSchema).max(SCHEDULED_TASK_LIMITS.list) }),
|
|
5363
|
+
z37.object({ ok: z37.literal(true), task: scheduledTaskSchema }),
|
|
5223
5364
|
refusal
|
|
5224
5365
|
]);
|
|
5225
5366
|
|
|
5226
5367
|
// ../contract/src/wait-tools.ts
|
|
5227
|
-
import { z as
|
|
5228
|
-
var pidSchema2 =
|
|
5368
|
+
import { z as z38 } from "zod";
|
|
5369
|
+
var pidSchema2 = z38.number().int().min(PID_MIN);
|
|
5229
5370
|
var oneModeTakesOneId = (ids, mode, ctx) => {
|
|
5230
5371
|
if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
|
|
5231
5372
|
};
|
|
5232
|
-
var waitTimeoutSeconds =
|
|
5233
|
-
var registrationFields = { operation_id:
|
|
5234
|
-
var builtInSquawkWaitRequestSchema =
|
|
5235
|
-
ciWaitRequestSchema.extend({ kind:
|
|
5236
|
-
|
|
5237
|
-
kind:
|
|
5373
|
+
var waitTimeoutSeconds = z38.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
|
|
5374
|
+
var registrationFields = { operation_id: z38.uuid().optional() };
|
|
5375
|
+
var builtInSquawkWaitRequestSchema = z38.discriminatedUnion("kind", [
|
|
5376
|
+
ciWaitRequestSchema.extend({ kind: z38.literal("pr"), ...registrationFields }).strict(),
|
|
5377
|
+
z38.object({
|
|
5378
|
+
kind: z38.literal("worker"),
|
|
5238
5379
|
...registrationFields,
|
|
5239
5380
|
worker_ids: workerIdsSchema,
|
|
5240
5381
|
mode: workerWaitModeSchema.optional(),
|
|
5241
5382
|
timeout_seconds: waitTimeoutSeconds
|
|
5242
5383
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
|
|
5243
|
-
|
|
5244
|
-
kind:
|
|
5384
|
+
z38.object({
|
|
5385
|
+
kind: z38.literal("request"),
|
|
5245
5386
|
...registrationFields,
|
|
5246
5387
|
request_ids: workerIdsSchema,
|
|
5247
5388
|
mode: workerWaitModeSchema.optional(),
|
|
5248
5389
|
timeout_seconds: waitTimeoutSeconds
|
|
5249
5390
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
|
|
5250
|
-
|
|
5251
|
-
kind:
|
|
5391
|
+
z38.object({
|
|
5392
|
+
kind: z38.literal("peer"),
|
|
5252
5393
|
...registrationFields,
|
|
5253
5394
|
peer_ids: workerIdsSchema,
|
|
5254
5395
|
timeout_seconds: waitTimeoutSeconds
|
|
5255
5396
|
}).strict(),
|
|
5256
|
-
|
|
5257
|
-
kind:
|
|
5397
|
+
z38.object({
|
|
5398
|
+
kind: z38.literal("timer"),
|
|
5258
5399
|
...registrationFields,
|
|
5259
|
-
seconds:
|
|
5260
|
-
note:
|
|
5400
|
+
seconds: z38.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
5401
|
+
note: z38.string().max(NOTE_MAX).optional()
|
|
5261
5402
|
}).strict(),
|
|
5262
|
-
|
|
5263
|
-
kind:
|
|
5403
|
+
z38.object({
|
|
5404
|
+
kind: z38.literal("process"),
|
|
5264
5405
|
...registrationFields,
|
|
5265
5406
|
pid: pidSchema2,
|
|
5266
|
-
exit_file:
|
|
5267
|
-
timeout_seconds:
|
|
5268
|
-
note:
|
|
5407
|
+
exit_file: z38.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
5408
|
+
timeout_seconds: z38.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
|
|
5409
|
+
note: z38.string().max(NOTE_MAX).optional()
|
|
5269
5410
|
}).strict()
|
|
5270
5411
|
]);
|
|
5271
5412
|
var builtInRequestKinds = /* @__PURE__ */ new Set(["pr", "worker", "request", "peer", "timer", "process"]);
|
|
5272
|
-
var pluginWaitRequestSchema =
|
|
5273
|
-
kind:
|
|
5413
|
+
var pluginWaitRequestSchema = z38.object({
|
|
5414
|
+
kind: z38.string().min(1).max(64),
|
|
5274
5415
|
...registrationFields
|
|
5275
|
-
}).catchall(
|
|
5276
|
-
var waitRequestInputSchema =
|
|
5277
|
-
var squawkWaitRequestSchema =
|
|
5416
|
+
}).catchall(z38.unknown()).refine((request) => !builtInRequestKinds.has(request.kind), { path: ["kind"], message: "built-in wait kinds require their built-in request shape" });
|
|
5417
|
+
var waitRequestInputSchema = z38.union([builtInSquawkWaitRequestSchema, pluginWaitRequestSchema]);
|
|
5418
|
+
var squawkWaitRequestSchema = z38.custom().transform((request, ctx) => {
|
|
5278
5419
|
const kind = request && typeof request === "object" && "kind" in request ? request.kind : void 0;
|
|
5279
5420
|
const schema = typeof kind === "string" && builtInRequestKinds.has(kind) ? builtInSquawkWaitRequestSchema : pluginWaitRequestSchema;
|
|
5280
5421
|
const parsed = schema.safeParse(request);
|
|
5281
5422
|
if (!parsed.success) {
|
|
5282
5423
|
for (const issue of parsed.error.issues) ctx.addIssue({ ...issue });
|
|
5283
|
-
return
|
|
5424
|
+
return z38.NEVER;
|
|
5284
5425
|
}
|
|
5285
5426
|
return parsed.data;
|
|
5286
5427
|
});
|
|
5287
|
-
var squawkCancelWaitRequestSchema =
|
|
5288
|
-
var message =
|
|
5428
|
+
var squawkCancelWaitRequestSchema = z38.object({ wait_id: z38.uuid() }).strict();
|
|
5429
|
+
var message = z38.string().max(WAIT_MESSAGE_MAX);
|
|
5289
5430
|
var registrationAnswerFields = {
|
|
5290
|
-
operation_id:
|
|
5431
|
+
operation_id: z38.uuid().optional()
|
|
5291
5432
|
};
|
|
5292
|
-
var squawkWaitAnswerSchema =
|
|
5293
|
-
|
|
5294
|
-
ok:
|
|
5433
|
+
var squawkWaitAnswerSchema = z38.discriminatedUnion("ok", [
|
|
5434
|
+
z38.object({
|
|
5435
|
+
ok: z38.literal(true),
|
|
5295
5436
|
...registrationAnswerFields,
|
|
5296
|
-
effect:
|
|
5297
|
-
deduplicated:
|
|
5298
|
-
replayed:
|
|
5299
|
-
wait_phase:
|
|
5300
|
-
wait_id:
|
|
5437
|
+
effect: z38.enum(["applied", "unchanged"]).optional(),
|
|
5438
|
+
deduplicated: z38.boolean().optional(),
|
|
5439
|
+
replayed: z38.boolean().optional(),
|
|
5440
|
+
wait_phase: z38.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
|
|
5441
|
+
wait_id: z38.uuid(),
|
|
5301
5442
|
/** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
|
|
5302
|
-
kind:
|
|
5303
|
-
deadline:
|
|
5304
|
-
open_waits:
|
|
5443
|
+
kind: z38.string().min(1).max(64),
|
|
5444
|
+
deadline: z38.iso.datetime().optional(),
|
|
5445
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT)
|
|
5305
5446
|
}).strict().superRefine((answer, ctx) => {
|
|
5306
5447
|
if (builtInRequestKinds.has(answer.kind) && answer.deadline === void 0) {
|
|
5307
5448
|
ctx.addIssue({ code: "invalid_type", expected: "string", path: ["deadline"], message: "Invalid input: expected string, received undefined" });
|
|
5308
5449
|
}
|
|
5309
5450
|
}),
|
|
5310
|
-
|
|
5311
|
-
ok:
|
|
5451
|
+
z38.object({
|
|
5452
|
+
ok: z38.literal(false),
|
|
5312
5453
|
...registrationAnswerFields,
|
|
5313
|
-
effect:
|
|
5454
|
+
effect: z38.enum(["refused", "unknown"]).optional(),
|
|
5314
5455
|
retained_wait: openWaitSchema.optional(),
|
|
5315
5456
|
code: waitErrorCodeSchema,
|
|
5316
5457
|
message,
|
|
5317
|
-
open_waits:
|
|
5458
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
5318
5459
|
}).strict()
|
|
5319
5460
|
]);
|
|
5320
5461
|
var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
|
|
5321
|
-
var squawkAskAnswerSchema =
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
ok:
|
|
5462
|
+
var squawkAskAnswerSchema = z38.discriminatedUnion("ok", [
|
|
5463
|
+
z38.object({ ok: z38.literal(true), wait_id: z38.uuid(), open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
5464
|
+
z38.object({
|
|
5465
|
+
ok: z38.literal(false),
|
|
5325
5466
|
code: askErrorCodeSchema,
|
|
5326
5467
|
message,
|
|
5327
|
-
open_waits:
|
|
5468
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
5328
5469
|
}).strict()
|
|
5329
5470
|
]);
|
|
5330
|
-
var squawkCancelWaitAnswerSchema =
|
|
5331
|
-
|
|
5332
|
-
cancelled:
|
|
5333
|
-
wait_id:
|
|
5334
|
-
open_waits:
|
|
5471
|
+
var squawkCancelWaitAnswerSchema = z38.discriminatedUnion("cancelled", [
|
|
5472
|
+
z38.object({
|
|
5473
|
+
cancelled: z38.literal(true),
|
|
5474
|
+
wait_id: z38.uuid(),
|
|
5475
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT)
|
|
5335
5476
|
}).strict(),
|
|
5336
|
-
|
|
5337
|
-
cancelled:
|
|
5338
|
-
code:
|
|
5477
|
+
z38.object({
|
|
5478
|
+
cancelled: z38.literal(false),
|
|
5479
|
+
code: z38.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
|
|
5339
5480
|
message,
|
|
5340
|
-
open_waits:
|
|
5481
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
5341
5482
|
}).strict()
|
|
5342
5483
|
]);
|
|
5343
|
-
var squawkDoneRequestSchema =
|
|
5484
|
+
var squawkDoneRequestSchema = z38.object({ summary: z38.string().max(2e3).optional() }).strict();
|
|
5344
5485
|
var doneAccepted = {
|
|
5345
|
-
ok:
|
|
5346
|
-
finishes:
|
|
5347
|
-
open_waits:
|
|
5486
|
+
ok: z38.literal(true),
|
|
5487
|
+
finishes: z38.literal("at_turn_end"),
|
|
5488
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT)
|
|
5348
5489
|
};
|
|
5349
|
-
var squawkDoneAnswerSchema =
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5490
|
+
var squawkDoneAnswerSchema = z38.discriminatedUnion("ok", [
|
|
5491
|
+
z38.discriminatedUnion("completes", [
|
|
5492
|
+
z38.object({ ...doneAccepted, completes: z38.literal("task") }).strict(),
|
|
5493
|
+
z38.object({ ...doneAccepted, completes: z38.literal("step"), next_step: z38.string().min(1) }).strict()
|
|
5353
5494
|
]),
|
|
5354
|
-
|
|
5355
|
-
ok:
|
|
5495
|
+
z38.object({
|
|
5496
|
+
ok: z38.literal(false),
|
|
5356
5497
|
code: doneErrorCodeSchema,
|
|
5357
5498
|
message,
|
|
5358
5499
|
/** The workers that block the finish, and why each one does. */
|
|
5359
|
-
workers:
|
|
5360
|
-
worker_id:
|
|
5361
|
-
reason:
|
|
5500
|
+
workers: z38.array(z38.object({
|
|
5501
|
+
worker_id: z38.string(),
|
|
5502
|
+
reason: z38.enum(["outstanding", "uncollected", "question"])
|
|
5362
5503
|
}).strict()).max(64).optional(),
|
|
5363
|
-
open_waits:
|
|
5504
|
+
open_waits: z38.array(openWaitSchema).max(WAIT_LIMIT).optional(),
|
|
5364
5505
|
/** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
|
|
5365
|
-
owed:
|
|
5506
|
+
owed: z38.array(doneOwedInputSchema).max(64).optional()
|
|
5366
5507
|
}).strict()
|
|
5367
5508
|
]);
|
|
5368
5509
|
|
|
5369
|
-
// ../contract/src/run-predicates.ts
|
|
5370
|
-
function latestSessionStep(steps, except) {
|
|
5371
|
-
let latest;
|
|
5372
|
-
for (const step of steps) {
|
|
5373
|
-
if (!step.sessionId || step.id === except) continue;
|
|
5374
|
-
if (!latest || !step.startedAt || !latest.startedAt || step.startedAt >= latest.startedAt) latest = step;
|
|
5375
|
-
}
|
|
5376
|
-
return latest;
|
|
5377
|
-
}
|
|
5378
|
-
function sessionRunner(step, run) {
|
|
5379
|
-
return step?.backend ?? run?.runner ?? "claude";
|
|
5380
|
-
}
|
|
5381
|
-
function removedRunnerStepAfter(steps, sessionId) {
|
|
5382
|
-
let latest;
|
|
5383
|
-
for (const step of steps) {
|
|
5384
|
-
if (step.removedBackend === void 0 && (sessionId === void 0 || step.sessionId !== sessionId)) continue;
|
|
5385
|
-
if (!latest || !step.startedAt || !latest.startedAt || step.startedAt >= latest.startedAt) latest = step;
|
|
5386
|
-
}
|
|
5387
|
-
return latest?.removedBackend !== void 0 ? latest : void 0;
|
|
5388
|
-
}
|
|
5389
|
-
function latestSession(run) {
|
|
5390
|
-
const latest = latestSessionStep(run.steps);
|
|
5391
|
-
const step = removedRunnerStepAfter(run.steps, latest?.sessionId) ? void 0 : latest;
|
|
5392
|
-
return { sessionId: step?.sessionId, backend: sessionRunner(step, run), profileId: step?.profileId };
|
|
5393
|
-
}
|
|
5394
|
-
function isAgentWorkflowStep(step) {
|
|
5395
|
-
return step.command === void 0 && step.kind !== "plugin";
|
|
5396
|
-
}
|
|
5397
|
-
function workerContinuationStepId(run) {
|
|
5398
|
-
const cursorId = run.workflowCursor?.mode === "resume" ? run.workflowCursor.stepId : void 0;
|
|
5399
|
-
if (cursorId && run.steps.find((step) => step.id === cursorId)?.status === "failed") return cursorId;
|
|
5400
|
-
const session = latestSessionStep(run.steps);
|
|
5401
|
-
if (!session) return void 0;
|
|
5402
|
-
if (session.synthetic === "continuation" && session.continuesStepId !== void 0) return session.continuesStepId;
|
|
5403
|
-
return run.steps.find((step) => step.sessionId === session.sessionId)?.id ?? session.id;
|
|
5404
|
-
}
|
|
5405
|
-
function workerContinuationStep(run, untouched = false) {
|
|
5406
|
-
if (run.delegation?.role !== "worker") return void 0;
|
|
5407
|
-
const steps = run.workflowDef?.steps;
|
|
5408
|
-
if (!steps?.length) return void 0;
|
|
5409
|
-
if (untouched) return steps.find(isAgentWorkflowStep);
|
|
5410
|
-
const targetId = workerContinuationStepId(run);
|
|
5411
|
-
const targeted = targetId ? steps.find((step) => step.id === targetId && isAgentWorkflowStep(step)) : void 0;
|
|
5412
|
-
return targeted ?? [...steps].reverse().find(isAgentWorkflowStep);
|
|
5413
|
-
}
|
|
5414
|
-
var LIVE_STATUSES = /* @__PURE__ */ new Set(["queued", "running", "waiting"]);
|
|
5415
|
-
function isLiveStatus(status) {
|
|
5416
|
-
return LIVE_STATUSES.has(status);
|
|
5417
|
-
}
|
|
5418
|
-
function engineOwnsRun(run) {
|
|
5419
|
-
if (isUsageLimitHold(run)) return false;
|
|
5420
|
-
return run.status === "queued" || run.status === "running" || run.status === "waiting";
|
|
5421
|
-
}
|
|
5422
|
-
function isSessionOpen(run) {
|
|
5423
|
-
return engineOwnsRun(run) && run.status !== "queued";
|
|
5424
|
-
}
|
|
5425
|
-
function isSweepable(run, scope, automation) {
|
|
5426
|
-
if (run.archived || !(run.status === "done" || run.status === "failed" || run.status === "cancelled")) return false;
|
|
5427
|
-
if (run.delegation?.role === "worker") return false;
|
|
5428
|
-
if (automation !== void 0 && isAutomationTask(run) !== automation) return false;
|
|
5429
|
-
if (scope === "unpinned") return !run.pinned;
|
|
5430
|
-
if (scope === "pinned") return run.pinned === true;
|
|
5431
|
-
return true;
|
|
5432
|
-
}
|
|
5433
|
-
var UNREAD_ELIGIBLE = ["done", "failed"];
|
|
5434
|
-
function canBeUnread(run) {
|
|
5435
|
-
if (run.archived) return false;
|
|
5436
|
-
if (isUsageLimitHold(run)) return false;
|
|
5437
|
-
if (!UNREAD_ELIGIBLE.includes(run.status)) return false;
|
|
5438
|
-
return run.finishedAt !== void 0;
|
|
5439
|
-
}
|
|
5440
|
-
function isUnread(run) {
|
|
5441
|
-
const finishedAt = run.finishedAt;
|
|
5442
|
-
if (finishedAt === void 0) return false;
|
|
5443
|
-
if (!canBeUnread(run)) return false;
|
|
5444
|
-
return run.seenAt === void 0 || run.seenAt < finishedAt;
|
|
5445
|
-
}
|
|
5446
|
-
function isRetentionCandidate(run) {
|
|
5447
|
-
const settled = run.status === "done" || run.status === "failed" || run.status === "cancelled";
|
|
5448
|
-
return settled && (!run.delegation || run.delegation.role === "root") && !run.pinned;
|
|
5449
|
-
}
|
|
5450
|
-
function hasReferencedRun(run) {
|
|
5451
|
-
return run.referencedPullRequestUrl !== void 0 || run.referencedIssueUrl !== void 0;
|
|
5452
|
-
}
|
|
5453
|
-
var UNREAD_RUN_RULE = {
|
|
5454
|
-
sql: "archived = 0 AND status IN ('done', 'failed') AND finished_at IS NOT NULL AND (json_extract(summary, '$.seenAt') IS NULL OR json_extract(summary, '$.seenAt') < finished_at)",
|
|
5455
|
-
matches: isUnread
|
|
5456
|
-
};
|
|
5457
|
-
var SWEEPABLE_RUN_RULE = {
|
|
5458
|
-
sql: "archived = 0 AND status IN ('done', 'failed', 'cancelled') AND parent_run_id IS NULL",
|
|
5459
|
-
matches: isSweepable
|
|
5460
|
-
};
|
|
5461
|
-
var RETENTION_RUN_RULE = {
|
|
5462
|
-
sql: "id IN (SELECT value FROM json_each(?)) AND status IN ('done', 'failed', 'cancelled') AND parent_run_id IS NULL AND json_extract(summary, '$.delegation.role') IS NOT 'worker' AND json_extract(summary, '$.delegation.role') IS NOT 'invalid' AND json_extract(summary, '$.pinned') IS NOT 1",
|
|
5463
|
-
matches: isRetentionCandidate
|
|
5464
|
-
};
|
|
5465
|
-
var REFERENCED_RUN_RULE = {
|
|
5466
|
-
sql: "json_extract(summary, '$.referencedPullRequestUrl') IS NOT NULL OR json_extract(summary, '$.referencedIssueUrl') IS NOT NULL",
|
|
5467
|
-
matches: hasReferencedRun
|
|
5468
|
-
};
|
|
5469
|
-
|
|
5470
5510
|
// ../contract/src/run-search.ts
|
|
5471
5511
|
function refNumberFromUrl(url) {
|
|
5472
5512
|
const last = /\/(\d+)\/?$/.exec(url.trim());
|
|
@@ -5565,75 +5605,75 @@ function sqlPrefilterTokens(query, options = {}) {
|
|
|
5565
5605
|
}
|
|
5566
5606
|
|
|
5567
5607
|
// ../contract/src/artifacts.ts
|
|
5568
|
-
import { z as
|
|
5569
|
-
var pathSchema =
|
|
5570
|
-
var publishedArtifactSchema =
|
|
5571
|
-
id:
|
|
5572
|
-
runId:
|
|
5573
|
-
name:
|
|
5574
|
-
title:
|
|
5608
|
+
import { z as z39 } from "zod";
|
|
5609
|
+
var pathSchema = z39.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
|
|
5610
|
+
var publishedArtifactSchema = z39.object({
|
|
5611
|
+
id: z39.uuid(),
|
|
5612
|
+
runId: z39.uuid(),
|
|
5613
|
+
name: z39.string().min(1).max(255),
|
|
5614
|
+
title: z39.string().max(200).optional(),
|
|
5575
5615
|
sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
|
|
5576
|
-
createdAt:
|
|
5577
|
-
size:
|
|
5578
|
-
sha256:
|
|
5616
|
+
createdAt: z39.iso.datetime(),
|
|
5617
|
+
size: z39.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5618
|
+
sha256: z39.string().regex(/^[a-f0-9]{64}$/)
|
|
5579
5619
|
}).strict();
|
|
5580
|
-
var filePreviewDataSchema =
|
|
5581
|
-
type:
|
|
5620
|
+
var filePreviewDataSchema = z39.object({
|
|
5621
|
+
type: z39.literal("file"),
|
|
5582
5622
|
path: pathSchema,
|
|
5583
|
-
size:
|
|
5584
|
-
binary:
|
|
5585
|
-
tooLarge:
|
|
5586
|
-
content:
|
|
5587
|
-
source:
|
|
5623
|
+
size: z39.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5624
|
+
binary: z39.boolean(),
|
|
5625
|
+
tooLarge: z39.boolean(),
|
|
5626
|
+
content: z39.string().optional(),
|
|
5627
|
+
source: z39.enum(["worktree", "project", "artifact"]),
|
|
5588
5628
|
artifact: publishedArtifactSchema.optional()
|
|
5589
5629
|
}).strict();
|
|
5590
|
-
var fileLinkResultSchema =
|
|
5630
|
+
var fileLinkResultSchema = z39.union([
|
|
5591
5631
|
filePreviewDataSchema,
|
|
5592
|
-
|
|
5593
|
-
type:
|
|
5632
|
+
z39.object({
|
|
5633
|
+
type: z39.enum(["unavailable", "unpublished"]),
|
|
5594
5634
|
path: pathSchema,
|
|
5595
|
-
reason:
|
|
5635
|
+
reason: z39.string().min(1).max(4096)
|
|
5596
5636
|
}).strict()
|
|
5597
5637
|
]);
|
|
5598
|
-
var artifactMetadataResponseSchema =
|
|
5599
|
-
var artifactListSchema =
|
|
5600
|
-
var fileLinkQuerySchema =
|
|
5601
|
-
var artifactParamsSchema =
|
|
5638
|
+
var artifactMetadataResponseSchema = z39.object({ artifact: publishedArtifactSchema }).strict();
|
|
5639
|
+
var artifactListSchema = z39.object({ artifacts: z39.array(publishedArtifactSchema).max(64) }).strict();
|
|
5640
|
+
var fileLinkQuerySchema = z39.object({ path: pathSchema, raw: z39.literal("1").optional() }).strict();
|
|
5641
|
+
var artifactParamsSchema = z39.object({ id: z39.uuid(), artifactId: z39.uuid() });
|
|
5602
5642
|
|
|
5603
5643
|
// ../contract/src/discovery.ts
|
|
5604
|
-
import { z as
|
|
5605
|
-
var hostDiscoveryRequestSchema =
|
|
5606
|
-
|
|
5607
|
-
|
|
5644
|
+
import { z as z40 } from "zod";
|
|
5645
|
+
var hostDiscoveryRequestSchema = z40.discriminatedUnion("kind", [
|
|
5646
|
+
z40.object({ kind: z40.literal("runners") }).strict(),
|
|
5647
|
+
z40.object({ kind: z40.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
|
|
5608
5648
|
]);
|
|
5609
|
-
var discoveryRequestSchema =
|
|
5649
|
+
var discoveryRequestSchema = z40.discriminatedUnion("kind", [
|
|
5610
5650
|
...hostDiscoveryRequestSchema.options,
|
|
5611
|
-
|
|
5651
|
+
z40.object({ kind: z40.literal("tasks"), all: z40.boolean().optional(), offset: z40.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
|
|
5612
5652
|
]);
|
|
5613
5653
|
var discoveredRunnerSchema = providerStatusSchema.omit({ provider: true, profileId: true }).extend({ runner: modelDiscoveryRunnerSchema });
|
|
5614
|
-
var discoveredRunnersSchema =
|
|
5615
|
-
scope:
|
|
5616
|
-
runners:
|
|
5617
|
-
});
|
|
5618
|
-
var discoveredTasksSchema =
|
|
5619
|
-
tasks:
|
|
5620
|
-
id:
|
|
5621
|
-
title:
|
|
5654
|
+
var discoveredRunnersSchema = z40.object({
|
|
5655
|
+
scope: z40.literal("host-default-account"),
|
|
5656
|
+
runners: z40.array(discoveredRunnerSchema)
|
|
5657
|
+
});
|
|
5658
|
+
var discoveredTasksSchema = z40.object({
|
|
5659
|
+
tasks: z40.array(z40.object({
|
|
5660
|
+
id: z40.string(),
|
|
5661
|
+
title: z40.string(),
|
|
5622
5662
|
runner: runnerSchema.optional(),
|
|
5623
5663
|
status: runStatusSchema,
|
|
5624
|
-
attention:
|
|
5625
|
-
attentionLabel:
|
|
5626
|
-
accepts:
|
|
5627
|
-
reason:
|
|
5664
|
+
attention: z40.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
|
|
5665
|
+
attentionLabel: z40.string(),
|
|
5666
|
+
accepts: z40.boolean(),
|
|
5667
|
+
reason: z40.string().optional()
|
|
5628
5668
|
})).max(32),
|
|
5629
|
-
nextOffset:
|
|
5669
|
+
nextOffset: z40.number().int().nonnegative().optional(),
|
|
5630
5670
|
/** The caller's own family ledger load; no recipient inbox. */
|
|
5631
5671
|
capacity: conversationCapacitySchema.optional()
|
|
5632
5672
|
});
|
|
5633
|
-
var discoveryResponseSchema =
|
|
5673
|
+
var discoveryResponseSchema = z40.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
|
|
5634
5674
|
|
|
5635
5675
|
// ../contract/src/live.ts
|
|
5636
|
-
import { z as
|
|
5676
|
+
import { z as z41 } from "zod";
|
|
5637
5677
|
|
|
5638
5678
|
// ../contract/src/live-limits.ts
|
|
5639
5679
|
var LIVE_RUN_LIMIT = 32;
|
|
@@ -5641,46 +5681,46 @@ var LIVE_EVENT_LIMIT = 256;
|
|
|
5641
5681
|
var LIVE_BYTE_LIMIT = 1024 * 1024;
|
|
5642
5682
|
|
|
5643
5683
|
// ../contract/src/live.ts
|
|
5644
|
-
var liveRunDemandSchema =
|
|
5645
|
-
projectId:
|
|
5684
|
+
var liveRunDemandSchema = z41.object({
|
|
5685
|
+
projectId: z41.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
|
|
5646
5686
|
runId: runIdParamSchema.shape.id,
|
|
5647
5687
|
cursor: runHistoryCursorSchema.optional(),
|
|
5648
|
-
afterSeq:
|
|
5688
|
+
afterSeq: z41.number().int().nonnegative().safe()
|
|
5649
5689
|
});
|
|
5650
|
-
var liveRunsRequestSchema =
|
|
5651
|
-
runs:
|
|
5690
|
+
var liveRunsRequestSchema = z41.object({
|
|
5691
|
+
runs: z41.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
|
|
5652
5692
|
}).refine(({ runs }) => new Set(runs.map((r) => `${r.projectId}/${r.runId}`)).size === runs.length, {
|
|
5653
5693
|
message: "duplicate run demand"
|
|
5654
5694
|
});
|
|
5655
5695
|
var identity = liveRunDemandSchema.pick({ projectId: true, runId: true });
|
|
5656
5696
|
var liveRunErrorSchema = identity.extend({
|
|
5657
|
-
type:
|
|
5658
|
-
status:
|
|
5659
|
-
error:
|
|
5697
|
+
type: z41.enum(["error", "reset"]),
|
|
5698
|
+
status: z41.union([z41.literal(400), z41.literal(404), z41.literal(409), z41.literal(413), z41.literal(503)]),
|
|
5699
|
+
error: z41.string()
|
|
5660
5700
|
});
|
|
5661
5701
|
var liveRunBatchSchema = identity.extend({
|
|
5662
|
-
type:
|
|
5663
|
-
events:
|
|
5664
|
-
snapshots:
|
|
5702
|
+
type: z41.literal("batch"),
|
|
5703
|
+
events: z41.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
|
|
5704
|
+
snapshots: z41.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT).optional(),
|
|
5665
5705
|
cursor: runHistoryCursorSchema,
|
|
5666
|
-
afterSeq:
|
|
5667
|
-
hasMore:
|
|
5668
|
-
});
|
|
5669
|
-
var liveRunBatchResultSchema =
|
|
5670
|
-
var liveRunBatchResponseSchema =
|
|
5671
|
-
generation:
|
|
5672
|
-
results:
|
|
5673
|
-
});
|
|
5674
|
-
var liveRunFrameSchema =
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
identity.extend({ type:
|
|
5678
|
-
identity.extend({ type:
|
|
5706
|
+
afterSeq: z41.number().int().nonnegative(),
|
|
5707
|
+
hasMore: z41.boolean()
|
|
5708
|
+
});
|
|
5709
|
+
var liveRunBatchResultSchema = z41.union([liveRunBatchSchema, liveRunErrorSchema]);
|
|
5710
|
+
var liveRunBatchResponseSchema = z41.object({
|
|
5711
|
+
generation: z41.string(),
|
|
5712
|
+
results: z41.array(liveRunBatchResultSchema)
|
|
5713
|
+
});
|
|
5714
|
+
var liveRunFrameSchema = z41.union([
|
|
5715
|
+
z41.object({ type: z41.literal("ready"), generation: z41.string() }),
|
|
5716
|
+
z41.object({ type: z41.literal("ping") }),
|
|
5717
|
+
identity.extend({ type: z41.literal("event"), name: z41.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
|
|
5718
|
+
identity.extend({ type: z41.literal("snapshot"), name: z41.literal("ui-event"), event: runHistoryEventSchema }),
|
|
5679
5719
|
liveRunErrorSchema
|
|
5680
5720
|
]);
|
|
5681
5721
|
|
|
5682
5722
|
// ../contract/src/activity.ts
|
|
5683
|
-
import { z as
|
|
5723
|
+
import { z as z42 } from "zod";
|
|
5684
5724
|
var ACTIVITY_RATE_SECONDS = 30;
|
|
5685
5725
|
var ACTIVITY_TEXT_MAX = 500;
|
|
5686
5726
|
var ACTIVITY_ERROR_MAX = 200;
|
|
@@ -5688,147 +5728,147 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
|
|
|
5688
5728
|
var ACTIVITY_CHECKS_MAX = 100;
|
|
5689
5729
|
var ACTIVITY_CHECK_NAME_MAX = 100;
|
|
5690
5730
|
var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
|
|
5691
|
-
var iso =
|
|
5692
|
-
var count =
|
|
5693
|
-
var runId =
|
|
5731
|
+
var iso = z42.iso.datetime();
|
|
5732
|
+
var count = z42.number().int().nonnegative();
|
|
5733
|
+
var runId = z42.string().min(1);
|
|
5694
5734
|
var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
|
|
5695
|
-
var activityToolSchema =
|
|
5696
|
-
title:
|
|
5697
|
-
toolKind:
|
|
5698
|
-
status:
|
|
5735
|
+
var activityToolSchema = z42.object({
|
|
5736
|
+
title: z42.string().max(ACTIVITY_TOOL_TITLE_MAX),
|
|
5737
|
+
toolKind: z42.enum(ACTIVITY_TOOL_KINDS),
|
|
5738
|
+
status: z42.enum(["pending", "running", "completed", "failed", "declined"]),
|
|
5699
5739
|
startedAt: iso,
|
|
5700
5740
|
endedAt: iso.optional()
|
|
5701
5741
|
}).strict();
|
|
5702
|
-
var activityCheckBucketSchema =
|
|
5703
|
-
var activityPrProgressSchema =
|
|
5704
|
-
checks:
|
|
5705
|
-
counts:
|
|
5706
|
-
truncated:
|
|
5742
|
+
var activityCheckBucketSchema = z42.enum(["pass", "fail", "pending", "skipping", "cancel"]);
|
|
5743
|
+
var activityPrProgressSchema = z42.object({
|
|
5744
|
+
checks: z42.array(z42.object({ name: z42.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
|
|
5745
|
+
counts: z42.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
|
|
5746
|
+
truncated: z42.literal(true).optional()
|
|
5707
5747
|
}).strict();
|
|
5708
|
-
var activityWaitSchema =
|
|
5709
|
-
|
|
5710
|
-
kind:
|
|
5748
|
+
var activityWaitSchema = z42.discriminatedUnion("kind", [
|
|
5749
|
+
z42.object({
|
|
5750
|
+
kind: z42.literal("human"),
|
|
5711
5751
|
since: iso,
|
|
5712
|
-
detail:
|
|
5752
|
+
detail: z42.object({
|
|
5713
5753
|
/** The ask card's first question. */
|
|
5714
|
-
question:
|
|
5754
|
+
question: z42.string().max(ACTIVITY_TEXT_MAX).optional(),
|
|
5715
5755
|
/** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
|
|
5716
5756
|
* automatic-wake budget is spent; `completion`: Squawk's completion gate. */
|
|
5717
|
-
reason:
|
|
5757
|
+
reason: z42.enum(["question", "turn-end", "budget", "completion"]),
|
|
5718
5758
|
/** Inputs not delivered yet, when there are any. */
|
|
5719
|
-
queuedMessages:
|
|
5759
|
+
queuedMessages: z42.number().int().positive().optional()
|
|
5720
5760
|
}).strict()
|
|
5721
5761
|
}).strict(),
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
kind:
|
|
5762
|
+
z42.object({ kind: z42.literal("usage-limit"), detail: z42.object({ resumeAt: z42.string() }).strict() }).strict(),
|
|
5763
|
+
z42.object({
|
|
5764
|
+
kind: z42.literal("workers"),
|
|
5725
5765
|
since: iso,
|
|
5726
5766
|
deadline: iso.optional(),
|
|
5727
|
-
detail:
|
|
5767
|
+
detail: z42.object({
|
|
5728
5768
|
/** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
|
|
5729
5769
|
owed: count,
|
|
5730
5770
|
/** Targets named and targets settled, summed over the entries. */
|
|
5731
5771
|
total: count,
|
|
5732
5772
|
settled: count,
|
|
5733
5773
|
/** Every open entry waits on request replies. */
|
|
5734
|
-
replies:
|
|
5774
|
+
replies: z42.literal(true).optional(),
|
|
5735
5775
|
/** Only when one entry is open. */
|
|
5736
5776
|
mode: workerWaitModeSchema.optional(),
|
|
5737
5777
|
/** Who owes the awaited replies, each once. */
|
|
5738
|
-
recipientRunIds:
|
|
5778
|
+
recipientRunIds: z42.array(runId)
|
|
5739
5779
|
}).strict()
|
|
5740
5780
|
}).strict(),
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
kind:
|
|
5781
|
+
z42.object({ kind: z42.literal("peers"), since: iso, deadline: iso, detail: z42.object({ peerRunIds: z42.array(runId) }).strict() }).strict(),
|
|
5782
|
+
z42.object({ kind: z42.literal("subagents"), since: iso, deadline: iso, detail: z42.object({ running: count }).strict() }).strict(),
|
|
5783
|
+
z42.object({
|
|
5784
|
+
kind: z42.literal("pr"),
|
|
5745
5785
|
since: iso,
|
|
5746
5786
|
deadline: iso,
|
|
5747
|
-
detail:
|
|
5748
|
-
number:
|
|
5787
|
+
detail: z42.object({
|
|
5788
|
+
number: z42.number().int().positive(),
|
|
5749
5789
|
target: prWaitUntilSchema,
|
|
5750
5790
|
/** Check progress, while the CI progress registry holds some for this wait. */
|
|
5751
5791
|
checks: activityPrProgressSchema.shape.checks.optional(),
|
|
5752
5792
|
counts: activityPrProgressSchema.shape.counts.optional(),
|
|
5753
|
-
truncated:
|
|
5793
|
+
truncated: z42.literal(true).optional()
|
|
5754
5794
|
}).strict()
|
|
5755
5795
|
}).strict(),
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5796
|
+
z42.object({ kind: z42.literal("process"), since: iso, deadline: iso, detail: z42.object({ pid: z42.number().int(), note: z42.string().optional() }).strict() }).strict(),
|
|
5797
|
+
z42.object({ kind: z42.literal("plugin"), since: iso, deadline: iso.optional(), detail: z42.object({ pluginKind: z42.string().min(1).max(64), summary: z42.string().max(256) }).strict() }).strict(),
|
|
5798
|
+
z42.object({ kind: z42.literal("timer"), since: iso, deadline: iso, detail: z42.object({ wakeAt: iso, note: z42.string().optional() }).strict() }).strict()
|
|
5759
5799
|
]);
|
|
5760
5800
|
var activityRunShape = {
|
|
5761
5801
|
runId,
|
|
5762
5802
|
/** The display title: `titleSummary ?? title`. */
|
|
5763
|
-
title:
|
|
5803
|
+
title: z42.string(),
|
|
5764
5804
|
status: runStatusSchema,
|
|
5765
5805
|
/** The `deriveAttention` rung id, never a label. */
|
|
5766
|
-
rung:
|
|
5806
|
+
rung: z42.enum(ATTENTION_RUNGS),
|
|
5767
5807
|
runner: runnerSchema.optional(),
|
|
5768
|
-
model:
|
|
5769
|
-
currentStepId:
|
|
5770
|
-
createdAt:
|
|
5771
|
-
startedAt:
|
|
5772
|
-
finishedAt:
|
|
5808
|
+
model: z42.string().optional(),
|
|
5809
|
+
currentStepId: z42.string().optional(),
|
|
5810
|
+
createdAt: z42.string().optional(),
|
|
5811
|
+
startedAt: z42.string().optional(),
|
|
5812
|
+
finishedAt: z42.string().optional(),
|
|
5773
5813
|
wait: activityWaitSchema.optional(),
|
|
5774
5814
|
tool: activityToolSchema.optional(),
|
|
5775
5815
|
/** Tool calls started per second, oldest first. */
|
|
5776
|
-
rate:
|
|
5816
|
+
rate: z42.array(count).length(ACTIVITY_RATE_SECONDS),
|
|
5777
5817
|
/** One line of `RunRecord.error`. */
|
|
5778
|
-
error:
|
|
5818
|
+
error: z42.string().max(ACTIVITY_ERROR_MAX).optional()
|
|
5779
5819
|
};
|
|
5780
|
-
var activityWorkerSchema =
|
|
5820
|
+
var activityWorkerSchema = z42.object({
|
|
5781
5821
|
...activityRunShape,
|
|
5782
5822
|
/** The worker's current execution revision. */
|
|
5783
5823
|
revision: count,
|
|
5784
5824
|
/** The parent holds a collected result for this revision. */
|
|
5785
|
-
collected:
|
|
5825
|
+
collected: z42.boolean()
|
|
5786
5826
|
}).strict();
|
|
5787
|
-
var activityRunSchema =
|
|
5788
|
-
var activityRequestSchema =
|
|
5789
|
-
requestId:
|
|
5790
|
-
relationship:
|
|
5827
|
+
var activityRunSchema = z42.object({ ...activityRunShape, workers: z42.array(activityWorkerSchema) }).strict();
|
|
5828
|
+
var activityRequestSchema = z42.object({
|
|
5829
|
+
requestId: z42.uuid(),
|
|
5830
|
+
relationship: z42.enum(["family", "peer"]),
|
|
5791
5831
|
senderRunId: runId,
|
|
5792
5832
|
recipientRunId: runId,
|
|
5793
|
-
text:
|
|
5794
|
-
senderTitle:
|
|
5795
|
-
recipientTitle:
|
|
5833
|
+
text: z42.string().max(ACTIVITY_TEXT_MAX),
|
|
5834
|
+
senderTitle: z42.string().optional(),
|
|
5835
|
+
recipientTitle: z42.string().optional(),
|
|
5796
5836
|
createdAt: iso,
|
|
5797
5837
|
deadline: iso.optional()
|
|
5798
5838
|
}).strict();
|
|
5799
|
-
var activityClosedRequestSchema =
|
|
5800
|
-
requestId:
|
|
5839
|
+
var activityClosedRequestSchema = z42.object({
|
|
5840
|
+
requestId: z42.uuid(),
|
|
5801
5841
|
senderRunId: runId,
|
|
5802
5842
|
recipientRunId: runId,
|
|
5803
5843
|
status: requestOutcomeSchema.shape.status,
|
|
5804
5844
|
observedAt: iso
|
|
5805
5845
|
}).strict();
|
|
5806
|
-
var activityProjectSchema =
|
|
5807
|
-
projectId:
|
|
5808
|
-
name:
|
|
5846
|
+
var activityProjectSchema = z42.object({
|
|
5847
|
+
projectId: z42.string(),
|
|
5848
|
+
name: z42.string(),
|
|
5809
5849
|
/** False for a project this process has not loaded: its lists are empty because nothing was read. */
|
|
5810
|
-
loaded:
|
|
5850
|
+
loaded: z42.boolean(),
|
|
5811
5851
|
/** The project is loaded but its run store cannot open: the failure its project routes answer.
|
|
5812
5852
|
* The lists are empty because nothing could be read, not because nothing runs. */
|
|
5813
|
-
unavailable:
|
|
5853
|
+
unavailable: z42.object({ status: z42.union([z42.literal(404), z42.literal(409), z42.literal(503)]), error: z42.string() }).strict().optional(),
|
|
5814
5854
|
/** Root tasks in review: the summary chip (D8). */
|
|
5815
5855
|
inReview: count,
|
|
5816
|
-
tasks:
|
|
5817
|
-
requests:
|
|
5818
|
-
closed:
|
|
5856
|
+
tasks: z42.array(activityRunSchema),
|
|
5857
|
+
requests: z42.array(activityRequestSchema),
|
|
5858
|
+
closed: z42.array(activityClosedRequestSchema)
|
|
5819
5859
|
}).strict();
|
|
5820
|
-
var activitySnapshotSchema =
|
|
5860
|
+
var activitySnapshotSchema = z42.object({
|
|
5821
5861
|
/** The server clock; the client ticks ages from it. */
|
|
5822
5862
|
generatedAt: iso,
|
|
5823
5863
|
/** One entry, or every visible project for the global read. */
|
|
5824
|
-
projects:
|
|
5864
|
+
projects: z42.array(activityProjectSchema)
|
|
5825
5865
|
}).strict();
|
|
5826
|
-
var activityQuerySchema =
|
|
5827
|
-
project:
|
|
5866
|
+
var activityQuerySchema = z42.object({
|
|
5867
|
+
project: z42.union([z42.literal("default"), z42.string().regex(PROJECT_ID_PATTERN)]).optional()
|
|
5828
5868
|
});
|
|
5829
5869
|
|
|
5830
5870
|
// ../contract/src/live-coordination.ts
|
|
5831
|
-
import { z as
|
|
5871
|
+
import { z as z43 } from "zod";
|
|
5832
5872
|
var LIVE_PROTOCOL = 4;
|
|
5833
5873
|
var LIVE_WORKER_NAME = "cezar-live-v4";
|
|
5834
5874
|
var LEASE_MS = 15e3;
|
|
@@ -5837,112 +5877,112 @@ function allowedLiveRead(path) {
|
|
|
5837
5877
|
if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
|
|
5838
5878
|
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);
|
|
5839
5879
|
}
|
|
5840
|
-
var liveDemandSchema =
|
|
5841
|
-
|
|
5842
|
-
liveRunDemandSchema.extend({ kind:
|
|
5843
|
-
|
|
5880
|
+
var liveDemandSchema = z43.discriminatedUnion("kind", [
|
|
5881
|
+
z43.object({ kind: z43.literal("workspace") }),
|
|
5882
|
+
liveRunDemandSchema.extend({ kind: z43.literal("run") }),
|
|
5883
|
+
z43.object({ kind: z43.literal("topic"), topic: z43.string().min(1).max(128) }),
|
|
5844
5884
|
// Preserve server-directed cadence (settled references use ten minutes). Only
|
|
5845
5885
|
// bound the timer itself: larger delays overflow setTimeout into a tight loop.
|
|
5846
|
-
|
|
5886
|
+
z43.object({ kind: z43.literal("read"), path: z43.string().max(4096).refine(allowedLiveRead), intervalMs: z43.number().int().min(1e3).max(2147483647) })
|
|
5847
5887
|
]);
|
|
5848
|
-
var liveEntrySchema =
|
|
5849
|
-
var envelope =
|
|
5850
|
-
var ownerInputSchema =
|
|
5888
|
+
var liveEntrySchema = z43.object({ id: z43.string().min(1).max(128), demand: liveDemandSchema });
|
|
5889
|
+
var envelope = z43.object({ version: z43.literal(LIVE_PROTOCOL), documentId: z43.string().min(1).max(128), epoch: z43.number().int().nonnegative() });
|
|
5890
|
+
var ownerInputSchema = z43.discriminatedUnion("type", [
|
|
5851
5891
|
envelope.extend({
|
|
5852
|
-
type:
|
|
5853
|
-
entries:
|
|
5892
|
+
type: z43.literal("sync"),
|
|
5893
|
+
entries: z43.array(liveEntrySchema).max(64),
|
|
5854
5894
|
/** The document knows no workspace stream generation (its `ready` was lost, for example to
|
|
5855
5895
|
* an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
|
|
5856
|
-
workspaceReady:
|
|
5896
|
+
workspaceReady: z43.literal(true).optional()
|
|
5857
5897
|
}).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
|
|
5858
|
-
envelope.extend({ type:
|
|
5859
|
-
envelope.extend({ type:
|
|
5860
|
-
envelope.extend({ type:
|
|
5898
|
+
envelope.extend({ type: z43.literal("ack"), id: z43.string(), seq: z43.number().int().nonnegative() }),
|
|
5899
|
+
envelope.extend({ type: z43.literal("ack-snapshot"), id: z43.string() }),
|
|
5900
|
+
envelope.extend({ type: z43.literal("refresh"), id: z43.string() })
|
|
5861
5901
|
]);
|
|
5862
|
-
var wireFrameSchema =
|
|
5863
|
-
var ownerOutputSchema =
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5902
|
+
var wireFrameSchema = z43.object({ event: z43.string(), data: z43.string(), id: z43.string() });
|
|
5903
|
+
var ownerOutputSchema = z43.discriminatedUnion("type", [
|
|
5904
|
+
z43.object({ type: z43.literal("unavailable"), version: z43.literal(LIVE_PROTOCOL), epoch: z43.number(), reason: z43.string() }),
|
|
5905
|
+
z43.object({ type: z43.literal("hello"), version: z43.literal(LIVE_PROTOCOL) }),
|
|
5906
|
+
z43.object({ type: z43.literal("alive"), version: z43.literal(LIVE_PROTOCOL), epoch: z43.number() }),
|
|
5907
|
+
z43.object({ type: z43.literal("frame"), version: z43.literal(LIVE_PROTOCOL), epoch: z43.number(), id: z43.string(), frame: z43.union([wireFrameSchema, liveRunFrameSchema]) }),
|
|
5908
|
+
z43.object({ type: z43.literal("value"), version: z43.literal(LIVE_PROTOCOL), epoch: z43.number(), id: z43.string(), value: z43.unknown(), error: z43.string().optional() }),
|
|
5909
|
+
z43.object({ type: z43.literal("reset"), version: z43.literal(LIVE_PROTOCOL), epoch: z43.number(), id: z43.string(), reason: z43.string() })
|
|
5870
5910
|
]);
|
|
5871
5911
|
var runKey = (run) => `${run.projectId}/${run.runId}`;
|
|
5872
5912
|
|
|
5873
5913
|
// ../contract/src/workspace-events.ts
|
|
5874
|
-
import { z as
|
|
5875
|
-
var workspaceEventsQuerySchema =
|
|
5876
|
-
runs:
|
|
5914
|
+
import { z as z44 } from "zod";
|
|
5915
|
+
var workspaceEventsQuerySchema = z44.object({
|
|
5916
|
+
runs: z44.literal("summary").optional()
|
|
5877
5917
|
});
|
|
5878
|
-
var projectStamp =
|
|
5879
|
-
var frameSeq =
|
|
5880
|
-
var workspaceRunSummaryEventSchema =
|
|
5918
|
+
var projectStamp = z44.string().min(1);
|
|
5919
|
+
var frameSeq = z44.number().int().positive();
|
|
5920
|
+
var workspaceRunSummaryEventSchema = z44.object({
|
|
5881
5921
|
project: projectStamp,
|
|
5882
5922
|
seq: frameSeq,
|
|
5883
5923
|
run: runSummarySchema,
|
|
5884
|
-
relationships:
|
|
5924
|
+
relationships: z44.string().min(1)
|
|
5885
5925
|
});
|
|
5886
|
-
var workspaceRunDeletedEventSchema =
|
|
5926
|
+
var workspaceRunDeletedEventSchema = z44.object({
|
|
5887
5927
|
project: projectStamp,
|
|
5888
5928
|
seq: frameSeq,
|
|
5889
|
-
id:
|
|
5929
|
+
id: z44.string().min(1)
|
|
5890
5930
|
});
|
|
5891
|
-
var workspaceReadyEventSchema =
|
|
5892
|
-
generation:
|
|
5893
|
-
seq:
|
|
5931
|
+
var workspaceReadyEventSchema = z44.object({
|
|
5932
|
+
generation: z44.string().min(1),
|
|
5933
|
+
seq: z44.number().int().nonnegative()
|
|
5894
5934
|
});
|
|
5895
|
-
var workspaceUsageEventSchema =
|
|
5935
|
+
var workspaceUsageEventSchema = z44.object({
|
|
5896
5936
|
project: projectStamp,
|
|
5897
|
-
usage:
|
|
5937
|
+
usage: z44.record(z44.string(), processUsageSchema)
|
|
5898
5938
|
});
|
|
5899
|
-
var runsIndexResponseSchema =
|
|
5939
|
+
var runsIndexResponseSchema = z44.object({
|
|
5900
5940
|
/** Newest first, across every registered project: each project's window
|
|
5901
5941
|
* (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
|
|
5902
5942
|
* archived root runs. Owned workers are never included. Older archived runs are reached
|
|
5903
5943
|
* through `GET /workspace/runs-search`. */
|
|
5904
|
-
runs:
|
|
5944
|
+
runs: z44.array(runIndexEntrySchema),
|
|
5905
5945
|
/** Additive: absent statuses mean "nothing warm", never "nothing to show". */
|
|
5906
5946
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
5907
5947
|
/** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
|
|
5908
|
-
perProjectLimit:
|
|
5948
|
+
perProjectLimit: z44.number(),
|
|
5909
5949
|
/** Ids of the projects that had more archived root runs than `perProjectLimit`. */
|
|
5910
|
-
truncated:
|
|
5950
|
+
truncated: z44.array(z44.string()),
|
|
5911
5951
|
/** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
|
|
5912
5952
|
* compares only within one generation. */
|
|
5913
|
-
generation:
|
|
5953
|
+
generation: z44.string().min(1),
|
|
5914
5954
|
/** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
|
|
5915
5955
|
* frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
|
|
5916
|
-
eventSeq:
|
|
5956
|
+
eventSeq: z44.number().int().nonnegative()
|
|
5917
5957
|
});
|
|
5918
5958
|
|
|
5919
5959
|
// ../contract/src/permissions.ts
|
|
5920
|
-
import { z as
|
|
5921
|
-
var permissionOptionKindSchema =
|
|
5922
|
-
var permissionOptionSchema =
|
|
5923
|
-
id:
|
|
5924
|
-
label:
|
|
5960
|
+
import { z as z45 } from "zod";
|
|
5961
|
+
var permissionOptionKindSchema = z45.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
|
|
5962
|
+
var permissionOptionSchema = z45.object({
|
|
5963
|
+
id: z45.string().min(1).max(128),
|
|
5964
|
+
label: z45.string().min(1),
|
|
5925
5965
|
kind: permissionOptionKindSchema
|
|
5926
5966
|
}).strict();
|
|
5927
|
-
var permissionRequestedSchema =
|
|
5928
|
-
type:
|
|
5929
|
-
requestId:
|
|
5930
|
-
itemId:
|
|
5931
|
-
title:
|
|
5932
|
-
details:
|
|
5933
|
-
options:
|
|
5967
|
+
var permissionRequestedSchema = z45.object({
|
|
5968
|
+
type: z45.literal("permission.requested"),
|
|
5969
|
+
requestId: z45.string().min(1).max(128),
|
|
5970
|
+
itemId: z45.string().optional(),
|
|
5971
|
+
title: z45.string().min(1),
|
|
5972
|
+
details: z45.string().optional(),
|
|
5973
|
+
options: z45.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
|
|
5934
5974
|
}).strict();
|
|
5935
|
-
var permissionResolvedSchema =
|
|
5936
|
-
type:
|
|
5937
|
-
requestId:
|
|
5938
|
-
optionId:
|
|
5939
|
-
reason:
|
|
5975
|
+
var permissionResolvedSchema = z45.object({
|
|
5976
|
+
type: z45.literal("permission.resolved"),
|
|
5977
|
+
requestId: z45.string().min(1).max(128),
|
|
5978
|
+
optionId: z45.string().optional(),
|
|
5979
|
+
reason: z45.string().optional()
|
|
5940
5980
|
}).strict();
|
|
5941
|
-
var permissionDecisionSchema =
|
|
5942
|
-
requestId:
|
|
5943
|
-
optionId:
|
|
5981
|
+
var permissionDecisionSchema = z45.object({
|
|
5982
|
+
requestId: z45.string().min(1).max(128),
|
|
5983
|
+
optionId: z45.string().min(1).max(128)
|
|
5944
5984
|
}).strict();
|
|
5945
|
-
var permissionDecisionResponseSchema =
|
|
5985
|
+
var permissionDecisionResponseSchema = z45.object({ delivered: z45.literal(true) });
|
|
5946
5986
|
|
|
5947
5987
|
// ../contract/src/defined.ts
|
|
5948
5988
|
function defined(value) {
|
|
@@ -6212,83 +6252,83 @@ function isImagePath(path) {
|
|
|
6212
6252
|
}
|
|
6213
6253
|
|
|
6214
6254
|
// ../contract/src/provider-requests.ts
|
|
6215
|
-
import { z as
|
|
6216
|
-
var providerConnectSchema =
|
|
6255
|
+
import { z as z46 } from "zod";
|
|
6256
|
+
var providerConnectSchema = z46.object({
|
|
6217
6257
|
provider: runnerSchema,
|
|
6218
6258
|
/** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
|
|
6219
6259
|
* default, which is what every pre-profiles client sends. Without this, "Connect" on a second
|
|
6220
6260
|
* Claude account would open a login for the FIRST one and report success. */
|
|
6221
|
-
profileId:
|
|
6261
|
+
profileId: z46.string().max(64).optional()
|
|
6222
6262
|
}).strict();
|
|
6223
|
-
var createAgentProfileSchema =
|
|
6263
|
+
var createAgentProfileSchema = z46.object({
|
|
6224
6264
|
provider: runnerSchema,
|
|
6225
|
-
label:
|
|
6226
|
-
configDir:
|
|
6265
|
+
label: z46.string().trim().max(200).optional(),
|
|
6266
|
+
configDir: z46.string().trim().min(1).max(4096)
|
|
6227
6267
|
}).strict();
|
|
6228
|
-
var updateAgentProfileSchema =
|
|
6229
|
-
label:
|
|
6230
|
-
configDir:
|
|
6268
|
+
var updateAgentProfileSchema = z46.object({
|
|
6269
|
+
label: z46.string().trim().max(200).optional(),
|
|
6270
|
+
configDir: z46.string().trim().min(1).max(4096).optional()
|
|
6231
6271
|
}).strict().refine(
|
|
6232
6272
|
(value) => value.label !== void 0 || value.configDir !== void 0,
|
|
6233
6273
|
"send label or configDir"
|
|
6234
6274
|
);
|
|
6235
|
-
var selectAgentProfileSchema =
|
|
6236
|
-
projectId:
|
|
6275
|
+
var selectAgentProfileSchema = z46.object({
|
|
6276
|
+
projectId: z46.string().min(1).max(64),
|
|
6237
6277
|
provider: runnerSchema,
|
|
6238
|
-
profileId:
|
|
6278
|
+
profileId: z46.string().max(64).nullable()
|
|
6239
6279
|
}).strict();
|
|
6240
6280
|
var providerParamSchema = runnerSchema;
|
|
6241
|
-
var providerEnabledSchema =
|
|
6242
|
-
var providerRetrySchema =
|
|
6243
|
-
authFailureId:
|
|
6281
|
+
var providerEnabledSchema = z46.object({ enabled: z46.boolean() }).strict();
|
|
6282
|
+
var providerRetrySchema = z46.object({
|
|
6283
|
+
authFailureId: z46.string().min(1).max(128)
|
|
6244
6284
|
}).strict();
|
|
6245
|
-
var providerRouteParamsSchema =
|
|
6246
|
-
var agentProfileRouteParamsSchema =
|
|
6247
|
-
var providerSignInParamsSchema =
|
|
6248
|
-
var providerSignInRedirectSchema =
|
|
6285
|
+
var providerRouteParamsSchema = z46.object({ provider: providerParamSchema });
|
|
6286
|
+
var agentProfileRouteParamsSchema = z46.object({ id: z46.string() });
|
|
6287
|
+
var providerSignInParamsSchema = z46.object({ id: z46.uuid() });
|
|
6288
|
+
var providerSignInRedirectSchema = z46.object({
|
|
6249
6289
|
/** The address the browser landed on after consent, or the code that page shows. */
|
|
6250
|
-
redirectUrl:
|
|
6290
|
+
redirectUrl: z46.string().trim().min(1).max(8192)
|
|
6251
6291
|
}).strict();
|
|
6252
6292
|
|
|
6253
6293
|
// ../contract/src/automation-requests.ts
|
|
6254
|
-
import { z as
|
|
6294
|
+
import { z as z48 } from "zod";
|
|
6255
6295
|
|
|
6256
6296
|
// ../contract/src/automation-storage.ts
|
|
6257
|
-
import { z as
|
|
6258
|
-
var storedAutomationEventSchema =
|
|
6297
|
+
import { z as z47 } from "zod";
|
|
6298
|
+
var storedAutomationEventSchema = z47.enum([
|
|
6259
6299
|
"pull_request.opened",
|
|
6260
6300
|
"issue.opened",
|
|
6261
6301
|
"issue.labeled",
|
|
6262
6302
|
"issue.unlabeled"
|
|
6263
6303
|
]);
|
|
6264
|
-
var boundedString =
|
|
6265
|
-
var stringList =
|
|
6266
|
-
var storedAutomationFiltersSchema =
|
|
6267
|
-
includeExisting:
|
|
6304
|
+
var boundedString = z47.string().trim().min(1).max(200);
|
|
6305
|
+
var stringList = z47.array(boundedString).max(100).optional();
|
|
6306
|
+
var storedAutomationFiltersSchema = z47.object({
|
|
6307
|
+
includeExisting: z47.boolean().optional(),
|
|
6268
6308
|
/** Require an open item and matching live labels before reservation and launch. */
|
|
6269
|
-
requireCurrentLabels:
|
|
6309
|
+
requireCurrentLabels: z47.boolean().optional(),
|
|
6270
6310
|
authors: stringList,
|
|
6271
6311
|
assignees: stringList,
|
|
6272
6312
|
allLabels: stringList,
|
|
6273
6313
|
anyLabels: stringList,
|
|
6274
6314
|
excludeLabels: stringList,
|
|
6275
6315
|
changedLabels: stringList,
|
|
6276
|
-
lookbackDays:
|
|
6277
|
-
maxRecords:
|
|
6316
|
+
lookbackDays: z47.number().int().min(1).max(90).default(7),
|
|
6317
|
+
maxRecords: z47.number().int().min(1).max(100).default(25)
|
|
6278
6318
|
}).passthrough();
|
|
6279
|
-
var storedAutomationTaskSchema =
|
|
6280
|
-
prompt:
|
|
6281
|
-
workflow:
|
|
6282
|
-
steps:
|
|
6319
|
+
var storedAutomationTaskSchema = z47.object({
|
|
6320
|
+
prompt: z47.string().min(1).max(1e5),
|
|
6321
|
+
workflow: z47.string().trim().min(1).max(200).optional(),
|
|
6322
|
+
steps: z47.array(workflowStepDefSchema).min(1).max(100).optional(),
|
|
6283
6323
|
runner: runnerSchema.optional(),
|
|
6284
|
-
model:
|
|
6285
|
-
effort:
|
|
6286
|
-
variants:
|
|
6287
|
-
worktree:
|
|
6288
|
-
autonomous:
|
|
6324
|
+
model: z47.string().trim().min(1).max(200).optional(),
|
|
6325
|
+
effort: z47.string().trim().min(1).max(32).optional(),
|
|
6326
|
+
variants: z47.union([z47.literal(1), z47.literal(2), z47.literal(3)]).optional(),
|
|
6327
|
+
worktree: z47.boolean().optional(),
|
|
6328
|
+
autonomous: z47.boolean().optional(),
|
|
6289
6329
|
...completionControlsShape,
|
|
6290
6330
|
...taskAccessShape,
|
|
6291
|
-
systemPrompt:
|
|
6331
|
+
systemPrompt: z47.string().max(1e5).optional()
|
|
6292
6332
|
}).passthrough().refine((task) => !(task.workflow && task.steps), {
|
|
6293
6333
|
message: "task selects either a named workflow or inline steps, not both"
|
|
6294
6334
|
});
|
|
@@ -6306,122 +6346,122 @@ var fillGithubDefaults = (raw) => {
|
|
|
6306
6346
|
filters: record.filters ?? {}
|
|
6307
6347
|
};
|
|
6308
6348
|
};
|
|
6309
|
-
var storedAutomationDefinitionObjectSchema =
|
|
6310
|
-
id:
|
|
6311
|
-
revision:
|
|
6312
|
-
name:
|
|
6313
|
-
description:
|
|
6314
|
-
enabled:
|
|
6349
|
+
var storedAutomationDefinitionObjectSchema = z47.object({
|
|
6350
|
+
id: z47.string().min(1).max(100),
|
|
6351
|
+
revision: z47.number().int().positive(),
|
|
6352
|
+
name: z47.string().trim().min(1).max(200),
|
|
6353
|
+
description: z47.string().max(2e3).optional(),
|
|
6354
|
+
enabled: z47.boolean().default(false),
|
|
6315
6355
|
/** A definition written before schedules has no `kind`: it is a poll. */
|
|
6316
6356
|
kind: automationKindSchema.default("github"),
|
|
6317
|
-
events:
|
|
6318
|
-
intervalSeconds:
|
|
6357
|
+
events: z47.array(storedAutomationEventSchema).min(1).max(4).optional(),
|
|
6358
|
+
intervalSeconds: z47.number().int().min(60).max(86400).optional(),
|
|
6319
6359
|
filters: storedAutomationFiltersSchema.optional(),
|
|
6320
6360
|
// Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
|
|
6321
6361
|
schedule: automationScheduleSchema.passthrough().optional(),
|
|
6322
6362
|
task: storedAutomationTaskSchema,
|
|
6323
6363
|
/** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
|
|
6324
|
-
archived:
|
|
6325
|
-
at:
|
|
6326
|
-
outcome:
|
|
6327
|
-
runId:
|
|
6328
|
-
receiptId:
|
|
6329
|
-
trigger:
|
|
6364
|
+
archived: z47.object({
|
|
6365
|
+
at: z47.string().datetime(),
|
|
6366
|
+
outcome: z47.enum(["launched", "cancelled"]),
|
|
6367
|
+
runId: z47.string().optional(),
|
|
6368
|
+
receiptId: z47.string().optional(),
|
|
6369
|
+
trigger: z47.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
6330
6370
|
}).passthrough().optional(),
|
|
6331
|
-
createdAt:
|
|
6332
|
-
updatedAt:
|
|
6371
|
+
createdAt: z47.string().datetime(),
|
|
6372
|
+
updatedAt: z47.string().datetime()
|
|
6333
6373
|
}).passthrough().superRefine((definition, ctx) => {
|
|
6334
6374
|
if (definition.kind === "schedule") {
|
|
6335
6375
|
if (!definition.schedule) {
|
|
6336
|
-
ctx.addIssue({ code:
|
|
6376
|
+
ctx.addIssue({ code: z47.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
|
|
6337
6377
|
}
|
|
6338
6378
|
return;
|
|
6339
6379
|
}
|
|
6340
6380
|
if (!definition.events?.length) {
|
|
6341
|
-
ctx.addIssue({ code:
|
|
6381
|
+
ctx.addIssue({ code: z47.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
|
|
6342
6382
|
}
|
|
6343
6383
|
if (definition.intervalSeconds === void 0) {
|
|
6344
|
-
ctx.addIssue({ code:
|
|
6384
|
+
ctx.addIssue({ code: z47.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
|
|
6345
6385
|
}
|
|
6346
6386
|
if (!definition.filters) {
|
|
6347
|
-
ctx.addIssue({ code:
|
|
6387
|
+
ctx.addIssue({ code: z47.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
|
|
6348
6388
|
}
|
|
6349
6389
|
if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
|
|
6350
6390
|
ctx.addIssue({
|
|
6351
|
-
code:
|
|
6391
|
+
code: z47.ZodIssueCode.custom,
|
|
6352
6392
|
path: ["filters", "changedLabels"],
|
|
6353
6393
|
message: "changedLabels is required for issue label events"
|
|
6354
6394
|
});
|
|
6355
6395
|
}
|
|
6356
6396
|
});
|
|
6357
|
-
var storedAutomationDefinitionSchema =
|
|
6358
|
-
var storedAutomationDefinitionsFileSchema =
|
|
6359
|
-
version:
|
|
6360
|
-
automations:
|
|
6361
|
-
tombstones:
|
|
6397
|
+
var storedAutomationDefinitionSchema = z47.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
|
|
6398
|
+
var storedAutomationDefinitionsFileSchema = z47.object({
|
|
6399
|
+
version: z47.literal(1).default(1),
|
|
6400
|
+
automations: z47.array(z47.unknown()).default([]),
|
|
6401
|
+
tombstones: z47.record(z47.string(), z47.string().datetime()).optional()
|
|
6362
6402
|
}).passthrough();
|
|
6363
|
-
var storedAutomationCursorSchema =
|
|
6364
|
-
timestamp:
|
|
6365
|
-
tieBreaker:
|
|
6403
|
+
var storedAutomationCursorSchema = z47.object({
|
|
6404
|
+
timestamp: z47.string().datetime(),
|
|
6405
|
+
tieBreaker: z47.string().optional()
|
|
6366
6406
|
}).passthrough();
|
|
6367
6407
|
var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
|
|
6368
6408
|
cursor: storedAutomationCursorSchema.optional()
|
|
6369
6409
|
});
|
|
6370
|
-
var storedAutomationRuntimeStateSchema =
|
|
6371
|
-
revision:
|
|
6372
|
-
baselineAt:
|
|
6410
|
+
var storedAutomationRuntimeStateSchema = z47.object({
|
|
6411
|
+
revision: z47.number().int().positive().optional(),
|
|
6412
|
+
baselineAt: z47.string().datetime().optional(),
|
|
6373
6413
|
/** Arming time, independent of a history window's older lower bound. */
|
|
6374
|
-
armedAt:
|
|
6414
|
+
armedAt: z47.string().datetime().optional(),
|
|
6375
6415
|
historyScan: storedAutomationHistoryScanSchema.optional(),
|
|
6376
6416
|
cursor: storedAutomationCursorSchema.optional(),
|
|
6377
|
-
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
6378
|
-
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
6379
|
-
nextCheckAt:
|
|
6380
|
-
lastSuccessAt:
|
|
6417
|
+
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z47.string() }).optional(),
|
|
6418
|
+
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z47.string() }).optional(),
|
|
6419
|
+
nextCheckAt: z47.string().datetime().optional(),
|
|
6420
|
+
lastSuccessAt: z47.string().datetime().optional(),
|
|
6381
6421
|
/** schedule kind: the next occurrence's instant and the last fired one's. */
|
|
6382
|
-
nextRunAt:
|
|
6383
|
-
lastRunAt:
|
|
6384
|
-
etags:
|
|
6385
|
-
backoffUntil:
|
|
6386
|
-
consecutiveFailures:
|
|
6422
|
+
nextRunAt: z47.string().datetime().optional(),
|
|
6423
|
+
lastRunAt: z47.string().datetime().optional(),
|
|
6424
|
+
etags: z47.record(z47.string(), z47.string()).optional(),
|
|
6425
|
+
backoffUntil: z47.string().datetime().optional(),
|
|
6426
|
+
consecutiveFailures: z47.number().int().nonnegative().optional(),
|
|
6387
6427
|
...automationLastErrorShape,
|
|
6388
6428
|
/** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
|
|
6389
|
-
onceOutcome:
|
|
6429
|
+
onceOutcome: z47.enum(["failed", "missed"]).optional()
|
|
6390
6430
|
}).passthrough();
|
|
6391
|
-
var storedAutomationStateFileSchema =
|
|
6392
|
-
version:
|
|
6393
|
-
states:
|
|
6431
|
+
var storedAutomationStateFileSchema = z47.object({
|
|
6432
|
+
version: z47.literal(1).default(1),
|
|
6433
|
+
states: z47.record(z47.string(), storedAutomationRuntimeStateSchema).default({})
|
|
6394
6434
|
}).passthrough();
|
|
6395
|
-
var storedAutomationReceiptSchema =
|
|
6396
|
-
receiptId:
|
|
6397
|
-
receiptKey:
|
|
6398
|
-
eventId:
|
|
6399
|
-
automationId:
|
|
6400
|
-
revision:
|
|
6401
|
-
status:
|
|
6402
|
-
runId:
|
|
6403
|
-
observedAt:
|
|
6404
|
-
updatedAt:
|
|
6405
|
-
error:
|
|
6435
|
+
var storedAutomationReceiptSchema = z47.object({
|
|
6436
|
+
receiptId: z47.string().min(1),
|
|
6437
|
+
receiptKey: z47.string().min(1),
|
|
6438
|
+
eventId: z47.string().min(1),
|
|
6439
|
+
automationId: z47.string().min(1),
|
|
6440
|
+
revision: z47.number().int().positive(),
|
|
6441
|
+
status: z47.enum(["reserved", "launched", "launch-error", "released"]),
|
|
6442
|
+
runId: z47.string().optional(),
|
|
6443
|
+
observedAt: z47.string().datetime(),
|
|
6444
|
+
updatedAt: z47.string().datetime(),
|
|
6445
|
+
error: z47.string().max(2e3).optional(),
|
|
6406
6446
|
/** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
|
|
6407
|
-
occurrenceAt:
|
|
6408
|
-
candidate:
|
|
6409
|
-
eventId:
|
|
6447
|
+
occurrenceAt: z47.string().datetime().optional(),
|
|
6448
|
+
candidate: z47.object({
|
|
6449
|
+
eventId: z47.string(),
|
|
6410
6450
|
event: storedAutomationEventSchema,
|
|
6411
|
-
timestamp:
|
|
6412
|
-
tieBreaker:
|
|
6413
|
-
repo:
|
|
6414
|
-
nodeId:
|
|
6415
|
-
number:
|
|
6416
|
-
title:
|
|
6417
|
-
url:
|
|
6418
|
-
author:
|
|
6419
|
-
assignees:
|
|
6420
|
-
labels:
|
|
6421
|
-
changedLabel:
|
|
6451
|
+
timestamp: z47.string().datetime(),
|
|
6452
|
+
tieBreaker: z47.string(),
|
|
6453
|
+
repo: z47.string(),
|
|
6454
|
+
nodeId: z47.string(),
|
|
6455
|
+
number: z47.number().int().positive(),
|
|
6456
|
+
title: z47.string().max(500),
|
|
6457
|
+
url: z47.string().url(),
|
|
6458
|
+
author: z47.string().max(200),
|
|
6459
|
+
assignees: z47.array(z47.string().max(200)).max(100),
|
|
6460
|
+
labels: z47.array(z47.string().max(200)).max(100),
|
|
6461
|
+
changedLabel: z47.string().max(200).optional()
|
|
6422
6462
|
}).passthrough().optional()
|
|
6423
6463
|
}).passthrough();
|
|
6424
|
-
var storedAutomationLogResultSchema =
|
|
6464
|
+
var storedAutomationLogResultSchema = z47.enum([
|
|
6425
6465
|
"launched",
|
|
6426
6466
|
"no-match",
|
|
6427
6467
|
"duplicate",
|
|
@@ -6437,24 +6477,24 @@ var storedAutomationLogResultSchema = z46.enum([
|
|
|
6437
6477
|
// once schedule
|
|
6438
6478
|
"missed"
|
|
6439
6479
|
]);
|
|
6440
|
-
var storedAutomationLogRecordSchema =
|
|
6441
|
-
seq:
|
|
6442
|
-
ts:
|
|
6443
|
-
automationId:
|
|
6444
|
-
revision:
|
|
6480
|
+
var storedAutomationLogRecordSchema = z47.object({
|
|
6481
|
+
seq: z47.number().int().positive(),
|
|
6482
|
+
ts: z47.string().datetime(),
|
|
6483
|
+
automationId: z47.string().min(1),
|
|
6484
|
+
revision: z47.number().int().positive(),
|
|
6445
6485
|
event: storedAutomationEventSchema.optional(),
|
|
6446
6486
|
result: storedAutomationLogResultSchema,
|
|
6447
|
-
reason:
|
|
6448
|
-
durationMs:
|
|
6449
|
-
receiptId:
|
|
6450
|
-
runId:
|
|
6451
|
-
githubNumber:
|
|
6452
|
-
githubTitle:
|
|
6453
|
-
githubUrl:
|
|
6454
|
-
rateLimit:
|
|
6455
|
-
bucket:
|
|
6456
|
-
remaining:
|
|
6457
|
-
resetAt:
|
|
6487
|
+
reason: z47.string().max(2e3).optional(),
|
|
6488
|
+
durationMs: z47.number().int().nonnegative().optional(),
|
|
6489
|
+
receiptId: z47.string().optional(),
|
|
6490
|
+
runId: z47.string().optional(),
|
|
6491
|
+
githubNumber: z47.number().int().positive().optional(),
|
|
6492
|
+
githubTitle: z47.string().max(500).optional(),
|
|
6493
|
+
githubUrl: z47.string().url().optional(),
|
|
6494
|
+
rateLimit: z47.object({
|
|
6495
|
+
bucket: z47.enum(["core", "search"]),
|
|
6496
|
+
remaining: z47.number().int().nonnegative().optional(),
|
|
6497
|
+
resetAt: z47.string().datetime().optional()
|
|
6458
6498
|
}).passthrough().optional()
|
|
6459
6499
|
}).passthrough();
|
|
6460
6500
|
function storedIsOnceSchedule(definition) {
|
|
@@ -6468,224 +6508,224 @@ function storedIsScheduleAutomation(definition) {
|
|
|
6468
6508
|
}
|
|
6469
6509
|
|
|
6470
6510
|
// ../contract/src/automation-requests.ts
|
|
6471
|
-
var automationEditableSchema =
|
|
6472
|
-
name:
|
|
6473
|
-
description:
|
|
6474
|
-
enabled:
|
|
6511
|
+
var automationEditableSchema = z48.object({
|
|
6512
|
+
name: z48.string().trim().min(1).max(200),
|
|
6513
|
+
description: z48.string().max(2e3).optional(),
|
|
6514
|
+
enabled: z48.boolean().optional(),
|
|
6475
6515
|
kind: automationKindSchema.optional(),
|
|
6476
|
-
events:
|
|
6477
|
-
intervalSeconds:
|
|
6516
|
+
events: z48.array(automationEventSchema).min(1).max(4).optional(),
|
|
6517
|
+
intervalSeconds: z48.number().int().min(60).max(86400).optional(),
|
|
6478
6518
|
filters: storedAutomationFiltersSchema.optional(),
|
|
6479
6519
|
schedule: automationScheduleSchema.optional(),
|
|
6480
|
-
task:
|
|
6520
|
+
task: z48.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
|
|
6481
6521
|
message: "task selects either a named workflow or inline steps, not both"
|
|
6482
6522
|
})
|
|
6483
6523
|
}).strict();
|
|
6484
|
-
var automationCreateSchema = automationEditableSchema.extend({ enable:
|
|
6485
|
-
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision:
|
|
6486
|
-
var automationCheckRequestSchema =
|
|
6487
|
-
var automationLogQuerySchema =
|
|
6488
|
-
automationId:
|
|
6524
|
+
var automationCreateSchema = automationEditableSchema.extend({ enable: z48.boolean().optional() });
|
|
6525
|
+
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z48.number().int().positive() });
|
|
6526
|
+
var automationCheckRequestSchema = z48.object({ mode: z48.enum(["preview", "execute"]) }).strict();
|
|
6527
|
+
var automationLogQuerySchema = z48.object({
|
|
6528
|
+
automationId: z48.string().optional(),
|
|
6489
6529
|
result: automationLogResultSchema.optional(),
|
|
6490
6530
|
event: automationEventSchema.optional(),
|
|
6491
|
-
since:
|
|
6492
|
-
cursor:
|
|
6531
|
+
since: z48.string().datetime().optional(),
|
|
6532
|
+
cursor: z48.coerce.number().int().positive().optional(),
|
|
6493
6533
|
// Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
|
|
6494
6534
|
// 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
|
|
6495
6535
|
// request type `queryZodValidator` publishes (see validators.ts on why the request side falls
|
|
6496
6536
|
// back to the schema's output), which would have made every caller send a `?limit=` this route
|
|
6497
6537
|
// never needed.
|
|
6498
|
-
limit:
|
|
6538
|
+
limit: z48.coerce.number().int().min(1).max(100).optional()
|
|
6499
6539
|
});
|
|
6500
6540
|
|
|
6501
6541
|
// ../contract/src/workflow-requests.ts
|
|
6502
|
-
import { z as
|
|
6503
|
-
var planSchema =
|
|
6542
|
+
import { z as z49 } from "zod";
|
|
6543
|
+
var planSchema = z49.object({
|
|
6504
6544
|
// Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
|
|
6505
|
-
task:
|
|
6545
|
+
task: z49.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
|
|
6506
6546
|
/** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
|
|
6507
6547
|
* selection (hearsay-tools/squawk#4116). */
|
|
6508
|
-
agentProfile:
|
|
6548
|
+
agentProfile: z49.string().max(64).optional()
|
|
6509
6549
|
});
|
|
6510
|
-
var parseWorkflowSchema =
|
|
6511
|
-
yaml:
|
|
6550
|
+
var parseWorkflowSchema = z49.object({
|
|
6551
|
+
yaml: z49.string().min(1).max(1e5)
|
|
6512
6552
|
});
|
|
6513
6553
|
|
|
6514
6554
|
// ../contract/src/ui-state-requests.ts
|
|
6515
|
-
import { z as
|
|
6555
|
+
import { z as z50 } from "zod";
|
|
6516
6556
|
var SKILL_USAGE_MAX_ENTRIES = 200;
|
|
6517
6557
|
var UI_STATE_MAX_KEYS = 200;
|
|
6518
6558
|
var uiStateSchema2 = uiStateSchema.extend({
|
|
6519
6559
|
// null records a quick task with no selected skill or workflow.
|
|
6520
|
-
lastTask:
|
|
6521
|
-
source:
|
|
6522
|
-
ref:
|
|
6560
|
+
lastTask: z50.object({
|
|
6561
|
+
source: z50.enum(["workflow", "skill"]),
|
|
6562
|
+
ref: z50.string().min(1).max(200)
|
|
6523
6563
|
}).nullable().optional(),
|
|
6524
6564
|
// Most recent source choices, newest first.
|
|
6525
|
-
recentSources:
|
|
6526
|
-
|
|
6527
|
-
source:
|
|
6528
|
-
ref:
|
|
6565
|
+
recentSources: z50.array(
|
|
6566
|
+
z50.object({
|
|
6567
|
+
source: z50.enum(["workflow", "skill"]),
|
|
6568
|
+
ref: z50.string().min(1).max(200)
|
|
6529
6569
|
})
|
|
6530
6570
|
).max(50).optional(),
|
|
6531
|
-
skillUsage:
|
|
6571
|
+
skillUsage: z50.record(z50.string().min(1).max(200), z50.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
|
|
6532
6572
|
message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
|
|
6533
6573
|
}).optional(),
|
|
6534
|
-
promptTemplates:
|
|
6535
|
-
|
|
6536
|
-
id:
|
|
6537
|
-
label:
|
|
6538
|
-
text:
|
|
6574
|
+
promptTemplates: z50.array(
|
|
6575
|
+
z50.object({
|
|
6576
|
+
id: z50.string().min(1).max(64),
|
|
6577
|
+
label: z50.string().trim().min(1).max(80),
|
|
6578
|
+
text: z50.string().trim().min(1).max(2e3),
|
|
6539
6579
|
// Skill names this template auto-applies for. Optional and additive: templates
|
|
6540
6580
|
// written before this key existed keep validating, and stay manual-only.
|
|
6541
|
-
skills:
|
|
6581
|
+
skills: z50.array(z50.string().trim().min(1).max(200)).max(50).optional()
|
|
6542
6582
|
})
|
|
6543
6583
|
).max(50).optional()
|
|
6544
6584
|
}).passthrough();
|
|
6545
6585
|
function capUiStateKeys(data, ctx) {
|
|
6546
6586
|
if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
|
|
6547
|
-
ctx.addIssue({ code:
|
|
6587
|
+
ctx.addIssue({ code: z50.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
|
|
6548
6588
|
}
|
|
6549
6589
|
}
|
|
6550
6590
|
var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
|
|
6551
6591
|
|
|
6552
6592
|
// ../contract/src/run-requests.ts
|
|
6553
|
-
import { z as
|
|
6554
|
-
var queuedMessagePatchSchema =
|
|
6555
|
-
text:
|
|
6556
|
-
images:
|
|
6593
|
+
import { z as z51 } from "zod";
|
|
6594
|
+
var queuedMessagePatchSchema = z51.object({
|
|
6595
|
+
text: z51.string().max(1e5).optional(),
|
|
6596
|
+
images: z51.array(attachmentInputSchema).max(4).optional()
|
|
6557
6597
|
}).refine((m) => m.text !== void 0 || m.images !== void 0, {
|
|
6558
6598
|
message: "message edit needs text or attachments"
|
|
6559
6599
|
});
|
|
6560
|
-
var continueSchema =
|
|
6561
|
-
text:
|
|
6562
|
-
images:
|
|
6600
|
+
var continueSchema = z51.object({
|
|
6601
|
+
text: z51.string().max(1e5, "must be at most 100000 characters").optional(),
|
|
6602
|
+
images: z51.array(attachmentInputSchema).max(4).optional(),
|
|
6563
6603
|
runner: runnerSchema.optional(),
|
|
6564
|
-
model:
|
|
6604
|
+
model: z51.string().max(200).optional(),
|
|
6565
6605
|
/** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
|
|
6566
|
-
effort:
|
|
6606
|
+
effort: z51.string().max(32).optional()
|
|
6567
6607
|
});
|
|
6568
|
-
var archiveSchema =
|
|
6569
|
-
archived:
|
|
6608
|
+
var archiveSchema = z51.object({
|
|
6609
|
+
archived: z51.boolean().optional()
|
|
6570
6610
|
});
|
|
6571
|
-
var openInSchema =
|
|
6611
|
+
var openInSchema = z51.object({
|
|
6572
6612
|
// A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
|
|
6573
|
-
target:
|
|
6574
|
-
path:
|
|
6613
|
+
target: z51.string().trim().min(1, "target required").max(200),
|
|
6614
|
+
path: z51.string().max(1e3).optional()
|
|
6575
6615
|
});
|
|
6576
6616
|
|
|
6577
6617
|
// ../contract/src/query-requests.ts
|
|
6578
|
-
import { z as
|
|
6579
|
-
var queryValue =
|
|
6580
|
-
var refreshQuery =
|
|
6581
|
-
var waitQuery =
|
|
6582
|
-
var queryRunnerSchema =
|
|
6583
|
-
var modelDiscoveryQuerySchema =
|
|
6584
|
-
var strictRefreshQuerySchema =
|
|
6585
|
-
var browseQuerySchema =
|
|
6586
|
-
var worktreeFilesQuerySchema =
|
|
6587
|
-
var commitQuerySchema =
|
|
6588
|
-
var fileTextQuerySchema =
|
|
6589
|
-
path:
|
|
6618
|
+
import { z as z52 } from "zod";
|
|
6619
|
+
var queryValue = z52.union([z52.string(), z52.array(z52.string()).transform((v) => v[0])]).optional();
|
|
6620
|
+
var refreshQuery = z52.object({ refresh: queryValue });
|
|
6621
|
+
var waitQuery = z52.object({ wait: queryValue });
|
|
6622
|
+
var queryRunnerSchema = z52.union([z52.string(), z52.array(z52.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
|
|
6623
|
+
var modelDiscoveryQuerySchema = z52.object({ runner: queryRunnerSchema, profileId: z52.string().max(64).optional() });
|
|
6624
|
+
var strictRefreshQuerySchema = z52.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6625
|
+
var browseQuerySchema = z52.object({ path: queryValue, showHidden: queryValue });
|
|
6626
|
+
var worktreeFilesQuerySchema = z52.object({ path: queryValue, raw: queryValue });
|
|
6627
|
+
var commitQuerySchema = z52.object({ structured: queryValue });
|
|
6628
|
+
var fileTextQuerySchema = z52.object({
|
|
6629
|
+
path: z52.union([z52.string(), z52.array(z52.string()).transform((v) => v[0])]).pipe(z52.string().refine(isRepoRelativePath, "a path inside the repository"))
|
|
6590
6630
|
});
|
|
6591
6631
|
|
|
6592
6632
|
// ../contract/src/github-requests.ts
|
|
6593
|
-
import { z as
|
|
6594
|
-
var mergeNumberParams =
|
|
6595
|
-
var prChangesParams =
|
|
6596
|
-
var prChangesQuery =
|
|
6597
|
-
var mergeBodySchema =
|
|
6598
|
-
method:
|
|
6599
|
-
expectedHeadSha:
|
|
6600
|
-
overrideRules:
|
|
6633
|
+
import { z as z53 } from "zod";
|
|
6634
|
+
var mergeNumberParams = z53.object({ number: z53.coerce.number().int().positive() });
|
|
6635
|
+
var prChangesParams = z53.object({ number: z53.coerce.number().int().positive().safe() });
|
|
6636
|
+
var prChangesQuery = z53.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
6637
|
+
var mergeBodySchema = z53.object({
|
|
6638
|
+
method: z53.enum(["merge", "squash", "rebase"]),
|
|
6639
|
+
expectedHeadSha: z53.string().regex(/^[0-9a-f]{40}$/),
|
|
6640
|
+
overrideRules: z53.boolean().optional().default(false)
|
|
6601
6641
|
}).strict();
|
|
6602
|
-
var githubChecksQuerySchema =
|
|
6603
|
-
var githubRefsQuerySchema =
|
|
6642
|
+
var githubChecksQuerySchema = z53.object({ prs: z53.string().min(1) });
|
|
6643
|
+
var githubRefsQuerySchema = z53.object({ prs: z53.string().optional(), issues: z53.string().optional() });
|
|
6604
6644
|
|
|
6605
6645
|
// ../contract/src/repo-requests.ts
|
|
6606
|
-
import { z as
|
|
6607
|
-
var gitCommitSchema =
|
|
6608
|
-
message:
|
|
6646
|
+
import { z as z54 } from "zod";
|
|
6647
|
+
var gitCommitSchema = z54.object({
|
|
6648
|
+
message: z54.string().trim().min(1, "must not be empty").max(5e3)
|
|
6609
6649
|
});
|
|
6610
|
-
var reclaimWorktreeBodySchema =
|
|
6611
|
-
discardWork:
|
|
6650
|
+
var reclaimWorktreeBodySchema = z54.object({
|
|
6651
|
+
discardWork: z54.boolean().optional()
|
|
6612
6652
|
});
|
|
6613
|
-
var reclaimBodySchema =
|
|
6614
|
-
|
|
6615
|
-
discardWork:
|
|
6616
|
-
runIds:
|
|
6653
|
+
var reclaimBodySchema = z54.union([
|
|
6654
|
+
z54.object({
|
|
6655
|
+
discardWork: z54.literal(true),
|
|
6656
|
+
runIds: z54.array(z54.string().min(1)).min(1)
|
|
6617
6657
|
}),
|
|
6618
|
-
|
|
6619
|
-
discardWork:
|
|
6658
|
+
z54.object({
|
|
6659
|
+
discardWork: z54.literal(false).optional()
|
|
6620
6660
|
})
|
|
6621
6661
|
]);
|
|
6622
|
-
var repoBranchSchema =
|
|
6623
|
-
name:
|
|
6624
|
-
from:
|
|
6662
|
+
var repoBranchSchema = z54.object({
|
|
6663
|
+
name: z54.string().trim().min(1).max(200),
|
|
6664
|
+
from: z54.string().trim().min(1).max(200).optional()
|
|
6625
6665
|
});
|
|
6626
|
-
var reclaimRunParamsSchema =
|
|
6666
|
+
var reclaimRunParamsSchema = z54.object({ runId: z54.string().min(1) });
|
|
6627
6667
|
|
|
6628
6668
|
// ../contract/src/config-requests.ts
|
|
6629
|
-
import { z as
|
|
6669
|
+
import { z as z55 } from "zod";
|
|
6630
6670
|
var setConfigSchema = setConfigInputSchema.extend({
|
|
6631
|
-
systemPrompt:
|
|
6671
|
+
systemPrompt: z55.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
|
|
6632
6672
|
});
|
|
6633
|
-
var setAgentConfigSchema =
|
|
6634
|
-
content:
|
|
6635
|
-
version:
|
|
6673
|
+
var setAgentConfigSchema = z55.object({
|
|
6674
|
+
content: z55.string().max(2e6),
|
|
6675
|
+
version: z55.string().nullable()
|
|
6636
6676
|
});
|
|
6637
6677
|
|
|
6638
6678
|
// ../contract/src/workflow-file.ts
|
|
6639
|
-
import { z as
|
|
6640
|
-
var workflowFileSchema =
|
|
6641
|
-
name:
|
|
6642
|
-
description:
|
|
6643
|
-
steps:
|
|
6644
|
-
skills:
|
|
6679
|
+
import { z as z56 } from "zod";
|
|
6680
|
+
var workflowFileSchema = z56.object({
|
|
6681
|
+
name: z56.string().min(1),
|
|
6682
|
+
description: z56.string().optional(),
|
|
6683
|
+
steps: z56.array(workflowStepDefSchema).min(1).optional(),
|
|
6684
|
+
skills: z56.array(z56.string().trim().min(1)).min(1).optional()
|
|
6645
6685
|
}).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
|
|
6646
6686
|
message: 'a workflow lists either "steps" or "skills", not both'
|
|
6647
6687
|
});
|
|
6648
6688
|
|
|
6649
6689
|
// ../contract/src/reports.ts
|
|
6650
|
-
import { z as
|
|
6690
|
+
import { z as z57 } from "zod";
|
|
6651
6691
|
var REPORTS_QUERY_MAX = 1e3;
|
|
6652
|
-
var cursorSchema =
|
|
6653
|
-
var reportsQuerySchema =
|
|
6654
|
-
q:
|
|
6692
|
+
var cursorSchema = z57.string().min(1).max(1024);
|
|
6693
|
+
var reportsQuerySchema = z57.object({
|
|
6694
|
+
q: z57.string().max(REPORTS_QUERY_MAX).optional(),
|
|
6655
6695
|
before: cursorSchema.optional(),
|
|
6656
|
-
limit:
|
|
6696
|
+
limit: z57.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
|
|
6657
6697
|
}).strict();
|
|
6658
|
-
var reportSchema =
|
|
6659
|
-
id:
|
|
6660
|
-
runId:
|
|
6661
|
-
name:
|
|
6662
|
-
title:
|
|
6663
|
-
createdAt:
|
|
6664
|
-
size:
|
|
6665
|
-
taskTitle:
|
|
6698
|
+
var reportSchema = z57.object({
|
|
6699
|
+
id: z57.uuid(),
|
|
6700
|
+
runId: z57.uuid(),
|
|
6701
|
+
name: z57.string(),
|
|
6702
|
+
title: z57.string(),
|
|
6703
|
+
createdAt: z57.iso.datetime(),
|
|
6704
|
+
size: z57.number().int().nonnegative(),
|
|
6705
|
+
taskTitle: z57.string(),
|
|
6666
6706
|
taskStatus: runStatusSchema
|
|
6667
6707
|
}).strict();
|
|
6668
|
-
var reportsResponseSchema =
|
|
6669
|
-
reports:
|
|
6708
|
+
var reportsResponseSchema = z57.object({
|
|
6709
|
+
reports: z57.array(reportSchema),
|
|
6670
6710
|
nextCursor: cursorSchema.nullable(),
|
|
6671
6711
|
// Counts all matching cached rows with readable source summaries before page content checks.
|
|
6672
6712
|
// A missing-content row dropped while filling this page can lower total on the next request.
|
|
6673
|
-
total:
|
|
6713
|
+
total: z57.number().int().nonnegative()
|
|
6674
6714
|
}).strict();
|
|
6675
|
-
var reportsStateSchema =
|
|
6676
|
-
epoch:
|
|
6677
|
-
generation:
|
|
6678
|
-
metadataGeneration:
|
|
6715
|
+
var reportsStateSchema = z57.object({
|
|
6716
|
+
epoch: z57.uuid(),
|
|
6717
|
+
generation: z57.number().int().nonnegative(),
|
|
6718
|
+
metadataGeneration: z57.number().int().nonnegative()
|
|
6679
6719
|
}).strict();
|
|
6680
|
-
var reportsMetadataSchema =
|
|
6681
|
-
runId:
|
|
6682
|
-
taskTitle:
|
|
6720
|
+
var reportsMetadataSchema = z57.object({
|
|
6721
|
+
runId: z57.uuid(),
|
|
6722
|
+
taskTitle: z57.string(),
|
|
6683
6723
|
taskStatus: runStatusSchema
|
|
6684
6724
|
}).strict();
|
|
6685
|
-
var reportsFrameSchema =
|
|
6686
|
-
reportsStateSchema.extend({ type:
|
|
6687
|
-
reportsStateSchema.extend({ type:
|
|
6688
|
-
reportsStateSchema.extend({ type:
|
|
6725
|
+
var reportsFrameSchema = z57.discriminatedUnion("type", [
|
|
6726
|
+
reportsStateSchema.extend({ type: z57.literal("snapshot") }),
|
|
6727
|
+
reportsStateSchema.extend({ type: z57.literal("content") }),
|
|
6728
|
+
reportsStateSchema.extend({ type: z57.literal("metadata"), runs: z57.array(reportsMetadataSchema) })
|
|
6689
6729
|
]);
|
|
6690
6730
|
|
|
6691
6731
|
// ../contract/src/report-title.ts
|
|
@@ -6707,118 +6747,118 @@ function controlLocation(control, separator = " \u2192 ") {
|
|
|
6707
6747
|
}
|
|
6708
6748
|
|
|
6709
6749
|
// ../contract/src/home-recovery.ts
|
|
6710
|
-
import { z as
|
|
6750
|
+
import { z as z58 } from "zod";
|
|
6711
6751
|
var HOME_FILE_PATTERN = /^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|hosts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock)|mcp-tokens\/[a-zA-Z0-9-]+\.json)$/;
|
|
6712
|
-
var homeFileSchema =
|
|
6713
|
-
var recoveryFile =
|
|
6752
|
+
var homeFileSchema = z58.string().regex(HOME_FILE_PATTERN);
|
|
6753
|
+
var recoveryFile = z58.object({
|
|
6714
6754
|
file: homeFileSchema,
|
|
6715
|
-
detectedAt:
|
|
6716
|
-
canRestore:
|
|
6755
|
+
detectedAt: z58.iso.datetime(),
|
|
6756
|
+
canRestore: z58.boolean()
|
|
6717
6757
|
});
|
|
6718
6758
|
var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
|
|
6719
|
-
var homeRecoveryFileSchema =
|
|
6720
|
-
recoveryFile.extend({ reason:
|
|
6721
|
-
recoveryFile.extend({ reason:
|
|
6722
|
-
recoveryFile.extend({ reason:
|
|
6759
|
+
var homeRecoveryFileSchema = z58.discriminatedUnion("reason", [
|
|
6760
|
+
recoveryFile.extend({ reason: z58.literal("reset") }),
|
|
6761
|
+
recoveryFile.extend({ reason: z58.literal("outside-write") }),
|
|
6762
|
+
recoveryFile.extend({ reason: z58.literal("legacy-change"), canImport: z58.boolean() })
|
|
6723
6763
|
]);
|
|
6724
|
-
var homeRecoverySchema =
|
|
6764
|
+
var homeRecoverySchema = z58.object({ files: z58.array(homeRecoveryFileSchema) });
|
|
6725
6765
|
function filterHomeRecoveryReasons(value, reasons) {
|
|
6726
6766
|
if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
|
|
6727
6767
|
return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
|
|
6728
6768
|
}
|
|
6729
|
-
var homeRecoveryReaderSchema =
|
|
6769
|
+
var homeRecoveryReaderSchema = z58.preprocess(
|
|
6730
6770
|
(value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
|
|
6731
6771
|
homeRecoverySchema
|
|
6732
6772
|
);
|
|
6733
|
-
var homeRecoveryActionSchema =
|
|
6773
|
+
var homeRecoveryActionSchema = z58.object({ file: homeFileSchema, detectedAt: z58.iso.datetime() }).strict();
|
|
6734
6774
|
|
|
6735
6775
|
// ../contract/src/runner-skills.ts
|
|
6736
|
-
import { z as
|
|
6737
|
-
var runnerSkillScopeSchema =
|
|
6738
|
-
var runnerSkillsQuerySchema =
|
|
6776
|
+
import { z as z59 } from "zod";
|
|
6777
|
+
var runnerSkillScopeSchema = z59.enum(["repo", "user", "system", "other"]);
|
|
6778
|
+
var runnerSkillsQuerySchema = z59.object({
|
|
6739
6779
|
runner: queryRunnerSchema,
|
|
6740
|
-
account:
|
|
6741
|
-
refresh:
|
|
6780
|
+
account: z59.string().min(1).max(64).optional(),
|
|
6781
|
+
refresh: z59.literal("1").optional()
|
|
6742
6782
|
});
|
|
6743
|
-
var runnerSkillSchema =
|
|
6744
|
-
id:
|
|
6745
|
-
name:
|
|
6746
|
-
description:
|
|
6783
|
+
var runnerSkillSchema = z59.object({
|
|
6784
|
+
id: z59.string(),
|
|
6785
|
+
name: z59.string(),
|
|
6786
|
+
description: z59.string().optional(),
|
|
6747
6787
|
scope: runnerSkillScopeSchema.optional(),
|
|
6748
|
-
plugin:
|
|
6749
|
-
path:
|
|
6788
|
+
plugin: z59.string().optional(),
|
|
6789
|
+
path: z59.string().optional()
|
|
6750
6790
|
});
|
|
6751
|
-
var runnerSkillProblemSchema =
|
|
6752
|
-
var runnerSkillListSchema =
|
|
6791
|
+
var runnerSkillProblemSchema = z59.object({ message: z59.string(), path: z59.string().optional() });
|
|
6792
|
+
var runnerSkillListSchema = z59.object({
|
|
6753
6793
|
runner: runnerSchema,
|
|
6754
|
-
skills:
|
|
6755
|
-
problems:
|
|
6756
|
-
source:
|
|
6757
|
-
reason:
|
|
6794
|
+
skills: z59.array(runnerSkillSchema),
|
|
6795
|
+
problems: z59.array(runnerSkillProblemSchema),
|
|
6796
|
+
source: z59.enum(["live", "cache", "unavailable"]),
|
|
6797
|
+
reason: z59.string().optional()
|
|
6758
6798
|
});
|
|
6759
6799
|
|
|
6760
6800
|
// ../contract/src/runner-install.ts
|
|
6761
|
-
import { z as
|
|
6762
|
-
var runnerInstallParamsSchema =
|
|
6763
|
-
var runnerInstallActionSchema =
|
|
6764
|
-
var runnerInstallPhaseSchema =
|
|
6765
|
-
var runnerInstallStatusSchema =
|
|
6766
|
-
supported:
|
|
6767
|
-
installedVersion:
|
|
6768
|
-
latestVersion:
|
|
6769
|
-
updateAvailable:
|
|
6801
|
+
import { z as z60 } from "zod";
|
|
6802
|
+
var runnerInstallParamsSchema = z60.object({ runner: runnerSchema });
|
|
6803
|
+
var runnerInstallActionSchema = z60.object({ action: z60.enum(["check", "install", "update", "remove"]) });
|
|
6804
|
+
var runnerInstallPhaseSchema = z60.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
|
|
6805
|
+
var runnerInstallStatusSchema = z60.object({
|
|
6806
|
+
supported: z60.boolean(),
|
|
6807
|
+
installedVersion: z60.string().nullable(),
|
|
6808
|
+
latestVersion: z60.string().nullable(),
|
|
6809
|
+
updateAvailable: z60.boolean(),
|
|
6770
6810
|
phase: runnerInstallPhaseSchema,
|
|
6771
|
-
error:
|
|
6811
|
+
error: z60.string().nullable()
|
|
6772
6812
|
});
|
|
6773
6813
|
|
|
6774
6814
|
// ../contract/src/automation-tool.ts
|
|
6775
|
-
import { z as
|
|
6815
|
+
import { z as z61 } from "zod";
|
|
6776
6816
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
6777
|
-
var id =
|
|
6778
|
-
var automationToolRequestSchema =
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6817
|
+
var id = z61.string().min(1).max(100);
|
|
6818
|
+
var automationToolRequestSchema = z61.discriminatedUnion("action", [
|
|
6819
|
+
z61.object({ action: z61.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
6820
|
+
z61.object({ action: z61.literal("show"), id }).strict(),
|
|
6821
|
+
z61.object({ action: z61.literal("preview"), id }).strict(),
|
|
6822
|
+
z61.object({ action: z61.literal("enable"), id, explicit: z61.boolean().optional() }).strict()
|
|
6783
6823
|
]);
|
|
6784
|
-
var automationToolAnswerSchema =
|
|
6785
|
-
|
|
6786
|
-
ok:
|
|
6824
|
+
var automationToolAnswerSchema = z61.union([
|
|
6825
|
+
z61.object({
|
|
6826
|
+
ok: z61.literal(true),
|
|
6787
6827
|
automation: storedAutomationDefinitionSchema,
|
|
6788
|
-
url:
|
|
6789
|
-
next_run_at:
|
|
6790
|
-
preview:
|
|
6828
|
+
url: z61.string().optional(),
|
|
6829
|
+
next_run_at: z61.string().optional(),
|
|
6830
|
+
preview: z61.object({ matches: z61.number().int().nonnegative(), truncated: z61.boolean() }).optional()
|
|
6791
6831
|
}),
|
|
6792
|
-
|
|
6832
|
+
z61.object({ ok: z61.literal(false), code: z61.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z61.string() })
|
|
6793
6833
|
]);
|
|
6794
6834
|
|
|
6795
6835
|
// ../contract/src/agent-tools.ts
|
|
6796
|
-
import { z as
|
|
6797
|
-
var agentToolResultSchema =
|
|
6798
|
-
content:
|
|
6799
|
-
isError:
|
|
6800
|
-
details:
|
|
6836
|
+
import { z as z62 } from "zod";
|
|
6837
|
+
var agentToolResultSchema = z62.object({
|
|
6838
|
+
content: z62.array(z62.object({ type: z62.literal("text"), text: z62.string() })),
|
|
6839
|
+
isError: z62.boolean().optional(),
|
|
6840
|
+
details: z62.unknown()
|
|
6801
6841
|
});
|
|
6802
|
-
var agentToolMetadataSchema =
|
|
6803
|
-
timeoutMs:
|
|
6842
|
+
var agentToolMetadataSchema = z62.object({
|
|
6843
|
+
timeoutMs: z62.number().positive(),
|
|
6804
6844
|
unavailable: agentToolResultSchema,
|
|
6805
|
-
name:
|
|
6806
|
-
description:
|
|
6807
|
-
trigger:
|
|
6808
|
-
label:
|
|
6809
|
-
inputSchema:
|
|
6845
|
+
name: z62.string(),
|
|
6846
|
+
description: z62.string(),
|
|
6847
|
+
trigger: z62.string(),
|
|
6848
|
+
label: z62.string(),
|
|
6849
|
+
inputSchema: z62.object({ type: z62.literal("object"), properties: z62.record(z62.string(), z62.unknown()).optional() }).catchall(z62.unknown())
|
|
6810
6850
|
});
|
|
6811
|
-
var agentToolCatalogSchema =
|
|
6851
|
+
var agentToolCatalogSchema = z62.object({ tools: z62.array(agentToolMetadataSchema), instructions: z62.string() });
|
|
6812
6852
|
|
|
6813
6853
|
// ../contract/src/hosts.ts
|
|
6814
|
-
import { z as
|
|
6854
|
+
import { z as z63 } from "zod";
|
|
6815
6855
|
var HOST_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
6816
6856
|
var LOCAL_HOST_ID = "local";
|
|
6817
|
-
var RESERVED_HOST_ROUTE_IDS = ["projects", "runs-index", "runs-search"];
|
|
6857
|
+
var RESERVED_HOST_ROUTE_IDS = ["projects", "runs-index", "runs-search", "signals"];
|
|
6818
6858
|
var RESERVED_HOST_ROUTE_ID_SET = new Set(RESERVED_HOST_ROUTE_IDS);
|
|
6819
6859
|
var CONTROL_CHARS_PATTERN = /[\u0000-\u001f\u007f]/;
|
|
6820
6860
|
var INVALID_SSH_ALIAS_CHARS = /[\s*?![\]\\'"`]/;
|
|
6821
|
-
var hostIdSchema =
|
|
6861
|
+
var hostIdSchema = z63.string().regex(HOST_ID_PATTERN, "host id must match ^[a-z0-9][a-z0-9-]{0,31}$").refine((value) => value !== LOCAL_HOST_ID, {
|
|
6822
6862
|
message: `host id "${LOCAL_HOST_ID}" is reserved`
|
|
6823
6863
|
});
|
|
6824
6864
|
var createHostIdSchema = hostIdSchema.superRefine((value, ctx) => {
|
|
@@ -6829,17 +6869,17 @@ var createHostIdSchema = hostIdSchema.superRefine((value, ctx) => {
|
|
|
6829
6869
|
});
|
|
6830
6870
|
}
|
|
6831
6871
|
});
|
|
6832
|
-
var hostLabelSchema =
|
|
6872
|
+
var hostLabelSchema = z63.string().trim().min(1, "label must not be empty").max(255, "label must be at most 255 characters").refine((value) => !CONTROL_CHARS_PATTERN.test(value), {
|
|
6833
6873
|
message: "label must not contain control characters"
|
|
6834
6874
|
});
|
|
6835
|
-
var hostSshAliasSchema =
|
|
6875
|
+
var hostSshAliasSchema = z63.string().min(1, "sshAlias must not be empty").max(255, "sshAlias must be at most 255 characters").refine((value) => !CONTROL_CHARS_PATTERN.test(value), {
|
|
6836
6876
|
message: "sshAlias must not contain control characters"
|
|
6837
6877
|
}).refine((value) => !INVALID_SSH_ALIAS_CHARS.test(value), {
|
|
6838
6878
|
message: "sshAlias must not contain whitespace, quotes, or wildcard characters"
|
|
6839
6879
|
}).refine((value) => !value.startsWith("-"), {
|
|
6840
6880
|
message: 'sshAlias must not start with "-"'
|
|
6841
6881
|
});
|
|
6842
|
-
var hostPortSchema =
|
|
6882
|
+
var hostPortSchema = z63.number().int("port must be an integer").min(1, "port must be between 1 and 65535").max(65535, "port must be between 1 and 65535");
|
|
6843
6883
|
function slugHostId(sshAlias) {
|
|
6844
6884
|
return sshAlias.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32).replace(/-+$/g, "");
|
|
6845
6885
|
}
|
|
@@ -6855,19 +6895,19 @@ var HOST_STATES = [
|
|
|
6855
6895
|
"paused",
|
|
6856
6896
|
"cannot-persist"
|
|
6857
6897
|
];
|
|
6858
|
-
var hostStateSchema =
|
|
6898
|
+
var hostStateSchema = z63.enum(HOST_STATES);
|
|
6859
6899
|
var HOST_NOT_CONNECTED_REASON = "not connected yet";
|
|
6860
|
-
var hostEntrySchema =
|
|
6900
|
+
var hostEntrySchema = z63.object({
|
|
6861
6901
|
id: hostIdSchema,
|
|
6862
6902
|
label: hostLabelSchema,
|
|
6863
|
-
kind:
|
|
6903
|
+
kind: z63.literal("ssh"),
|
|
6864
6904
|
sshAlias: hostSshAliasSchema,
|
|
6865
|
-
installId:
|
|
6905
|
+
installId: z63.string().min(1).max(128).optional(),
|
|
6866
6906
|
port: hostPortSchema.optional(),
|
|
6867
|
-
addedAt:
|
|
6907
|
+
addedAt: z63.iso.datetime()
|
|
6868
6908
|
});
|
|
6869
|
-
var hostsRegistryFileSchema =
|
|
6870
|
-
hosts:
|
|
6909
|
+
var hostsRegistryFileSchema = z63.object({
|
|
6910
|
+
hosts: z63.array(hostEntrySchema)
|
|
6871
6911
|
}).superRefine((data, ctx) => {
|
|
6872
6912
|
const seen = /* @__PURE__ */ new Set();
|
|
6873
6913
|
for (const [index, entry] of data.hosts.entries()) {
|
|
@@ -6881,26 +6921,26 @@ var hostsRegistryFileSchema = z62.object({
|
|
|
6881
6921
|
seen.add(entry.id);
|
|
6882
6922
|
}
|
|
6883
6923
|
});
|
|
6884
|
-
var hostSummarySchema =
|
|
6924
|
+
var hostSummarySchema = z63.object({
|
|
6885
6925
|
id: hostIdSchema,
|
|
6886
6926
|
label: hostLabelSchema,
|
|
6887
6927
|
state: hostStateSchema,
|
|
6888
|
-
reason:
|
|
6889
|
-
kind:
|
|
6928
|
+
reason: z63.string().optional(),
|
|
6929
|
+
kind: z63.literal("ssh").optional(),
|
|
6890
6930
|
sshAlias: hostSshAliasSchema.optional(),
|
|
6891
|
-
installId:
|
|
6931
|
+
installId: z63.string().min(1).max(128).optional(),
|
|
6892
6932
|
port: hostPortSchema.optional(),
|
|
6893
|
-
addedAt:
|
|
6933
|
+
addedAt: z63.iso.datetime().optional()
|
|
6894
6934
|
});
|
|
6895
|
-
var hostsListResponseSchema =
|
|
6896
|
-
hosts:
|
|
6897
|
-
warning:
|
|
6898
|
-
sshSuggestions:
|
|
6935
|
+
var hostsListResponseSchema = z63.object({
|
|
6936
|
+
hosts: z63.array(hostSummarySchema),
|
|
6937
|
+
warning: z63.string().optional(),
|
|
6938
|
+
sshSuggestions: z63.array(hostSshAliasSchema).optional()
|
|
6899
6939
|
});
|
|
6900
|
-
var hostRouteParamsSchema =
|
|
6940
|
+
var hostRouteParamsSchema = z63.object({
|
|
6901
6941
|
id: hostIdSchema
|
|
6902
6942
|
});
|
|
6903
|
-
var createHostInputSchema =
|
|
6943
|
+
var createHostInputSchema = z63.object({
|
|
6904
6944
|
sshAlias: hostSshAliasSchema,
|
|
6905
6945
|
id: createHostIdSchema.optional(),
|
|
6906
6946
|
label: hostLabelSchema.optional(),
|
|
@@ -6917,7 +6957,7 @@ var createHostInputSchema = z62.object({
|
|
|
6917
6957
|
});
|
|
6918
6958
|
}
|
|
6919
6959
|
});
|
|
6920
|
-
var updateHostInputSchema =
|
|
6960
|
+
var updateHostInputSchema = z63.object({
|
|
6921
6961
|
label: hostLabelSchema.optional(),
|
|
6922
6962
|
sshAlias: hostSshAliasSchema.optional(),
|
|
6923
6963
|
port: hostPortSchema.nullable().optional()
|
|
@@ -6925,96 +6965,96 @@ var updateHostInputSchema = z62.object({
|
|
|
6925
6965
|
(data) => data.label !== void 0 || data.sshAlias !== void 0 || data.port !== void 0,
|
|
6926
6966
|
{ message: "at least one of label, sshAlias, or port must be provided" }
|
|
6927
6967
|
);
|
|
6928
|
-
var hostResponseSchema =
|
|
6968
|
+
var hostResponseSchema = z63.object({
|
|
6929
6969
|
host: hostSummarySchema
|
|
6930
6970
|
});
|
|
6931
|
-
var removeHostResponseSchema =
|
|
6932
|
-
removed:
|
|
6971
|
+
var removeHostResponseSchema = z63.object({
|
|
6972
|
+
removed: z63.literal(true),
|
|
6933
6973
|
id: hostIdSchema
|
|
6934
6974
|
});
|
|
6935
|
-
var hostStarterInstallIdSchema =
|
|
6975
|
+
var hostStarterInstallIdSchema = z63.string().regex(
|
|
6936
6976
|
/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,
|
|
6937
6977
|
"starterInstallId must be 1\u2013128 alphanumeric, dot, underscore, or hyphen characters"
|
|
6938
6978
|
);
|
|
6939
|
-
var hostServerStartMethodSchema =
|
|
6940
|
-
var hostServerClaimPhaseSchema =
|
|
6941
|
-
var hostServerClaimSummarySchema =
|
|
6942
|
-
pid:
|
|
6979
|
+
var hostServerStartMethodSchema = z63.enum(["systemd-user", "detached"]);
|
|
6980
|
+
var hostServerClaimPhaseSchema = z63.enum(["starting", "running"]);
|
|
6981
|
+
var hostServerClaimSummarySchema = z63.object({
|
|
6982
|
+
pid: z63.number().int().positive(),
|
|
6943
6983
|
phase: hostServerClaimPhaseSchema,
|
|
6944
6984
|
port: hostPortSchema.nullable(),
|
|
6945
|
-
version:
|
|
6985
|
+
version: z63.string().min(1),
|
|
6946
6986
|
starterInstallId: hostStarterInstallIdSchema,
|
|
6947
|
-
managedByStarter:
|
|
6987
|
+
managedByStarter: z63.boolean().optional()
|
|
6948
6988
|
});
|
|
6949
|
-
var hostServerLeaseSummarySchema =
|
|
6950
|
-
pid:
|
|
6989
|
+
var hostServerLeaseSummarySchema = z63.object({
|
|
6990
|
+
pid: z63.number().int().positive(),
|
|
6951
6991
|
port: hostPortSchema,
|
|
6952
|
-
instance:
|
|
6953
|
-
installId:
|
|
6954
|
-
});
|
|
6955
|
-
var installIdFieldSchema =
|
|
6956
|
-
var hostServerEnsureResultSchema =
|
|
6957
|
-
|
|
6958
|
-
status:
|
|
6959
|
-
ownership:
|
|
6992
|
+
instance: z63.string(),
|
|
6993
|
+
installId: z63.string().min(1).max(128)
|
|
6994
|
+
});
|
|
6995
|
+
var installIdFieldSchema = z63.string().min(1).max(128);
|
|
6996
|
+
var hostServerEnsureResultSchema = z63.discriminatedUnion("status", [
|
|
6997
|
+
z63.object({
|
|
6998
|
+
status: z63.literal("ready"),
|
|
6999
|
+
ownership: z63.enum(["managed", "unmanaged"]),
|
|
6960
7000
|
port: hostPortSchema,
|
|
6961
|
-
pid:
|
|
6962
|
-
version:
|
|
7001
|
+
pid: z63.number().int().positive().optional(),
|
|
7002
|
+
version: z63.string().min(1).optional(),
|
|
6963
7003
|
starterInstallId: hostStarterInstallIdSchema.optional(),
|
|
6964
|
-
managedByStarter:
|
|
7004
|
+
managedByStarter: z63.boolean().optional(),
|
|
6965
7005
|
startMethod: hostServerStartMethodSchema.optional(),
|
|
6966
7006
|
installId: installIdFieldSchema.optional()
|
|
6967
7007
|
}),
|
|
6968
|
-
|
|
6969
|
-
status:
|
|
7008
|
+
z63.object({
|
|
7009
|
+
status: z63.literal("paused"),
|
|
6970
7010
|
starterInstallId: hostStarterInstallIdSchema,
|
|
6971
7011
|
installId: installIdFieldSchema.optional()
|
|
6972
7012
|
}),
|
|
6973
|
-
|
|
6974
|
-
status:
|
|
7013
|
+
z63.object({
|
|
7014
|
+
status: z63.literal("unreachable"),
|
|
6975
7015
|
port: hostPortSchema,
|
|
6976
|
-
reason:
|
|
7016
|
+
reason: z63.string().min(1),
|
|
6977
7017
|
installId: installIdFieldSchema.optional()
|
|
6978
7018
|
}),
|
|
6979
|
-
|
|
6980
|
-
status:
|
|
6981
|
-
ports:
|
|
6982
|
-
reason:
|
|
7019
|
+
z63.object({
|
|
7020
|
+
status: z63.literal("several-servers"),
|
|
7021
|
+
ports: z63.array(hostPortSchema).min(2),
|
|
7022
|
+
reason: z63.string().min(1),
|
|
6983
7023
|
installId: installIdFieldSchema.optional()
|
|
6984
7024
|
}),
|
|
6985
|
-
|
|
6986
|
-
status:
|
|
6987
|
-
operatorCommand:
|
|
6988
|
-
reason:
|
|
7025
|
+
z63.object({
|
|
7026
|
+
status: z63.literal("cannot-persist"),
|
|
7027
|
+
operatorCommand: z63.string().min(1),
|
|
7028
|
+
reason: z63.string().min(1),
|
|
6989
7029
|
installId: installIdFieldSchema.optional()
|
|
6990
7030
|
}),
|
|
6991
|
-
|
|
6992
|
-
status:
|
|
6993
|
-
code:
|
|
6994
|
-
error:
|
|
6995
|
-
dbPath:
|
|
7031
|
+
z63.object({
|
|
7032
|
+
status: z63.literal("error"),
|
|
7033
|
+
code: z63.enum(["unreadable-store", "unreadable-leases", "timeout", "start-failed", "invalid-input"]),
|
|
7034
|
+
error: z63.string().min(1),
|
|
7035
|
+
dbPath: z63.string().min(1).optional()
|
|
6996
7036
|
})
|
|
6997
7037
|
]);
|
|
6998
|
-
var hostServerStatusResultSchema =
|
|
6999
|
-
ok:
|
|
7000
|
-
version:
|
|
7001
|
-
installId:
|
|
7002
|
-
dbPath:
|
|
7003
|
-
paused:
|
|
7038
|
+
var hostServerStatusResultSchema = z63.object({
|
|
7039
|
+
ok: z63.literal(true),
|
|
7040
|
+
version: z63.string().min(1),
|
|
7041
|
+
installId: z63.string().min(1).max(128).nullable(),
|
|
7042
|
+
dbPath: z63.string().min(1),
|
|
7043
|
+
paused: z63.boolean(),
|
|
7004
7044
|
claim: hostServerClaimSummarySchema.nullable(),
|
|
7005
|
-
leases:
|
|
7006
|
-
state:
|
|
7045
|
+
leases: z63.array(hostServerLeaseSummarySchema),
|
|
7046
|
+
state: z63.enum(["ready", "starting", "paused", "stopped", "several-servers", "unreachable"])
|
|
7007
7047
|
});
|
|
7008
|
-
var hostServerStopResultSchema =
|
|
7009
|
-
ok:
|
|
7010
|
-
action:
|
|
7048
|
+
var hostServerStopResultSchema = z63.object({
|
|
7049
|
+
ok: z63.literal(true),
|
|
7050
|
+
action: z63.literal("stop"),
|
|
7011
7051
|
starterInstallId: hostStarterInstallIdSchema,
|
|
7012
|
-
paused:
|
|
7013
|
-
stopped:
|
|
7014
|
-
pid:
|
|
7052
|
+
paused: z63.literal(true),
|
|
7053
|
+
stopped: z63.boolean(),
|
|
7054
|
+
pid: z63.number().int().positive().optional(),
|
|
7015
7055
|
phase: hostServerClaimPhaseSchema.optional(),
|
|
7016
7056
|
port: hostPortSchema.nullable().optional(),
|
|
7017
|
-
reason:
|
|
7057
|
+
reason: z63.enum([
|
|
7018
7058
|
"stopped",
|
|
7019
7059
|
"already-exited",
|
|
7020
7060
|
"signal-failed",
|
|
@@ -7023,26 +7063,26 @@ var hostServerStopResultSchema = z62.object({
|
|
|
7023
7063
|
"unverifiable-process"
|
|
7024
7064
|
]).optional()
|
|
7025
7065
|
});
|
|
7026
|
-
var hostServerResumeResultSchema =
|
|
7027
|
-
ok:
|
|
7028
|
-
action:
|
|
7066
|
+
var hostServerResumeResultSchema = z63.object({
|
|
7067
|
+
ok: z63.literal(true),
|
|
7068
|
+
action: z63.literal("resume"),
|
|
7029
7069
|
starterInstallId: hostStarterInstallIdSchema,
|
|
7030
|
-
paused:
|
|
7031
|
-
wasPaused:
|
|
7032
|
-
});
|
|
7033
|
-
var hostServerInstallRuntimeResultSchema =
|
|
7034
|
-
ok:
|
|
7035
|
-
action:
|
|
7036
|
-
version:
|
|
7037
|
-
runtimeDir:
|
|
7038
|
-
alreadyInstalled:
|
|
7039
|
-
prunedVersions:
|
|
7040
|
-
});
|
|
7041
|
-
var hostServerActiveTasksResultSchema =
|
|
7042
|
-
ok:
|
|
7043
|
-
action:
|
|
7070
|
+
paused: z63.literal(false),
|
|
7071
|
+
wasPaused: z63.boolean()
|
|
7072
|
+
});
|
|
7073
|
+
var hostServerInstallRuntimeResultSchema = z63.object({
|
|
7074
|
+
ok: z63.literal(true),
|
|
7075
|
+
action: z63.literal("install-runtime"),
|
|
7076
|
+
version: z63.string().min(1),
|
|
7077
|
+
runtimeDir: z63.string().min(1),
|
|
7078
|
+
alreadyInstalled: z63.boolean(),
|
|
7079
|
+
prunedVersions: z63.array(z63.string())
|
|
7080
|
+
});
|
|
7081
|
+
var hostServerActiveTasksResultSchema = z63.object({
|
|
7082
|
+
ok: z63.literal(true),
|
|
7083
|
+
action: z63.literal("active-tasks"),
|
|
7044
7084
|
port: hostPortSchema,
|
|
7045
|
-
activeCount:
|
|
7085
|
+
activeCount: z63.number().int().min(0)
|
|
7046
7086
|
});
|
|
7047
7087
|
var HOST_GATEWAY_ERROR_CODES = [
|
|
7048
7088
|
"host-unreachable",
|
|
@@ -7055,97 +7095,114 @@ var HOST_GATEWAY_ERROR_CODES = [
|
|
|
7055
7095
|
"host-unexpected-redirect",
|
|
7056
7096
|
"host-nested-gateway-unsupported"
|
|
7057
7097
|
];
|
|
7058
|
-
var hostGatewayErrorCodeSchema =
|
|
7059
|
-
var hostGatewayErrorResponseSchema =
|
|
7098
|
+
var hostGatewayErrorCodeSchema = z63.enum(HOST_GATEWAY_ERROR_CODES);
|
|
7099
|
+
var hostGatewayErrorResponseSchema = z63.object({
|
|
7060
7100
|
code: hostGatewayErrorCodeSchema,
|
|
7061
|
-
error:
|
|
7101
|
+
error: z63.string().min(1)
|
|
7062
7102
|
});
|
|
7063
|
-
var hostProjectsEntrySchema =
|
|
7103
|
+
var hostProjectsEntrySchema = z63.object({
|
|
7064
7104
|
id: hostIdSchema,
|
|
7065
7105
|
label: hostLabelSchema,
|
|
7066
7106
|
state: hostStateSchema,
|
|
7067
|
-
projects:
|
|
7107
|
+
projects: z63.array(projectListEntrySchema).nullable()
|
|
7108
|
+
});
|
|
7109
|
+
var hostsProjectsResponseSchema = z63.object({
|
|
7110
|
+
local: z63.object({
|
|
7111
|
+
projects: z63.array(projectListEntrySchema),
|
|
7112
|
+
bootProject: z63.string().nullable()
|
|
7113
|
+
}),
|
|
7114
|
+
hosts: z63.array(hostProjectsEntrySchema),
|
|
7115
|
+
warning: z63.string().optional()
|
|
7068
7116
|
});
|
|
7069
|
-
var
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7117
|
+
var projectSignalsRecordSchema = z63.record(z63.string(), projectSignalSchema);
|
|
7118
|
+
var hostSignalsEntrySchema = z63.object({
|
|
7119
|
+
id: hostIdSchema,
|
|
7120
|
+
state: hostStateSchema,
|
|
7121
|
+
/** True when the host is connected, loaded, and not stale so omitted projects are idle. */
|
|
7122
|
+
known: z63.boolean(),
|
|
7123
|
+
/** Non-zero per-project counts when `known` is true; empty when `known` is false. */
|
|
7124
|
+
signals: projectSignalsRecordSchema
|
|
7125
|
+
});
|
|
7126
|
+
var hostsSignalsResponseSchema = z63.object({
|
|
7127
|
+
local: z63.object({
|
|
7128
|
+
known: z63.boolean(),
|
|
7129
|
+
signals: projectSignalsRecordSchema
|
|
7073
7130
|
}),
|
|
7074
|
-
hosts:
|
|
7075
|
-
warning:
|
|
7131
|
+
hosts: z63.array(hostSignalsEntrySchema),
|
|
7132
|
+
warning: z63.string().optional()
|
|
7076
7133
|
});
|
|
7077
7134
|
var hostRunIndexEntrySchema = runIndexEntrySchema.extend({
|
|
7078
7135
|
hostId: hostIdSchema
|
|
7079
7136
|
});
|
|
7080
|
-
var hostRunsIndexStateSchema =
|
|
7137
|
+
var hostRunsIndexStateSchema = z63.object({
|
|
7081
7138
|
id: hostIdSchema,
|
|
7082
7139
|
label: hostLabelSchema,
|
|
7083
7140
|
state: hostStateSchema,
|
|
7084
7141
|
/** True while the host is not connected and live-synced; cached rows may be behind the host. */
|
|
7085
|
-
stale:
|
|
7142
|
+
stale: z63.boolean(),
|
|
7086
7143
|
/** True once the main server has read the host's task index at least once since starting. */
|
|
7087
|
-
loaded:
|
|
7144
|
+
loaded: z63.boolean(),
|
|
7088
7145
|
/** Project ids on this host that hit `perProjectLimit` for archived root runs. */
|
|
7089
|
-
truncated:
|
|
7146
|
+
truncated: z63.array(z63.string()),
|
|
7090
7147
|
/** Cached PR/issue reference statuses per project id from the host's latest snapshot. */
|
|
7091
7148
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
7092
7149
|
/** Per-project archived window reported by the host's latest snapshot, when loaded. */
|
|
7093
|
-
perProjectLimit:
|
|
7150
|
+
perProjectLimit: z63.number().int().nonnegative().optional()
|
|
7094
7151
|
});
|
|
7095
|
-
var hostsRunsIndexQuerySchema =
|
|
7152
|
+
var hostsRunsIndexQuerySchema = z63.object({
|
|
7096
7153
|
/** When set, returns rows and state for that single saved host only. */
|
|
7097
7154
|
hostId: hostIdSchema.optional()
|
|
7098
7155
|
});
|
|
7099
|
-
var hostsRunsIndexResponseSchema =
|
|
7100
|
-
runs:
|
|
7101
|
-
hosts:
|
|
7102
|
-
generation:
|
|
7103
|
-
eventSeq:
|
|
7104
|
-
warning:
|
|
7156
|
+
var hostsRunsIndexResponseSchema = z63.object({
|
|
7157
|
+
runs: z63.array(hostRunIndexEntrySchema),
|
|
7158
|
+
hosts: z63.array(hostRunsIndexStateSchema),
|
|
7159
|
+
generation: z63.string().min(1),
|
|
7160
|
+
eventSeq: z63.number().int().nonnegative(),
|
|
7161
|
+
warning: z63.string().optional()
|
|
7105
7162
|
});
|
|
7106
7163
|
var HOST_SEARCH_UNANSWERED_REASONS = ["not-connected", "deadline", "error"];
|
|
7107
|
-
var hostSearchUnansweredReasonSchema =
|
|
7108
|
-
var hostSearchUnansweredSchema =
|
|
7164
|
+
var hostSearchUnansweredReasonSchema = z63.enum(HOST_SEARCH_UNANSWERED_REASONS);
|
|
7165
|
+
var hostSearchUnansweredSchema = z63.object({
|
|
7109
7166
|
hostId: hostIdSchema,
|
|
7110
7167
|
label: hostLabelSchema,
|
|
7111
7168
|
state: hostStateSchema,
|
|
7112
7169
|
reason: hostSearchUnansweredReasonSchema
|
|
7113
7170
|
});
|
|
7114
|
-
var hostTruncatedProjectSchema =
|
|
7171
|
+
var hostTruncatedProjectSchema = z63.object({
|
|
7115
7172
|
hostId: hostIdSchema,
|
|
7116
|
-
projectId:
|
|
7173
|
+
projectId: z63.string()
|
|
7117
7174
|
});
|
|
7118
|
-
var hostsRunsSearchResponseSchema =
|
|
7119
|
-
runs:
|
|
7120
|
-
truncated:
|
|
7121
|
-
unanswered:
|
|
7122
|
-
warning:
|
|
7175
|
+
var hostsRunsSearchResponseSchema = z63.object({
|
|
7176
|
+
runs: z63.array(hostRunIndexEntrySchema),
|
|
7177
|
+
truncated: z63.array(hostTruncatedProjectSchema),
|
|
7178
|
+
unanswered: z63.array(hostSearchUnansweredSchema),
|
|
7179
|
+
warning: z63.string().optional()
|
|
7123
7180
|
});
|
|
7124
7181
|
var HOSTS_CHANGED_EVENT = "hosts-changed";
|
|
7125
|
-
var hostsChangedEventSchema =
|
|
7126
|
-
hostIds:
|
|
7127
|
-
stateChanged:
|
|
7128
|
-
indexChanged:
|
|
7182
|
+
var hostsChangedEventSchema = z63.object({
|
|
7183
|
+
hostIds: z63.array(hostIdSchema).min(1),
|
|
7184
|
+
stateChanged: z63.boolean(),
|
|
7185
|
+
indexChanged: z63.boolean()
|
|
7129
7186
|
});
|
|
7130
7187
|
var HOST_RUN_SUMMARY_EVENT = "host-run-summary";
|
|
7131
|
-
var hostRunSummaryEventSchema =
|
|
7188
|
+
var hostRunSummaryEventSchema = z63.object({
|
|
7132
7189
|
hostId: hostIdSchema,
|
|
7133
|
-
project:
|
|
7134
|
-
seq:
|
|
7190
|
+
project: z63.string().min(1),
|
|
7191
|
+
seq: z63.number().int().positive(),
|
|
7135
7192
|
run: runSummarySchema
|
|
7136
7193
|
});
|
|
7137
7194
|
var HOST_RUN_DELETED_EVENT = "host-run-deleted";
|
|
7138
|
-
var hostRunDeletedEventSchema =
|
|
7195
|
+
var hostRunDeletedEventSchema = z63.object({
|
|
7139
7196
|
hostId: hostIdSchema,
|
|
7140
|
-
project:
|
|
7141
|
-
seq:
|
|
7142
|
-
id:
|
|
7197
|
+
project: z63.string().min(1),
|
|
7198
|
+
seq: z63.number().int().positive(),
|
|
7199
|
+
id: z63.string().min(1)
|
|
7143
7200
|
});
|
|
7144
7201
|
var HOST_USAGE_EVENT = "host-usage";
|
|
7145
|
-
var hostUsageEventSchema =
|
|
7202
|
+
var hostUsageEventSchema = z63.object({
|
|
7146
7203
|
hostId: hostIdSchema,
|
|
7147
|
-
project:
|
|
7148
|
-
usage:
|
|
7204
|
+
project: z63.string().min(1),
|
|
7205
|
+
usage: z63.record(z63.string(), processUsageSchema)
|
|
7149
7206
|
});
|
|
7150
7207
|
export {
|
|
7151
7208
|
ACTIVITY_CHECKS_MAX,
|
|
@@ -7455,6 +7512,7 @@ export {
|
|
|
7455
7512
|
editQueuedMessageResponseSchema,
|
|
7456
7513
|
effortFieldSchema,
|
|
7457
7514
|
effortLevelSchema,
|
|
7515
|
+
emptyProjectSignal,
|
|
7458
7516
|
encodeConversationCursor,
|
|
7459
7517
|
engineOwnsRun,
|
|
7460
7518
|
exactLineIndex,
|
|
@@ -7538,6 +7596,7 @@ export {
|
|
|
7538
7596
|
hostServerStartMethodSchema,
|
|
7539
7597
|
hostServerStatusResultSchema,
|
|
7540
7598
|
hostServerStopResultSchema,
|
|
7599
|
+
hostSignalsEntrySchema,
|
|
7541
7600
|
hostSshAliasSchema,
|
|
7542
7601
|
hostStarterInstallIdSchema,
|
|
7543
7602
|
hostStateSchema,
|
|
@@ -7551,6 +7610,7 @@ export {
|
|
|
7551
7610
|
hostsRunsIndexQuerySchema,
|
|
7552
7611
|
hostsRunsIndexResponseSchema,
|
|
7553
7612
|
hostsRunsSearchResponseSchema,
|
|
7613
|
+
hostsSignalsResponseSchema,
|
|
7554
7614
|
humanAskClosedEventSchema,
|
|
7555
7615
|
humanInputDeliveredEventSchema,
|
|
7556
7616
|
humanWaitEntrySchema,
|
|
@@ -7576,6 +7636,7 @@ export {
|
|
|
7576
7636
|
isUnread,
|
|
7577
7637
|
isUsageLimitHold,
|
|
7578
7638
|
isValidTimeZone,
|
|
7639
|
+
isZeroProjectSignal,
|
|
7579
7640
|
isoWeekday,
|
|
7580
7641
|
latestSession,
|
|
7581
7642
|
latestSessionStep,
|
|
@@ -7682,6 +7743,10 @@ export {
|
|
|
7682
7743
|
processWaitResultSchema,
|
|
7683
7744
|
projectDelegationSummary,
|
|
7684
7745
|
projectListEntrySchema,
|
|
7746
|
+
projectSignal,
|
|
7747
|
+
projectSignalSchema,
|
|
7748
|
+
projectSignalsEqual,
|
|
7749
|
+
projectSignalsRecordSchema,
|
|
7685
7750
|
projectWebhookInputSchema,
|
|
7686
7751
|
projectWebhookNameSchema,
|
|
7687
7752
|
projectWebhookParamsSchema,
|
|
@@ -7776,6 +7841,7 @@ export {
|
|
|
7776
7841
|
runPullRequestSchema,
|
|
7777
7842
|
runRecordSchema,
|
|
7778
7843
|
runRelationshipsSchema,
|
|
7844
|
+
runSignalCategory,
|
|
7779
7845
|
runStatePreviewSchema,
|
|
7780
7846
|
runStatusSchema,
|
|
7781
7847
|
runSummariesQuerySchema,
|