@hearsay-tools/squawk 0.18.0-dev.8015 → 0.18.0-dev.8022
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/client.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +6 -5
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/tool-catalog.js.map +1 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +622 -615
- package/dist/contract/wait-limits.d.ts +3 -0
- package/dist/contract/wait-tools.d.ts +440 -0
- package/dist/contract/waits.d.ts +2 -441
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/transport.d.ts +15 -15
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/runs/run-decode.d.ts +72 -72
- package/dist/runs/run-exits.d.ts +352 -352
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/run/compose.d.ts +2 -1
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/run-finish.js.map +1 -1
- package/dist/workflows/run/squawk-tools.d.ts +2 -1
- package/dist/workflows/run/squawk-tools.js.map +1 -1
- package/dist/workflows/run/wait-registration-tool.js +2 -1
- package/dist/workflows/run/wait-registration-tool.js.map +1 -1
- package/dist/workflows/run/wait-registration.d.ts +2 -1
- package/dist/workflows/run/wait-registration.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +2 -1
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/run.d.ts +2 -1
- package/dist/workflows/run.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-CJ1xR0FN.js → accounts-section-Lxa13E8O.js} +1 -1
- package/web/dist/assets/{activity-motion-C01GEN0y.js → activity-motion-D-8GF_WP.js} +1 -1
- package/web/dist/assets/{activity-route-BZ1NIKSY.js → activity-route-Bo-Cyzsz.js} +1 -1
- package/web/dist/assets/{agent-config-section-DvFcRRLD.js → agent-config-section-BE239EYo.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BE88c2RN.js → agent-defaults-section-Bj5dO6F3.js} +1 -1
- package/web/dist/assets/{appearance-B9Z6lNEm.js → appearance-C2v7z5MF.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DtR7twJI.js → archive-on-merge-field-Ta3WlY1p.js} +1 -1
- package/web/dist/assets/attention-B1Ei1IW6.js +1 -0
- package/web/dist/assets/{automations-route-Dpa01C3j.js → automations-route-DPpaFR0Q.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-CGjhxIPJ.js → commit-diff-panel-CzY8bO3p.js} +1 -1
- package/web/dist/assets/{diff-DQ18_bA-.js → diff-3jSM3IH7.js} +2 -2
- package/web/dist/assets/{diff-view-CMwe_Rx7.js → diff-view-C3cwyYRv.js} +1 -1
- package/web/dist/assets/{file-preview-_lAUlt5u.js → file-preview-B71T62DU.js} +1 -1
- package/web/dist/assets/{folder-browser-Cy26Y6YK.js → folder-browser-BTYMFLBY.js} +1 -1
- package/web/dist/assets/{git-toolbar-BJM3pWHY.js → git-toolbar-Dng31AhK.js} +1 -1
- package/web/dist/assets/{github-aO7y0526.js → github-Cft2RNHM.js} +1 -1
- package/web/dist/assets/{global-activity-route-BWOfw2C5.js → global-activity-route-CngRjBlD.js} +1 -1
- package/web/dist/assets/{index-D-Y1olb1.js → index-MG3T7zFQ.js} +5 -5
- package/web/dist/assets/{label-CbEJ99h4.js → label-C9IGG0mW.js} +1 -1
- package/web/dist/assets/{markdown-BDWII3gy.js → markdown-BDWm6oGX.js} +1 -1
- package/web/dist/assets/{notifications-section-Z_4IW83J.js → notifications-section-BxIKJ1NF.js} +1 -1
- package/web/dist/assets/{open-in-menu-21vcjK3t.js → open-in-menu-LbTu2sP4.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CxwvH4pt.js → preview-pane-connected-CGQngtTw.js} +1 -1
- package/web/dist/assets/{project-location-CvJMe_Vp.js → project-location-B-18C392.js} +1 -1
- package/web/dist/assets/{project-router-hhGBPlav.js → project-router-DImKA81z.js} +1 -1
- package/web/dist/assets/project-scope-context-D3_4Nfjk.js +4 -0
- package/web/dist/assets/{projects-section-CQ34YFnT.js → projects-section-DQ1LxJ3A.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-UIxQCLJq.js → prompt-templates-section-C5AYB6Ig.js} +1 -1
- package/web/dist/assets/{queries-D6ioEk6c.js → queries-BaHOUYn4.js} +1 -1
- package/web/dist/assets/{reference-chip-B5br2cfV.js → reference-chip-CdOqXRll.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BWDpTH5W.js → remote-settings-notice-BTdflMqO.js} +1 -1
- package/web/dist/assets/{repo-git-U12bPaG-.js → repo-git-DChiMWrS.js} +1 -1
- package/web/dist/assets/{report-reader-B5vipU-m.js → report-reader-nV2G6iRk.js} +1 -1
- package/web/dist/assets/{reports-Cdk8Dc-w.js → reports-CoQqVEy4.js} +1 -1
- package/web/dist/assets/{resources-section-BCLu3v1Z.js → resources-section-CVaIlicS.js} +1 -1
- package/web/dist/assets/{run-header-gOqc0BKa.js → run-header-xPtXOBkm.js} +1 -1
- package/web/dist/assets/{runners-5cgs0qUY.js → runners-DccsyraI.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-CB7l8AW-.js → settings-agent-picker-ixlEQ-MP.js} +1 -1
- package/web/dist/assets/{settings-shell-BUHHoCDs.js → settings-shell-BwknM_fs.js} +1 -1
- package/web/dist/assets/{sidebar-section-8dTKLdQw.js → sidebar-section-BNy-fRPU.js} +1 -1
- package/web/dist/assets/{skills-thuBrq2s.js → skills-CKceHo5J.js} +1 -1
- package/web/dist/assets/{tab-link-DaFUyEhe.js → tab-link-VCVNqxFc.js} +1 -1
- package/web/dist/assets/{task-changes-DSpeg6sX.js → task-changes-D4H5YbMo.js} +1 -1
- package/web/dist/assets/{task-commits-DRDRswBh.js → task-commits-BNu0VTTf.js} +1 -1
- package/web/dist/assets/{task-files-Cevz9Mex.js → task-files-C8q8GHYK.js} +1 -1
- package/web/dist/assets/{task-github-item-DpLkKSKy.js → task-github-item-D5kHfnwY.js} +1 -1
- package/web/dist/assets/{task-groups-CafTiSSz.js → task-groups-C7yO8nMy.js} +1 -1
- package/web/dist/assets/{task-thread-BvM4rEQe.js → task-thread-Dhts8Nbu.js} +1 -1
- package/web/dist/assets/{tasks-table-DYjfmofR.js → tasks-table-I_z4e7uI.js} +1 -1
- package/web/dist/assets/{thread-state-A3TSuI5v.js → thread-state-DV19z3BD.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-IepoiFbj.js → use-hand-to-agent-state-C6e6Mgi1.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-B20OnjTe.js → useInfiniteQuery-DR5UfhCS.js} +1 -1
- package/web/dist/assets/useQuery-BMyCehPp.js +1 -0
- package/web/dist/assets/{workflows-B0TaHAzz.js → workflows-BNHmFZRc.js} +1 -1
- package/web/dist/assets/{workspace-tools-B8sP_p5c.js → workspace-tools-UHJAnHEN.js} +1 -1
- package/web/dist/assets/{worktrees-section-BDfwadB6.js → worktrees-section-B4XPx6R5.js} +1 -1
- package/web/dist/assets/{ws-ExzR2_Yn.js → ws-CH3zNFKR.js} +1 -1
- package/web/dist/index.html +15 -15
- package/web/dist/assets/attention-B6NEiTGm.js +0 -1
- package/web/dist/assets/project-scope-context-BiijuuWU.js +0 -4
- package/web/dist/assets/useQuery-BTg3x78A.js +0 -1
package/dist/contract/index.js
CHANGED
|
@@ -1558,6 +1558,8 @@ var SUBAGENT_WAIT_DEADLINE_SECONDS = 1800;
|
|
|
1558
1558
|
var SUBAGENT_WAIT_GRACE_SECONDS = 15;
|
|
1559
1559
|
var SUBAGENT_WAIT_CHILD_LIMIT = 32;
|
|
1560
1560
|
var WAIT_MESSAGE_MAX = 4096;
|
|
1561
|
+
var NOTE_MAX = 512;
|
|
1562
|
+
var PID_MIN = 2;
|
|
1561
1563
|
|
|
1562
1564
|
// ../contract/src/waiting-on.ts
|
|
1563
1565
|
function peerRequestIds(delegation) {
|
|
@@ -1637,8 +1639,7 @@ function resolveWaitingOn(run) {
|
|
|
1637
1639
|
}
|
|
1638
1640
|
|
|
1639
1641
|
// ../contract/src/waits.ts
|
|
1640
|
-
var
|
|
1641
|
-
var pidSchema = z21.number().int().min(2);
|
|
1642
|
+
var pidSchema = z21.number().int().min(PID_MIN);
|
|
1642
1643
|
var waitPhaseSchema = z21.enum(["open", "resolved", "delivered", "cancelled"]);
|
|
1643
1644
|
var waitViaSchema = z21.enum([
|
|
1644
1645
|
// `cezar_wait_for_ci` is kept for stored rows only: the tool was removed (hearsay-tools/cezarion#1236).
|
|
@@ -1784,49 +1785,6 @@ function runningSubagents(wait) {
|
|
|
1784
1785
|
return wait.children.filter((child) => child.status === "running").length;
|
|
1785
1786
|
}
|
|
1786
1787
|
var waitSchema = z21.discriminatedUnion("kind", [prWaitEntrySchema, timerWaitEntrySchema, humanWaitEntrySchema, workerWaitEntrySchema, processWaitEntrySchema, peerWaitEntrySchema, subagentWaitEntrySchema]);
|
|
1787
|
-
var oneModeTakesOneId = (ids, mode, ctx) => {
|
|
1788
|
-
if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
|
|
1789
|
-
};
|
|
1790
|
-
var waitTimeoutSeconds = z21.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
|
|
1791
|
-
var registrationFields = { operation_id: z21.uuid().optional() };
|
|
1792
|
-
var squawkWaitRequestSchema = z21.discriminatedUnion("kind", [
|
|
1793
|
-
ciWaitRequestSchema.extend({ kind: z21.literal("pr"), ...registrationFields }).strict(),
|
|
1794
|
-
z21.object({
|
|
1795
|
-
kind: z21.literal("worker"),
|
|
1796
|
-
...registrationFields,
|
|
1797
|
-
worker_ids: workerIdsSchema,
|
|
1798
|
-
mode: workerWaitModeSchema.optional(),
|
|
1799
|
-
timeout_seconds: waitTimeoutSeconds
|
|
1800
|
-
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
|
|
1801
|
-
z21.object({
|
|
1802
|
-
kind: z21.literal("request"),
|
|
1803
|
-
...registrationFields,
|
|
1804
|
-
request_ids: workerIdsSchema,
|
|
1805
|
-
mode: workerWaitModeSchema.optional(),
|
|
1806
|
-
timeout_seconds: waitTimeoutSeconds
|
|
1807
|
-
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
|
|
1808
|
-
z21.object({
|
|
1809
|
-
kind: z21.literal("peer"),
|
|
1810
|
-
...registrationFields,
|
|
1811
|
-
peer_ids: workerIdsSchema,
|
|
1812
|
-
timeout_seconds: waitTimeoutSeconds
|
|
1813
|
-
}).strict(),
|
|
1814
|
-
z21.object({
|
|
1815
|
-
kind: z21.literal("timer"),
|
|
1816
|
-
...registrationFields,
|
|
1817
|
-
seconds: z21.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
1818
|
-
note: z21.string().max(NOTE_MAX).optional()
|
|
1819
|
-
}).strict(),
|
|
1820
|
-
z21.object({
|
|
1821
|
-
kind: z21.literal("process"),
|
|
1822
|
-
...registrationFields,
|
|
1823
|
-
pid: pidSchema,
|
|
1824
|
-
exit_file: z21.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
1825
|
-
timeout_seconds: z21.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
|
|
1826
|
-
note: z21.string().max(NOTE_MAX).optional()
|
|
1827
|
-
}).strict()
|
|
1828
|
-
]);
|
|
1829
|
-
var squawkCancelWaitRequestSchema = z21.object({ wait_id: z21.uuid() }).strict();
|
|
1830
1788
|
var openWaitFields = { wait_id: z21.uuid(), summary: z21.string().max(256) };
|
|
1831
1789
|
var openWaitSchema = z21.discriminatedUnion("kind", [
|
|
1832
1790
|
z21.object({ ...openWaitFields, kind: z21.enum(["pr", "timer", "worker", "process", "peer", "subagent"]), deadline: z21.iso.datetime() }).strict(),
|
|
@@ -1846,41 +1804,12 @@ var waitErrorCodeSchema = z21.enum([
|
|
|
1846
1804
|
// hearsay-tools/cezarion#2784: a peer wait on a task whose messaging switch is off.
|
|
1847
1805
|
"messaging_off"
|
|
1848
1806
|
]);
|
|
1849
|
-
var message = z21.string().max(WAIT_MESSAGE_MAX);
|
|
1850
1807
|
var waitRegistrationReceiptSchema = z21.object({
|
|
1851
1808
|
operationId: z21.uuid(),
|
|
1852
1809
|
requestHash: z21.string().regex(/^[0-9a-f]{64}$/),
|
|
1853
1810
|
wait: waitSchema,
|
|
1854
1811
|
deduplicated: z21.boolean()
|
|
1855
1812
|
}).strict();
|
|
1856
|
-
var registrationAnswerFields = {
|
|
1857
|
-
operation_id: z21.uuid().optional()
|
|
1858
|
-
};
|
|
1859
|
-
var squawkWaitAnswerSchema = z21.discriminatedUnion("ok", [
|
|
1860
|
-
z21.object({
|
|
1861
|
-
ok: z21.literal(true),
|
|
1862
|
-
...registrationAnswerFields,
|
|
1863
|
-
effect: z21.enum(["applied", "unchanged"]).optional(),
|
|
1864
|
-
deduplicated: z21.boolean().optional(),
|
|
1865
|
-
replayed: z21.boolean().optional(),
|
|
1866
|
-
wait_phase: z21.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
|
|
1867
|
-
wait_id: z21.uuid(),
|
|
1868
|
-
/** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
|
|
1869
|
-
kind: z21.enum(["pr", "timer", "worker", "request", "process", "peer"]),
|
|
1870
|
-
deadline: z21.iso.datetime(),
|
|
1871
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT)
|
|
1872
|
-
}).strict(),
|
|
1873
|
-
z21.object({
|
|
1874
|
-
ok: z21.literal(false),
|
|
1875
|
-
...registrationAnswerFields,
|
|
1876
|
-
effect: z21.enum(["refused", "unknown"]).optional(),
|
|
1877
|
-
retained_wait: openWaitSchema.optional(),
|
|
1878
|
-
code: waitErrorCodeSchema,
|
|
1879
|
-
message,
|
|
1880
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
1881
|
-
}).strict()
|
|
1882
|
-
]);
|
|
1883
|
-
var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
|
|
1884
1813
|
var askErrorCodeSchema = z21.enum([
|
|
1885
1814
|
"invalid_request",
|
|
1886
1815
|
"capacity",
|
|
@@ -1903,29 +1832,6 @@ var askErrorCodeSchema = z21.enum([
|
|
|
1903
1832
|
"root_finish_pending",
|
|
1904
1833
|
"supervisor_is_worker"
|
|
1905
1834
|
]);
|
|
1906
|
-
var squawkAskAnswerSchema = z21.discriminatedUnion("ok", [
|
|
1907
|
-
z21.object({ ok: z21.literal(true), wait_id: z21.uuid(), open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
1908
|
-
z21.object({
|
|
1909
|
-
ok: z21.literal(false),
|
|
1910
|
-
code: askErrorCodeSchema,
|
|
1911
|
-
message,
|
|
1912
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
1913
|
-
}).strict()
|
|
1914
|
-
]);
|
|
1915
|
-
var squawkCancelWaitAnswerSchema = z21.discriminatedUnion("cancelled", [
|
|
1916
|
-
z21.object({
|
|
1917
|
-
cancelled: z21.literal(true),
|
|
1918
|
-
wait_id: z21.uuid(),
|
|
1919
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT)
|
|
1920
|
-
}).strict(),
|
|
1921
|
-
z21.object({
|
|
1922
|
-
cancelled: z21.literal(false),
|
|
1923
|
-
code: z21.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
|
|
1924
|
-
message,
|
|
1925
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
1926
|
-
}).strict()
|
|
1927
|
-
]);
|
|
1928
|
-
var squawkDoneRequestSchema = z21.object({ summary: z21.string().max(2e3).optional() }).strict();
|
|
1929
1835
|
var doneErrorCodeSchema = z21.enum([
|
|
1930
1836
|
"workers_outstanding",
|
|
1931
1837
|
"workers_uncollected",
|
|
@@ -1956,30 +1862,6 @@ var doneOwedInputSchema = z21.discriminatedUnion("kind", [
|
|
|
1956
1862
|
z21.object({ kind: z21.literal("in_flight"), input_id: z21.string() }).strict(),
|
|
1957
1863
|
z21.object({ kind: z21.literal("unread"), input_id: z21.string() }).strict()
|
|
1958
1864
|
]);
|
|
1959
|
-
var doneAccepted = {
|
|
1960
|
-
ok: z21.literal(true),
|
|
1961
|
-
finishes: z21.literal("at_turn_end"),
|
|
1962
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT)
|
|
1963
|
-
};
|
|
1964
|
-
var squawkDoneAnswerSchema = z21.discriminatedUnion("ok", [
|
|
1965
|
-
z21.discriminatedUnion("completes", [
|
|
1966
|
-
z21.object({ ...doneAccepted, completes: z21.literal("task") }).strict(),
|
|
1967
|
-
z21.object({ ...doneAccepted, completes: z21.literal("step"), next_step: z21.string().min(1) }).strict()
|
|
1968
|
-
]),
|
|
1969
|
-
z21.object({
|
|
1970
|
-
ok: z21.literal(false),
|
|
1971
|
-
code: doneErrorCodeSchema,
|
|
1972
|
-
message,
|
|
1973
|
-
/** The workers that block the finish, and why each one does. */
|
|
1974
|
-
workers: z21.array(z21.object({
|
|
1975
|
-
worker_id: z21.string(),
|
|
1976
|
-
reason: z21.enum(["outstanding", "uncollected", "question"])
|
|
1977
|
-
}).strict()).max(64).optional(),
|
|
1978
|
-
open_waits: z21.array(openWaitSchema).max(WAIT_LIMIT).optional(),
|
|
1979
|
-
/** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
|
|
1980
|
-
owed: z21.array(doneOwedInputSchema).max(64).optional()
|
|
1981
|
-
}).strict()
|
|
1982
|
-
]);
|
|
1983
1865
|
var waitingOnUnionSchema = z21.discriminatedUnion("kind", [
|
|
1984
1866
|
/** `shown` once the user sees the question (its `askSeq`): attention reads that as Needs you at
|
|
1985
1867
|
* any status, a wake turn's included (phase 4b, hearsay-tools/cezarion#1236). */
|
|
@@ -4701,6 +4583,129 @@ var scheduledTasksAnswerSchema = z34.union([
|
|
|
4701
4583
|
refusal
|
|
4702
4584
|
]);
|
|
4703
4585
|
|
|
4586
|
+
// ../contract/src/wait-tools.ts
|
|
4587
|
+
import { z as z35 } from "zod";
|
|
4588
|
+
var pidSchema2 = z35.number().int().min(PID_MIN);
|
|
4589
|
+
var oneModeTakesOneId = (ids, mode, ctx) => {
|
|
4590
|
+
if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
|
|
4591
|
+
};
|
|
4592
|
+
var waitTimeoutSeconds = z35.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
|
|
4593
|
+
var registrationFields = { operation_id: z35.uuid().optional() };
|
|
4594
|
+
var squawkWaitRequestSchema = z35.discriminatedUnion("kind", [
|
|
4595
|
+
ciWaitRequestSchema.extend({ kind: z35.literal("pr"), ...registrationFields }).strict(),
|
|
4596
|
+
z35.object({
|
|
4597
|
+
kind: z35.literal("worker"),
|
|
4598
|
+
...registrationFields,
|
|
4599
|
+
worker_ids: workerIdsSchema,
|
|
4600
|
+
mode: workerWaitModeSchema.optional(),
|
|
4601
|
+
timeout_seconds: waitTimeoutSeconds
|
|
4602
|
+
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
|
|
4603
|
+
z35.object({
|
|
4604
|
+
kind: z35.literal("request"),
|
|
4605
|
+
...registrationFields,
|
|
4606
|
+
request_ids: workerIdsSchema,
|
|
4607
|
+
mode: workerWaitModeSchema.optional(),
|
|
4608
|
+
timeout_seconds: waitTimeoutSeconds
|
|
4609
|
+
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
|
|
4610
|
+
z35.object({
|
|
4611
|
+
kind: z35.literal("peer"),
|
|
4612
|
+
...registrationFields,
|
|
4613
|
+
peer_ids: workerIdsSchema,
|
|
4614
|
+
timeout_seconds: waitTimeoutSeconds
|
|
4615
|
+
}).strict(),
|
|
4616
|
+
z35.object({
|
|
4617
|
+
kind: z35.literal("timer"),
|
|
4618
|
+
...registrationFields,
|
|
4619
|
+
seconds: z35.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
4620
|
+
note: z35.string().max(NOTE_MAX).optional()
|
|
4621
|
+
}).strict(),
|
|
4622
|
+
z35.object({
|
|
4623
|
+
kind: z35.literal("process"),
|
|
4624
|
+
...registrationFields,
|
|
4625
|
+
pid: pidSchema2,
|
|
4626
|
+
exit_file: z35.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
4627
|
+
timeout_seconds: z35.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
|
|
4628
|
+
note: z35.string().max(NOTE_MAX).optional()
|
|
4629
|
+
}).strict()
|
|
4630
|
+
]);
|
|
4631
|
+
var squawkCancelWaitRequestSchema = z35.object({ wait_id: z35.uuid() }).strict();
|
|
4632
|
+
var message = z35.string().max(WAIT_MESSAGE_MAX);
|
|
4633
|
+
var registrationAnswerFields = {
|
|
4634
|
+
operation_id: z35.uuid().optional()
|
|
4635
|
+
};
|
|
4636
|
+
var squawkWaitAnswerSchema = z35.discriminatedUnion("ok", [
|
|
4637
|
+
z35.object({
|
|
4638
|
+
ok: z35.literal(true),
|
|
4639
|
+
...registrationAnswerFields,
|
|
4640
|
+
effect: z35.enum(["applied", "unchanged"]).optional(),
|
|
4641
|
+
deduplicated: z35.boolean().optional(),
|
|
4642
|
+
replayed: z35.boolean().optional(),
|
|
4643
|
+
wait_phase: z35.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
|
|
4644
|
+
wait_id: z35.uuid(),
|
|
4645
|
+
/** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
|
|
4646
|
+
kind: z35.enum(["pr", "timer", "worker", "request", "process", "peer"]),
|
|
4647
|
+
deadline: z35.iso.datetime(),
|
|
4648
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4649
|
+
}).strict(),
|
|
4650
|
+
z35.object({
|
|
4651
|
+
ok: z35.literal(false),
|
|
4652
|
+
...registrationAnswerFields,
|
|
4653
|
+
effect: z35.enum(["refused", "unknown"]).optional(),
|
|
4654
|
+
retained_wait: openWaitSchema.optional(),
|
|
4655
|
+
code: waitErrorCodeSchema,
|
|
4656
|
+
message,
|
|
4657
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4658
|
+
}).strict()
|
|
4659
|
+
]);
|
|
4660
|
+
var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
|
|
4661
|
+
var squawkAskAnswerSchema = z35.discriminatedUnion("ok", [
|
|
4662
|
+
z35.object({ ok: z35.literal(true), wait_id: z35.uuid(), open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
4663
|
+
z35.object({
|
|
4664
|
+
ok: z35.literal(false),
|
|
4665
|
+
code: askErrorCodeSchema,
|
|
4666
|
+
message,
|
|
4667
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4668
|
+
}).strict()
|
|
4669
|
+
]);
|
|
4670
|
+
var squawkCancelWaitAnswerSchema = z35.discriminatedUnion("cancelled", [
|
|
4671
|
+
z35.object({
|
|
4672
|
+
cancelled: z35.literal(true),
|
|
4673
|
+
wait_id: z35.uuid(),
|
|
4674
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4675
|
+
}).strict(),
|
|
4676
|
+
z35.object({
|
|
4677
|
+
cancelled: z35.literal(false),
|
|
4678
|
+
code: z35.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
|
|
4679
|
+
message,
|
|
4680
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
4681
|
+
}).strict()
|
|
4682
|
+
]);
|
|
4683
|
+
var squawkDoneRequestSchema = z35.object({ summary: z35.string().max(2e3).optional() }).strict();
|
|
4684
|
+
var doneAccepted = {
|
|
4685
|
+
ok: z35.literal(true),
|
|
4686
|
+
finishes: z35.literal("at_turn_end"),
|
|
4687
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
|
|
4688
|
+
};
|
|
4689
|
+
var squawkDoneAnswerSchema = z35.discriminatedUnion("ok", [
|
|
4690
|
+
z35.discriminatedUnion("completes", [
|
|
4691
|
+
z35.object({ ...doneAccepted, completes: z35.literal("task") }).strict(),
|
|
4692
|
+
z35.object({ ...doneAccepted, completes: z35.literal("step"), next_step: z35.string().min(1) }).strict()
|
|
4693
|
+
]),
|
|
4694
|
+
z35.object({
|
|
4695
|
+
ok: z35.literal(false),
|
|
4696
|
+
code: doneErrorCodeSchema,
|
|
4697
|
+
message,
|
|
4698
|
+
/** The workers that block the finish, and why each one does. */
|
|
4699
|
+
workers: z35.array(z35.object({
|
|
4700
|
+
worker_id: z35.string(),
|
|
4701
|
+
reason: z35.enum(["outstanding", "uncollected", "question"])
|
|
4702
|
+
}).strict()).max(64).optional(),
|
|
4703
|
+
open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional(),
|
|
4704
|
+
/** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
|
|
4705
|
+
owed: z35.array(doneOwedInputSchema).max(64).optional()
|
|
4706
|
+
}).strict()
|
|
4707
|
+
]);
|
|
4708
|
+
|
|
4704
4709
|
// ../contract/src/run-predicates.ts
|
|
4705
4710
|
function latestSessionStep(steps, except) {
|
|
4706
4711
|
let latest;
|
|
@@ -4880,73 +4885,73 @@ function sqlPrefilterTokens(query, options = {}) {
|
|
|
4880
4885
|
}
|
|
4881
4886
|
|
|
4882
4887
|
// ../contract/src/artifacts.ts
|
|
4883
|
-
import { z as
|
|
4884
|
-
var pathSchema =
|
|
4885
|
-
var publishedArtifactSchema =
|
|
4886
|
-
id:
|
|
4887
|
-
runId:
|
|
4888
|
-
name:
|
|
4889
|
-
title:
|
|
4888
|
+
import { z as z36 } from "zod";
|
|
4889
|
+
var pathSchema = z36.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
|
|
4890
|
+
var publishedArtifactSchema = z36.object({
|
|
4891
|
+
id: z36.uuid(),
|
|
4892
|
+
runId: z36.uuid(),
|
|
4893
|
+
name: z36.string().min(1).max(255),
|
|
4894
|
+
title: z36.string().max(200).optional(),
|
|
4890
4895
|
sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
|
|
4891
|
-
createdAt:
|
|
4892
|
-
size:
|
|
4893
|
-
sha256:
|
|
4896
|
+
createdAt: z36.iso.datetime(),
|
|
4897
|
+
size: z36.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
4898
|
+
sha256: z36.string().regex(/^[a-f0-9]{64}$/)
|
|
4894
4899
|
}).strict();
|
|
4895
|
-
var filePreviewDataSchema =
|
|
4896
|
-
type:
|
|
4900
|
+
var filePreviewDataSchema = z36.object({
|
|
4901
|
+
type: z36.literal("file"),
|
|
4897
4902
|
path: pathSchema,
|
|
4898
|
-
size:
|
|
4899
|
-
binary:
|
|
4900
|
-
tooLarge:
|
|
4901
|
-
content:
|
|
4902
|
-
source:
|
|
4903
|
+
size: z36.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
4904
|
+
binary: z36.boolean(),
|
|
4905
|
+
tooLarge: z36.boolean(),
|
|
4906
|
+
content: z36.string().optional(),
|
|
4907
|
+
source: z36.enum(["worktree", "project", "artifact"]),
|
|
4903
4908
|
artifact: publishedArtifactSchema.optional()
|
|
4904
4909
|
}).strict();
|
|
4905
|
-
var fileLinkResultSchema =
|
|
4910
|
+
var fileLinkResultSchema = z36.union([
|
|
4906
4911
|
filePreviewDataSchema,
|
|
4907
|
-
|
|
4908
|
-
type:
|
|
4912
|
+
z36.object({
|
|
4913
|
+
type: z36.enum(["unavailable", "unpublished"]),
|
|
4909
4914
|
path: pathSchema,
|
|
4910
|
-
reason:
|
|
4915
|
+
reason: z36.string().min(1).max(4096)
|
|
4911
4916
|
}).strict()
|
|
4912
4917
|
]);
|
|
4913
|
-
var artifactMetadataResponseSchema =
|
|
4914
|
-
var artifactListSchema =
|
|
4915
|
-
var fileLinkQuerySchema =
|
|
4916
|
-
var artifactParamsSchema =
|
|
4918
|
+
var artifactMetadataResponseSchema = z36.object({ artifact: publishedArtifactSchema }).strict();
|
|
4919
|
+
var artifactListSchema = z36.object({ artifacts: z36.array(publishedArtifactSchema).max(64) }).strict();
|
|
4920
|
+
var fileLinkQuerySchema = z36.object({ path: pathSchema, raw: z36.literal("1").optional() }).strict();
|
|
4921
|
+
var artifactParamsSchema = z36.object({ id: z36.uuid(), artifactId: z36.uuid() });
|
|
4917
4922
|
|
|
4918
4923
|
// ../contract/src/discovery.ts
|
|
4919
|
-
import { z as
|
|
4920
|
-
var hostDiscoveryRequestSchema =
|
|
4921
|
-
|
|
4922
|
-
|
|
4924
|
+
import { z as z37 } from "zod";
|
|
4925
|
+
var hostDiscoveryRequestSchema = z37.discriminatedUnion("kind", [
|
|
4926
|
+
z37.object({ kind: z37.literal("runners") }).strict(),
|
|
4927
|
+
z37.object({ kind: z37.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
|
|
4923
4928
|
]);
|
|
4924
|
-
var discoveryRequestSchema =
|
|
4929
|
+
var discoveryRequestSchema = z37.discriminatedUnion("kind", [
|
|
4925
4930
|
...hostDiscoveryRequestSchema.options,
|
|
4926
|
-
|
|
4931
|
+
z37.object({ kind: z37.literal("tasks"), all: z37.boolean().optional(), offset: z37.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
|
|
4927
4932
|
]);
|
|
4928
4933
|
var discoveredRunnerSchema = providerStatusSchema.omit({ provider: true, profileId: true }).extend({ runner: modelDiscoveryRunnerSchema });
|
|
4929
|
-
var discoveredRunnersSchema =
|
|
4930
|
-
scope:
|
|
4931
|
-
runners:
|
|
4932
|
-
});
|
|
4933
|
-
var discoveredTasksSchema =
|
|
4934
|
-
tasks:
|
|
4935
|
-
id:
|
|
4936
|
-
title:
|
|
4934
|
+
var discoveredRunnersSchema = z37.object({
|
|
4935
|
+
scope: z37.literal("host-default-account"),
|
|
4936
|
+
runners: z37.array(discoveredRunnerSchema)
|
|
4937
|
+
});
|
|
4938
|
+
var discoveredTasksSchema = z37.object({
|
|
4939
|
+
tasks: z37.array(z37.object({
|
|
4940
|
+
id: z37.string(),
|
|
4941
|
+
title: z37.string(),
|
|
4937
4942
|
runner: runnerSchema.optional(),
|
|
4938
4943
|
status: runStatusSchema,
|
|
4939
|
-
attention:
|
|
4940
|
-
attentionLabel:
|
|
4941
|
-
accepts:
|
|
4942
|
-
reason:
|
|
4944
|
+
attention: z37.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
|
|
4945
|
+
attentionLabel: z37.string(),
|
|
4946
|
+
accepts: z37.boolean(),
|
|
4947
|
+
reason: z37.string().optional()
|
|
4943
4948
|
})).max(32),
|
|
4944
|
-
nextOffset:
|
|
4949
|
+
nextOffset: z37.number().int().nonnegative().optional()
|
|
4945
4950
|
});
|
|
4946
|
-
var discoveryResponseSchema =
|
|
4951
|
+
var discoveryResponseSchema = z37.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
|
|
4947
4952
|
|
|
4948
4953
|
// ../contract/src/live.ts
|
|
4949
|
-
import { z as
|
|
4954
|
+
import { z as z38 } from "zod";
|
|
4950
4955
|
|
|
4951
4956
|
// ../contract/src/live-limits.ts
|
|
4952
4957
|
var LIVE_RUN_LIMIT = 32;
|
|
@@ -4954,44 +4959,44 @@ var LIVE_EVENT_LIMIT = 256;
|
|
|
4954
4959
|
var LIVE_BYTE_LIMIT = 1024 * 1024;
|
|
4955
4960
|
|
|
4956
4961
|
// ../contract/src/live.ts
|
|
4957
|
-
var liveRunDemandSchema =
|
|
4958
|
-
projectId:
|
|
4962
|
+
var liveRunDemandSchema = z38.object({
|
|
4963
|
+
projectId: z38.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
|
|
4959
4964
|
runId: runIdParamSchema.shape.id,
|
|
4960
4965
|
cursor: runHistoryCursorSchema.optional(),
|
|
4961
|
-
afterSeq:
|
|
4966
|
+
afterSeq: z38.number().int().nonnegative().safe()
|
|
4962
4967
|
});
|
|
4963
|
-
var liveRunsRequestSchema =
|
|
4964
|
-
runs:
|
|
4968
|
+
var liveRunsRequestSchema = z38.object({
|
|
4969
|
+
runs: z38.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
|
|
4965
4970
|
}).refine(({ runs }) => new Set(runs.map((r) => `${r.projectId}/${r.runId}`)).size === runs.length, {
|
|
4966
4971
|
message: "duplicate run demand"
|
|
4967
4972
|
});
|
|
4968
4973
|
var identity = liveRunDemandSchema.pick({ projectId: true, runId: true });
|
|
4969
4974
|
var liveRunErrorSchema = identity.extend({
|
|
4970
|
-
type:
|
|
4971
|
-
status:
|
|
4972
|
-
error:
|
|
4975
|
+
type: z38.enum(["error", "reset"]),
|
|
4976
|
+
status: z38.union([z38.literal(400), z38.literal(404), z38.literal(409), z38.literal(413), z38.literal(503)]),
|
|
4977
|
+
error: z38.string()
|
|
4973
4978
|
});
|
|
4974
4979
|
var liveRunBatchSchema = identity.extend({
|
|
4975
|
-
type:
|
|
4976
|
-
events:
|
|
4980
|
+
type: z38.literal("batch"),
|
|
4981
|
+
events: z38.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
|
|
4977
4982
|
cursor: runHistoryCursorSchema,
|
|
4978
|
-
afterSeq:
|
|
4979
|
-
hasMore:
|
|
4980
|
-
});
|
|
4981
|
-
var liveRunBatchResultSchema =
|
|
4982
|
-
var liveRunBatchResponseSchema =
|
|
4983
|
-
generation:
|
|
4984
|
-
results:
|
|
4985
|
-
});
|
|
4986
|
-
var liveRunFrameSchema =
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
identity.extend({ type:
|
|
4983
|
+
afterSeq: z38.number().int().nonnegative(),
|
|
4984
|
+
hasMore: z38.boolean()
|
|
4985
|
+
});
|
|
4986
|
+
var liveRunBatchResultSchema = z38.union([liveRunBatchSchema, liveRunErrorSchema]);
|
|
4987
|
+
var liveRunBatchResponseSchema = z38.object({
|
|
4988
|
+
generation: z38.string(),
|
|
4989
|
+
results: z38.array(liveRunBatchResultSchema)
|
|
4990
|
+
});
|
|
4991
|
+
var liveRunFrameSchema = z38.union([
|
|
4992
|
+
z38.object({ type: z38.literal("ready"), generation: z38.string() }),
|
|
4993
|
+
z38.object({ type: z38.literal("ping") }),
|
|
4994
|
+
identity.extend({ type: z38.literal("event"), name: z38.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
|
|
4990
4995
|
liveRunErrorSchema
|
|
4991
4996
|
]);
|
|
4992
4997
|
|
|
4993
4998
|
// ../contract/src/activity.ts
|
|
4994
|
-
import { z as
|
|
4999
|
+
import { z as z39 } from "zod";
|
|
4995
5000
|
var ACTIVITY_RATE_SECONDS = 30;
|
|
4996
5001
|
var ACTIVITY_TEXT_MAX = 500;
|
|
4997
5002
|
var ACTIVITY_ERROR_MAX = 200;
|
|
@@ -4999,144 +5004,144 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
|
|
|
4999
5004
|
var ACTIVITY_CHECKS_MAX = 100;
|
|
5000
5005
|
var ACTIVITY_CHECK_NAME_MAX = 100;
|
|
5001
5006
|
var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
|
|
5002
|
-
var iso =
|
|
5003
|
-
var count =
|
|
5004
|
-
var runId =
|
|
5007
|
+
var iso = z39.iso.datetime();
|
|
5008
|
+
var count = z39.number().int().nonnegative();
|
|
5009
|
+
var runId = z39.string().min(1);
|
|
5005
5010
|
var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
|
|
5006
|
-
var activityToolSchema =
|
|
5007
|
-
title:
|
|
5008
|
-
toolKind:
|
|
5009
|
-
status:
|
|
5011
|
+
var activityToolSchema = z39.object({
|
|
5012
|
+
title: z39.string().max(ACTIVITY_TOOL_TITLE_MAX),
|
|
5013
|
+
toolKind: z39.enum(ACTIVITY_TOOL_KINDS),
|
|
5014
|
+
status: z39.enum(["pending", "running", "completed", "failed", "declined"]),
|
|
5010
5015
|
startedAt: iso,
|
|
5011
5016
|
endedAt: iso.optional()
|
|
5012
5017
|
}).strict();
|
|
5013
|
-
var activityCheckBucketSchema =
|
|
5014
|
-
var activityPrProgressSchema =
|
|
5015
|
-
checks:
|
|
5016
|
-
counts:
|
|
5017
|
-
truncated:
|
|
5018
|
+
var activityCheckBucketSchema = z39.enum(["pass", "fail", "pending", "skipping", "cancel"]);
|
|
5019
|
+
var activityPrProgressSchema = z39.object({
|
|
5020
|
+
checks: z39.array(z39.object({ name: z39.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
|
|
5021
|
+
counts: z39.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
|
|
5022
|
+
truncated: z39.literal(true).optional()
|
|
5018
5023
|
}).strict();
|
|
5019
|
-
var activityWaitSchema =
|
|
5020
|
-
|
|
5021
|
-
kind:
|
|
5024
|
+
var activityWaitSchema = z39.discriminatedUnion("kind", [
|
|
5025
|
+
z39.object({
|
|
5026
|
+
kind: z39.literal("human"),
|
|
5022
5027
|
since: iso,
|
|
5023
|
-
detail:
|
|
5028
|
+
detail: z39.object({
|
|
5024
5029
|
/** The ask card's first question. */
|
|
5025
|
-
question:
|
|
5030
|
+
question: z39.string().max(ACTIVITY_TEXT_MAX).optional(),
|
|
5026
5031
|
/** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
|
|
5027
5032
|
* automatic-wake budget is spent; `completion`: Squawk's completion gate. */
|
|
5028
|
-
reason:
|
|
5033
|
+
reason: z39.enum(["question", "turn-end", "budget", "completion"]),
|
|
5029
5034
|
/** Inputs not delivered yet, when there are any. */
|
|
5030
|
-
queuedMessages:
|
|
5035
|
+
queuedMessages: z39.number().int().positive().optional()
|
|
5031
5036
|
}).strict()
|
|
5032
5037
|
}).strict(),
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
kind:
|
|
5038
|
+
z39.object({ kind: z39.literal("usage-limit"), detail: z39.object({ resumeAt: z39.string() }).strict() }).strict(),
|
|
5039
|
+
z39.object({
|
|
5040
|
+
kind: z39.literal("workers"),
|
|
5036
5041
|
since: iso,
|
|
5037
5042
|
deadline: iso.optional(),
|
|
5038
|
-
detail:
|
|
5043
|
+
detail: z39.object({
|
|
5039
5044
|
/** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
|
|
5040
5045
|
owed: count,
|
|
5041
5046
|
/** Targets named and targets settled, summed over the entries. */
|
|
5042
5047
|
total: count,
|
|
5043
5048
|
settled: count,
|
|
5044
5049
|
/** Every open entry waits on request replies. */
|
|
5045
|
-
replies:
|
|
5050
|
+
replies: z39.literal(true).optional(),
|
|
5046
5051
|
/** Only when one entry is open. */
|
|
5047
5052
|
mode: workerWaitModeSchema.optional(),
|
|
5048
5053
|
/** Who owes the awaited replies, each once. */
|
|
5049
|
-
recipientRunIds:
|
|
5054
|
+
recipientRunIds: z39.array(runId)
|
|
5050
5055
|
}).strict()
|
|
5051
5056
|
}).strict(),
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
kind:
|
|
5057
|
+
z39.object({ kind: z39.literal("peers"), since: iso, deadline: iso, detail: z39.object({ peerRunIds: z39.array(runId) }).strict() }).strict(),
|
|
5058
|
+
z39.object({ kind: z39.literal("subagents"), since: iso, deadline: iso, detail: z39.object({ running: count }).strict() }).strict(),
|
|
5059
|
+
z39.object({
|
|
5060
|
+
kind: z39.literal("pr"),
|
|
5056
5061
|
since: iso,
|
|
5057
5062
|
deadline: iso,
|
|
5058
|
-
detail:
|
|
5059
|
-
number:
|
|
5063
|
+
detail: z39.object({
|
|
5064
|
+
number: z39.number().int().positive(),
|
|
5060
5065
|
target: prWaitUntilSchema,
|
|
5061
5066
|
/** Check progress, while the CI progress registry holds some for this wait. */
|
|
5062
5067
|
checks: activityPrProgressSchema.shape.checks.optional(),
|
|
5063
5068
|
counts: activityPrProgressSchema.shape.counts.optional(),
|
|
5064
|
-
truncated:
|
|
5069
|
+
truncated: z39.literal(true).optional()
|
|
5065
5070
|
}).strict()
|
|
5066
5071
|
}).strict(),
|
|
5067
|
-
|
|
5068
|
-
|
|
5072
|
+
z39.object({ kind: z39.literal("process"), since: iso, deadline: iso, detail: z39.object({ pid: z39.number().int(), note: z39.string().optional() }).strict() }).strict(),
|
|
5073
|
+
z39.object({ kind: z39.literal("timer"), since: iso, deadline: iso, detail: z39.object({ wakeAt: iso, note: z39.string().optional() }).strict() }).strict()
|
|
5069
5074
|
]);
|
|
5070
5075
|
var activityRunShape = {
|
|
5071
5076
|
runId,
|
|
5072
5077
|
/** The display title: `titleSummary ?? title`. */
|
|
5073
|
-
title:
|
|
5078
|
+
title: z39.string(),
|
|
5074
5079
|
status: runStatusSchema,
|
|
5075
5080
|
/** The `deriveAttention` rung id, never a label. */
|
|
5076
|
-
rung:
|
|
5081
|
+
rung: z39.enum(ATTENTION_RUNGS),
|
|
5077
5082
|
runner: runnerSchema.optional(),
|
|
5078
|
-
model:
|
|
5079
|
-
currentStepId:
|
|
5080
|
-
startedAt:
|
|
5083
|
+
model: z39.string().optional(),
|
|
5084
|
+
currentStepId: z39.string().optional(),
|
|
5085
|
+
startedAt: z39.string().optional(),
|
|
5081
5086
|
wait: activityWaitSchema.optional(),
|
|
5082
5087
|
tool: activityToolSchema.optional(),
|
|
5083
5088
|
/** Tool calls started per second, oldest first. */
|
|
5084
|
-
rate:
|
|
5089
|
+
rate: z39.array(count).length(ACTIVITY_RATE_SECONDS),
|
|
5085
5090
|
/** One line of `RunRecord.error`. */
|
|
5086
|
-
error:
|
|
5091
|
+
error: z39.string().max(ACTIVITY_ERROR_MAX).optional()
|
|
5087
5092
|
};
|
|
5088
|
-
var activityWorkerSchema =
|
|
5093
|
+
var activityWorkerSchema = z39.object({
|
|
5089
5094
|
...activityRunShape,
|
|
5090
5095
|
/** The worker's current execution revision. */
|
|
5091
5096
|
revision: count,
|
|
5092
5097
|
/** The parent holds a collected result for this revision. */
|
|
5093
|
-
collected:
|
|
5098
|
+
collected: z39.boolean()
|
|
5094
5099
|
}).strict();
|
|
5095
|
-
var activityRunSchema =
|
|
5096
|
-
var activityRequestSchema =
|
|
5097
|
-
requestId:
|
|
5098
|
-
relationship:
|
|
5100
|
+
var activityRunSchema = z39.object({ ...activityRunShape, workers: z39.array(activityWorkerSchema) }).strict();
|
|
5101
|
+
var activityRequestSchema = z39.object({
|
|
5102
|
+
requestId: z39.uuid(),
|
|
5103
|
+
relationship: z39.enum(["family", "peer"]),
|
|
5099
5104
|
senderRunId: runId,
|
|
5100
5105
|
recipientRunId: runId,
|
|
5101
|
-
text:
|
|
5102
|
-
senderTitle:
|
|
5103
|
-
recipientTitle:
|
|
5106
|
+
text: z39.string().max(ACTIVITY_TEXT_MAX),
|
|
5107
|
+
senderTitle: z39.string().optional(),
|
|
5108
|
+
recipientTitle: z39.string().optional(),
|
|
5104
5109
|
createdAt: iso,
|
|
5105
5110
|
deadline: iso.optional()
|
|
5106
5111
|
}).strict();
|
|
5107
|
-
var activityClosedRequestSchema =
|
|
5108
|
-
requestId:
|
|
5112
|
+
var activityClosedRequestSchema = z39.object({
|
|
5113
|
+
requestId: z39.uuid(),
|
|
5109
5114
|
senderRunId: runId,
|
|
5110
5115
|
recipientRunId: runId,
|
|
5111
5116
|
status: requestOutcomeSchema.shape.status,
|
|
5112
5117
|
observedAt: iso
|
|
5113
5118
|
}).strict();
|
|
5114
|
-
var activityProjectSchema =
|
|
5115
|
-
projectId:
|
|
5116
|
-
name:
|
|
5119
|
+
var activityProjectSchema = z39.object({
|
|
5120
|
+
projectId: z39.string(),
|
|
5121
|
+
name: z39.string(),
|
|
5117
5122
|
/** False for a project this process has not loaded: its lists are empty because nothing was read. */
|
|
5118
|
-
loaded:
|
|
5123
|
+
loaded: z39.boolean(),
|
|
5119
5124
|
/** The project is loaded but its run store cannot open: the failure its project routes answer.
|
|
5120
5125
|
* The lists are empty because nothing could be read, not because nothing runs. */
|
|
5121
|
-
unavailable:
|
|
5126
|
+
unavailable: z39.object({ status: z39.union([z39.literal(404), z39.literal(409), z39.literal(503)]), error: z39.string() }).strict().optional(),
|
|
5122
5127
|
/** Root tasks in review: the summary chip (D8). */
|
|
5123
5128
|
inReview: count,
|
|
5124
|
-
tasks:
|
|
5125
|
-
requests:
|
|
5126
|
-
closed:
|
|
5129
|
+
tasks: z39.array(activityRunSchema),
|
|
5130
|
+
requests: z39.array(activityRequestSchema),
|
|
5131
|
+
closed: z39.array(activityClosedRequestSchema)
|
|
5127
5132
|
}).strict();
|
|
5128
|
-
var activitySnapshotSchema =
|
|
5133
|
+
var activitySnapshotSchema = z39.object({
|
|
5129
5134
|
/** The server clock; the client ticks ages from it. */
|
|
5130
5135
|
generatedAt: iso,
|
|
5131
5136
|
/** One entry, or every visible project for the global read. */
|
|
5132
|
-
projects:
|
|
5137
|
+
projects: z39.array(activityProjectSchema)
|
|
5133
5138
|
}).strict();
|
|
5134
|
-
var activityQuerySchema =
|
|
5135
|
-
project:
|
|
5139
|
+
var activityQuerySchema = z39.object({
|
|
5140
|
+
project: z39.union([z39.literal("default"), z39.string().regex(PROJECT_ID_PATTERN)]).optional()
|
|
5136
5141
|
});
|
|
5137
5142
|
|
|
5138
5143
|
// ../contract/src/live-coordination.ts
|
|
5139
|
-
import { z as
|
|
5144
|
+
import { z as z40 } from "zod";
|
|
5140
5145
|
var LIVE_PROTOCOL = 3;
|
|
5141
5146
|
var LIVE_WORKER_NAME = "cezar-live-v3";
|
|
5142
5147
|
var LEASE_MS = 15e3;
|
|
@@ -5145,111 +5150,111 @@ function allowedLiveRead(path) {
|
|
|
5145
5150
|
if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
|
|
5146
5151
|
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);
|
|
5147
5152
|
}
|
|
5148
|
-
var liveDemandSchema =
|
|
5149
|
-
|
|
5150
|
-
liveRunDemandSchema.extend({ kind:
|
|
5151
|
-
|
|
5153
|
+
var liveDemandSchema = z40.discriminatedUnion("kind", [
|
|
5154
|
+
z40.object({ kind: z40.literal("workspace") }),
|
|
5155
|
+
liveRunDemandSchema.extend({ kind: z40.literal("run") }),
|
|
5156
|
+
z40.object({ kind: z40.literal("topic"), topic: z40.string().min(1).max(128) }),
|
|
5152
5157
|
// Preserve server-directed cadence (settled references use ten minutes). Only
|
|
5153
5158
|
// bound the timer itself: larger delays overflow setTimeout into a tight loop.
|
|
5154
|
-
|
|
5159
|
+
z40.object({ kind: z40.literal("read"), path: z40.string().max(4096).refine(allowedLiveRead), intervalMs: z40.number().int().min(1e3).max(2147483647) })
|
|
5155
5160
|
]);
|
|
5156
|
-
var liveEntrySchema =
|
|
5157
|
-
var envelope =
|
|
5158
|
-
var ownerInputSchema =
|
|
5161
|
+
var liveEntrySchema = z40.object({ id: z40.string().min(1).max(128), demand: liveDemandSchema });
|
|
5162
|
+
var envelope = z40.object({ version: z40.literal(LIVE_PROTOCOL), documentId: z40.string().min(1).max(128), epoch: z40.number().int().nonnegative() });
|
|
5163
|
+
var ownerInputSchema = z40.discriminatedUnion("type", [
|
|
5159
5164
|
envelope.extend({
|
|
5160
|
-
type:
|
|
5161
|
-
entries:
|
|
5165
|
+
type: z40.literal("sync"),
|
|
5166
|
+
entries: z40.array(liveEntrySchema).max(64),
|
|
5162
5167
|
/** The document knows no workspace stream generation (its `ready` was lost, for example to
|
|
5163
5168
|
* an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
|
|
5164
|
-
workspaceReady:
|
|
5169
|
+
workspaceReady: z40.literal(true).optional()
|
|
5165
5170
|
}).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
|
|
5166
|
-
envelope.extend({ type:
|
|
5167
|
-
envelope.extend({ type:
|
|
5171
|
+
envelope.extend({ type: z40.literal("ack"), id: z40.string(), seq: z40.number().int().nonnegative() }),
|
|
5172
|
+
envelope.extend({ type: z40.literal("refresh"), id: z40.string() })
|
|
5168
5173
|
]);
|
|
5169
|
-
var wireFrameSchema =
|
|
5170
|
-
var ownerOutputSchema =
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5174
|
+
var wireFrameSchema = z40.object({ event: z40.string(), data: z40.string(), id: z40.string() });
|
|
5175
|
+
var ownerOutputSchema = z40.discriminatedUnion("type", [
|
|
5176
|
+
z40.object({ type: z40.literal("unavailable"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), reason: z40.string() }),
|
|
5177
|
+
z40.object({ type: z40.literal("hello"), version: z40.literal(LIVE_PROTOCOL) }),
|
|
5178
|
+
z40.object({ type: z40.literal("alive"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number() }),
|
|
5179
|
+
z40.object({ type: z40.literal("frame"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), frame: z40.union([wireFrameSchema, liveRunFrameSchema]) }),
|
|
5180
|
+
z40.object({ type: z40.literal("value"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), value: z40.unknown(), error: z40.string().optional() }),
|
|
5181
|
+
z40.object({ type: z40.literal("reset"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), reason: z40.string() })
|
|
5177
5182
|
]);
|
|
5178
5183
|
var runKey = (run) => `${run.projectId}/${run.runId}`;
|
|
5179
5184
|
|
|
5180
5185
|
// ../contract/src/workspace-events.ts
|
|
5181
|
-
import { z as
|
|
5182
|
-
var workspaceEventsQuerySchema =
|
|
5183
|
-
runs:
|
|
5186
|
+
import { z as z41 } from "zod";
|
|
5187
|
+
var workspaceEventsQuerySchema = z41.object({
|
|
5188
|
+
runs: z41.literal("summary").optional()
|
|
5184
5189
|
});
|
|
5185
|
-
var projectStamp =
|
|
5186
|
-
var frameSeq =
|
|
5187
|
-
var workspaceRunSummaryEventSchema =
|
|
5190
|
+
var projectStamp = z41.string().min(1);
|
|
5191
|
+
var frameSeq = z41.number().int().positive();
|
|
5192
|
+
var workspaceRunSummaryEventSchema = z41.object({
|
|
5188
5193
|
project: projectStamp,
|
|
5189
5194
|
seq: frameSeq,
|
|
5190
5195
|
run: runSummarySchema,
|
|
5191
|
-
relationships:
|
|
5196
|
+
relationships: z41.string().min(1)
|
|
5192
5197
|
});
|
|
5193
|
-
var workspaceRunDeletedEventSchema =
|
|
5198
|
+
var workspaceRunDeletedEventSchema = z41.object({
|
|
5194
5199
|
project: projectStamp,
|
|
5195
5200
|
seq: frameSeq,
|
|
5196
|
-
id:
|
|
5201
|
+
id: z41.string().min(1)
|
|
5197
5202
|
});
|
|
5198
|
-
var workspaceReadyEventSchema =
|
|
5199
|
-
generation:
|
|
5200
|
-
seq:
|
|
5203
|
+
var workspaceReadyEventSchema = z41.object({
|
|
5204
|
+
generation: z41.string().min(1),
|
|
5205
|
+
seq: z41.number().int().nonnegative()
|
|
5201
5206
|
});
|
|
5202
|
-
var workspaceUsageEventSchema =
|
|
5207
|
+
var workspaceUsageEventSchema = z41.object({
|
|
5203
5208
|
project: projectStamp,
|
|
5204
|
-
usage:
|
|
5209
|
+
usage: z41.record(z41.string(), processUsageSchema)
|
|
5205
5210
|
});
|
|
5206
|
-
var runsIndexResponseSchema =
|
|
5211
|
+
var runsIndexResponseSchema = z41.object({
|
|
5207
5212
|
/** Newest first, across every registered project: each project's window
|
|
5208
5213
|
* (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
|
|
5209
5214
|
* archived root runs. Owned workers are never included. Older archived runs are reached
|
|
5210
5215
|
* through `GET /workspace/runs-search`. */
|
|
5211
|
-
runs:
|
|
5216
|
+
runs: z41.array(runIndexEntrySchema),
|
|
5212
5217
|
/** Additive: absent statuses mean "nothing warm", never "nothing to show". */
|
|
5213
5218
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
5214
5219
|
/** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
|
|
5215
|
-
perProjectLimit:
|
|
5220
|
+
perProjectLimit: z41.number(),
|
|
5216
5221
|
/** Ids of the projects that had more archived root runs than `perProjectLimit`. */
|
|
5217
|
-
truncated:
|
|
5222
|
+
truncated: z41.array(z41.string()),
|
|
5218
5223
|
/** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
|
|
5219
5224
|
* compares only within one generation. */
|
|
5220
|
-
generation:
|
|
5225
|
+
generation: z41.string().min(1),
|
|
5221
5226
|
/** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
|
|
5222
5227
|
* frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
|
|
5223
|
-
eventSeq:
|
|
5228
|
+
eventSeq: z41.number().int().nonnegative()
|
|
5224
5229
|
});
|
|
5225
5230
|
|
|
5226
5231
|
// ../contract/src/permissions.ts
|
|
5227
|
-
import { z as
|
|
5228
|
-
var permissionOptionKindSchema =
|
|
5229
|
-
var permissionOptionSchema =
|
|
5230
|
-
id:
|
|
5231
|
-
label:
|
|
5232
|
+
import { z as z42 } from "zod";
|
|
5233
|
+
var permissionOptionKindSchema = z42.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
|
|
5234
|
+
var permissionOptionSchema = z42.object({
|
|
5235
|
+
id: z42.string().min(1).max(128),
|
|
5236
|
+
label: z42.string().min(1),
|
|
5232
5237
|
kind: permissionOptionKindSchema
|
|
5233
5238
|
}).strict();
|
|
5234
|
-
var permissionRequestedSchema =
|
|
5235
|
-
type:
|
|
5236
|
-
requestId:
|
|
5237
|
-
itemId:
|
|
5238
|
-
title:
|
|
5239
|
-
details:
|
|
5240
|
-
options:
|
|
5239
|
+
var permissionRequestedSchema = z42.object({
|
|
5240
|
+
type: z42.literal("permission.requested"),
|
|
5241
|
+
requestId: z42.string().min(1).max(128),
|
|
5242
|
+
itemId: z42.string().optional(),
|
|
5243
|
+
title: z42.string().min(1),
|
|
5244
|
+
details: z42.string().optional(),
|
|
5245
|
+
options: z42.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
|
|
5241
5246
|
}).strict();
|
|
5242
|
-
var permissionResolvedSchema =
|
|
5243
|
-
type:
|
|
5244
|
-
requestId:
|
|
5245
|
-
optionId:
|
|
5246
|
-
reason:
|
|
5247
|
+
var permissionResolvedSchema = z42.object({
|
|
5248
|
+
type: z42.literal("permission.resolved"),
|
|
5249
|
+
requestId: z42.string().min(1).max(128),
|
|
5250
|
+
optionId: z42.string().optional(),
|
|
5251
|
+
reason: z42.string().optional()
|
|
5247
5252
|
}).strict();
|
|
5248
|
-
var permissionDecisionSchema =
|
|
5249
|
-
requestId:
|
|
5250
|
-
optionId:
|
|
5253
|
+
var permissionDecisionSchema = z42.object({
|
|
5254
|
+
requestId: z42.string().min(1).max(128),
|
|
5255
|
+
optionId: z42.string().min(1).max(128)
|
|
5251
5256
|
}).strict();
|
|
5252
|
-
var permissionDecisionResponseSchema =
|
|
5257
|
+
var permissionDecisionResponseSchema = z42.object({ delivered: z42.literal(true) });
|
|
5253
5258
|
|
|
5254
5259
|
// ../contract/src/defined.ts
|
|
5255
5260
|
function defined(value) {
|
|
@@ -5519,83 +5524,83 @@ function isImagePath(path) {
|
|
|
5519
5524
|
}
|
|
5520
5525
|
|
|
5521
5526
|
// ../contract/src/provider-requests.ts
|
|
5522
|
-
import { z as
|
|
5523
|
-
var providerConnectSchema =
|
|
5527
|
+
import { z as z43 } from "zod";
|
|
5528
|
+
var providerConnectSchema = z43.object({
|
|
5524
5529
|
provider: runnerSchema,
|
|
5525
5530
|
/** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
|
|
5526
5531
|
* default, which is what every pre-profiles client sends. Without this, "Connect" on a second
|
|
5527
5532
|
* Claude account would open a login for the FIRST one and report success. */
|
|
5528
|
-
profileId:
|
|
5533
|
+
profileId: z43.string().max(64).optional()
|
|
5529
5534
|
}).strict();
|
|
5530
|
-
var createAgentProfileSchema =
|
|
5535
|
+
var createAgentProfileSchema = z43.object({
|
|
5531
5536
|
provider: runnerSchema,
|
|
5532
|
-
label:
|
|
5533
|
-
configDir:
|
|
5537
|
+
label: z43.string().trim().max(200).optional(),
|
|
5538
|
+
configDir: z43.string().trim().min(1).max(4096)
|
|
5534
5539
|
}).strict();
|
|
5535
|
-
var updateAgentProfileSchema =
|
|
5536
|
-
label:
|
|
5537
|
-
configDir:
|
|
5540
|
+
var updateAgentProfileSchema = z43.object({
|
|
5541
|
+
label: z43.string().trim().max(200).optional(),
|
|
5542
|
+
configDir: z43.string().trim().min(1).max(4096).optional()
|
|
5538
5543
|
}).strict().refine(
|
|
5539
5544
|
(value) => value.label !== void 0 || value.configDir !== void 0,
|
|
5540
5545
|
"send label or configDir"
|
|
5541
5546
|
);
|
|
5542
|
-
var selectAgentProfileSchema =
|
|
5543
|
-
projectId:
|
|
5547
|
+
var selectAgentProfileSchema = z43.object({
|
|
5548
|
+
projectId: z43.string().min(1).max(64),
|
|
5544
5549
|
provider: runnerSchema,
|
|
5545
|
-
profileId:
|
|
5550
|
+
profileId: z43.string().max(64).nullable()
|
|
5546
5551
|
}).strict();
|
|
5547
5552
|
var providerParamSchema = runnerSchema;
|
|
5548
|
-
var providerEnabledSchema =
|
|
5549
|
-
var providerRetrySchema =
|
|
5550
|
-
authFailureId:
|
|
5553
|
+
var providerEnabledSchema = z43.object({ enabled: z43.boolean() }).strict();
|
|
5554
|
+
var providerRetrySchema = z43.object({
|
|
5555
|
+
authFailureId: z43.string().min(1).max(128)
|
|
5551
5556
|
}).strict();
|
|
5552
|
-
var providerRouteParamsSchema =
|
|
5553
|
-
var agentProfileRouteParamsSchema =
|
|
5554
|
-
var providerSignInParamsSchema =
|
|
5555
|
-
var providerSignInRedirectSchema =
|
|
5557
|
+
var providerRouteParamsSchema = z43.object({ provider: providerParamSchema });
|
|
5558
|
+
var agentProfileRouteParamsSchema = z43.object({ id: z43.string() });
|
|
5559
|
+
var providerSignInParamsSchema = z43.object({ id: z43.uuid() });
|
|
5560
|
+
var providerSignInRedirectSchema = z43.object({
|
|
5556
5561
|
/** The address the browser landed on after consent, or the code that page shows. */
|
|
5557
|
-
redirectUrl:
|
|
5562
|
+
redirectUrl: z43.string().trim().min(1).max(8192)
|
|
5558
5563
|
}).strict();
|
|
5559
5564
|
|
|
5560
5565
|
// ../contract/src/automation-requests.ts
|
|
5561
|
-
import { z as
|
|
5566
|
+
import { z as z45 } from "zod";
|
|
5562
5567
|
|
|
5563
5568
|
// ../contract/src/automation-storage.ts
|
|
5564
|
-
import { z as
|
|
5565
|
-
var storedAutomationEventSchema =
|
|
5569
|
+
import { z as z44 } from "zod";
|
|
5570
|
+
var storedAutomationEventSchema = z44.enum([
|
|
5566
5571
|
"pull_request.opened",
|
|
5567
5572
|
"issue.opened",
|
|
5568
5573
|
"issue.labeled",
|
|
5569
5574
|
"issue.unlabeled"
|
|
5570
5575
|
]);
|
|
5571
|
-
var boundedString =
|
|
5572
|
-
var stringList =
|
|
5573
|
-
var storedAutomationFiltersSchema =
|
|
5574
|
-
includeExisting:
|
|
5576
|
+
var boundedString = z44.string().trim().min(1).max(200);
|
|
5577
|
+
var stringList = z44.array(boundedString).max(100).optional();
|
|
5578
|
+
var storedAutomationFiltersSchema = z44.object({
|
|
5579
|
+
includeExisting: z44.boolean().optional(),
|
|
5575
5580
|
/** Require an open item and matching live labels before reservation and launch. */
|
|
5576
|
-
requireCurrentLabels:
|
|
5581
|
+
requireCurrentLabels: z44.boolean().optional(),
|
|
5577
5582
|
authors: stringList,
|
|
5578
5583
|
assignees: stringList,
|
|
5579
5584
|
allLabels: stringList,
|
|
5580
5585
|
anyLabels: stringList,
|
|
5581
5586
|
excludeLabels: stringList,
|
|
5582
5587
|
changedLabels: stringList,
|
|
5583
|
-
lookbackDays:
|
|
5584
|
-
maxRecords:
|
|
5588
|
+
lookbackDays: z44.number().int().min(1).max(90).default(7),
|
|
5589
|
+
maxRecords: z44.number().int().min(1).max(100).default(25)
|
|
5585
5590
|
}).passthrough();
|
|
5586
|
-
var storedAutomationTaskSchema =
|
|
5587
|
-
prompt:
|
|
5588
|
-
workflow:
|
|
5589
|
-
steps:
|
|
5591
|
+
var storedAutomationTaskSchema = z44.object({
|
|
5592
|
+
prompt: z44.string().min(1).max(1e5),
|
|
5593
|
+
workflow: z44.string().trim().min(1).max(200).optional(),
|
|
5594
|
+
steps: z44.array(workflowStepDefSchema).min(1).max(100).optional(),
|
|
5590
5595
|
runner: runnerSchema.optional(),
|
|
5591
|
-
model:
|
|
5592
|
-
effort:
|
|
5593
|
-
variants:
|
|
5594
|
-
worktree:
|
|
5595
|
-
autonomous:
|
|
5596
|
+
model: z44.string().trim().min(1).max(200).optional(),
|
|
5597
|
+
effort: z44.string().trim().min(1).max(32).optional(),
|
|
5598
|
+
variants: z44.union([z44.literal(1), z44.literal(2), z44.literal(3)]).optional(),
|
|
5599
|
+
worktree: z44.boolean().optional(),
|
|
5600
|
+
autonomous: z44.boolean().optional(),
|
|
5596
5601
|
...completionControlsShape,
|
|
5597
5602
|
...taskAccessShape,
|
|
5598
|
-
systemPrompt:
|
|
5603
|
+
systemPrompt: z44.string().max(1e5).optional()
|
|
5599
5604
|
}).passthrough().refine((task) => !(task.workflow && task.steps), {
|
|
5600
5605
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5601
5606
|
});
|
|
@@ -5613,122 +5618,122 @@ var fillGithubDefaults = (raw) => {
|
|
|
5613
5618
|
filters: record.filters ?? {}
|
|
5614
5619
|
};
|
|
5615
5620
|
};
|
|
5616
|
-
var storedAutomationDefinitionObjectSchema =
|
|
5617
|
-
id:
|
|
5618
|
-
revision:
|
|
5619
|
-
name:
|
|
5620
|
-
description:
|
|
5621
|
-
enabled:
|
|
5621
|
+
var storedAutomationDefinitionObjectSchema = z44.object({
|
|
5622
|
+
id: z44.string().min(1).max(100),
|
|
5623
|
+
revision: z44.number().int().positive(),
|
|
5624
|
+
name: z44.string().trim().min(1).max(200),
|
|
5625
|
+
description: z44.string().max(2e3).optional(),
|
|
5626
|
+
enabled: z44.boolean().default(false),
|
|
5622
5627
|
/** A definition written before schedules has no `kind`: it is a poll. */
|
|
5623
5628
|
kind: automationKindSchema.default("github"),
|
|
5624
|
-
events:
|
|
5625
|
-
intervalSeconds:
|
|
5629
|
+
events: z44.array(storedAutomationEventSchema).min(1).max(4).optional(),
|
|
5630
|
+
intervalSeconds: z44.number().int().min(60).max(86400).optional(),
|
|
5626
5631
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5627
5632
|
// Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
|
|
5628
5633
|
schedule: automationScheduleSchema.passthrough().optional(),
|
|
5629
5634
|
task: storedAutomationTaskSchema,
|
|
5630
5635
|
/** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
|
|
5631
|
-
archived:
|
|
5632
|
-
at:
|
|
5633
|
-
outcome:
|
|
5634
|
-
runId:
|
|
5635
|
-
receiptId:
|
|
5636
|
-
trigger:
|
|
5636
|
+
archived: z44.object({
|
|
5637
|
+
at: z44.string().datetime(),
|
|
5638
|
+
outcome: z44.enum(["launched", "cancelled"]),
|
|
5639
|
+
runId: z44.string().optional(),
|
|
5640
|
+
receiptId: z44.string().optional(),
|
|
5641
|
+
trigger: z44.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
5637
5642
|
}).passthrough().optional(),
|
|
5638
|
-
createdAt:
|
|
5639
|
-
updatedAt:
|
|
5643
|
+
createdAt: z44.string().datetime(),
|
|
5644
|
+
updatedAt: z44.string().datetime()
|
|
5640
5645
|
}).passthrough().superRefine((definition, ctx) => {
|
|
5641
5646
|
if (definition.kind === "schedule") {
|
|
5642
5647
|
if (!definition.schedule) {
|
|
5643
|
-
ctx.addIssue({ code:
|
|
5648
|
+
ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
|
|
5644
5649
|
}
|
|
5645
5650
|
return;
|
|
5646
5651
|
}
|
|
5647
5652
|
if (!definition.events?.length) {
|
|
5648
|
-
ctx.addIssue({ code:
|
|
5653
|
+
ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
|
|
5649
5654
|
}
|
|
5650
5655
|
if (definition.intervalSeconds === void 0) {
|
|
5651
|
-
ctx.addIssue({ code:
|
|
5656
|
+
ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
|
|
5652
5657
|
}
|
|
5653
5658
|
if (!definition.filters) {
|
|
5654
|
-
ctx.addIssue({ code:
|
|
5659
|
+
ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
|
|
5655
5660
|
}
|
|
5656
5661
|
if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
|
|
5657
5662
|
ctx.addIssue({
|
|
5658
|
-
code:
|
|
5663
|
+
code: z44.ZodIssueCode.custom,
|
|
5659
5664
|
path: ["filters", "changedLabels"],
|
|
5660
5665
|
message: "changedLabels is required for issue label events"
|
|
5661
5666
|
});
|
|
5662
5667
|
}
|
|
5663
5668
|
});
|
|
5664
|
-
var storedAutomationDefinitionSchema =
|
|
5665
|
-
var storedAutomationDefinitionsFileSchema =
|
|
5666
|
-
version:
|
|
5667
|
-
automations:
|
|
5668
|
-
tombstones:
|
|
5669
|
+
var storedAutomationDefinitionSchema = z44.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
|
|
5670
|
+
var storedAutomationDefinitionsFileSchema = z44.object({
|
|
5671
|
+
version: z44.literal(1).default(1),
|
|
5672
|
+
automations: z44.array(z44.unknown()).default([]),
|
|
5673
|
+
tombstones: z44.record(z44.string(), z44.string().datetime()).optional()
|
|
5669
5674
|
}).passthrough();
|
|
5670
|
-
var storedAutomationCursorSchema =
|
|
5671
|
-
timestamp:
|
|
5672
|
-
tieBreaker:
|
|
5675
|
+
var storedAutomationCursorSchema = z44.object({
|
|
5676
|
+
timestamp: z44.string().datetime(),
|
|
5677
|
+
tieBreaker: z44.string().optional()
|
|
5673
5678
|
}).passthrough();
|
|
5674
5679
|
var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
|
|
5675
5680
|
cursor: storedAutomationCursorSchema.optional()
|
|
5676
5681
|
});
|
|
5677
|
-
var storedAutomationRuntimeStateSchema =
|
|
5678
|
-
revision:
|
|
5679
|
-
baselineAt:
|
|
5682
|
+
var storedAutomationRuntimeStateSchema = z44.object({
|
|
5683
|
+
revision: z44.number().int().positive().optional(),
|
|
5684
|
+
baselineAt: z44.string().datetime().optional(),
|
|
5680
5685
|
/** Arming time, independent of a history window's older lower bound. */
|
|
5681
|
-
armedAt:
|
|
5686
|
+
armedAt: z44.string().datetime().optional(),
|
|
5682
5687
|
historyScan: storedAutomationHistoryScanSchema.optional(),
|
|
5683
5688
|
cursor: storedAutomationCursorSchema.optional(),
|
|
5684
|
-
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5685
|
-
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5686
|
-
nextCheckAt:
|
|
5687
|
-
lastSuccessAt:
|
|
5689
|
+
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
|
|
5690
|
+
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
|
|
5691
|
+
nextCheckAt: z44.string().datetime().optional(),
|
|
5692
|
+
lastSuccessAt: z44.string().datetime().optional(),
|
|
5688
5693
|
/** schedule kind: the next occurrence's instant and the last fired one's. */
|
|
5689
|
-
nextRunAt:
|
|
5690
|
-
lastRunAt:
|
|
5691
|
-
etags:
|
|
5692
|
-
backoffUntil:
|
|
5693
|
-
consecutiveFailures:
|
|
5694
|
+
nextRunAt: z44.string().datetime().optional(),
|
|
5695
|
+
lastRunAt: z44.string().datetime().optional(),
|
|
5696
|
+
etags: z44.record(z44.string(), z44.string()).optional(),
|
|
5697
|
+
backoffUntil: z44.string().datetime().optional(),
|
|
5698
|
+
consecutiveFailures: z44.number().int().nonnegative().optional(),
|
|
5694
5699
|
...automationLastErrorShape,
|
|
5695
5700
|
/** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
|
|
5696
|
-
onceOutcome:
|
|
5701
|
+
onceOutcome: z44.enum(["failed", "missed"]).optional()
|
|
5697
5702
|
}).passthrough();
|
|
5698
|
-
var storedAutomationStateFileSchema =
|
|
5699
|
-
version:
|
|
5700
|
-
states:
|
|
5703
|
+
var storedAutomationStateFileSchema = z44.object({
|
|
5704
|
+
version: z44.literal(1).default(1),
|
|
5705
|
+
states: z44.record(z44.string(), storedAutomationRuntimeStateSchema).default({})
|
|
5701
5706
|
}).passthrough();
|
|
5702
|
-
var storedAutomationReceiptSchema =
|
|
5703
|
-
receiptId:
|
|
5704
|
-
receiptKey:
|
|
5705
|
-
eventId:
|
|
5706
|
-
automationId:
|
|
5707
|
-
revision:
|
|
5708
|
-
status:
|
|
5709
|
-
runId:
|
|
5710
|
-
observedAt:
|
|
5711
|
-
updatedAt:
|
|
5712
|
-
error:
|
|
5707
|
+
var storedAutomationReceiptSchema = z44.object({
|
|
5708
|
+
receiptId: z44.string().min(1),
|
|
5709
|
+
receiptKey: z44.string().min(1),
|
|
5710
|
+
eventId: z44.string().min(1),
|
|
5711
|
+
automationId: z44.string().min(1),
|
|
5712
|
+
revision: z44.number().int().positive(),
|
|
5713
|
+
status: z44.enum(["reserved", "launched", "launch-error", "released"]),
|
|
5714
|
+
runId: z44.string().optional(),
|
|
5715
|
+
observedAt: z44.string().datetime(),
|
|
5716
|
+
updatedAt: z44.string().datetime(),
|
|
5717
|
+
error: z44.string().max(2e3).optional(),
|
|
5713
5718
|
/** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
|
|
5714
|
-
occurrenceAt:
|
|
5715
|
-
candidate:
|
|
5716
|
-
eventId:
|
|
5719
|
+
occurrenceAt: z44.string().datetime().optional(),
|
|
5720
|
+
candidate: z44.object({
|
|
5721
|
+
eventId: z44.string(),
|
|
5717
5722
|
event: storedAutomationEventSchema,
|
|
5718
|
-
timestamp:
|
|
5719
|
-
tieBreaker:
|
|
5720
|
-
repo:
|
|
5721
|
-
nodeId:
|
|
5722
|
-
number:
|
|
5723
|
-
title:
|
|
5724
|
-
url:
|
|
5725
|
-
author:
|
|
5726
|
-
assignees:
|
|
5727
|
-
labels:
|
|
5728
|
-
changedLabel:
|
|
5723
|
+
timestamp: z44.string().datetime(),
|
|
5724
|
+
tieBreaker: z44.string(),
|
|
5725
|
+
repo: z44.string(),
|
|
5726
|
+
nodeId: z44.string(),
|
|
5727
|
+
number: z44.number().int().positive(),
|
|
5728
|
+
title: z44.string().max(500),
|
|
5729
|
+
url: z44.string().url(),
|
|
5730
|
+
author: z44.string().max(200),
|
|
5731
|
+
assignees: z44.array(z44.string().max(200)).max(100),
|
|
5732
|
+
labels: z44.array(z44.string().max(200)).max(100),
|
|
5733
|
+
changedLabel: z44.string().max(200).optional()
|
|
5729
5734
|
}).passthrough().optional()
|
|
5730
5735
|
}).passthrough();
|
|
5731
|
-
var storedAutomationLogResultSchema =
|
|
5736
|
+
var storedAutomationLogResultSchema = z44.enum([
|
|
5732
5737
|
"launched",
|
|
5733
5738
|
"no-match",
|
|
5734
5739
|
"duplicate",
|
|
@@ -5744,24 +5749,24 @@ var storedAutomationLogResultSchema = z43.enum([
|
|
|
5744
5749
|
// once schedule
|
|
5745
5750
|
"missed"
|
|
5746
5751
|
]);
|
|
5747
|
-
var storedAutomationLogRecordSchema =
|
|
5748
|
-
seq:
|
|
5749
|
-
ts:
|
|
5750
|
-
automationId:
|
|
5751
|
-
revision:
|
|
5752
|
+
var storedAutomationLogRecordSchema = z44.object({
|
|
5753
|
+
seq: z44.number().int().positive(),
|
|
5754
|
+
ts: z44.string().datetime(),
|
|
5755
|
+
automationId: z44.string().min(1),
|
|
5756
|
+
revision: z44.number().int().positive(),
|
|
5752
5757
|
event: storedAutomationEventSchema.optional(),
|
|
5753
5758
|
result: storedAutomationLogResultSchema,
|
|
5754
|
-
reason:
|
|
5755
|
-
durationMs:
|
|
5756
|
-
receiptId:
|
|
5757
|
-
runId:
|
|
5758
|
-
githubNumber:
|
|
5759
|
-
githubTitle:
|
|
5760
|
-
githubUrl:
|
|
5761
|
-
rateLimit:
|
|
5762
|
-
bucket:
|
|
5763
|
-
remaining:
|
|
5764
|
-
resetAt:
|
|
5759
|
+
reason: z44.string().max(2e3).optional(),
|
|
5760
|
+
durationMs: z44.number().int().nonnegative().optional(),
|
|
5761
|
+
receiptId: z44.string().optional(),
|
|
5762
|
+
runId: z44.string().optional(),
|
|
5763
|
+
githubNumber: z44.number().int().positive().optional(),
|
|
5764
|
+
githubTitle: z44.string().max(500).optional(),
|
|
5765
|
+
githubUrl: z44.string().url().optional(),
|
|
5766
|
+
rateLimit: z44.object({
|
|
5767
|
+
bucket: z44.enum(["core", "search"]),
|
|
5768
|
+
remaining: z44.number().int().nonnegative().optional(),
|
|
5769
|
+
resetAt: z44.string().datetime().optional()
|
|
5765
5770
|
}).passthrough().optional()
|
|
5766
5771
|
}).passthrough();
|
|
5767
5772
|
function storedIsOnceSchedule(definition) {
|
|
@@ -5775,210 +5780,210 @@ function storedIsScheduleAutomation(definition) {
|
|
|
5775
5780
|
}
|
|
5776
5781
|
|
|
5777
5782
|
// ../contract/src/automation-requests.ts
|
|
5778
|
-
var automationEditableSchema =
|
|
5779
|
-
name:
|
|
5780
|
-
description:
|
|
5781
|
-
enabled:
|
|
5783
|
+
var automationEditableSchema = z45.object({
|
|
5784
|
+
name: z45.string().trim().min(1).max(200),
|
|
5785
|
+
description: z45.string().max(2e3).optional(),
|
|
5786
|
+
enabled: z45.boolean().optional(),
|
|
5782
5787
|
kind: automationKindSchema.optional(),
|
|
5783
|
-
events:
|
|
5784
|
-
intervalSeconds:
|
|
5788
|
+
events: z45.array(automationEventSchema).min(1).max(4).optional(),
|
|
5789
|
+
intervalSeconds: z45.number().int().min(60).max(86400).optional(),
|
|
5785
5790
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5786
5791
|
schedule: automationScheduleSchema.optional(),
|
|
5787
|
-
task:
|
|
5792
|
+
task: z45.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
|
|
5788
5793
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5789
5794
|
})
|
|
5790
5795
|
}).strict();
|
|
5791
|
-
var automationCreateSchema = automationEditableSchema.extend({ enable:
|
|
5792
|
-
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision:
|
|
5793
|
-
var automationCheckRequestSchema =
|
|
5794
|
-
var automationLogQuerySchema =
|
|
5795
|
-
automationId:
|
|
5796
|
+
var automationCreateSchema = automationEditableSchema.extend({ enable: z45.boolean().optional() });
|
|
5797
|
+
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z45.number().int().positive() });
|
|
5798
|
+
var automationCheckRequestSchema = z45.object({ mode: z45.enum(["preview", "execute"]) }).strict();
|
|
5799
|
+
var automationLogQuerySchema = z45.object({
|
|
5800
|
+
automationId: z45.string().optional(),
|
|
5796
5801
|
result: automationLogResultSchema.optional(),
|
|
5797
5802
|
event: automationEventSchema.optional(),
|
|
5798
|
-
since:
|
|
5799
|
-
cursor:
|
|
5803
|
+
since: z45.string().datetime().optional(),
|
|
5804
|
+
cursor: z45.coerce.number().int().positive().optional(),
|
|
5800
5805
|
// Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
|
|
5801
5806
|
// 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
|
|
5802
5807
|
// request type `queryZodValidator` publishes (see validators.ts on why the request side falls
|
|
5803
5808
|
// back to the schema's output), which would have made every caller send a `?limit=` this route
|
|
5804
5809
|
// never needed.
|
|
5805
|
-
limit:
|
|
5810
|
+
limit: z45.coerce.number().int().min(1).max(100).optional()
|
|
5806
5811
|
});
|
|
5807
5812
|
|
|
5808
5813
|
// ../contract/src/workflow-requests.ts
|
|
5809
|
-
import { z as
|
|
5810
|
-
var planSchema =
|
|
5814
|
+
import { z as z46 } from "zod";
|
|
5815
|
+
var planSchema = z46.object({
|
|
5811
5816
|
// Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
|
|
5812
|
-
task:
|
|
5817
|
+
task: z46.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
|
|
5813
5818
|
/** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
|
|
5814
5819
|
* selection (hearsay-tools/squawk#4116). */
|
|
5815
|
-
agentProfile:
|
|
5820
|
+
agentProfile: z46.string().max(64).optional()
|
|
5816
5821
|
});
|
|
5817
|
-
var parseWorkflowSchema =
|
|
5818
|
-
yaml:
|
|
5822
|
+
var parseWorkflowSchema = z46.object({
|
|
5823
|
+
yaml: z46.string().min(1).max(1e5)
|
|
5819
5824
|
});
|
|
5820
5825
|
|
|
5821
5826
|
// ../contract/src/ui-state-requests.ts
|
|
5822
|
-
import { z as
|
|
5827
|
+
import { z as z47 } from "zod";
|
|
5823
5828
|
var SKILL_USAGE_MAX_ENTRIES = 200;
|
|
5824
5829
|
var UI_STATE_MAX_KEYS = 200;
|
|
5825
5830
|
var uiStateSchema2 = uiStateSchema.extend({
|
|
5826
5831
|
// null records a quick task with no selected skill or workflow.
|
|
5827
|
-
lastTask:
|
|
5828
|
-
source:
|
|
5829
|
-
ref:
|
|
5832
|
+
lastTask: z47.object({
|
|
5833
|
+
source: z47.enum(["workflow", "skill"]),
|
|
5834
|
+
ref: z47.string().min(1).max(200)
|
|
5830
5835
|
}).nullable().optional(),
|
|
5831
5836
|
// Most recent source choices, newest first.
|
|
5832
|
-
recentSources:
|
|
5833
|
-
|
|
5834
|
-
source:
|
|
5835
|
-
ref:
|
|
5837
|
+
recentSources: z47.array(
|
|
5838
|
+
z47.object({
|
|
5839
|
+
source: z47.enum(["workflow", "skill"]),
|
|
5840
|
+
ref: z47.string().min(1).max(200)
|
|
5836
5841
|
})
|
|
5837
5842
|
).max(50).optional(),
|
|
5838
|
-
skillUsage:
|
|
5843
|
+
skillUsage: z47.record(z47.string().min(1).max(200), z47.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
|
|
5839
5844
|
message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
|
|
5840
5845
|
}).optional(),
|
|
5841
|
-
promptTemplates:
|
|
5842
|
-
|
|
5843
|
-
id:
|
|
5844
|
-
label:
|
|
5845
|
-
text:
|
|
5846
|
+
promptTemplates: z47.array(
|
|
5847
|
+
z47.object({
|
|
5848
|
+
id: z47.string().min(1).max(64),
|
|
5849
|
+
label: z47.string().trim().min(1).max(80),
|
|
5850
|
+
text: z47.string().trim().min(1).max(2e3),
|
|
5846
5851
|
// Skill names this template auto-applies for. Optional and additive: templates
|
|
5847
5852
|
// written before this key existed keep validating, and stay manual-only.
|
|
5848
|
-
skills:
|
|
5853
|
+
skills: z47.array(z47.string().trim().min(1).max(200)).max(50).optional()
|
|
5849
5854
|
})
|
|
5850
5855
|
).max(50).optional()
|
|
5851
5856
|
}).passthrough();
|
|
5852
5857
|
function capUiStateKeys(data, ctx) {
|
|
5853
5858
|
if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
|
|
5854
|
-
ctx.addIssue({ code:
|
|
5859
|
+
ctx.addIssue({ code: z47.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
|
|
5855
5860
|
}
|
|
5856
5861
|
}
|
|
5857
5862
|
var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
|
|
5858
5863
|
|
|
5859
5864
|
// ../contract/src/run-requests.ts
|
|
5860
|
-
import { z as
|
|
5861
|
-
var queuedMessagePatchSchema =
|
|
5862
|
-
text:
|
|
5863
|
-
images:
|
|
5865
|
+
import { z as z48 } from "zod";
|
|
5866
|
+
var queuedMessagePatchSchema = z48.object({
|
|
5867
|
+
text: z48.string().max(1e5).optional(),
|
|
5868
|
+
images: z48.array(attachmentInputSchema).max(4).optional()
|
|
5864
5869
|
}).refine((m) => m.text !== void 0 || m.images !== void 0, {
|
|
5865
5870
|
message: "message edit needs text or attachments"
|
|
5866
5871
|
});
|
|
5867
|
-
var continueSchema =
|
|
5868
|
-
text:
|
|
5869
|
-
images:
|
|
5872
|
+
var continueSchema = z48.object({
|
|
5873
|
+
text: z48.string().max(1e5, "must be at most 100000 characters").optional(),
|
|
5874
|
+
images: z48.array(attachmentInputSchema).max(4).optional(),
|
|
5870
5875
|
runner: runnerSchema.optional(),
|
|
5871
|
-
model:
|
|
5876
|
+
model: z48.string().max(200).optional(),
|
|
5872
5877
|
/** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
|
|
5873
|
-
effort:
|
|
5878
|
+
effort: z48.string().max(32).optional()
|
|
5874
5879
|
});
|
|
5875
|
-
var archiveSchema =
|
|
5876
|
-
archived:
|
|
5880
|
+
var archiveSchema = z48.object({
|
|
5881
|
+
archived: z48.boolean().optional()
|
|
5877
5882
|
});
|
|
5878
|
-
var openInSchema =
|
|
5883
|
+
var openInSchema = z48.object({
|
|
5879
5884
|
// A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
|
|
5880
|
-
target:
|
|
5881
|
-
path:
|
|
5885
|
+
target: z48.string().trim().min(1, "target required").max(200),
|
|
5886
|
+
path: z48.string().max(1e3).optional()
|
|
5882
5887
|
});
|
|
5883
5888
|
|
|
5884
5889
|
// ../contract/src/query-requests.ts
|
|
5885
|
-
import { z as
|
|
5886
|
-
var queryValue =
|
|
5887
|
-
var refreshQuery =
|
|
5888
|
-
var waitQuery =
|
|
5889
|
-
var queryRunnerSchema =
|
|
5890
|
-
var modelDiscoveryQuerySchema =
|
|
5891
|
-
var strictRefreshQuerySchema =
|
|
5892
|
-
var browseQuerySchema =
|
|
5893
|
-
var worktreeFilesQuerySchema =
|
|
5894
|
-
var commitQuerySchema =
|
|
5890
|
+
import { z as z49 } from "zod";
|
|
5891
|
+
var queryValue = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).optional();
|
|
5892
|
+
var refreshQuery = z49.object({ refresh: queryValue });
|
|
5893
|
+
var waitQuery = z49.object({ wait: queryValue });
|
|
5894
|
+
var queryRunnerSchema = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
|
|
5895
|
+
var modelDiscoveryQuerySchema = z49.object({ runner: queryRunnerSchema, profileId: z49.string().max(64).optional() });
|
|
5896
|
+
var strictRefreshQuerySchema = z49.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
5897
|
+
var browseQuerySchema = z49.object({ path: queryValue, showHidden: queryValue });
|
|
5898
|
+
var worktreeFilesQuerySchema = z49.object({ path: queryValue, raw: queryValue });
|
|
5899
|
+
var commitQuerySchema = z49.object({ structured: queryValue });
|
|
5895
5900
|
|
|
5896
5901
|
// ../contract/src/github-requests.ts
|
|
5897
|
-
import { z as
|
|
5898
|
-
var mergeNumberParams =
|
|
5899
|
-
var prChangesParams =
|
|
5900
|
-
var prChangesQuery =
|
|
5901
|
-
var mergeBodySchema =
|
|
5902
|
-
method:
|
|
5903
|
-
expectedHeadSha:
|
|
5904
|
-
overrideRules:
|
|
5902
|
+
import { z as z50 } from "zod";
|
|
5903
|
+
var mergeNumberParams = z50.object({ number: z50.coerce.number().int().positive() });
|
|
5904
|
+
var prChangesParams = z50.object({ number: z50.coerce.number().int().positive().safe() });
|
|
5905
|
+
var prChangesQuery = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
5906
|
+
var mergeBodySchema = z50.object({
|
|
5907
|
+
method: z50.enum(["merge", "squash", "rebase"]),
|
|
5908
|
+
expectedHeadSha: z50.string().regex(/^[0-9a-f]{40}$/),
|
|
5909
|
+
overrideRules: z50.boolean().optional().default(false)
|
|
5905
5910
|
}).strict();
|
|
5906
|
-
var githubChecksQuerySchema =
|
|
5907
|
-
var githubRefsQuerySchema =
|
|
5911
|
+
var githubChecksQuerySchema = z50.object({ prs: z50.string().min(1) });
|
|
5912
|
+
var githubRefsQuerySchema = z50.object({ prs: z50.string().optional(), issues: z50.string().optional() });
|
|
5908
5913
|
|
|
5909
5914
|
// ../contract/src/repo-requests.ts
|
|
5910
|
-
import { z as
|
|
5911
|
-
var gitCommitSchema =
|
|
5912
|
-
message:
|
|
5915
|
+
import { z as z51 } from "zod";
|
|
5916
|
+
var gitCommitSchema = z51.object({
|
|
5917
|
+
message: z51.string().trim().min(1, "must not be empty").max(5e3)
|
|
5913
5918
|
});
|
|
5914
|
-
var reclaimBodySchema =
|
|
5915
|
-
var repoBranchSchema =
|
|
5916
|
-
name:
|
|
5917
|
-
from:
|
|
5919
|
+
var reclaimBodySchema = z51.object({}).passthrough();
|
|
5920
|
+
var repoBranchSchema = z51.object({
|
|
5921
|
+
name: z51.string().trim().min(1).max(200),
|
|
5922
|
+
from: z51.string().trim().min(1).max(200).optional()
|
|
5918
5923
|
});
|
|
5919
|
-
var reclaimRunParamsSchema =
|
|
5924
|
+
var reclaimRunParamsSchema = z51.object({ runId: z51.string().min(1) });
|
|
5920
5925
|
|
|
5921
5926
|
// ../contract/src/config-requests.ts
|
|
5922
|
-
import { z as
|
|
5927
|
+
import { z as z52 } from "zod";
|
|
5923
5928
|
var setConfigSchema = setConfigInputSchema.extend({
|
|
5924
|
-
systemPrompt:
|
|
5929
|
+
systemPrompt: z52.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
|
|
5925
5930
|
});
|
|
5926
|
-
var setAgentConfigSchema =
|
|
5927
|
-
content:
|
|
5928
|
-
version:
|
|
5931
|
+
var setAgentConfigSchema = z52.object({
|
|
5932
|
+
content: z52.string().max(2e6),
|
|
5933
|
+
version: z52.string().nullable()
|
|
5929
5934
|
});
|
|
5930
5935
|
|
|
5931
5936
|
// ../contract/src/workflow-file.ts
|
|
5932
|
-
import { z as
|
|
5933
|
-
var workflowFileSchema =
|
|
5934
|
-
name:
|
|
5935
|
-
description:
|
|
5936
|
-
steps:
|
|
5937
|
-
skills:
|
|
5937
|
+
import { z as z53 } from "zod";
|
|
5938
|
+
var workflowFileSchema = z53.object({
|
|
5939
|
+
name: z53.string().min(1),
|
|
5940
|
+
description: z53.string().optional(),
|
|
5941
|
+
steps: z53.array(workflowStepDefSchema).min(1).optional(),
|
|
5942
|
+
skills: z53.array(z53.string().trim().min(1)).min(1).optional()
|
|
5938
5943
|
}).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
|
|
5939
5944
|
message: 'a workflow lists either "steps" or "skills", not both'
|
|
5940
5945
|
});
|
|
5941
5946
|
|
|
5942
5947
|
// ../contract/src/reports.ts
|
|
5943
|
-
import { z as
|
|
5948
|
+
import { z as z54 } from "zod";
|
|
5944
5949
|
var REPORTS_QUERY_MAX = 1e3;
|
|
5945
|
-
var cursorSchema =
|
|
5946
|
-
var reportsQuerySchema =
|
|
5947
|
-
q:
|
|
5950
|
+
var cursorSchema = z54.string().min(1).max(1024);
|
|
5951
|
+
var reportsQuerySchema = z54.object({
|
|
5952
|
+
q: z54.string().max(REPORTS_QUERY_MAX).optional(),
|
|
5948
5953
|
before: cursorSchema.optional(),
|
|
5949
|
-
limit:
|
|
5954
|
+
limit: z54.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
|
|
5950
5955
|
}).strict();
|
|
5951
|
-
var reportSchema =
|
|
5952
|
-
id:
|
|
5953
|
-
runId:
|
|
5954
|
-
name:
|
|
5955
|
-
title:
|
|
5956
|
-
createdAt:
|
|
5957
|
-
size:
|
|
5958
|
-
taskTitle:
|
|
5956
|
+
var reportSchema = z54.object({
|
|
5957
|
+
id: z54.uuid(),
|
|
5958
|
+
runId: z54.uuid(),
|
|
5959
|
+
name: z54.string(),
|
|
5960
|
+
title: z54.string(),
|
|
5961
|
+
createdAt: z54.iso.datetime(),
|
|
5962
|
+
size: z54.number().int().nonnegative(),
|
|
5963
|
+
taskTitle: z54.string(),
|
|
5959
5964
|
taskStatus: runStatusSchema
|
|
5960
5965
|
}).strict();
|
|
5961
|
-
var reportsResponseSchema =
|
|
5962
|
-
reports:
|
|
5966
|
+
var reportsResponseSchema = z54.object({
|
|
5967
|
+
reports: z54.array(reportSchema),
|
|
5963
5968
|
nextCursor: cursorSchema.nullable(),
|
|
5964
5969
|
// Counts all matching cached rows with readable source summaries before page content checks.
|
|
5965
5970
|
// A missing-content row dropped while filling this page can lower total on the next request.
|
|
5966
|
-
total:
|
|
5971
|
+
total: z54.number().int().nonnegative()
|
|
5967
5972
|
}).strict();
|
|
5968
|
-
var reportsStateSchema =
|
|
5969
|
-
epoch:
|
|
5970
|
-
generation:
|
|
5971
|
-
metadataGeneration:
|
|
5973
|
+
var reportsStateSchema = z54.object({
|
|
5974
|
+
epoch: z54.uuid(),
|
|
5975
|
+
generation: z54.number().int().nonnegative(),
|
|
5976
|
+
metadataGeneration: z54.number().int().nonnegative()
|
|
5972
5977
|
}).strict();
|
|
5973
|
-
var reportsMetadataSchema =
|
|
5974
|
-
runId:
|
|
5975
|
-
taskTitle:
|
|
5978
|
+
var reportsMetadataSchema = z54.object({
|
|
5979
|
+
runId: z54.uuid(),
|
|
5980
|
+
taskTitle: z54.string(),
|
|
5976
5981
|
taskStatus: runStatusSchema
|
|
5977
5982
|
}).strict();
|
|
5978
|
-
var reportsFrameSchema =
|
|
5979
|
-
reportsStateSchema.extend({ type:
|
|
5980
|
-
reportsStateSchema.extend({ type:
|
|
5981
|
-
reportsStateSchema.extend({ type:
|
|
5983
|
+
var reportsFrameSchema = z54.discriminatedUnion("type", [
|
|
5984
|
+
reportsStateSchema.extend({ type: z54.literal("snapshot") }),
|
|
5985
|
+
reportsStateSchema.extend({ type: z54.literal("content") }),
|
|
5986
|
+
reportsStateSchema.extend({ type: z54.literal("metadata"), runs: z54.array(reportsMetadataSchema) })
|
|
5982
5987
|
]);
|
|
5983
5988
|
|
|
5984
5989
|
// ../contract/src/report-title.ts
|
|
@@ -6000,89 +6005,89 @@ function controlLocation(control, separator = " \u2192 ") {
|
|
|
6000
6005
|
}
|
|
6001
6006
|
|
|
6002
6007
|
// ../contract/src/home-recovery.ts
|
|
6003
|
-
import { z as
|
|
6008
|
+
import { z as z55 } from "zod";
|
|
6004
6009
|
var HOME_FILE_PATTERN = /^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/;
|
|
6005
|
-
var homeFileSchema =
|
|
6006
|
-
var recoveryFile =
|
|
6010
|
+
var homeFileSchema = z55.string().regex(HOME_FILE_PATTERN);
|
|
6011
|
+
var recoveryFile = z55.object({
|
|
6007
6012
|
file: homeFileSchema,
|
|
6008
|
-
detectedAt:
|
|
6009
|
-
canRestore:
|
|
6013
|
+
detectedAt: z55.iso.datetime(),
|
|
6014
|
+
canRestore: z55.boolean()
|
|
6010
6015
|
});
|
|
6011
6016
|
var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
|
|
6012
|
-
var homeRecoveryFileSchema =
|
|
6013
|
-
recoveryFile.extend({ reason:
|
|
6014
|
-
recoveryFile.extend({ reason:
|
|
6015
|
-
recoveryFile.extend({ reason:
|
|
6017
|
+
var homeRecoveryFileSchema = z55.discriminatedUnion("reason", [
|
|
6018
|
+
recoveryFile.extend({ reason: z55.literal("reset") }),
|
|
6019
|
+
recoveryFile.extend({ reason: z55.literal("outside-write") }),
|
|
6020
|
+
recoveryFile.extend({ reason: z55.literal("legacy-change"), canImport: z55.boolean() })
|
|
6016
6021
|
]);
|
|
6017
|
-
var homeRecoverySchema =
|
|
6022
|
+
var homeRecoverySchema = z55.object({ files: z55.array(homeRecoveryFileSchema) });
|
|
6018
6023
|
function filterHomeRecoveryReasons(value, reasons) {
|
|
6019
6024
|
if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
|
|
6020
6025
|
return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
|
|
6021
6026
|
}
|
|
6022
|
-
var homeRecoveryReaderSchema =
|
|
6027
|
+
var homeRecoveryReaderSchema = z55.preprocess(
|
|
6023
6028
|
(value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
|
|
6024
6029
|
homeRecoverySchema
|
|
6025
6030
|
);
|
|
6026
|
-
var homeRecoveryActionSchema =
|
|
6031
|
+
var homeRecoveryActionSchema = z55.object({ file: homeFileSchema, detectedAt: z55.iso.datetime() }).strict();
|
|
6027
6032
|
|
|
6028
6033
|
// ../contract/src/runner-skills.ts
|
|
6029
|
-
import { z as
|
|
6030
|
-
var runnerSkillScopeSchema =
|
|
6031
|
-
var runnerSkillsQuerySchema =
|
|
6034
|
+
import { z as z56 } from "zod";
|
|
6035
|
+
var runnerSkillScopeSchema = z56.enum(["repo", "user", "system", "other"]);
|
|
6036
|
+
var runnerSkillsQuerySchema = z56.object({
|
|
6032
6037
|
runner: queryRunnerSchema,
|
|
6033
|
-
account:
|
|
6034
|
-
refresh:
|
|
6038
|
+
account: z56.string().min(1).max(64).optional(),
|
|
6039
|
+
refresh: z56.literal("1").optional()
|
|
6035
6040
|
});
|
|
6036
|
-
var runnerSkillSchema =
|
|
6037
|
-
id:
|
|
6038
|
-
name:
|
|
6039
|
-
description:
|
|
6041
|
+
var runnerSkillSchema = z56.object({
|
|
6042
|
+
id: z56.string(),
|
|
6043
|
+
name: z56.string(),
|
|
6044
|
+
description: z56.string().optional(),
|
|
6040
6045
|
scope: runnerSkillScopeSchema.optional(),
|
|
6041
|
-
plugin:
|
|
6042
|
-
path:
|
|
6046
|
+
plugin: z56.string().optional(),
|
|
6047
|
+
path: z56.string().optional()
|
|
6043
6048
|
});
|
|
6044
|
-
var runnerSkillProblemSchema =
|
|
6045
|
-
var runnerSkillListSchema =
|
|
6049
|
+
var runnerSkillProblemSchema = z56.object({ message: z56.string(), path: z56.string().optional() });
|
|
6050
|
+
var runnerSkillListSchema = z56.object({
|
|
6046
6051
|
runner: runnerSchema,
|
|
6047
|
-
skills:
|
|
6048
|
-
problems:
|
|
6049
|
-
source:
|
|
6050
|
-
reason:
|
|
6052
|
+
skills: z56.array(runnerSkillSchema),
|
|
6053
|
+
problems: z56.array(runnerSkillProblemSchema),
|
|
6054
|
+
source: z56.enum(["live", "cache", "unavailable"]),
|
|
6055
|
+
reason: z56.string().optional()
|
|
6051
6056
|
});
|
|
6052
6057
|
|
|
6053
6058
|
// ../contract/src/runner-install.ts
|
|
6054
|
-
import { z as
|
|
6055
|
-
var runnerInstallParamsSchema =
|
|
6056
|
-
var runnerInstallActionSchema =
|
|
6057
|
-
var runnerInstallPhaseSchema =
|
|
6058
|
-
var runnerInstallStatusSchema =
|
|
6059
|
-
supported:
|
|
6060
|
-
installedVersion:
|
|
6061
|
-
latestVersion:
|
|
6062
|
-
updateAvailable:
|
|
6059
|
+
import { z as z57 } from "zod";
|
|
6060
|
+
var runnerInstallParamsSchema = z57.object({ runner: runnerSchema });
|
|
6061
|
+
var runnerInstallActionSchema = z57.object({ action: z57.enum(["check", "install", "update", "remove"]) });
|
|
6062
|
+
var runnerInstallPhaseSchema = z57.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
|
|
6063
|
+
var runnerInstallStatusSchema = z57.object({
|
|
6064
|
+
supported: z57.boolean(),
|
|
6065
|
+
installedVersion: z57.string().nullable(),
|
|
6066
|
+
latestVersion: z57.string().nullable(),
|
|
6067
|
+
updateAvailable: z57.boolean(),
|
|
6063
6068
|
phase: runnerInstallPhaseSchema,
|
|
6064
|
-
error:
|
|
6069
|
+
error: z57.string().nullable()
|
|
6065
6070
|
});
|
|
6066
6071
|
|
|
6067
6072
|
// ../contract/src/automation-tool.ts
|
|
6068
|
-
import { z as
|
|
6073
|
+
import { z as z58 } from "zod";
|
|
6069
6074
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
6070
|
-
var id =
|
|
6071
|
-
var automationToolRequestSchema =
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6075
|
+
var id = z58.string().min(1).max(100);
|
|
6076
|
+
var automationToolRequestSchema = z58.discriminatedUnion("action", [
|
|
6077
|
+
z58.object({ action: z58.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
6078
|
+
z58.object({ action: z58.literal("show"), id }).strict(),
|
|
6079
|
+
z58.object({ action: z58.literal("preview"), id }).strict(),
|
|
6080
|
+
z58.object({ action: z58.literal("enable"), id, explicit: z58.boolean().optional() }).strict()
|
|
6076
6081
|
]);
|
|
6077
|
-
var automationToolAnswerSchema =
|
|
6078
|
-
|
|
6079
|
-
ok:
|
|
6082
|
+
var automationToolAnswerSchema = z58.union([
|
|
6083
|
+
z58.object({
|
|
6084
|
+
ok: z58.literal(true),
|
|
6080
6085
|
automation: storedAutomationDefinitionSchema,
|
|
6081
|
-
url:
|
|
6082
|
-
next_run_at:
|
|
6083
|
-
preview:
|
|
6086
|
+
url: z58.string().optional(),
|
|
6087
|
+
next_run_at: z58.string().optional(),
|
|
6088
|
+
preview: z58.object({ matches: z58.number().int().nonnegative(), truncated: z58.boolean() }).optional()
|
|
6084
6089
|
}),
|
|
6085
|
-
|
|
6090
|
+
z58.object({ ok: z58.literal(false), code: z58.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z58.string() })
|
|
6086
6091
|
]);
|
|
6087
6092
|
export {
|
|
6088
6093
|
ACTIVITY_CHECKS_MAX,
|
|
@@ -6128,11 +6133,13 @@ export {
|
|
|
6128
6133
|
LIVE_WORKER_NAME,
|
|
6129
6134
|
MAX_CONVERSATION_REQUEST_SECONDS,
|
|
6130
6135
|
MAX_RESUME_REQUEST_SECONDS,
|
|
6136
|
+
NOTE_MAX,
|
|
6131
6137
|
ONCE_MAX_LATEST_START_MINUTES,
|
|
6132
6138
|
ONCE_MIN_LATEST_START_MINUTES,
|
|
6133
6139
|
ONCE_PAST_DUE_MESSAGE,
|
|
6134
6140
|
PEER_WAIT_DEFAULT_SECONDS,
|
|
6135
6141
|
PEER_WAIT_MAX_SECONDS,
|
|
6142
|
+
PID_MIN,
|
|
6136
6143
|
PREVIEW_MAX_PIXEL_RATIO,
|
|
6137
6144
|
PROCESS_EXIT_FILE_MAX,
|
|
6138
6145
|
PROCESS_TIMEOUT_DEFAULT_SECONDS,
|