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