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