@hearsay-tools/squawk 0.18.0-dev.8461 → 0.18.0-dev.8472

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.
Files changed (119) hide show
  1. package/dist/contract/index.d.ts +1 -0
  2. package/dist/contract/index.js +866 -804
  3. package/dist/contract/session-context.d.ts +94 -0
  4. package/dist/contract/utf8.d.ts +2 -0
  5. package/dist/delegation/routes.d.ts +4 -4
  6. package/dist/runners/claude/claude-cli-runner.d.ts +2 -0
  7. package/dist/runners/claude/claude-cli-runner.js +6 -1
  8. package/dist/runners/claude/claude-cli-runner.js.map +1 -1
  9. package/dist/runners/claude/claude-partial-messages.d.ts +32 -0
  10. package/dist/runners/claude/claude-partial-messages.js +129 -0
  11. package/dist/runners/claude/claude-partial-messages.js.map +1 -0
  12. package/dist/runners/claude/claude-stream.d.ts +1 -0
  13. package/dist/runners/claude/claude-stream.js +32 -1
  14. package/dist/runners/claude/claude-stream.js.map +1 -1
  15. package/dist/runners/claude/claude-ui-mapper.d.ts +2 -1
  16. package/dist/runners/claude/claude-ui-mapper.js +14 -2
  17. package/dist/runners/claude/claude-ui-mapper.js.map +1 -1
  18. package/dist/runs/run-exits.d.ts +336 -336
  19. package/dist/server/activity-routes.d.ts +23 -23
  20. package/dist/server/models-routes.d.ts +12 -12
  21. package/dist/server/providers-routes.d.ts +57 -57
  22. package/dist/server/repo-routes.d.ts +34 -34
  23. package/dist/server/reports-api.d.ts +2 -2
  24. package/dist/server/runs-routes.d.ts +16 -16
  25. package/dist/server/server.d.ts +817 -655
  26. package/dist/server/server.js +3 -1
  27. package/dist/server/server.js.map +1 -1
  28. package/dist/server/session-context-routes.d.ts +88 -0
  29. package/dist/server/session-context-routes.js +26 -0
  30. package/dist/server/session-context-routes.js.map +1 -0
  31. package/dist/server/workspace-routes.d.ts +84 -84
  32. package/dist/session-context-file.d.ts +11 -0
  33. package/dist/session-context-file.js +144 -0
  34. package/dist/session-context-file.js.map +1 -0
  35. package/dist/session-context.d.ts +48 -0
  36. package/dist/session-context.js +180 -19
  37. package/dist/session-context.js.map +1 -1
  38. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  39. package/dist/workflows/run/wait-kinds.d.ts +52 -52
  40. package/package.json +4 -4
  41. package/web/dist/assets/accounts-section-CuihHvuE.js +1 -0
  42. package/web/dist/assets/activity-motion-bKmIl_Ai.js +2 -0
  43. package/web/dist/assets/{activity-route-BAGYVlk1.js → activity-route-Bnz_NdUs.js} +1 -1
  44. package/web/dist/assets/agent-config-section-uQrQrvBR.js +1 -0
  45. package/web/dist/assets/agent-defaults-section-1UTSo5HV.js +1 -0
  46. package/web/dist/assets/{appearance-Bbmz3RPP.js → appearance-CZ0kce28.js} +1 -1
  47. package/web/dist/assets/{archive-on-merge-field-BHtW_R72.js → archive-on-merge-field-CEyCpweg.js} +1 -1
  48. package/web/dist/assets/attention-BFUaj1mU.js +1 -0
  49. package/web/dist/assets/automations-route-Dq90emTh.js +1 -0
  50. package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
  51. package/web/dist/assets/{commit-diff-panel-CR9lCdYd.js → commit-diff-panel-Btc38N2Q.js} +1 -1
  52. package/web/dist/assets/{diff-BUihlcHW.js → diff-C3-63Zgu.js} +2 -2
  53. package/web/dist/assets/{diff-view-Dy1iZUpI.js → diff-view-D2O2Nm5P.js} +1 -1
  54. package/web/dist/assets/file-preview-Bnq2OKGK.js +2 -0
  55. package/web/dist/assets/{folder-browser-OPEKYHN1.js → folder-browser-Bn83Rjyn.js} +1 -1
  56. package/web/dist/assets/{git-toolbar-CUQ8veXw.js → git-toolbar-RA8rF90D.js} +1 -1
  57. package/web/dist/assets/{github-ClGhwLM1.js → github-BRAMTLRU.js} +1 -1
  58. package/web/dist/assets/{global-activity-route-DzdSy7Wm.js → global-activity-route-Ii_-Fqqo.js} +1 -1
  59. package/web/dist/assets/index-2DP8fWMQ.css +1 -0
  60. package/web/dist/assets/index-DCw_bX8I.js +21 -0
  61. package/web/dist/assets/{label-Cptt_zCn.js → label-tOtTf55G.js} +1 -1
  62. package/web/dist/assets/{live-reads-jRSHgWlx.js → live-reads-CR3-q01w.js} +1 -1
  63. package/web/dist/assets/{markdown-DvutydYG.js → markdown-G8tjpJd_.js} +1 -1
  64. package/web/dist/assets/{notifications-section-BAqEIyDN.js → notifications-section-Fk_ebhy_.js} +1 -1
  65. package/web/dist/assets/{open-in-menu-ytsrlsSn.js → open-in-menu-xzDJ4_Tv.js} +1 -1
  66. package/web/dist/assets/plus-CxRU2X8C.js +1 -0
  67. package/web/dist/assets/{preview-pane-connected-BU0pxY0y.js → preview-pane-connected-8HkdMxOW.js} +2 -2
  68. package/web/dist/assets/{project-location-BIWHn5XU.js → project-location-C9WLgY3A.js} +1 -1
  69. package/web/dist/assets/{project-router-CWwXAsqF.js → project-router-DucFIl_x.js} +1 -1
  70. package/web/dist/assets/{project-scope-context-Dq-Iq7xE.js → project-scope-context-C912rTJP.js} +2 -2
  71. package/web/dist/assets/{projects-section-DbCjlMOl.js → projects-section-Dmj4JFoi.js} +1 -1
  72. package/web/dist/assets/{prompt-templates-section-BsAYf057.js → prompt-templates-section-DzfD2GES.js} +1 -1
  73. package/web/dist/assets/queries-DRpvYgai.js +1 -0
  74. package/web/dist/assets/{reference-chip-D52WtrZ9.js → reference-chip-zRuFkaGy.js} +1 -1
  75. package/web/dist/assets/{remote-settings-notice-Buq1mILf.js → remote-settings-notice-CYiMrnys.js} +1 -1
  76. package/web/dist/assets/repo-git-B3tTtvIQ.js +1 -0
  77. package/web/dist/assets/report-reader-DBGA_8LA.js +1 -0
  78. package/web/dist/assets/{reports-D-IUJk8n.js → reports-B-Q6u2X6.js} +1 -1
  79. package/web/dist/assets/{resources-section-CIF3uOPg.js → resources-section-C5ndEonC.js} +1 -1
  80. package/web/dist/assets/run-header-DK4CZ3hY.js +2 -0
  81. package/web/dist/assets/session-context-section-BAw6x6P2.js +119 -0
  82. package/web/dist/assets/{settings-agent-picker-D7x87Fza.js → settings-agent-picker-fkaIrncp.js} +1 -1
  83. package/web/dist/assets/settings-shell-dzuuT5tw.js +1 -0
  84. package/web/dist/assets/{sidebar-section-2j1dPZW-.js → sidebar-section-BIQilcgt.js} +1 -1
  85. package/web/dist/assets/{skills-BZQKuRIK.js → skills-C-jo20DK.js} +1 -1
  86. package/web/dist/assets/{tab-link-qPg641SX.js → tab-link-Bh6CcIR7.js} +1 -1
  87. package/web/dist/assets/{task-changes-CMCstWbh.js → task-changes-DnG-9vJh.js} +1 -1
  88. package/web/dist/assets/{task-commits-De5jDVRc.js → task-commits-mqs3nfjk.js} +1 -1
  89. package/web/dist/assets/task-files-DKB3Xp3N.js +1 -0
  90. package/web/dist/assets/{task-github-item-Da-J1yOO.js → task-github-item-BA7W64bU.js} +1 -1
  91. package/web/dist/assets/{task-groups-CZAR_voe.js → task-groups-ClNnAPRA.js} +1 -1
  92. package/web/dist/assets/task-thread-B8zgMgtO.js +9 -0
  93. package/web/dist/assets/{tasks-table-CPP0rXJp.js → tasks-table-CE_VVk0w.js} +1 -1
  94. package/web/dist/assets/{thread-state-q7EKE8NY.js → thread-state-8okW1FLM.js} +1 -1
  95. package/web/dist/assets/{use-hand-to-agent-state-V15iu0Vf.js → use-hand-to-agent-state-BwLk3gNd.js} +1 -1
  96. package/web/dist/assets/{useInfiniteQuery-D9ecHhMH.js → useInfiniteQuery-CPEWc6dl.js} +1 -1
  97. package/web/dist/assets/useQuery-BOEhMTCg.js +1 -0
  98. package/web/dist/assets/workflows-BhQJM4JW.js +7 -0
  99. package/web/dist/assets/{workspace-tools-BSJXB55E.js → workspace-tools-BZs10pQZ.js} +1 -1
  100. package/web/dist/assets/{worktrees-section-DWfvhcFw.js → worktrees-section-BTNZUVnW.js} +4 -4
  101. package/web/dist/index.html +15 -15
  102. package/web/dist/assets/accounts-section-COnLhVcc.js +0 -1
  103. package/web/dist/assets/activity-motion-BepAhXl7.js +0 -2
  104. package/web/dist/assets/agent-config-section-D3eY8kW2.js +0 -4
  105. package/web/dist/assets/agent-defaults-section-BxIztnP5.js +0 -1
  106. package/web/dist/assets/attention-CexCTxjN.js +0 -1
  107. package/web/dist/assets/automations-route-vO4VXsmB.js +0 -1
  108. package/web/dist/assets/file-preview-Cq_WJ308.js +0 -2
  109. package/web/dist/assets/index-8Pe4JlYM.js +0 -21
  110. package/web/dist/assets/index-HkNWm2JB.css +0 -1
  111. package/web/dist/assets/queries-Dd6O2cf-.js +0 -1
  112. package/web/dist/assets/repo-git-P8s3o1t9.js +0 -1
  113. package/web/dist/assets/report-reader-BGHRGd46.js +0 -1
  114. package/web/dist/assets/run-header-x8ZoTs8l.js +0 -2
  115. package/web/dist/assets/settings-shell-CdsAJa6b.js +0 -1
  116. package/web/dist/assets/task-files-BTaS-k-o.js +0 -1
  117. package/web/dist/assets/task-thread-A2rldNuS.js +0 -9
  118. package/web/dist/assets/useQuery-B0ubYnT2.js +0 -1
  119. package/web/dist/assets/workflows-BWde25JO.js +0 -7
@@ -1487,6 +1487,18 @@ import { z as z21 } from "zod";
1487
1487
 
1488
1488
  // ../contract/src/ci-wait.ts
1489
1489
  import { z as z20 } from "zod";
1490
+
1491
+ // ../contract/src/utf8.ts
1492
+ function utf8Bytes(value) {
1493
+ let bytes = 0;
1494
+ for (const char of value) {
1495
+ const point = char.codePointAt(0);
1496
+ bytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
1497
+ }
1498
+ return bytes;
1499
+ }
1500
+
1501
+ // ../contract/src/ci-wait.ts
1490
1502
  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.";
1491
1503
  var CI_WAIT_RECEIPT_INSTRUCTION = "End your turn to wait for CI; no marker is needed. " + CI_WAIT_LIMITATION;
1492
1504
  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]*)$/;
@@ -1544,14 +1556,6 @@ var ciWaitErrorCodeSchema = z20.enum([
1544
1556
  "turn_changed"
1545
1557
  ]);
1546
1558
  var ciWaitErrorSchema = z20.object({ code: ciWaitErrorCodeSchema, message: z20.string().max(4096) }).strict();
