@hearsay-tools/squawk 0.18.0-pr3883.7308 → 0.18.0-pr3885.7316
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/README.md +3 -2
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1584 -1578
- package/dist/contract/queued-messages.d.ts +31 -0
- package/dist/contract/runs.d.ts +3 -29
- package/dist/delegation/conversations.d.ts +2 -0
- package/dist/delegation/transport.d.ts +66 -66
- package/dist/runs/run-exits.d.ts +6 -0
- package/dist/runs/store.d.ts +2 -0
- package/dist/runs/store.js +2 -1
- package/dist/runs/store.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/server.d.ts +1720 -1702
- package/dist/workflows/continuation-admission.d.ts +3 -1
- package/dist/workflows/continuation-admission.js +4 -2
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.js +1 -1
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/launch-read-resolver.js +20 -8
- package/dist/workflows/run/launch-read-resolver.js.map +1 -1
- package/dist/workflows/run/prompts.d.ts +3 -0
- package/dist/workflows/run/prompts.js +11 -5
- package/dist/workflows/run/prompts.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +73 -72
- package/package.json +4 -4
- package/scripts/mock-nudge.mjs +3 -1
- package/web/dist/assets/{activity-motion-YMvJpfC8.js → activity-motion-Ctg50eXm.js} +1 -1
- package/web/dist/assets/{activity-route-C3nuQQR-.js → activity-route-CIrBgiGz.js} +1 -1
- package/web/dist/assets/{agent-accounts-C1IZE0uf.js → agent-accounts-Bxqcccek.js} +1 -1
- package/web/dist/assets/attention-D15PtJnc.js +1 -0
- package/web/dist/assets/{commit-diff-panel-B78xqBBB.js → commit-diff-panel-OWVorWVw.js} +1 -1
- package/web/dist/assets/{diff-CuoNLz3Q.js → diff-BvBs4Gxp.js} +2 -2
- package/web/dist/assets/{diff-view-Dxt-xGXY.js → diff-view-CSrp8jyv.js} +1 -1
- package/web/dist/assets/{file-preview-D6fgR7rc.js → file-preview-B6mM_dbK.js} +1 -1
- package/web/dist/assets/{git-toolbar-B4gNpVK8.js → git-toolbar-CvG0gvVf.js} +1 -1
- package/web/dist/assets/{github-D4IdDmEF.js → github-Dra1J1Oi.js} +1 -1
- package/web/dist/assets/{global-activity-route-BQW6XCBZ.js → global-activity-route-8H2KkpXH.js} +1 -1
- package/web/dist/assets/{index-CZSDjjxd.js → index-aCWAgBiE.js} +4 -4
- package/web/dist/assets/{markdown-CFpzsarc.js → markdown-D4ZGAuSC.js} +1 -1
- package/web/dist/assets/{picker-pill-AQuDoa6t.js → picker-pill-B6QPSEUZ.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Divki4iS.js → preview-pane-connected-Bhb5eJ5Z.js} +1 -1
- package/web/dist/assets/{project-router-CuXiyyHq.js → project-router-0DHZ1s8l.js} +1 -1
- package/web/dist/assets/project-scope-context-qMCI2vmR.js +4 -0
- package/web/dist/assets/{prompt-template-menu-DttDghYr.js → prompt-template-menu-_WK10gNW.js} +1 -1
- package/web/dist/assets/{queries-M7QM2Z_B.js → queries-DFchmPfl.js} +1 -1
- package/web/dist/assets/{reference-chip-C2uR5keT.js → reference-chip-BJe4UIpL.js} +1 -1
- package/web/dist/assets/{repo-git-Dl6O3hGA.js → repo-git-DAhDX80l.js} +1 -1
- package/web/dist/assets/{report-reader-MmUDUBB6.js → report-reader-DsYm5b9J.js} +1 -1
- package/web/dist/assets/{reports-D5N5f1oD.js → reports-BosE8lj8.js} +1 -1
- package/web/dist/assets/{run-header-CWSg_ZYo.js → run-header-DBbM_xNy.js} +1 -1
- package/web/dist/assets/{skills-UhbdEQES.js → skills-BHAGfLNq.js} +1 -1
- package/web/dist/assets/{tab-link-Bz7Tn_PW.js → tab-link-lVQ2eOeD.js} +1 -1
- package/web/dist/assets/{task-changes-Ciq3wQdC.js → task-changes-Jg7Xzrfa.js} +1 -1
- package/web/dist/assets/{task-commits-BYZEw7j8.js → task-commits-DecgF6zx.js} +1 -1
- package/web/dist/assets/{task-files-zvZu7yvk.js → task-files-D7N-vFyz.js} +1 -1
- package/web/dist/assets/{task-github-item-BYzml2gD.js → task-github-item-C8fBdico.js} +1 -1
- package/web/dist/assets/{task-thread-DSdn2fYx.js → task-thread-DifTEOeK.js} +1 -1
- package/web/dist/assets/{thread-state-BU_1o8aR.js → thread-state-i29D-4yN.js} +1 -1
- package/web/dist/assets/{use-desktop-Dc0-ZSdE.js → use-desktop-CdWXLHne.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C8jp_mTB.js → use-hand-to-agent-state-CPxNdj4_.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BzvShKMo.js → useInfiniteQuery-Bn5hIzUm.js} +1 -1
- package/web/dist/assets/useQuery-DjkTL27e.js +1 -0
- package/web/dist/assets/{workflows-BdBF5bnk.js → workflows-CflCv_rB.js} +1 -1
- package/web/dist/assets/{ws-BQRkvdhO.js → ws-DfKMAUWf.js} +1 -1
- package/web/dist/index.html +13 -13
- package/web/dist/assets/attention-SAsrxB3a.js +0 -1
- package/web/dist/assets/project-scope-context-TjMvUo_E.js +0 -4
- package/web/dist/assets/useQuery-BJvp3XYr.js +0 -1
package/dist/contract/index.js
CHANGED
|
@@ -1159,7 +1159,7 @@ function runnerModelListName(runner) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
1161
|
// ../contract/src/runs.ts
|
|
1162
|
-
import { z as
|
|
1162
|
+
import { z as z20 } from "zod";
|
|
1163
1163
|
|
|
1164
1164
|
// ../contract/src/github.ts
|
|
1165
1165
|
import { z as z12 } from "zod";
|
|
@@ -1702,30 +1702,57 @@ function runWorkflowLabel(run) {
|
|
|
1702
1702
|
var ARCHIVED_RUNS_PAGE_DEFAULT = 50;
|
|
1703
1703
|
var ARCHIVED_RUNS_PAGE_MAX = 200;
|
|
1704
1704
|
|
|
1705
|
-
// ../contract/src/
|
|
1705
|
+
// ../contract/src/queued-messages.ts
|
|
1706
1706
|
import { z as z14 } from "zod";
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
|
|
1707
|
+
var queuedMessageSchema = z14.object({
|
|
1708
|
+
replayAfterOpen: z14.literal(true).optional(),
|
|
1709
|
+
// NativeSkillInputQueue sets; launch hydration excludes; QueuedInput replays after open.
|
|
1710
|
+
id: z14.string(),
|
|
1711
|
+
text: z14.string(),
|
|
1712
|
+
/** `/api/v1/runs/:id/images/…` URLs — attachments are persisted, never inlined. Images and
|
|
1713
|
+
* files share this one list; read `isImageAttachmentName` on the file name to tell them apart. */
|
|
1714
|
+
images: z14.array(z14.string()).optional(),
|
|
1715
|
+
createdAt: z14.string()
|
|
1716
|
+
});
|
|
1717
|
+
var continuationMessageSchema = queuedMessageSchema.extend({
|
|
1718
|
+
origin: z14.enum(["human", "lifecycle"]).optional(),
|
|
1719
|
+
/** An attributed parent message used as the opening prompt, never a human answer. */
|
|
1720
|
+
agentInputId: z14.uuid().optional(),
|
|
1721
|
+
/** The run's task when this Continue was accepted. A queued Continue repeats the task only
|
|
1722
|
+
* when the human edited it while waiting (hearsay-tools/squawk#3882). */
|
|
1723
|
+
task: z14.string().optional(),
|
|
1724
|
+
/** Captured before clearing the run error. Keep generated context separate from human
|
|
1725
|
+
* text so repeated restart recovery never accumulates diagnostic prefixes. */
|
|
1726
|
+
resumeContext: z14.object({
|
|
1727
|
+
failure: z14.object({ stepId: z14.string().optional(), error: z14.string() }).optional(),
|
|
1728
|
+
restarted: z14.literal(true).optional()
|
|
1729
|
+
}).optional()
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
// ../contract/src/workflows.ts
|
|
1733
|
+
import { z as z15 } from "zod";
|
|
1734
|
+
var workflowStepDefSchema = z15.object({
|
|
1735
|
+
id: z15.string().min(1),
|
|
1736
|
+
name: z15.string().optional(),
|
|
1710
1737
|
// agent step
|
|
1711
|
-
prompt:
|
|
1712
|
-
skill:
|
|
1713
|
-
model:
|
|
1714
|
-
effort:
|
|
1738
|
+
prompt: z15.string().optional(),
|
|
1739
|
+
skill: z15.string().optional(),
|
|
1740
|
+
model: z15.string().optional(),
|
|
1741
|
+
effort: z15.string().max(32).optional(),
|
|
1715
1742
|
/** Authored agent-step wall-clock limit in ms. Omitted or 0 means no limit.
|
|
1716
1743
|
* Bound to Node's timer range so a larger value cannot become a 1ms kill. */
|
|
1717
|
-
timeoutMs:
|
|
1744
|
+
timeoutMs: z15.number().int().min(0).max(2147483647).optional(),
|
|
1718
1745
|
/** Per-step agent backend override (falls back to the task / config default). */
|
|
1719
1746
|
runner: runnerSchema.optional(),
|
|
1720
1747
|
/** Agent account id for this step (spec 2026-07-29-agent-profiles); resolved per step for owned workers (#452). */
|
|
1721
|
-
agentProfile:
|
|
1722
|
-
allowedTools:
|
|
1723
|
-
bashAllowlist:
|
|
1748
|
+
agentProfile: z15.string().min(1).max(64).optional(),
|
|
1749
|
+
allowedTools: z15.array(z15.string()).optional(),
|
|
1750
|
+
bashAllowlist: z15.array(z15.string()).optional(),
|
|
1724
1751
|
// check step
|
|
1725
|
-
command:
|
|
1726
|
-
onFail:
|
|
1727
|
-
retry:
|
|
1728
|
-
max:
|
|
1752
|
+
command: z15.string().optional(),
|
|
1753
|
+
onFail: z15.object({
|
|
1754
|
+
retry: z15.string().min(1),
|
|
1755
|
+
max: z15.number().int().positive().default(2)
|
|
1729
1756
|
}).optional()
|
|
1730
1757
|
}).refine((s) => Boolean(s.command) !== Boolean(s.prompt ?? s.skill), {
|
|
1731
1758
|
message: "a step is either an agent step (prompt/skill) or a check step (command), not both"
|
|
@@ -1733,13 +1760,13 @@ var workflowStepDefSchema = z14.object({
|
|
|
1733
1760
|
message: "timeoutMs applies only to agent steps",
|
|
1734
1761
|
path: ["timeoutMs"]
|
|
1735
1762
|
});
|
|
1736
|
-
var workflowDefSchema =
|
|
1737
|
-
name:
|
|
1738
|
-
description:
|
|
1739
|
-
steps:
|
|
1740
|
-
source:
|
|
1763
|
+
var workflowDefSchema = z15.object({
|
|
1764
|
+
name: z15.string(),
|
|
1765
|
+
description: z15.string().optional(),
|
|
1766
|
+
steps: z15.array(workflowStepDefSchema),
|
|
1767
|
+
source: z15.enum(["built-in", "file"]),
|
|
1741
1768
|
/** Absent on built-ins — which is exactly what makes them undeletable. */
|
|
1742
|
-
path:
|
|
1769
|
+
path: z15.string().optional()
|
|
1743
1770
|
});
|
|
1744
1771
|
function providersRequiredByWorkflow(workflow, fallback) {
|
|
1745
1772
|
const required = /* @__PURE__ */ new Set();
|
|
@@ -1748,73 +1775,73 @@ function providersRequiredByWorkflow(workflow, fallback) {
|
|
|
1748
1775
|
}
|
|
1749
1776
|
return runnerSchema.options.filter((provider) => required.has(provider));
|
|
1750
1777
|
}
|
|
1751
|
-
var workflowLoadIssueSchema =
|
|
1752
|
-
path:
|
|
1753
|
-
message:
|
|
1778
|
+
var workflowLoadIssueSchema = z15.object({
|
|
1779
|
+
path: z15.string(),
|
|
1780
|
+
message: z15.string()
|
|
1754
1781
|
});
|
|
1755
|
-
var workflowsResponseSchema =
|
|
1756
|
-
workflows:
|
|
1757
|
-
issues:
|
|
1782
|
+
var workflowsResponseSchema = z15.object({
|
|
1783
|
+
workflows: z15.array(workflowDefSchema),
|
|
1784
|
+
issues: z15.array(workflowLoadIssueSchema)
|
|
1758
1785
|
});
|
|
1759
|
-
var saveWorkflowInputSchema =
|
|
1760
|
-
name:
|
|
1761
|
-
description:
|
|
1762
|
-
steps:
|
|
1763
|
-
skills:
|
|
1764
|
-
overwrite:
|
|
1786
|
+
var saveWorkflowInputSchema = z15.object({
|
|
1787
|
+
name: z15.string().trim().min(1).max(80),
|
|
1788
|
+
description: z15.string().max(2e3, "must be at most 2000 characters").optional(),
|
|
1789
|
+
steps: z15.array(workflowStepDefSchema).min(1).max(8).optional(),
|
|
1790
|
+
skills: z15.array(z15.string().trim().min(1)).min(1).max(8).optional(),
|
|
1791
|
+
overwrite: z15.boolean().optional()
|
|
1765
1792
|
}).refine((b) => Boolean(b.steps) !== Boolean(b.skills), {
|
|
1766
1793
|
message: 'provide either "steps" or "skills", not both'
|
|
1767
1794
|
});
|
|
1768
|
-
var saveWorkflowResponseSchema =
|
|
1769
|
-
path:
|
|
1770
|
-
name:
|
|
1795
|
+
var saveWorkflowResponseSchema = z15.object({
|
|
1796
|
+
path: z15.string(),
|
|
1797
|
+
name: z15.string()
|
|
1771
1798
|
});
|
|
1772
|
-
var parsedWorkflowSchema =
|
|
1773
|
-
name:
|
|
1774
|
-
description:
|
|
1775
|
-
steps:
|
|
1799
|
+
var parsedWorkflowSchema = z15.object({
|
|
1800
|
+
name: z15.string(),
|
|
1801
|
+
description: z15.string().optional(),
|
|
1802
|
+
steps: z15.array(workflowStepDefSchema)
|
|
1776
1803
|
});
|
|
1777
|
-
var deleteWorkflowResponseSchema =
|
|
1778
|
-
ok:
|
|
1779
|
-
path:
|
|
1804
|
+
var deleteWorkflowResponseSchema = z15.object({
|
|
1805
|
+
ok: z15.literal(true),
|
|
1806
|
+
path: z15.string()
|
|
1780
1807
|
});
|
|
1781
|
-
var planResponseSchema =
|
|
1808
|
+
var planResponseSchema = z15.object({
|
|
1782
1809
|
/** The kebab-case workflow title the planner proposed. Absent on the degraded fallback. */
|
|
1783
|
-
name:
|
|
1784
|
-
steps:
|
|
1785
|
-
rationale:
|
|
1786
|
-
fallback:
|
|
1810
|
+
name: z15.string().optional(),
|
|
1811
|
+
steps: z15.array(workflowStepDefSchema),
|
|
1812
|
+
rationale: z15.string(),
|
|
1813
|
+
fallback: z15.boolean()
|
|
1787
1814
|
});
|
|
1788
1815
|
|
|
1789
1816
|
// ../contract/src/waits.ts
|
|
1790
|
-
import { z as
|
|
1817
|
+
import { z as z17 } from "zod";
|
|
1791
1818
|
|
|
1792
1819
|
// ../contract/src/ci-wait.ts
|
|
1793
|
-
import { z as
|
|
1820
|
+
import { z as z16 } from "zod";
|
|
1794
1821
|
var CI_WAIT_LIMITATION = "Passing reported checks does not prove that every expected workflow has appeared or that the PR is merge-ready. This observation is not merge approval.";
|
|
1795
1822
|
var CI_WAIT_RECEIPT_INSTRUCTION = "End your turn to wait for CI; no marker is needed. " + CI_WAIT_LIMITATION;
|
|
1796
1823
|
var prPattern = /^https:\/\/([a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)$/;
|
|
1797
|
-
var ciPrUrlSchema =
|
|
1824
|
+
var ciPrUrlSchema = z16.string().max(2048).regex(prPattern).refine((value) => {
|
|
1798
1825
|
const match = prPattern.exec(value);
|
|
1799
1826
|
return !!match && Number.isSafeInteger(Number(match[4])) && match[3] !== "." && match[3] !== "..";
|
|
1800
1827
|
}, "Expected an HTTPS GitHub PR URL with a positive integer PR number");
|
|
1801
|
-
var prWaitUntilSchema =
|
|
1802
|
-
var ciWaitRequestSchema =
|
|
1828
|
+
var prWaitUntilSchema = z16.enum(["checks", "merge", "merge_or_blocked"]);
|
|
1829
|
+
var ciWaitRequestSchema = z16.object({
|
|
1803
1830
|
pr: ciPrUrlSchema,
|
|
1804
1831
|
until: prWaitUntilSchema.default("checks"),
|
|
1805
1832
|
/** False keeps a conflicting PR from ending the wait: for a PR the agent does not own. */
|
|
1806
|
-
wake_on_conflict:
|
|
1807
|
-
timeout_seconds:
|
|
1833
|
+
wake_on_conflict: z16.boolean().default(true),
|
|
1834
|
+
timeout_seconds: z16.number().int().min(1).max(7200).default(1800)
|
|
1808
1835
|
}).strict();
|
|
1809
|
-
var sha =
|
|
1810
|
-
var ciPrIdentitySchema =
|
|
1836
|
+
var sha = z16.string().regex(/^[0-9a-f]{40}$/i);
|
|
1837
|
+
var ciPrIdentitySchema = z16.object({
|
|
1811
1838
|
prUrl: ciPrUrlSchema,
|
|
1812
|
-
repository:
|
|
1813
|
-
prNumber:
|
|
1839
|
+
repository: z16.string().max(2048).regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),
|
|
1840
|
+
prNumber: z16.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1814
1841
|
headSha: sha
|
|
1815
1842
|
}).strict();
|
|
1816
|
-
var ciWaitOutcomeSchema =
|
|
1817
|
-
var ciWaitErrorCodeSchema =
|
|
1843
|
+
var ciWaitOutcomeSchema = z16.enum(["passed", "failed", "cancelled", "skipped", "no_checks", "head_changed", "conflicting", "deadline", "error", "merged", "closed", "blocked"]);
|
|
1844
|
+
var ciWaitErrorCodeSchema = z16.enum([
|
|
1818
1845
|
"invalid_request",
|
|
1819
1846
|
"unsupported_host",
|
|
1820
1847
|
"gh_missing",
|
|
@@ -1845,7 +1872,7 @@ var ciWaitErrorCodeSchema = z15.enum([
|
|
|
1845
1872
|
"registration_aborted",
|
|
1846
1873
|
"turn_changed"
|
|
1847
1874
|
]);
|
|
1848
|
-
var ciWaitErrorSchema =
|
|
1875
|
+
var ciWaitErrorSchema = z16.object({ code: ciWaitErrorCodeSchema, message: z16.string().max(4096) }).strict();
|
|
1849
1876
|
function utf8Bytes(value) {
|
|
1850
1877
|
let bytes = 0;
|
|
1851
1878
|
for (const char of value) {
|
|
@@ -1854,54 +1881,54 @@ function utf8Bytes(value) {
|
|
|
1854
1881
|
}
|
|
1855
1882
|
return bytes;
|
|
1856
1883
|
}
|
|
1857
|
-
var mergeBlockSchema =
|
|
1858
|
-
reason:
|
|
1859
|
-
isInMergeQueue:
|
|
1860
|
-
autoMergeEnabled:
|
|
1861
|
-
event:
|
|
1862
|
-
kind:
|
|
1863
|
-
createdAt:
|
|
1864
|
-
reason:
|
|
1865
|
-
reasonCode:
|
|
1884
|
+
var mergeBlockSchema = z16.object({
|
|
1885
|
+
reason: z16.enum(["conflict", "no_pending_merge"]),
|
|
1886
|
+
isInMergeQueue: z16.boolean(),
|
|
1887
|
+
autoMergeEnabled: z16.boolean(),
|
|
1888
|
+
event: z16.object({
|
|
1889
|
+
kind: z16.enum(["queue_removal", "auto_merge_disabled"]),
|
|
1890
|
+
createdAt: z16.iso.datetime({ offset: true }),
|
|
1891
|
+
reason: z16.string().max(256).optional(),
|
|
1892
|
+
reasonCode: z16.string().max(256).optional()
|
|
1866
1893
|
}).strict().optional()
|
|
1867
1894
|
}).strict();
|
|
1868
|
-
var ciWaitResultSchema =
|
|
1895
|
+
var ciWaitResultSchema = z16.object({
|
|
1869
1896
|
outcome: ciWaitOutcomeSchema,
|
|
1870
1897
|
headSha: sha,
|
|
1871
1898
|
observedHeadSha: sha.optional(),
|
|
1872
|
-
mergeable:
|
|
1873
|
-
mergeStateStatus:
|
|
1899
|
+
mergeable: z16.enum(["MERGEABLE", "CONFLICTING", "UNKNOWN"]).optional(),
|
|
1900
|
+
mergeStateStatus: z16.string().max(64).optional(),
|
|
1874
1901
|
/** A merge wait's `merged` outcome: when, and as which commit, GitHub merged the PR. */
|
|
1875
|
-
mergedAt:
|
|
1902
|
+
mergedAt: z16.iso.datetime({ offset: true }).optional(),
|
|
1876
1903
|
mergeCommitSha: sha.optional(),
|
|
1877
1904
|
mergeBlock: mergeBlockSchema.optional(),
|
|
1878
|
-
observedAt:
|
|
1879
|
-
checks:
|
|
1880
|
-
totalChecks:
|
|
1881
|
-
truncated:
|
|
1882
|
-
diagnostic:
|
|
1905
|
+
observedAt: z16.iso.datetime(),
|
|
1906
|
+
checks: z16.array(z16.object({ name: z16.string().max(256), state: z16.string().max(256), link: z16.string().max(2048) }).strict()).max(100),
|
|
1907
|
+
totalChecks: z16.number().int().nonnegative(),
|
|
1908
|
+
truncated: z16.boolean(),
|
|
1909
|
+
diagnostic: z16.string().max(4096).refine((value) => utf8Bytes(value) <= 4096).optional()
|
|
1883
1910
|
}).strict().refine((value) => {
|
|
1884
1911
|
return value.outcome === "blocked" === (value.mergeBlock !== void 0);
|
|
1885
1912
|
}, "Only blocked outcomes require mergeBlock").refine((value) => utf8Bytes(JSON.stringify(value)) <= 32 * 1024, "CI result exceeds 32 KiB");
|
|
1886
1913
|
var ciWaitSchema = ciPrIdentitySchema.extend({
|
|
1887
|
-
id:
|
|
1888
|
-
generation:
|
|
1889
|
-
turnId:
|
|
1890
|
-
timeoutSeconds:
|
|
1914
|
+
id: z16.uuid(),
|
|
1915
|
+
generation: z16.string().min(1).max(256),
|
|
1916
|
+
turnId: z16.string().min(1).max(256),
|
|
1917
|
+
timeoutSeconds: z16.number().int().min(1).max(7200),
|
|
1891
1918
|
// Legacy `ciWait` rows predate the target (hearsay-tools/cezarion#1425): they waited for checks.
|
|
1892
1919
|
until: prWaitUntilSchema.default("checks"),
|
|
1893
|
-
wakeOnConflict:
|
|
1894
|
-
registeredAt:
|
|
1895
|
-
deadline:
|
|
1896
|
-
phase:
|
|
1920
|
+
wakeOnConflict: z16.boolean().default(true),
|
|
1921
|
+
registeredAt: z16.iso.datetime(),
|
|
1922
|
+
deadline: z16.iso.datetime(),
|
|
1923
|
+
phase: z16.enum(["registered", "parked", "wake-pending", "delivered", "withdrawn"]),
|
|
1897
1924
|
result: ciWaitResultSchema.optional(),
|
|
1898
|
-
wakeId:
|
|
1899
|
-
deliveredAt:
|
|
1925
|
+
wakeId: z16.string().min(1).max(256).optional(),
|
|
1926
|
+
deliveredAt: z16.iso.datetime().optional()
|
|
1900
1927
|
}).strict();
|
|
1901
1928
|
var ciWaitReceiptSchema = ciPrIdentitySchema.extend({
|
|
1902
|
-
waitId:
|
|
1903
|
-
registeredAt:
|
|
1904
|
-
deadline:
|
|
1929
|
+
waitId: z16.uuid(),
|
|
1930
|
+
registeredAt: z16.iso.datetime(),
|
|
1931
|
+
deadline: z16.iso.datetime(),
|
|
1905
1932
|
phase: ciWaitSchema.shape.phase
|
|
1906
1933
|
}).strict();
|
|
1907
1934
|
|
|
@@ -1924,9 +1951,9 @@ var PEER_WAIT_MAX_SECONDS = 7200;
|
|
|
1924
1951
|
var SUBAGENT_WAIT_DEADLINE_SECONDS = 1800;
|
|
1925
1952
|
var SUBAGENT_WAIT_GRACE_SECONDS = 15;
|
|
1926
1953
|
var SUBAGENT_WAIT_CHILD_LIMIT = 32;
|
|
1927
|
-
var pidSchema =
|
|
1928
|
-
var waitPhaseSchema =
|
|
1929
|
-
var waitViaSchema =
|
|
1954
|
+
var pidSchema = z17.number().int().min(2);
|
|
1955
|
+
var waitPhaseSchema = z17.enum(["open", "resolved", "delivered", "cancelled"]);
|
|
1956
|
+
var waitViaSchema = z17.enum([
|
|
1930
1957
|
// `cezar_wait_for_ci` is kept for stored rows only: the tool was removed (hearsay-tools/cezarion#1236).
|
|
1931
1958
|
"cezar_wait",
|
|
1932
1959
|
"cezar_wait_for_ci",
|
|
@@ -1943,74 +1970,74 @@ var waitViaSchema = z16.enum([
|
|
|
1943
1970
|
"native-subagents"
|
|
1944
1971
|
]);
|
|
1945
1972
|
var waitBaseShape = {
|
|
1946
|
-
id:
|
|
1947
|
-
source:
|
|
1973
|
+
id: z17.uuid(),
|
|
1974
|
+
source: z17.enum(["agent", "cezar"]),
|
|
1948
1975
|
via: waitViaSchema,
|
|
1949
|
-
registeredAt:
|
|
1976
|
+
registeredAt: z17.iso.datetime(),
|
|
1950
1977
|
phase: waitPhaseSchema,
|
|
1951
|
-
resolvedAt:
|
|
1952
|
-
deliveredAt:
|
|
1953
|
-
cancelledAt:
|
|
1954
|
-
turnId:
|
|
1978
|
+
resolvedAt: z17.iso.datetime().optional(),
|
|
1979
|
+
deliveredAt: z17.iso.datetime().optional(),
|
|
1980
|
+
cancelledAt: z17.iso.datetime().optional(),
|
|
1981
|
+
turnId: z17.string().min(1).max(256)
|
|
1955
1982
|
};
|
|
1956
|
-
var prWaitEntrySchema =
|
|
1983
|
+
var prWaitEntrySchema = z17.object({
|
|
1957
1984
|
...waitBaseShape,
|
|
1958
|
-
kind:
|
|
1959
|
-
deadline:
|
|
1985
|
+
kind: z17.literal("pr"),
|
|
1986
|
+
deadline: z17.iso.datetime(),
|
|
1960
1987
|
...ciPrIdentitySchema.shape,
|
|
1961
|
-
generation:
|
|
1962
|
-
timeoutSeconds:
|
|
1988
|
+
generation: z17.string().min(1).max(256),
|
|
1989
|
+
timeoutSeconds: z17.number().int().min(1).max(7200),
|
|
1963
1990
|
until: prWaitUntilSchema,
|
|
1964
|
-
wakeOnConflict:
|
|
1991
|
+
wakeOnConflict: z17.boolean(),
|
|
1965
1992
|
result: ciWaitResultSchema.optional()
|
|
1966
1993
|
}).strict();
|
|
1967
|
-
var timerWaitEntrySchema =
|
|
1994
|
+
var timerWaitEntrySchema = z17.object({
|
|
1968
1995
|
...waitBaseShape,
|
|
1969
|
-
kind:
|
|
1970
|
-
deadline:
|
|
1971
|
-
seconds:
|
|
1972
|
-
note:
|
|
1996
|
+
kind: z17.literal("timer"),
|
|
1997
|
+
deadline: z17.iso.datetime(),
|
|
1998
|
+
seconds: z17.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
1999
|
+
note: z17.string().max(NOTE_MAX).optional()
|
|
1973
2000
|
}).strict();
|
|
1974
|
-
var processWaitResultSchema =
|
|
1975
|
-
outcome:
|
|
1976
|
-
observedAt:
|
|
1977
|
-
exitCode:
|
|
1978
|
-
exitFileNote:
|
|
1979
|
-
diagnostic:
|
|
2001
|
+
var processWaitResultSchema = z17.object({
|
|
2002
|
+
outcome: z17.enum(["exit_file", "exited", "deadline", "error"]),
|
|
2003
|
+
observedAt: z17.iso.datetime(),
|
|
2004
|
+
exitCode: z17.number().int().min(-2147483648).max(2147483647).optional(),
|
|
2005
|
+
exitFileNote: z17.literal("not-an-exit-code").optional(),
|
|
2006
|
+
diagnostic: z17.string().max(512).optional()
|
|
1980
2007
|
}).strict();
|
|
1981
|
-
var processWaitEntrySchema =
|
|
2008
|
+
var processWaitEntrySchema = z17.object({
|
|
1982
2009
|
...waitBaseShape,
|
|
1983
|
-
kind:
|
|
1984
|
-
deadline:
|
|
1985
|
-
timeoutSeconds:
|
|
2010
|
+
kind: z17.literal("process"),
|
|
2011
|
+
deadline: z17.iso.datetime(),
|
|
2012
|
+
timeoutSeconds: z17.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS),
|
|
1986
2013
|
pid: pidSchema,
|
|
1987
|
-
startToken:
|
|
1988
|
-
exitFile:
|
|
1989
|
-
note:
|
|
2014
|
+
startToken: z17.string().min(1).max(256).optional(),
|
|
2015
|
+
exitFile: z17.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
2016
|
+
note: z17.string().max(NOTE_MAX).optional(),
|
|
1990
2017
|
result: processWaitResultSchema.optional()
|
|
1991
2018
|
}).strict();
|
|
1992
|
-
var humanWaitEntrySchema =
|
|
2019
|
+
var humanWaitEntrySchema = z17.object({
|
|
1993
2020
|
...waitBaseShape,
|
|
1994
|
-
kind:
|
|
2021
|
+
kind: z17.literal("human"),
|
|
1995
2022
|
questions: askRequestSchema.shape.questions.optional(),
|
|
1996
2023
|
/** The card's Markdown context (hearsay-tools/cezarion#1458); absent on waits recorded before it. */
|
|
1997
2024
|
context: askContextSchema.optional(),
|
|
1998
|
-
askSeq:
|
|
2025
|
+
askSeq: z17.number().int().nonnegative().optional()
|
|
1999
2026
|
}).strict();
|
|
2000
|
-
var workerWaitEntrySchema =
|
|
2027
|
+
var workerWaitEntrySchema = z17.object({
|
|
2001
2028
|
...waitBaseShape,
|
|
2002
|
-
kind:
|
|
2029
|
+
kind: z17.literal("worker"),
|
|
2003
2030
|
// Squawk's completion wait has neither: it ends when its workers settle (hearsay-tools/cezarion#1301).
|
|
2004
|
-
deadline:
|
|
2005
|
-
timeoutSeconds:
|
|
2031
|
+
deadline: z17.iso.datetime().optional(),
|
|
2032
|
+
timeoutSeconds: z17.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).optional(),
|
|
2006
2033
|
mode: workerWaitModeSchema.optional(),
|
|
2007
2034
|
workerIds: workerIdsSchema.optional(),
|
|
2008
|
-
revisions:
|
|
2009
|
-
outcomes:
|
|
2035
|
+
revisions: z17.array(z17.object({ workerId: z17.uuid(), revision: z17.number().int().nonnegative() }).strict()).max(32).optional(),
|
|
2036
|
+
outcomes: z17.array(workerOutcomeSchema).max(32).optional(),
|
|
2010
2037
|
requestIds: workerIdsSchema.optional(),
|
|
2011
|
-
requestOutcomes:
|
|
2012
|
-
result:
|
|
2013
|
-
wakeInputId:
|
|
2038
|
+
requestOutcomes: z17.array(requestOutcomeSchema).max(32).optional(),
|
|
2039
|
+
result: z17.object({ reason: z17.enum(["outcome", "timeout"]) }).strict().optional(),
|
|
2040
|
+
wakeInputId: z17.uuid().optional()
|
|
2014
2041
|
}).strict().superRefine((wait, ctx) => {
|
|
2015
2042
|
const hasDeadline = wait.deadline !== void 0;
|
|
2016
2043
|
const hasTimeout = wait.timeoutSeconds !== void 0;
|
|
@@ -2039,84 +2066,84 @@ var workerWaitEntrySchema = z16.object({
|
|
|
2039
2066
|
}
|
|
2040
2067
|
});
|
|
2041
2068
|
var hasWorkerDeadline = (entry) => entry.deadline !== void 0;
|
|
2042
|
-
var peerWaitEntrySchema =
|
|
2069
|
+
var peerWaitEntrySchema = z17.object({
|
|
2043
2070
|
...waitBaseShape,
|
|
2044
|
-
kind:
|
|
2045
|
-
deadline:
|
|
2046
|
-
timeoutSeconds:
|
|
2071
|
+
kind: z17.literal("peer"),
|
|
2072
|
+
deadline: z17.iso.datetime(),
|
|
2073
|
+
timeoutSeconds: z17.number().int().min(1).max(PEER_WAIT_MAX_SECONDS),
|
|
2047
2074
|
peerIds: workerIdsSchema,
|
|
2048
2075
|
result: peerWaitResultSchema.optional()
|
|
2049
2076
|
}).strict().superRefine(refinePeerWaitResult);
|
|
2050
2077
|
function peerWaitView(entry) {
|
|
2051
2078
|
return { id: entry.id, peerIds: entry.peerIds, deadline: entry.deadline, phase: entry.phase, ...entry.result ? { result: entry.result } : {} };
|
|
2052
2079
|
}
|
|
2053
|
-
var subagentChildSchema =
|
|
2054
|
-
id:
|
|
2055
|
-
status:
|
|
2080
|
+
var subagentChildSchema = z17.object({
|
|
2081
|
+
id: z17.string().min(1).max(256),
|
|
2082
|
+
status: z17.enum(["running", "completed", "failed", "cancelled"])
|
|
2056
2083
|
}).strict();
|
|
2057
|
-
var subagentWaitResultSchema =
|
|
2058
|
-
var subagentWaitEntrySchema =
|
|
2084
|
+
var subagentWaitResultSchema = z17.object({ reason: z17.enum(["settled", "timeout", "interrupted", "superseded"]) }).strict();
|
|
2085
|
+
var subagentWaitEntrySchema = z17.object({
|
|
2059
2086
|
...waitBaseShape,
|
|
2060
|
-
kind:
|
|
2061
|
-
source:
|
|
2062
|
-
via:
|
|
2063
|
-
deadline:
|
|
2064
|
-
children:
|
|
2087
|
+
kind: z17.literal("subagent"),
|
|
2088
|
+
source: z17.literal("cezar"),
|
|
2089
|
+
via: z17.literal("native-subagents"),
|
|
2090
|
+
deadline: z17.iso.datetime(),
|
|
2091
|
+
children: z17.array(subagentChildSchema).min(1).max(SUBAGENT_WAIT_CHILD_LIMIT),
|
|
2065
2092
|
result: subagentWaitResultSchema.optional()
|
|
2066
2093
|
}).strict();
|
|
2067
2094
|
function runningSubagents(wait) {
|
|
2068
2095
|
return wait.children.filter((child) => child.status === "running").length;
|
|
2069
2096
|
}
|
|
2070
|
-
var waitSchema =
|
|
2097
|
+
var waitSchema = z17.discriminatedUnion("kind", [prWaitEntrySchema, timerWaitEntrySchema, humanWaitEntrySchema, workerWaitEntrySchema, processWaitEntrySchema, peerWaitEntrySchema, subagentWaitEntrySchema]);
|
|
2071
2098
|
var oneModeTakesOneId = (ids, mode, ctx) => {
|
|
2072
2099
|
if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
|
|
2073
2100
|
};
|
|
2074
|
-
var waitTimeoutSeconds =
|
|
2075
|
-
var registrationFields = { operation_id:
|
|
2076
|
-
var squawkWaitRequestSchema =
|
|
2077
|
-
ciWaitRequestSchema.extend({ kind:
|
|
2078
|
-
|
|
2079
|
-
kind:
|
|
2101
|
+
var waitTimeoutSeconds = z17.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
|
|
2102
|
+
var registrationFields = { operation_id: z17.uuid().optional() };
|
|
2103
|
+
var squawkWaitRequestSchema = z17.discriminatedUnion("kind", [
|
|
2104
|
+
ciWaitRequestSchema.extend({ kind: z17.literal("pr"), ...registrationFields }).strict(),
|
|
2105
|
+
z17.object({
|
|
2106
|
+
kind: z17.literal("worker"),
|
|
2080
2107
|
...registrationFields,
|
|
2081
2108
|
worker_ids: workerIdsSchema,
|
|
2082
2109
|
mode: workerWaitModeSchema.optional(),
|
|
2083
2110
|
timeout_seconds: waitTimeoutSeconds
|
|
2084
2111
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
|
|
2085
|
-
|
|
2086
|
-
kind:
|
|
2112
|
+
z17.object({
|
|
2113
|
+
kind: z17.literal("request"),
|
|
2087
2114
|
...registrationFields,
|
|
2088
2115
|
request_ids: workerIdsSchema,
|
|
2089
2116
|
mode: workerWaitModeSchema.optional(),
|
|
2090
2117
|
timeout_seconds: waitTimeoutSeconds
|
|
2091
2118
|
}).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
|
|
2092
|
-
|
|
2093
|
-
kind:
|
|
2119
|
+
z17.object({
|
|
2120
|
+
kind: z17.literal("peer"),
|
|
2094
2121
|
...registrationFields,
|
|
2095
2122
|
peer_ids: workerIdsSchema,
|
|
2096
2123
|
timeout_seconds: waitTimeoutSeconds
|
|
2097
2124
|
}).strict(),
|
|
2098
|
-
|
|
2099
|
-
kind:
|
|
2125
|
+
z17.object({
|
|
2126
|
+
kind: z17.literal("timer"),
|
|
2100
2127
|
...registrationFields,
|
|
2101
|
-
seconds:
|
|
2102
|
-
note:
|
|
2128
|
+
seconds: z17.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
|
|
2129
|
+
note: z17.string().max(NOTE_MAX).optional()
|
|
2103
2130
|
}).strict(),
|
|
2104
|
-
|
|
2105
|
-
kind:
|
|
2131
|
+
z17.object({
|
|
2132
|
+
kind: z17.literal("process"),
|
|
2106
2133
|
...registrationFields,
|
|
2107
2134
|
pid: pidSchema,
|
|
2108
|
-
exit_file:
|
|
2109
|
-
timeout_seconds:
|
|
2110
|
-
note:
|
|
2135
|
+
exit_file: z17.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
|
|
2136
|
+
timeout_seconds: z17.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
|
|
2137
|
+
note: z17.string().max(NOTE_MAX).optional()
|
|
2111
2138
|
}).strict()
|
|
2112
2139
|
]);
|
|
2113
|
-
var squawkCancelWaitRequestSchema =
|
|
2114
|
-
var openWaitFields = { wait_id:
|
|
2115
|
-
var openWaitSchema =
|
|
2116
|
-
|
|
2117
|
-
|
|
2140
|
+
var squawkCancelWaitRequestSchema = z17.object({ wait_id: z17.uuid() }).strict();
|
|
2141
|
+
var openWaitFields = { wait_id: z17.uuid(), summary: z17.string().max(256) };
|
|
2142
|
+
var openWaitSchema = z17.discriminatedUnion("kind", [
|
|
2143
|
+
z17.object({ ...openWaitFields, kind: z17.enum(["pr", "timer", "worker", "process", "peer", "subagent"]), deadline: z17.iso.datetime() }).strict(),
|
|
2144
|
+
z17.object({ ...openWaitFields, kind: z17.literal("human") }).strict()
|
|
2118
2145
|
]);
|
|
2119
|
-
var waitErrorCodeSchema =
|
|
2146
|
+
var waitErrorCodeSchema = z17.enum([
|
|
2120
2147
|
...ciWaitErrorCodeSchema.options,
|
|
2121
2148
|
"timers_disabled",
|
|
2122
2149
|
"wake_budget_spent",
|
|
@@ -2131,42 +2158,42 @@ var waitErrorCodeSchema = z16.enum([
|
|
|
2131
2158
|
"messaging_off"
|
|
2132
2159
|
]);
|
|
2133
2160
|
var WAIT_MESSAGE_MAX = 4096;
|
|
2134
|
-
var message =
|
|
2135
|
-
var waitRegistrationReceiptSchema =
|
|
2136
|
-
operationId:
|
|
2137
|
-
requestHash:
|
|
2161
|
+
var message = z17.string().max(WAIT_MESSAGE_MAX);
|
|
2162
|
+
var waitRegistrationReceiptSchema = z17.object({
|
|
2163
|
+
operationId: z17.uuid(),
|
|
2164
|
+
requestHash: z17.string().regex(/^[0-9a-f]{64}$/),
|
|
2138
2165
|
wait: waitSchema,
|
|
2139
|
-
deduplicated:
|
|
2166
|
+
deduplicated: z17.boolean()
|
|
2140
2167
|
}).strict();
|
|
2141
2168
|
var registrationAnswerFields = {
|
|
2142
|
-
operation_id:
|
|
2169
|
+
operation_id: z17.uuid().optional()
|
|
2143
2170
|
};
|
|
2144
|
-
var squawkWaitAnswerSchema =
|
|
2145
|
-
|
|
2146
|
-
ok:
|
|
2171
|
+
var squawkWaitAnswerSchema = z17.discriminatedUnion("ok", [
|
|
2172
|
+
z17.object({
|
|
2173
|
+
ok: z17.literal(true),
|
|
2147
2174
|
...registrationAnswerFields,
|
|
2148
|
-
effect:
|
|
2149
|
-
deduplicated:
|
|
2150
|
-
replayed:
|
|
2151
|
-
wait_phase:
|
|
2152
|
-
wait_id:
|
|
2175
|
+
effect: z17.enum(["applied", "unchanged"]).optional(),
|
|
2176
|
+
deduplicated: z17.boolean().optional(),
|
|
2177
|
+
replayed: z17.boolean().optional(),
|
|
2178
|
+
wait_phase: z17.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
|
|
2179
|
+
wait_id: z17.uuid(),
|
|
2153
2180
|
/** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
|
|
2154
|
-
kind:
|
|
2155
|
-
deadline:
|
|
2156
|
-
open_waits:
|
|
2181
|
+
kind: z17.enum(["pr", "timer", "worker", "request", "process", "peer"]),
|
|
2182
|
+
deadline: z17.iso.datetime(),
|
|
2183
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT)
|
|
2157
2184
|
}).strict(),
|
|
2158
|
-
|
|
2159
|
-
ok:
|
|
2185
|
+
z17.object({
|
|
2186
|
+
ok: z17.literal(false),
|
|
2160
2187
|
...registrationAnswerFields,
|
|
2161
|
-
effect:
|
|
2188
|
+
effect: z17.enum(["refused", "unknown"]).optional(),
|
|
2162
2189
|
retained_wait: openWaitSchema.optional(),
|
|
2163
2190
|
code: waitErrorCodeSchema,
|
|
2164
2191
|
message,
|
|
2165
|
-
open_waits:
|
|
2192
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
2166
2193
|
}).strict()
|
|
2167
2194
|
]);
|
|
2168
2195
|
var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
|
|
2169
|
-
var askErrorCodeSchema =
|
|
2196
|
+
var askErrorCodeSchema = z17.enum([
|
|
2170
2197
|
"invalid_request",
|
|
2171
2198
|
"capacity",
|
|
2172
2199
|
"persistence",
|
|
@@ -2187,30 +2214,30 @@ var askErrorCodeSchema = z16.enum([
|
|
|
2187
2214
|
"worker_execution_stopped",
|
|
2188
2215
|
"root_finish_pending"
|
|
2189
2216
|
]);
|
|
2190
|
-
var squawkAskAnswerSchema =
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
ok:
|
|
2217
|
+
var squawkAskAnswerSchema = z17.discriminatedUnion("ok", [
|
|
2218
|
+
z17.object({ ok: z17.literal(true), wait_id: z17.uuid(), open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
2219
|
+
z17.object({
|
|
2220
|
+
ok: z17.literal(false),
|
|
2194
2221
|
code: askErrorCodeSchema,
|
|
2195
2222
|
message,
|
|
2196
|
-
open_waits:
|
|
2223
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
2197
2224
|
}).strict()
|
|
2198
2225
|
]);
|
|
2199
|
-
var squawkCancelWaitAnswerSchema =
|
|
2200
|
-
|
|
2201
|
-
cancelled:
|
|
2202
|
-
wait_id:
|
|
2203
|
-
open_waits:
|
|
2226
|
+
var squawkCancelWaitAnswerSchema = z17.discriminatedUnion("cancelled", [
|
|
2227
|
+
z17.object({
|
|
2228
|
+
cancelled: z17.literal(true),
|
|
2229
|
+
wait_id: z17.uuid(),
|
|
2230
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT)
|
|
2204
2231
|
}).strict(),
|
|
2205
|
-
|
|
2206
|
-
cancelled:
|
|
2207
|
-
code:
|
|
2232
|
+
z17.object({
|
|
2233
|
+
cancelled: z17.literal(false),
|
|
2234
|
+
code: z17.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
|
|
2208
2235
|
message,
|
|
2209
|
-
open_waits:
|
|
2236
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT).optional()
|
|
2210
2237
|
}).strict()
|
|
2211
2238
|
]);
|
|
2212
|
-
var squawkDoneRequestSchema =
|
|
2213
|
-
var doneErrorCodeSchema =
|
|
2239
|
+
var squawkDoneRequestSchema = z17.object({ summary: z17.string().max(2e3).optional() }).strict();
|
|
2240
|
+
var doneErrorCodeSchema = z17.enum([
|
|
2214
2241
|
"workers_outstanding",
|
|
2215
2242
|
"workers_uncollected",
|
|
2216
2243
|
"worker_questions",
|
|
@@ -2234,65 +2261,65 @@ var doneErrorCodeSchema = z16.enum([
|
|
|
2234
2261
|
"unavailable",
|
|
2235
2262
|
"input_pending"
|
|
2236
2263
|
]);
|
|
2237
|
-
var doneOwedInputSchema =
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2264
|
+
var doneOwedInputSchema = z17.discriminatedUnion("kind", [
|
|
2265
|
+
z17.object({ kind: z17.literal("wait_result"), wait_id: z17.string(), wait_kind: z17.string() }).strict(),
|
|
2266
|
+
z17.object({ kind: z17.literal("queued"), input_id: z17.string().optional(), source: z17.string() }).strict(),
|
|
2267
|
+
z17.object({ kind: z17.literal("in_flight"), input_id: z17.string() }).strict(),
|
|
2268
|
+
z17.object({ kind: z17.literal("unread"), input_id: z17.string() }).strict()
|
|
2242
2269
|
]);
|
|
2243
2270
|
var doneAccepted = {
|
|
2244
|
-
ok:
|
|
2245
|
-
finishes:
|
|
2246
|
-
open_waits:
|
|
2271
|
+
ok: z17.literal(true),
|
|
2272
|
+
finishes: z17.literal("at_turn_end"),
|
|
2273
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT)
|
|
2247
2274
|
};
|
|
2248
|
-
var squawkDoneAnswerSchema =
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2275
|
+
var squawkDoneAnswerSchema = z17.discriminatedUnion("ok", [
|
|
2276
|
+
z17.discriminatedUnion("completes", [
|
|
2277
|
+
z17.object({ ...doneAccepted, completes: z17.literal("task") }).strict(),
|
|
2278
|
+
z17.object({ ...doneAccepted, completes: z17.literal("step"), next_step: z17.string().min(1) }).strict()
|
|
2252
2279
|
]),
|
|
2253
|
-
|
|
2254
|
-
ok:
|
|
2280
|
+
z17.object({
|
|
2281
|
+
ok: z17.literal(false),
|
|
2255
2282
|
code: doneErrorCodeSchema,
|
|
2256
2283
|
message,
|
|
2257
2284
|
/** The workers that block the finish, and why each one does. */
|
|
2258
|
-
workers:
|
|
2259
|
-
worker_id:
|
|
2260
|
-
reason:
|
|
2285
|
+
workers: z17.array(z17.object({
|
|
2286
|
+
worker_id: z17.string(),
|
|
2287
|
+
reason: z17.enum(["outstanding", "uncollected", "question"])
|
|
2261
2288
|
}).strict()).max(64).optional(),
|
|
2262
|
-
open_waits:
|
|
2289
|
+
open_waits: z17.array(openWaitSchema).max(WAIT_LIMIT).optional(),
|
|
2263
2290
|
/** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
|
|
2264
|
-
owed:
|
|
2291
|
+
owed: z17.array(doneOwedInputSchema).max(64).optional()
|
|
2265
2292
|
}).strict()
|
|
2266
2293
|
]);
|
|
2267
|
-
var waitingOnUnionSchema =
|
|
2294
|
+
var waitingOnUnionSchema = z17.discriminatedUnion("kind", [
|
|
2268
2295
|
/** `shown` once the user sees the question (its `askSeq`): attention reads that as Needs you at
|
|
2269
2296
|
* any status, a wake turn's included (phase 4b, hearsay-tools/cezarion#1236). */
|
|
2270
|
-
|
|
2297
|
+
z17.object({ kind: z17.literal("human"), shown: z17.literal(true).optional() }),
|
|
2271
2298
|
// `autoResumeAt` is free text on the record, so the instant it carries is too.
|
|
2272
|
-
|
|
2299
|
+
z17.object({ kind: z17.literal("usage-limit"), at: z17.string() }),
|
|
2273
2300
|
/** The workers still owed an outcome, or the replies awaited; 0 when the row cannot count.
|
|
2274
2301
|
* `replies` when every open worker entry waits on request replies, so a summary, which carries
|
|
2275
2302
|
* no `waits`, can still say so (hearsay-tools/cezarion#1235). `peers` when one of those
|
|
2276
2303
|
* requests went to a peer task (hearsay-tools/cezarion#1995). */
|
|
2277
|
-
|
|
2304
|
+
z17.object({ kind: z17.literal("workers"), count: z17.number().int().nonnegative(), replies: z17.literal(true).optional(), peers: z17.literal(true).optional() }),
|
|
2278
2305
|
/** The peer tasks the open peer waits name, counted once each (hearsay-tools/cezarion#1995). */
|
|
2279
|
-
|
|
2306
|
+
z17.object({ kind: z17.literal("peers"), count: z17.number().int().nonnegative() }),
|
|
2280
2307
|
/** The native subagents still running, over every open subagent wait (hearsay-tools/cezarion#2431). */
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
kind:
|
|
2308
|
+
z17.object({ kind: z17.literal("subagents"), count: z17.number().int().nonnegative() }),
|
|
2309
|
+
z17.object({
|
|
2310
|
+
kind: z17.literal("pr"),
|
|
2284
2311
|
until: prWaitUntilSchema,
|
|
2285
|
-
waitId:
|
|
2312
|
+
waitId: z17.uuid(),
|
|
2286
2313
|
prUrl: ciPrIdentitySchema.shape.prUrl,
|
|
2287
2314
|
repository: ciPrIdentitySchema.shape.repository,
|
|
2288
2315
|
prNumber: ciPrIdentitySchema.shape.prNumber,
|
|
2289
|
-
deadline:
|
|
2316
|
+
deadline: z17.iso.datetime()
|
|
2290
2317
|
}),
|
|
2291
2318
|
/** A background command (hearsay-tools/cezarion#1446). */
|
|
2292
|
-
|
|
2293
|
-
|
|
2319
|
+
z17.object({ kind: z17.literal("process"), waitId: z17.uuid(), pid: pidSchema, deadline: z17.iso.datetime(), note: z17.string().max(NOTE_MAX).optional() }),
|
|
2320
|
+
z17.object({ kind: z17.literal("timer"), waitId: z17.uuid(), at: z17.iso.datetime(), note: z17.string().max(NOTE_MAX).optional() })
|
|
2294
2321
|
]);
|
|
2295
|
-
var waitingOnSchema =
|
|
2322
|
+
var waitingOnSchema = z17.preprocess(
|
|
2296
2323
|
(value) => value && typeof value === "object" && value.kind === "ci" ? { ...value, kind: "pr", until: "checks" } : value,
|
|
2297
2324
|
waitingOnUnionSchema
|
|
2298
2325
|
);
|
|
@@ -2421,19 +2448,19 @@ function workerWaitEntryToLegacy(entry) {
|
|
|
2421
2448
|
}
|
|
2422
2449
|
|
|
2423
2450
|
// ../contract/src/handoff.ts
|
|
2424
|
-
import { z as
|
|
2451
|
+
import { z as z18 } from "zod";
|
|
2425
2452
|
var HANDOFF_AUTOSAVE_RECORDS_MAX = 20;
|
|
2426
|
-
var handoffAutosaveRecordSchema =
|
|
2427
|
-
at:
|
|
2428
|
-
note:
|
|
2429
|
-
periodic:
|
|
2430
|
-
branch:
|
|
2431
|
-
count:
|
|
2432
|
-
first:
|
|
2433
|
-
latest:
|
|
2453
|
+
var handoffAutosaveRecordSchema = z18.object({
|
|
2454
|
+
at: z18.string(),
|
|
2455
|
+
note: z18.string(),
|
|
2456
|
+
periodic: z18.object({
|
|
2457
|
+
branch: z18.string().nullable(),
|
|
2458
|
+
count: z18.number().int().positive(),
|
|
2459
|
+
first: z18.string().nullable(),
|
|
2460
|
+
latest: z18.string().nullable()
|
|
2434
2461
|
}).optional()
|
|
2435
2462
|
});
|
|
2436
|
-
var handoffRecordsSchema =
|
|
2463
|
+
var handoffRecordsSchema = z18.object({ autosave: z18.array(handoffAutosaveRecordSchema) });
|
|
2437
2464
|
function exactLineIndex(text, line) {
|
|
2438
2465
|
const padded = `
|
|
2439
2466
|
${text}
|
|
@@ -2452,46 +2479,46 @@ function nextLineIndex(text, index) {
|
|
|
2452
2479
|
}
|
|
2453
2480
|
|
|
2454
2481
|
// ../contract/src/task-options.ts
|
|
2455
|
-
import { z as
|
|
2482
|
+
import { z as z19 } from "zod";
|
|
2456
2483
|
var completionControlsShape = {
|
|
2457
|
-
archiveWhenDone:
|
|
2458
|
-
autoMergePr:
|
|
2484
|
+
archiveWhenDone: z19.boolean().optional(),
|
|
2485
|
+
autoMergePr: z19.boolean().optional()
|
|
2459
2486
|
};
|
|
2460
2487
|
var taskAccessShape = {
|
|
2461
|
-
allowWorkers:
|
|
2462
|
-
allowMessaging:
|
|
2488
|
+
allowWorkers: z19.boolean().optional(),
|
|
2489
|
+
allowMessaging: z19.boolean().optional()
|
|
2463
2490
|
};
|
|
2464
2491
|
var workersAllowed = (run) => run.allowWorkers !== false;
|
|
2465
2492
|
var messagingAllowed = (run) => run.allowMessaging !== false;
|
|
2466
2493
|
|
|
2467
2494
|
// ../contract/src/runs.ts
|
|
2468
|
-
var archivePullRequestIdentitySchema =
|
|
2469
|
-
owner:
|
|
2470
|
-
repo:
|
|
2471
|
-
number:
|
|
2472
|
-
});
|
|
2473
|
-
var mergedPullRequestSchema = archivePullRequestIdentitySchema.extend({ mergedAt:
|
|
2474
|
-
var autoArchiveReceiptSchema =
|
|
2475
|
-
reason:
|
|
2476
|
-
archivedAt:
|
|
2477
|
-
fingerprint:
|
|
2478
|
-
pullRequests:
|
|
2479
|
-
});
|
|
2480
|
-
var completionActionSchema =
|
|
2481
|
-
id:
|
|
2482
|
-
phase:
|
|
2483
|
-
message:
|
|
2484
|
-
});
|
|
2485
|
-
var usageCounterSchema =
|
|
2486
|
-
var stepStateSchema =
|
|
2487
|
-
id:
|
|
2488
|
-
name:
|
|
2495
|
+
var archivePullRequestIdentitySchema = z20.object({
|
|
2496
|
+
owner: z20.string().min(1),
|
|
2497
|
+
repo: z20.string().min(1),
|
|
2498
|
+
number: z20.number().int().positive()
|
|
2499
|
+
});
|
|
2500
|
+
var mergedPullRequestSchema = archivePullRequestIdentitySchema.extend({ mergedAt: z20.string().datetime() });
|
|
2501
|
+
var autoArchiveReceiptSchema = z20.object({
|
|
2502
|
+
reason: z20.literal("pull-requests-merged"),
|
|
2503
|
+
archivedAt: z20.string().datetime(),
|
|
2504
|
+
fingerprint: z20.string(),
|
|
2505
|
+
pullRequests: z20.array(mergedPullRequestSchema)
|
|
2506
|
+
});
|
|
2507
|
+
var completionActionSchema = z20.object({
|
|
2508
|
+
id: z20.string().uuid(),
|
|
2509
|
+
phase: z20.enum(["pending", "blocked", "complete"]),
|
|
2510
|
+
message: z20.string().optional()
|
|
2511
|
+
});
|
|
2512
|
+
var usageCounterSchema = z20.number().finite().nonnegative();
|
|
2513
|
+
var stepStateSchema = z20.object({
|
|
2514
|
+
id: z20.string(),
|
|
2515
|
+
name: z20.string(),
|
|
2489
2516
|
kind: stepKindSchema,
|
|
2490
2517
|
status: stepStatusSchema,
|
|
2491
|
-
iterations:
|
|
2518
|
+
iterations: z20.number(),
|
|
2492
2519
|
/** Durable count of onFail retry loops consumed by this check. */
|
|
2493
|
-
retriesUsed:
|
|
2494
|
-
tokensUsed:
|
|
2520
|
+
retriesUsed: z20.number().int().nonnegative().optional(),
|
|
2521
|
+
tokensUsed: z20.number(),
|
|
2495
2522
|
inputTokens: usageCounterSchema.optional(),
|
|
2496
2523
|
outputTokens: usageCounterSchema.optional(),
|
|
2497
2524
|
usageInvocationsStarted: usageCounterSchema.optional(),
|
|
@@ -2499,113 +2526,92 @@ var stepStateSchema = z19.object({
|
|
|
2499
2526
|
usageTurnsStarted: usageCounterSchema.optional(),
|
|
2500
2527
|
usageTurnsRecorded: usageCounterSchema.optional(),
|
|
2501
2528
|
usageInvocationEpoch: usageCounterSchema.optional(),
|
|
2502
|
-
startedAt:
|
|
2503
|
-
finishedAt:
|
|
2504
|
-
error:
|
|
2529
|
+
startedAt: z20.string().optional(),
|
|
2530
|
+
finishedAt: z20.string().optional(),
|
|
2531
|
+
error: z20.string().optional(),
|
|
2505
2532
|
/** Latest agent session id — `claude --resume <id>` and friends. */
|
|
2506
|
-
sessionId:
|
|
2533
|
+
sessionId: z20.string().optional(),
|
|
2507
2534
|
/** Backend that owns `sessionId`; absent on records written before backend affinity. */
|
|
2508
2535
|
backend: runnerSchema.optional(),
|
|
2509
2536
|
/** A runner Squawk no longer ships that this step ran on; its session is gone (hearsay-tools/squawk#3715). */
|
|
2510
|
-
removedBackend:
|
|
2537
|
+
removedBackend: z20.string().optional(),
|
|
2511
2538
|
/** Agent account (spec 2026-07-29-agent-profiles) that owns `sessionId` — `default`, or a
|
|
2512
2539
|
* stored profile id. The two are a PAIR: a session id only resolves inside the config dir
|
|
2513
2540
|
* that created it, so resume and Continue read this rather than the project's current
|
|
2514
2541
|
* selection. Absent on records written before accounts existed. */
|
|
2515
|
-
profileId:
|
|
2516
|
-
skillPath:
|
|
2542
|
+
profileId: z20.string().optional(),
|
|
2543
|
+
skillPath: z20.string().min(1).optional(),
|
|
2517
2544
|
// Host-local copy; project skills are relative to the step's working folder.
|
|
2518
|
-
costUsd:
|
|
2545
|
+
costUsd: z20.number().optional(),
|
|
2519
2546
|
/** Explicit provenance for engine-generated continuation steps. */
|
|
2520
|
-
synthetic:
|
|
2547
|
+
synthetic: z20.literal("continuation").optional(),
|
|
2521
2548
|
/** On a `synthetic` continuation: the workflow step it continues, recorded once at admission
|
|
2522
2549
|
* (ADR 0064). It names the step a later Continue of this session runs as, never the workflow
|
|
2523
2550
|
* position. Absent on steps saved before it; those resolve to the chain's last agent step. */
|
|
2524
|
-
continuesStepId:
|
|
2551
|
+
continuesStepId: z20.string().optional()
|
|
2525
2552
|
});
|
|
2526
|
-
var diffStatSchema =
|
|
2527
|
-
adds:
|
|
2528
|
-
dels:
|
|
2529
|
-
files:
|
|
2553
|
+
var diffStatSchema = z20.object({
|
|
2554
|
+
adds: z20.number(),
|
|
2555
|
+
dels: z20.number(),
|
|
2556
|
+
files: z20.number(),
|
|
2530
2557
|
/** Additive since #751, and present ONLY when true: the numbers were measured against a
|
|
2531
2558
|
* branch the agent checked out into the task's worktree, as the run found it, because the
|
|
2532
2559
|
* worktree's HEAD had been repointed off the task's own branch (every review/QA run does
|
|
2533
2560
|
* this) and the merge-base anchor would otherwise have reported that branch's entire diff
|
|
2534
2561
|
* as this task's. Absent on every normal run and on every record written before #751 — a
|
|
2535
2562
|
* consumer that ignores it sees exactly the old shape. */
|
|
2536
|
-
repointed:
|
|
2537
|
-
});
|
|
2538
|
-
var queuedMessageSchema = z19.object({
|
|
2539
|
-
replayAfterOpen: z19.literal(true).optional(),
|
|
2540
|
-
// NativeSkillInputQueue sets; launch hydration excludes; QueuedInput replays after open.
|
|
2541
|
-
id: z19.string(),
|
|
2542
|
-
text: z19.string(),
|
|
2543
|
-
/** `/api/v1/runs/:id/images/…` URLs — attachments are persisted, never inlined. Images and
|
|
2544
|
-
* files share this one list; read `isImageAttachmentName` on the file name to tell them apart. */
|
|
2545
|
-
images: z19.array(z19.string()).optional(),
|
|
2546
|
-
createdAt: z19.string()
|
|
2563
|
+
repointed: z20.boolean().optional()
|
|
2547
2564
|
});
|
|
2548
|
-
var
|
|
2549
|
-
origin: z19.enum(["human", "lifecycle"]).optional(),
|
|
2550
|
-
/** An attributed parent message used as the opening prompt, never a human answer. */
|
|
2551
|
-
agentInputId: z19.uuid().optional(),
|
|
2552
|
-
/** Captured before clearing the run error. Keep generated context separate from human
|
|
2553
|
-
* text so repeated restart recovery never accumulates diagnostic prefixes. */
|
|
2554
|
-
resumeContext: z19.object({
|
|
2555
|
-
failure: z19.object({ stepId: z19.string().optional(), error: z19.string() }).optional(),
|
|
2556
|
-
restarted: z19.literal(true).optional()
|
|
2557
|
-
}).optional()
|
|
2558
|
-
});
|
|
2559
|
-
var processUsageSchema = z19.object({
|
|
2565
|
+
var processUsageSchema = z20.object({
|
|
2560
2566
|
/** Sum of `%cpu` across the tree — can exceed 100 on multi-core work. */
|
|
2561
|
-
cpuPct:
|
|
2562
|
-
rssBytes:
|
|
2563
|
-
procCount:
|
|
2564
|
-
});
|
|
2565
|
-
var runWebhookOutcomeSchema =
|
|
2566
|
-
lastDeliveredAt:
|
|
2567
|
-
lastError:
|
|
2568
|
-
lastErrorWebhookId:
|
|
2569
|
-
});
|
|
2570
|
-
var runWorktreeSetupSchema =
|
|
2571
|
-
status:
|
|
2572
|
-
startedAt:
|
|
2573
|
-
finishedAt:
|
|
2574
|
-
durationMs:
|
|
2567
|
+
cpuPct: z20.number(),
|
|
2568
|
+
rssBytes: z20.number(),
|
|
2569
|
+
procCount: z20.number()
|
|
2570
|
+
});
|
|
2571
|
+
var runWebhookOutcomeSchema = z20.object({
|
|
2572
|
+
lastDeliveredAt: z20.string().optional(),
|
|
2573
|
+
lastError: z20.string().max(1024).optional(),
|
|
2574
|
+
lastErrorWebhookId: z20.string().optional()
|
|
2575
|
+
});
|
|
2576
|
+
var runWorktreeSetupSchema = z20.object({
|
|
2577
|
+
status: z20.enum(["running", "done", "failed"]),
|
|
2578
|
+
startedAt: z20.string(),
|
|
2579
|
+
finishedAt: z20.string().optional(),
|
|
2580
|
+
durationMs: z20.number().optional(),
|
|
2575
2581
|
/** One line: "`npm ci` exited 1", "`npm ci` timed out after 900s", "invalid config: …". */
|
|
2576
|
-
error:
|
|
2582
|
+
error: z20.string().optional()
|
|
2577
2583
|
});
|
|
2578
|
-
var runPullRequestSchema =
|
|
2579
|
-
number:
|
|
2580
|
-
url:
|
|
2581
|
-
source:
|
|
2584
|
+
var runPullRequestSchema = z20.object({
|
|
2585
|
+
number: z20.number().int().positive().lt(1e7),
|
|
2586
|
+
url: z20.string().regex(/^https?:\/\/github\.com\/[a-z0-9_.-]+\/[a-z0-9_.-]+\/pull\/\d+\/?(?:[?#][^\s]*)?$/i).optional(),
|
|
2587
|
+
source: z20.enum(["declared", "created"])
|
|
2582
2588
|
}).refine((entry) => entry.url === void 0 || Number(/\/pull\/(\d+)/i.exec(entry.url)?.[1]) === entry.number, { message: "PR URL and number must agree" });
|
|
2583
|
-
var workflowCursorSchema =
|
|
2584
|
-
var doneAcceptedSchema =
|
|
2585
|
-
session:
|
|
2586
|
-
at:
|
|
2587
|
-
seq:
|
|
2588
|
-
openWaits:
|
|
2589
|
-
settledWaits:
|
|
2590
|
-
lastInput:
|
|
2591
|
-
summary:
|
|
2592
|
-
freeTurn:
|
|
2593
|
-
});
|
|
2594
|
-
var runRecordSchema =
|
|
2595
|
-
id:
|
|
2596
|
-
title:
|
|
2589
|
+
var workflowCursorSchema = z20.object({ stepId: z20.string(), mode: z20.enum(["resume", "start"]) });
|
|
2590
|
+
var doneAcceptedSchema = z20.object({
|
|
2591
|
+
session: z20.string(),
|
|
2592
|
+
at: z20.string(),
|
|
2593
|
+
seq: z20.number().int().nonnegative(),
|
|
2594
|
+
openWaits: z20.array(z20.string()).max(32),
|
|
2595
|
+
settledWaits: z20.array(z20.string()).max(32),
|
|
2596
|
+
lastInput: z20.string().optional(),
|
|
2597
|
+
summary: z20.string().optional(),
|
|
2598
|
+
freeTurn: z20.literal(true).optional()
|
|
2599
|
+
});
|
|
2600
|
+
var runRecordSchema = z20.object({
|
|
2601
|
+
id: z20.string(),
|
|
2602
|
+
title: z20.string(),
|
|
2597
2603
|
/** Display title (#389): auto-derived from the first agent turn, or the user's inline edit
|
|
2598
2604
|
* (`PATCH /runs/:id` sets it together with `title`). Show `titleSummary ?? title`. */
|
|
2599
|
-
titleSummary:
|
|
2605
|
+
titleSummary: z20.string().optional(),
|
|
2600
2606
|
/** Refreshed on every turn-end; absent until the first turn ends (and on worktree-less runs). */
|
|
2601
2607
|
diffStat: diffStatSchema.optional(),
|
|
2602
|
-
workflow:
|
|
2603
|
-
task:
|
|
2608
|
+
workflow: z20.string(),
|
|
2609
|
+
task: z20.string(),
|
|
2604
2610
|
/** Prompt messages stacked onto the run while it waited for a free agent slot (#472). Folded
|
|
2605
2611
|
* into the prompt at dequeue — never delivered as their own turns. Absent on pre-#472 runs. */
|
|
2606
|
-
queuedMessages:
|
|
2612
|
+
queuedMessages: z20.array(queuedMessageSchema).optional(),
|
|
2607
2613
|
/** Stop was accepted; execution termination is still pending. */
|
|
2608
|
-
stopping:
|
|
2614
|
+
stopping: z20.boolean().optional(),
|
|
2609
2615
|
/** Opening Continue message, retained until its first completed turn for crash recovery. */
|
|
2610
2616
|
continuationMessage: continuationMessageSchema.optional(),
|
|
2611
2617
|
/** The workflow step the run goes on from (ADR 0064): `resume` continues that step's session (a
|
|
@@ -2616,54 +2622,54 @@ var runRecordSchema = z19.object({
|
|
|
2616
2622
|
* `turn-settler.ts` decides at each turn end whether it holds and retires it. */
|
|
2617
2623
|
doneAccepted: doneAcceptedSchema.optional(),
|
|
2618
2624
|
/** The last turn carried a malformed explicit structured question. */
|
|
2619
|
-
invalidAsk:
|
|
2625
|
+
invalidAsk: z20.boolean().optional(),
|
|
2620
2626
|
/** Owned-run authority; absence is legacy, invalid is explicitly quarantined. */
|
|
2621
2627
|
delegation: delegationStateSchema.optional(),
|
|
2622
2628
|
/** Durable non-human input, kept separate from human prompt/answer queues. */
|
|
2623
|
-
agentInputs:
|
|
2629
|
+
agentInputs: z20.array(agentInputSchema).optional(),
|
|
2624
2630
|
/** Open and recently resolved waits (spec 2026-10-17-unified-waits): CI, timers and the user. */
|
|
2625
|
-
waits:
|
|
2626
|
-
waitRegistrations:
|
|
2631
|
+
waits: z20.array(waitSchema).optional(),
|
|
2632
|
+
waitRegistrations: z20.array(waitRegistrationReceiptSchema).optional(),
|
|
2627
2633
|
/** Settled waits, newest last, capped at `LAST_WAITS_LIMIT`. */
|
|
2628
|
-
lastWaits:
|
|
2634
|
+
lastWaits: z20.array(waitSchema).optional(),
|
|
2629
2635
|
/** Retained recovery observation when previous wait metadata cannot be trusted. */
|
|
2630
|
-
lastWaitsError:
|
|
2636
|
+
lastWaitsError: z20.string().max(256).optional(),
|
|
2631
2637
|
/** Automatic wakes (timers and nudges) spent since the user last wrote; the budget survives
|
|
2632
2638
|
* a restart and a scheduler continuation (hearsay-tools/cezarion#1234). */
|
|
2633
|
-
automaticWakes:
|
|
2639
|
+
automaticWakes: z20.number().int().nonnegative().optional(),
|
|
2634
2640
|
/** Consecutive wake deliveries that failed; at the bound the run settles `failed` and keeps
|
|
2635
2641
|
* its results (hearsay-tools/cezarion#1234). */
|
|
2636
|
-
waitDeliveryFailures:
|
|
2642
|
+
waitDeliveryFailures: z20.number().int().nonnegative().optional(),
|
|
2637
2643
|
/** Dev servers the agent registered with `cezar_preview_serve` (#781). Salvaged per entry on load. */
|
|
2638
|
-
previewServers:
|
|
2644
|
+
previewServers: z20.array(previewServerSchema).optional(),
|
|
2639
2645
|
/** URLs of images and document attachments on the initial task prompt; branch on isImageAttachmentName. */
|
|
2640
|
-
taskImages:
|
|
2641
|
-
model:
|
|
2646
|
+
taskImages: z20.array(z20.string()).optional(),
|
|
2647
|
+
model: z20.string().optional(),
|
|
2642
2648
|
/** Reasoning-effort pin (#45). Canonical `low`/`medium`/`high`/`xhigh`/`max`.
|
|
2643
2649
|
* Absent = harness default. Additive: pre-#45 records omit it and still parse. */
|
|
2644
|
-
effort:
|
|
2650
|
+
effort: z20.string().max(32).optional(),
|
|
2645
2651
|
/** Normalized provider/model identity used for attribution and reproducible replay. */
|
|
2646
|
-
modelIdentity:
|
|
2652
|
+
modelIdentity: z20.string().optional(),
|
|
2647
2653
|
runner: runnerSchema.optional(),
|
|
2648
2654
|
/** A runner Squawk no longer ships that this run ran on; it continues only on a named runner (hearsay-tools/squawk#3715). */
|
|
2649
|
-
removedRunner:
|
|
2655
|
+
removedRunner: z20.string().optional(),
|
|
2650
2656
|
/** The composer's per-task agent account (spec 2026-07-29-agent-profiles), applying to steps
|
|
2651
2657
|
* on `runner`. Absent = the run follows the project's own selection. */
|
|
2652
|
-
agentProfile:
|
|
2658
|
+
agentProfile: z20.string().optional(),
|
|
2653
2659
|
/** Echo of the extra system prompt the run used (POST override or config default). */
|
|
2654
|
-
systemPrompt:
|
|
2660
|
+
systemPrompt: z20.string().optional(),
|
|
2655
2661
|
/** Legacy generated-inbox preference, retained only to read historical run records. */
|
|
2656
|
-
generateFollowups:
|
|
2662
|
+
generateFollowups: z20.boolean().optional(),
|
|
2657
2663
|
/** Autonomous mode (#autonomous): the run never parks at `waiting` or the terminal `review`
|
|
2658
2664
|
* gate. Absent = falsy = not autonomous. */
|
|
2659
|
-
autonomous:
|
|
2665
|
+
autonomous: z20.boolean().optional(),
|
|
2660
2666
|
...completionControlsShape,
|
|
2661
2667
|
...taskAccessShape,
|
|
2662
2668
|
completionAction: completionActionSchema.optional(),
|
|
2663
|
-
archiveBlocker:
|
|
2664
|
-
message:
|
|
2665
|
-
runId:
|
|
2666
|
-
pullRequestUrl:
|
|
2669
|
+
archiveBlocker: z20.object({
|
|
2670
|
+
message: z20.string(),
|
|
2671
|
+
runId: z20.string().optional(),
|
|
2672
|
+
pullRequestUrl: z20.string().optional()
|
|
2667
2673
|
}).optional(),
|
|
2668
2674
|
/**
|
|
2669
2675
|
* Provenance for a task a project GitHub automation launched (#694). Absent on every ordinary
|
|
@@ -2674,25 +2680,25 @@ var runRecordSchema = z19.object({
|
|
|
2674
2680
|
* launching definition matched, recorded on the run for the audit trail, and `src/runs/store.ts`
|
|
2675
2681
|
* persists it as free text so an older Squawk can still read a record written by a newer one.
|
|
2676
2682
|
*/
|
|
2677
|
-
automation:
|
|
2678
|
-
automationId:
|
|
2679
|
-
automationRevision:
|
|
2680
|
-
receiptId:
|
|
2681
|
-
event:
|
|
2682
|
-
githubUrl:
|
|
2683
|
+
automation: z20.object({
|
|
2684
|
+
automationId: z20.string(),
|
|
2685
|
+
automationRevision: z20.number(),
|
|
2686
|
+
receiptId: z20.string(),
|
|
2687
|
+
event: z20.string(),
|
|
2688
|
+
githubUrl: z20.string()
|
|
2683
2689
|
}).optional(),
|
|
2684
2690
|
/**
|
|
2685
2691
|
* Provenance for a task a SCHEDULED automation launched. A separate optional key rather than a
|
|
2686
2692
|
* loosened `automation`: `runs.json` is parsed as one array, so a downgraded Squawk meeting a
|
|
2687
2693
|
* record without `githubUrl` would drop every run, whereas an unknown key it simply strips.
|
|
2688
2694
|
*/
|
|
2689
|
-
automationTrigger:
|
|
2690
|
-
automationId:
|
|
2691
|
-
automationRevision:
|
|
2692
|
-
receiptId:
|
|
2693
|
-
trigger:
|
|
2695
|
+
automationTrigger: z20.object({
|
|
2696
|
+
automationId: z20.string(),
|
|
2697
|
+
automationRevision: z20.number(),
|
|
2698
|
+
receiptId: z20.string(),
|
|
2699
|
+
trigger: z20.enum(["schedule", "catch-up", "manual"]),
|
|
2694
2700
|
/** The scheduled instant (UTC ISO); for `manual`, the launch time. */
|
|
2695
|
-
occurrenceAt:
|
|
2701
|
+
occurrenceAt: z20.string()
|
|
2696
2702
|
}).optional(),
|
|
2697
2703
|
/** A pending worker destroy's automatic retry state (hearsay-tools/cezarion#879). Here, not in
|
|
2698
2704
|
* the strict worker `delegation`, so an older Squawk strips it instead of quarantining the worker,
|
|
@@ -2701,102 +2707,102 @@ var runRecordSchema = z19.object({
|
|
|
2701
2707
|
/** Task webhook opt-in (#589): the project's webhook receives this run's status changes.
|
|
2702
2708
|
* Absent = off. Changes after start through `POST /runs/:id/notify`, which is why it is not
|
|
2703
2709
|
* part of the idempotent-start hash. */
|
|
2704
|
-
notify:
|
|
2710
|
+
notify: z20.boolean().optional(),
|
|
2705
2711
|
/** The last webhook delivery's outcome (#589). Absent until a delivery was attempted. */
|
|
2706
2712
|
webhook: runWebhookOutcomeSchema.optional(),
|
|
2707
2713
|
status: runStatusSchema,
|
|
2708
2714
|
/** Live native approval attention; grants themselves never persist. */
|
|
2709
|
-
hasPendingPermission:
|
|
2715
|
+
hasPendingPermission: z20.boolean().optional(),
|
|
2710
2716
|
/** Exact ISO-8601 instant this run resumes itself after a provider usage limit stopped it
|
|
2711
2717
|
* (spec 2026-08-03-auto-resume-after-usage-limit). Present only on a `waiting` run with a
|
|
2712
2718
|
* pending automatic resume (hearsay-tools/cezarion#1236; a `failed` one before) — its absence
|
|
2713
2719
|
* is what "no resume is scheduled" looks like. */
|
|
2714
|
-
autoResumeAt:
|
|
2720
|
+
autoResumeAt: z20.string().optional(),
|
|
2715
2721
|
/** Consecutive automatic resumes since the last human turn, against the safety cap. */
|
|
2716
|
-
autoResumeAttempts:
|
|
2722
|
+
autoResumeAttempts: z20.number().optional(),
|
|
2717
2723
|
/** Why the hold waits: `usage-limit`, or a `provider-error` retried with back-off (hearsay-tools/squawk#3337). */
|
|
2718
|
-
autoResumeReason:
|
|
2724
|
+
autoResumeReason: z20.enum(["usage-limit", "provider-error"]).optional(),
|
|
2719
2725
|
/** Why a `waiting` run parked (ADR 0064): its own turn (`turn`), an automatic-resume hold
|
|
2720
2726
|
* (`hold`), or a session that closed while it held wakes (`closing-wakes`). The exit that parks
|
|
2721
2727
|
* the run writes it (`runs/run-exits.ts`); a run that leaves `waiting` keeps it unread. A row
|
|
2722
2728
|
* saved before the fact has none. */
|
|
2723
|
-
parkReason:
|
|
2724
|
-
createdAt:
|
|
2725
|
-
startedAt:
|
|
2726
|
-
finishedAt:
|
|
2727
|
-
tokensUsed:
|
|
2729
|
+
parkReason: z20.enum(["turn", "hold", "closing-wakes"]).optional(),
|
|
2730
|
+
createdAt: z20.string(),
|
|
2731
|
+
startedAt: z20.string().optional(),
|
|
2732
|
+
finishedAt: z20.string().optional(),
|
|
2733
|
+
tokensUsed: z20.number(),
|
|
2728
2734
|
inputTokens: usageCounterSchema.optional(),
|
|
2729
2735
|
outputTokens: usageCounterSchema.optional(),
|
|
2730
|
-
costUsd:
|
|
2731
|
-
pullRequestUrl:
|
|
2732
|
-
pullRequests:
|
|
2736
|
+
costUsd: z20.number().optional(),
|
|
2737
|
+
pullRequestUrl: z20.string().optional(),
|
|
2738
|
+
pullRequests: z20.array(runPullRequestSchema).optional(),
|
|
2733
2739
|
/** The PR this task is ABOUT (#407) — auto-discovered from conversation references. Display
|
|
2734
2740
|
* tier only: `pullRequestUrl` (the PR this task CREATED) wins, and the action gates ignore it. */
|
|
2735
|
-
referencedPullRequestUrl:
|
|
2741
|
+
referencedPullRequestUrl: z20.string().optional(),
|
|
2736
2742
|
/** The PR/issue number this task is ABOUT (task auto-naming spec) — display tier only. */
|
|
2737
|
-
prNumber:
|
|
2738
|
-
issueNumber:
|
|
2743
|
+
prNumber: z20.number().optional(),
|
|
2744
|
+
issueNumber: z20.number().optional(),
|
|
2739
2745
|
/** Server-side provenance: referenced-issue discovery currently owns `issueNumber`. */
|
|
2740
|
-
referencedIssueNumberSeeded:
|
|
2746
|
+
referencedIssueNumberSeeded: z20.boolean().optional(),
|
|
2741
2747
|
/** 'user' = renamed via PATCH, never auto-overwritten; 'marker' = agent-declared via
|
|
2742
2748
|
* CEZ:TITLE (spec 2026-07-18-task-ref-markers); 'auto' = namer-owned. */
|
|
2743
|
-
titleOrigin:
|
|
2749
|
+
titleOrigin: z20.enum(["user", "auto", "marker"]).optional(),
|
|
2744
2750
|
/** References the agent declared via CEZ:PR/CEZ:ISSUE markers — authoritative over the namer
|
|
2745
2751
|
* for the matching kind. */
|
|
2746
|
-
markerRefs:
|
|
2752
|
+
markerRefs: z20.object({ pr: z20.number().optional(), issue: z20.number().optional() }).optional(),
|
|
2747
2753
|
/** The referenced tier's working set (distinct PR URLs spotted, capped server-side). */
|
|
2748
|
-
referencedPrCandidates:
|
|
2754
|
+
referencedPrCandidates: z20.array(z20.string()).optional(),
|
|
2749
2755
|
/** The issue this task is ABOUT (spec 2026-07-21-report-ref-discovery). Display-only. */
|
|
2750
|
-
referencedIssueUrl:
|
|
2756
|
+
referencedIssueUrl: z20.string().optional(),
|
|
2751
2757
|
/** The referenced-issue working set, persisted like `referencedPrCandidates`. Capped. */
|
|
2752
|
-
referencedIssueCandidates:
|
|
2758
|
+
referencedIssueCandidates: z20.array(z20.string()).optional(),
|
|
2753
2759
|
/** Explicit execution policy. `false` means the run intentionally uses the repo root;
|
|
2754
2760
|
* absent on older runs and for the default isolated-worktree mode. */
|
|
2755
|
-
worktree:
|
|
2761
|
+
worktree: z20.literal(false).optional(),
|
|
2756
2762
|
/** Absent for in-place runs and after an isolated worktree is removed. */
|
|
2757
|
-
worktreePath:
|
|
2758
|
-
branch:
|
|
2763
|
+
worktreePath: z20.string().optional(),
|
|
2764
|
+
branch: z20.string().optional(),
|
|
2759
2765
|
/** Stable baseline for session git views: a worktree's fork ref, or an in-place run's starting commit. */
|
|
2760
|
-
baseBranch:
|
|
2766
|
+
baseBranch: z20.string().optional(),
|
|
2761
2767
|
/** Set when count-based retention (#483) reclaimed the worktree DIRECTORY (the branch is
|
|
2762
2768
|
* kept): the dir is gone but recoverable. */
|
|
2763
|
-
worktreeReclaimedAt:
|
|
2769
|
+
worktreeReclaimedAt: z20.string().optional(),
|
|
2764
2770
|
/** The worktree setup this run's isolated worktree got (#917). Absent when none ran. */
|
|
2765
2771
|
worktreeSetup: runWorktreeSetupSchema.optional(),
|
|
2766
2772
|
/** Historical parallel variants (retired): runs sharing a groupId are one group. */
|
|
2767
|
-
groupId:
|
|
2773
|
+
groupId: z20.string().optional(),
|
|
2768
2774
|
/** Variant letter within the group — 'A' | 'B' | 'C'. */
|
|
2769
|
-
variant:
|
|
2775
|
+
variant: z20.string().optional(),
|
|
2770
2776
|
/** Idempotent start (#504): the caller's request id and the hash of the start payload it
|
|
2771
2777
|
* named (`src/runs/client-request.ts`). Absent on every run started without one. */
|
|
2772
|
-
clientRequestId:
|
|
2773
|
-
clientRequestHash:
|
|
2774
|
-
peakRssBytes:
|
|
2775
|
-
peakProcCount:
|
|
2776
|
-
archived:
|
|
2777
|
-
archivedAt:
|
|
2778
|
+
clientRequestId: z20.string().optional(),
|
|
2779
|
+
clientRequestHash: z20.string().optional(),
|
|
2780
|
+
peakRssBytes: z20.number().optional(),
|
|
2781
|
+
peakProcCount: z20.number().optional(),
|
|
2782
|
+
archived: z20.boolean(),
|
|
2783
|
+
archivedAt: z20.string().optional(),
|
|
2778
2784
|
autoArchive: autoArchiveReceiptSchema.optional(),
|
|
2779
|
-
manualUnarchivedAt:
|
|
2785
|
+
manualUnarchivedAt: z20.string().datetime().optional(),
|
|
2780
2786
|
/** Pinned to the top of this project's task list (#935) — the `Pinned` group above
|
|
2781
2787
|
* `Needs you`. Optional, unlike `archived`: absent IS "not pinned", which is what every
|
|
2782
2788
|
* record written before this carries, and the store never writes `false`. Archiving
|
|
2783
2789
|
* clears it, because archiving is how a user resigns from a task. */
|
|
2784
|
-
pinned:
|
|
2790
|
+
pinned: z20.boolean().optional(),
|
|
2785
2791
|
/** When the pin was set. Deliberately WRITE-ONLY today, like the `archivedAt` above it:
|
|
2786
2792
|
* ordering inside `Pinned` uses the ordinary status/recency rules, so nothing reads this
|
|
2787
2793
|
* yet. It is here because a field on the saved run record is far cheaper to add now than to
|
|
2788
2794
|
* add later — "pinned oldest first" and "unpin what you pinned a month ago" both need it,
|
|
2789
2795
|
* and neither can be reconstructed after the fact. */
|
|
2790
|
-
pinnedAt:
|
|
2796
|
+
pinnedAt: z20.string().optional(),
|
|
2791
2797
|
/** Read receipt (#unread-done-items): ISO time the cockpit last opened this run's
|
|
2792
2798
|
* thread. A finished (`done`/`failed`) run reads as *unread* until seen since it
|
|
2793
2799
|
* finished — see `isUnread()` in the cockpit's `lib/read-state.ts`. Absent on old
|
|
2794
2800
|
* runs, on any run not yet opened, and on one deliberately put back to unread via
|
|
2795
2801
|
* `POST /runs/:id/unread` (#775) — all three count as unread. */
|
|
2796
|
-
seenAt:
|
|
2797
|
-
currentStepId:
|
|
2798
|
-
error:
|
|
2799
|
-
steps:
|
|
2802
|
+
seenAt: z20.string().optional(),
|
|
2803
|
+
currentStepId: z20.string().optional(),
|
|
2804
|
+
error: z20.string().optional(),
|
|
2805
|
+
steps: z20.array(stepStateSchema),
|
|
2800
2806
|
/**
|
|
2801
2807
|
* The persisted workflow definition, so a `queued` run survives a restart — including the ad-hoc
|
|
2802
2808
|
* "(planned)" chains that exist nowhere else.
|
|
@@ -2816,17 +2822,17 @@ var runRecordSchema = z19.object({
|
|
|
2816
2822
|
var apiRunSchema = runRecordSchema.extend({
|
|
2817
2823
|
/** Read-only GET /runs/:id verdict: null permits Finish, a string explains refusal.
|
|
2818
2824
|
* Absent on lists, stored records and mutation responses; absence is not permission. */
|
|
2819
|
-
finishBlocked:
|
|
2825
|
+
finishBlocked: z20.string().nullable().optional(),
|
|
2820
2826
|
/** The server's take-over command for the run's latest session, with the executable the server
|
|
2821
2827
|
* resolves. Absent without a session or for an id the server refuses. Never persisted. */
|
|
2822
|
-
cliResumeCommand:
|
|
2828
|
+
cliResumeCommand: z20.string().optional(),
|
|
2823
2829
|
usage: processUsageSchema.optional()
|
|
2824
2830
|
});
|
|
2825
|
-
var runSummarySchema =
|
|
2826
|
-
id:
|
|
2827
|
-
title:
|
|
2828
|
-
titleSummary:
|
|
2829
|
-
titleOrigin:
|
|
2831
|
+
var runSummarySchema = z20.object({
|
|
2832
|
+
id: z20.string(),
|
|
2833
|
+
title: z20.string(),
|
|
2834
|
+
titleSummary: z20.string().optional(),
|
|
2835
|
+
titleOrigin: z20.enum(["user", "auto", "marker"]).optional(),
|
|
2830
2836
|
status: runStatusSchema,
|
|
2831
2837
|
hasPendingPermission: runRecordSchema.shape.hasPendingPermission,
|
|
2832
2838
|
/** The run's top open wait (`computeWaitingOn`), which `deriveAttention` reads. The wait list
|
|
@@ -2834,35 +2840,35 @@ var runSummarySchema = z19.object({
|
|
|
2834
2840
|
waitingOn: waitingOnSchema.optional(),
|
|
2835
2841
|
/** Present when a wait has resolved and its wake turn has not started (`hasResolvedWait`):
|
|
2836
2842
|
* attention's "waiting for capacity" rung. */
|
|
2837
|
-
waitWakePending:
|
|
2843
|
+
waitWakePending: z20.literal(true).optional(),
|
|
2838
2844
|
/** Only the relationship role and wait phase used by list attention. */
|
|
2839
2845
|
delegation: runDelegationSummarySchema.optional(),
|
|
2840
|
-
createdAt:
|
|
2841
|
-
finishedAt:
|
|
2846
|
+
createdAt: z20.string(),
|
|
2847
|
+
finishedAt: z20.string().optional(),
|
|
2842
2848
|
/** With `status`/`finishedAt`/`archived`, the four inputs `isUnread` reads — what lets the
|
|
2843
2849
|
* palette lead with "finished while you weren't looking" across every project, not just the
|
|
2844
2850
|
* one you happen to be standing in. */
|
|
2845
|
-
seenAt:
|
|
2851
|
+
seenAt: z20.string().optional(),
|
|
2846
2852
|
/** Always present, like `RunRecord.archived`: absent would read as "not archived", and the
|
|
2847
2853
|
* unread rule treats archiving as a stronger "done with this" than reading. */
|
|
2848
|
-
archived:
|
|
2854
|
+
archived: z20.boolean(),
|
|
2849
2855
|
/** A run parked by a provider usage limit is `failed` on the record with a resume booked
|
|
2850
2856
|
* (spec 2026-08-03-auto-resume-after-usage-limit). Both `deriveAttention` and `isUnread` read
|
|
2851
2857
|
* it, so without it here a cross-project row would show a red "failed" dot and land in
|
|
2852
2858
|
* Recently finished for work that is simply waiting for its appointment. */
|
|
2853
|
-
autoResumeAt:
|
|
2859
|
+
autoResumeAt: z20.string().optional(),
|
|
2854
2860
|
/** Which hold it is (hearsay-tools/squawk#3337): the row names a provider error instead of a usage limit. */
|
|
2855
2861
|
autoResumeReason: runRecordSchema.shape.autoResumeReason,
|
|
2856
2862
|
/** The workflow the run executes — the global Tasks page shows it in a column and groups by
|
|
2857
2863
|
* it. Always present on the record (`RunRecord.workflow`), so required here. The display
|
|
2858
2864
|
* name, which reads a `(planned)` chain as its first agent's name, is `workflowLabel` below. */
|
|
2859
|
-
workflow:
|
|
2865
|
+
workflow: z20.string(),
|
|
2860
2866
|
/** The task's branch, when it has one — a column on the global page, and the one field that
|
|
2861
2867
|
* makes a cross-project row identifiable at a glance without opening it. */
|
|
2862
|
-
branch:
|
|
2868
|
+
branch: z20.string().optional(),
|
|
2863
2869
|
/** When the agent actually started, as opposed to when the task was created. The global page's
|
|
2864
2870
|
* age column prefers it and falls back to `createdAt`, exactly as the per-project table does. */
|
|
2865
|
-
startedAt:
|
|
2871
|
+
startedAt: z20.string().optional(),
|
|
2866
2872
|
/**
|
|
2867
2873
|
* The six fields `taskReference()` (`web/src/lib/tasks-table.ts`) reads to decide a task's PR
|
|
2868
2874
|
* or issue chip. Carried verbatim rather than pre-resolved into a `{kind, number, url}` on the
|
|
@@ -2874,21 +2880,21 @@ var runSummarySchema = z19.object({
|
|
|
2874
2880
|
* Six scalars is still the slim row this schema exists to keep: `steps[]` and `workflowDef`,
|
|
2875
2881
|
* the expensive half, stay off it.
|
|
2876
2882
|
*/
|
|
2877
|
-
pullRequestUrl:
|
|
2878
|
-
pullRequests:
|
|
2879
|
-
referencedPullRequestUrl:
|
|
2880
|
-
prNumber:
|
|
2881
|
-
issueNumber:
|
|
2882
|
-
referencedIssueUrl:
|
|
2883
|
-
markerRefs:
|
|
2883
|
+
pullRequestUrl: z20.string().optional(),
|
|
2884
|
+
pullRequests: z20.array(runPullRequestSchema).optional(),
|
|
2885
|
+
referencedPullRequestUrl: z20.string().optional(),
|
|
2886
|
+
prNumber: z20.number().optional(),
|
|
2887
|
+
issueNumber: z20.number().optional(),
|
|
2888
|
+
referencedIssueUrl: z20.string().optional(),
|
|
2889
|
+
markerRefs: z20.object({ pr: z20.number().optional(), issue: z20.number().optional() }).optional(),
|
|
2884
2890
|
/** What the run has cost so far. Absent means nothing was recorded, which is NOT `$0` — the
|
|
2885
2891
|
* cockpit prints an em dash rather than claiming a measurement that never happened. */
|
|
2886
|
-
costUsd:
|
|
2892
|
+
costUsd: z20.number().optional(),
|
|
2887
2893
|
/** The persisted high-water marks a FINISHED run leaves behind. `usage` below stops existing
|
|
2888
2894
|
* the moment the process tree does, so without these a finished row could say nothing at all
|
|
2889
2895
|
* about what it took to run. */
|
|
2890
|
-
peakRssBytes:
|
|
2891
|
-
peakProcCount:
|
|
2896
|
+
peakRssBytes: z20.number().optional(),
|
|
2897
|
+
peakProcCount: z20.number().optional(),
|
|
2892
2898
|
/**
|
|
2893
2899
|
* The live CPU/RSS sample of this run's process tree, attached on the way out exactly as
|
|
2894
2900
|
* `GET /runs` attaches it (`withUsage`) — never persisted.
|
|
@@ -2902,34 +2908,34 @@ var runSummarySchema = z19.object({
|
|
|
2902
2908
|
/** The Workflow column's text (#817): for a `(planned)` or `(inbox)` chain, its first agent
|
|
2903
2909
|
* step's name when it has one, otherwise `workflow`. Derived here because it is the one thing
|
|
2904
2910
|
* a list row ever read off `steps[]`. */
|
|
2905
|
-
workflowLabel:
|
|
2911
|
+
workflowLabel: z20.string(),
|
|
2906
2912
|
/** Historical variant group membership (spec 010, retired): the list shows each run as its own row. */
|
|
2907
|
-
groupId:
|
|
2908
|
-
variant:
|
|
2909
|
-
pinned:
|
|
2913
|
+
groupId: z20.string().optional(),
|
|
2914
|
+
variant: z20.string().optional(),
|
|
2915
|
+
pinned: z20.boolean().optional(),
|
|
2910
2916
|
/** The automation that launched this task (hearsay-tools/cezarion#1332), from `automation`
|
|
2911
2917
|
* (GitHub-triggered) or `automationTrigger` (scheduled, catch-up or Run now). Absent on every
|
|
2912
2918
|
* task no automation launched; the sidebar files the task under Automations when present. */
|
|
2913
|
-
automationId:
|
|
2919
|
+
automationId: z20.string().optional(),
|
|
2914
2920
|
runner: runRecordSchema.shape.runner,
|
|
2915
2921
|
removedRunner: runRecordSchema.shape.removedRunner,
|
|
2916
|
-
model:
|
|
2917
|
-
notify:
|
|
2922
|
+
model: z20.string().optional(),
|
|
2923
|
+
notify: z20.boolean().optional(),
|
|
2918
2924
|
diffStat: diffStatSchema.optional(),
|
|
2919
|
-
tokensUsed:
|
|
2925
|
+
tokensUsed: z20.number(),
|
|
2920
2926
|
inputTokens: runRecordSchema.shape.inputTokens,
|
|
2921
2927
|
outputTokens: runRecordSchema.shape.outputTokens,
|
|
2922
|
-
currentStepId:
|
|
2928
|
+
currentStepId: z20.string().optional(),
|
|
2923
2929
|
/** The backend of the step `currentStepId` names, when it recorded one — the conversation view
|
|
2924
2930
|
* labels a delegated peer by the agent actually running it, which can differ from `runner`. */
|
|
2925
2931
|
currentStepBackend: runnerSchema.optional(),
|
|
2926
|
-
error:
|
|
2932
|
+
error: z20.string().optional(),
|
|
2927
2933
|
/** Present while the run's isolated worktree exists — the breadcrumb says "Isolated worktree". */
|
|
2928
|
-
worktreePath:
|
|
2934
|
+
worktreePath: z20.string().optional()
|
|
2929
2935
|
});
|
|
2930
2936
|
var runIndexEntrySchema = runSummarySchema.extend({
|
|
2931
2937
|
/** The registered project this run belongs to. Joins against `GET /projects`. */
|
|
2932
|
-
projectId:
|
|
2938
|
+
projectId: z20.string()
|
|
2933
2939
|
});
|
|
2934
2940
|
var SUMMARY_OPTIONAL_KEYS = [
|
|
2935
2941
|
"titleSummary",
|
|
@@ -2999,159 +3005,159 @@ function automationIdOf(run) {
|
|
|
2999
3005
|
function isAutomationTask(run) {
|
|
3000
3006
|
return run.automationId !== void 0;
|
|
3001
3007
|
}
|
|
3002
|
-
var referenceStatusesByProjectSchema =
|
|
3003
|
-
prs:
|
|
3004
|
-
issues:
|
|
3008
|
+
var referenceStatusesByProjectSchema = z20.record(z20.string(), z20.object({
|
|
3009
|
+
prs: z20.record(z20.number(), referenceStatusSchema),
|
|
3010
|
+
issues: z20.record(z20.number(), referenceStatusSchema)
|
|
3005
3011
|
}));
|
|
3006
|
-
var runSummariesQuerySchema =
|
|
3007
|
-
archived:
|
|
3012
|
+
var runSummariesQuerySchema = z20.object({
|
|
3013
|
+
archived: z20.enum(["recent", "all"]).optional()
|
|
3008
3014
|
});
|
|
3009
|
-
var archivedRunsQuerySchema =
|
|
3015
|
+
var archivedRunsQuerySchema = z20.object({
|
|
3010
3016
|
/** `nextCursor` from the previous page. Opaque: a malformed one answers 400. */
|
|
3011
|
-
before:
|
|
3012
|
-
limit:
|
|
3017
|
+
before: z20.string().optional(),
|
|
3018
|
+
limit: z20.coerce.number().int().min(1).max(ARCHIVED_RUNS_PAGE_MAX).optional(),
|
|
3013
3019
|
/** Only runs that match (`matchesRunSearch`): title, id, branch, workflow, PR or issue. */
|
|
3014
|
-
q:
|
|
3020
|
+
q: z20.string().optional()
|
|
3015
3021
|
});
|
|
3016
|
-
var archivedRunsResponseSchema =
|
|
3017
|
-
runs:
|
|
3022
|
+
var archivedRunsResponseSchema = z20.object({
|
|
3023
|
+
runs: z20.array(runSummarySchema),
|
|
3018
3024
|
/** The `before` of the next page, or null on the last one. */
|
|
3019
|
-
nextCursor:
|
|
3025
|
+
nextCursor: z20.string().nullable(),
|
|
3020
3026
|
/** How many archived root runs match, across every page. */
|
|
3021
|
-
total:
|
|
3027
|
+
total: z20.number().int().nonnegative()
|
|
3022
3028
|
});
|
|
3023
3029
|
var RUNS_SEARCH_PER_PROJECT_MAX = 50;
|
|
3024
|
-
var runsSearchQuerySchema =
|
|
3030
|
+
var runsSearchQuerySchema = z20.object({
|
|
3025
3031
|
/** Every whitespace-separated token must match (`matchesRunSearch`). At least two characters:
|
|
3026
3032
|
* one matches nearly every run. */
|
|
3027
|
-
q:
|
|
3028
|
-
limit:
|
|
3033
|
+
q: z20.string().trim().min(2),
|
|
3034
|
+
limit: z20.coerce.number().int().min(1).max(RUNS_SEARCH_PER_PROJECT_MAX).optional()
|
|
3029
3035
|
});
|
|
3030
|
-
var runsSearchResponseSchema =
|
|
3036
|
+
var runsSearchResponseSchema = z20.object({
|
|
3031
3037
|
/** Root runs, archived or not, newest first across every registered project. */
|
|
3032
|
-
runs:
|
|
3038
|
+
runs: z20.array(runIndexEntrySchema),
|
|
3033
3039
|
/** Ids of the projects that had more matches than `limit`. */
|
|
3034
|
-
truncated:
|
|
3040
|
+
truncated: z20.array(z20.string())
|
|
3035
3041
|
});
|
|
3036
3042
|
var createRunResponseSchema = runRecordSchema;
|
|
3037
|
-
var cancelResponseSchema =
|
|
3038
|
-
var cancelAutoResumeResponseSchema =
|
|
3039
|
-
var archiveFinishedScopeSchema =
|
|
3040
|
-
var archiveFinishedRequestSchema =
|
|
3043
|
+
var cancelResponseSchema = z20.object({ cancelled: z20.boolean() });
|
|
3044
|
+
var cancelAutoResumeResponseSchema = z20.object({ cancelled: z20.literal(true) });
|
|
3045
|
+
var archiveFinishedScopeSchema = z20.enum(["unpinned", "pinned"]);
|
|
3046
|
+
var archiveFinishedRequestSchema = z20.object({
|
|
3041
3047
|
scope: archiveFinishedScopeSchema.optional(),
|
|
3042
|
-
automation:
|
|
3043
|
-
});
|
|
3044
|
-
var archiveFinishedResponseSchema =
|
|
3045
|
-
archived:
|
|
3046
|
-
ids:
|
|
3047
|
-
pinnedIds:
|
|
3048
|
-
});
|
|
3049
|
-
var markAllReadRequestSchema =
|
|
3050
|
-
var markAllReadResponseSchema =
|
|
3051
|
-
var deleteRunResponseSchema =
|
|
3052
|
-
var finishResponseSchema =
|
|
3053
|
-
var continueResponseSchema =
|
|
3054
|
-
var createPrResponseSchema =
|
|
3055
|
-
url:
|
|
3056
|
-
dryRun:
|
|
3057
|
-
});
|
|
3058
|
-
var messageResponseSchema =
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3048
|
+
automation: z20.boolean().optional()
|
|
3049
|
+
});
|
|
3050
|
+
var archiveFinishedResponseSchema = z20.object({
|
|
3051
|
+
archived: z20.number(),
|
|
3052
|
+
ids: z20.array(z20.string()),
|
|
3053
|
+
pinnedIds: z20.array(z20.string())
|
|
3054
|
+
});
|
|
3055
|
+
var markAllReadRequestSchema = z20.object({ automation: z20.boolean().optional() });
|
|
3056
|
+
var markAllReadResponseSchema = z20.object({ read: z20.number() });
|
|
3057
|
+
var deleteRunResponseSchema = z20.object({ deleted: z20.literal(true) });
|
|
3058
|
+
var finishResponseSchema = z20.object({ finished: z20.literal(true) });
|
|
3059
|
+
var continueResponseSchema = z20.object({ continued: z20.literal(true) });
|
|
3060
|
+
var createPrResponseSchema = z20.object({
|
|
3061
|
+
url: z20.string(),
|
|
3062
|
+
dryRun: z20.boolean()
|
|
3063
|
+
});
|
|
3064
|
+
var messageResponseSchema = z20.union([
|
|
3065
|
+
z20.object({ delivered: z20.literal(true) }),
|
|
3066
|
+
z20.object({ queued: z20.literal(true), message: queuedMessageSchema }),
|
|
3067
|
+
z20.object({ deferred: z20.literal(true) })
|
|
3062
3068
|
]);
|
|
3063
|
-
var editQueuedMessageResponseSchema =
|
|
3064
|
-
var removeQueuedMessageResponseSchema =
|
|
3065
|
-
var openInCliResponseSchema =
|
|
3066
|
-
opened:
|
|
3067
|
-
command:
|
|
3068
|
-
});
|
|
3069
|
-
var removeWorktreeResponseSchema =
|
|
3070
|
-
var gitCommitResponseSchema =
|
|
3071
|
-
committed:
|
|
3072
|
-
sha:
|
|
3073
|
-
});
|
|
3074
|
-
var gitPushResponseSchema =
|
|
3075
|
-
pushed:
|
|
3076
|
-
branch:
|
|
3077
|
-
remote:
|
|
3078
|
-
upstreamSet:
|
|
3079
|
-
});
|
|
3080
|
-
var runCommitSchema =
|
|
3081
|
-
sha:
|
|
3082
|
-
subject:
|
|
3083
|
-
author:
|
|
3069
|
+
var editQueuedMessageResponseSchema = z20.object({ message: queuedMessageSchema });
|
|
3070
|
+
var removeQueuedMessageResponseSchema = z20.object({ removed: z20.literal(true) });
|
|
3071
|
+
var openInCliResponseSchema = z20.object({
|
|
3072
|
+
opened: z20.literal(true),
|
|
3073
|
+
command: z20.string()
|
|
3074
|
+
});
|
|
3075
|
+
var removeWorktreeResponseSchema = z20.object({ removed: z20.literal(true) });
|
|
3076
|
+
var gitCommitResponseSchema = z20.object({
|
|
3077
|
+
committed: z20.literal(true),
|
|
3078
|
+
sha: z20.string()
|
|
3079
|
+
});
|
|
3080
|
+
var gitPushResponseSchema = z20.object({
|
|
3081
|
+
pushed: z20.literal(true),
|
|
3082
|
+
branch: z20.string(),
|
|
3083
|
+
remote: z20.string(),
|
|
3084
|
+
upstreamSet: z20.boolean()
|
|
3085
|
+
});
|
|
3086
|
+
var runCommitSchema = z20.object({
|
|
3087
|
+
sha: z20.string(),
|
|
3088
|
+
subject: z20.string(),
|
|
3089
|
+
author: z20.string(),
|
|
3084
3090
|
/** Relative time ("3 hours ago") — git's `%cr`. */
|
|
3085
|
-
when:
|
|
3091
|
+
when: z20.string()
|
|
3086
3092
|
});
|
|
3087
|
-
var runCommitsResponseSchema =
|
|
3088
|
-
var attachmentFileParamSchema =
|
|
3089
|
-
id:
|
|
3090
|
-
file:
|
|
3093
|
+
var runCommitsResponseSchema = z20.object({ commits: z20.array(runCommitSchema) });
|
|
3094
|
+
var attachmentFileParamSchema = z20.object({
|
|
3095
|
+
id: z20.string().min(1),
|
|
3096
|
+
file: z20.string().regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine((name) => !name.includes(".."))
|
|
3091
3097
|
});
|
|
3092
|
-
var attachmentInputSchema =
|
|
3093
|
-
mediaType:
|
|
3098
|
+
var attachmentInputSchema = z20.object({
|
|
3099
|
+
mediaType: z20.string().refine(isAttachmentMediaType, {
|
|
3094
3100
|
message: "unsupported attachment type \u2014 images, plain text, markdown and PDF only"
|
|
3095
3101
|
}),
|
|
3096
|
-
data:
|
|
3102
|
+
data: z20.string().min(1).max(7e6)
|
|
3097
3103
|
});
|
|
3098
3104
|
var imageInputSchema = attachmentInputSchema;
|
|
3099
|
-
var createRunInputBaseSchema =
|
|
3100
|
-
workflow:
|
|
3105
|
+
var createRunInputBaseSchema = z20.object({
|
|
3106
|
+
workflow: z20.string().min(1).optional(),
|
|
3101
3107
|
/** An inline chain (spec 008 — an approved plan runs as an ad-hoc workflow, never written to
|
|
3102
3108
|
* a file). The catalog's own step shape, not a copy of it. */
|
|
3103
|
-
steps:
|
|
3104
|
-
task:
|
|
3105
|
-
model:
|
|
3109
|
+
steps: z20.array(workflowStepDefSchema).min(1).max(8).optional(),
|
|
3110
|
+
task: z20.string().min(1).max(1e5, "must be at most 100000 characters"),
|
|
3111
|
+
model: z20.string().optional(),
|
|
3106
3112
|
/** Reasoning-effort pin (#45). Omit for the harness default; empty/`auto` stay implicit. */
|
|
3107
|
-
effort:
|
|
3113
|
+
effort: z20.string().max(32).optional(),
|
|
3108
3114
|
runner: runnerSchema.optional(),
|
|
3109
3115
|
/** Agent account for this task (spec 2026-07-29-agent-profiles). Omit to follow the
|
|
3110
3116
|
* project's own selection; an id that no longer exists is a 400, not a silent default. */
|
|
3111
|
-
agentProfile:
|
|
3117
|
+
agentProfile: z20.string().max(64).optional(),
|
|
3112
3118
|
/** false → run in the repo working tree instead of an isolated worktree (read-only skills).
|
|
3113
3119
|
* Omit for the default. */
|
|
3114
|
-
worktree:
|
|
3120
|
+
worktree: z20.boolean().optional(),
|
|
3115
3121
|
/** true → autonomous run: never parks at "waiting"; auto-continues until done. */
|
|
3116
|
-
autonomous:
|
|
3122
|
+
autonomous: z20.boolean().optional(),
|
|
3117
3123
|
...completionControlsShape,
|
|
3118
3124
|
...taskAccessShape,
|
|
3119
3125
|
/** Per-run system-prompt override. Wins over the config default; whitespace-only is absent. */
|
|
3120
|
-
systemPrompt:
|
|
3126
|
+
systemPrompt: z20.string().trim().max(2e4, "must be at most 20000 characters").optional().transform((s) => s ? s : void 0),
|
|
3121
3127
|
/** Attachments pasted into the new-task form — screenshots, and since #950 PDF/TXT/MD files
|
|
3122
3128
|
* too; delivered with the first agent step. The key keeps its name: the wire contract widened
|
|
3123
3129
|
* in place rather than growing a second list. */
|
|
3124
|
-
images:
|
|
3130
|
+
images: z20.array(attachmentInputSchema).max(4).optional()
|
|
3125
3131
|
});
|
|
3126
3132
|
var createRunInputSchema = createRunInputBaseSchema.extend({
|
|
3127
|
-
steps:
|
|
3133
|
+
steps: z20.array(workflowStepDefSchema.safeExtend({ skillPath: z20.string().min(1).optional() })).min(1).max(8).optional(),
|
|
3128
3134
|
/** Idempotent start (#504): a retry with the same id and payload answers `200` with the run
|
|
3129
3135
|
* the first request created; a different payload answers `409`. Scoped to the project. Not
|
|
3130
3136
|
* on the base schema, so an automation's task definition cannot carry one. */
|
|
3131
|
-
clientRequestId:
|
|
3137
|
+
clientRequestId: z20.string().uuid().optional(),
|
|
3132
3138
|
/** Task webhook opt-in (#589). Absent = off. `true` on a project with no webhook is a 400.
|
|
3133
3139
|
* Not on the base schema, and not part of the idempotent-start hash: it can change later. */
|
|
3134
|
-
notify:
|
|
3140
|
+
notify: z20.boolean().optional()
|
|
3135
3141
|
}).refine(
|
|
3136
3142
|
(b) => Boolean(b.workflow) !== Boolean(b.steps),
|
|
3137
3143
|
{ message: 'provide either "workflow" or "steps", not both' }
|
|
3138
3144
|
);
|
|
3139
|
-
var messageInputSchema =
|
|
3140
|
-
text:
|
|
3141
|
-
images:
|
|
3145
|
+
var messageInputSchema = z20.object({
|
|
3146
|
+
text: z20.string().max(1e5).default(""),
|
|
3147
|
+
images: z20.array(attachmentInputSchema).max(4).default([])
|
|
3142
3148
|
}).refine((m) => m.text.trim().length > 0 || m.images.length > 0, {
|
|
3143
3149
|
message: "message needs text or at least one attachment"
|
|
3144
3150
|
});
|
|
3145
|
-
var patchRunInputSchema =
|
|
3146
|
-
title:
|
|
3147
|
-
task:
|
|
3151
|
+
var patchRunInputSchema = z20.object({
|
|
3152
|
+
title: z20.string().trim().min(1).max(300).optional(),
|
|
3153
|
+
task: z20.string().trim().min(1).max(1e5).optional(),
|
|
3148
3154
|
...completionControlsShape,
|
|
3149
3155
|
...taskAccessShape
|
|
3150
3156
|
});
|
|
3151
|
-
var pinRunInputSchema =
|
|
3152
|
-
var notifyRunInputSchema =
|
|
3153
|
-
notify:
|
|
3154
|
-
message:
|
|
3157
|
+
var pinRunInputSchema = z20.object({ pinned: z20.boolean().optional() });
|
|
3158
|
+
var notifyRunInputSchema = z20.object({
|
|
3159
|
+
notify: z20.boolean(),
|
|
3160
|
+
message: z20.string().trim().max(1e5).optional().transform((text) => text ? text : void 0)
|
|
3155
3161
|
});
|
|
3156
3162
|
|
|
3157
3163
|
// ../contract/src/attention.ts
|
|
@@ -3339,192 +3345,192 @@ function deriveWebhookState(run) {
|
|
|
3339
3345
|
}
|
|
3340
3346
|
|
|
3341
3347
|
// ../contract/src/repo.ts
|
|
3342
|
-
import { z as
|
|
3343
|
-
var statusEntrySchema =
|
|
3344
|
-
status:
|
|
3345
|
-
path:
|
|
3346
|
-
});
|
|
3347
|
-
var logEntrySourceSchema =
|
|
3348
|
-
runId:
|
|
3349
|
-
title:
|
|
3350
|
-
prNumber:
|
|
3351
|
-
});
|
|
3352
|
-
var logEntrySchema =
|
|
3353
|
-
hash:
|
|
3354
|
-
subject:
|
|
3355
|
-
author:
|
|
3356
|
-
when:
|
|
3357
|
-
at:
|
|
3348
|
+
import { z as z21 } from "zod";
|
|
3349
|
+
var statusEntrySchema = z21.object({
|
|
3350
|
+
status: z21.string(),
|
|
3351
|
+
path: z21.string()
|
|
3352
|
+
});
|
|
3353
|
+
var logEntrySourceSchema = z21.object({
|
|
3354
|
+
runId: z21.string(),
|
|
3355
|
+
title: z21.string(),
|
|
3356
|
+
prNumber: z21.number().nullable()
|
|
3357
|
+
});
|
|
3358
|
+
var logEntrySchema = z21.object({
|
|
3359
|
+
hash: z21.string(),
|
|
3360
|
+
subject: z21.string(),
|
|
3361
|
+
author: z21.string(),
|
|
3362
|
+
when: z21.string(),
|
|
3363
|
+
at: z21.string(),
|
|
3358
3364
|
source: logEntrySourceSchema.optional()
|
|
3359
3365
|
});
|
|
3360
|
-
var repoTrackingSchema =
|
|
3361
|
-
ref:
|
|
3362
|
-
ahead:
|
|
3363
|
-
behind:
|
|
3364
|
-
fetchedAt:
|
|
3365
|
-
});
|
|
3366
|
-
var repoResponseSchema =
|
|
3367
|
-
|
|
3368
|
-
info:
|
|
3369
|
-
status:
|
|
3370
|
-
log:
|
|
3371
|
-
branches:
|
|
3372
|
-
baseBranch:
|
|
3373
|
-
tracking:
|
|
3366
|
+
var repoTrackingSchema = z21.object({
|
|
3367
|
+
ref: z21.string(),
|
|
3368
|
+
ahead: z21.number(),
|
|
3369
|
+
behind: z21.number(),
|
|
3370
|
+
fetchedAt: z21.string().nullable()
|
|
3371
|
+
});
|
|
3372
|
+
var repoResponseSchema = z21.union([
|
|
3373
|
+
z21.object({
|
|
3374
|
+
info: z21.null(),
|
|
3375
|
+
status: z21.array(z21.never()),
|
|
3376
|
+
log: z21.array(z21.never()),
|
|
3377
|
+
branches: z21.array(z21.never()),
|
|
3378
|
+
baseBranch: z21.null(),
|
|
3379
|
+
tracking: z21.null()
|
|
3374
3380
|
}),
|
|
3375
|
-
|
|
3381
|
+
z21.object({
|
|
3376
3382
|
info: repoInfoSchema,
|
|
3377
|
-
status:
|
|
3378
|
-
log:
|
|
3379
|
-
branches:
|
|
3380
|
-
baseBranch:
|
|
3383
|
+
status: z21.array(statusEntrySchema),
|
|
3384
|
+
log: z21.array(logEntrySchema),
|
|
3385
|
+
branches: z21.array(z21.string()),
|
|
3386
|
+
baseBranch: z21.string().nullable(),
|
|
3381
3387
|
tracking: repoTrackingSchema.nullable()
|
|
3382
3388
|
})
|
|
3383
3389
|
]);
|
|
3384
|
-
var repoBranchResponseSchema =
|
|
3385
|
-
branch:
|
|
3386
|
-
created:
|
|
3390
|
+
var repoBranchResponseSchema = z21.object({
|
|
3391
|
+
branch: z21.string(),
|
|
3392
|
+
created: z21.boolean()
|
|
3387
3393
|
});
|
|
3388
|
-
var branchClassSchema =
|
|
3389
|
-
var branchPrStateSchema =
|
|
3390
|
-
var repoBranchEntrySchema =
|
|
3391
|
-
name:
|
|
3394
|
+
var branchClassSchema = z21.enum(["active", "not-landed", "orphan", "merged", "empty", "other"]);
|
|
3395
|
+
var branchPrStateSchema = z21.enum(["open", "draft", "merged", "closed"]);
|
|
3396
|
+
var repoBranchEntrySchema = z21.object({
|
|
3397
|
+
name: z21.string(),
|
|
3392
3398
|
class: branchClassSchema,
|
|
3393
|
-
runId:
|
|
3394
|
-
title:
|
|
3399
|
+
runId: z21.string().nullable(),
|
|
3400
|
+
title: z21.string().nullable(),
|
|
3395
3401
|
runStatus: runStatusSchema.nullable(),
|
|
3396
3402
|
/** Commits on the branch that are not reachable from the base. */
|
|
3397
|
-
ahead:
|
|
3398
|
-
lastCommit:
|
|
3403
|
+
ahead: z21.number(),
|
|
3404
|
+
lastCommit: z21.object({ sha: z21.string(), subject: z21.string(), at: z21.string() }),
|
|
3399
3405
|
/** `--shortstat <base>...<branch>`, for `not-landed` and `orphan` rows only. */
|
|
3400
|
-
diffStat:
|
|
3401
|
-
pr:
|
|
3406
|
+
diffStat: z21.object({ additions: z21.number(), deletions: z21.number() }).nullable(),
|
|
3407
|
+
pr: z21.object({ number: z21.number(), url: z21.string(), state: branchPrStateSchema }).nullable(),
|
|
3402
3408
|
/** Why a branch that might be merged is kept: present only when GitHub did not return its full
|
|
3403
3409
|
* PR history, so no merged PR could be ruled in. */
|
|
3404
|
-
keptReason:
|
|
3410
|
+
keptReason: z21.string().optional(),
|
|
3405
3411
|
/** The parent task of a worker's branch (hearsay-tools/squawk#911). Absent for any other run. */
|
|
3406
|
-
parentRunId:
|
|
3407
|
-
});
|
|
3408
|
-
var repoBranchesResponseSchema =
|
|
3409
|
-
base:
|
|
3410
|
-
prStateKnown:
|
|
3411
|
-
branches:
|
|
3412
|
-
counts:
|
|
3413
|
-
});
|
|
3414
|
-
var repoBranchCountsResponseSchema = repoBranchesResponseSchema.pick({ base: true, prStateKnown: true, counts: true }).extend({ allBranches:
|
|
3415
|
-
var deleteBranchesInputSchema =
|
|
3416
|
-
names:
|
|
3417
|
-
confirm:
|
|
3418
|
-
});
|
|
3419
|
-
var branchRefusalSchema =
|
|
3420
|
-
var deleteBranchesResponseSchema =
|
|
3421
|
-
deleted:
|
|
3422
|
-
refused:
|
|
3423
|
-
dropped:
|
|
3424
|
-
});
|
|
3425
|
-
var deleteBranchesErrorSchema =
|
|
3426
|
-
error:
|
|
3427
|
-
refused:
|
|
3428
|
-
});
|
|
3429
|
-
var repoPullBranchesResponseSchema =
|
|
3430
|
-
var repoPullInputSchema =
|
|
3431
|
-
branch:
|
|
3432
|
-
confirm:
|
|
3433
|
-
});
|
|
3434
|
-
var repoPullResponseSchema =
|
|
3435
|
-
branch:
|
|
3436
|
-
pulled:
|
|
3437
|
-
summary:
|
|
3438
|
-
});
|
|
3439
|
-
var repoPullConfirmationSchema =
|
|
3440
|
-
error:
|
|
3441
|
-
branch:
|
|
3442
|
-
risks:
|
|
3443
|
-
});
|
|
3444
|
-
var repoPullErrorSchema =
|
|
3412
|
+
parentRunId: z21.string().optional()
|
|
3413
|
+
});
|
|
3414
|
+
var repoBranchesResponseSchema = z21.object({
|
|
3415
|
+
base: z21.string(),
|
|
3416
|
+
prStateKnown: z21.boolean(),
|
|
3417
|
+
branches: z21.array(repoBranchEntrySchema),
|
|
3418
|
+
counts: z21.object({ notLanded: z21.number(), cleanup: z21.number() })
|
|
3419
|
+
});
|
|
3420
|
+
var repoBranchCountsResponseSchema = repoBranchesResponseSchema.pick({ base: true, prStateKnown: true, counts: true }).extend({ allBranches: z21.number() });
|
|
3421
|
+
var deleteBranchesInputSchema = z21.object({
|
|
3422
|
+
names: z21.array(z21.string().trim().min(1).max(250)).min(1).max(500),
|
|
3423
|
+
confirm: z21.string().optional()
|
|
3424
|
+
});
|
|
3425
|
+
var branchRefusalSchema = z21.object({ name: z21.string(), reason: z21.string() });
|
|
3426
|
+
var deleteBranchesResponseSchema = z21.object({
|
|
3427
|
+
deleted: z21.array(z21.string()),
|
|
3428
|
+
refused: z21.array(branchRefusalSchema),
|
|
3429
|
+
dropped: z21.array(z21.object({ sha: z21.string(), subject: z21.string() })).optional()
|
|
3430
|
+
});
|
|
3431
|
+
var deleteBranchesErrorSchema = z21.object({
|
|
3432
|
+
error: z21.string(),
|
|
3433
|
+
refused: z21.array(branchRefusalSchema)
|
|
3434
|
+
});
|
|
3435
|
+
var repoPullBranchesResponseSchema = z21.object({ branches: z21.array(z21.string()) });
|
|
3436
|
+
var repoPullInputSchema = z21.object({
|
|
3437
|
+
branch: z21.string().trim().min(1).max(200).optional(),
|
|
3438
|
+
confirm: z21.boolean().optional()
|
|
3439
|
+
});
|
|
3440
|
+
var repoPullResponseSchema = z21.object({
|
|
3441
|
+
branch: z21.string(),
|
|
3442
|
+
pulled: z21.literal(true),
|
|
3443
|
+
summary: z21.string()
|
|
3444
|
+
});
|
|
3445
|
+
var repoPullConfirmationSchema = z21.object({
|
|
3446
|
+
error: z21.string(),
|
|
3447
|
+
branch: z21.string(),
|
|
3448
|
+
risks: z21.array(z21.enum(["active_runs", "dirty_tree"]))
|
|
3449
|
+
});
|
|
3450
|
+
var repoPullErrorSchema = z21.union([
|
|
3445
3451
|
repoPullConfirmationSchema,
|
|
3446
|
-
|
|
3452
|
+
z21.object({ error: z21.string() })
|
|
3447
3453
|
]);
|
|
3448
|
-
var diffStatSchema2 =
|
|
3449
|
-
adds:
|
|
3450
|
-
dels:
|
|
3451
|
-
files:
|
|
3454
|
+
var diffStatSchema2 = z21.object({
|
|
3455
|
+
adds: z21.number(),
|
|
3456
|
+
dels: z21.number(),
|
|
3457
|
+
files: z21.number()
|
|
3452
3458
|
});
|
|
3453
|
-
var changedFileSchema =
|
|
3454
|
-
path:
|
|
3459
|
+
var changedFileSchema = z21.object({
|
|
3460
|
+
path: z21.string(),
|
|
3455
3461
|
/** Rename/copy source — present only when `status` is renamed/copied. */
|
|
3456
|
-
oldPath:
|
|
3457
|
-
status:
|
|
3458
|
-
adds:
|
|
3459
|
-
dels:
|
|
3462
|
+
oldPath: z21.string().optional(),
|
|
3463
|
+
status: z21.enum(["added", "modified", "deleted", "renamed", "copied"]),
|
|
3464
|
+
adds: z21.number(),
|
|
3465
|
+
dels: z21.number(),
|
|
3460
3466
|
/** Binary per numstat — there is no text patch to render. */
|
|
3461
|
-
binary:
|
|
3467
|
+
binary: z21.boolean(),
|
|
3462
3468
|
/** True when the path is one the raw-bytes route serves as an `<img>` (#365) — present only
|
|
3463
3469
|
* when true, so old clients that never read it stay correct. */
|
|
3464
|
-
image:
|
|
3470
|
+
image: z21.boolean().optional(),
|
|
3465
3471
|
/** This file's unified-diff section; possibly `… (patch truncated)`, possibly empty. */
|
|
3466
|
-
patch:
|
|
3472
|
+
patch: z21.string()
|
|
3467
3473
|
});
|
|
3468
|
-
var changesPayloadSchema =
|
|
3469
|
-
files:
|
|
3474
|
+
var changesPayloadSchema = z21.object({
|
|
3475
|
+
files: z21.array(changedFileSchema),
|
|
3470
3476
|
stat: diffStatSchema2,
|
|
3471
3477
|
/** Additive context for review tasks whose worktree HEAD no longer matches their own branch. */
|
|
3472
|
-
repointedHead:
|
|
3478
|
+
repointedHead: z21.object({ headBranch: z21.string(), taskBranch: z21.string() }).optional()
|
|
3473
3479
|
});
|
|
3474
|
-
var repoCommitPayloadSchema =
|
|
3475
|
-
sha:
|
|
3476
|
-
subject:
|
|
3477
|
-
author:
|
|
3480
|
+
var repoCommitPayloadSchema = z21.object({
|
|
3481
|
+
sha: z21.string(),
|
|
3482
|
+
subject: z21.string(),
|
|
3483
|
+
author: z21.string(),
|
|
3478
3484
|
/** Relative time ("3 hours ago") — same `%cr` format as the /api/v1/repo log. */
|
|
3479
|
-
when:
|
|
3480
|
-
files:
|
|
3485
|
+
when: z21.string(),
|
|
3486
|
+
files: z21.array(changedFileSchema),
|
|
3481
3487
|
stat: diffStatSchema2
|
|
3482
3488
|
});
|
|
3483
|
-
var worktreeDirEntrySchema =
|
|
3484
|
-
name:
|
|
3485
|
-
type:
|
|
3486
|
-
size:
|
|
3487
|
-
});
|
|
3488
|
-
var worktreeEntrySchema =
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
path:
|
|
3492
|
-
entries:
|
|
3489
|
+
var worktreeDirEntrySchema = z21.object({
|
|
3490
|
+
name: z21.string(),
|
|
3491
|
+
type: z21.enum(["dir", "file"]),
|
|
3492
|
+
size: z21.number().optional()
|
|
3493
|
+
});
|
|
3494
|
+
var worktreeEntrySchema = z21.discriminatedUnion("type", [
|
|
3495
|
+
z21.object({
|
|
3496
|
+
type: z21.literal("dir"),
|
|
3497
|
+
path: z21.string(),
|
|
3498
|
+
entries: z21.array(worktreeDirEntrySchema)
|
|
3493
3499
|
}),
|
|
3494
|
-
|
|
3495
|
-
type:
|
|
3496
|
-
path:
|
|
3497
|
-
size:
|
|
3498
|
-
binary:
|
|
3499
|
-
tooLarge:
|
|
3500
|
-
content:
|
|
3500
|
+
z21.object({
|
|
3501
|
+
type: z21.literal("file"),
|
|
3502
|
+
path: z21.string(),
|
|
3503
|
+
size: z21.number(),
|
|
3504
|
+
binary: z21.boolean(),
|
|
3505
|
+
tooLarge: z21.boolean(),
|
|
3506
|
+
content: z21.string().optional()
|
|
3501
3507
|
})
|
|
3502
3508
|
]);
|
|
3503
|
-
var worktreeInfoSchema =
|
|
3504
|
-
runId:
|
|
3505
|
-
title:
|
|
3509
|
+
var worktreeInfoSchema = z21.object({
|
|
3510
|
+
runId: z21.string(),
|
|
3511
|
+
title: z21.string(),
|
|
3506
3512
|
status: runStatusSchema,
|
|
3507
|
-
branch:
|
|
3508
|
-
sizeBytes:
|
|
3509
|
-
finishedAt:
|
|
3510
|
-
reclaimable:
|
|
3511
|
-
pastKeep:
|
|
3513
|
+
branch: z21.string().nullable(),
|
|
3514
|
+
sizeBytes: z21.number().nullable(),
|
|
3515
|
+
finishedAt: z21.string().nullable(),
|
|
3516
|
+
reclaimable: z21.boolean(),
|
|
3517
|
+
pastKeep: z21.boolean()
|
|
3512
3518
|
});
|
|
3513
|
-
var worktreesResponseSchema =
|
|
3514
|
-
worktrees:
|
|
3515
|
-
totalBytes:
|
|
3516
|
-
keep:
|
|
3519
|
+
var worktreesResponseSchema = z21.object({
|
|
3520
|
+
worktrees: z21.array(worktreeInfoSchema),
|
|
3521
|
+
totalBytes: z21.number().nullable(),
|
|
3522
|
+
keep: z21.number()
|
|
3517
3523
|
});
|
|
3518
|
-
var reclaimWorktreeResponseSchema =
|
|
3519
|
-
runId:
|
|
3520
|
-
worktreeReclaimedAt:
|
|
3524
|
+
var reclaimWorktreeResponseSchema = z21.object({
|
|
3525
|
+
runId: z21.string(),
|
|
3526
|
+
worktreeReclaimedAt: z21.string()
|
|
3521
3527
|
});
|
|
3522
|
-
var reclaimWorktreesResponseSchema =
|
|
3523
|
-
reclaimed:
|
|
3528
|
+
var reclaimWorktreesResponseSchema = z21.object({
|
|
3529
|
+
reclaimed: z21.array(z21.string())
|
|
3524
3530
|
});
|
|
3525
3531
|
|
|
3526
3532
|
// ../contract/src/projects.ts
|
|
3527
|
-
import { z as
|
|
3533
|
+
import { z as z22 } from "zod";
|
|
3528
3534
|
|
|
3529
3535
|
// ../contract/src/project-limits.ts
|
|
3530
3536
|
var PROJECT_TAG_MAX_LENGTH = 32;
|
|
@@ -3541,32 +3547,32 @@ var AGENT_REPORT_TITLE_MAX_LENGTH = 200;
|
|
|
3541
3547
|
var AGENT_REPORT_MESSAGE_MAX_LENGTH = 64 * 1024;
|
|
3542
3548
|
|
|
3543
3549
|
// ../contract/src/projects.ts
|
|
3544
|
-
var webhookTriggerSchema =
|
|
3545
|
-
var projectWebhookSchema =
|
|
3546
|
-
id:
|
|
3547
|
-
name:
|
|
3548
|
-
description:
|
|
3549
|
-
url:
|
|
3550
|
-
tokenSet:
|
|
3551
|
-
tasks:
|
|
3552
|
-
triggers:
|
|
3553
|
-
agent:
|
|
3554
|
-
});
|
|
3555
|
-
var projectListEntrySchema =
|
|
3556
|
-
id:
|
|
3557
|
-
name:
|
|
3550
|
+
var webhookTriggerSchema = z22.enum(WEBHOOK_TRIGGERS);
|
|
3551
|
+
var projectWebhookSchema = z22.object({
|
|
3552
|
+
id: z22.string(),
|
|
3553
|
+
name: z22.string(),
|
|
3554
|
+
description: z22.string().optional(),
|
|
3555
|
+
url: z22.string(),
|
|
3556
|
+
tokenSet: z22.boolean(),
|
|
3557
|
+
tasks: z22.boolean(),
|
|
3558
|
+
triggers: z22.array(webhookTriggerSchema).optional(),
|
|
3559
|
+
agent: z22.boolean()
|
|
3560
|
+
});
|
|
3561
|
+
var projectListEntrySchema = z22.object({
|
|
3562
|
+
id: z22.string(),
|
|
3563
|
+
name: z22.string(),
|
|
3558
3564
|
/** Absolute, realpath-normalized repo root. */
|
|
3559
|
-
root:
|
|
3560
|
-
addedAt:
|
|
3561
|
-
lastOpenedAt:
|
|
3562
|
-
source:
|
|
3565
|
+
root: z22.string(),
|
|
3566
|
+
addedAt: z22.string(),
|
|
3567
|
+
lastOpenedAt: z22.string(),
|
|
3568
|
+
source: z22.enum(["local", "checkout"]),
|
|
3563
3569
|
/** `not-git` is fully usable (degraded single-queue mode); only `missing` blocks. */
|
|
3564
|
-
status:
|
|
3570
|
+
status: z22.enum(["ok", "missing", "not-git"]),
|
|
3565
3571
|
/** Current branch when cheaply available (omitted e.g. on an unborn HEAD). */
|
|
3566
|
-
branch:
|
|
3572
|
+
branch: z22.string().optional(),
|
|
3567
3573
|
/** Which forge this project's remote belongs to (#698) — classified server-side from the
|
|
3568
3574
|
* remote URL alone. Gates the project group's GitHub nav item; omitted = no forge remote. */
|
|
3569
|
-
forge:
|
|
3575
|
+
forge: z22.literal("github").optional(),
|
|
3570
3576
|
/**
|
|
3571
3577
|
* The remote's web root, `https://github.com/owner/repo`. Rebuilt server-side from the parsed
|
|
3572
3578
|
* remote rather than passed through, so a remote carrying credentials cannot leak into the
|
|
@@ -3576,10 +3582,10 @@ var projectListEntrySchema = z21.object({
|
|
|
3576
3582
|
* the global Tasks page has one row per project, so it cannot use any single repo's base the
|
|
3577
3583
|
* way a project-scoped view can. With this, every reference it shows is a link.
|
|
3578
3584
|
*/
|
|
3579
|
-
repoUrl:
|
|
3585
|
+
repoUrl: z22.string().optional(),
|
|
3580
3586
|
/** Per-project cap on concurrently running tasks (spec 2026-07-22). Omitted = inherit the
|
|
3581
3587
|
* workspace `resources.maxParallel`; a number pins this project. */
|
|
3582
|
-
maxParallel:
|
|
3588
|
+
maxParallel: z22.number().optional(),
|
|
3583
3589
|
/**
|
|
3584
3590
|
* Free-form labels grouping CONNECTED repositories — a `storefront` tag on the API, the web
|
|
3585
3591
|
* app and the design system says those three are one piece of work spread over three repos.
|
|
@@ -3591,105 +3597,105 @@ var projectListEntrySchema = z21.object({
|
|
|
3591
3597
|
* server-side (trimmed, deduped case-insensitively, sorted), so a consumer may compare them
|
|
3592
3598
|
* directly.
|
|
3593
3599
|
*/
|
|
3594
|
-
tags:
|
|
3600
|
+
tags: z22.array(z22.string()).optional(),
|
|
3595
3601
|
/** The task webhook (#589). The token is write-only: the wire says only whether one is set.
|
|
3596
3602
|
* `triggers` is the stored state selection (hearsay-tools/cezarion#1356); absent means
|
|
3597
3603
|
* `DEFAULT_WEBHOOK_TRIGGERS`, and `[]` means no state sends. */
|
|
3598
|
-
webhook:
|
|
3604
|
+
webhook: z22.object({ url: z22.string(), tokenSet: z22.boolean(), triggers: z22.array(webhookTriggerSchema).optional() }).optional(),
|
|
3599
3605
|
/** Every project webhook, in the order they were added (hearsay-tools/cezarion#1576). Omitted
|
|
3600
3606
|
* when the project has none. `webhook` above stays the first one with task notifications on,
|
|
3601
3607
|
* for clients that know one webhook only. */
|
|
3602
|
-
webhooks:
|
|
3608
|
+
webhooks: z22.array(projectWebhookSchema).optional()
|
|
3603
3609
|
});
|
|
3604
|
-
var projectsResponseSchema =
|
|
3605
|
-
projects:
|
|
3606
|
-
bootProject:
|
|
3607
|
-
projectsDir:
|
|
3610
|
+
var projectsResponseSchema = z22.object({
|
|
3611
|
+
projects: z22.array(projectListEntrySchema),
|
|
3612
|
+
bootProject: z22.string(),
|
|
3613
|
+
projectsDir: z22.string()
|
|
3608
3614
|
});
|
|
3609
|
-
var registerProjectResponseSchema =
|
|
3615
|
+
var registerProjectResponseSchema = z22.object({
|
|
3610
3616
|
project: projectListEntrySchema,
|
|
3611
|
-
error:
|
|
3617
|
+
error: z22.string().optional()
|
|
3612
3618
|
});
|
|
3613
|
-
var removeProjectResponseSchema =
|
|
3614
|
-
removed:
|
|
3615
|
-
id:
|
|
3619
|
+
var removeProjectResponseSchema = z22.object({
|
|
3620
|
+
removed: z22.literal(true),
|
|
3621
|
+
id: z22.string()
|
|
3616
3622
|
});
|
|
3617
|
-
var updateProjectResponseSchema =
|
|
3623
|
+
var updateProjectResponseSchema = z22.object({
|
|
3618
3624
|
project: projectListEntrySchema
|
|
3619
3625
|
});
|
|
3620
|
-
var projectWebhookUrlSchema =
|
|
3621
|
-
var projectWebhookInputSchema =
|
|
3626
|
+
var projectWebhookUrlSchema = z22.string().trim().max(PROJECT_WEBHOOK_URL_MAX_LENGTH).pipe(z22.url({ protocol: /^https?$/, error: "webhook url must be an http(s) URL" })).refine((value) => !/^https?:\/\/[^/?#]*@/i.test(value), "webhook url must not contain credentials; put the secret in the token");
|
|
3627
|
+
var projectWebhookInputSchema = z22.object({
|
|
3622
3628
|
url: projectWebhookUrlSchema,
|
|
3623
|
-
token:
|
|
3629
|
+
token: z22.string().trim().max(PROJECT_WEBHOOK_TOKEN_MAX_LENGTH).optional(),
|
|
3624
3630
|
/** The states that send a delivery (hearsay-tools/cezarion#1356). Omitted keeps the stored
|
|
3625
3631
|
* selection; `[]` stores "none". Each value at most once. */
|
|
3626
|
-
triggers:
|
|
3632
|
+
triggers: z22.array(webhookTriggerSchema).refine((values) => new Set(values).size === values.length, "webhook triggers must not repeat").optional()
|
|
3627
3633
|
});
|
|
3628
|
-
var webhookTriggersInputSchema =
|
|
3629
|
-
var projectWebhookNameSchema =
|
|
3630
|
-
var projectWebhookDescriptionSchema =
|
|
3631
|
-
var projectWebhookTokenSchema =
|
|
3632
|
-
var createProjectWebhookInputSchema =
|
|
3634
|
+
var webhookTriggersInputSchema = z22.array(webhookTriggerSchema).refine((values) => new Set(values).size === values.length, "webhook triggers must not repeat");
|
|
3635
|
+
var projectWebhookNameSchema = z22.string().trim().min(1, "webhook name is required").max(PROJECT_WEBHOOK_NAME_MAX_LENGTH);
|
|
3636
|
+
var projectWebhookDescriptionSchema = z22.string().trim().max(PROJECT_WEBHOOK_DESCRIPTION_MAX_LENGTH);
|
|
3637
|
+
var projectWebhookTokenSchema = z22.string().trim().max(PROJECT_WEBHOOK_TOKEN_MAX_LENGTH);
|
|
3638
|
+
var createProjectWebhookInputSchema = z22.object({
|
|
3633
3639
|
name: projectWebhookNameSchema,
|
|
3634
3640
|
description: projectWebhookDescriptionSchema.optional(),
|
|
3635
3641
|
url: projectWebhookUrlSchema,
|
|
3636
3642
|
token: projectWebhookTokenSchema.optional(),
|
|
3637
|
-
tasks:
|
|
3643
|
+
tasks: z22.boolean().optional(),
|
|
3638
3644
|
triggers: webhookTriggersInputSchema.optional(),
|
|
3639
|
-
agent:
|
|
3645
|
+
agent: z22.boolean().optional()
|
|
3640
3646
|
});
|
|
3641
|
-
var updateProjectWebhookInputSchema =
|
|
3647
|
+
var updateProjectWebhookInputSchema = z22.object({
|
|
3642
3648
|
name: projectWebhookNameSchema.optional(),
|
|
3643
3649
|
description: projectWebhookDescriptionSchema.optional(),
|
|
3644
3650
|
url: projectWebhookUrlSchema.optional(),
|
|
3645
3651
|
token: projectWebhookTokenSchema.optional(),
|
|
3646
|
-
tasks:
|
|
3652
|
+
tasks: z22.boolean().optional(),
|
|
3647
3653
|
triggers: webhookTriggersInputSchema.optional(),
|
|
3648
|
-
agent:
|
|
3654
|
+
agent: z22.boolean().optional()
|
|
3649
3655
|
}).refine((body) => Object.values(body).some((value) => value !== void 0), "specify at least one webhook field");
|
|
3650
|
-
var projectWebhookParamsSchema =
|
|
3651
|
-
projectId:
|
|
3652
|
-
webhookId:
|
|
3656
|
+
var projectWebhookParamsSchema = z22.object({
|
|
3657
|
+
projectId: z22.string(),
|
|
3658
|
+
webhookId: z22.string().regex(PROJECT_WEBHOOK_ID_PATTERN, "unknown webhook")
|
|
3653
3659
|
});
|
|
3654
|
-
var projectWebhookResponseSchema =
|
|
3660
|
+
var projectWebhookResponseSchema = z22.object({
|
|
3655
3661
|
project: projectListEntrySchema,
|
|
3656
3662
|
webhook: projectWebhookSchema
|
|
3657
3663
|
});
|
|
3658
|
-
var agentWebhookSchema =
|
|
3659
|
-
id:
|
|
3660
|
-
name:
|
|
3661
|
-
description:
|
|
3664
|
+
var agentWebhookSchema = z22.object({
|
|
3665
|
+
id: z22.string(),
|
|
3666
|
+
name: z22.string(),
|
|
3667
|
+
description: z22.string().optional()
|
|
3662
3668
|
});
|
|
3663
|
-
var agentWebhooksResponseSchema =
|
|
3664
|
-
var agentWebhookParamsSchema =
|
|
3665
|
-
projectId:
|
|
3669
|
+
var agentWebhooksResponseSchema = z22.object({ webhooks: z22.array(agentWebhookSchema) });
|
|
3670
|
+
var agentWebhookParamsSchema = z22.object({
|
|
3671
|
+
projectId: z22.string(),
|
|
3666
3672
|
/** The webhook's id, or its name (case-insensitive). */
|
|
3667
|
-
webhook:
|
|
3673
|
+
webhook: z22.string().min(1).max(PROJECT_WEBHOOK_NAME_MAX_LENGTH)
|
|
3668
3674
|
});
|
|
3669
|
-
var sendAgentReportInputSchema =
|
|
3670
|
-
runId:
|
|
3671
|
-
title:
|
|
3672
|
-
message:
|
|
3673
|
-
data:
|
|
3675
|
+
var sendAgentReportInputSchema = z22.object({
|
|
3676
|
+
runId: z22.string().min(1).max(128).optional(),
|
|
3677
|
+
title: z22.string().trim().min(1).max(AGENT_REPORT_TITLE_MAX_LENGTH).optional(),
|
|
3678
|
+
message: z22.string().trim().min(1, "message is required").max(AGENT_REPORT_MESSAGE_MAX_LENGTH),
|
|
3679
|
+
data: z22.record(z22.string(), z22.unknown()).optional()
|
|
3674
3680
|
});
|
|
3675
|
-
var sendAgentReportResponseSchema =
|
|
3676
|
-
ok:
|
|
3681
|
+
var sendAgentReportResponseSchema = z22.object({
|
|
3682
|
+
ok: z22.boolean(),
|
|
3677
3683
|
webhook: agentWebhookSchema.pick({ id: true, name: true }),
|
|
3678
|
-
deliveryId:
|
|
3679
|
-
attempts:
|
|
3680
|
-
status:
|
|
3681
|
-
error:
|
|
3682
|
-
dryRun:
|
|
3683
|
-
});
|
|
3684
|
-
var testProjectWebhookResponseSchema =
|
|
3685
|
-
ok:
|
|
3686
|
-
status:
|
|
3687
|
-
error:
|
|
3688
|
-
dryRun:
|
|
3689
|
-
});
|
|
3690
|
-
var updateProjectInputSchema =
|
|
3691
|
-
maxParallel:
|
|
3692
|
-
tags:
|
|
3684
|
+
deliveryId: z22.string(),
|
|
3685
|
+
attempts: z22.number(),
|
|
3686
|
+
status: z22.number().optional(),
|
|
3687
|
+
error: z22.string().optional(),
|
|
3688
|
+
dryRun: z22.boolean().optional()
|
|
3689
|
+
});
|
|
3690
|
+
var testProjectWebhookResponseSchema = z22.object({
|
|
3691
|
+
ok: z22.boolean(),
|
|
3692
|
+
status: z22.number().optional(),
|
|
3693
|
+
error: z22.string().optional(),
|
|
3694
|
+
dryRun: z22.boolean().optional()
|
|
3695
|
+
});
|
|
3696
|
+
var updateProjectInputSchema = z22.object({
|
|
3697
|
+
maxParallel: z22.number().int().min(1).max(16).nullable().optional(),
|
|
3698
|
+
tags: z22.array(z22.string().trim().min(1).max(PROJECT_TAG_MAX_LENGTH)).max(PROJECT_TAGS_MAX).nullable().optional(),
|
|
3693
3699
|
/**
|
|
3694
3700
|
* The task webhook (#589). `null` removes it. An omitted `token` keeps the stored one, so the
|
|
3695
3701
|
* settings form can change the URL without asking for a secret it never shows again; `''`
|
|
@@ -3700,158 +3706,158 @@ var updateProjectInputSchema = z21.object({
|
|
|
3700
3706
|
(body) => body.maxParallel !== void 0 || body.tags !== void 0 || body.webhook !== void 0,
|
|
3701
3707
|
"specify maxParallel, tags or webhook"
|
|
3702
3708
|
);
|
|
3703
|
-
var checkoutProjectInputSchema =
|
|
3704
|
-
url:
|
|
3705
|
-
name:
|
|
3706
|
-
checkoutId:
|
|
3707
|
-
});
|
|
3708
|
-
var createProjectInputSchema =
|
|
3709
|
-
name:
|
|
3710
|
-
github:
|
|
3711
|
-
owner:
|
|
3712
|
-
template:
|
|
3709
|
+
var checkoutProjectInputSchema = z22.object({
|
|
3710
|
+
url: z22.string().trim().min(1).max(512),
|
|
3711
|
+
name: z22.string().trim().max(128).optional(),
|
|
3712
|
+
checkoutId: z22.string().trim().max(128).optional()
|
|
3713
|
+
});
|
|
3714
|
+
var createProjectInputSchema = z22.object({
|
|
3715
|
+
name: z22.string().trim().regex(PROJECT_NAME_PATTERN),
|
|
3716
|
+
github: z22.object({
|
|
3717
|
+
owner: z22.string().trim().min(1).max(64),
|
|
3718
|
+
template: z22.string().trim().max(512).optional()
|
|
3713
3719
|
}).optional(),
|
|
3714
|
-
checkoutId:
|
|
3720
|
+
checkoutId: z22.string().trim().max(128).optional()
|
|
3715
3721
|
});
|
|
3716
3722
|
var createProjectResponseSchema = registerProjectResponseSchema.extend({
|
|
3717
|
-
warning:
|
|
3723
|
+
warning: z22.string().optional()
|
|
3718
3724
|
});
|
|
3719
|
-
var githubOwnerSchema =
|
|
3720
|
-
login:
|
|
3721
|
-
personal:
|
|
3722
|
-
avatarUrl:
|
|
3723
|
-
description:
|
|
3725
|
+
var githubOwnerSchema = z22.object({
|
|
3726
|
+
login: z22.string(),
|
|
3727
|
+
personal: z22.boolean(),
|
|
3728
|
+
avatarUrl: z22.string().optional(),
|
|
3729
|
+
description: z22.string().optional()
|
|
3724
3730
|
});
|
|
3725
|
-
var githubOwnersResponseSchema =
|
|
3726
|
-
|
|
3727
|
-
|
|
3731
|
+
var githubOwnersResponseSchema = z22.discriminatedUnion("available", [
|
|
3732
|
+
z22.object({ available: z22.literal(true), owners: z22.array(githubOwnerSchema) }),
|
|
3733
|
+
z22.object({ available: z22.literal(false), reason: z22.string() })
|
|
3728
3734
|
]);
|
|
3729
|
-
var fsBrowseDirSchema =
|
|
3730
|
-
name:
|
|
3731
|
-
path:
|
|
3735
|
+
var fsBrowseDirSchema = z22.object({
|
|
3736
|
+
name: z22.string(),
|
|
3737
|
+
path: z22.string(),
|
|
3732
3738
|
/** Has a `.git` entry — drives the "git" badge. A non-repo folder is still selectable. */
|
|
3733
|
-
isRepo:
|
|
3739
|
+
isRepo: z22.boolean()
|
|
3734
3740
|
});
|
|
3735
|
-
var fsBrowseResponseSchema =
|
|
3741
|
+
var fsBrowseResponseSchema = z22.object({
|
|
3736
3742
|
/** The realpath'd directory actually listed — never the spelling asked for, so the breadcrumb
|
|
3737
3743
|
* shows where the picker really is. */
|
|
3738
|
-
path:
|
|
3744
|
+
path: z22.string(),
|
|
3739
3745
|
/** `null` AT the browse root: there is no "up" out of it, and the dialog must render no parent
|
|
3740
3746
|
* row rather than one that 400s. */
|
|
3741
|
-
parent:
|
|
3742
|
-
dirs:
|
|
3747
|
+
parent: z22.string().nullable(),
|
|
3748
|
+
dirs: z22.array(fsBrowseDirSchema),
|
|
3743
3749
|
/** True when the listing was capped server-side — surfaced honestly instead of showing a
|
|
3744
3750
|
* silently short list. */
|
|
3745
|
-
truncated:
|
|
3751
|
+
truncated: z22.boolean()
|
|
3746
3752
|
});
|
|
3747
|
-
var checkoutProgressParamsSchema =
|
|
3748
|
-
var checkoutProgressResponseSchema =
|
|
3749
|
-
var registerProjectInputSchema =
|
|
3750
|
-
root:
|
|
3753
|
+
var checkoutProgressParamsSchema = z22.object({ checkoutId: z22.string().min(1).max(128) });
|
|
3754
|
+
var checkoutProgressResponseSchema = z22.object({ progress: checkoutProgressEventSchema.nullable() });
|
|
3755
|
+
var registerProjectInputSchema = z22.object({
|
|
3756
|
+
root: z22.string().trim().min(1).max(4096)
|
|
3751
3757
|
});
|
|
3752
3758
|
|
|
3753
3759
|
// ../contract/src/skills.ts
|
|
3754
|
-
import { z as
|
|
3755
|
-
var skillSchema =
|
|
3756
|
-
name:
|
|
3757
|
-
description:
|
|
3758
|
-
body:
|
|
3759
|
-
path:
|
|
3760
|
+
import { z as z23 } from "zod";
|
|
3761
|
+
var skillSchema = z23.object({
|
|
3762
|
+
name: z23.string(),
|
|
3763
|
+
description: z23.string().optional(),
|
|
3764
|
+
body: z23.string(),
|
|
3765
|
+
path: z23.string(),
|
|
3760
3766
|
/** `builtin`: shipped by Squawk itself and listed last (#774), so a repo skill of the same name wins. */
|
|
3761
|
-
source:
|
|
3767
|
+
source: z23.enum(["ai", "cezar", "agents", "global", "team", "builtin"]),
|
|
3762
3768
|
/** Team skills only: where the definition lives in its skills repo. */
|
|
3763
|
-
team:
|
|
3764
|
-
repo:
|
|
3765
|
-
ref:
|
|
3766
|
-
path:
|
|
3769
|
+
team: z23.object({
|
|
3770
|
+
repo: z23.string(),
|
|
3771
|
+
ref: z23.string(),
|
|
3772
|
+
path: z23.string(),
|
|
3767
3773
|
/** True for the `SKILL.md` convention — a whole directory (references/…). */
|
|
3768
|
-
dir:
|
|
3774
|
+
dir: z23.boolean(),
|
|
3769
3775
|
/**
|
|
3770
3776
|
* The exact commit `ref` resolved to when the skill was read (#428).
|
|
3771
3777
|
*
|
|
3772
3778
|
* The hand-written DTO omitted this field entirely — it was NARROWER than the route,
|
|
3773
3779
|
* which has served it since #428.
|
|
3774
3780
|
*/
|
|
3775
|
-
commit:
|
|
3781
|
+
commit: z23.string().optional()
|
|
3776
3782
|
}).optional()
|
|
3777
3783
|
});
|
|
3778
3784
|
|
|
3779
3785
|
// ../contract/src/agent-config.ts
|
|
3780
|
-
import { z as
|
|
3781
|
-
var agentConfigFormatSchema =
|
|
3782
|
-
var agentConfigScopeSchema =
|
|
3783
|
-
var agentConfigKindSchema =
|
|
3784
|
-
var agentConfigTrackedSchema =
|
|
3785
|
-
var agentConfigFileSchema =
|
|
3786
|
+
import { z as z24 } from "zod";
|
|
3787
|
+
var agentConfigFormatSchema = z24.enum(["json", "jsonc", "toml", "yaml", "markdown"]);
|
|
3788
|
+
var agentConfigScopeSchema = z24.enum(["user", "project", "local"]);
|
|
3789
|
+
var agentConfigKindSchema = z24.enum(["settings", "memory", "mcp"]);
|
|
3790
|
+
var agentConfigTrackedSchema = z24.enum(["tracked", "gitignored", "outside-repo"]);
|
|
3791
|
+
var agentConfigFileSchema = z24.object({
|
|
3786
3792
|
/** Stable, opaque, URL-safe — the ONLY thing a client may name (traversal-proof). */
|
|
3787
|
-
id:
|
|
3793
|
+
id: z24.string(),
|
|
3788
3794
|
/** Every runner that reads this file: `<repo>/AGENTS.md` is one file, two readers. */
|
|
3789
|
-
runners:
|
|
3795
|
+
runners: z24.array(runnerSchema),
|
|
3790
3796
|
kind: agentConfigKindSchema,
|
|
3791
3797
|
scope: agentConfigScopeSchema,
|
|
3792
|
-
label:
|
|
3793
|
-
path:
|
|
3798
|
+
label: z24.string(),
|
|
3799
|
+
path: z24.string(),
|
|
3794
3800
|
format: agentConfigFormatSchema,
|
|
3795
3801
|
tracked: agentConfigTrackedSchema,
|
|
3796
|
-
seeded:
|
|
3797
|
-
holdsMcp:
|
|
3802
|
+
seeded: z24.boolean(),
|
|
3803
|
+
holdsMcp: z24.boolean(),
|
|
3798
3804
|
/** VERBATIM from the vendor docs. Never computed, never generic. */
|
|
3799
|
-
precedence:
|
|
3805
|
+
precedence: z24.string(),
|
|
3800
3806
|
/** Documented mid-run reload behaviour, or absent when the vendor is silent. */
|
|
3801
|
-
hotReload:
|
|
3802
|
-
docsUrl:
|
|
3803
|
-
exists:
|
|
3804
|
-
size:
|
|
3807
|
+
hotReload: z24.string().optional(),
|
|
3808
|
+
docsUrl: z24.string(),
|
|
3809
|
+
exists: z24.boolean(),
|
|
3810
|
+
size: z24.number(),
|
|
3805
3811
|
/** sha256 of the bytes, or null when absent. */
|
|
3806
|
-
version:
|
|
3812
|
+
version: z24.string().nullable(),
|
|
3807
3813
|
/** False in hosted mode (whole feature) — the client renders read-only up front. */
|
|
3808
|
-
writable:
|
|
3809
|
-
readOnlyReason:
|
|
3814
|
+
writable: z24.boolean(),
|
|
3815
|
+
readOnlyReason: z24.string().optional()
|
|
3810
3816
|
});
|
|
3811
|
-
var userMcpListingSchema =
|
|
3812
|
-
path:
|
|
3813
|
-
servers:
|
|
3814
|
-
readable:
|
|
3817
|
+
var userMcpListingSchema = z24.object({
|
|
3818
|
+
path: z24.string(),
|
|
3819
|
+
servers: z24.array(z24.string()),
|
|
3820
|
+
readable: z24.boolean()
|
|
3815
3821
|
});
|
|
3816
|
-
var agentConfigListingSchema =
|
|
3817
|
-
editable:
|
|
3818
|
-
files:
|
|
3822
|
+
var agentConfigListingSchema = z24.object({
|
|
3823
|
+
editable: z24.boolean(),
|
|
3824
|
+
files: z24.array(agentConfigFileSchema),
|
|
3819
3825
|
/** null in hosted mode (host-state disclosure guard). */
|
|
3820
3826
|
userMcp: userMcpListingSchema.nullable()
|
|
3821
3827
|
});
|
|
3822
|
-
var agentConfigFileContentSchema =
|
|
3823
|
-
id:
|
|
3824
|
-
path:
|
|
3825
|
-
exists:
|
|
3826
|
-
content:
|
|
3828
|
+
var agentConfigFileContentSchema = z24.object({
|
|
3829
|
+
id: z24.string(),
|
|
3830
|
+
path: z24.string(),
|
|
3831
|
+
exists: z24.boolean(),
|
|
3832
|
+
content: z24.string(),
|
|
3827
3833
|
/** sha256 of the bytes, or null when the file does not exist yet. */
|
|
3828
|
-
version:
|
|
3834
|
+
version: z24.string().nullable()
|
|
3829
3835
|
});
|
|
3830
|
-
var setAgentConfigInputSchema =
|
|
3831
|
-
content:
|
|
3832
|
-
version:
|
|
3836
|
+
var setAgentConfigInputSchema = z24.object({
|
|
3837
|
+
content: z24.string().max(2e6),
|
|
3838
|
+
version: z24.string().nullable()
|
|
3833
3839
|
});
|
|
3834
3840
|
|
|
3835
3841
|
// ../contract/src/agent-profiles.ts
|
|
3836
|
-
import { z as
|
|
3842
|
+
import { z as z25 } from "zod";
|
|
3837
3843
|
var DEFAULT_AGENT_ACCOUNT_ID = "default";
|
|
3838
|
-
var agentProfileSchema =
|
|
3844
|
+
var agentProfileSchema = z25.object({
|
|
3839
3845
|
/** `default` for the discovered profile, else the stored slug. */
|
|
3840
|
-
id:
|
|
3846
|
+
id: z25.string(),
|
|
3841
3847
|
provider: providerIdSchema,
|
|
3842
|
-
label:
|
|
3848
|
+
label: z25.string(),
|
|
3843
3849
|
/** As the user wrote it — a literal `~` is preserved, matching `browseRoot`/`projectsDir`. */
|
|
3844
|
-
configDir:
|
|
3850
|
+
configDir: z25.string(),
|
|
3845
3851
|
/** Expanded absolute path. Same-origin route, like `ProjectListEntry.root`. */
|
|
3846
|
-
path:
|
|
3852
|
+
path: z25.string(),
|
|
3847
3853
|
/** False for a dir the CLI has not created yet — legitimate, and NOT a reason to fall back
|
|
3848
3854
|
* to another account at run time (that would silently bill the wrong subscription). */
|
|
3849
|
-
exists:
|
|
3855
|
+
exists: z25.boolean(),
|
|
3850
3856
|
/** Whether the dir carries this agent's own marker files. ADVISORY: an unrecognised dir is
|
|
3851
3857
|
* still accepted, because "add profile → Connect → the CLI creates it" is the real flow. */
|
|
3852
|
-
looksValid:
|
|
3858
|
+
looksValid: z25.boolean(),
|
|
3853
3859
|
/** True for the profile Squawk discovers from the environment. Never stored, never deletable. */
|
|
3854
|
-
isDefault:
|
|
3860
|
+
isDefault: z25.boolean(),
|
|
3855
3861
|
/** This account's own authentication state — two Claude logins answer independently.
|
|
3856
3862
|
*
|
|
3857
3863
|
* **Absent until the probe has warmed.** Every probe shells out to an agent CLI, and this
|
|
@@ -3865,45 +3871,45 @@ function agentAccountRouteId(profile) {
|
|
|
3865
3871
|
return profile.isDefault ? `default:${profile.provider}` : profile.id;
|
|
3866
3872
|
}
|
|
3867
3873
|
var agentAccountSelectionSchema = perRunnerOptionalStrings();
|
|
3868
|
-
var agentProfilesResponseSchema =
|
|
3869
|
-
editable:
|
|
3870
|
-
profiles:
|
|
3874
|
+
var agentProfilesResponseSchema = z25.object({
|
|
3875
|
+
editable: z25.boolean(),
|
|
3876
|
+
profiles: z25.array(agentProfileSchema),
|
|
3871
3877
|
/** Providers that can carry more than one account at all — what "Add account" is offered for.
|
|
3872
3878
|
* OpenCode and omp are absent: no folder variable moves their credentials, so a config-dir
|
|
3873
3879
|
* profile would swap settings while still billing the other account. */
|
|
3874
|
-
profileCapableProviders:
|
|
3880
|
+
profileCapableProviders: z25.array(providerIdSchema),
|
|
3875
3881
|
/** Which account each project uses, keyed by the project's realpath'd ROOT.
|
|
3876
3882
|
*
|
|
3877
3883
|
* Served here rather than on `GET /api/v1/projects` because it is stored beside the accounts it
|
|
3878
3884
|
* names (`~/.cezar/agent-accounts.json`) — one file, so deleting an account and scrubbing every
|
|
3879
3885
|
* reference to it is one atomic write, and neither can be dropped by a Squawk version that never
|
|
3880
3886
|
* heard of accounts. Empty in hosted mode, where the whole family is withheld. */
|
|
3881
|
-
selections:
|
|
3887
|
+
selections: z25.record(z25.string(), agentAccountSelectionSchema)
|
|
3882
3888
|
});
|
|
3883
|
-
var selectAgentProfileInputSchema =
|
|
3889
|
+
var selectAgentProfileInputSchema = z25.object({
|
|
3884
3890
|
/** Registry slug, or the reserved `default` boot alias. Resolved to a root server-side. */
|
|
3885
|
-
projectId:
|
|
3891
|
+
projectId: z25.string().min(1).max(64),
|
|
3886
3892
|
provider: providerIdSchema,
|
|
3887
|
-
profileId:
|
|
3893
|
+
profileId: z25.string().max(64).nullable()
|
|
3888
3894
|
});
|
|
3889
|
-
var agentProfileSelectionsResponseSchema =
|
|
3890
|
-
selections:
|
|
3895
|
+
var agentProfileSelectionsResponseSchema = z25.object({
|
|
3896
|
+
selections: z25.record(z25.string(), agentAccountSelectionSchema)
|
|
3891
3897
|
});
|
|
3892
|
-
var agentAccountStatusResponseSchema =
|
|
3893
|
-
var createAgentProfileInputSchema =
|
|
3898
|
+
var agentAccountStatusResponseSchema = z25.object({ status: providerStatusSchema });
|
|
3899
|
+
var createAgentProfileInputSchema = z25.object({
|
|
3894
3900
|
provider: providerIdSchema,
|
|
3895
|
-
label:
|
|
3901
|
+
label: z25.string().trim().max(200).optional(),
|
|
3896
3902
|
/** Stored as written; validated absolute after `~` expansion, server-side. */
|
|
3897
|
-
configDir:
|
|
3903
|
+
configDir: z25.string().trim().min(1).max(4096)
|
|
3898
3904
|
});
|
|
3899
|
-
var agentProfileResponseSchema =
|
|
3900
|
-
var updateAgentProfileInputSchema =
|
|
3901
|
-
label:
|
|
3902
|
-
configDir:
|
|
3905
|
+
var agentProfileResponseSchema = z25.object({ profile: agentProfileSchema });
|
|
3906
|
+
var updateAgentProfileInputSchema = z25.object({
|
|
3907
|
+
label: z25.string().trim().max(200).optional(),
|
|
3908
|
+
configDir: z25.string().trim().min(1).max(4096).optional()
|
|
3903
3909
|
});
|
|
3904
|
-
var removeAgentProfileResponseSchema =
|
|
3905
|
-
removed:
|
|
3906
|
-
id:
|
|
3910
|
+
var removeAgentProfileResponseSchema = z25.object({
|
|
3911
|
+
removed: z25.literal(true),
|
|
3912
|
+
id: z25.string()
|
|
3907
3913
|
});
|
|
3908
3914
|
|
|
3909
3915
|
// ../contract/src/zoned-time.ts
|
|
@@ -3986,7 +3992,7 @@ function localTimeZone() {
|
|
|
3986
3992
|
}
|
|
3987
3993
|
|
|
3988
3994
|
// ../contract/src/automation-schedule.ts
|
|
3989
|
-
import { z as
|
|
3995
|
+
import { z as z26 } from "zod";
|
|
3990
3996
|
var SCHEDULE_TYPES = ["daily", "weekdays", "weekly", "hours", "once"];
|
|
3991
3997
|
var SCHEDULE_HOURS_OPTIONS = [1, 2, 3, 4, 6, 8, 12];
|
|
3992
3998
|
var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
@@ -3997,34 +4003,34 @@ var ONCE_AT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
|
3997
4003
|
var REPEATING_KEYS = ["hour", "minute", "day", "every"];
|
|
3998
4004
|
var ONCE_KEYS = ["at", "timeZone", "latestStartMinutes"];
|
|
3999
4005
|
var ONCE_PAST_DUE_MESSAGE = "the due time has passed; choose a later time or use Run now";
|
|
4000
|
-
var onceStatusSchema =
|
|
4006
|
+
var onceStatusSchema = z26.enum(["paused", "waiting", "failed", "missed", "archived"]);
|
|
4001
4007
|
function unknownTimeZoneMessage(zone) {
|
|
4002
4008
|
return `unknown time zone "${zone}"; use an IANA name such as Europe/Warsaw`;
|
|
4003
4009
|
}
|
|
4004
|
-
var automationScheduleSchema =
|
|
4005
|
-
type:
|
|
4010
|
+
var automationScheduleSchema = z26.object({
|
|
4011
|
+
type: z26.enum(SCHEDULE_TYPES),
|
|
4006
4012
|
/** 0–23; `daily`, `weekdays`, `weekly`. Default 4. */
|
|
4007
|
-
hour:
|
|
4013
|
+
hour: z26.number().int().min(0).max(23).optional(),
|
|
4008
4014
|
/** 0–59; `daily`, `weekdays`, `weekly`. Default 0. */
|
|
4009
|
-
minute:
|
|
4015
|
+
minute: z26.number().int().min(0).max(59).optional(),
|
|
4010
4016
|
/** ISO weekday, Monday = 1 … Sunday = 7; `weekly`. Default 1. */
|
|
4011
|
-
day:
|
|
4017
|
+
day: z26.number().int().min(1).max(7).optional(),
|
|
4012
4018
|
/** Hours between runs, from 00:00; `hours`. Default 6. */
|
|
4013
|
-
every:
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4019
|
+
every: z26.union([
|
|
4020
|
+
z26.literal(1),
|
|
4021
|
+
z26.literal(2),
|
|
4022
|
+
z26.literal(3),
|
|
4023
|
+
z26.literal(4),
|
|
4024
|
+
z26.literal(6),
|
|
4025
|
+
z26.literal(8),
|
|
4026
|
+
z26.literal(12)
|
|
4021
4027
|
]).optional(),
|
|
4022
4028
|
/** `once`: the local wall time `YYYY-MM-DDTHH:MM` in `timeZone`. */
|
|
4023
|
-
at:
|
|
4029
|
+
at: z26.string().regex(ONCE_AT_PATTERN, "at must be YYYY-MM-DDTHH:MM").optional(),
|
|
4024
4030
|
/** `once`: the IANA zone `at` is read in. Required there, refused on the repeating shapes. */
|
|
4025
|
-
timeZone:
|
|
4031
|
+
timeZone: z26.string().optional(),
|
|
4026
4032
|
/** `once`: how late after `at` a start may still launch. Absent = no limit. */
|
|
4027
|
-
latestStartMinutes:
|
|
4033
|
+
latestStartMinutes: z26.number().int().min(ONCE_MIN_LATEST_START_MINUTES).max(ONCE_MAX_LATEST_START_MINUTES).optional()
|
|
4028
4034
|
}).superRefine((schedule, ctx) => {
|
|
4029
4035
|
const present = (key) => schedule[key] !== void 0;
|
|
4030
4036
|
const refuse = (key, message2) => ctx.addIssue({ code: "custom", path: [key], message: message2 });
|
|
@@ -4189,112 +4195,112 @@ function nextOccurrence(schedule, afterMs, timeZone) {
|
|
|
4189
4195
|
}
|
|
4190
4196
|
|
|
4191
4197
|
// ../contract/src/automations.ts
|
|
4192
|
-
import { z as
|
|
4193
|
-
var automationEventSchema =
|
|
4198
|
+
import { z as z27 } from "zod";
|
|
4199
|
+
var automationEventSchema = z27.enum([
|
|
4194
4200
|
"pull_request.opened",
|
|
4195
4201
|
"issue.opened",
|
|
4196
4202
|
"issue.labeled",
|
|
4197
4203
|
"issue.unlabeled"
|
|
4198
4204
|
]);
|
|
4199
|
-
var automationFiltersSchema =
|
|
4205
|
+
var automationFiltersSchema = z27.object({
|
|
4200
4206
|
/** Opt in to matching events before enablement, bounded by lookbackDays. Absent means false. */
|
|
4201
|
-
includeExisting:
|
|
4202
|
-
authors:
|
|
4203
|
-
assignees:
|
|
4207
|
+
includeExisting: z27.boolean().optional(),
|
|
4208
|
+
authors: z27.array(z27.string()).optional(),
|
|
4209
|
+
assignees: z27.array(z27.string()).optional(),
|
|
4204
4210
|
/** Opt-in: require an open item and matching live labels before reservation and launch. */
|
|
4205
|
-
requireCurrentLabels:
|
|
4206
|
-
allLabels:
|
|
4207
|
-
anyLabels:
|
|
4208
|
-
excludeLabels:
|
|
4211
|
+
requireCurrentLabels: z27.boolean().optional(),
|
|
4212
|
+
allLabels: z27.array(z27.string()).optional(),
|
|
4213
|
+
anyLabels: z27.array(z27.string()).optional(),
|
|
4214
|
+
excludeLabels: z27.array(z27.string()).optional(),
|
|
4209
4215
|
/** Required for the two label events — the server rejects a definition without it. */
|
|
4210
|
-
changedLabels:
|
|
4211
|
-
lookbackDays:
|
|
4212
|
-
maxRecords:
|
|
4216
|
+
changedLabels: z27.array(z27.string()).optional(),
|
|
4217
|
+
lookbackDays: z27.number(),
|
|
4218
|
+
maxRecords: z27.number()
|
|
4213
4219
|
});
|
|
4214
|
-
var automationKindSchema =
|
|
4220
|
+
var automationKindSchema = z27.enum(["github", "schedule"]);
|
|
4215
4221
|
var automationTaskSchema = createRunInputBaseSchema.omit({ task: true, images: true, systemPrompt: true }).extend({
|
|
4216
4222
|
/** The prompt template. `{{github.number}}`, `{{github.title}}`, `{{github.url}}` and
|
|
4217
4223
|
* `{{github.labels}}` are substituted per match; GitHub content is appended as untrusted
|
|
4218
4224
|
* context, never interpolated into instructions. */
|
|
4219
|
-
prompt:
|
|
4220
|
-
variants:
|
|
4221
|
-
systemPrompt:
|
|
4225
|
+
prompt: z27.string(),
|
|
4226
|
+
variants: z27.union([z27.literal(1), z27.literal(2), z27.literal(3)]).optional(),
|
|
4227
|
+
systemPrompt: z27.string().optional()
|
|
4222
4228
|
});
|
|
4223
4229
|
function writableAutomationTask(task) {
|
|
4224
4230
|
const { variants: _variants, ...writable } = task;
|
|
4225
4231
|
return writable;
|
|
4226
4232
|
}
|
|
4227
|
-
var automationArchiveSchema =
|
|
4228
|
-
at:
|
|
4229
|
-
outcome:
|
|
4230
|
-
runId:
|
|
4231
|
-
receiptId:
|
|
4232
|
-
trigger:
|
|
4233
|
+
var automationArchiveSchema = z27.object({
|
|
4234
|
+
at: z27.string(),
|
|
4235
|
+
outcome: z27.enum(["launched", "cancelled"]),
|
|
4236
|
+
runId: z27.string().optional(),
|
|
4237
|
+
receiptId: z27.string().optional(),
|
|
4238
|
+
trigger: z27.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
4233
4239
|
});
|
|
4234
|
-
var automationDefinitionSchema =
|
|
4235
|
-
id:
|
|
4240
|
+
var automationDefinitionSchema = z27.object({
|
|
4241
|
+
id: z27.string(),
|
|
4236
4242
|
/** Bumped on every edit; a PUT must echo the revision it read (optimistic concurrency). */
|
|
4237
|
-
revision:
|
|
4238
|
-
name:
|
|
4239
|
-
description:
|
|
4243
|
+
revision: z27.number(),
|
|
4244
|
+
name: z27.string(),
|
|
4245
|
+
description: z27.string().optional(),
|
|
4240
4246
|
/** Always present: the storage schema defaults it to `false`, so a definition is created
|
|
4241
4247
|
* PAUSED and enabling it is a separate, baseline-establishing act. */
|
|
4242
|
-
enabled:
|
|
4248
|
+
enabled: z27.boolean(),
|
|
4243
4249
|
kind: automationKindSchema,
|
|
4244
4250
|
/** `github` kind: always present. `schedule` kind: absent. */
|
|
4245
|
-
events:
|
|
4246
|
-
intervalSeconds:
|
|
4251
|
+
events: z27.array(automationEventSchema).optional(),
|
|
4252
|
+
intervalSeconds: z27.number().optional(),
|
|
4247
4253
|
filters: automationFiltersSchema.optional(),
|
|
4248
4254
|
/** `schedule` kind: always present. `github` kind: absent. */
|
|
4249
4255
|
schedule: automationScheduleSchema.optional(),
|
|
4250
4256
|
task: automationTaskSchema,
|
|
4251
4257
|
/** `once` schedules only: present once its task exists or it was cancelled. */
|
|
4252
4258
|
archived: automationArchiveSchema.optional(),
|
|
4253
|
-
createdAt:
|
|
4254
|
-
updatedAt:
|
|
4255
|
-
});
|
|
4256
|
-
var automationCursorSchema =
|
|
4257
|
-
timestamp:
|
|
4258
|
-
tieBreaker:
|
|
4259
|
-
});
|
|
4260
|
-
var automationHistoryScanSchema =
|
|
4261
|
-
since:
|
|
4262
|
-
until:
|
|
4263
|
-
source:
|
|
4264
|
-
page:
|
|
4265
|
-
item:
|
|
4259
|
+
createdAt: z27.string(),
|
|
4260
|
+
updatedAt: z27.string()
|
|
4261
|
+
});
|
|
4262
|
+
var automationCursorSchema = z27.object({
|
|
4263
|
+
timestamp: z27.string(),
|
|
4264
|
+
tieBreaker: z27.string().optional()
|
|
4265
|
+
});
|
|
4266
|
+
var automationHistoryScanSchema = z27.object({
|
|
4267
|
+
since: z27.string().datetime(),
|
|
4268
|
+
until: z27.string().datetime(),
|
|
4269
|
+
source: z27.number().int().min(0).max(2),
|
|
4270
|
+
page: z27.number().int().min(1).max(10),
|
|
4271
|
+
item: z27.number().int().min(0).max(100),
|
|
4266
4272
|
// One item can contain ten pages of 100 timeline entries, independent of the new-work cap.
|
|
4267
|
-
event:
|
|
4273
|
+
event: z27.number().int().min(0).max(1e3),
|
|
4268
4274
|
cursor: automationCursorSchema.optional()
|
|
4269
4275
|
});
|
|
4270
4276
|
var AUTOMATION_LAST_ERROR_MAX = 1e3;
|
|
4271
4277
|
var automationLastErrorShape = {
|
|
4272
|
-
lastError:
|
|
4273
|
-
lastErrorAt:
|
|
4278
|
+
lastError: z27.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
|
|
4279
|
+
lastErrorAt: z27.string().datetime().optional()
|
|
4274
4280
|
};
|
|
4275
|
-
var automationRuntimeStateSchema =
|
|
4281
|
+
var automationRuntimeStateSchema = z27.object({
|
|
4276
4282
|
/** The definition revision this state belongs to; activation or history-policy changes re-arm. */
|
|
4277
|
-
revision:
|
|
4283
|
+
revision: z27.number().optional(),
|
|
4278
4284
|
/** Earliest eligible event: enablement time, or the lookback start when includeExisting is on. */
|
|
4279
|
-
baselineAt:
|
|
4285
|
+
baselineAt: z27.string().optional(),
|
|
4280
4286
|
/** When discovery was armed, independent of the historical baseline. */
|
|
4281
|
-
armedAt:
|
|
4287
|
+
armedAt: z27.string().optional(),
|
|
4282
4288
|
historyScan: automationHistoryScanSchema.optional(),
|
|
4283
4289
|
cursor: automationCursorSchema.optional(),
|
|
4284
|
-
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker:
|
|
4285
|
-
backlogAfter: automationCursorSchema.extend({ tieBreaker:
|
|
4286
|
-
nextCheckAt:
|
|
4287
|
-
lastSuccessAt:
|
|
4290
|
+
frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z27.string() }).optional(),
|
|
4291
|
+
backlogAfter: automationCursorSchema.extend({ tieBreaker: z27.string() }).optional(),
|
|
4292
|
+
nextCheckAt: z27.string().optional(),
|
|
4293
|
+
lastSuccessAt: z27.string().optional(),
|
|
4288
4294
|
/** `schedule` kind: the next occurrence's instant and the last fired one's. */
|
|
4289
|
-
nextRunAt:
|
|
4290
|
-
lastRunAt:
|
|
4295
|
+
nextRunAt: z27.string().optional(),
|
|
4296
|
+
lastRunAt: z27.string().optional(),
|
|
4291
4297
|
/** Per-query GitHub ETags, so an unchanged page costs no rate-limit budget. */
|
|
4292
|
-
etags:
|
|
4293
|
-
backoffUntil:
|
|
4294
|
-
consecutiveFailures:
|
|
4298
|
+
etags: z27.record(z27.string(), z27.string()).optional(),
|
|
4299
|
+
backoffUntil: z27.string().optional(),
|
|
4300
|
+
consecutiveFailures: z27.number().optional(),
|
|
4295
4301
|
...automationLastErrorShape,
|
|
4296
4302
|
/** `once` schedules: why it stopped without a task — its launch failed, or it started past its cutoff. */
|
|
4297
|
-
onceOutcome:
|
|
4303
|
+
onceOutcome: z27.enum(["failed", "missed"]).optional()
|
|
4298
4304
|
});
|
|
4299
4305
|
var AUTOMATION_FAILURE_NOTICE_AFTER = 3;
|
|
4300
4306
|
function automationFailureNotice(state) {
|
|
@@ -4307,7 +4313,7 @@ function automationFailureNotice(state) {
|
|
|
4307
4313
|
...state.backoffUntil ? { retryAt: state.backoffUntil } : {}
|
|
4308
4314
|
};
|
|
4309
4315
|
}
|
|
4310
|
-
var automationLogResultSchema =
|
|
4316
|
+
var automationLogResultSchema = z27.enum([
|
|
4311
4317
|
"launched",
|
|
4312
4318
|
"no-match",
|
|
4313
4319
|
"duplicate",
|
|
@@ -4323,36 +4329,36 @@ var automationLogResultSchema = z26.enum([
|
|
|
4323
4329
|
// once schedule: Squawk started after its latest start, so nothing launched.
|
|
4324
4330
|
"missed"
|
|
4325
4331
|
]);
|
|
4326
|
-
var automationLogRecordSchema =
|
|
4327
|
-
seq:
|
|
4328
|
-
ts:
|
|
4329
|
-
automationId:
|
|
4330
|
-
revision:
|
|
4332
|
+
var automationLogRecordSchema = z27.object({
|
|
4333
|
+
seq: z27.number(),
|
|
4334
|
+
ts: z27.string(),
|
|
4335
|
+
automationId: z27.string(),
|
|
4336
|
+
revision: z27.number(),
|
|
4331
4337
|
event: automationEventSchema.optional(),
|
|
4332
4338
|
result: automationLogResultSchema,
|
|
4333
|
-
reason:
|
|
4334
|
-
durationMs:
|
|
4335
|
-
receiptId:
|
|
4336
|
-
runId:
|
|
4337
|
-
githubNumber:
|
|
4338
|
-
githubTitle:
|
|
4339
|
-
githubUrl:
|
|
4340
|
-
rateLimit:
|
|
4341
|
-
bucket:
|
|
4342
|
-
remaining:
|
|
4343
|
-
resetAt:
|
|
4339
|
+
reason: z27.string().optional(),
|
|
4340
|
+
durationMs: z27.number().optional(),
|
|
4341
|
+
receiptId: z27.string().optional(),
|
|
4342
|
+
runId: z27.string().optional(),
|
|
4343
|
+
githubNumber: z27.number().optional(),
|
|
4344
|
+
githubTitle: z27.string().optional(),
|
|
4345
|
+
githubUrl: z27.string().optional(),
|
|
4346
|
+
rateLimit: z27.object({
|
|
4347
|
+
bucket: z27.enum(["core", "search"]),
|
|
4348
|
+
remaining: z27.number().optional(),
|
|
4349
|
+
resetAt: z27.string().optional()
|
|
4344
4350
|
}).optional()
|
|
4345
4351
|
});
|
|
4346
|
-
var automationCountsSchema =
|
|
4352
|
+
var automationCountsSchema = z27.object({
|
|
4347
4353
|
/** GitHub candidates that matched a filter: `launched` + `duplicate` rows. */
|
|
4348
|
-
matches:
|
|
4354
|
+
matches: z27.number(),
|
|
4349
4355
|
/** Stored tasks with this automation's provenance, including each variant, finished and archived
|
|
4350
4356
|
* tasks, across all revisions. Independent of log/receipt retention; deleting a task removes it. */
|
|
4351
|
-
launched:
|
|
4357
|
+
launched: z27.number(),
|
|
4352
4358
|
/** `duplicate` rows: a match whose receipt already existed, so nothing launched. */
|
|
4353
|
-
duplicates:
|
|
4359
|
+
duplicates: z27.number(),
|
|
4354
4360
|
/** `error` and `rate-limited` rows, plus a schedule's `failed` launches. */
|
|
4355
|
-
errors:
|
|
4361
|
+
errors: z27.number()
|
|
4356
4362
|
});
|
|
4357
4363
|
var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
4358
4364
|
state: automationRuntimeStateSchema.optional(),
|
|
@@ -4360,74 +4366,74 @@ var automationListEntrySchema = automationDefinitionSchema.extend({
|
|
|
4360
4366
|
counts: automationCountsSchema,
|
|
4361
4367
|
/** Enabled only: a schedule's armed `state.nextRunAt`, a poll's `state.nextCheckAt`. Absent
|
|
4362
4368
|
* while paused, and for a schedule the timer has not armed yet. */
|
|
4363
|
-
nextRunAt:
|
|
4369
|
+
nextRunAt: z27.string().optional(),
|
|
4364
4370
|
/** `once` schedules only. */
|
|
4365
4371
|
onceStatus: onceStatusSchema.optional()
|
|
4366
4372
|
});
|
|
4367
|
-
var automationsResponseSchema =
|
|
4368
|
-
available:
|
|
4369
|
-
reason:
|
|
4370
|
-
timeZone:
|
|
4371
|
-
scheduler:
|
|
4372
|
-
state:
|
|
4373
|
-
nextDue:
|
|
4373
|
+
var automationsResponseSchema = z27.object({
|
|
4374
|
+
available: z27.boolean(),
|
|
4375
|
+
reason: z27.string().optional(),
|
|
4376
|
+
timeZone: z27.string(),
|
|
4377
|
+
scheduler: z27.object({
|
|
4378
|
+
state: z27.enum(["scheduled", "idle"]),
|
|
4379
|
+
nextDue: z27.string().optional()
|
|
4374
4380
|
}),
|
|
4375
|
-
automations:
|
|
4381
|
+
automations: z27.array(automationListEntrySchema)
|
|
4376
4382
|
});
|
|
4377
|
-
var automationResponseSchema =
|
|
4383
|
+
var automationResponseSchema = z27.object({ automation: automationDefinitionSchema });
|
|
4378
4384
|
var automationCreateResponseSchema = automationResponseSchema.extend({
|
|
4379
|
-
once:
|
|
4385
|
+
once: z27.object({ dueAt: z27.string(), timeZone: z27.string(), resolvedInstant: z27.string(), note: z27.string() }).optional()
|
|
4380
4386
|
});
|
|
4381
|
-
var automationDetailResponseSchema =
|
|
4387
|
+
var automationDetailResponseSchema = z27.object({
|
|
4382
4388
|
automation: automationDefinitionSchema,
|
|
4383
4389
|
state: automationRuntimeStateSchema.optional(),
|
|
4384
4390
|
latestLog: automationLogRecordSchema.optional(),
|
|
4385
4391
|
/** `once` schedules only. */
|
|
4386
4392
|
onceStatus: onceStatusSchema.optional()
|
|
4387
4393
|
});
|
|
4388
|
-
var automationCheckSchema =
|
|
4389
|
-
id:
|
|
4390
|
-
automationId:
|
|
4391
|
-
mode:
|
|
4392
|
-
status:
|
|
4393
|
-
createdAt:
|
|
4394
|
-
completedAt:
|
|
4395
|
-
matches:
|
|
4396
|
-
truncated:
|
|
4397
|
-
error:
|
|
4398
|
-
});
|
|
4399
|
-
var automationCheckQueuedResponseSchema =
|
|
4400
|
-
var automationLogResponseSchema =
|
|
4401
|
-
records:
|
|
4402
|
-
});
|
|
4403
|
-
var automationRetryResponseSchema =
|
|
4404
|
-
receiptId:
|
|
4405
|
-
runId:
|
|
4406
|
-
});
|
|
4407
|
-
var automationRunResponseSchema =
|
|
4394
|
+
var automationCheckSchema = z27.object({
|
|
4395
|
+
id: z27.string(),
|
|
4396
|
+
automationId: z27.string(),
|
|
4397
|
+
mode: z27.enum(["preview", "execute"]),
|
|
4398
|
+
status: z27.enum(["queued", "running", "complete", "error"]),
|
|
4399
|
+
createdAt: z27.string(),
|
|
4400
|
+
completedAt: z27.string().optional(),
|
|
4401
|
+
matches: z27.number().optional(),
|
|
4402
|
+
truncated: z27.boolean().optional(),
|
|
4403
|
+
error: z27.string().optional()
|
|
4404
|
+
});
|
|
4405
|
+
var automationCheckQueuedResponseSchema = z27.object({ checkId: z27.string() });
|
|
4406
|
+
var automationLogResponseSchema = z27.object({
|
|
4407
|
+
records: z27.array(automationLogRecordSchema)
|
|
4408
|
+
});
|
|
4409
|
+
var automationRetryResponseSchema = z27.object({
|
|
4410
|
+
receiptId: z27.string(),
|
|
4411
|
+
runId: z27.string()
|
|
4412
|
+
});
|
|
4413
|
+
var automationRunResponseSchema = z27.object({ runId: z27.string() });
|
|
4408
4414
|
var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true, kind: true, archived: true }).extend({
|
|
4409
4415
|
/** Omitted = `github` on create, the shape every pre-schedule client sends; omitted on
|
|
4410
4416
|
* update = the stored kind. */
|
|
4411
4417
|
kind: automationKindSchema.optional(),
|
|
4412
4418
|
task: automationTaskSchema.omit({ variants: true }).strict(),
|
|
4413
|
-
enable:
|
|
4419
|
+
enable: z27.boolean().optional()
|
|
4414
4420
|
});
|
|
4415
4421
|
var updateAutomationInputSchema = createAutomationInputSchema.omit({ enable: true }).extend({
|
|
4416
|
-
enabled:
|
|
4417
|
-
expectedRevision:
|
|
4422
|
+
enabled: z27.boolean().optional(),
|
|
4423
|
+
expectedRevision: z27.number()
|
|
4418
4424
|
});
|
|
4419
|
-
var automationListQuerySchema =
|
|
4420
|
-
archived:
|
|
4425
|
+
var automationListQuerySchema = z27.object({
|
|
4426
|
+
archived: z27.enum(["include", "only"]).optional()
|
|
4421
4427
|
});
|
|
4422
|
-
var automationCheckInputSchema =
|
|
4423
|
-
mode:
|
|
4428
|
+
var automationCheckInputSchema = z27.object({
|
|
4429
|
+
mode: z27.enum(["preview", "execute"])
|
|
4424
4430
|
});
|
|
4425
4431
|
|
|
4426
4432
|
// ../contract/src/scheduled-tasks.ts
|
|
4427
|
-
import { z as
|
|
4433
|
+
import { z as z28 } from "zod";
|
|
4428
4434
|
var SCHEDULED_TASK_LIMITS = { prompt: 1e5, list: 50, wireBytes: 1048576 };
|
|
4429
4435
|
var DURATION = /^(\d+)\s*([mhd])$/;
|
|
4430
|
-
var durationField =
|
|
4436
|
+
var durationField = z28.string().regex(DURATION, "a duration such as 30m, 6h or 7d");
|
|
4431
4437
|
function parseDurationMinutes(value) {
|
|
4432
4438
|
const match = DURATION.exec(value.trim());
|
|
4433
4439
|
if (!match) throw new Error(`"${value}" is not a duration; use 30m, 6h or 7d`);
|
|
@@ -4451,58 +4457,58 @@ function wallTimeAtOrAfter(targetMs, timeZone) {
|
|
|
4451
4457
|
var UTC_MINUTE_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})Z$/;
|
|
4452
4458
|
var utcMinute = (instantMs) => `${new Date(instantMs).toISOString().slice(0, 16)}Z`;
|
|
4453
4459
|
var scheduleFields = {
|
|
4454
|
-
at:
|
|
4460
|
+
at: z28.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(),
|
|
4455
4461
|
delay: durationField.optional(),
|
|
4456
4462
|
latest_start: durationField.optional(),
|
|
4457
|
-
workflow:
|
|
4458
|
-
runner:
|
|
4459
|
-
model:
|
|
4460
|
-
effort:
|
|
4463
|
+
workflow: z28.string().trim().min(1).max(200).optional(),
|
|
4464
|
+
runner: z28.string().trim().min(1).max(32).optional(),
|
|
4465
|
+
model: z28.string().trim().min(1).max(200).optional(),
|
|
4466
|
+
effort: z28.string().trim().min(1).max(32).optional()
|
|
4461
4467
|
};
|
|
4462
4468
|
var notBoth = (value) => !(value.at && value.delay);
|
|
4463
|
-
var scheduleTaskRequestSchema =
|
|
4464
|
-
name:
|
|
4465
|
-
prompt:
|
|
4469
|
+
var scheduleTaskRequestSchema = z28.object({
|
|
4470
|
+
name: z28.string().trim().min(1).max(200),
|
|
4471
|
+
prompt: z28.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt),
|
|
4466
4472
|
...scheduleFields,
|
|
4467
|
-
enable:
|
|
4473
|
+
enable: z28.boolean().optional()
|
|
4468
4474
|
}).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"] });
|
|
4469
|
-
var idField =
|
|
4470
|
-
var scheduledTasksRequestSchema =
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
action:
|
|
4475
|
+
var idField = z28.string().min(1).max(100);
|
|
4476
|
+
var scheduledTasksRequestSchema = z28.discriminatedUnion("action", [
|
|
4477
|
+
z28.object({ action: z28.literal("list"), archived: z28.enum(["include", "only"]).optional() }).strict(),
|
|
4478
|
+
z28.object({ action: z28.literal("show"), id: idField }).strict(),
|
|
4479
|
+
z28.object({
|
|
4480
|
+
action: z28.literal("update"),
|
|
4475
4481
|
id: idField,
|
|
4476
|
-
name:
|
|
4477
|
-
prompt:
|
|
4482
|
+
name: z28.string().trim().min(1).max(200).optional(),
|
|
4483
|
+
prompt: z28.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt).optional(),
|
|
4478
4484
|
...scheduleFields
|
|
4479
4485
|
}).strict().refine(notBoth, { message: "give at or delay, not both", path: ["delay"] }),
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4486
|
+
z28.object({ action: z28.literal("pause"), id: idField }).strict(),
|
|
4487
|
+
z28.object({ action: z28.literal("enable"), id: idField }).strict(),
|
|
4488
|
+
z28.object({ action: z28.literal("cancel"), id: idField }).strict()
|
|
4483
4489
|
]);
|
|
4484
|
-
var scheduledTaskSchema =
|
|
4485
|
-
id:
|
|
4486
|
-
name:
|
|
4490
|
+
var scheduledTaskSchema = z28.object({
|
|
4491
|
+
id: z28.string(),
|
|
4492
|
+
name: z28.string(),
|
|
4487
4493
|
status: onceStatusSchema,
|
|
4488
4494
|
/** When it is due, in UTC: `YYYY-MM-DDTHH:MMZ`, the form `at` takes. */
|
|
4489
|
-
due_at:
|
|
4490
|
-
latest_start_minutes:
|
|
4495
|
+
due_at: z28.string(),
|
|
4496
|
+
latest_start_minutes: z28.number().optional(),
|
|
4491
4497
|
/** The task it launched, once archived with one. */
|
|
4492
|
-
run_id:
|
|
4498
|
+
run_id: z28.string().optional(),
|
|
4493
4499
|
/** The cockpit page of the schedule, when the cockpit's address is known. */
|
|
4494
|
-
url:
|
|
4500
|
+
url: z28.string().optional()
|
|
4495
4501
|
});
|
|
4496
|
-
var scheduledTaskRefusalCodeSchema =
|
|
4497
|
-
var refusal =
|
|
4502
|
+
var scheduledTaskRefusalCodeSchema = z28.enum(["invalid_request", "unavailable", "not_found", "conflict", "automations_off"]);
|
|
4503
|
+
var refusal = z28.object({ ok: z28.literal(false), code: scheduledTaskRefusalCodeSchema, message: z28.string() });
|
|
4498
4504
|
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.";
|
|
4499
|
-
var scheduleTaskAnswerSchema =
|
|
4500
|
-
|
|
4505
|
+
var scheduleTaskAnswerSchema = z28.union([
|
|
4506
|
+
z28.object({ ok: z28.literal(true), task: scheduledTaskSchema, note: z28.string() }),
|
|
4501
4507
|
refusal
|
|
4502
4508
|
]);
|
|
4503
|
-
var scheduledTasksAnswerSchema =
|
|
4504
|
-
|
|
4505
|
-
|
|
4509
|
+
var scheduledTasksAnswerSchema = z28.union([
|
|
4510
|
+
z28.object({ ok: z28.literal(true), tasks: z28.array(scheduledTaskSchema).max(SCHEDULED_TASK_LIMITS.list) }),
|
|
4511
|
+
z28.object({ ok: z28.literal(true), task: scheduledTaskSchema }),
|
|
4506
4512
|
refusal
|
|
4507
4513
|
]);
|
|
4508
4514
|
|
|
@@ -4685,73 +4691,73 @@ function sqlPrefilterTokens(query, options = {}) {
|
|
|
4685
4691
|
}
|
|
4686
4692
|
|
|
4687
4693
|
// ../contract/src/artifacts.ts
|
|
4688
|
-
import { z as
|
|
4689
|
-
var pathSchema =
|
|
4690
|
-
var publishedArtifactSchema =
|
|
4691
|
-
id:
|
|
4692
|
-
runId:
|
|
4693
|
-
name:
|
|
4694
|
-
title:
|
|
4694
|
+
import { z as z29 } from "zod";
|
|
4695
|
+
var pathSchema = z29.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
|
|
4696
|
+
var publishedArtifactSchema = z29.object({
|
|
4697
|
+
id: z29.uuid(),
|
|
4698
|
+
runId: z29.uuid(),
|
|
4699
|
+
name: z29.string().min(1).max(255),
|
|
4700
|
+
title: z29.string().max(200).optional(),
|
|
4695
4701
|
sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
|
|
4696
|
-
createdAt:
|
|
4697
|
-
size:
|
|
4698
|
-
sha256:
|
|
4702
|
+
createdAt: z29.iso.datetime(),
|
|
4703
|
+
size: z29.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
4704
|
+
sha256: z29.string().regex(/^[a-f0-9]{64}$/)
|
|
4699
4705
|
}).strict();
|
|
4700
|
-
var filePreviewDataSchema =
|
|
4701
|
-
type:
|
|
4706
|
+
var filePreviewDataSchema = z29.object({
|
|
4707
|
+
type: z29.literal("file"),
|
|
4702
4708
|
path: pathSchema,
|
|
4703
|
-
size:
|
|
4704
|
-
binary:
|
|
4705
|
-
tooLarge:
|
|
4706
|
-
content:
|
|
4707
|
-
source:
|
|
4709
|
+
size: z29.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
4710
|
+
binary: z29.boolean(),
|
|
4711
|
+
tooLarge: z29.boolean(),
|
|
4712
|
+
content: z29.string().optional(),
|
|
4713
|
+
source: z29.enum(["worktree", "project", "artifact"]),
|
|
4708
4714
|
artifact: publishedArtifactSchema.optional()
|
|
4709
4715
|
}).strict();
|
|
4710
|
-
var fileLinkResultSchema =
|
|
4716
|
+
var fileLinkResultSchema = z29.union([
|
|
4711
4717
|
filePreviewDataSchema,
|
|
4712
|
-
|
|
4713
|
-
type:
|
|
4718
|
+
z29.object({
|
|
4719
|
+
type: z29.enum(["unavailable", "unpublished"]),
|
|
4714
4720
|
path: pathSchema,
|
|
4715
|
-
reason:
|
|
4721
|
+
reason: z29.string().min(1).max(4096)
|
|
4716
4722
|
}).strict()
|
|
4717
4723
|
]);
|
|
4718
|
-
var artifactMetadataResponseSchema =
|
|
4719
|
-
var artifactListSchema =
|
|
4720
|
-
var fileLinkQuerySchema =
|
|
4721
|
-
var artifactParamsSchema =
|
|
4724
|
+
var artifactMetadataResponseSchema = z29.object({ artifact: publishedArtifactSchema }).strict();
|
|
4725
|
+
var artifactListSchema = z29.object({ artifacts: z29.array(publishedArtifactSchema).max(64) }).strict();
|
|
4726
|
+
var fileLinkQuerySchema = z29.object({ path: pathSchema, raw: z29.literal("1").optional() }).strict();
|
|
4727
|
+
var artifactParamsSchema = z29.object({ id: z29.uuid(), artifactId: z29.uuid() });
|
|
4722
4728
|
|
|
4723
4729
|
// ../contract/src/discovery.ts
|
|
4724
|
-
import { z as
|
|
4725
|
-
var hostDiscoveryRequestSchema =
|
|
4726
|
-
|
|
4727
|
-
|
|
4730
|
+
import { z as z30 } from "zod";
|
|
4731
|
+
var hostDiscoveryRequestSchema = z30.discriminatedUnion("kind", [
|
|
4732
|
+
z30.object({ kind: z30.literal("runners") }).strict(),
|
|
4733
|
+
z30.object({ kind: z30.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
|
|
4728
4734
|
]);
|
|
4729
|
-
var discoveryRequestSchema =
|
|
4735
|
+
var discoveryRequestSchema = z30.discriminatedUnion("kind", [
|
|
4730
4736
|
...hostDiscoveryRequestSchema.options,
|
|
4731
|
-
|
|
4737
|
+
z30.object({ kind: z30.literal("tasks"), all: z30.boolean().optional(), offset: z30.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
|
|
4732
4738
|
]);
|
|
4733
4739
|
var discoveredRunnerSchema = providerStatusSchema.omit({ provider: true, profileId: true }).extend({ runner: modelDiscoveryRunnerSchema });
|
|
4734
|
-
var discoveredRunnersSchema =
|
|
4735
|
-
scope:
|
|
4736
|
-
runners:
|
|
4737
|
-
});
|
|
4738
|
-
var discoveredTasksSchema =
|
|
4739
|
-
tasks:
|
|
4740
|
-
id:
|
|
4741
|
-
title:
|
|
4740
|
+
var discoveredRunnersSchema = z30.object({
|
|
4741
|
+
scope: z30.literal("host-default-account"),
|
|
4742
|
+
runners: z30.array(discoveredRunnerSchema)
|
|
4743
|
+
});
|
|
4744
|
+
var discoveredTasksSchema = z30.object({
|
|
4745
|
+
tasks: z30.array(z30.object({
|
|
4746
|
+
id: z30.string(),
|
|
4747
|
+
title: z30.string(),
|
|
4742
4748
|
runner: runnerSchema.optional(),
|
|
4743
4749
|
status: runStatusSchema,
|
|
4744
|
-
attention:
|
|
4745
|
-
attentionLabel:
|
|
4746
|
-
accepts:
|
|
4747
|
-
reason:
|
|
4750
|
+
attention: z30.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
|
|
4751
|
+
attentionLabel: z30.string(),
|
|
4752
|
+
accepts: z30.boolean(),
|
|
4753
|
+
reason: z30.string().optional()
|
|
4748
4754
|
})).max(32),
|
|
4749
|
-
nextOffset:
|
|
4755
|
+
nextOffset: z30.number().int().nonnegative().optional()
|
|
4750
4756
|
});
|
|
4751
|
-
var discoveryResponseSchema =
|
|
4757
|
+
var discoveryResponseSchema = z30.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
|
|
4752
4758
|
|
|
4753
4759
|
// ../contract/src/live.ts
|
|
4754
|
-
import { z as
|
|
4760
|
+
import { z as z31 } from "zod";
|
|
4755
4761
|
|
|
4756
4762
|
// ../contract/src/live-limits.ts
|
|
4757
4763
|
var LIVE_RUN_LIMIT = 32;
|
|
@@ -4759,44 +4765,44 @@ var LIVE_EVENT_LIMIT = 256;
|
|
|
4759
4765
|
var LIVE_BYTE_LIMIT = 1024 * 1024;
|
|
4760
4766
|
|
|
4761
4767
|
// ../contract/src/live.ts
|
|
4762
|
-
var liveRunDemandSchema =
|
|
4763
|
-
projectId:
|
|
4768
|
+
var liveRunDemandSchema = z31.object({
|
|
4769
|
+
projectId: z31.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
|
|
4764
4770
|
runId: runIdParamSchema.shape.id,
|
|
4765
4771
|
cursor: runHistoryCursorSchema.optional(),
|
|
4766
|
-
afterSeq:
|
|
4772
|
+
afterSeq: z31.number().int().nonnegative().safe()
|
|
4767
4773
|
});
|
|
4768
|
-
var liveRunsRequestSchema =
|
|
4769
|
-
runs:
|
|
4774
|
+
var liveRunsRequestSchema = z31.object({
|
|
4775
|
+
runs: z31.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
|
|
4770
4776
|
}).refine(({ runs }) => new Set(runs.map((r) => `${r.projectId}/${r.runId}`)).size === runs.length, {
|
|
4771
4777
|
message: "duplicate run demand"
|
|
4772
4778
|
});
|
|
4773
4779
|
var identity = liveRunDemandSchema.pick({ projectId: true, runId: true });
|
|
4774
4780
|
var liveRunErrorSchema = identity.extend({
|
|
4775
|
-
type:
|
|
4776
|
-
status:
|
|
4777
|
-
error:
|
|
4781
|
+
type: z31.enum(["error", "reset"]),
|
|
4782
|
+
status: z31.union([z31.literal(400), z31.literal(404), z31.literal(409), z31.literal(413), z31.literal(503)]),
|
|
4783
|
+
error: z31.string()
|
|
4778
4784
|
});
|
|
4779
4785
|
var liveRunBatchSchema = identity.extend({
|
|
4780
|
-
type:
|
|
4781
|
-
events:
|
|
4786
|
+
type: z31.literal("batch"),
|
|
4787
|
+
events: z31.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
|
|
4782
4788
|
cursor: runHistoryCursorSchema,
|
|
4783
|
-
afterSeq:
|
|
4784
|
-
hasMore:
|
|
4785
|
-
});
|
|
4786
|
-
var liveRunBatchResultSchema =
|
|
4787
|
-
var liveRunBatchResponseSchema =
|
|
4788
|
-
generation:
|
|
4789
|
-
results:
|
|
4790
|
-
});
|
|
4791
|
-
var liveRunFrameSchema =
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
identity.extend({ type:
|
|
4789
|
+
afterSeq: z31.number().int().nonnegative(),
|
|
4790
|
+
hasMore: z31.boolean()
|
|
4791
|
+
});
|
|
4792
|
+
var liveRunBatchResultSchema = z31.union([liveRunBatchSchema, liveRunErrorSchema]);
|
|
4793
|
+
var liveRunBatchResponseSchema = z31.object({
|
|
4794
|
+
generation: z31.string(),
|
|
4795
|
+
results: z31.array(liveRunBatchResultSchema)
|
|
4796
|
+
});
|
|
4797
|
+
var liveRunFrameSchema = z31.union([
|
|
4798
|
+
z31.object({ type: z31.literal("ready"), generation: z31.string() }),
|
|
4799
|
+
z31.object({ type: z31.literal("ping") }),
|
|
4800
|
+
identity.extend({ type: z31.literal("event"), name: z31.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
|
|
4795
4801
|
liveRunErrorSchema
|
|
4796
4802
|
]);
|
|
4797
4803
|
|
|
4798
4804
|
// ../contract/src/activity.ts
|
|
4799
|
-
import { z as
|
|
4805
|
+
import { z as z32 } from "zod";
|
|
4800
4806
|
var ACTIVITY_RATE_SECONDS = 30;
|
|
4801
4807
|
var ACTIVITY_TEXT_MAX = 500;
|
|
4802
4808
|
var ACTIVITY_ERROR_MAX = 200;
|
|
@@ -4804,144 +4810,144 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
|
|
|
4804
4810
|
var ACTIVITY_CHECKS_MAX = 100;
|
|
4805
4811
|
var ACTIVITY_CHECK_NAME_MAX = 100;
|
|
4806
4812
|
var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
|
|
4807
|
-
var iso =
|
|
4808
|
-
var count =
|
|
4809
|
-
var runId =
|
|
4813
|
+
var iso = z32.iso.datetime();
|
|
4814
|
+
var count = z32.number().int().nonnegative();
|
|
4815
|
+
var runId = z32.string().min(1);
|
|
4810
4816
|
var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
|
|
4811
|
-
var activityToolSchema =
|
|
4812
|
-
title:
|
|
4813
|
-
toolKind:
|
|
4814
|
-
status:
|
|
4817
|
+
var activityToolSchema = z32.object({
|
|
4818
|
+
title: z32.string().max(ACTIVITY_TOOL_TITLE_MAX),
|
|
4819
|
+
toolKind: z32.enum(ACTIVITY_TOOL_KINDS),
|
|
4820
|
+
status: z32.enum(["pending", "running", "completed", "failed", "declined"]),
|
|
4815
4821
|
startedAt: iso,
|
|
4816
4822
|
endedAt: iso.optional()
|
|
4817
4823
|
}).strict();
|
|
4818
|
-
var activityCheckBucketSchema =
|
|
4819
|
-
var activityPrProgressSchema =
|
|
4820
|
-
checks:
|
|
4821
|
-
counts:
|
|
4822
|
-
truncated:
|
|
4824
|
+
var activityCheckBucketSchema = z32.enum(["pass", "fail", "pending", "skipping", "cancel"]);
|
|
4825
|
+
var activityPrProgressSchema = z32.object({
|
|
4826
|
+
checks: z32.array(z32.object({ name: z32.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
|
|
4827
|
+
counts: z32.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
|
|
4828
|
+
truncated: z32.literal(true).optional()
|
|
4823
4829
|
}).strict();
|
|
4824
|
-
var activityWaitSchema =
|
|
4825
|
-
|
|
4826
|
-
kind:
|
|
4830
|
+
var activityWaitSchema = z32.discriminatedUnion("kind", [
|
|
4831
|
+
z32.object({
|
|
4832
|
+
kind: z32.literal("human"),
|
|
4827
4833
|
since: iso,
|
|
4828
|
-
detail:
|
|
4834
|
+
detail: z32.object({
|
|
4829
4835
|
/** The ask card's first question. */
|
|
4830
|
-
question:
|
|
4836
|
+
question: z32.string().max(ACTIVITY_TEXT_MAX).optional(),
|
|
4831
4837
|
/** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
|
|
4832
4838
|
* automatic-wake budget is spent; `completion`: Squawk's completion gate. */
|
|
4833
|
-
reason:
|
|
4839
|
+
reason: z32.enum(["question", "turn-end", "budget", "completion"]),
|
|
4834
4840
|
/** Inputs not delivered yet, when there are any. */
|
|
4835
|
-
queuedMessages:
|
|
4841
|
+
queuedMessages: z32.number().int().positive().optional()
|
|
4836
4842
|
}).strict()
|
|
4837
4843
|
}).strict(),
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
kind:
|
|
4844
|
+
z32.object({ kind: z32.literal("usage-limit"), detail: z32.object({ resumeAt: z32.string() }).strict() }).strict(),
|
|
4845
|
+
z32.object({
|
|
4846
|
+
kind: z32.literal("workers"),
|
|
4841
4847
|
since: iso,
|
|
4842
4848
|
deadline: iso.optional(),
|
|
4843
|
-
detail:
|
|
4849
|
+
detail: z32.object({
|
|
4844
4850
|
/** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
|
|
4845
4851
|
owed: count,
|
|
4846
4852
|
/** Targets named and targets settled, summed over the entries. */
|
|
4847
4853
|
total: count,
|
|
4848
4854
|
settled: count,
|
|
4849
4855
|
/** Every open entry waits on request replies. */
|
|
4850
|
-
replies:
|
|
4856
|
+
replies: z32.literal(true).optional(),
|
|
4851
4857
|
/** Only when one entry is open. */
|
|
4852
4858
|
mode: workerWaitModeSchema.optional(),
|
|
4853
4859
|
/** Who owes the awaited replies, each once. */
|
|
4854
|
-
recipientRunIds:
|
|
4860
|
+
recipientRunIds: z32.array(runId)
|
|
4855
4861
|
}).strict()
|
|
4856
4862
|
}).strict(),
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
kind:
|
|
4863
|
+
z32.object({ kind: z32.literal("peers"), since: iso, deadline: iso, detail: z32.object({ peerRunIds: z32.array(runId) }).strict() }).strict(),
|
|
4864
|
+
z32.object({ kind: z32.literal("subagents"), since: iso, deadline: iso, detail: z32.object({ running: count }).strict() }).strict(),
|
|
4865
|
+
z32.object({
|
|
4866
|
+
kind: z32.literal("pr"),
|
|
4861
4867
|
since: iso,
|
|
4862
4868
|
deadline: iso,
|
|
4863
|
-
detail:
|
|
4864
|
-
number:
|
|
4869
|
+
detail: z32.object({
|
|
4870
|
+
number: z32.number().int().positive(),
|
|
4865
4871
|
target: prWaitUntilSchema,
|
|
4866
4872
|
/** Check progress, while the CI progress registry holds some for this wait. */
|
|
4867
4873
|
checks: activityPrProgressSchema.shape.checks.optional(),
|
|
4868
4874
|
counts: activityPrProgressSchema.shape.counts.optional(),
|
|
4869
|
-
truncated:
|
|
4875
|
+
truncated: z32.literal(true).optional()
|
|
4870
4876
|
}).strict()
|
|
4871
4877
|
}).strict(),
|
|
4872
|
-
|
|
4873
|
-
|
|
4878
|
+
z32.object({ kind: z32.literal("process"), since: iso, deadline: iso, detail: z32.object({ pid: z32.number().int(), note: z32.string().optional() }).strict() }).strict(),
|
|
4879
|
+
z32.object({ kind: z32.literal("timer"), since: iso, deadline: iso, detail: z32.object({ wakeAt: iso, note: z32.string().optional() }).strict() }).strict()
|
|
4874
4880
|
]);
|
|
4875
4881
|
var activityRunShape = {
|
|
4876
4882
|
runId,
|
|
4877
4883
|
/** The display title: `titleSummary ?? title`. */
|
|
4878
|
-
title:
|
|
4884
|
+
title: z32.string(),
|
|
4879
4885
|
status: runStatusSchema,
|
|
4880
4886
|
/** The `deriveAttention` rung id, never a label. */
|
|
4881
|
-
rung:
|
|
4887
|
+
rung: z32.enum(ATTENTION_RUNGS),
|
|
4882
4888
|
runner: runnerSchema.optional(),
|
|
4883
|
-
model:
|
|
4884
|
-
currentStepId:
|
|
4885
|
-
startedAt:
|
|
4889
|
+
model: z32.string().optional(),
|
|
4890
|
+
currentStepId: z32.string().optional(),
|
|
4891
|
+
startedAt: z32.string().optional(),
|
|
4886
4892
|
wait: activityWaitSchema.optional(),
|
|
4887
4893
|
tool: activityToolSchema.optional(),
|
|
4888
4894
|
/** Tool calls started per second, oldest first. */
|
|
4889
|
-
rate:
|
|
4895
|
+
rate: z32.array(count).length(ACTIVITY_RATE_SECONDS),
|
|
4890
4896
|
/** One line of `RunRecord.error`. */
|
|
4891
|
-
error:
|
|
4897
|
+
error: z32.string().max(ACTIVITY_ERROR_MAX).optional()
|
|
4892
4898
|
};
|
|
4893
|
-
var activityWorkerSchema =
|
|
4899
|
+
var activityWorkerSchema = z32.object({
|
|
4894
4900
|
...activityRunShape,
|
|
4895
4901
|
/** The worker's current execution revision. */
|
|
4896
4902
|
revision: count,
|
|
4897
4903
|
/** The parent holds a collected result for this revision. */
|
|
4898
|
-
collected:
|
|
4904
|
+
collected: z32.boolean()
|
|
4899
4905
|
}).strict();
|
|
4900
|
-
var activityRunSchema =
|
|
4901
|
-
var activityRequestSchema =
|
|
4902
|
-
requestId:
|
|
4903
|
-
relationship:
|
|
4906
|
+
var activityRunSchema = z32.object({ ...activityRunShape, workers: z32.array(activityWorkerSchema) }).strict();
|
|
4907
|
+
var activityRequestSchema = z32.object({
|
|
4908
|
+
requestId: z32.uuid(),
|
|
4909
|
+
relationship: z32.enum(["family", "peer"]),
|
|
4904
4910
|
senderRunId: runId,
|
|
4905
4911
|
recipientRunId: runId,
|
|
4906
|
-
text:
|
|
4907
|
-
senderTitle:
|
|
4908
|
-
recipientTitle:
|
|
4912
|
+
text: z32.string().max(ACTIVITY_TEXT_MAX),
|
|
4913
|
+
senderTitle: z32.string().optional(),
|
|
4914
|
+
recipientTitle: z32.string().optional(),
|
|
4909
4915
|
createdAt: iso,
|
|
4910
4916
|
deadline: iso.optional()
|
|
4911
4917
|
}).strict();
|
|
4912
|
-
var activityClosedRequestSchema =
|
|
4913
|
-
requestId:
|
|
4918
|
+
var activityClosedRequestSchema = z32.object({
|
|
4919
|
+
requestId: z32.uuid(),
|
|
4914
4920
|
senderRunId: runId,
|
|
4915
4921
|
recipientRunId: runId,
|
|
4916
4922
|
status: requestOutcomeSchema.shape.status,
|
|
4917
4923
|
observedAt: iso
|
|
4918
4924
|
}).strict();
|
|
4919
|
-
var activityProjectSchema =
|
|
4920
|
-
projectId:
|
|
4921
|
-
name:
|
|
4925
|
+
var activityProjectSchema = z32.object({
|
|
4926
|
+
projectId: z32.string(),
|
|
4927
|
+
name: z32.string(),
|
|
4922
4928
|
/** False for a project this process has not loaded: its lists are empty because nothing was read. */
|
|
4923
|
-
loaded:
|
|
4929
|
+
loaded: z32.boolean(),
|
|
4924
4930
|
/** The project is loaded but its run store cannot open: the failure its project routes answer.
|
|
4925
4931
|
* The lists are empty because nothing could be read, not because nothing runs. */
|
|
4926
|
-
unavailable:
|
|
4932
|
+
unavailable: z32.object({ status: z32.union([z32.literal(404), z32.literal(409), z32.literal(503)]), error: z32.string() }).strict().optional(),
|
|
4927
4933
|
/** Root tasks in review: the summary chip (D8). */
|
|
4928
4934
|
inReview: count,
|
|
4929
|
-
tasks:
|
|
4930
|
-
requests:
|
|
4931
|
-
closed:
|
|
4935
|
+
tasks: z32.array(activityRunSchema),
|
|
4936
|
+
requests: z32.array(activityRequestSchema),
|
|
4937
|
+
closed: z32.array(activityClosedRequestSchema)
|
|
4932
4938
|
}).strict();
|
|
4933
|
-
var activitySnapshotSchema =
|
|
4939
|
+
var activitySnapshotSchema = z32.object({
|
|
4934
4940
|
/** The server clock; the client ticks ages from it. */
|
|
4935
4941
|
generatedAt: iso,
|
|
4936
4942
|
/** One entry, or every visible project for the global read. */
|
|
4937
|
-
projects:
|
|
4943
|
+
projects: z32.array(activityProjectSchema)
|
|
4938
4944
|
}).strict();
|
|
4939
|
-
var activityQuerySchema =
|
|
4940
|
-
project:
|
|
4945
|
+
var activityQuerySchema = z32.object({
|
|
4946
|
+
project: z32.union([z32.literal("default"), z32.string().regex(PROJECT_ID_PATTERN)]).optional()
|
|
4941
4947
|
});
|
|
4942
4948
|
|
|
4943
4949
|
// ../contract/src/live-coordination.ts
|
|
4944
|
-
import { z as
|
|
4950
|
+
import { z as z33 } from "zod";
|
|
4945
4951
|
var LIVE_PROTOCOL = 3;
|
|
4946
4952
|
var LIVE_WORKER_NAME = "cezar-live-v3";
|
|
4947
4953
|
var LEASE_MS = 15e3;
|
|
@@ -4950,111 +4956,111 @@ function allowedLiveRead(path) {
|
|
|
4950
4956
|
if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
|
|
4951
4957
|
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);
|
|
4952
4958
|
}
|
|
4953
|
-
var liveDemandSchema =
|
|
4954
|
-
|
|
4955
|
-
liveRunDemandSchema.extend({ kind:
|
|
4956
|
-
|
|
4959
|
+
var liveDemandSchema = z33.discriminatedUnion("kind", [
|
|
4960
|
+
z33.object({ kind: z33.literal("workspace") }),
|
|
4961
|
+
liveRunDemandSchema.extend({ kind: z33.literal("run") }),
|
|
4962
|
+
z33.object({ kind: z33.literal("topic"), topic: z33.string().min(1).max(128) }),
|
|
4957
4963
|
// Preserve server-directed cadence (settled references use ten minutes). Only
|
|
4958
4964
|
// bound the timer itself: larger delays overflow setTimeout into a tight loop.
|
|
4959
|
-
|
|
4965
|
+
z33.object({ kind: z33.literal("read"), path: z33.string().max(4096).refine(allowedLiveRead), intervalMs: z33.number().int().min(1e3).max(2147483647) })
|
|
4960
4966
|
]);
|
|
4961
|
-
var liveEntrySchema =
|
|
4962
|
-
var envelope =
|
|
4963
|
-
var ownerInputSchema =
|
|
4967
|
+
var liveEntrySchema = z33.object({ id: z33.string().min(1).max(128), demand: liveDemandSchema });
|
|
4968
|
+
var envelope = z33.object({ version: z33.literal(LIVE_PROTOCOL), documentId: z33.string().min(1).max(128), epoch: z33.number().int().nonnegative() });
|
|
4969
|
+
var ownerInputSchema = z33.discriminatedUnion("type", [
|
|
4964
4970
|
envelope.extend({
|
|
4965
|
-
type:
|
|
4966
|
-
entries:
|
|
4971
|
+
type: z33.literal("sync"),
|
|
4972
|
+
entries: z33.array(liveEntrySchema).max(64),
|
|
4967
4973
|
/** The document knows no workspace stream generation (its `ready` was lost, for example to
|
|
4968
4974
|
* an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
|
|
4969
|
-
workspaceReady:
|
|
4975
|
+
workspaceReady: z33.literal(true).optional()
|
|
4970
4976
|
}).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
|
|
4971
|
-
envelope.extend({ type:
|
|
4972
|
-
envelope.extend({ type:
|
|
4977
|
+
envelope.extend({ type: z33.literal("ack"), id: z33.string(), seq: z33.number().int().nonnegative() }),
|
|
4978
|
+
envelope.extend({ type: z33.literal("refresh"), id: z33.string() })
|
|
4973
4979
|
]);
|
|
4974
|
-
var wireFrameSchema =
|
|
4975
|
-
var ownerOutputSchema =
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4980
|
+
var wireFrameSchema = z33.object({ event: z33.string(), data: z33.string(), id: z33.string() });
|
|
4981
|
+
var ownerOutputSchema = z33.discriminatedUnion("type", [
|
|
4982
|
+
z33.object({ type: z33.literal("unavailable"), version: z33.literal(LIVE_PROTOCOL), epoch: z33.number(), reason: z33.string() }),
|
|
4983
|
+
z33.object({ type: z33.literal("hello"), version: z33.literal(LIVE_PROTOCOL) }),
|
|
4984
|
+
z33.object({ type: z33.literal("alive"), version: z33.literal(LIVE_PROTOCOL), epoch: z33.number() }),
|
|
4985
|
+
z33.object({ type: z33.literal("frame"), version: z33.literal(LIVE_PROTOCOL), epoch: z33.number(), id: z33.string(), frame: z33.union([wireFrameSchema, liveRunFrameSchema]) }),
|
|
4986
|
+
z33.object({ type: z33.literal("value"), version: z33.literal(LIVE_PROTOCOL), epoch: z33.number(), id: z33.string(), value: z33.unknown(), error: z33.string().optional() }),
|
|
4987
|
+
z33.object({ type: z33.literal("reset"), version: z33.literal(LIVE_PROTOCOL), epoch: z33.number(), id: z33.string(), reason: z33.string() })
|
|
4982
4988
|
]);
|
|
4983
4989
|
var runKey = (run) => `${run.projectId}/${run.runId}`;
|
|
4984
4990
|
|
|
4985
4991
|
// ../contract/src/workspace-events.ts
|
|
4986
|
-
import { z as
|
|
4987
|
-
var workspaceEventsQuerySchema =
|
|
4988
|
-
runs:
|
|
4992
|
+
import { z as z34 } from "zod";
|
|
4993
|
+
var workspaceEventsQuerySchema = z34.object({
|
|
4994
|
+
runs: z34.literal("summary").optional()
|
|
4989
4995
|
});
|
|
4990
|
-
var projectStamp =
|
|
4991
|
-
var frameSeq =
|
|
4992
|
-
var workspaceRunSummaryEventSchema =
|
|
4996
|
+
var projectStamp = z34.string().min(1);
|
|
4997
|
+
var frameSeq = z34.number().int().positive();
|
|
4998
|
+
var workspaceRunSummaryEventSchema = z34.object({
|
|
4993
4999
|
project: projectStamp,
|
|
4994
5000
|
seq: frameSeq,
|
|
4995
5001
|
run: runSummarySchema,
|
|
4996
|
-
relationships:
|
|
5002
|
+
relationships: z34.string().min(1)
|
|
4997
5003
|
});
|
|
4998
|
-
var workspaceRunDeletedEventSchema =
|
|
5004
|
+
var workspaceRunDeletedEventSchema = z34.object({
|
|
4999
5005
|
project: projectStamp,
|
|
5000
5006
|
seq: frameSeq,
|
|
5001
|
-
id:
|
|
5007
|
+
id: z34.string().min(1)
|
|
5002
5008
|
});
|
|
5003
|
-
var workspaceReadyEventSchema =
|
|
5004
|
-
generation:
|
|
5005
|
-
seq:
|
|
5009
|
+
var workspaceReadyEventSchema = z34.object({
|
|
5010
|
+
generation: z34.string().min(1),
|
|
5011
|
+
seq: z34.number().int().nonnegative()
|
|
5006
5012
|
});
|
|
5007
|
-
var workspaceUsageEventSchema =
|
|
5013
|
+
var workspaceUsageEventSchema = z34.object({
|
|
5008
5014
|
project: projectStamp,
|
|
5009
|
-
usage:
|
|
5015
|
+
usage: z34.record(z34.string(), processUsageSchema)
|
|
5010
5016
|
});
|
|
5011
|
-
var runsIndexResponseSchema =
|
|
5017
|
+
var runsIndexResponseSchema = z34.object({
|
|
5012
5018
|
/** Newest first, across every registered project: each project's window
|
|
5013
5019
|
* (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
|
|
5014
5020
|
* archived root runs. Owned workers are never included. Older archived runs are reached
|
|
5015
5021
|
* through `GET /workspace/runs-search`. */
|
|
5016
|
-
runs:
|
|
5022
|
+
runs: z34.array(runIndexEntrySchema),
|
|
5017
5023
|
/** Additive: absent statuses mean "nothing warm", never "nothing to show". */
|
|
5018
5024
|
referenceStatuses: referenceStatusesByProjectSchema,
|
|
5019
5025
|
/** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
|
|
5020
|
-
perProjectLimit:
|
|
5026
|
+
perProjectLimit: z34.number(),
|
|
5021
5027
|
/** Ids of the projects that had more archived root runs than `perProjectLimit`. */
|
|
5022
|
-
truncated:
|
|
5028
|
+
truncated: z34.array(z34.string()),
|
|
5023
5029
|
/** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
|
|
5024
5030
|
* compares only within one generation. */
|
|
5025
|
-
generation:
|
|
5031
|
+
generation: z34.string().min(1),
|
|
5026
5032
|
/** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
|
|
5027
5033
|
* frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
|
|
5028
|
-
eventSeq:
|
|
5034
|
+
eventSeq: z34.number().int().nonnegative()
|
|
5029
5035
|
});
|
|
5030
5036
|
|
|
5031
5037
|
// ../contract/src/permissions.ts
|
|
5032
|
-
import { z as
|
|
5033
|
-
var permissionOptionKindSchema =
|
|
5034
|
-
var permissionOptionSchema =
|
|
5035
|
-
id:
|
|
5036
|
-
label:
|
|
5038
|
+
import { z as z35 } from "zod";
|
|
5039
|
+
var permissionOptionKindSchema = z35.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
|
|
5040
|
+
var permissionOptionSchema = z35.object({
|
|
5041
|
+
id: z35.string().min(1).max(128),
|
|
5042
|
+
label: z35.string().min(1),
|
|
5037
5043
|
kind: permissionOptionKindSchema
|
|
5038
5044
|
}).strict();
|
|
5039
|
-
var permissionRequestedSchema =
|
|
5040
|
-
type:
|
|
5041
|
-
requestId:
|
|
5042
|
-
itemId:
|
|
5043
|
-
title:
|
|
5044
|
-
details:
|
|
5045
|
-
options:
|
|
5045
|
+
var permissionRequestedSchema = z35.object({
|
|
5046
|
+
type: z35.literal("permission.requested"),
|
|
5047
|
+
requestId: z35.string().min(1).max(128),
|
|
5048
|
+
itemId: z35.string().optional(),
|
|
5049
|
+
title: z35.string().min(1),
|
|
5050
|
+
details: z35.string().optional(),
|
|
5051
|
+
options: z35.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
|
|
5046
5052
|
}).strict();
|
|
5047
|
-
var permissionResolvedSchema =
|
|
5048
|
-
type:
|
|
5049
|
-
requestId:
|
|
5050
|
-
optionId:
|
|
5051
|
-
reason:
|
|
5053
|
+
var permissionResolvedSchema = z35.object({
|
|
5054
|
+
type: z35.literal("permission.resolved"),
|
|
5055
|
+
requestId: z35.string().min(1).max(128),
|
|
5056
|
+
optionId: z35.string().optional(),
|
|
5057
|
+
reason: z35.string().optional()
|
|
5052
5058
|
}).strict();
|
|
5053
|
-
var permissionDecisionSchema =
|
|
5054
|
-
requestId:
|
|
5055
|
-
optionId:
|
|
5059
|
+
var permissionDecisionSchema = z35.object({
|
|
5060
|
+
requestId: z35.string().min(1).max(128),
|
|
5061
|
+
optionId: z35.string().min(1).max(128)
|
|
5056
5062
|
}).strict();
|
|
5057
|
-
var permissionDecisionResponseSchema =
|
|
5063
|
+
var permissionDecisionResponseSchema = z35.object({ delivered: z35.literal(true) });
|
|
5058
5064
|
|
|
5059
5065
|
// ../contract/src/defined.ts
|
|
5060
5066
|
function defined(value) {
|
|
@@ -5324,80 +5330,80 @@ function isImagePath(path) {
|
|
|
5324
5330
|
}
|
|
5325
5331
|
|
|
5326
5332
|
// ../contract/src/provider-requests.ts
|
|
5327
|
-
import { z as
|
|
5333
|
+
import { z as z36 } from "zod";
|
|
5328
5334
|
var PROVIDER_IDS = runnerSchema.options;
|
|
5329
|
-
var providerConnectSchema =
|
|
5330
|
-
provider:
|
|
5335
|
+
var providerConnectSchema = z36.object({
|
|
5336
|
+
provider: z36.enum(PROVIDER_IDS),
|
|
5331
5337
|
/** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
|
|
5332
5338
|
* default, which is what every pre-profiles client sends. Without this, "Connect" on a second
|
|
5333
5339
|
* Claude account would open a login for the FIRST one and report success. */
|
|
5334
|
-
profileId:
|
|
5340
|
+
profileId: z36.string().max(64).optional()
|
|
5335
5341
|
}).strict();
|
|
5336
|
-
var createAgentProfileSchema =
|
|
5337
|
-
provider:
|
|
5338
|
-
label:
|
|
5339
|
-
configDir:
|
|
5342
|
+
var createAgentProfileSchema = z36.object({
|
|
5343
|
+
provider: z36.enum(PROVIDER_IDS),
|
|
5344
|
+
label: z36.string().trim().max(200).optional(),
|
|
5345
|
+
configDir: z36.string().trim().min(1).max(4096)
|
|
5340
5346
|
}).strict();
|
|
5341
|
-
var updateAgentProfileSchema =
|
|
5342
|
-
label:
|
|
5343
|
-
configDir:
|
|
5347
|
+
var updateAgentProfileSchema = z36.object({
|
|
5348
|
+
label: z36.string().trim().max(200).optional(),
|
|
5349
|
+
configDir: z36.string().trim().min(1).max(4096).optional()
|
|
5344
5350
|
}).strict().refine(
|
|
5345
5351
|
(value) => value.label !== void 0 || value.configDir !== void 0,
|
|
5346
5352
|
"send label or configDir"
|
|
5347
5353
|
);
|
|
5348
|
-
var selectAgentProfileSchema =
|
|
5349
|
-
projectId:
|
|
5350
|
-
provider:
|
|
5351
|
-
profileId:
|
|
5354
|
+
var selectAgentProfileSchema = z36.object({
|
|
5355
|
+
projectId: z36.string().min(1).max(64),
|
|
5356
|
+
provider: z36.enum(PROVIDER_IDS),
|
|
5357
|
+
profileId: z36.string().max(64).nullable()
|
|
5352
5358
|
}).strict();
|
|
5353
|
-
var providerParamSchema =
|
|
5354
|
-
var providerEnabledSchema =
|
|
5355
|
-
var providerRetrySchema =
|
|
5356
|
-
authFailureId:
|
|
5359
|
+
var providerParamSchema = z36.enum(PROVIDER_IDS);
|
|
5360
|
+
var providerEnabledSchema = z36.object({ enabled: z36.boolean() }).strict();
|
|
5361
|
+
var providerRetrySchema = z36.object({
|
|
5362
|
+
authFailureId: z36.string().min(1).max(128)
|
|
5357
5363
|
}).strict();
|
|
5358
|
-
var providerRouteParamsSchema =
|
|
5359
|
-
var agentProfileRouteParamsSchema =
|
|
5364
|
+
var providerRouteParamsSchema = z36.object({ provider: providerParamSchema });
|
|
5365
|
+
var agentProfileRouteParamsSchema = z36.object({ id: z36.string() });
|
|
5360
5366
|
|
|
5361
5367
|
// ../contract/src/automation-requests.ts
|
|
5362
|
-
import { z as
|
|
5368
|
+
import { z as z38 } from "zod";
|
|
5363
5369
|
|
|
5364
5370
|
// ../contract/src/automation-storage.ts
|
|
5365
|
-
import { z as
|
|
5371
|
+
import { z as z37 } from "zod";
|
|
5366
5372
|
var RUNNER_IDS = runnerSchema.options;
|
|
5367
|
-
var storedAutomationEventSchema =
|
|
5373
|
+
var storedAutomationEventSchema = z37.enum([
|
|
5368
5374
|
"pull_request.opened",
|
|
5369
5375
|
"issue.opened",
|
|
5370
5376
|
"issue.labeled",
|
|
5371
5377
|
"issue.unlabeled"
|
|
5372
5378
|
]);
|
|
5373
|
-
var boundedString =
|
|
5374
|
-
var stringList =
|
|
5375
|
-
var storedAutomationFiltersSchema =
|
|
5376
|
-
includeExisting:
|
|
5379
|
+
var boundedString = z37.string().trim().min(1).max(200);
|
|
5380
|
+
var stringList = z37.array(boundedString).max(100).optional();
|
|
5381
|
+
var storedAutomationFiltersSchema = z37.object({
|
|
5382
|
+
includeExisting: z37.boolean().optional(),
|
|
5377
5383
|
/** Require an open item and matching live labels before reservation and launch. */
|
|
5378
|
-
requireCurrentLabels:
|
|
5384
|
+
requireCurrentLabels: z37.boolean().optional(),
|
|
5379
5385
|
authors: stringList,
|
|
5380
5386
|
assignees: stringList,
|
|
5381
5387
|
allLabels: stringList,
|
|
5382
5388
|
anyLabels: stringList,
|
|
5383
5389
|
excludeLabels: stringList,
|
|
5384
5390
|
changedLabels: stringList,
|
|
5385
|
-
lookbackDays:
|
|
5386
|
-
maxRecords:
|
|
5391
|
+
lookbackDays: z37.number().int().min(1).max(90).default(7),
|
|
5392
|
+
maxRecords: z37.number().int().min(1).max(100).default(25)
|
|
5387
5393
|
}).passthrough();
|
|
5388
|
-
var storedAutomationTaskSchema =
|
|
5389
|
-
prompt:
|
|
5390
|
-
workflow:
|
|
5391
|
-
steps:
|
|
5392
|
-
runner:
|
|
5393
|
-
model:
|
|
5394
|
-
effort:
|
|
5395
|
-
variants:
|
|
5396
|
-
worktree:
|
|
5397
|
-
autonomous:
|
|
5394
|
+
var storedAutomationTaskSchema = z37.object({
|
|
5395
|
+
prompt: z37.string().min(1).max(1e5),
|
|
5396
|
+
workflow: z37.string().trim().min(1).max(200).optional(),
|
|
5397
|
+
steps: z37.array(workflowStepDefSchema).min(1).max(100).optional(),
|
|
5398
|
+
runner: z37.enum(RUNNER_IDS).optional(),
|
|
5399
|
+
model: z37.string().trim().min(1).max(200).optional(),
|
|
5400
|
+
effort: z37.string().trim().min(1).max(32).optional(),
|
|
5401
|
+
variants: z37.union([z37.literal(1), z37.literal(2), z37.literal(3)]).optional(),
|
|
5402
|
+
worktree: z37.boolean().optional(),
|
|
5403
|
+
autonomous: z37.boolean().optional(),
|
|
5398
5404
|
...completionControlsShape,
|
|
5399
5405
|
...taskAccessShape,
|
|
5400
|
-
systemPrompt:
|
|
5406
|
+
systemPrompt: z37.string().max(1e5).optional()
|
|
5401
5407
|
}).passthrough().refine((task) => !(task.workflow && task.steps), {
|
|
5402
5408
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5403
5409
|
});
|
|
@@ -5411,122 +5417,122 @@ var fillGithubDefaults = (raw) => {
|
|
|
5411
5417
|
filters: record.filters ?? {}
|
|
5412
5418
|
};
|
|
5413
5419
|
};
|
|
5414
|
-
var storedAutomationDefinitionObjectSchema =
|
|
5415
|
-
id:
|
|
5416
|
-
revision:
|
|
5417
|
-
name:
|
|
5418
|
-
description:
|
|
5419
|
-
enabled:
|
|
5420
|
+
var storedAutomationDefinitionObjectSchema = z37.object({
|
|
5421
|
+
id: z37.string().min(1).max(100),
|
|
5422
|
+
revision: z37.number().int().positive(),
|
|
5423
|
+
name: z37.string().trim().min(1).max(200),
|
|
5424
|
+
description: z37.string().max(2e3).optional(),
|
|
5425
|
+
enabled: z37.boolean().default(false),
|
|
5420
5426
|
/** A definition written before schedules has no `kind`: it is a poll. */
|
|
5421
5427
|
kind: automationKindSchema.default("github"),
|
|
5422
|
-
events:
|
|
5423
|
-
intervalSeconds:
|
|
5428
|
+
events: z37.array(storedAutomationEventSchema).min(1).max(4).optional(),
|
|
5429
|
+
intervalSeconds: z37.number().int().min(60).max(86400).optional(),
|
|
5424
5430
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5425
5431
|
// Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
|
|
5426
5432
|
schedule: automationScheduleSchema.passthrough().optional(),
|
|
5427
5433
|
task: storedAutomationTaskSchema,
|
|
5428
5434
|
/** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
|
|
5429
|
-
archived:
|
|
5430
|
-
at:
|
|
5431
|
-
outcome:
|
|
5432
|
-
runId:
|
|
5433
|
-
receiptId:
|
|
5434
|
-
trigger:
|
|
5435
|
+
archived: z37.object({
|
|
5436
|
+
at: z37.string().datetime(),
|
|
5437
|
+
outcome: z37.enum(["launched", "cancelled"]),
|
|
5438
|
+
runId: z37.string().optional(),
|
|
5439
|
+
receiptId: z37.string().optional(),
|
|
5440
|
+
trigger: z37.enum(["schedule", "late", "manual", "retry"]).optional()
|
|
5435
5441
|
}).passthrough().optional(),
|
|
5436
|
-
createdAt:
|
|
5437
|
-
updatedAt:
|
|
5442
|
+
createdAt: z37.string().datetime(),
|
|
5443
|
+
updatedAt: z37.string().datetime()
|
|
5438
5444
|
}).passthrough().superRefine((definition, ctx) => {
|
|
5439
5445
|
if (definition.kind === "schedule") {
|
|
5440
5446
|
if (!definition.schedule) {
|
|
5441
|
-
ctx.addIssue({ code:
|
|
5447
|
+
ctx.addIssue({ code: z37.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
|
|
5442
5448
|
}
|
|
5443
5449
|
return;
|
|
5444
5450
|
}
|
|
5445
5451
|
if (!definition.events?.length) {
|
|
5446
|
-
ctx.addIssue({ code:
|
|
5452
|
+
ctx.addIssue({ code: z37.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
|
|
5447
5453
|
}
|
|
5448
5454
|
if (definition.intervalSeconds === void 0) {
|
|
5449
|
-
ctx.addIssue({ code:
|
|
5455
|
+
ctx.addIssue({ code: z37.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
|
|
5450
5456
|
}
|
|
5451
5457
|
if (!definition.filters) {
|
|
5452
|
-
ctx.addIssue({ code:
|
|
5458
|
+
ctx.addIssue({ code: z37.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
|
|
5453
5459
|
}
|
|
5454
5460
|
if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
|
|
5455
5461
|
ctx.addIssue({
|
|
5456
|
-
code:
|
|
5462
|
+
code: z37.ZodIssueCode.custom,
|
|
5457
5463
|
path: ["filters", "changedLabels"],
|
|
5458
5464
|
message: "changedLabels is required for issue label events"
|
|
5459
5465
|
});
|
|
5460
5466
|
}
|
|
5461
5467
|
});
|
|
5462
|
-
var storedAutomationDefinitionSchema =
|
|
5463
|
-
var storedAutomationDefinitionsFileSchema =
|
|
5464
|
-
version:
|
|
5465
|
-
automations:
|
|
5466
|
-
tombstones:
|
|
5468
|
+
var storedAutomationDefinitionSchema = z37.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
|
|
5469
|
+
var storedAutomationDefinitionsFileSchema = z37.object({
|
|
5470
|
+
version: z37.literal(1).default(1),
|
|
5471
|
+
automations: z37.array(z37.unknown()).default([]),
|
|
5472
|
+
tombstones: z37.record(z37.string(), z37.string().datetime()).optional()
|
|
5467
5473
|
}).passthrough();
|
|
5468
|
-
var storedAutomationCursorSchema =
|
|
5469
|
-
timestamp:
|
|
5470
|
-
tieBreaker:
|
|
5474
|
+
var storedAutomationCursorSchema = z37.object({
|
|
5475
|
+
timestamp: z37.string().datetime(),
|
|
5476
|
+
tieBreaker: z37.string().optional()
|
|
5471
5477
|
}).passthrough();
|
|
5472
5478
|
var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
|
|
5473
5479
|
cursor: storedAutomationCursorSchema.optional()
|
|
5474
5480
|
});
|
|
5475
|
-
var storedAutomationRuntimeStateSchema =
|
|
5476
|
-
revision:
|
|
5477
|
-
baselineAt:
|
|
5481
|
+
var storedAutomationRuntimeStateSchema = z37.object({
|
|
5482
|
+
revision: z37.number().int().positive().optional(),
|
|
5483
|
+
baselineAt: z37.string().datetime().optional(),
|
|
5478
5484
|
/** Arming time, independent of a history window's older lower bound. */
|
|
5479
|
-
armedAt:
|
|
5485
|
+
armedAt: z37.string().datetime().optional(),
|
|
5480
5486
|
historyScan: storedAutomationHistoryScanSchema.optional(),
|
|
5481
5487
|
cursor: storedAutomationCursorSchema.optional(),
|
|
5482
|
-
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5483
|
-
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker:
|
|
5484
|
-
nextCheckAt:
|
|
5485
|
-
lastSuccessAt:
|
|
5488
|
+
frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z37.string() }).optional(),
|
|
5489
|
+
backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z37.string() }).optional(),
|
|
5490
|
+
nextCheckAt: z37.string().datetime().optional(),
|
|
5491
|
+
lastSuccessAt: z37.string().datetime().optional(),
|
|
5486
5492
|
/** schedule kind: the next occurrence's instant and the last fired one's. */
|
|
5487
|
-
nextRunAt:
|
|
5488
|
-
lastRunAt:
|
|
5489
|
-
etags:
|
|
5490
|
-
backoffUntil:
|
|
5491
|
-
consecutiveFailures:
|
|
5493
|
+
nextRunAt: z37.string().datetime().optional(),
|
|
5494
|
+
lastRunAt: z37.string().datetime().optional(),
|
|
5495
|
+
etags: z37.record(z37.string(), z37.string()).optional(),
|
|
5496
|
+
backoffUntil: z37.string().datetime().optional(),
|
|
5497
|
+
consecutiveFailures: z37.number().int().nonnegative().optional(),
|
|
5492
5498
|
...automationLastErrorShape,
|
|
5493
5499
|
/** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
|
|
5494
|
-
onceOutcome:
|
|
5500
|
+
onceOutcome: z37.enum(["failed", "missed"]).optional()
|
|
5495
5501
|
}).passthrough();
|
|
5496
|
-
var storedAutomationStateFileSchema =
|
|
5497
|
-
version:
|
|
5498
|
-
states:
|
|
5502
|
+
var storedAutomationStateFileSchema = z37.object({
|
|
5503
|
+
version: z37.literal(1).default(1),
|
|
5504
|
+
states: z37.record(z37.string(), storedAutomationRuntimeStateSchema).default({})
|
|
5499
5505
|
}).passthrough();
|
|
5500
|
-
var storedAutomationReceiptSchema =
|
|
5501
|
-
receiptId:
|
|
5502
|
-
receiptKey:
|
|
5503
|
-
eventId:
|
|
5504
|
-
automationId:
|
|
5505
|
-
revision:
|
|
5506
|
-
status:
|
|
5507
|
-
runId:
|
|
5508
|
-
observedAt:
|
|
5509
|
-
updatedAt:
|
|
5510
|
-
error:
|
|
5506
|
+
var storedAutomationReceiptSchema = z37.object({
|
|
5507
|
+
receiptId: z37.string().min(1),
|
|
5508
|
+
receiptKey: z37.string().min(1),
|
|
5509
|
+
eventId: z37.string().min(1),
|
|
5510
|
+
automationId: z37.string().min(1),
|
|
5511
|
+
revision: z37.number().int().positive(),
|
|
5512
|
+
status: z37.enum(["reserved", "launched", "launch-error", "released"]),
|
|
5513
|
+
runId: z37.string().optional(),
|
|
5514
|
+
observedAt: z37.string().datetime(),
|
|
5515
|
+
updatedAt: z37.string().datetime(),
|
|
5516
|
+
error: z37.string().max(2e3).optional(),
|
|
5511
5517
|
/** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
|
|
5512
|
-
occurrenceAt:
|
|
5513
|
-
candidate:
|
|
5514
|
-
eventId:
|
|
5518
|
+
occurrenceAt: z37.string().datetime().optional(),
|
|
5519
|
+
candidate: z37.object({
|
|
5520
|
+
eventId: z37.string(),
|
|
5515
5521
|
event: storedAutomationEventSchema,
|
|
5516
|
-
timestamp:
|
|
5517
|
-
tieBreaker:
|
|
5518
|
-
repo:
|
|
5519
|
-
nodeId:
|
|
5520
|
-
number:
|
|
5521
|
-
title:
|
|
5522
|
-
url:
|
|
5523
|
-
author:
|
|
5524
|
-
assignees:
|
|
5525
|
-
labels:
|
|
5526
|
-
changedLabel:
|
|
5522
|
+
timestamp: z37.string().datetime(),
|
|
5523
|
+
tieBreaker: z37.string(),
|
|
5524
|
+
repo: z37.string(),
|
|
5525
|
+
nodeId: z37.string(),
|
|
5526
|
+
number: z37.number().int().positive(),
|
|
5527
|
+
title: z37.string().max(500),
|
|
5528
|
+
url: z37.string().url(),
|
|
5529
|
+
author: z37.string().max(200),
|
|
5530
|
+
assignees: z37.array(z37.string().max(200)).max(100),
|
|
5531
|
+
labels: z37.array(z37.string().max(200)).max(100),
|
|
5532
|
+
changedLabel: z37.string().max(200).optional()
|
|
5527
5533
|
}).passthrough().optional()
|
|
5528
5534
|
}).passthrough();
|
|
5529
|
-
var storedAutomationLogResultSchema =
|
|
5535
|
+
var storedAutomationLogResultSchema = z37.enum([
|
|
5530
5536
|
"launched",
|
|
5531
5537
|
"no-match",
|
|
5532
5538
|
"duplicate",
|
|
@@ -5542,24 +5548,24 @@ var storedAutomationLogResultSchema = z36.enum([
|
|
|
5542
5548
|
// once schedule
|
|
5543
5549
|
"missed"
|
|
5544
5550
|
]);
|
|
5545
|
-
var storedAutomationLogRecordSchema =
|
|
5546
|
-
seq:
|
|
5547
|
-
ts:
|
|
5548
|
-
automationId:
|
|
5549
|
-
revision:
|
|
5551
|
+
var storedAutomationLogRecordSchema = z37.object({
|
|
5552
|
+
seq: z37.number().int().positive(),
|
|
5553
|
+
ts: z37.string().datetime(),
|
|
5554
|
+
automationId: z37.string().min(1),
|
|
5555
|
+
revision: z37.number().int().positive(),
|
|
5550
5556
|
event: storedAutomationEventSchema.optional(),
|
|
5551
5557
|
result: storedAutomationLogResultSchema,
|
|
5552
|
-
reason:
|
|
5553
|
-
durationMs:
|
|
5554
|
-
receiptId:
|
|
5555
|
-
runId:
|
|
5556
|
-
githubNumber:
|
|
5557
|
-
githubTitle:
|
|
5558
|
-
githubUrl:
|
|
5559
|
-
rateLimit:
|
|
5560
|
-
bucket:
|
|
5561
|
-
remaining:
|
|
5562
|
-
resetAt:
|
|
5558
|
+
reason: z37.string().max(2e3).optional(),
|
|
5559
|
+
durationMs: z37.number().int().nonnegative().optional(),
|
|
5560
|
+
receiptId: z37.string().optional(),
|
|
5561
|
+
runId: z37.string().optional(),
|
|
5562
|
+
githubNumber: z37.number().int().positive().optional(),
|
|
5563
|
+
githubTitle: z37.string().max(500).optional(),
|
|
5564
|
+
githubUrl: z37.string().url().optional(),
|
|
5565
|
+
rateLimit: z37.object({
|
|
5566
|
+
bucket: z37.enum(["core", "search"]),
|
|
5567
|
+
remaining: z37.number().int().nonnegative().optional(),
|
|
5568
|
+
resetAt: z37.string().datetime().optional()
|
|
5563
5569
|
}).passthrough().optional()
|
|
5564
5570
|
}).passthrough();
|
|
5565
5571
|
function storedIsOnceSchedule(definition) {
|
|
@@ -5573,207 +5579,207 @@ function storedIsScheduleAutomation(definition) {
|
|
|
5573
5579
|
}
|
|
5574
5580
|
|
|
5575
5581
|
// ../contract/src/automation-requests.ts
|
|
5576
|
-
var automationEditableSchema =
|
|
5577
|
-
name:
|
|
5578
|
-
description:
|
|
5579
|
-
enabled:
|
|
5582
|
+
var automationEditableSchema = z38.object({
|
|
5583
|
+
name: z38.string().trim().min(1).max(200),
|
|
5584
|
+
description: z38.string().max(2e3).optional(),
|
|
5585
|
+
enabled: z38.boolean().optional(),
|
|
5580
5586
|
kind: automationKindSchema.optional(),
|
|
5581
|
-
events:
|
|
5582
|
-
intervalSeconds:
|
|
5587
|
+
events: z38.array(automationEventSchema).min(1).max(4).optional(),
|
|
5588
|
+
intervalSeconds: z38.number().int().min(60).max(86400).optional(),
|
|
5583
5589
|
filters: storedAutomationFiltersSchema.optional(),
|
|
5584
5590
|
schedule: automationScheduleSchema.optional(),
|
|
5585
|
-
task:
|
|
5591
|
+
task: z38.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
|
|
5586
5592
|
message: "task selects either a named workflow or inline steps, not both"
|
|
5587
5593
|
})
|
|
5588
5594
|
}).strict();
|
|
5589
|
-
var automationCreateSchema = automationEditableSchema.extend({ enable:
|
|
5590
|
-
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision:
|
|
5591
|
-
var automationCheckRequestSchema =
|
|
5592
|
-
var automationLogQuerySchema =
|
|
5593
|
-
automationId:
|
|
5595
|
+
var automationCreateSchema = automationEditableSchema.extend({ enable: z38.boolean().optional() });
|
|
5596
|
+
var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z38.number().int().positive() });
|
|
5597
|
+
var automationCheckRequestSchema = z38.object({ mode: z38.enum(["preview", "execute"]) }).strict();
|
|
5598
|
+
var automationLogQuerySchema = z38.object({
|
|
5599
|
+
automationId: z38.string().optional(),
|
|
5594
5600
|
result: automationLogResultSchema.optional(),
|
|
5595
5601
|
event: automationEventSchema.optional(),
|
|
5596
|
-
since:
|
|
5597
|
-
cursor:
|
|
5602
|
+
since: z38.string().datetime().optional(),
|
|
5603
|
+
cursor: z38.coerce.number().int().positive().optional(),
|
|
5598
5604
|
// Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
|
|
5599
5605
|
// 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
|
|
5600
5606
|
// request type `queryZodValidator` publishes (see validators.ts on why the request side falls
|
|
5601
5607
|
// back to the schema's output), which would have made every caller send a `?limit=` this route
|
|
5602
5608
|
// never needed.
|
|
5603
|
-
limit:
|
|
5609
|
+
limit: z38.coerce.number().int().min(1).max(100).optional()
|
|
5604
5610
|
});
|
|
5605
5611
|
|
|
5606
5612
|
// ../contract/src/workflow-requests.ts
|
|
5607
|
-
import { z as
|
|
5608
|
-
var planSchema =
|
|
5613
|
+
import { z as z39 } from "zod";
|
|
5614
|
+
var planSchema = z39.object({
|
|
5609
5615
|
// Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
|
|
5610
|
-
task:
|
|
5616
|
+
task: z39.string().trim().min(1).max(1e5, "must be at most 100000 characters")
|
|
5611
5617
|
});
|
|
5612
|
-
var parseWorkflowSchema =
|
|
5613
|
-
yaml:
|
|
5618
|
+
var parseWorkflowSchema = z39.object({
|
|
5619
|
+
yaml: z39.string().min(1).max(1e5)
|
|
5614
5620
|
});
|
|
5615
5621
|
|
|
5616
5622
|
// ../contract/src/ui-state-requests.ts
|
|
5617
|
-
import { z as
|
|
5623
|
+
import { z as z40 } from "zod";
|
|
5618
5624
|
var SKILL_USAGE_MAX_ENTRIES = 200;
|
|
5619
5625
|
var UI_STATE_MAX_KEYS = 200;
|
|
5620
5626
|
var uiStateSchema2 = uiStateSchema.extend({
|
|
5621
5627
|
// null records a quick task with no selected skill or workflow.
|
|
5622
|
-
lastTask:
|
|
5623
|
-
source:
|
|
5624
|
-
ref:
|
|
5628
|
+
lastTask: z40.object({
|
|
5629
|
+
source: z40.enum(["workflow", "skill"]),
|
|
5630
|
+
ref: z40.string().min(1).max(200)
|
|
5625
5631
|
}).nullable().optional(),
|
|
5626
5632
|
// Most recent source choices, newest first.
|
|
5627
|
-
recentSources:
|
|
5628
|
-
|
|
5629
|
-
source:
|
|
5630
|
-
ref:
|
|
5633
|
+
recentSources: z40.array(
|
|
5634
|
+
z40.object({
|
|
5635
|
+
source: z40.enum(["workflow", "skill"]),
|
|
5636
|
+
ref: z40.string().min(1).max(200)
|
|
5631
5637
|
})
|
|
5632
5638
|
).max(50).optional(),
|
|
5633
|
-
skillUsage:
|
|
5639
|
+
skillUsage: z40.record(z40.string().min(1).max(200), z40.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
|
|
5634
5640
|
message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
|
|
5635
5641
|
}).optional(),
|
|
5636
|
-
promptTemplates:
|
|
5637
|
-
|
|
5638
|
-
id:
|
|
5639
|
-
label:
|
|
5640
|
-
text:
|
|
5642
|
+
promptTemplates: z40.array(
|
|
5643
|
+
z40.object({
|
|
5644
|
+
id: z40.string().min(1).max(64),
|
|
5645
|
+
label: z40.string().trim().min(1).max(80),
|
|
5646
|
+
text: z40.string().trim().min(1).max(2e3),
|
|
5641
5647
|
// Skill names this template auto-applies for. Optional and additive: templates
|
|
5642
5648
|
// written before this key existed keep validating, and stay manual-only.
|
|
5643
|
-
skills:
|
|
5649
|
+
skills: z40.array(z40.string().trim().min(1).max(200)).max(50).optional()
|
|
5644
5650
|
})
|
|
5645
5651
|
).max(50).optional()
|
|
5646
5652
|
}).passthrough();
|
|
5647
5653
|
function capUiStateKeys(data, ctx) {
|
|
5648
5654
|
if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
|
|
5649
|
-
ctx.addIssue({ code:
|
|
5655
|
+
ctx.addIssue({ code: z40.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
|
|
5650
5656
|
}
|
|
5651
5657
|
}
|
|
5652
5658
|
var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
|
|
5653
5659
|
|
|
5654
5660
|
// ../contract/src/run-requests.ts
|
|
5655
|
-
import { z as
|
|
5661
|
+
import { z as z41 } from "zod";
|
|
5656
5662
|
var RUNNER_IDS2 = runnerSchema.options;
|
|
5657
|
-
var queuedMessagePatchSchema =
|
|
5658
|
-
text:
|
|
5659
|
-
images:
|
|
5663
|
+
var queuedMessagePatchSchema = z41.object({
|
|
5664
|
+
text: z41.string().max(1e5).optional(),
|
|
5665
|
+
images: z41.array(attachmentInputSchema).max(4).optional()
|
|
5660
5666
|
}).refine((m) => m.text !== void 0 || m.images !== void 0, {
|
|
5661
5667
|
message: "message edit needs text or attachments"
|
|
5662
5668
|
});
|
|
5663
|
-
var continueSchema =
|
|
5664
|
-
text:
|
|
5665
|
-
images:
|
|
5666
|
-
runner:
|
|
5667
|
-
model:
|
|
5669
|
+
var continueSchema = z41.object({
|
|
5670
|
+
text: z41.string().max(1e5, "must be at most 100000 characters").optional(),
|
|
5671
|
+
images: z41.array(attachmentInputSchema).max(4).optional(),
|
|
5672
|
+
runner: z41.enum(RUNNER_IDS2).optional(),
|
|
5673
|
+
model: z41.string().max(200).optional(),
|
|
5668
5674
|
/** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
|
|
5669
|
-
effort:
|
|
5675
|
+
effort: z41.string().max(32).optional()
|
|
5670
5676
|
});
|
|
5671
|
-
var archiveSchema =
|
|
5672
|
-
archived:
|
|
5677
|
+
var archiveSchema = z41.object({
|
|
5678
|
+
archived: z41.boolean().optional()
|
|
5673
5679
|
});
|
|
5674
|
-
var openInSchema =
|
|
5680
|
+
var openInSchema = z41.object({
|
|
5675
5681
|
// A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
|
|
5676
|
-
target:
|
|
5677
|
-
path:
|
|
5682
|
+
target: z41.string().trim().min(1, "target required").max(200),
|
|
5683
|
+
path: z41.string().max(1e3).optional()
|
|
5678
5684
|
});
|
|
5679
5685
|
|
|
5680
5686
|
// ../contract/src/query-requests.ts
|
|
5681
|
-
import { z as
|
|
5682
|
-
var queryValue =
|
|
5683
|
-
var refreshQuery =
|
|
5684
|
-
var waitQuery =
|
|
5685
|
-
var modelDiscoveryQuerySchema =
|
|
5686
|
-
var strictRefreshQuerySchema =
|
|
5687
|
-
var browseQuerySchema =
|
|
5688
|
-
var worktreeFilesQuerySchema =
|
|
5689
|
-
var commitQuerySchema =
|
|
5687
|
+
import { z as z42 } from "zod";
|
|
5688
|
+
var queryValue = z42.union([z42.string(), z42.array(z42.string()).transform((v) => v[0])]).optional();
|
|
5689
|
+
var refreshQuery = z42.object({ refresh: queryValue });
|
|
5690
|
+
var waitQuery = z42.object({ wait: queryValue });
|
|
5691
|
+
var modelDiscoveryQuerySchema = z42.object({ runner: z42.union([z42.string(), z42.array(z42.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema) });
|
|
5692
|
+
var strictRefreshQuerySchema = z42.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
5693
|
+
var browseQuerySchema = z42.object({ path: queryValue, showHidden: queryValue });
|
|
5694
|
+
var worktreeFilesQuerySchema = z42.object({ path: queryValue, raw: queryValue });
|
|
5695
|
+
var commitQuerySchema = z42.object({ structured: queryValue });
|
|
5690
5696
|
|
|
5691
5697
|
// ../contract/src/github-requests.ts
|
|
5692
|
-
import { z as
|
|
5693
|
-
var mergeNumberParams =
|
|
5694
|
-
var prChangesParams =
|
|
5695
|
-
var prChangesQuery =
|
|
5696
|
-
var mergeBodySchema =
|
|
5697
|
-
method:
|
|
5698
|
-
expectedHeadSha:
|
|
5699
|
-
overrideRules:
|
|
5698
|
+
import { z as z43 } from "zod";
|
|
5699
|
+
var mergeNumberParams = z43.object({ number: z43.coerce.number().int().positive() });
|
|
5700
|
+
var prChangesParams = z43.object({ number: z43.coerce.number().int().positive().safe() });
|
|
5701
|
+
var prChangesQuery = z43.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
|
|
5702
|
+
var mergeBodySchema = z43.object({
|
|
5703
|
+
method: z43.enum(["merge", "squash", "rebase"]),
|
|
5704
|
+
expectedHeadSha: z43.string().regex(/^[0-9a-f]{40}$/),
|
|
5705
|
+
overrideRules: z43.boolean().optional().default(false)
|
|
5700
5706
|
}).strict();
|
|
5701
|
-
var githubChecksQuerySchema =
|
|
5702
|
-
var githubRefsQuerySchema =
|
|
5707
|
+
var githubChecksQuerySchema = z43.object({ prs: z43.string().min(1) });
|
|
5708
|
+
var githubRefsQuerySchema = z43.object({ prs: z43.string().optional(), issues: z43.string().optional() });
|
|
5703
5709
|
|
|
5704
5710
|
// ../contract/src/repo-requests.ts
|
|
5705
|
-
import { z as
|
|
5706
|
-
var gitCommitSchema =
|
|
5707
|
-
message:
|
|
5711
|
+
import { z as z44 } from "zod";
|
|
5712
|
+
var gitCommitSchema = z44.object({
|
|
5713
|
+
message: z44.string().trim().min(1, "must not be empty").max(5e3)
|
|
5708
5714
|
});
|
|
5709
|
-
var reclaimBodySchema =
|
|
5710
|
-
var repoBranchSchema =
|
|
5711
|
-
name:
|
|
5712
|
-
from:
|
|
5715
|
+
var reclaimBodySchema = z44.object({}).passthrough();
|
|
5716
|
+
var repoBranchSchema = z44.object({
|
|
5717
|
+
name: z44.string().trim().min(1).max(200),
|
|
5718
|
+
from: z44.string().trim().min(1).max(200).optional()
|
|
5713
5719
|
});
|
|
5714
|
-
var reclaimRunParamsSchema =
|
|
5720
|
+
var reclaimRunParamsSchema = z44.object({ runId: z44.string().min(1) });
|
|
5715
5721
|
|
|
5716
5722
|
// ../contract/src/config-requests.ts
|
|
5717
|
-
import { z as
|
|
5723
|
+
import { z as z45 } from "zod";
|
|
5718
5724
|
var setConfigSchema = setConfigInputSchema.extend({
|
|
5719
|
-
systemPrompt:
|
|
5725
|
+
systemPrompt: z45.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
|
|
5720
5726
|
});
|
|
5721
|
-
var setAgentConfigSchema =
|
|
5722
|
-
content:
|
|
5723
|
-
version:
|
|
5727
|
+
var setAgentConfigSchema = z45.object({
|
|
5728
|
+
content: z45.string().max(2e6),
|
|
5729
|
+
version: z45.string().nullable()
|
|
5724
5730
|
});
|
|
5725
5731
|
|
|
5726
5732
|
// ../contract/src/workflow-file.ts
|
|
5727
|
-
import { z as
|
|
5728
|
-
var workflowFileSchema =
|
|
5729
|
-
name:
|
|
5730
|
-
description:
|
|
5731
|
-
steps:
|
|
5732
|
-
skills:
|
|
5733
|
+
import { z as z46 } from "zod";
|
|
5734
|
+
var workflowFileSchema = z46.object({
|
|
5735
|
+
name: z46.string().min(1),
|
|
5736
|
+
description: z46.string().optional(),
|
|
5737
|
+
steps: z46.array(workflowStepDefSchema).min(1).optional(),
|
|
5738
|
+
skills: z46.array(z46.string().trim().min(1)).min(1).optional()
|
|
5733
5739
|
}).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
|
|
5734
5740
|
message: 'a workflow lists either "steps" or "skills", not both'
|
|
5735
5741
|
});
|
|
5736
5742
|
|
|
5737
5743
|
// ../contract/src/reports.ts
|
|
5738
|
-
import { z as
|
|
5744
|
+
import { z as z47 } from "zod";
|
|
5739
5745
|
var REPORTS_QUERY_MAX = 1e3;
|
|
5740
|
-
var cursorSchema =
|
|
5741
|
-
var reportsQuerySchema =
|
|
5742
|
-
q:
|
|
5746
|
+
var cursorSchema = z47.string().min(1).max(1024);
|
|
5747
|
+
var reportsQuerySchema = z47.object({
|
|
5748
|
+
q: z47.string().max(REPORTS_QUERY_MAX).optional(),
|
|
5743
5749
|
before: cursorSchema.optional(),
|
|
5744
|
-
limit:
|
|
5750
|
+
limit: z47.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
|
|
5745
5751
|
}).strict();
|
|
5746
|
-
var reportSchema =
|
|
5747
|
-
id:
|
|
5748
|
-
runId:
|
|
5749
|
-
name:
|
|
5750
|
-
title:
|
|
5751
|
-
createdAt:
|
|
5752
|
-
size:
|
|
5753
|
-
taskTitle:
|
|
5752
|
+
var reportSchema = z47.object({
|
|
5753
|
+
id: z47.uuid(),
|
|
5754
|
+
runId: z47.uuid(),
|
|
5755
|
+
name: z47.string(),
|
|
5756
|
+
title: z47.string(),
|
|
5757
|
+
createdAt: z47.iso.datetime(),
|
|
5758
|
+
size: z47.number().int().nonnegative(),
|
|
5759
|
+
taskTitle: z47.string(),
|
|
5754
5760
|
taskStatus: runStatusSchema
|
|
5755
5761
|
}).strict();
|
|
5756
|
-
var reportsResponseSchema =
|
|
5757
|
-
reports:
|
|
5762
|
+
var reportsResponseSchema = z47.object({
|
|
5763
|
+
reports: z47.array(reportSchema),
|
|
5758
5764
|
nextCursor: cursorSchema.nullable(),
|
|
5759
5765
|
// Counts all matching cached rows with readable source summaries before page content checks.
|
|
5760
5766
|
// A missing-content row dropped while filling this page can lower total on the next request.
|
|
5761
|
-
total:
|
|
5767
|
+
total: z47.number().int().nonnegative()
|
|
5762
5768
|
}).strict();
|
|
5763
|
-
var reportsStateSchema =
|
|
5764
|
-
epoch:
|
|
5765
|
-
generation:
|
|
5766
|
-
metadataGeneration:
|
|
5769
|
+
var reportsStateSchema = z47.object({
|
|
5770
|
+
epoch: z47.uuid(),
|
|
5771
|
+
generation: z47.number().int().nonnegative(),
|
|
5772
|
+
metadataGeneration: z47.number().int().nonnegative()
|
|
5767
5773
|
}).strict();
|
|
5768
|
-
var reportsMetadataSchema =
|
|
5769
|
-
runId:
|
|
5770
|
-
taskTitle:
|
|
5774
|
+
var reportsMetadataSchema = z47.object({
|
|
5775
|
+
runId: z47.uuid(),
|
|
5776
|
+
taskTitle: z47.string(),
|
|
5771
5777
|
taskStatus: runStatusSchema
|
|
5772
5778
|
}).strict();
|
|
5773
|
-
var reportsFrameSchema =
|
|
5774
|
-
reportsStateSchema.extend({ type:
|
|
5775
|
-
reportsStateSchema.extend({ type:
|
|
5776
|
-
reportsStateSchema.extend({ type:
|
|
5779
|
+
var reportsFrameSchema = z47.discriminatedUnion("type", [
|
|
5780
|
+
reportsStateSchema.extend({ type: z47.literal("snapshot") }),
|
|
5781
|
+
reportsStateSchema.extend({ type: z47.literal("content") }),
|
|
5782
|
+
reportsStateSchema.extend({ type: z47.literal("metadata"), runs: z47.array(reportsMetadataSchema) })
|
|
5777
5783
|
]);
|
|
5778
5784
|
|
|
5779
5785
|
// ../contract/src/report-title.ts
|
|
@@ -5795,75 +5801,75 @@ function controlLocation(control, separator = " \u2192 ") {
|
|
|
5795
5801
|
}
|
|
5796
5802
|
|
|
5797
5803
|
// ../contract/src/home-recovery.ts
|
|
5798
|
-
import { z as
|
|
5804
|
+
import { z as z48 } from "zod";
|
|
5799
5805
|
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))$/;
|
|
5800
|
-
var homeFileSchema =
|
|
5801
|
-
var recoveryFile =
|
|
5806
|
+
var homeFileSchema = z48.string().regex(HOME_FILE_PATTERN);
|
|
5807
|
+
var recoveryFile = z48.object({
|
|
5802
5808
|
file: homeFileSchema,
|
|
5803
|
-
detectedAt:
|
|
5804
|
-
canRestore:
|
|
5809
|
+
detectedAt: z48.iso.datetime(),
|
|
5810
|
+
canRestore: z48.boolean()
|
|
5805
5811
|
});
|
|
5806
5812
|
var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
|
|
5807
|
-
var homeRecoveryFileSchema =
|
|
5808
|
-
recoveryFile.extend({ reason:
|
|
5809
|
-
recoveryFile.extend({ reason:
|
|
5810
|
-
recoveryFile.extend({ reason:
|
|
5813
|
+
var homeRecoveryFileSchema = z48.discriminatedUnion("reason", [
|
|
5814
|
+
recoveryFile.extend({ reason: z48.literal("reset") }),
|
|
5815
|
+
recoveryFile.extend({ reason: z48.literal("outside-write") }),
|
|
5816
|
+
recoveryFile.extend({ reason: z48.literal("legacy-change"), canImport: z48.boolean() })
|
|
5811
5817
|
]);
|
|
5812
|
-
var homeRecoverySchema =
|
|
5818
|
+
var homeRecoverySchema = z48.object({ files: z48.array(homeRecoveryFileSchema) });
|
|
5813
5819
|
function filterHomeRecoveryReasons(value, reasons) {
|
|
5814
5820
|
if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
|
|
5815
5821
|
return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
|
|
5816
5822
|
}
|
|
5817
|
-
var homeRecoveryReaderSchema =
|
|
5823
|
+
var homeRecoveryReaderSchema = z48.preprocess(
|
|
5818
5824
|
(value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
|
|
5819
5825
|
homeRecoverySchema
|
|
5820
5826
|
);
|
|
5821
|
-
var homeRecoveryActionSchema =
|
|
5827
|
+
var homeRecoveryActionSchema = z48.object({ file: homeFileSchema, detectedAt: z48.iso.datetime() }).strict();
|
|
5822
5828
|
|
|
5823
5829
|
// ../contract/src/runner-skills.ts
|
|
5824
|
-
import { z as
|
|
5825
|
-
var runnerSkillScopeSchema =
|
|
5826
|
-
var runnerSkillsQuerySchema =
|
|
5830
|
+
import { z as z49 } from "zod";
|
|
5831
|
+
var runnerSkillScopeSchema = z49.enum(["repo", "user", "system", "other"]);
|
|
5832
|
+
var runnerSkillsQuerySchema = z49.object({
|
|
5827
5833
|
runner: runnerSchema,
|
|
5828
|
-
account:
|
|
5829
|
-
refresh:
|
|
5834
|
+
account: z49.string().min(1).max(64).optional(),
|
|
5835
|
+
refresh: z49.literal("1").optional()
|
|
5830
5836
|
});
|
|
5831
|
-
var runnerSkillSchema =
|
|
5832
|
-
id:
|
|
5833
|
-
name:
|
|
5834
|
-
description:
|
|
5837
|
+
var runnerSkillSchema = z49.object({
|
|
5838
|
+
id: z49.string(),
|
|
5839
|
+
name: z49.string(),
|
|
5840
|
+
description: z49.string().optional(),
|
|
5835
5841
|
scope: runnerSkillScopeSchema.optional(),
|
|
5836
|
-
plugin:
|
|
5837
|
-
path:
|
|
5842
|
+
plugin: z49.string().optional(),
|
|
5843
|
+
path: z49.string().optional()
|
|
5838
5844
|
});
|
|
5839
|
-
var runnerSkillProblemSchema =
|
|
5840
|
-
var runnerSkillListSchema =
|
|
5845
|
+
var runnerSkillProblemSchema = z49.object({ message: z49.string(), path: z49.string().optional() });
|
|
5846
|
+
var runnerSkillListSchema = z49.object({
|
|
5841
5847
|
runner: runnerSchema,
|
|
5842
|
-
skills:
|
|
5843
|
-
problems:
|
|
5844
|
-
source:
|
|
5845
|
-
reason:
|
|
5848
|
+
skills: z49.array(runnerSkillSchema),
|
|
5849
|
+
problems: z49.array(runnerSkillProblemSchema),
|
|
5850
|
+
source: z49.enum(["live", "cache", "unavailable"]),
|
|
5851
|
+
reason: z49.string().optional()
|
|
5846
5852
|
});
|
|
5847
5853
|
|
|
5848
5854
|
// ../contract/src/automation-tool.ts
|
|
5849
|
-
import { z as
|
|
5855
|
+
import { z as z50 } from "zod";
|
|
5850
5856
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
5851
|
-
var id =
|
|
5852
|
-
var automationToolRequestSchema =
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
+
var id = z50.string().min(1).max(100);
|
|
5858
|
+
var automationToolRequestSchema = z50.discriminatedUnion("action", [
|
|
5859
|
+
z50.object({ action: z50.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
5860
|
+
z50.object({ action: z50.literal("show"), id }).strict(),
|
|
5861
|
+
z50.object({ action: z50.literal("preview"), id }).strict(),
|
|
5862
|
+
z50.object({ action: z50.literal("enable"), id, explicit: z50.boolean().optional() }).strict()
|
|
5857
5863
|
]);
|
|
5858
|
-
var automationToolAnswerSchema =
|
|
5859
|
-
|
|
5860
|
-
ok:
|
|
5864
|
+
var automationToolAnswerSchema = z50.union([
|
|
5865
|
+
z50.object({
|
|
5866
|
+
ok: z50.literal(true),
|
|
5861
5867
|
automation: storedAutomationDefinitionSchema,
|
|
5862
|
-
url:
|
|
5863
|
-
next_run_at:
|
|
5864
|
-
preview:
|
|
5868
|
+
url: z50.string().optional(),
|
|
5869
|
+
next_run_at: z50.string().optional(),
|
|
5870
|
+
preview: z50.object({ matches: z50.number().int().nonnegative(), truncated: z50.boolean() }).optional()
|
|
5865
5871
|
}),
|
|
5866
|
-
|
|
5872
|
+
z50.object({ ok: z50.literal(false), code: z50.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z50.string() })
|
|
5867
5873
|
]);
|
|
5868
5874
|
export {
|
|
5869
5875
|
ACTIVITY_CHECKS_MAX,
|