1547
- function utf8Bytes(value) {
1548
- let bytes = 0;
1549
- for (const char of value) {
1550
- const point = char.codePointAt(0);
1551
- bytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
1552
- }
1553
- return bytes;
1554
- }
1555
1559
  var mergeBlockSchema = z20.object({
1556
1560
  reason: z20.enum(["conflict", "no_pending_merge"]),
1557
1561
  isInMergeQueue: z20.boolean(),
@@ -4012,27 +4016,77 @@ var setAgentConfigInputSchema = z30.object({
4012
4016
  version: z30.string().nullable()
4013
4017
  });
4014
4018
 
4015
- // ../contract/src/agent-profiles.ts
4019
+ // ../contract/src/session-context.ts
4016
4020
  import { z as z31 } from "zod";
4021
+ var SESSION_CONTEXT_FILE_MAX_BYTES = 256 * 1024;
4022
+ var fileContentSchema = z31.string().refine((text) => utf8Bytes(text) <= SESSION_CONTEXT_FILE_MAX_BYTES, {
4023
+ error: `context.yaml must be at most ${SESSION_CONTEXT_FILE_MAX_BYTES} bytes`
4024
+ });
4025
+ var sessionContextFileSchema = z31.object({
4026
+ /** Relative to the project root: `.ai/squawk/context.yaml` or `.ai/cezar/context.yaml`. */
4027
+ path: z31.string(),
4028
+ exists: z31.boolean(),
4029
+ content: z31.string(),
4030
+ /** sha256 of the bytes, or null when the file does not exist. */
4031
+ version: z31.string().nullable(),
4032
+ /** False when the file cannot be read as text, or lives in read-only fallback project data. */
4033
+ writable: z31.boolean(),
4034
+ readOnlyReason: z31.string().nullable()
4035
+ });
4036
+ var setSessionContextSchema = z31.object({
4037
+ content: fileContentSchema,
4038
+ version: z31.string().nullable()
4039
+ });
4040
+ var sessionContextRoleSchema = z31.enum(["parent", "worker"]);
4041
+ var sessionContextPreviewRequestSchema = z31.object({
4042
+ content: fileContentSchema,
4043
+ role: sessionContextRoleSchema
4044
+ });
4045
+ var sessionContextProblemSchema = z31.object({
4046
+ line: z31.number().nullable(),
4047
+ rule: z31.number().nullable(),
4048
+ message: z31.string()
4049
+ });
4050
+ var sessionContextPreviewBlockSchema = z31.object({
4051
+ id: z31.string(),
4052
+ /** `built-in` for the handoff block; null when the file names no target for the entry. */
4053
+ target: z31.enum(["built-in", "parent", "worker", "both"]).nullable(),
4054
+ status: z31.enum(["applied", "skipped", "not-for-role"]),
4055
+ bytes: z31.number().nullable(),
4056
+ reason: z31.string().nullable(),
4057
+ sources: z31.array(z31.string()),
4058
+ /** The rendered text, cut short for the preview; null when nothing rendered. */
4059
+ text: z31.string().nullable(),
4060
+ truncated: z31.boolean()
4061
+ });
4062
+ var sessionContextPreviewSchema = z31.object({
4063
+ problems: z31.array(sessionContextProblemSchema),
4064
+ blocks: z31.array(sessionContextPreviewBlockSchema),
4065
+ usedBytes: z31.number(),
4066
+ limitBytes: z31.number()
4067
+ });
4068
+
4069
+ // ../contract/src/agent-profiles.ts
4070
+ import { z as z32 } from "zod";
4017
4071
  var DEFAULT_AGENT_ACCOUNT_ID = "default";
4018
- var agentProfileSchema = z31.object({
4072
+ var agentProfileSchema = z32.object({
4019
4073
  /** `default` for the discovered profile, else the stored slug. */
4020
- id: z31.string(),
4074
+ id: z32.string(),
4021
4075
  provider: providerIdSchema,
4022
- label: z31.string(),
4076
+ label: z32.string(),
4023
4077
  /** As the user wrote it — a literal `~` is preserved, matching `browseRoot`/`projectsDir`.
4024
4078
  * Omitted on a remote cockpit without `settingsAdmin` so host paths are not disclosed. */
4025
- configDir: z31.string().optional(),
4079
+ configDir: z32.string().optional(),
4026
4080
  /** Expanded absolute path. Omitted on a remote cockpit without `settingsAdmin`. */
4027
- path: z31.string().optional(),
4081
+ path: z32.string().optional(),
4028
4082
  /** False for a dir the CLI has not created yet — legitimate, and NOT a reason to fall back
4029
4083
  * to another account at run time (that would silently bill the wrong subscription). */
4030
- exists: z31.boolean(),
4084
+ exists: z32.boolean(),
4031
4085
  /** Whether the dir carries this agent's own marker files. ADVISORY: an unrecognised dir is
4032
4086
  * still accepted, because "add profile → Connect → the CLI creates it" is the real flow. */
4033
- looksValid: z31.boolean(),
4087
+ looksValid: z32.boolean(),
4034
4088
  /** True for the profile Squawk discovers from the environment. Never stored, never deletable. */
4035
- isDefault: z31.boolean(),
4089
+ isDefault: z32.boolean(),
4036
4090
  /** This account's own authentication state — two Claude logins answer independently.
4037
4091
  *
4038
4092
  * **Absent until the probe has warmed.** Every probe shells out to an agent CLI, and this
@@ -4046,49 +4100,49 @@ function agentAccountRouteId(profile) {
4046
4100
  return profile.isDefault ? `default:${profile.provider}` : profile.id;
4047
4101
  }
4048
4102
  var agentAccountSelectionSchema = perRunnerOptionalStrings();
4049
- var agentProfilesResponseSchema = z31.object({
4050
- editable: z31.boolean(),
4051
- profiles: z31.array(agentProfileSchema),
4103
+ var agentProfilesResponseSchema = z32.object({
4104
+ editable: z32.boolean(),
4105
+ profiles: z32.array(agentProfileSchema),
4052
4106
  /** Providers that can carry more than one account at all — what "Add account" is offered for.
4053
4107
  * OpenCode and omp are absent: no folder variable moves their credentials, so a config-dir
4054
4108
  * profile would swap settings while still billing the other account. */
4055
- profileCapableProviders: z31.array(providerIdSchema),
4109
+ profileCapableProviders: z32.array(providerIdSchema),
4056
4110
  /** Which account each project uses, keyed by the project's realpath'd ROOT.
4057
4111
  *
4058
4112
  * Served here rather than on `GET /api/v1/projects` because it is stored beside the accounts it
4059
4113
  * names (`~/.cezar/agent-accounts.json`) — one file, so deleting an account and scrubbing every
4060
4114
  * reference to it is one atomic write, and neither can be dropped by a Squawk version that never
4061
4115
  * heard of accounts. Empty without `settingsAdmin` so host paths are not disclosed. */
4062
- selections: z31.record(z31.string(), agentAccountSelectionSchema),
4116
+ selections: z32.record(z32.string(), agentAccountSelectionSchema),
4063
4117
  /** Which account each project uses, keyed by canonical project id (plus `'default'` for the boot
4064
4118
  * project). Always populated without disclosing host filesystem paths. */
4065
- projectSelections: z31.record(z31.string(), agentAccountSelectionSchema)
4119
+ projectSelections: z32.record(z32.string(), agentAccountSelectionSchema)
4066
4120
  });
4067
- var selectAgentProfileInputSchema = z31.object({
4121
+ var selectAgentProfileInputSchema = z32.object({
4068
4122
  /** Registry slug, or the reserved `default` boot alias. Resolved to a root server-side. */
4069
- projectId: z31.string().min(1).max(64),
4123
+ projectId: z32.string().min(1).max(64),
4070
4124
  provider: providerIdSchema,
4071
- profileId: z31.string().max(64).nullable()
4125
+ profileId: z32.string().max(64).nullable()
4072
4126
  });
4073
- var agentProfileSelectionsResponseSchema = z31.object({
4074
- selections: z31.record(z31.string(), agentAccountSelectionSchema),
4075
- projectSelections: z31.record(z31.string(), agentAccountSelectionSchema)
4127
+ var agentProfileSelectionsResponseSchema = z32.object({
4128
+ selections: z32.record(z32.string(), agentAccountSelectionSchema),
4129
+ projectSelections: z32.record(z32.string(), agentAccountSelectionSchema)
4076
4130
  });
4077
- var agentAccountStatusResponseSchema = z31.object({ status: providerStatusSchema });
4078
- var createAgentProfileInputSchema = z31.object({
4131
+ var agentAccountStatusResponseSchema = z32.object({ status: providerStatusSchema });
4132
+ var createAgentProfileInputSchema = z32.object({
4079
4133
  provider: providerIdSchema,
4080
- label: z31.string().trim().max(200).optional(),
4134
+ label: z32.string().trim().max(200).optional(),
4081
4135
  /** Stored as written; validated absolute after `~` expansion, server-side. */
4082
- configDir: z31.string().trim().min(1).max(4096)
4136
+ configDir: z32.string().trim().min(1).max(4096)
4083
4137
  });
4084
- var agentProfileResponseSchema = z31.object({ profile: agentProfileSchema });
4085
- var updateAgentProfileInputSchema = z31.object({
4086
- label: z31.string().trim().max(200).optional(),
4087
- configDir: z31.string().trim().min(1).max(4096).optional()
4138
+ var agentProfileResponseSchema = z32.object({ profile: agentProfileSchema });
4139
+ var updateAgentProfileInputSchema = z32.object({
4140
+ label: z32.string().trim().max(200).optional(),
4141
+ configDir: z32.string().trim().min(1).max(4096).optional()
4088
4142
  });
4089
- var removeAgentProfileResponseSchema = z31.object({
4090
- removed: z31.literal(true),
4091
- id: z31.string()
4143
+ var removeAgentProfileResponseSchema = z32.object({
4144
+ removed: z32.literal(true),
4145
+ id: z32.string()
4092
4146
  });
4093
4147
 
4094
4148
  // ../contract/src/zoned-time.ts
@@ -4171,7 +4225,7 @@ function localTimeZone() {
4171
4225
  }
4172
4226
 
4173
4227
  // ../contract/src/automation-schedule.ts
4174
- import { z as z32 } from "zod";
4228
+ import { z as z33 } from "zod";
4175
4229
  var SCHEDULE_TYPES = ["daily", "weekdays", "weekly", "hours", "once"];
4176
4230
  var SCHEDULE_HOURS_OPTIONS = [1, 2, 3, 4, 6, 8, 12];
4177
4231
  var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
@@ -4182,34 +4236,34 @@ var ONCE_AT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
4182
4236
  var REPEATING_KEYS = ["hour", "minute", "day", "every"];
4183
4237
  var ONCE_KEYS = ["at", "timeZone", "latestStartMinutes"];
4184
4238
  var ONCE_PAST_DUE_MESSAGE = "the due time has passed; choose a later time or use Run now";
4185
- var onceStatusSchema = z32.enum(["paused", "waiting", "failed", "missed", "archived"]);
4239
+ var onceStatusSchema = z33.enum(["paused", "waiting", "failed", "missed", "archived"]);
4186
4240
  function unknownTimeZoneMessage(zone) {
4187
4241
  return `unknown time zone "${zone}"; use an IANA name such as Europe/Warsaw`;
4188
4242
  }
4189
- var automationScheduleSchema = z32.object({
4190
- type: z32.enum(SCHEDULE_TYPES),
4243
+ var automationScheduleSchema = z33.object({
4244
+ type: z33.enum(SCHEDULE_TYPES),
4191
4245
  /** 0–23; `daily`, `weekdays`, `weekly`. Default 4. */
4192
- hour: z32.number().int().min(0).max(23).optional(),
4246
+ hour: z33.number().int().min(0).max(23).optional(),
4193
4247
  /** 0–59; `daily`, `weekdays`, `weekly`. Default 0. */
4194
- minute: z32.number().int().min(0).max(59).optional(),
4248
+ minute: z33.number().int().min(0).max(59).optional(),
4195
4249
  /** ISO weekday, Monday = 1 … Sunday = 7; `weekly`. Default 1. */
4196
- day: z32.number().int().min(1).max(7).optional(),
4250
+ day: z33.number().int().min(1).max(7).optional(),
4197
4251
  /** Hours between runs, from 00:00; `hours`. Default 6. */
4198
- every: z32.union([
4199
- z32.literal(1),
4200
- z32.literal(2),
4201
- z32.literal(3),
4202
- z32.literal(4),
4203
- z32.literal(6),
4204
- z32.literal(8),
4205
- z32.literal(12)
4252
+ every: z33.union([
4253
+ z33.literal(1),
4254
+ z33.literal(2),
4255
+ z33.literal(3),
4256
+ z33.literal(4),
4257
+ z33.literal(6),
4258
+ z33.literal(8),
4259
+ z33.literal(12)
4206
4260
  ]).optional(),
4207
4261
  /** `once`: the local wall time `YYYY-MM-DDTHH:MM` in `timeZone`. */
4208
- at: z32.string().regex(ONCE_AT_PATTERN, "at must be YYYY-MM-DDTHH:MM").optional(),
4262
+ at: z33.string().regex(ONCE_AT_PATTERN, "at must be YYYY-MM-DDTHH:MM").optional(),
4209
4263
  /** `once`: the IANA zone `at` is read in. Required there, refused on the repeating shapes. */
4210
- timeZone: z32.string().optional(),
4264
+ timeZone: z33.string().optional(),
4211
4265
  /** `once`: how late after `at` a start may still launch. Absent = no limit. */
4212
- latestStartMinutes: z32.number().int().min(ONCE_MIN_LATEST_START_MINUTES).max(ONCE_MAX_LATEST_START_MINUTES).optional()
4266
+ latestStartMinutes: z33.number().int().min(ONCE_MIN_LATEST_START_MINUTES).max(ONCE_MAX_LATEST_START_MINUTES).optional()
4213
4267
  }).superRefine((schedule, ctx) => {
4214
4268
  const present = (key) => schedule[key] !== void 0;
4215
4269
  const refuse = (key, message2) => ctx.addIssue({ code: "custom", path: [key], message: message2 });
@@ -4374,108 +4428,108 @@ function nextOccurrence(schedule, afterMs, timeZone) {
4374
4428
  }
4375
4429
 
4376
4430
  // ../contract/src/automations.ts
4377
- import { z as z33 } from "zod";
4378
- var automationEventSchema = z33.enum([
4431
+ import { z as z34 } from "zod";
4432
+ var automationEventSchema = z34.enum([
4379
4433
  "pull_request.opened",
4380
4434
  "issue.opened",
4381
4435
  "issue.labeled",
4382
4436
  "issue.unlabeled"
4383
4437
  ]);
4384
- var automationFiltersSchema = z33.object({
4438
+ var automationFiltersSchema = z34.object({
4385
4439
  /** Opt in to matching events before enablement, bounded by lookbackDays. Absent means false. */
4386
- includeExisting: z33.boolean().optional(),
4387
- authors: z33.array(z33.string()).optional(),
4388
- assignees: z33.array(z33.string()).optional(),
4440
+ includeExisting: z34.boolean().optional(),
4441
+ authors: z34.array(z34.string()).optional(),
4442
+ assignees: z34.array(z34.string()).optional(),
4389
4443
  /** Opt-in: require an open item and matching live labels before reservation and launch. */
4390
- requireCurrentLabels: z33.boolean().optional(),
4391
- allLabels: z33.array(z33.string()).optional(),
4392
- anyLabels: z33.array(z33.string()).optional(),
4393
- excludeLabels: z33.array(z33.string()).optional(),
4444
+ requireCurrentLabels: z34.boolean().optional(),
4445
+ allLabels: z34.array(z34.string()).optional(),
4446
+ anyLabels: z34.array(z34.string()).optional(),
4447
+ excludeLabels: z34.array(z34.string()).optional(),
4394
4448
  /** Required for the two label events — the server rejects a definition without it. */
4395
- changedLabels: z33.array(z33.string()).optional(),
4396
- lookbackDays: z33.number(),
4397
- maxRecords: z33.number()
4449
+ changedLabels: z34.array(z34.string()).optional(),
4450
+ lookbackDays: z34.number(),
4451
+ maxRecords: z34.number()
4398
4452
  });
4399
- var automationKindSchema = z33.enum(["github", "schedule"]);
4453
+ var automationKindSchema = z34.enum(["github", "schedule"]);
4400
4454
  var automationTaskSchema = createRunInputBaseSchema.omit({ task: true, images: true, systemPrompt: true }).extend({
4401
4455
  /** The prompt template. `{{github.number}}`, `{{github.title}}`, `{{github.url}}` and
4402
4456
  * `{{github.labels}}` are substituted per match; GitHub content is appended as untrusted
4403
4457
  * context, never interpolated into instructions. */
4404
- prompt: z33.string(),
4405
- variants: z33.union([z33.literal(1), z33.literal(2), z33.literal(3)]).optional(),
4406
- systemPrompt: z33.string().optional()
4407
- });
4408
- var automationArchiveSchema = z33.object({
4409
- at: z33.string(),
4410
- outcome: z33.enum(["launched", "cancelled"]),
4411
- runId: z33.string().optional(),
4412
- receiptId: z33.string().optional(),
4413
- trigger: z33.enum(["schedule", "late", "manual", "retry"]).optional()
4414
- });
4415
- var automationDefinitionSchema = z33.object({
4416
- id: z33.string(),
4458
+ prompt: z34.string(),
4459
+ variants: z34.union([z34.literal(1), z34.literal(2), z34.literal(3)]).optional(),
4460
+ systemPrompt: z34.string().optional()
4461
+ });
4462
+ var automationArchiveSchema = z34.object({
4463
+ at: z34.string(),
4464
+ outcome: z34.enum(["launched", "cancelled"]),
4465
+ runId: z34.string().optional(),
4466
+ receiptId: z34.string().optional(),
4467
+ trigger: z34.enum(["schedule", "late", "manual", "retry"]).optional()
4468
+ });
4469
+ var automationDefinitionSchema = z34.object({
4470
+ id: z34.string(),
4417
4471
  /** Bumped on every edit; a PUT must echo the revision it read (optimistic concurrency). */
4418
- revision: z33.number(),
4419
- name: z33.string(),
4420
- description: z33.string().optional(),
4472
+ revision: z34.number(),
4473
+ name: z34.string(),
4474
+ description: z34.string().optional(),
4421
4475
  /** Always present: the storage schema defaults it to `false`, so a definition is created
4422
4476
  * PAUSED and enabling it is a separate, baseline-establishing act. */
4423
- enabled: z33.boolean(),
4477
+ enabled: z34.boolean(),
4424
4478
  kind: automationKindSchema,
4425
4479
  /** `github` kind: always present. `schedule` kind: absent. */
4426
- events: z33.array(automationEventSchema).optional(),
4427
- intervalSeconds: z33.number().optional(),
4480
+ events: z34.array(automationEventSchema).optional(),
4481
+ intervalSeconds: z34.number().optional(),
4428
4482
  filters: automationFiltersSchema.optional(),
4429
4483
  /** `schedule` kind: always present. `github` kind: absent. */
4430
4484
  schedule: automationScheduleSchema.optional(),
4431
4485
  task: automationTaskSchema,
4432
4486
  /** `once` schedules only: present once its task exists or it was cancelled. */
4433
4487
  archived: automationArchiveSchema.optional(),
4434
- createdAt: z33.string(),
4435
- updatedAt: z33.string()
4436
- });
4437
- var automationCursorSchema = z33.object({
4438
- timestamp: z33.string(),
4439
- tieBreaker: z33.string().optional()
4440
- });
4441
- var automationHistoryScanSchema = z33.object({
4442
- since: z33.string().datetime(),
4443
- until: z33.string().datetime(),
4444
- source: z33.number().int().min(0).max(2),
4445
- page: z33.number().int().min(1).max(10),
4446
- item: z33.number().int().min(0).max(100),
4488
+ createdAt: z34.string(),
4489
+ updatedAt: z34.string()
4490
+ });
4491
+ var automationCursorSchema = z34.object({
4492
+ timestamp: z34.string(),
4493
+ tieBreaker: z34.string().optional()
4494
+ });
4495
+ var automationHistoryScanSchema = z34.object({
4496
+ since: z34.string().datetime(),
4497
+ until: z34.string().datetime(),
4498
+ source: z34.number().int().min(0).max(2),
4499
+ page: z34.number().int().min(1).max(10),
4500
+ item: z34.number().int().min(0).max(100),
4447
4501
  // One item can contain ten pages of 100 timeline entries, independent of the new-work cap.
4448
- event: z33.number().int().min(0).max(1e3),
4502
+ event: z34.number().int().min(0).max(1e3),
4449
4503
  cursor: automationCursorSchema.optional()
4450
4504
  });
4451
4505
  var AUTOMATION_LAST_ERROR_MAX = 1e3;
4452
4506
  var automationLastErrorShape = {
4453
- lastError: z33.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
4454
- lastErrorAt: z33.string().datetime().optional()
4507
+ lastError: z34.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
4508
+ lastErrorAt: z34.string().datetime().optional()
4455
4509
  };
4456
- var automationRuntimeStateSchema = z33.object({
4510
+ var automationRuntimeStateSchema = z34.object({
4457
4511
  /** The definition revision this state belongs to; activation or history-policy changes re-arm. */
4458
- revision: z33.number().optional(),
4512
+ revision: z34.number().optional(),
4459
4513
  /** Earliest eligible event: enablement time, or the lookback start when includeExisting is on. */
4460
- baselineAt: z33.string().optional(),
4514
+ baselineAt: z34.string().optional(),
4461
4515
  /** When discovery was armed, independent of the historical baseline. */
4462
- armedAt: z33.string().optional(),
4516
+ armedAt: z34.string().optional(),
4463
4517
  historyScan: automationHistoryScanSchema.optional(),
4464
4518
  cursor: automationCursorSchema.optional(),
4465
- frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z33.string() }).optional(),
4466
- backlogAfter: automationCursorSchema.extend({ tieBreaker: z33.string() }).optional(),
4467
- nextCheckAt: z33.string().optional(),
4468
- lastSuccessAt: z33.string().optional(),
4519
+ frozenHighWatermark: automationCursorSchema.extend({ tieBreaker: z34.string() }).optional(),
4520
+ backlogAfter: automationCursorSchema.extend({ tieBreaker: z34.string() }).optional(),
4521
+ nextCheckAt: z34.string().optional(),
4522
+ lastSuccessAt: z34.string().optional(),
4469
4523
  /** `schedule` kind: the next occurrence's instant and the last fired one's. */
4470
- nextRunAt: z33.string().optional(),
4471
- lastRunAt: z33.string().optional(),
4524
+ nextRunAt: z34.string().optional(),
4525
+ lastRunAt: z34.string().optional(),
4472
4526
  /** Per-query GitHub ETags, so an unchanged page costs no rate-limit budget. */
4473
- etags: z33.record(z33.string(), z33.string()).optional(),
4474
- backoffUntil: z33.string().optional(),
4475
- consecutiveFailures: z33.number().optional(),
4527
+ etags: z34.record(z34.string(), z34.string()).optional(),
4528
+ backoffUntil: z34.string().optional(),
4529
+ consecutiveFailures: z34.number().optional(),
4476
4530
  ...automationLastErrorShape,
4477
4531
  /** `once` schedules: why it stopped without a task — its launch failed, or it started past its cutoff. */
4478
- onceOutcome: z33.enum(["failed", "missed"]).optional()
4532
+ onceOutcome: z34.enum(["failed", "missed"]).optional()
4479
4533
  });
4480
4534
  var AUTOMATION_FAILURE_NOTICE_AFTER = 3;
4481
4535
  function automationFailureNotice(state) {
@@ -4488,7 +4542,7 @@ function automationFailureNotice(state) {
4488
4542
  ...state.backoffUntil ? { retryAt: state.backoffUntil } : {}
4489
4543
  };
4490
4544
  }
4491
- var automationLogResultSchema = z33.enum([
4545
+ var automationLogResultSchema = z34.enum([
4492
4546
  "launched",
4493
4547
  "no-match",
4494
4548
  "duplicate",
@@ -4504,36 +4558,36 @@ var automationLogResultSchema = z33.enum([
4504
4558
  // once schedule: Squawk started after its latest start, so nothing launched.
4505
4559
  "missed"
4506
4560
  ]);
4507
- var automationLogRecordSchema = z33.object({
4508
- seq: z33.number(),
4509
- ts: z33.string(),
4510
- automationId: z33.string(),
4511
- revision: z33.number(),
4561
+ var automationLogRecordSchema = z34.object({
4562
+ seq: z34.number(),
4563
+ ts: z34.string(),
4564
+ automationId: z34.string(),
4565
+ revision: z34.number(),
4512
4566
  event: automationEventSchema.optional(),
4513
4567
  result: automationLogResultSchema,
4514
- reason: z33.string().optional(),
4515
- durationMs: z33.number().optional(),
4516
- receiptId: z33.string().optional(),
4517
- runId: z33.string().optional(),
4518
- githubNumber: z33.number().optional(),
4519
- githubTitle: z33.string().optional(),
4520
- githubUrl: z33.string().optional(),
4521
- rateLimit: z33.object({
4522
- bucket: z33.enum(["core", "search"]),
4523
- remaining: z33.number().optional(),
4524
- resetAt: z33.string().optional()
4568
+ reason: z34.string().optional(),
4569
+ durationMs: z34.number().optional(),
4570
+ receiptId: z34.string().optional(),
4571
+ runId: z34.string().optional(),
4572
+ githubNumber: z34.number().optional(),
4573
+ githubTitle: z34.string().optional(),
4574
+ githubUrl: z34.string().optional(),
4575
+ rateLimit: z34.object({
4576
+ bucket: z34.enum(["core", "search"]),
4577
+ remaining: z34.number().optional(),
4578
+ resetAt: z34.string().optional()
4525
4579
  }).optional()
4526
4580
  });
4527
- var automationCountsSchema = z33.object({
4581
+ var automationCountsSchema = z34.object({
4528
4582
  /** GitHub candidates that matched a filter: `launched` + `duplicate` rows. */
4529
- matches: z33.number(),
4583
+ matches: z34.number(),
4530
4584
  /** Stored tasks with this automation's provenance, including each variant, finished and archived
4531
4585
  * tasks, across all revisions. Independent of log/receipt retention; deleting a task removes it. */
4532
- launched: z33.number(),
4586
+ launched: z34.number(),
4533
4587
  /** `duplicate` rows: a match whose receipt already existed, so nothing launched. */
4534
- duplicates: z33.number(),
4588
+ duplicates: z34.number(),
4535
4589
  /** `error` and `rate-limited` rows, plus a schedule's `failed` launches. */
4536
- errors: z33.number()
4590
+ errors: z34.number()
4537
4591
  });
4538
4592
  var automationListEntrySchema = automationDefinitionSchema.extend({
4539
4593
  state: automationRuntimeStateSchema.optional(),
@@ -4541,74 +4595,74 @@ var automationListEntrySchema = automationDefinitionSchema.extend({
4541
4595
  counts: automationCountsSchema,
4542
4596
  /** Enabled only: a schedule's armed `state.nextRunAt`, a poll's `state.nextCheckAt`. Absent
4543
4597
  * while paused, and for a schedule the timer has not armed yet. */
4544
- nextRunAt: z33.string().optional(),
4598
+ nextRunAt: z34.string().optional(),
4545
4599
  /** `once` schedules only. */
4546
4600
  onceStatus: onceStatusSchema.optional()
4547
4601
  });
4548
- var automationsResponseSchema = z33.object({
4549
- available: z33.boolean(),
4550
- reason: z33.string().optional(),
4551
- timeZone: z33.string(),
4552
- scheduler: z33.object({
4553
- state: z33.enum(["scheduled", "idle"]),
4554
- nextDue: z33.string().optional()
4602
+ var automationsResponseSchema = z34.object({
4603
+ available: z34.boolean(),
4604
+ reason: z34.string().optional(),
4605
+ timeZone: z34.string(),
4606
+ scheduler: z34.object({
4607
+ state: z34.enum(["scheduled", "idle"]),
4608
+ nextDue: z34.string().optional()
4555
4609
  }),
4556
- automations: z33.array(automationListEntrySchema)
4610
+ automations: z34.array(automationListEntrySchema)
4557
4611
  });
4558
- var automationResponseSchema = z33.object({ automation: automationDefinitionSchema });
4612
+ var automationResponseSchema = z34.object({ automation: automationDefinitionSchema });
4559
4613
  var automationCreateResponseSchema = automationResponseSchema.extend({
4560
- once: z33.object({ dueAt: z33.string(), timeZone: z33.string(), resolvedInstant: z33.string(), note: z33.string() }).optional()
4614
+ once: z34.object({ dueAt: z34.string(), timeZone: z34.string(), resolvedInstant: z34.string(), note: z34.string() }).optional()
4561
4615
  });
4562
- var automationDetailResponseSchema = z33.object({
4616
+ var automationDetailResponseSchema = z34.object({
4563
4617
  automation: automationDefinitionSchema,
4564
4618
  state: automationRuntimeStateSchema.optional(),
4565
4619
  latestLog: automationLogRecordSchema.optional(),
4566
4620
  /** `once` schedules only. */
4567
4621
  onceStatus: onceStatusSchema.optional()
4568
4622
  });
4569
- var automationCheckSchema = z33.object({
4570
- id: z33.string(),
4571
- automationId: z33.string(),
4572
- mode: z33.enum(["preview", "execute"]),
4573
- status: z33.enum(["queued", "running", "complete", "error"]),
4574
- createdAt: z33.string(),
4575
- completedAt: z33.string().optional(),
4576
- matches: z33.number().optional(),
4577
- truncated: z33.boolean().optional(),
4578
- error: z33.string().optional()
4579
- });
4580
- var automationCheckQueuedResponseSchema = z33.object({ checkId: z33.string() });
4581
- var automationLogResponseSchema = z33.object({
4582
- records: z33.array(automationLogRecordSchema)
4583
- });
4584
- var automationRetryResponseSchema = z33.object({
4585
- receiptId: z33.string(),
4586
- runId: z33.string()
4587
- });
4588
- var automationRunResponseSchema = z33.object({ runId: z33.string() });
4623
+ var automationCheckSchema = z34.object({
4624
+ id: z34.string(),
4625
+ automationId: z34.string(),
4626
+ mode: z34.enum(["preview", "execute"]),
4627
+ status: z34.enum(["queued", "running", "complete", "error"]),
4628
+ createdAt: z34.string(),
4629
+ completedAt: z34.string().optional(),
4630
+ matches: z34.number().optional(),
4631
+ truncated: z34.boolean().optional(),
4632
+ error: z34.string().optional()
4633
+ });
4634
+ var automationCheckQueuedResponseSchema = z34.object({ checkId: z34.string() });
4635
+ var automationLogResponseSchema = z34.object({
4636
+ records: z34.array(automationLogRecordSchema)
4637
+ });
4638
+ var automationRetryResponseSchema = z34.object({
4639
+ receiptId: z34.string(),
4640
+ runId: z34.string()
4641
+ });
4642
+ var automationRunResponseSchema = z34.object({ runId: z34.string() });
4589
4643
  var createAutomationInputSchema = automationDefinitionSchema.omit({ id: true, revision: true, createdAt: true, updatedAt: true, enabled: true, kind: true, archived: true }).extend({
4590
4644
  /** Omitted = `github` on create, the shape every pre-schedule client sends; omitted on
4591
4645
  * update = the stored kind. */
4592
4646
  kind: automationKindSchema.optional(),
4593
4647
  task: automationTaskSchema.omit({ variants: true }).strict(),
4594
- enable: z33.boolean().optional()
4648
+ enable: z34.boolean().optional()
4595
4649
  });
4596
4650
  var updateAutomationInputSchema = createAutomationInputSchema.omit({ enable: true }).extend({
4597
- enabled: z33.boolean().optional(),
4598
- expectedRevision: z33.number()
4651
+ enabled: z34.boolean().optional(),
4652
+ expectedRevision: z34.number()
4599
4653
  });
4600
- var automationListQuerySchema = z33.object({
4601
- archived: z33.enum(["include", "only"]).optional()
4654
+ var automationListQuerySchema = z34.object({
4655
+ archived: z34.enum(["include", "only"]).optional()
4602
4656
  });
4603
- var automationCheckInputSchema = z33.object({
4604
- mode: z33.enum(["preview", "execute"])
4657
+ var automationCheckInputSchema = z34.object({
4658
+ mode: z34.enum(["preview", "execute"])
4605
4659
  });
4606
4660
 
4607
4661
  // ../contract/src/scheduled-tasks.ts
4608
- import { z as z34 } from "zod";
4662
+ import { z as z35 } from "zod";
4609
4663
  var SCHEDULED_TASK_LIMITS = { prompt: 1e5, list: 50, wireBytes: 1048576 };
4610
4664
  var DURATION = /^(\d+)\s*([mhd])$/;
4611
- var durationField = z34.string().regex(DURATION, "a duration such as 30m, 6h or 7d");
4665
+ var durationField = z35.string().regex(DURATION, "a duration such as 30m, 6h or 7d");
4612
4666
  function parseDurationMinutes(value) {
4613
4667
  const match = DURATION.exec(value.trim());
4614
4668
  if (!match) throw new Error(`"${value}" is not a duration; use 30m, 6h or 7d`);
@@ -4632,201 +4686,201 @@ function wallTimeAtOrAfter(targetMs, timeZone) {
4632
4686
  var UTC_MINUTE_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})Z$/;
4633
4687
  var utcMinute = (instantMs) => `${new Date(instantMs).toISOString().slice(0, 16)}Z`;
4634
4688
  var scheduleFields = {
4635
- at: z34.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(),
4689
+ at: z35.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(),
4636
4690
  delay: durationField.optional(),
4637
4691
  latest_start: durationField.optional(),
4638
- workflow: z34.string().trim().min(1).max(200).optional(),
4639
- runner: z34.string().trim().min(1).max(32).optional(),
4640
- model: z34.string().trim().min(1).max(200).optional(),
4641
- effort: z34.string().trim().min(1).max(32).optional()
4692
+ workflow: z35.string().trim().min(1).max(200).optional(),
4693
+ runner: z35.string().trim().min(1).max(32).optional(),
4694
+ model: z35.string().trim().min(1).max(200).optional(),
4695
+ effort: z35.string().trim().min(1).max(32).optional()
4642
4696
  };
4643
4697
  var notBoth = (value) => !(value.at && value.delay);
4644
- var scheduleTaskRequestSchema = z34.object({
4645
- name: z34.string().trim().min(1).max(200),
4646
- prompt: z34.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt),
4698
+ var scheduleTaskRequestSchema = z35.object({
4699
+ name: z35.string().trim().min(1).max(200),
4700
+ prompt: z35.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt),
4647
4701
  ...scheduleFields,
4648
- enable: z34.boolean().optional()
4702
+ enable: z35.boolean().optional()
4649
4703
  }).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"] });
4650
- var idField = z34.string().min(1).max(100);
4651
- var scheduledTasksRequestSchema = z34.discriminatedUnion("action", [
4652
- z34.object({ action: z34.literal("list"), archived: z34.enum(["include", "only"]).optional() }).strict(),
4653
- z34.object({ action: z34.literal("show"), id: idField }).strict(),
4654
- z34.object({
4655
- action: z34.literal("update"),
4704
+ var idField = z35.string().min(1).max(100);
4705
+ var scheduledTasksRequestSchema = z35.discriminatedUnion("action", [
4706
+ z35.object({ action: z35.literal("list"), archived: z35.enum(["include", "only"]).optional() }).strict(),
4707
+ z35.object({ action: z35.literal("show"), id: idField }).strict(),
4708
+ z35.object({
4709
+ action: z35.literal("update"),
4656
4710
  id: idField,
4657
- name: z34.string().trim().min(1).max(200).optional(),
4658
- prompt: z34.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt).optional(),
4711
+ name: z35.string().trim().min(1).max(200).optional(),
4712
+ prompt: z35.string().min(1).max(SCHEDULED_TASK_LIMITS.prompt).optional(),
4659
4713
  ...scheduleFields
4660
4714
  }).strict().refine(notBoth, { message: "give at or delay, not both", path: ["delay"] }),
4661
- z34.object({ action: z34.literal("pause"), id: idField }).strict(),
4662
- z34.object({ action: z34.literal("enable"), id: idField }).strict(),
4663
- z34.object({ action: z34.literal("cancel"), id: idField }).strict()
4715
+ z35.object({ action: z35.literal("pause"), id: idField }).strict(),
4716
+ z35.object({ action: z35.literal("enable"), id: idField }).strict(),
4717
+ z35.object({ action: z35.literal("cancel"), id: idField }).strict()
4664
4718
  ]);
4665
- var scheduledTaskSchema = z34.object({
4666
- id: z34.string(),
4667
- name: z34.string(),
4719
+ var scheduledTaskSchema = z35.object({
4720
+ id: z35.string(),
4721
+ name: z35.string(),
4668
4722
  status: onceStatusSchema,
4669
4723
  /** When it is due, in UTC: `YYYY-MM-DDTHH:MMZ`, the form `at` takes. */
4670
- due_at: z34.string(),
4671
- latest_start_minutes: z34.number().optional(),
4724
+ due_at: z35.string(),
4725
+ latest_start_minutes: z35.number().optional(),
4672
4726
  /** The task it launched, once archived with one. */
4673
- run_id: z34.string().optional(),
4727
+ run_id: z35.string().optional(),
4674
4728
  /** The cockpit page of the schedule, when the cockpit's address is known. */
4675
- url: z34.string().optional()
4729
+ url: z35.string().optional()
4676
4730
  });
4677
- var scheduledTaskRefusalCodeSchema = z34.enum(["invalid_request", "unavailable", "not_found", "conflict", "automations_off"]);
4678
- var refusal = z34.object({ ok: z34.literal(false), code: scheduledTaskRefusalCodeSchema, message: z34.string() });
4731
+ var scheduledTaskRefusalCodeSchema = z35.enum(["invalid_request", "unavailable", "not_found", "conflict", "automations_off"]);
4732
+ var refusal = z35.object({ ok: z35.literal(false), code: scheduledTaskRefusalCodeSchema, message: z35.string() });
4679
4733
  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.";
4680
- var scheduleTaskAnswerSchema = z34.union([
4681
- z34.object({ ok: z34.literal(true), task: scheduledTaskSchema, note: z34.string() }),
4734
+ var scheduleTaskAnswerSchema = z35.union([
4735
+ z35.object({ ok: z35.literal(true), task: scheduledTaskSchema, note: z35.string() }),
4682
4736
  refusal
4683
4737
  ]);
4684
- var scheduledTasksAnswerSchema = z34.union([
4685
- z34.object({ ok: z34.literal(true), tasks: z34.array(scheduledTaskSchema).max(SCHEDULED_TASK_LIMITS.list) }),
4686
- z34.object({ ok: z34.literal(true), task: scheduledTaskSchema }),
4738
+ var scheduledTasksAnswerSchema = z35.union([
4739
+ z35.object({ ok: z35.literal(true), tasks: z35.array(scheduledTaskSchema).max(SCHEDULED_TASK_LIMITS.list) }),
4740
+ z35.object({ ok: z35.literal(true), task: scheduledTaskSchema }),
4687
4741
  refusal
4688
4742
  ]);
4689
4743
 
4690
4744
  // ../contract/src/wait-tools.ts
4691
- import { z as z35 } from "zod";
4692
- var pidSchema2 = z35.number().int().min(PID_MIN);
4745
+ import { z as z36 } from "zod";
4746
+ var pidSchema2 = z36.number().int().min(PID_MIN);
4693
4747
  var oneModeTakesOneId = (ids, mode, ctx) => {
4694
4748
  if (mode === "one" && ids.length !== 1) ctx.addIssue({ code: "custom", message: "one mode requires exactly one id", path: ["mode"] });
4695
4749
  };
4696
- var waitTimeoutSeconds = z35.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
4697
- var registrationFields = { operation_id: z35.uuid().optional() };
4698
- var builtInSquawkWaitRequestSchema = z35.discriminatedUnion("kind", [
4699
- ciWaitRequestSchema.extend({ kind: z35.literal("pr"), ...registrationFields }).strict(),
4700
- z35.object({
4701
- kind: z35.literal("worker"),
4750
+ var waitTimeoutSeconds = z36.number().int().min(1).max(PEER_WAIT_MAX_SECONDS).default(PEER_WAIT_DEFAULT_SECONDS);
4751
+ var registrationFields = { operation_id: z36.uuid().optional() };
4752
+ var builtInSquawkWaitRequestSchema = z36.discriminatedUnion("kind", [
4753
+ ciWaitRequestSchema.extend({ kind: z36.literal("pr"), ...registrationFields }).strict(),
4754
+ z36.object({
4755
+ kind: z36.literal("worker"),
4702
4756
  ...registrationFields,
4703
4757
  worker_ids: workerIdsSchema,
4704
4758
  mode: workerWaitModeSchema.optional(),
4705
4759
  timeout_seconds: waitTimeoutSeconds
4706
4760
  }).strict().superRefine((request, ctx) => oneModeTakesOneId(request.worker_ids, request.mode, ctx)),
4707
- z35.object({
4708
- kind: z35.literal("request"),
4761
+ z36.object({
4762
+ kind: z36.literal("request"),
4709
4763
  ...registrationFields,
4710
4764
  request_ids: workerIdsSchema,
4711
4765
  mode: workerWaitModeSchema.optional(),
4712
4766
  timeout_seconds: waitTimeoutSeconds
4713
4767
  }).strict().superRefine((request, ctx) => oneModeTakesOneId(request.request_ids, request.mode, ctx)),
4714
- z35.object({
4715
- kind: z35.literal("peer"),
4768
+ z36.object({
4769
+ kind: z36.literal("peer"),
4716
4770
  ...registrationFields,
4717
4771
  peer_ids: workerIdsSchema,
4718
4772
  timeout_seconds: waitTimeoutSeconds
4719
4773
  }).strict(),
4720
- z35.object({
4721
- kind: z35.literal("timer"),
4774
+ z36.object({
4775
+ kind: z36.literal("timer"),
4722
4776
  ...registrationFields,
4723
- seconds: z35.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
4724
- note: z35.string().max(NOTE_MAX).optional()
4777
+ seconds: z36.number().int().min(TIMER_MIN_SECONDS).max(TIMER_MAX_SECONDS),
4778
+ note: z36.string().max(NOTE_MAX).optional()
4725
4779
  }).strict(),
4726
- z35.object({
4727
- kind: z35.literal("process"),
4780
+ z36.object({
4781
+ kind: z36.literal("process"),
4728
4782
  ...registrationFields,
4729
4783
  pid: pidSchema2,
4730
- exit_file: z35.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
4731
- timeout_seconds: z35.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
4732
- note: z35.string().max(NOTE_MAX).optional()
4784
+ exit_file: z36.string().min(1).max(PROCESS_EXIT_FILE_MAX).optional(),
4785
+ timeout_seconds: z36.number().int().min(1).max(PROCESS_TIMEOUT_MAX_SECONDS).default(PROCESS_TIMEOUT_DEFAULT_SECONDS),
4786
+ note: z36.string().max(NOTE_MAX).optional()
4733
4787
  }).strict()
4734
4788
  ]);
4735
4789
  var builtInRequestKinds = /* @__PURE__ */ new Set(["pr", "worker", "request", "peer", "timer", "process"]);
4736
- var pluginWaitRequestSchema = z35.object({
4737
- kind: z35.string().min(1).max(64),
4790
+ var pluginWaitRequestSchema = z36.object({
4791
+ kind: z36.string().min(1).max(64),
4738
4792
  ...registrationFields
4739
- }).catchall(z35.unknown()).refine((request) => !builtInRequestKinds.has(request.kind), { path: ["kind"], message: "built-in wait kinds require their built-in request shape" });
4740
- var waitRequestInputSchema = z35.union([builtInSquawkWaitRequestSchema, pluginWaitRequestSchema]);
4741
- var squawkWaitRequestSchema = z35.custom().transform((request, ctx) => {
4793
+ }).catchall(z36.unknown()).refine((request) => !builtInRequestKinds.has(request.kind), { path: ["kind"], message: "built-in wait kinds require their built-in request shape" });
4794
+ var waitRequestInputSchema = z36.union([builtInSquawkWaitRequestSchema, pluginWaitRequestSchema]);
4795
+ var squawkWaitRequestSchema = z36.custom().transform((request, ctx) => {
4742
4796
  const kind = request && typeof request === "object" && "kind" in request ? request.kind : void 0;
4743
4797
  const schema = typeof kind === "string" && builtInRequestKinds.has(kind) ? builtInSquawkWaitRequestSchema : pluginWaitRequestSchema;
4744
4798
  const parsed = schema.safeParse(request);
4745
4799
  if (!parsed.success) {
4746
4800
  for (const issue of parsed.error.issues) ctx.addIssue({ ...issue });
4747
- return z35.NEVER;
4801
+ return z36.NEVER;
4748
4802
  }
4749
4803
  return parsed.data;
4750
4804
  });
4751
- var squawkCancelWaitRequestSchema = z35.object({ wait_id: z35.uuid() }).strict();
4752
- var message = z35.string().max(WAIT_MESSAGE_MAX);
4805
+ var squawkCancelWaitRequestSchema = z36.object({ wait_id: z36.uuid() }).strict();
4806
+ var message = z36.string().max(WAIT_MESSAGE_MAX);
4753
4807
  var registrationAnswerFields = {
4754
- operation_id: z35.uuid().optional()
4808
+ operation_id: z36.uuid().optional()
4755
4809
  };
4756
- var squawkWaitAnswerSchema = z35.discriminatedUnion("ok", [
4757
- z35.object({
4758
- ok: z35.literal(true),
4810
+ var squawkWaitAnswerSchema = z36.discriminatedUnion("ok", [
4811
+ z36.object({
4812
+ ok: z36.literal(true),
4759
4813
  ...registrationAnswerFields,
4760
- effect: z35.enum(["applied", "unchanged"]).optional(),
4761
- deduplicated: z35.boolean().optional(),
4762
- replayed: z35.boolean().optional(),
4763
- wait_phase: z35.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
4764
- wait_id: z35.uuid(),
4814
+ effect: z36.enum(["applied", "unchanged"]).optional(),
4815
+ deduplicated: z36.boolean().optional(),
4816
+ replayed: z36.boolean().optional(),
4817
+ wait_phase: z36.enum([...waitPhaseSchema.options, "unavailable"]).optional(),
4818
+ wait_id: z36.uuid(),
4765
4819
  /** The kind the call asked for: a `request` wait is stored as a `worker` entry. */
4766
- kind: z35.string().min(1).max(64),
4767
- deadline: z35.iso.datetime().optional(),
4768
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
4820
+ kind: z36.string().min(1).max(64),
4821
+ deadline: z36.iso.datetime().optional(),
4822
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
4769
4823
  }).strict().superRefine((answer, ctx) => {
4770
4824
  if (builtInRequestKinds.has(answer.kind) && answer.deadline === void 0) {
4771
4825
  ctx.addIssue({ code: "invalid_type", expected: "string", path: ["deadline"], message: "Invalid input: expected string, received undefined" });
4772
4826
  }
4773
4827
  }),
4774
- z35.object({
4775
- ok: z35.literal(false),
4828
+ z36.object({
4829
+ ok: z36.literal(false),
4776
4830
  ...registrationAnswerFields,
4777
- effect: z35.enum(["refused", "unknown"]).optional(),
4831
+ effect: z36.enum(["refused", "unknown"]).optional(),
4778
4832
  retained_wait: openWaitSchema.optional(),
4779
4833
  code: waitErrorCodeSchema,
4780
4834
  message,
4781
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
4835
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
4782
4836
  }).strict()
4783
4837
  ]);
4784
4838
  var squawkAskRequestSchema = askRequestSchema.extend({ context: askContextSchema });
4785
- var squawkAskAnswerSchema = z35.discriminatedUnion("ok", [
4786
- z35.object({ ok: z35.literal(true), wait_id: z35.uuid(), open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
4787
- z35.object({
4788
- ok: z35.literal(false),
4839
+ var squawkAskAnswerSchema = z36.discriminatedUnion("ok", [
4840
+ z36.object({ ok: z36.literal(true), wait_id: z36.uuid(), open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
4841
+ z36.object({
4842
+ ok: z36.literal(false),
4789
4843
  code: askErrorCodeSchema,
4790
4844
  message,
4791
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
4845
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
4792
4846
  }).strict()
4793
4847
  ]);
4794
- var squawkCancelWaitAnswerSchema = z35.discriminatedUnion("cancelled", [
4795
- z35.object({
4796
- cancelled: z35.literal(true),
4797
- wait_id: z35.uuid(),
4798
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
4848
+ var squawkCancelWaitAnswerSchema = z36.discriminatedUnion("cancelled", [
4849
+ z36.object({
4850
+ cancelled: z36.literal(true),
4851
+ wait_id: z36.uuid(),
4852
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
4799
4853
  }).strict(),
4800
- z35.object({
4801
- cancelled: z35.literal(false),
4802
- code: z35.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
4854
+ z36.object({
4855
+ cancelled: z36.literal(false),
4856
+ code: z36.enum(["not_found", "already_resolved", "human_question", "invalid_request", "unavailable"]),
4803
4857
  message,
4804
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional()
4858
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional()
4805
4859
  }).strict()
4806
4860
  ]);
4807
- var squawkDoneRequestSchema = z35.object({ summary: z35.string().max(2e3).optional() }).strict();
4861
+ var squawkDoneRequestSchema = z36.object({ summary: z36.string().max(2e3).optional() }).strict();
4808
4862
  var doneAccepted = {
4809
- ok: z35.literal(true),
4810
- finishes: z35.literal("at_turn_end"),
4811
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT)
4863
+ ok: z36.literal(true),
4864
+ finishes: z36.literal("at_turn_end"),
4865
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT)
4812
4866
  };
4813
- var squawkDoneAnswerSchema = z35.discriminatedUnion("ok", [
4814
- z35.discriminatedUnion("completes", [
4815
- z35.object({ ...doneAccepted, completes: z35.literal("task") }).strict(),
4816
- z35.object({ ...doneAccepted, completes: z35.literal("step"), next_step: z35.string().min(1) }).strict()
4867
+ var squawkDoneAnswerSchema = z36.discriminatedUnion("ok", [
4868
+ z36.discriminatedUnion("completes", [
4869
+ z36.object({ ...doneAccepted, completes: z36.literal("task") }).strict(),
4870
+ z36.object({ ...doneAccepted, completes: z36.literal("step"), next_step: z36.string().min(1) }).strict()
4817
4871
  ]),
4818
- z35.object({
4819
- ok: z35.literal(false),
4872
+ z36.object({
4873
+ ok: z36.literal(false),
4820
4874
  code: doneErrorCodeSchema,
4821
4875
  message,
4822
4876
  /** The workers that block the finish, and why each one does. */
4823
- workers: z35.array(z35.object({
4824
- worker_id: z35.string(),
4825
- reason: z35.enum(["outstanding", "uncollected", "question"])
4877
+ workers: z36.array(z36.object({
4878
+ worker_id: z36.string(),
4879
+ reason: z36.enum(["outstanding", "uncollected", "question"])
4826
4880
  }).strict()).max(64).optional(),
4827
- open_waits: z35.array(openWaitSchema).max(WAIT_LIMIT).optional(),
4881
+ open_waits: z36.array(openWaitSchema).max(WAIT_LIMIT).optional(),
4828
4882
  /** `input_pending` (hearsay-tools/squawk#2587): what the run still owes the agent. */
4829
- owed: z35.array(doneOwedInputSchema).max(64).optional()
4883
+ owed: z36.array(doneOwedInputSchema).max(64).optional()
4830
4884
  }).strict()
4831
4885
  ]);
4832
4886
 
@@ -5029,75 +5083,75 @@ function sqlPrefilterTokens(query, options = {}) {
5029
5083
  }
5030
5084
 
5031
5085
  // ../contract/src/artifacts.ts
5032
- import { z as z36 } from "zod";
5033
- var pathSchema = z36.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
5034
- var publishedArtifactSchema = z36.object({
5035
- id: z36.uuid(),
5036
- runId: z36.uuid(),
5037
- name: z36.string().min(1).max(255),
5038
- title: z36.string().max(200).optional(),
5086
+ import { z as z37 } from "zod";
5087
+ var pathSchema = z37.string().min(1).max(8192).refine((value) => !value.includes("\0"), "Path contains NUL");
5088
+ var publishedArtifactSchema = z37.object({
5089
+ id: z37.uuid(),
5090
+ runId: z37.uuid(),
5091
+ name: z37.string().min(1).max(255),
5092
+ title: z37.string().max(200).optional(),
5039
5093
  sourcePath: pathSchema.refine((value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value), "Expected an absolute source path"),
5040
- createdAt: z36.iso.datetime(),
5041
- size: z36.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
5042
- sha256: z36.string().regex(/^[a-f0-9]{64}$/)
5094
+ createdAt: z37.iso.datetime(),
5095
+ size: z37.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
5096
+ sha256: z37.string().regex(/^[a-f0-9]{64}$/)
5043
5097
  }).strict();
5044
- var filePreviewDataSchema = z36.object({
5045
- type: z36.literal("file"),
5098
+ var filePreviewDataSchema = z37.object({
5099
+ type: z37.literal("file"),
5046
5100
  path: pathSchema,
5047
- size: z36.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
5048
- binary: z36.boolean(),
5049
- tooLarge: z36.boolean(),
5050
- content: z36.string().optional(),
5051
- source: z36.enum(["worktree", "project", "artifact"]),
5101
+ size: z37.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
5102
+ binary: z37.boolean(),
5103
+ tooLarge: z37.boolean(),
5104
+ content: z37.string().optional(),
5105
+ source: z37.enum(["worktree", "project", "artifact"]),
5052
5106
  artifact: publishedArtifactSchema.optional()
5053
5107
  }).strict();
5054
- var fileLinkResultSchema = z36.union([
5108
+ var fileLinkResultSchema = z37.union([
5055
5109
  filePreviewDataSchema,
5056
- z36.object({
5057
- type: z36.enum(["unavailable", "unpublished"]),
5110
+ z37.object({
5111
+ type: z37.enum(["unavailable", "unpublished"]),
5058
5112
  path: pathSchema,
5059
- reason: z36.string().min(1).max(4096)
5113
+ reason: z37.string().min(1).max(4096)
5060
5114
  }).strict()
5061
5115
  ]);
5062
- var artifactMetadataResponseSchema = z36.object({ artifact: publishedArtifactSchema }).strict();
5063
- var artifactListSchema = z36.object({ artifacts: z36.array(publishedArtifactSchema).max(64) }).strict();
5064
- var fileLinkQuerySchema = z36.object({ path: pathSchema, raw: z36.literal("1").optional() }).strict();
5065
- var artifactParamsSchema = z36.object({ id: z36.uuid(), artifactId: z36.uuid() });
5116
+ var artifactMetadataResponseSchema = z37.object({ artifact: publishedArtifactSchema }).strict();
5117
+ var artifactListSchema = z37.object({ artifacts: z37.array(publishedArtifactSchema).max(64) }).strict();
5118
+ var fileLinkQuerySchema = z37.object({ path: pathSchema, raw: z37.literal("1").optional() }).strict();
5119
+ var artifactParamsSchema = z37.object({ id: z37.uuid(), artifactId: z37.uuid() });
5066
5120
 
5067
5121
  // ../contract/src/discovery.ts
5068
- import { z as z37 } from "zod";
5069
- var hostDiscoveryRequestSchema = z37.discriminatedUnion("kind", [
5070
- z37.object({ kind: z37.literal("runners") }).strict(),
5071
- z37.object({ kind: z37.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
5122
+ import { z as z38 } from "zod";
5123
+ var hostDiscoveryRequestSchema = z38.discriminatedUnion("kind", [
5124
+ z38.object({ kind: z38.literal("runners") }).strict(),
5125
+ z38.object({ kind: z38.literal("models"), runner: modelDiscoveryRunnerSchema }).strict()
5072
5126
  ]);
5073
- var discoveryRequestSchema = z37.discriminatedUnion("kind", [
5127
+ var discoveryRequestSchema = z38.discriminatedUnion("kind", [
5074
5128
  ...hostDiscoveryRequestSchema.options,
5075
- z37.object({ kind: z37.literal("tasks"), all: z37.boolean().optional(), offset: z37.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
5129
+ z38.object({ kind: z38.literal("tasks"), all: z38.boolean().optional(), offset: z38.number().int().min(0).max(Number.MAX_SAFE_INTEGER).optional() }).strict()
5076
5130
  ]);
5077
5131
  var discoveredRunnerSchema = providerStatusSchema.omit({ provider: true, profileId: true }).extend({ runner: modelDiscoveryRunnerSchema });
5078
- var discoveredRunnersSchema = z37.object({
5079
- scope: z37.literal("host-default-account"),
5080
- runners: z37.array(discoveredRunnerSchema)
5081
- });
5082
- var discoveredTasksSchema = z37.object({
5083
- tasks: z37.array(z37.object({
5084
- id: z37.string(),
5085
- title: z37.string(),
5132
+ var discoveredRunnersSchema = z38.object({
5133
+ scope: z38.literal("host-default-account"),
5134
+ runners: z38.array(discoveredRunnerSchema)
5135
+ });
5136
+ var discoveredTasksSchema = z38.object({
5137
+ tasks: z38.array(z38.object({
5138
+ id: z38.string(),
5139
+ title: z38.string(),
5086
5140
  runner: runnerSchema.optional(),
5087
5141
  status: runStatusSchema,
5088
- attention: z37.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
5089
- attentionLabel: z37.string(),
5090
- accepts: z37.boolean(),
5091
- reason: z37.string().optional()
5142
+ attention: z38.enum(["permission", "error", "waiting", "running", "unseen", "none"]),
5143
+ attentionLabel: z38.string(),
5144
+ accepts: z38.boolean(),
5145
+ reason: z38.string().optional()
5092
5146
  })).max(32),
5093
- nextOffset: z37.number().int().nonnegative().optional(),
5147
+ nextOffset: z38.number().int().nonnegative().optional(),
5094
5148
  /** The caller's own family ledger load; no recipient inbox. */
5095
5149
  capacity: conversationCapacitySchema.optional()
5096
5150
  });
5097
- var discoveryResponseSchema = z37.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
5151
+ var discoveryResponseSchema = z38.union([discoveredRunnersSchema, runnerModelCatalogResponseSchema, discoveredTasksSchema]);
5098
5152
 
5099
5153
  // ../contract/src/live.ts
5100
- import { z as z38 } from "zod";
5154
+ import { z as z39 } from "zod";
5101
5155
 
5102
5156
  // ../contract/src/live-limits.ts
5103
5157
  var LIVE_RUN_LIMIT = 32;
@@ -5105,46 +5159,46 @@ var LIVE_EVENT_LIMIT = 256;
5105
5159
  var LIVE_BYTE_LIMIT = 1024 * 1024;
5106
5160
 
5107
5161
  // ../contract/src/live.ts
5108
- var liveRunDemandSchema = z38.object({
5109
- projectId: z38.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
5162
+ var liveRunDemandSchema = z39.object({
5163
+ projectId: z39.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
5110
5164
  runId: runIdParamSchema.shape.id,
5111
5165
  cursor: runHistoryCursorSchema.optional(),
5112
- afterSeq: z38.number().int().nonnegative().safe()
5166
+ afterSeq: z39.number().int().nonnegative().safe()
5113
5167
  });
5114
- var liveRunsRequestSchema = z38.object({
5115
- runs: z38.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
5168
+ var liveRunsRequestSchema = z39.object({
5169
+ runs: z39.array(liveRunDemandSchema).min(1).max(LIVE_RUN_LIMIT)
5116
5170
  }).refine(({ runs }) => new Set(runs.map((r) => `${r.projectId}/${r.runId}`)).size === runs.length, {
5117
5171
  message: "duplicate run demand"
5118
5172
  });
5119
5173
  var identity = liveRunDemandSchema.pick({ projectId: true, runId: true });
5120
5174
  var liveRunErrorSchema = identity.extend({
5121
- type: z38.enum(["error", "reset"]),
5122
- status: z38.union([z38.literal(400), z38.literal(404), z38.literal(409), z38.literal(413), z38.literal(503)]),
5123
- error: z38.string()
5175
+ type: z39.enum(["error", "reset"]),
5176
+ status: z39.union([z39.literal(400), z39.literal(404), z39.literal(409), z39.literal(413), z39.literal(503)]),
5177
+ error: z39.string()
5124
5178
  });
5125
5179
  var liveRunBatchSchema = identity.extend({
5126
- type: z38.literal("batch"),
5127
- events: z38.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
5128
- snapshots: z38.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT).optional(),
5180
+ type: z39.literal("batch"),
5181
+ events: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
5182
+ snapshots: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT).optional(),
5129
5183
  cursor: runHistoryCursorSchema,
5130
- afterSeq: z38.number().int().nonnegative(),
5131
- hasMore: z38.boolean()
5132
- });
5133
- var liveRunBatchResultSchema = z38.union([liveRunBatchSchema, liveRunErrorSchema]);
5134
- var liveRunBatchResponseSchema = z38.object({
5135
- generation: z38.string(),
5136
- results: z38.array(liveRunBatchResultSchema)
5137
- });
5138
- var liveRunFrameSchema = z38.union([
5139
- z38.object({ type: z38.literal("ready"), generation: z38.string() }),
5140
- z38.object({ type: z38.literal("ping") }),
5141
- identity.extend({ type: z38.literal("event"), name: z38.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
5142
- identity.extend({ type: z38.literal("snapshot"), name: z38.literal("ui-event"), event: runHistoryEventSchema }),
5184
+ afterSeq: z39.number().int().nonnegative(),
5185
+ hasMore: z39.boolean()
5186
+ });
5187
+ var liveRunBatchResultSchema = z39.union([liveRunBatchSchema, liveRunErrorSchema]);
5188
+ var liveRunBatchResponseSchema = z39.object({
5189
+ generation: z39.string(),
5190
+ results: z39.array(liveRunBatchResultSchema)
5191
+ });
5192
+ var liveRunFrameSchema = z39.union([
5193
+ z39.object({ type: z39.literal("ready"), generation: z39.string() }),
5194
+ z39.object({ type: z39.literal("ping") }),
5195
+ identity.extend({ type: z39.literal("event"), name: z39.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
5196
+ identity.extend({ type: z39.literal("snapshot"), name: z39.literal("ui-event"), event: runHistoryEventSchema }),
5143
5197
  liveRunErrorSchema
5144
5198
  ]);
5145
5199
 
5146
5200
  // ../contract/src/activity.ts
5147
- import { z as z39 } from "zod";
5201
+ import { z as z40 } from "zod";
5148
5202
  var ACTIVITY_RATE_SECONDS = 30;
5149
5203
  var ACTIVITY_TEXT_MAX = 500;
5150
5204
  var ACTIVITY_ERROR_MAX = 200;
@@ -5152,145 +5206,145 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
5152
5206
  var ACTIVITY_CHECKS_MAX = 100;
5153
5207
  var ACTIVITY_CHECK_NAME_MAX = 100;
5154
5208
  var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
5155
- var iso = z39.iso.datetime();
5156
- var count = z39.number().int().nonnegative();
5157
- var runId = z39.string().min(1);
5209
+ var iso = z40.iso.datetime();
5210
+ var count = z40.number().int().nonnegative();
5211
+ var runId = z40.string().min(1);
5158
5212
  var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
5159
- var activityToolSchema = z39.object({
5160
- title: z39.string().max(ACTIVITY_TOOL_TITLE_MAX),
5161
- toolKind: z39.enum(ACTIVITY_TOOL_KINDS),
5162
- status: z39.enum(["pending", "running", "completed", "failed", "declined"]),
5213
+ var activityToolSchema = z40.object({
5214
+ title: z40.string().max(ACTIVITY_TOOL_TITLE_MAX),
5215
+ toolKind: z40.enum(ACTIVITY_TOOL_KINDS),
5216
+ status: z40.enum(["pending", "running", "completed", "failed", "declined"]),
5163
5217
  startedAt: iso,
5164
5218
  endedAt: iso.optional()
5165
5219
  }).strict();
5166
- var activityCheckBucketSchema = z39.enum(["pass", "fail", "pending", "skipping", "cancel"]);
5167
- var activityPrProgressSchema = z39.object({
5168
- checks: z39.array(z39.object({ name: z39.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
5169
- counts: z39.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
5170
- truncated: z39.literal(true).optional()
5220
+ var activityCheckBucketSchema = z40.enum(["pass", "fail", "pending", "skipping", "cancel"]);
5221
+ var activityPrProgressSchema = z40.object({
5222
+ checks: z40.array(z40.object({ name: z40.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
5223
+ counts: z40.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
5224
+ truncated: z40.literal(true).optional()
5171
5225
  }).strict();
5172
- var activityWaitSchema = z39.discriminatedUnion("kind", [
5173
- z39.object({
5174
- kind: z39.literal("human"),
5226
+ var activityWaitSchema = z40.discriminatedUnion("kind", [
5227
+ z40.object({
5228
+ kind: z40.literal("human"),
5175
5229
  since: iso,
5176
- detail: z39.object({
5230
+ detail: z40.object({
5177
5231
  /** The ask card's first question. */
5178
- question: z39.string().max(ACTIVITY_TEXT_MAX).optional(),
5232
+ question: z40.string().max(ACTIVITY_TEXT_MAX).optional(),
5179
5233
  /** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
5180
5234
  * automatic-wake budget is spent; `completion`: Squawk's completion gate. */
5181
- reason: z39.enum(["question", "turn-end", "budget", "completion"]),
5235
+ reason: z40.enum(["question", "turn-end", "budget", "completion"]),
5182
5236
  /** Inputs not delivered yet, when there are any. */
5183
- queuedMessages: z39.number().int().positive().optional()
5237
+ queuedMessages: z40.number().int().positive().optional()
5184
5238
  }).strict()
5185
5239
  }).strict(),
5186
- z39.object({ kind: z39.literal("usage-limit"), detail: z39.object({ resumeAt: z39.string() }).strict() }).strict(),
5187
- z39.object({
5188
- kind: z39.literal("workers"),
5240
+ z40.object({ kind: z40.literal("usage-limit"), detail: z40.object({ resumeAt: z40.string() }).strict() }).strict(),
5241
+ z40.object({
5242
+ kind: z40.literal("workers"),
5189
5243
  since: iso,
5190
5244
  deadline: iso.optional(),
5191
- detail: z39.object({
5245
+ detail: z40.object({
5192
5246
  /** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
5193
5247
  owed: count,
5194
5248
  /** Targets named and targets settled, summed over the entries. */
5195
5249
  total: count,
5196
5250
  settled: count,
5197
5251
  /** Every open entry waits on request replies. */
5198
- replies: z39.literal(true).optional(),
5252
+ replies: z40.literal(true).optional(),
5199
5253
  /** Only when one entry is open. */
5200
5254
  mode: workerWaitModeSchema.optional(),
5201
5255
  /** Who owes the awaited replies, each once. */
5202
- recipientRunIds: z39.array(runId)
5256
+ recipientRunIds: z40.array(runId)
5203
5257
  }).strict()
5204
5258
  }).strict(),
5205
- z39.object({ kind: z39.literal("peers"), since: iso, deadline: iso, detail: z39.object({ peerRunIds: z39.array(runId) }).strict() }).strict(),
5206
- z39.object({ kind: z39.literal("subagents"), since: iso, deadline: iso, detail: z39.object({ running: count }).strict() }).strict(),
5207
- z39.object({
5208
- kind: z39.literal("pr"),
5259
+ z40.object({ kind: z40.literal("peers"), since: iso, deadline: iso, detail: z40.object({ peerRunIds: z40.array(runId) }).strict() }).strict(),
5260
+ z40.object({ kind: z40.literal("subagents"), since: iso, deadline: iso, detail: z40.object({ running: count }).strict() }).strict(),
5261
+ z40.object({
5262
+ kind: z40.literal("pr"),
5209
5263
  since: iso,
5210
5264
  deadline: iso,
5211
- detail: z39.object({
5212
- number: z39.number().int().positive(),
5265
+ detail: z40.object({
5266
+ number: z40.number().int().positive(),
5213
5267
  target: prWaitUntilSchema,
5214
5268
  /** Check progress, while the CI progress registry holds some for this wait. */
5215
5269
  checks: activityPrProgressSchema.shape.checks.optional(),
5216
5270
  counts: activityPrProgressSchema.shape.counts.optional(),
5217
- truncated: z39.literal(true).optional()
5271
+ truncated: z40.literal(true).optional()
5218
5272
  }).strict()
5219
5273
  }).strict(),
5220
- z39.object({ kind: z39.literal("process"), since: iso, deadline: iso, detail: z39.object({ pid: z39.number().int(), note: z39.string().optional() }).strict() }).strict(),
5221
- z39.object({ kind: z39.literal("plugin"), since: iso, deadline: iso.optional(), detail: z39.object({ pluginKind: z39.string().min(1).max(64), summary: z39.string().max(256) }).strict() }).strict(),
5222
- z39.object({ kind: z39.literal("timer"), since: iso, deadline: iso, detail: z39.object({ wakeAt: iso, note: z39.string().optional() }).strict() }).strict()
5274
+ z40.object({ kind: z40.literal("process"), since: iso, deadline: iso, detail: z40.object({ pid: z40.number().int(), note: z40.string().optional() }).strict() }).strict(),
5275
+ z40.object({ kind: z40.literal("plugin"), since: iso, deadline: iso.optional(), detail: z40.object({ pluginKind: z40.string().min(1).max(64), summary: z40.string().max(256) }).strict() }).strict(),
5276
+ z40.object({ kind: z40.literal("timer"), since: iso, deadline: iso, detail: z40.object({ wakeAt: iso, note: z40.string().optional() }).strict() }).strict()
5223
5277
  ]);
5224
5278
  var activityRunShape = {
5225
5279
  runId,
5226
5280
  /** The display title: `titleSummary ?? title`. */
5227
- title: z39.string(),
5281
+ title: z40.string(),
5228
5282
  status: runStatusSchema,
5229
5283
  /** The `deriveAttention` rung id, never a label. */
5230
- rung: z39.enum(ATTENTION_RUNGS),
5284
+ rung: z40.enum(ATTENTION_RUNGS),
5231
5285
  runner: runnerSchema.optional(),
5232
- model: z39.string().optional(),
5233
- currentStepId: z39.string().optional(),
5234
- startedAt: z39.string().optional(),
5286
+ model: z40.string().optional(),
5287
+ currentStepId: z40.string().optional(),
5288
+ startedAt: z40.string().optional(),
5235
5289
  wait: activityWaitSchema.optional(),
5236
5290
  tool: activityToolSchema.optional(),
5237
5291
  /** Tool calls started per second, oldest first. */
5238
- rate: z39.array(count).length(ACTIVITY_RATE_SECONDS),
5292
+ rate: z40.array(count).length(ACTIVITY_RATE_SECONDS),
5239
5293
  /** One line of `RunRecord.error`. */
5240
- error: z39.string().max(ACTIVITY_ERROR_MAX).optional()
5294
+ error: z40.string().max(ACTIVITY_ERROR_MAX).optional()
5241
5295
  };
5242
- var activityWorkerSchema = z39.object({
5296
+ var activityWorkerSchema = z40.object({
5243
5297
  ...activityRunShape,
5244
5298
  /** The worker's current execution revision. */
5245
5299
  revision: count,
5246
5300
  /** The parent holds a collected result for this revision. */
5247
- collected: z39.boolean()
5301
+ collected: z40.boolean()
5248
5302
  }).strict();
5249
- var activityRunSchema = z39.object({ ...activityRunShape, workers: z39.array(activityWorkerSchema) }).strict();
5250
- var activityRequestSchema = z39.object({
5251
- requestId: z39.uuid(),
5252
- relationship: z39.enum(["family", "peer"]),
5303
+ var activityRunSchema = z40.object({ ...activityRunShape, workers: z40.array(activityWorkerSchema) }).strict();
5304
+ var activityRequestSchema = z40.object({
5305
+ requestId: z40.uuid(),
5306
+ relationship: z40.enum(["family", "peer"]),
5253
5307
  senderRunId: runId,
5254
5308
  recipientRunId: runId,
5255
- text: z39.string().max(ACTIVITY_TEXT_MAX),
5256
- senderTitle: z39.string().optional(),
5257
- recipientTitle: z39.string().optional(),
5309
+ text: z40.string().max(ACTIVITY_TEXT_MAX),
5310
+ senderTitle: z40.string().optional(),
5311
+ recipientTitle: z40.string().optional(),
5258
5312
  createdAt: iso,
5259
5313
  deadline: iso.optional()
5260
5314
  }).strict();
5261
- var activityClosedRequestSchema = z39.object({
5262
- requestId: z39.uuid(),
5315
+ var activityClosedRequestSchema = z40.object({
5316
+ requestId: z40.uuid(),
5263
5317
  senderRunId: runId,
5264
5318
  recipientRunId: runId,
5265
5319
  status: requestOutcomeSchema.shape.status,
5266
5320
  observedAt: iso
5267
5321
  }).strict();
5268
- var activityProjectSchema = z39.object({
5269
- projectId: z39.string(),
5270
- name: z39.string(),
5322
+ var activityProjectSchema = z40.object({
5323
+ projectId: z40.string(),
5324
+ name: z40.string(),
5271
5325
  /** False for a project this process has not loaded: its lists are empty because nothing was read. */
5272
- loaded: z39.boolean(),
5326
+ loaded: z40.boolean(),
5273
5327
  /** The project is loaded but its run store cannot open: the failure its project routes answer.
5274
5328
  * The lists are empty because nothing could be read, not because nothing runs. */
5275
- unavailable: z39.object({ status: z39.union([z39.literal(404), z39.literal(409), z39.literal(503)]), error: z39.string() }).strict().optional(),
5329
+ unavailable: z40.object({ status: z40.union([z40.literal(404), z40.literal(409), z40.literal(503)]), error: z40.string() }).strict().optional(),
5276
5330
  /** Root tasks in review: the summary chip (D8). */
5277
5331
  inReview: count,
5278
- tasks: z39.array(activityRunSchema),
5279
- requests: z39.array(activityRequestSchema),
5280
- closed: z39.array(activityClosedRequestSchema)
5332
+ tasks: z40.array(activityRunSchema),
5333
+ requests: z40.array(activityRequestSchema),
5334
+ closed: z40.array(activityClosedRequestSchema)
5281
5335
  }).strict();
5282
- var activitySnapshotSchema = z39.object({
5336
+ var activitySnapshotSchema = z40.object({
5283
5337
  /** The server clock; the client ticks ages from it. */
5284
5338
  generatedAt: iso,
5285
5339
  /** One entry, or every visible project for the global read. */
5286
- projects: z39.array(activityProjectSchema)
5340
+ projects: z40.array(activityProjectSchema)
5287
5341
  }).strict();
5288
- var activityQuerySchema = z39.object({
5289
- project: z39.union([z39.literal("default"), z39.string().regex(PROJECT_ID_PATTERN)]).optional()
5342
+ var activityQuerySchema = z40.object({
5343
+ project: z40.union([z40.literal("default"), z40.string().regex(PROJECT_ID_PATTERN)]).optional()
5290
5344
  });
5291
5345
 
5292
5346
  // ../contract/src/live-coordination.ts
5293
- import { z as z40 } from "zod";
5347
+ import { z as z41 } from "zod";
5294
5348
  var LIVE_PROTOCOL = 4;
5295
5349
  var LIVE_WORKER_NAME = "cezar-live-v4";
5296
5350
  var LEASE_MS = 15e3;
@@ -5299,112 +5353,112 @@ function allowedLiveRead(path) {
5299
5353
  if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
5300
5354
  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);
5301
5355
  }
5302
- var liveDemandSchema = z40.discriminatedUnion("kind", [
5303
- z40.object({ kind: z40.literal("workspace") }),
5304
- liveRunDemandSchema.extend({ kind: z40.literal("run") }),
5305
- z40.object({ kind: z40.literal("topic"), topic: z40.string().min(1).max(128) }),
5356
+ var liveDemandSchema = z41.discriminatedUnion("kind", [
5357
+ z41.object({ kind: z41.literal("workspace") }),
5358
+ liveRunDemandSchema.extend({ kind: z41.literal("run") }),
5359
+ z41.object({ kind: z41.literal("topic"), topic: z41.string().min(1).max(128) }),
5306
5360
  // Preserve server-directed cadence (settled references use ten minutes). Only
5307
5361
  // bound the timer itself: larger delays overflow setTimeout into a tight loop.
5308
- z40.object({ kind: z40.literal("read"), path: z40.string().max(4096).refine(allowedLiveRead), intervalMs: z40.number().int().min(1e3).max(2147483647) })
5362
+ z41.object({ kind: z41.literal("read"), path: z41.string().max(4096).refine(allowedLiveRead), intervalMs: z41.number().int().min(1e3).max(2147483647) })
5309
5363
  ]);
5310
- var liveEntrySchema = z40.object({ id: z40.string().min(1).max(128), demand: liveDemandSchema });
5311
- var envelope = z40.object({ version: z40.literal(LIVE_PROTOCOL), documentId: z40.string().min(1).max(128), epoch: z40.number().int().nonnegative() });
5312
- var ownerInputSchema = z40.discriminatedUnion("type", [
5364
+ var liveEntrySchema = z41.object({ id: z41.string().min(1).max(128), demand: liveDemandSchema });
5365
+ var envelope = z41.object({ version: z41.literal(LIVE_PROTOCOL), documentId: z41.string().min(1).max(128), epoch: z41.number().int().nonnegative() });
5366
+ var ownerInputSchema = z41.discriminatedUnion("type", [
5313
5367
  envelope.extend({
5314
- type: z40.literal("sync"),
5315
- entries: z40.array(liveEntrySchema).max(64),
5368
+ type: z41.literal("sync"),
5369
+ entries: z41.array(liveEntrySchema).max(64),
5316
5370
  /** The document knows no workspace stream generation (its `ready` was lost, for example to
5317
5371
  * an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
5318
- workspaceReady: z40.literal(true).optional()
5372
+ workspaceReady: z41.literal(true).optional()
5319
5373
  }).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
5320
- envelope.extend({ type: z40.literal("ack"), id: z40.string(), seq: z40.number().int().nonnegative() }),
5321
- envelope.extend({ type: z40.literal("ack-snapshot"), id: z40.string() }),
5322
- envelope.extend({ type: z40.literal("refresh"), id: z40.string() })
5374
+ envelope.extend({ type: z41.literal("ack"), id: z41.string(), seq: z41.number().int().nonnegative() }),
5375
+ envelope.extend({ type: z41.literal("ack-snapshot"), id: z41.string() }),
5376
+ envelope.extend({ type: z41.literal("refresh"), id: z41.string() })
5323
5377
  ]);
5324
- var wireFrameSchema = z40.object({ event: z40.string(), data: z40.string(), id: z40.string() });
5325
- var ownerOutputSchema = z40.discriminatedUnion("type", [
5326
- z40.object({ type: z40.literal("unavailable"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), reason: z40.string() }),
5327
- z40.object({ type: z40.literal("hello"), version: z40.literal(LIVE_PROTOCOL) }),
5328
- z40.object({ type: z40.literal("alive"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number() }),
5329
- z40.object({ type: z40.literal("frame"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), frame: z40.union([wireFrameSchema, liveRunFrameSchema]) }),
5330
- z40.object({ type: z40.literal("value"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), value: z40.unknown(), error: z40.string().optional() }),
5331
- z40.object({ type: z40.literal("reset"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), reason: z40.string() })
5378
+ var wireFrameSchema = z41.object({ event: z41.string(), data: z41.string(), id: z41.string() });
5379
+ var ownerOutputSchema = z41.discriminatedUnion("type", [
5380
+ z41.object({ type: z41.literal("unavailable"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), reason: z41.string() }),
5381
+ z41.object({ type: z41.literal("hello"), version: z41.literal(LIVE_PROTOCOL) }),
5382
+ z41.object({ type: z41.literal("alive"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number() }),
5383
+ z41.object({ type: z41.literal("frame"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), frame: z41.union([wireFrameSchema, liveRunFrameSchema]) }),
5384
+ z41.object({ type: z41.literal("value"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), value: z41.unknown(), error: z41.string().optional() }),
5385
+ z41.object({ type: z41.literal("reset"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), reason: z41.string() })
5332
5386
  ]);
5333
5387
  var runKey = (run) => `${run.projectId}/${run.runId}`;
5334
5388
 
5335
5389
  // ../contract/src/workspace-events.ts
5336
- import { z as z41 } from "zod";
5337
- var workspaceEventsQuerySchema = z41.object({
5338
- runs: z41.literal("summary").optional()
5390
+ import { z as z42 } from "zod";
5391
+ var workspaceEventsQuerySchema = z42.object({
5392
+ runs: z42.literal("summary").optional()
5339
5393
  });
5340
- var projectStamp = z41.string().min(1);
5341
- var frameSeq = z41.number().int().positive();
5342
- var workspaceRunSummaryEventSchema = z41.object({
5394
+ var projectStamp = z42.string().min(1);
5395
+ var frameSeq = z42.number().int().positive();
5396
+ var workspaceRunSummaryEventSchema = z42.object({
5343
5397
  project: projectStamp,
5344
5398
  seq: frameSeq,
5345
5399
  run: runSummarySchema,
5346
- relationships: z41.string().min(1)
5400
+ relationships: z42.string().min(1)
5347
5401
  });
5348
- var workspaceRunDeletedEventSchema = z41.object({
5402
+ var workspaceRunDeletedEventSchema = z42.object({
5349
5403
  project: projectStamp,
5350
5404
  seq: frameSeq,
5351
- id: z41.string().min(1)
5405
+ id: z42.string().min(1)
5352
5406
  });
5353
- var workspaceReadyEventSchema = z41.object({
5354
- generation: z41.string().min(1),
5355
- seq: z41.number().int().nonnegative()
5407
+ var workspaceReadyEventSchema = z42.object({
5408
+ generation: z42.string().min(1),
5409
+ seq: z42.number().int().nonnegative()
5356
5410
  });
5357
- var workspaceUsageEventSchema = z41.object({
5411
+ var workspaceUsageEventSchema = z42.object({
5358
5412
  project: projectStamp,
5359
- usage: z41.record(z41.string(), processUsageSchema)
5413
+ usage: z42.record(z42.string(), processUsageSchema)
5360
5414
  });
5361
- var runsIndexResponseSchema = z41.object({
5415
+ var runsIndexResponseSchema = z42.object({
5362
5416
  /** Newest first, across every registered project: each project's window
5363
5417
  * (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
5364
5418
  * archived root runs. Owned workers are never included. Older archived runs are reached
5365
5419
  * through `GET /workspace/runs-search`. */
5366
- runs: z41.array(runIndexEntrySchema),
5420
+ runs: z42.array(runIndexEntrySchema),
5367
5421
  /** Additive: absent statuses mean "nothing warm", never "nothing to show". */
5368
5422
  referenceStatuses: referenceStatusesByProjectSchema,
5369
5423
  /** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
5370
- perProjectLimit: z41.number(),
5424
+ perProjectLimit: z42.number(),
5371
5425
  /** Ids of the projects that had more archived root runs than `perProjectLimit`. */
5372
- truncated: z41.array(z41.string()),
5426
+ truncated: z42.array(z42.string()),
5373
5427
  /** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
5374
5428
  * compares only within one generation. */
5375
- generation: z41.string().min(1),
5429
+ generation: z42.string().min(1),
5376
5430
  /** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
5377
5431
  * frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
5378
- eventSeq: z41.number().int().nonnegative()
5432
+ eventSeq: z42.number().int().nonnegative()
5379
5433
  });
5380
5434
 
5381
5435
  // ../contract/src/permissions.ts
5382
- import { z as z42 } from "zod";
5383
- var permissionOptionKindSchema = z42.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
5384
- var permissionOptionSchema = z42.object({
5385
- id: z42.string().min(1).max(128),
5386
- label: z42.string().min(1),
5436
+ import { z as z43 } from "zod";
5437
+ var permissionOptionKindSchema = z43.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
5438
+ var permissionOptionSchema = z43.object({
5439
+ id: z43.string().min(1).max(128),
5440
+ label: z43.string().min(1),
5387
5441
  kind: permissionOptionKindSchema
5388
5442
  }).strict();
5389
- var permissionRequestedSchema = z42.object({
5390
- type: z42.literal("permission.requested"),
5391
- requestId: z42.string().min(1).max(128),
5392
- itemId: z42.string().optional(),
5393
- title: z42.string().min(1),
5394
- details: z42.string().optional(),
5395
- options: z42.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
5443
+ var permissionRequestedSchema = z43.object({
5444
+ type: z43.literal("permission.requested"),
5445
+ requestId: z43.string().min(1).max(128),
5446
+ itemId: z43.string().optional(),
5447
+ title: z43.string().min(1),
5448
+ details: z43.string().optional(),
5449
+ options: z43.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
5396
5450
  }).strict();
5397
- var permissionResolvedSchema = z42.object({
5398
- type: z42.literal("permission.resolved"),
5399
- requestId: z42.string().min(1).max(128),
5400
- optionId: z42.string().optional(),
5401
- reason: z42.string().optional()
5451
+ var permissionResolvedSchema = z43.object({
5452
+ type: z43.literal("permission.resolved"),
5453
+ requestId: z43.string().min(1).max(128),
5454
+ optionId: z43.string().optional(),
5455
+ reason: z43.string().optional()
5402
5456
  }).strict();
5403
- var permissionDecisionSchema = z42.object({
5404
- requestId: z42.string().min(1).max(128),
5405
- optionId: z42.string().min(1).max(128)
5457
+ var permissionDecisionSchema = z43.object({
5458
+ requestId: z43.string().min(1).max(128),
5459
+ optionId: z43.string().min(1).max(128)
5406
5460
  }).strict();
5407
- var permissionDecisionResponseSchema = z42.object({ delivered: z42.literal(true) });
5461
+ var permissionDecisionResponseSchema = z43.object({ delivered: z43.literal(true) });
5408
5462
 
5409
5463
  // ../contract/src/defined.ts
5410
5464
  function defined(value) {
@@ -5674,83 +5728,83 @@ function isImagePath(path) {
5674
5728
  }
5675
5729
 
5676
5730
  // ../contract/src/provider-requests.ts
5677
- import { z as z43 } from "zod";
5678
- var providerConnectSchema = z43.object({
5731
+ import { z as z44 } from "zod";
5732
+ var providerConnectSchema = z44.object({
5679
5733
  provider: runnerSchema,
5680
5734
  /** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
5681
5735
  * default, which is what every pre-profiles client sends. Without this, "Connect" on a second
5682
5736
  * Claude account would open a login for the FIRST one and report success. */
5683
- profileId: z43.string().max(64).optional()
5737
+ profileId: z44.string().max(64).optional()
5684
5738
  }).strict();
5685
- var createAgentProfileSchema = z43.object({
5739
+ var createAgentProfileSchema = z44.object({
5686
5740
  provider: runnerSchema,
5687
- label: z43.string().trim().max(200).optional(),
5688
- configDir: z43.string().trim().min(1).max(4096)
5741
+ label: z44.string().trim().max(200).optional(),
5742
+ configDir: z44.string().trim().min(1).max(4096)
5689
5743
  }).strict();
5690
- var updateAgentProfileSchema = z43.object({
5691
- label: z43.string().trim().max(200).optional(),
5692
- configDir: z43.string().trim().min(1).max(4096).optional()
5744
+ var updateAgentProfileSchema = z44.object({
5745
+ label: z44.string().trim().max(200).optional(),
5746
+ configDir: z44.string().trim().min(1).max(4096).optional()
5693
5747
  }).strict().refine(
5694
5748
  (value) => value.label !== void 0 || value.configDir !== void 0,
5695
5749
  "send label or configDir"
5696
5750
  );
5697
- var selectAgentProfileSchema = z43.object({
5698
- projectId: z43.string().min(1).max(64),
5751
+ var selectAgentProfileSchema = z44.object({
5752
+ projectId: z44.string().min(1).max(64),
5699
5753
  provider: runnerSchema,
5700
- profileId: z43.string().max(64).nullable()
5754
+ profileId: z44.string().max(64).nullable()
5701
5755
  }).strict();
5702
5756
  var providerParamSchema = runnerSchema;
5703
- var providerEnabledSchema = z43.object({ enabled: z43.boolean() }).strict();
5704
- var providerRetrySchema = z43.object({
5705
- authFailureId: z43.string().min(1).max(128)
5757
+ var providerEnabledSchema = z44.object({ enabled: z44.boolean() }).strict();
5758
+ var providerRetrySchema = z44.object({
5759
+ authFailureId: z44.string().min(1).max(128)
5706
5760
  }).strict();
5707
- var providerRouteParamsSchema = z43.object({ provider: providerParamSchema });
5708
- var agentProfileRouteParamsSchema = z43.object({ id: z43.string() });
5709
- var providerSignInParamsSchema = z43.object({ id: z43.uuid() });
5710
- var providerSignInRedirectSchema = z43.object({
5761
+ var providerRouteParamsSchema = z44.object({ provider: providerParamSchema });
5762
+ var agentProfileRouteParamsSchema = z44.object({ id: z44.string() });
5763
+ var providerSignInParamsSchema = z44.object({ id: z44.uuid() });
5764
+ var providerSignInRedirectSchema = z44.object({
5711
5765
  /** The address the browser landed on after consent, or the code that page shows. */
5712
- redirectUrl: z43.string().trim().min(1).max(8192)
5766
+ redirectUrl: z44.string().trim().min(1).max(8192)
5713
5767
  }).strict();
5714
5768
 
5715
5769
  // ../contract/src/automation-requests.ts
5716
- import { z as z45 } from "zod";
5770
+ import { z as z46 } from "zod";
5717
5771
 
5718
5772
  // ../contract/src/automation-storage.ts
5719
- import { z as z44 } from "zod";
5720
- var storedAutomationEventSchema = z44.enum([
5773
+ import { z as z45 } from "zod";
5774
+ var storedAutomationEventSchema = z45.enum([
5721
5775
  "pull_request.opened",
5722
5776
  "issue.opened",
5723
5777
  "issue.labeled",
5724
5778
  "issue.unlabeled"
5725
5779
  ]);
5726
- var boundedString = z44.string().trim().min(1).max(200);
5727
- var stringList = z44.array(boundedString).max(100).optional();
5728
- var storedAutomationFiltersSchema = z44.object({
5729
- includeExisting: z44.boolean().optional(),
5780
+ var boundedString = z45.string().trim().min(1).max(200);
5781
+ var stringList = z45.array(boundedString).max(100).optional();
5782
+ var storedAutomationFiltersSchema = z45.object({
5783
+ includeExisting: z45.boolean().optional(),
5730
5784
  /** Require an open item and matching live labels before reservation and launch. */
5731
- requireCurrentLabels: z44.boolean().optional(),
5785
+ requireCurrentLabels: z45.boolean().optional(),
5732
5786
  authors: stringList,
5733
5787
  assignees: stringList,
5734
5788
  allLabels: stringList,
5735
5789
  anyLabels: stringList,
5736
5790
  excludeLabels: stringList,
5737
5791
  changedLabels: stringList,
5738
- lookbackDays: z44.number().int().min(1).max(90).default(7),
5739
- maxRecords: z44.number().int().min(1).max(100).default(25)
5792
+ lookbackDays: z45.number().int().min(1).max(90).default(7),
5793
+ maxRecords: z45.number().int().min(1).max(100).default(25)
5740
5794
  }).passthrough();
5741
- var storedAutomationTaskSchema = z44.object({
5742
- prompt: z44.string().min(1).max(1e5),
5743
- workflow: z44.string().trim().min(1).max(200).optional(),
5744
- steps: z44.array(workflowStepDefSchema).min(1).max(100).optional(),
5795
+ var storedAutomationTaskSchema = z45.object({
5796
+ prompt: z45.string().min(1).max(1e5),
5797
+ workflow: z45.string().trim().min(1).max(200).optional(),
5798
+ steps: z45.array(workflowStepDefSchema).min(1).max(100).optional(),
5745
5799
  runner: runnerSchema.optional(),
5746
- model: z44.string().trim().min(1).max(200).optional(),
5747
- effort: z44.string().trim().min(1).max(32).optional(),
5748
- variants: z44.union([z44.literal(1), z44.literal(2), z44.literal(3)]).optional(),
5749
- worktree: z44.boolean().optional(),
5750
- autonomous: z44.boolean().optional(),
5800
+ model: z45.string().trim().min(1).max(200).optional(),
5801
+ effort: z45.string().trim().min(1).max(32).optional(),
5802
+ variants: z45.union([z45.literal(1), z45.literal(2), z45.literal(3)]).optional(),
5803
+ worktree: z45.boolean().optional(),
5804
+ autonomous: z45.boolean().optional(),
5751
5805
  ...completionControlsShape,
5752
5806
  ...taskAccessShape,
5753
- systemPrompt: z44.string().max(1e5).optional()
5807
+ systemPrompt: z45.string().max(1e5).optional()
5754
5808
  }).passthrough().refine((task) => !(task.workflow && task.steps), {
5755
5809
  message: "task selects either a named workflow or inline steps, not both"
5756
5810
  });
@@ -5768,122 +5822,122 @@ var fillGithubDefaults = (raw) => {
5768
5822
  filters: record.filters ?? {}
5769
5823
  };
5770
5824
  };
5771
- var storedAutomationDefinitionObjectSchema = z44.object({
5772
- id: z44.string().min(1).max(100),
5773
- revision: z44.number().int().positive(),
5774
- name: z44.string().trim().min(1).max(200),
5775
- description: z44.string().max(2e3).optional(),
5776
- enabled: z44.boolean().default(false),
5825
+ var storedAutomationDefinitionObjectSchema = z45.object({
5826
+ id: z45.string().min(1).max(100),
5827
+ revision: z45.number().int().positive(),
5828
+ name: z45.string().trim().min(1).max(200),
5829
+ description: z45.string().max(2e3).optional(),
5830
+ enabled: z45.boolean().default(false),
5777
5831
  /** A definition written before schedules has no `kind`: it is a poll. */
5778
5832
  kind: automationKindSchema.default("github"),
5779
- events: z44.array(storedAutomationEventSchema).min(1).max(4).optional(),
5780
- intervalSeconds: z44.number().int().min(60).max(86400).optional(),
5833
+ events: z45.array(storedAutomationEventSchema).min(1).max(4).optional(),
5834
+ intervalSeconds: z45.number().int().min(60).max(86400).optional(),
5781
5835
  filters: storedAutomationFiltersSchema.optional(),
5782
5836
  // Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
5783
5837
  schedule: automationScheduleSchema.passthrough().optional(),
5784
5838
  task: storedAutomationTaskSchema,
5785
5839
  /** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
5786
- archived: z44.object({
5787
- at: z44.string().datetime(),
5788
- outcome: z44.enum(["launched", "cancelled"]),
5789
- runId: z44.string().optional(),
5790
- receiptId: z44.string().optional(),
5791
- trigger: z44.enum(["schedule", "late", "manual", "retry"]).optional()
5840
+ archived: z45.object({
5841
+ at: z45.string().datetime(),
5842
+ outcome: z45.enum(["launched", "cancelled"]),
5843
+ runId: z45.string().optional(),
5844
+ receiptId: z45.string().optional(),
5845
+ trigger: z45.enum(["schedule", "late", "manual", "retry"]).optional()
5792
5846
  }).passthrough().optional(),
5793
- createdAt: z44.string().datetime(),
5794
- updatedAt: z44.string().datetime()
5847
+ createdAt: z45.string().datetime(),
5848
+ updatedAt: z45.string().datetime()
5795
5849
  }).passthrough().superRefine((definition, ctx) => {
5796
5850
  if (definition.kind === "schedule") {
5797
5851
  if (!definition.schedule) {
5798
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
5852
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
5799
5853
  }
5800
5854
  return;
5801
5855
  }
5802
5856
  if (!definition.events?.length) {
5803
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
5857
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
5804
5858
  }
5805
5859
  if (definition.intervalSeconds === void 0) {
5806
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
5860
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
5807
5861
  }
5808
5862
  if (!definition.filters) {
5809
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
5863
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
5810
5864
  }
5811
5865
  if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
5812
5866
  ctx.addIssue({
5813
- code: z44.ZodIssueCode.custom,
5867
+ code: z45.ZodIssueCode.custom,
5814
5868
  path: ["filters", "changedLabels"],
5815
5869
  message: "changedLabels is required for issue label events"
5816
5870
  });
5817
5871
  }
5818
5872
  });
5819
- var storedAutomationDefinitionSchema = z44.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
5820
- var storedAutomationDefinitionsFileSchema = z44.object({
5821
- version: z44.literal(1).default(1),
5822
- automations: z44.array(z44.unknown()).default([]),
5823
- tombstones: z44.record(z44.string(), z44.string().datetime()).optional()
5873
+ var storedAutomationDefinitionSchema = z45.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
5874
+ var storedAutomationDefinitionsFileSchema = z45.object({
5875
+ version: z45.literal(1).default(1),
5876
+ automations: z45.array(z45.unknown()).default([]),
5877
+ tombstones: z45.record(z45.string(), z45.string().datetime()).optional()
5824
5878
  }).passthrough();
5825
- var storedAutomationCursorSchema = z44.object({
5826
- timestamp: z44.string().datetime(),
5827
- tieBreaker: z44.string().optional()
5879
+ var storedAutomationCursorSchema = z45.object({
5880
+ timestamp: z45.string().datetime(),
5881
+ tieBreaker: z45.string().optional()
5828
5882
  }).passthrough();
5829
5883
  var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
5830
5884
  cursor: storedAutomationCursorSchema.optional()
5831
5885
  });
5832
- var storedAutomationRuntimeStateSchema = z44.object({
5833
- revision: z44.number().int().positive().optional(),
5834
- baselineAt: z44.string().datetime().optional(),
5886
+ var storedAutomationRuntimeStateSchema = z45.object({
5887
+ revision: z45.number().int().positive().optional(),
5888
+ baselineAt: z45.string().datetime().optional(),
5835
5889
  /** Arming time, independent of a history window's older lower bound. */
5836
- armedAt: z44.string().datetime().optional(),
5890
+ armedAt: z45.string().datetime().optional(),
5837
5891
  historyScan: storedAutomationHistoryScanSchema.optional(),
5838
5892
  cursor: storedAutomationCursorSchema.optional(),
5839
- frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
5840
- backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
5841
- nextCheckAt: z44.string().datetime().optional(),
5842
- lastSuccessAt: z44.string().datetime().optional(),
5893
+ frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
5894
+ backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
5895
+ nextCheckAt: z45.string().datetime().optional(),
5896
+ lastSuccessAt: z45.string().datetime().optional(),
5843
5897
  /** schedule kind: the next occurrence's instant and the last fired one's. */
5844
- nextRunAt: z44.string().datetime().optional(),
5845
- lastRunAt: z44.string().datetime().optional(),
5846
- etags: z44.record(z44.string(), z44.string()).optional(),
5847
- backoffUntil: z44.string().datetime().optional(),
5848
- consecutiveFailures: z44.number().int().nonnegative().optional(),
5898
+ nextRunAt: z45.string().datetime().optional(),
5899
+ lastRunAt: z45.string().datetime().optional(),
5900
+ etags: z45.record(z45.string(), z45.string()).optional(),
5901
+ backoffUntil: z45.string().datetime().optional(),
5902
+ consecutiveFailures: z45.number().int().nonnegative().optional(),
5849
5903
  ...automationLastErrorShape,
5850
5904
  /** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
5851
- onceOutcome: z44.enum(["failed", "missed"]).optional()
5905
+ onceOutcome: z45.enum(["failed", "missed"]).optional()
5852
5906
  }).passthrough();
5853
- var storedAutomationStateFileSchema = z44.object({
5854
- version: z44.literal(1).default(1),
5855
- states: z44.record(z44.string(), storedAutomationRuntimeStateSchema).default({})
5907
+ var storedAutomationStateFileSchema = z45.object({
5908
+ version: z45.literal(1).default(1),
5909
+ states: z45.record(z45.string(), storedAutomationRuntimeStateSchema).default({})
5856
5910
  }).passthrough();
5857
- var storedAutomationReceiptSchema = z44.object({
5858
- receiptId: z44.string().min(1),
5859
- receiptKey: z44.string().min(1),
5860
- eventId: z44.string().min(1),
5861
- automationId: z44.string().min(1),
5862
- revision: z44.number().int().positive(),
5863
- status: z44.enum(["reserved", "launched", "launch-error", "released"]),
5864
- runId: z44.string().optional(),
5865
- observedAt: z44.string().datetime(),
5866
- updatedAt: z44.string().datetime(),
5867
- error: z44.string().max(2e3).optional(),
5911
+ var storedAutomationReceiptSchema = z45.object({
5912
+ receiptId: z45.string().min(1),
5913
+ receiptKey: z45.string().min(1),
5914
+ eventId: z45.string().min(1),
5915
+ automationId: z45.string().min(1),
5916
+ revision: z45.number().int().positive(),
5917
+ status: z45.enum(["reserved", "launched", "launch-error", "released"]),
5918
+ runId: z45.string().optional(),
5919
+ observedAt: z45.string().datetime(),
5920
+ updatedAt: z45.string().datetime(),
5921
+ error: z45.string().max(2e3).optional(),
5868
5922
  /** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
5869
- occurrenceAt: z44.string().datetime().optional(),
5870
- candidate: z44.object({
5871
- eventId: z44.string(),
5923
+ occurrenceAt: z45.string().datetime().optional(),
5924
+ candidate: z45.object({
5925
+ eventId: z45.string(),
5872
5926
  event: storedAutomationEventSchema,
5873
- timestamp: z44.string().datetime(),
5874
- tieBreaker: z44.string(),
5875
- repo: z44.string(),
5876
- nodeId: z44.string(),
5877
- number: z44.number().int().positive(),
5878
- title: z44.string().max(500),
5879
- url: z44.string().url(),
5880
- author: z44.string().max(200),
5881
- assignees: z44.array(z44.string().max(200)).max(100),
5882
- labels: z44.array(z44.string().max(200)).max(100),
5883
- changedLabel: z44.string().max(200).optional()
5927
+ timestamp: z45.string().datetime(),
5928
+ tieBreaker: z45.string(),
5929
+ repo: z45.string(),
5930
+ nodeId: z45.string(),
5931
+ number: z45.number().int().positive(),
5932
+ title: z45.string().max(500),
5933
+ url: z45.string().url(),
5934
+ author: z45.string().max(200),
5935
+ assignees: z45.array(z45.string().max(200)).max(100),
5936
+ labels: z45.array(z45.string().max(200)).max(100),
5937
+ changedLabel: z45.string().max(200).optional()
5884
5938
  }).passthrough().optional()
5885
5939
  }).passthrough();
5886
- var storedAutomationLogResultSchema = z44.enum([
5940
+ var storedAutomationLogResultSchema = z45.enum([
5887
5941
  "launched",
5888
5942
  "no-match",
5889
5943
  "duplicate",
@@ -5899,24 +5953,24 @@ var storedAutomationLogResultSchema = z44.enum([
5899
5953
  // once schedule
5900
5954
  "missed"
5901
5955
  ]);
5902
- var storedAutomationLogRecordSchema = z44.object({
5903
- seq: z44.number().int().positive(),
5904
- ts: z44.string().datetime(),
5905
- automationId: z44.string().min(1),
5906
- revision: z44.number().int().positive(),
5956
+ var storedAutomationLogRecordSchema = z45.object({
5957
+ seq: z45.number().int().positive(),
5958
+ ts: z45.string().datetime(),
5959
+ automationId: z45.string().min(1),
5960
+ revision: z45.number().int().positive(),
5907
5961
  event: storedAutomationEventSchema.optional(),
5908
5962
  result: storedAutomationLogResultSchema,
5909
- reason: z44.string().max(2e3).optional(),
5910
- durationMs: z44.number().int().nonnegative().optional(),
5911
- receiptId: z44.string().optional(),
5912
- runId: z44.string().optional(),
5913
- githubNumber: z44.number().int().positive().optional(),
5914
- githubTitle: z44.string().max(500).optional(),
5915
- githubUrl: z44.string().url().optional(),
5916
- rateLimit: z44.object({
5917
- bucket: z44.enum(["core", "search"]),
5918
- remaining: z44.number().int().nonnegative().optional(),
5919
- resetAt: z44.string().datetime().optional()
5963
+ reason: z45.string().max(2e3).optional(),
5964
+ durationMs: z45.number().int().nonnegative().optional(),
5965
+ receiptId: z45.string().optional(),
5966
+ runId: z45.string().optional(),
5967
+ githubNumber: z45.number().int().positive().optional(),
5968
+ githubTitle: z45.string().max(500).optional(),
5969
+ githubUrl: z45.string().url().optional(),
5970
+ rateLimit: z45.object({
5971
+ bucket: z45.enum(["core", "search"]),
5972
+ remaining: z45.number().int().nonnegative().optional(),
5973
+ resetAt: z45.string().datetime().optional()
5920
5974
  }).passthrough().optional()
5921
5975
  }).passthrough();
5922
5976
  function storedIsOnceSchedule(definition) {
@@ -5930,210 +5984,210 @@ function storedIsScheduleAutomation(definition) {
5930
5984
  }
5931
5985
 
5932
5986
  // ../contract/src/automation-requests.ts
5933
- var automationEditableSchema = z45.object({
5934
- name: z45.string().trim().min(1).max(200),
5935
- description: z45.string().max(2e3).optional(),
5936
- enabled: z45.boolean().optional(),
5987
+ var automationEditableSchema = z46.object({
5988
+ name: z46.string().trim().min(1).max(200),
5989
+ description: z46.string().max(2e3).optional(),
5990
+ enabled: z46.boolean().optional(),
5937
5991
  kind: automationKindSchema.optional(),
5938
- events: z45.array(automationEventSchema).min(1).max(4).optional(),
5939
- intervalSeconds: z45.number().int().min(60).max(86400).optional(),
5992
+ events: z46.array(automationEventSchema).min(1).max(4).optional(),
5993
+ intervalSeconds: z46.number().int().min(60).max(86400).optional(),
5940
5994
  filters: storedAutomationFiltersSchema.optional(),
5941
5995
  schedule: automationScheduleSchema.optional(),
5942
- task: z45.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
5996
+ task: z46.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
5943
5997
  message: "task selects either a named workflow or inline steps, not both"
5944
5998
  })
5945
5999
  }).strict();
5946
- var automationCreateSchema = automationEditableSchema.extend({ enable: z45.boolean().optional() });
5947
- var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z45.number().int().positive() });
5948
- var automationCheckRequestSchema = z45.object({ mode: z45.enum(["preview", "execute"]) }).strict();
5949
- var automationLogQuerySchema = z45.object({
5950
- automationId: z45.string().optional(),
6000
+ var automationCreateSchema = automationEditableSchema.extend({ enable: z46.boolean().optional() });
6001
+ var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z46.number().int().positive() });
6002
+ var automationCheckRequestSchema = z46.object({ mode: z46.enum(["preview", "execute"]) }).strict();
6003
+ var automationLogQuerySchema = z46.object({
6004
+ automationId: z46.string().optional(),
5951
6005
  result: automationLogResultSchema.optional(),
5952
6006
  event: automationEventSchema.optional(),
5953
- since: z45.string().datetime().optional(),
5954
- cursor: z45.coerce.number().int().positive().optional(),
6007
+ since: z46.string().datetime().optional(),
6008
+ cursor: z46.coerce.number().int().positive().optional(),
5955
6009
  // Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
5956
6010
  // 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
5957
6011
  // request type `queryZodValidator` publishes (see validators.ts on why the request side falls
5958
6012
  // back to the schema's output), which would have made every caller send a `?limit=` this route
5959
6013
  // never needed.
5960
- limit: z45.coerce.number().int().min(1).max(100).optional()
6014
+ limit: z46.coerce.number().int().min(1).max(100).optional()
5961
6015
  });
5962
6016
 
5963
6017
  // ../contract/src/workflow-requests.ts
5964
- import { z as z46 } from "zod";
5965
- var planSchema = z46.object({
6018
+ import { z as z47 } from "zod";
6019
+ var planSchema = z47.object({
5966
6020
  // Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
5967
- task: z46.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
6021
+ task: z47.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
5968
6022
  /** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
5969
6023
  * selection (hearsay-tools/squawk#4116). */
5970
- agentProfile: z46.string().max(64).optional()
6024
+ agentProfile: z47.string().max(64).optional()
5971
6025
  });
5972
- var parseWorkflowSchema = z46.object({
5973
- yaml: z46.string().min(1).max(1e5)
6026
+ var parseWorkflowSchema = z47.object({
6027
+ yaml: z47.string().min(1).max(1e5)
5974
6028
  });
5975
6029
 
5976
6030
  // ../contract/src/ui-state-requests.ts
5977
- import { z as z47 } from "zod";
6031
+ import { z as z48 } from "zod";
5978
6032
  var SKILL_USAGE_MAX_ENTRIES = 200;
5979
6033
  var UI_STATE_MAX_KEYS = 200;
5980
6034
  var uiStateSchema2 = uiStateSchema.extend({
5981
6035
  // null records a quick task with no selected skill or workflow.
5982
- lastTask: z47.object({
5983
- source: z47.enum(["workflow", "skill"]),
5984
- ref: z47.string().min(1).max(200)
6036
+ lastTask: z48.object({
6037
+ source: z48.enum(["workflow", "skill"]),
6038
+ ref: z48.string().min(1).max(200)
5985
6039
  }).nullable().optional(),
5986
6040
  // Most recent source choices, newest first.
5987
- recentSources: z47.array(
5988
- z47.object({
5989
- source: z47.enum(["workflow", "skill"]),
5990
- ref: z47.string().min(1).max(200)
6041
+ recentSources: z48.array(
6042
+ z48.object({
6043
+ source: z48.enum(["workflow", "skill"]),
6044
+ ref: z48.string().min(1).max(200)
5991
6045
  })
5992
6046
  ).max(50).optional(),
5993
- skillUsage: z47.record(z47.string().min(1).max(200), z47.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
6047
+ skillUsage: z48.record(z48.string().min(1).max(200), z48.number().int().min(0).max(1e6)).refine((usage) => Object.keys(usage).length <= SKILL_USAGE_MAX_ENTRIES, {
5994
6048
  message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
5995
6049
  }).optional(),
5996
- promptTemplates: z47.array(
5997
- z47.object({
5998
- id: z47.string().min(1).max(64),
5999
- label: z47.string().trim().min(1).max(80),
6000
- text: z47.string().trim().min(1).max(2e3),
6050
+ promptTemplates: z48.array(
6051
+ z48.object({
6052
+ id: z48.string().min(1).max(64),
6053
+ label: z48.string().trim().min(1).max(80),
6054
+ text: z48.string().trim().min(1).max(2e3),
6001
6055
  // Skill names this template auto-applies for. Optional and additive: templates
6002
6056
  // written before this key existed keep validating, and stay manual-only.
6003
- skills: z47.array(z47.string().trim().min(1).max(200)).max(50).optional()
6057
+ skills: z48.array(z48.string().trim().min(1).max(200)).max(50).optional()
6004
6058
  })
6005
6059
  ).max(50).optional()
6006
6060
  }).passthrough();
6007
6061
  function capUiStateKeys(data, ctx) {
6008
6062
  if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
6009
- ctx.addIssue({ code: z47.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
6063
+ ctx.addIssue({ code: z48.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
6010
6064
  }
6011
6065
  }
6012
6066
  var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
6013
6067
 
6014
6068
  // ../contract/src/run-requests.ts
6015
- import { z as z48 } from "zod";
6016
- var queuedMessagePatchSchema = z48.object({
6017
- text: z48.string().max(1e5).optional(),
6018
- images: z48.array(attachmentInputSchema).max(4).optional()
6069
+ import { z as z49 } from "zod";
6070
+ var queuedMessagePatchSchema = z49.object({
6071
+ text: z49.string().max(1e5).optional(),
6072
+ images: z49.array(attachmentInputSchema).max(4).optional()
6019
6073
  }).refine((m) => m.text !== void 0 || m.images !== void 0, {
6020
6074
  message: "message edit needs text or attachments"
6021
6075
  });
6022
- var continueSchema = z48.object({
6023
- text: z48.string().max(1e5, "must be at most 100000 characters").optional(),
6024
- images: z48.array(attachmentInputSchema).max(4).optional(),
6076
+ var continueSchema = z49.object({
6077
+ text: z49.string().max(1e5, "must be at most 100000 characters").optional(),
6078
+ images: z49.array(attachmentInputSchema).max(4).optional(),
6025
6079
  runner: runnerSchema.optional(),
6026
- model: z48.string().max(200).optional(),
6080
+ model: z49.string().max(200).optional(),
6027
6081
  /** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
6028
- effort: z48.string().max(32).optional()
6082
+ effort: z49.string().max(32).optional()
6029
6083
  });
6030
- var archiveSchema = z48.object({
6031
- archived: z48.boolean().optional()
6084
+ var archiveSchema = z49.object({
6085
+ archived: z49.boolean().optional()
6032
6086
  });
6033
- var openInSchema = z48.object({
6087
+ var openInSchema = z49.object({
6034
6088
  // A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
6035
- target: z48.string().trim().min(1, "target required").max(200),
6036
- path: z48.string().max(1e3).optional()
6089
+ target: z49.string().trim().min(1, "target required").max(200),
6090
+ path: z49.string().max(1e3).optional()
6037
6091
  });
6038
6092
 
6039
6093
  // ../contract/src/query-requests.ts
6040
- import { z as z49 } from "zod";
6041
- var queryValue = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).optional();
6042
- var refreshQuery = z49.object({ refresh: queryValue });
6043
- var waitQuery = z49.object({ wait: queryValue });
6044
- var queryRunnerSchema = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
6045
- var modelDiscoveryQuerySchema = z49.object({ runner: queryRunnerSchema, profileId: z49.string().max(64).optional() });
6046
- var strictRefreshQuerySchema = z49.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6047
- var browseQuerySchema = z49.object({ path: queryValue, showHidden: queryValue });
6048
- var worktreeFilesQuerySchema = z49.object({ path: queryValue, raw: queryValue });
6049
- var commitQuerySchema = z49.object({ structured: queryValue });
6094
+ import { z as z50 } from "zod";
6095
+ var queryValue = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).optional();
6096
+ var refreshQuery = z50.object({ refresh: queryValue });
6097
+ var waitQuery = z50.object({ wait: queryValue });
6098
+ var queryRunnerSchema = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
6099
+ var modelDiscoveryQuerySchema = z50.object({ runner: queryRunnerSchema, profileId: z50.string().max(64).optional() });
6100
+ var strictRefreshQuerySchema = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6101
+ var browseQuerySchema = z50.object({ path: queryValue, showHidden: queryValue });
6102
+ var worktreeFilesQuerySchema = z50.object({ path: queryValue, raw: queryValue });
6103
+ var commitQuerySchema = z50.object({ structured: queryValue });
6050
6104
 
6051
6105
  // ../contract/src/github-requests.ts
6052
- import { z as z50 } from "zod";
6053
- var mergeNumberParams = z50.object({ number: z50.coerce.number().int().positive() });
6054
- var prChangesParams = z50.object({ number: z50.coerce.number().int().positive().safe() });
6055
- var prChangesQuery = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6056
- var mergeBodySchema = z50.object({
6057
- method: z50.enum(["merge", "squash", "rebase"]),
6058
- expectedHeadSha: z50.string().regex(/^[0-9a-f]{40}$/),
6059
- overrideRules: z50.boolean().optional().default(false)
6106
+ import { z as z51 } from "zod";
6107
+ var mergeNumberParams = z51.object({ number: z51.coerce.number().int().positive() });
6108
+ var prChangesParams = z51.object({ number: z51.coerce.number().int().positive().safe() });
6109
+ var prChangesQuery = z51.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6110
+ var mergeBodySchema = z51.object({
6111
+ method: z51.enum(["merge", "squash", "rebase"]),
6112
+ expectedHeadSha: z51.string().regex(/^[0-9a-f]{40}$/),
6113
+ overrideRules: z51.boolean().optional().default(false)
6060
6114
  }).strict();
6061
- var githubChecksQuerySchema = z50.object({ prs: z50.string().min(1) });
6062
- var githubRefsQuerySchema = z50.object({ prs: z50.string().optional(), issues: z50.string().optional() });
6115
+ var githubChecksQuerySchema = z51.object({ prs: z51.string().min(1) });
6116
+ var githubRefsQuerySchema = z51.object({ prs: z51.string().optional(), issues: z51.string().optional() });
6063
6117
 
6064
6118
  // ../contract/src/repo-requests.ts
6065
- import { z as z51 } from "zod";
6066
- var gitCommitSchema = z51.object({
6067
- message: z51.string().trim().min(1, "must not be empty").max(5e3)
6119
+ import { z as z52 } from "zod";
6120
+ var gitCommitSchema = z52.object({
6121
+ message: z52.string().trim().min(1, "must not be empty").max(5e3)
6068
6122
  });
6069
- var reclaimBodySchema = z51.object({}).passthrough();
6070
- var repoBranchSchema = z51.object({
6071
- name: z51.string().trim().min(1).max(200),
6072
- from: z51.string().trim().min(1).max(200).optional()
6123
+ var reclaimBodySchema = z52.object({}).passthrough();
6124
+ var repoBranchSchema = z52.object({
6125
+ name: z52.string().trim().min(1).max(200),
6126
+ from: z52.string().trim().min(1).max(200).optional()
6073
6127
  });
6074
- var reclaimRunParamsSchema = z51.object({ runId: z51.string().min(1) });
6128
+ var reclaimRunParamsSchema = z52.object({ runId: z52.string().min(1) });
6075
6129
 
6076
6130
  // ../contract/src/config-requests.ts
6077
- import { z as z52 } from "zod";
6131
+ import { z as z53 } from "zod";
6078
6132
  var setConfigSchema = setConfigInputSchema.extend({
6079
- systemPrompt: z52.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
6133
+ systemPrompt: z53.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
6080
6134
  });
6081
- var setAgentConfigSchema = z52.object({
6082
- content: z52.string().max(2e6),
6083
- version: z52.string().nullable()
6135
+ var setAgentConfigSchema = z53.object({
6136
+ content: z53.string().max(2e6),
6137
+ version: z53.string().nullable()
6084
6138
  });
6085
6139
 
6086
6140
  // ../contract/src/workflow-file.ts
6087
- import { z as z53 } from "zod";
6088
- var workflowFileSchema = z53.object({
6089
- name: z53.string().min(1),
6090
- description: z53.string().optional(),
6091
- steps: z53.array(workflowStepDefSchema).min(1).optional(),
6092
- skills: z53.array(z53.string().trim().min(1)).min(1).optional()
6141
+ import { z as z54 } from "zod";
6142
+ var workflowFileSchema = z54.object({
6143
+ name: z54.string().min(1),
6144
+ description: z54.string().optional(),
6145
+ steps: z54.array(workflowStepDefSchema).min(1).optional(),
6146
+ skills: z54.array(z54.string().trim().min(1)).min(1).optional()
6093
6147
  }).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
6094
6148
  message: 'a workflow lists either "steps" or "skills", not both'
6095
6149
  });
6096
6150
 
6097
6151
  // ../contract/src/reports.ts
6098
- import { z as z54 } from "zod";
6152
+ import { z as z55 } from "zod";
6099
6153
  var REPORTS_QUERY_MAX = 1e3;
6100
- var cursorSchema = z54.string().min(1).max(1024);
6101
- var reportsQuerySchema = z54.object({
6102
- q: z54.string().max(REPORTS_QUERY_MAX).optional(),
6154
+ var cursorSchema = z55.string().min(1).max(1024);
6155
+ var reportsQuerySchema = z55.object({
6156
+ q: z55.string().max(REPORTS_QUERY_MAX).optional(),
6103
6157
  before: cursorSchema.optional(),
6104
- limit: z54.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
6158
+ limit: z55.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
6105
6159
  }).strict();
6106
- var reportSchema = z54.object({
6107
- id: z54.uuid(),
6108
- runId: z54.uuid(),
6109
- name: z54.string(),
6110
- title: z54.string(),
6111
- createdAt: z54.iso.datetime(),
6112
- size: z54.number().int().nonnegative(),
6113
- taskTitle: z54.string(),
6160
+ var reportSchema = z55.object({
6161
+ id: z55.uuid(),
6162
+ runId: z55.uuid(),
6163
+ name: z55.string(),
6164
+ title: z55.string(),
6165
+ createdAt: z55.iso.datetime(),
6166
+ size: z55.number().int().nonnegative(),
6167
+ taskTitle: z55.string(),
6114
6168
  taskStatus: runStatusSchema
6115
6169
  }).strict();
6116
- var reportsResponseSchema = z54.object({
6117
- reports: z54.array(reportSchema),
6170
+ var reportsResponseSchema = z55.object({
6171
+ reports: z55.array(reportSchema),
6118
6172
  nextCursor: cursorSchema.nullable(),
6119
6173
  // Counts all matching cached rows with readable source summaries before page content checks.
6120
6174
  // A missing-content row dropped while filling this page can lower total on the next request.
6121
- total: z54.number().int().nonnegative()
6175
+ total: z55.number().int().nonnegative()
6122
6176
  }).strict();
6123
- var reportsStateSchema = z54.object({
6124
- epoch: z54.uuid(),
6125
- generation: z54.number().int().nonnegative(),
6126
- metadataGeneration: z54.number().int().nonnegative()
6177
+ var reportsStateSchema = z55.object({
6178
+ epoch: z55.uuid(),
6179
+ generation: z55.number().int().nonnegative(),
6180
+ metadataGeneration: z55.number().int().nonnegative()
6127
6181
  }).strict();
6128
- var reportsMetadataSchema = z54.object({
6129
- runId: z54.uuid(),
6130
- taskTitle: z54.string(),
6182
+ var reportsMetadataSchema = z55.object({
6183
+ runId: z55.uuid(),
6184
+ taskTitle: z55.string(),
6131
6185
  taskStatus: runStatusSchema
6132
6186
  }).strict();
6133
- var reportsFrameSchema = z54.discriminatedUnion("type", [
6134
- reportsStateSchema.extend({ type: z54.literal("snapshot") }),
6135
- reportsStateSchema.extend({ type: z54.literal("content") }),
6136
- reportsStateSchema.extend({ type: z54.literal("metadata"), runs: z54.array(reportsMetadataSchema) })
6187
+ var reportsFrameSchema = z55.discriminatedUnion("type", [
6188
+ reportsStateSchema.extend({ type: z55.literal("snapshot") }),
6189
+ reportsStateSchema.extend({ type: z55.literal("content") }),
6190
+ reportsStateSchema.extend({ type: z55.literal("metadata"), runs: z55.array(reportsMetadataSchema) })
6137
6191
  ]);
6138
6192
 
6139
6193
  // ../contract/src/report-title.ts
@@ -6155,108 +6209,108 @@ function controlLocation(control, separator = " \u2192 ") {
6155
6209
  }
6156
6210
 
6157
6211
  // ../contract/src/home-recovery.ts
6158
- import { z as z55 } from "zod";
6212
+ import { z as z56 } from "zod";
6159
6213
  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))$/;
6160
- var homeFileSchema = z55.string().regex(HOME_FILE_PATTERN);
6161
- var recoveryFile = z55.object({
6214
+ var homeFileSchema = z56.string().regex(HOME_FILE_PATTERN);
6215
+ var recoveryFile = z56.object({
6162
6216
  file: homeFileSchema,
6163
- detectedAt: z55.iso.datetime(),
6164
- canRestore: z55.boolean()
6217
+ detectedAt: z56.iso.datetime(),
6218
+ canRestore: z56.boolean()
6165
6219
  });
6166
6220
  var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
6167
- var homeRecoveryFileSchema = z55.discriminatedUnion("reason", [
6168
- recoveryFile.extend({ reason: z55.literal("reset") }),
6169
- recoveryFile.extend({ reason: z55.literal("outside-write") }),
6170
- recoveryFile.extend({ reason: z55.literal("legacy-change"), canImport: z55.boolean() })
6221
+ var homeRecoveryFileSchema = z56.discriminatedUnion("reason", [
6222
+ recoveryFile.extend({ reason: z56.literal("reset") }),
6223
+ recoveryFile.extend({ reason: z56.literal("outside-write") }),
6224
+ recoveryFile.extend({ reason: z56.literal("legacy-change"), canImport: z56.boolean() })
6171
6225
  ]);
6172
- var homeRecoverySchema = z55.object({ files: z55.array(homeRecoveryFileSchema) });
6226
+ var homeRecoverySchema = z56.object({ files: z56.array(homeRecoveryFileSchema) });
6173
6227
  function filterHomeRecoveryReasons(value, reasons) {
6174
6228
  if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
6175
6229
  return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
6176
6230
  }
6177
- var homeRecoveryReaderSchema = z55.preprocess(
6231
+ var homeRecoveryReaderSchema = z56.preprocess(
6178
6232
  (value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
6179
6233
  homeRecoverySchema
6180
6234
  );
6181
- var homeRecoveryActionSchema = z55.object({ file: homeFileSchema, detectedAt: z55.iso.datetime() }).strict();
6235
+ var homeRecoveryActionSchema = z56.object({ file: homeFileSchema, detectedAt: z56.iso.datetime() }).strict();
6182
6236
 
6183
6237
  // ../contract/src/runner-skills.ts
6184
- import { z as z56 } from "zod";
6185
- var runnerSkillScopeSchema = z56.enum(["repo", "user", "system", "other"]);
6186
- var runnerSkillsQuerySchema = z56.object({
6238
+ import { z as z57 } from "zod";
6239
+ var runnerSkillScopeSchema = z57.enum(["repo", "user", "system", "other"]);
6240
+ var runnerSkillsQuerySchema = z57.object({
6187
6241
  runner: queryRunnerSchema,
6188
- account: z56.string().min(1).max(64).optional(),
6189
- refresh: z56.literal("1").optional()
6242
+ account: z57.string().min(1).max(64).optional(),
6243
+ refresh: z57.literal("1").optional()
6190
6244
  });
6191
- var runnerSkillSchema = z56.object({
6192
- id: z56.string(),
6193
- name: z56.string(),
6194
- description: z56.string().optional(),
6245
+ var runnerSkillSchema = z57.object({
6246
+ id: z57.string(),
6247
+ name: z57.string(),
6248
+ description: z57.string().optional(),
6195
6249
  scope: runnerSkillScopeSchema.optional(),
6196
- plugin: z56.string().optional(),
6197
- path: z56.string().optional()
6250
+ plugin: z57.string().optional(),
6251
+ path: z57.string().optional()
6198
6252
  });
6199
- var runnerSkillProblemSchema = z56.object({ message: z56.string(), path: z56.string().optional() });
6200
- var runnerSkillListSchema = z56.object({
6253
+ var runnerSkillProblemSchema = z57.object({ message: z57.string(), path: z57.string().optional() });
6254
+ var runnerSkillListSchema = z57.object({
6201
6255
  runner: runnerSchema,
6202
- skills: z56.array(runnerSkillSchema),
6203
- problems: z56.array(runnerSkillProblemSchema),
6204
- source: z56.enum(["live", "cache", "unavailable"]),
6205
- reason: z56.string().optional()
6256
+ skills: z57.array(runnerSkillSchema),
6257
+ problems: z57.array(runnerSkillProblemSchema),
6258
+ source: z57.enum(["live", "cache", "unavailable"]),
6259
+ reason: z57.string().optional()
6206
6260
  });
6207
6261
 
6208
6262
  // ../contract/src/runner-install.ts
6209
- import { z as z57 } from "zod";
6210
- var runnerInstallParamsSchema = z57.object({ runner: runnerSchema });
6211
- var runnerInstallActionSchema = z57.object({ action: z57.enum(["check", "install", "update", "remove"]) });
6212
- var runnerInstallPhaseSchema = z57.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
6213
- var runnerInstallStatusSchema = z57.object({
6214
- supported: z57.boolean(),
6215
- installedVersion: z57.string().nullable(),
6216
- latestVersion: z57.string().nullable(),
6217
- updateAvailable: z57.boolean(),
6263
+ import { z as z58 } from "zod";
6264
+ var runnerInstallParamsSchema = z58.object({ runner: runnerSchema });
6265
+ var runnerInstallActionSchema = z58.object({ action: z58.enum(["check", "install", "update", "remove"]) });
6266
+ var runnerInstallPhaseSchema = z58.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
6267
+ var runnerInstallStatusSchema = z58.object({
6268
+ supported: z58.boolean(),
6269
+ installedVersion: z58.string().nullable(),
6270
+ latestVersion: z58.string().nullable(),
6271
+ updateAvailable: z58.boolean(),
6218
6272
  phase: runnerInstallPhaseSchema,
6219
- error: z57.string().nullable()
6273
+ error: z58.string().nullable()
6220
6274
  });
6221
6275
 
6222
6276
  // ../contract/src/automation-tool.ts
6223
- import { z as z58 } from "zod";
6277
+ import { z as z59 } from "zod";
6224
6278
  var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
6225
- var id = z58.string().min(1).max(100);
6226
- var automationToolRequestSchema = z58.discriminatedUnion("action", [
6227
- z58.object({ action: z58.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
6228
- z58.object({ action: z58.literal("show"), id }).strict(),
6229
- z58.object({ action: z58.literal("preview"), id }).strict(),
6230
- z58.object({ action: z58.literal("enable"), id, explicit: z58.boolean().optional() }).strict()
6279
+ var id = z59.string().min(1).max(100);
6280
+ var automationToolRequestSchema = z59.discriminatedUnion("action", [
6281
+ z59.object({ action: z59.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
6282
+ z59.object({ action: z59.literal("show"), id }).strict(),
6283
+ z59.object({ action: z59.literal("preview"), id }).strict(),
6284
+ z59.object({ action: z59.literal("enable"), id, explicit: z59.boolean().optional() }).strict()
6231
6285
  ]);
6232
- var automationToolAnswerSchema = z58.union([
6233
- z58.object({
6234
- ok: z58.literal(true),
6286
+ var automationToolAnswerSchema = z59.union([
6287
+ z59.object({
6288
+ ok: z59.literal(true),
6235
6289
  automation: storedAutomationDefinitionSchema,
6236
- url: z58.string().optional(),
6237
- next_run_at: z58.string().optional(),
6238
- preview: z58.object({ matches: z58.number().int().nonnegative(), truncated: z58.boolean() }).optional()
6290
+ url: z59.string().optional(),
6291
+ next_run_at: z59.string().optional(),
6292
+ preview: z59.object({ matches: z59.number().int().nonnegative(), truncated: z59.boolean() }).optional()
6239
6293
  }),
6240
- z58.object({ ok: z58.literal(false), code: z58.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z58.string() })
6294
+ z59.object({ ok: z59.literal(false), code: z59.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z59.string() })
6241
6295
  ]);
6242
6296
 
6243
6297
  // ../contract/src/agent-tools.ts
6244
- import { z as z59 } from "zod";
6245
- var agentToolResultSchema = z59.object({
6246
- content: z59.array(z59.object({ type: z59.literal("text"), text: z59.string() })),
6247
- isError: z59.boolean().optional(),
6248
- details: z59.unknown()
6249
- });
6250
- var agentToolMetadataSchema = z59.object({
6251
- timeoutMs: z59.number().positive(),
6298
+ import { z as z60 } from "zod";
6299
+ var agentToolResultSchema = z60.object({
6300
+ content: z60.array(z60.object({ type: z60.literal("text"), text: z60.string() })),
6301
+ isError: z60.boolean().optional(),
6302
+ details: z60.unknown()
6303
+ });
6304
+ var agentToolMetadataSchema = z60.object({
6305
+ timeoutMs: z60.number().positive(),
6252
6306
  unavailable: agentToolResultSchema,
6253
- name: z59.string(),
6254
- description: z59.string(),
6255
- trigger: z59.string(),
6256
- label: z59.string(),
6257
- inputSchema: z59.object({ type: z59.literal("object"), properties: z59.record(z59.string(), z59.unknown()).optional() }).catchall(z59.unknown())
6307
+ name: z60.string(),
6308
+ description: z60.string(),
6309
+ trigger: z60.string(),
6310
+ label: z60.string(),
6311
+ inputSchema: z60.object({ type: z60.literal("object"), properties: z60.record(z60.string(), z60.unknown()).optional() }).catchall(z60.unknown())
6258
6312
  });
6259
- var agentToolCatalogSchema = z59.object({ tools: z59.array(agentToolMetadataSchema), instructions: z59.string() });
6313
+ var agentToolCatalogSchema = z60.object({ tools: z60.array(agentToolMetadataSchema), instructions: z60.string() });
6260
6314
  export {
6261
6315
  ACTIVITY_CHECKS_MAX,
6262
6316
  ACTIVITY_CHECK_NAME_MAX,
@@ -6334,6 +6388,7 @@ export {
6334
6388
  SCHEDULED_TASK_NOTE,
6335
6389
  SCHEDULE_HOURS_OPTIONS,
6336
6390
  SCHEDULE_TYPES,
6391
+ SESSION_CONTEXT_FILE_MAX_BYTES,
6337
6392
  SHARED_ATTACH_REFUSAL,
6338
6393
  SHARED_BASELINE,
6339
6394
  SHARED_BASELINE_REFUSAL,
@@ -6860,12 +6915,19 @@ export {
6860
6915
  selectAgentProfileSchema,
6861
6916
  sendAgentReportInputSchema,
6862
6917
  sendAgentReportResponseSchema,
6918
+ sessionContextFileSchema,
6919
+ sessionContextPreviewBlockSchema,
6920
+ sessionContextPreviewRequestSchema,
6921
+ sessionContextPreviewSchema,
6922
+ sessionContextProblemSchema,
6923
+ sessionContextRoleSchema,
6863
6924
  sessionRunner,
6864
6925
  setAgentConfigInputSchema,
6865
6926
  setAgentConfigSchema,
6866
6927
  setConfigInputSchema,
6867
6928
  setConfigResponseSchema,
6868
6929
  setConfigSchema,
6930
+ setSessionContextSchema,
6869
6931
  setWorkspaceConfigInputSchema,
6870
6932
  setWorkspaceUiStateInputSchema,
6871
6933
  sharedSpawnRefusal,