@hearsay-tools/squawk 0.18.0-pr4307.8368 → 0.18.0-pr4311.8381

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 (104) hide show
  1. package/dist/contract/index.d.ts +1 -0
  2. package/dist/contract/index.js +863 -801
  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 +10 -10
  6. package/dist/delegation/transport.d.ts +11 -11
  7. package/dist/server/automations-routes.d.ts +150 -150
  8. package/dist/server/project-settings-routes.d.ts +107 -107
  9. package/dist/server/repo-routes.d.ts +13 -13
  10. package/dist/server/runner-install-routes.d.ts +10 -10
  11. package/dist/server/runs-routes.d.ts +31 -31
  12. package/dist/server/server.d.ts +757 -595
  13. package/dist/server/server.js +3 -1
  14. package/dist/server/server.js.map +1 -1
  15. package/dist/server/session-context-routes.d.ts +88 -0
  16. package/dist/server/session-context-routes.js +26 -0
  17. package/dist/server/session-context-routes.js.map +1 -0
  18. package/dist/session-context-file.d.ts +11 -0
  19. package/dist/session-context-file.js +137 -0
  20. package/dist/session-context-file.js.map +1 -0
  21. package/dist/session-context.d.ts +48 -0
  22. package/dist/session-context.js +146 -18
  23. package/dist/session-context.js.map +1 -1
  24. package/dist/workflows/run/wait-engine.d.ts +72 -72
  25. package/package.json +4 -4
  26. package/web/dist/assets/accounts-section-BJvE9Zln.js +1 -0
  27. package/web/dist/assets/activity-motion-C7V2Zytw.js +2 -0
  28. package/web/dist/assets/{activity-route-HvdWBepL.js → activity-route-CTqpLmA9.js} +1 -1
  29. package/web/dist/assets/agent-config-section-DJRFuip3.js +1 -0
  30. package/web/dist/assets/agent-defaults-section-CeMUJzwV.js +1 -0
  31. package/web/dist/assets/{appearance-ZpysBpxH.js → appearance-V0sfM4Xw.js} +1 -1
  32. package/web/dist/assets/{archive-on-merge-field-BlGo3o7a.js → archive-on-merge-field-ChwFDgN8.js} +1 -1
  33. package/web/dist/assets/attention-DJIQDiO5.js +1 -0
  34. package/web/dist/assets/automations-route-RV6ad8dC.js +1 -0
  35. package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
  36. package/web/dist/assets/{commit-diff-panel-BzAqXG0p.js → commit-diff-panel-C8BKEM91.js} +1 -1
  37. package/web/dist/assets/{diff-lVUk7FAR.js → diff-DN710SrG.js} +2 -2
  38. package/web/dist/assets/{diff-view-B5RGiepv.js → diff-view-BOORW_QD.js} +1 -1
  39. package/web/dist/assets/file-preview-DUHn3plI.js +2 -0
  40. package/web/dist/assets/{folder-browser-CffyHz8w.js → folder-browser-O-QkHs8B.js} +1 -1
  41. package/web/dist/assets/{git-toolbar-xLFz5nnr.js → git-toolbar-DLn0htp2.js} +1 -1
  42. package/web/dist/assets/{github-DxiILmDg.js → github-rSbXwKu9.js} +1 -1
  43. package/web/dist/assets/{global-activity-route-BmqMaZug.js → global-activity-route-C_SjZHhE.js} +1 -1
  44. package/web/dist/assets/index-2DP8fWMQ.css +1 -0
  45. package/web/dist/assets/index-VOxZqw61.js +21 -0
  46. package/web/dist/assets/{label-6PgIe3Ny.js → label-DaF3ftAD.js} +1 -1
  47. package/web/dist/assets/{live-reads-BxjlQXfN.js → live-reads-CfCVkYjf.js} +1 -1
  48. package/web/dist/assets/{markdown-DHYxiDex.js → markdown-DQj6hGSX.js} +1 -1
  49. package/web/dist/assets/{notifications-section-xHvjaRxV.js → notifications-section-CREk2cYf.js} +1 -1
  50. package/web/dist/assets/{open-in-menu-AZMtej8C.js → open-in-menu-BY4TapRQ.js} +1 -1
  51. package/web/dist/assets/plus-CxRU2X8C.js +1 -0
  52. package/web/dist/assets/{preview-pane-connected-C5Lsjf2P.js → preview-pane-connected-BS8M7HRF.js} +2 -2
  53. package/web/dist/assets/{project-location-DzOgHfcA.js → project-location-DkjkVltT.js} +1 -1
  54. package/web/dist/assets/{project-router-CDPfL2Jz.js → project-router-C-7SCaQu.js} +1 -1
  55. package/web/dist/assets/{project-scope-context-D9axDY18.js → project-scope-context-CMu1TeV7.js} +2 -2
  56. package/web/dist/assets/{projects-section-0ov7IK9p.js → projects-section-DmI2vrR9.js} +1 -1
  57. package/web/dist/assets/{prompt-templates-section-DgLWN4ZB.js → prompt-templates-section-C_ZkFDJ2.js} +1 -1
  58. package/web/dist/assets/queries-B6x1ADXB.js +1 -0
  59. package/web/dist/assets/{reference-chip-BnIoiMgY.js → reference-chip-Ch3mSHpR.js} +1 -1
  60. package/web/dist/assets/{remote-settings-notice-kmlL_JEi.js → remote-settings-notice-B97QRJRX.js} +1 -1
  61. package/web/dist/assets/repo-git-D3Hc5dTH.js +1 -0
  62. package/web/dist/assets/report-reader-C3ZbGANg.js +1 -0
  63. package/web/dist/assets/{reports--yxm1Dbp.js → reports-B8UQJmqx.js} +1 -1
  64. package/web/dist/assets/{resources-section-CZu7afz7.js → resources-section-C_z6IH9E.js} +1 -1
  65. package/web/dist/assets/run-header--tUbnd6U.js +2 -0
  66. package/web/dist/assets/session-context-section-B3h6gyn4.js +118 -0
  67. package/web/dist/assets/{settings-agent-picker-XdHS0cXP.js → settings-agent-picker-CwgrzYYC.js} +1 -1
  68. package/web/dist/assets/settings-shell-DBkzg_Zm.js +1 -0
  69. package/web/dist/assets/{sidebar-section-Dgf9Tda6.js → sidebar-section-C6-ecxDw.js} +1 -1
  70. package/web/dist/assets/{skills-CVoGqJeT.js → skills-BBSOi-c_.js} +1 -1
  71. package/web/dist/assets/{tab-link-BaKE6KnE.js → tab-link-BGx4dJyd.js} +1 -1
  72. package/web/dist/assets/{task-changes-Cd30VNwk.js → task-changes-rlBta9iZ.js} +1 -1
  73. package/web/dist/assets/{task-commits-33kwaiVP.js → task-commits-Bw6PH9bn.js} +1 -1
  74. package/web/dist/assets/task-files-DWvHKsMk.js +1 -0
  75. package/web/dist/assets/{task-github-item-C7dEQxMN.js → task-github-item-CCTkPQrv.js} +1 -1
  76. package/web/dist/assets/{task-groups-DoiPFEfM.js → task-groups-BJTO_lzF.js} +1 -1
  77. package/web/dist/assets/task-thread-cCwjVK3w.js +9 -0
  78. package/web/dist/assets/{tasks-table-CmESFng9.js → tasks-table-DfjsK2ZU.js} +1 -1
  79. package/web/dist/assets/{thread-state-DI7JLoTx.js → thread-state-BsoWER7_.js} +1 -1
  80. package/web/dist/assets/{use-hand-to-agent-state-B869bBKO.js → use-hand-to-agent-state-CuIPrVeu.js} +1 -1
  81. package/web/dist/assets/{useInfiniteQuery-GZp9laKm.js → useInfiniteQuery-EIYt3KXs.js} +1 -1
  82. package/web/dist/assets/useQuery-CQLBQlcy.js +1 -0
  83. package/web/dist/assets/workflows-BxqDHhP6.js +7 -0
  84. package/web/dist/assets/{workspace-tools-YqTAoyv7.js → workspace-tools-2UqOWOET.js} +1 -1
  85. package/web/dist/assets/{worktrees-section-9fwC5DGp.js → worktrees-section-C2_py7HS.js} +4 -4
  86. package/web/dist/index.html +15 -15
  87. package/web/dist/assets/accounts-section-D3rKSj1e.js +0 -1
  88. package/web/dist/assets/activity-motion-CFgok4CI.js +0 -2
  89. package/web/dist/assets/agent-config-section-DbmhTCJA.js +0 -4
  90. package/web/dist/assets/agent-defaults-section-5fBA2FMV.js +0 -1
  91. package/web/dist/assets/attention-CvHM4cjG.js +0 -1
  92. package/web/dist/assets/automations-route-aINxoEQX.js +0 -1
  93. package/web/dist/assets/file-preview-Bn5u5k1W.js +0 -2
  94. package/web/dist/assets/index-DndX-kC-.js +0 -21
  95. package/web/dist/assets/index-HkNWm2JB.css +0 -1
  96. package/web/dist/assets/queries-DzwCG927.js +0 -1
  97. package/web/dist/assets/repo-git-D-L0KYwh.js +0 -1
  98. package/web/dist/assets/report-reader-Fb02sGC6.js +0 -1
  99. package/web/dist/assets/run-header-Bajufo9w.js +0 -2
  100. package/web/dist/assets/settings-shell-63smMna1.js +0 -1
  101. package/web/dist/assets/task-files-W2NkAX0s.js +0 -1
  102. package/web/dist/assets/task-thread-Bi5cKYmZ.js +0 -9
  103. package/web/dist/assets/useQuery-CzVHT8UE.js +0 -1
  104. package/web/dist/assets/workflows-CeRdeF9n.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,44 +5159,44 @@ 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),
5180
+ type: z39.literal("batch"),
5181
+ events: z39.array(runHistoryEventSchema).max(LIVE_EVENT_LIMIT),
5128
5182
  cursor: runHistoryCursorSchema,
5129
- afterSeq: z38.number().int().nonnegative(),
5130
- hasMore: z38.boolean()
5131
- });
5132
- var liveRunBatchResultSchema = z38.union([liveRunBatchSchema, liveRunErrorSchema]);
5133
- var liveRunBatchResponseSchema = z38.object({
5134
- generation: z38.string(),
5135
- results: z38.array(liveRunBatchResultSchema)
5136
- });
5137
- var liveRunFrameSchema = z38.union([
5138
- z38.object({ type: z38.literal("ready"), generation: z38.string() }),
5139
- z38.object({ type: z38.literal("ping") }),
5140
- identity.extend({ type: z38.literal("event"), name: z38.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
5183
+ afterSeq: z39.number().int().nonnegative(),
5184
+ hasMore: z39.boolean()
5185
+ });
5186
+ var liveRunBatchResultSchema = z39.union([liveRunBatchSchema, liveRunErrorSchema]);
5187
+ var liveRunBatchResponseSchema = z39.object({
5188
+ generation: z39.string(),
5189
+ results: z39.array(liveRunBatchResultSchema)
5190
+ });
5191
+ var liveRunFrameSchema = z39.union([
5192
+ z39.object({ type: z39.literal("ready"), generation: z39.string() }),
5193
+ z39.object({ type: z39.literal("ping") }),
5194
+ identity.extend({ type: z39.literal("event"), name: z39.enum(["run-event", "ui-event"]), event: runHistoryEventSchema }),
5141
5195
  liveRunErrorSchema
5142
5196
  ]);
5143
5197
 
5144
5198
  // ../contract/src/activity.ts
5145
- import { z as z39 } from "zod";
5199
+ import { z as z40 } from "zod";
5146
5200
  var ACTIVITY_RATE_SECONDS = 30;
5147
5201
  var ACTIVITY_TEXT_MAX = 500;
5148
5202
  var ACTIVITY_ERROR_MAX = 200;
@@ -5150,145 +5204,145 @@ var ACTIVITY_TOOL_TITLE_MAX = 160;
5150
5204
  var ACTIVITY_CHECKS_MAX = 100;
5151
5205
  var ACTIVITY_CHECK_NAME_MAX = 100;
5152
5206
  var ACTIVITY_CLOSED_WINDOW_MS = 3e4;
5153
- var iso = z39.iso.datetime();
5154
- var count = z39.number().int().nonnegative();
5155
- var runId = z39.string().min(1);
5207
+ var iso = z40.iso.datetime();
5208
+ var count = z40.number().int().nonnegative();
5209
+ var runId = z40.string().min(1);
5156
5210
  var ACTIVITY_TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "task", "plan", "other"];
5157
- var activityToolSchema = z39.object({
5158
- title: z39.string().max(ACTIVITY_TOOL_TITLE_MAX),
5159
- toolKind: z39.enum(ACTIVITY_TOOL_KINDS),
5160
- status: z39.enum(["pending", "running", "completed", "failed", "declined"]),
5211
+ var activityToolSchema = z40.object({
5212
+ title: z40.string().max(ACTIVITY_TOOL_TITLE_MAX),
5213
+ toolKind: z40.enum(ACTIVITY_TOOL_KINDS),
5214
+ status: z40.enum(["pending", "running", "completed", "failed", "declined"]),
5161
5215
  startedAt: iso,
5162
5216
  endedAt: iso.optional()
5163
5217
  }).strict();
5164
- var activityCheckBucketSchema = z39.enum(["pass", "fail", "pending", "skipping", "cancel"]);
5165
- var activityPrProgressSchema = z39.object({
5166
- checks: z39.array(z39.object({ name: z39.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
5167
- counts: z39.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
5168
- truncated: z39.literal(true).optional()
5218
+ var activityCheckBucketSchema = z40.enum(["pass", "fail", "pending", "skipping", "cancel"]);
5219
+ var activityPrProgressSchema = z40.object({
5220
+ checks: z40.array(z40.object({ name: z40.string().max(ACTIVITY_CHECK_NAME_MAX), bucket: activityCheckBucketSchema }).strict()).max(ACTIVITY_CHECKS_MAX),
5221
+ counts: z40.object({ pass: count, fail: count, pending: count, skipping: count, cancel: count }).strict(),
5222
+ truncated: z40.literal(true).optional()
5169
5223
  }).strict();
5170
- var activityWaitSchema = z39.discriminatedUnion("kind", [
5171
- z39.object({
5172
- kind: z39.literal("human"),
5224
+ var activityWaitSchema = z40.discriminatedUnion("kind", [
5225
+ z40.object({
5226
+ kind: z40.literal("human"),
5173
5227
  since: iso,
5174
- detail: z39.object({
5228
+ detail: z40.object({
5175
5229
  /** The ask card's first question. */
5176
- question: z39.string().max(ACTIVITY_TEXT_MAX).optional(),
5230
+ question: z40.string().max(ACTIVITY_TEXT_MAX).optional(),
5177
5231
  /** `question`: an open question; `turn-end`: Squawk's `no-wait` wait; `budget`: the
5178
5232
  * automatic-wake budget is spent; `completion`: Squawk's completion gate. */
5179
- reason: z39.enum(["question", "turn-end", "budget", "completion"]),
5233
+ reason: z40.enum(["question", "turn-end", "budget", "completion"]),
5180
5234
  /** Inputs not delivered yet, when there are any. */
5181
- queuedMessages: z39.number().int().positive().optional()
5235
+ queuedMessages: z40.number().int().positive().optional()
5182
5236
  }).strict()
5183
5237
  }).strict(),
5184
- z39.object({ kind: z39.literal("usage-limit"), detail: z39.object({ resumeAt: z39.string() }).strict() }).strict(),
5185
- z39.object({
5186
- kind: z39.literal("workers"),
5238
+ z40.object({ kind: z40.literal("usage-limit"), detail: z40.object({ resumeAt: z40.string() }).strict() }).strict(),
5239
+ z40.object({
5240
+ kind: z40.literal("workers"),
5187
5241
  since: iso,
5188
5242
  deadline: iso.optional(),
5189
- detail: z39.object({
5243
+ detail: z40.object({
5190
5244
  /** `computeWaitingOn`'s count: the unanswered targets, summed over the entries. */
5191
5245
  owed: count,
5192
5246
  /** Targets named and targets settled, summed over the entries. */
5193
5247
  total: count,
5194
5248
  settled: count,
5195
5249
  /** Every open entry waits on request replies. */
5196
- replies: z39.literal(true).optional(),
5250
+ replies: z40.literal(true).optional(),
5197
5251
  /** Only when one entry is open. */
5198
5252
  mode: workerWaitModeSchema.optional(),
5199
5253
  /** Who owes the awaited replies, each once. */
5200
- recipientRunIds: z39.array(runId)
5254
+ recipientRunIds: z40.array(runId)
5201
5255
  }).strict()
5202
5256
  }).strict(),
5203
- z39.object({ kind: z39.literal("peers"), since: iso, deadline: iso, detail: z39.object({ peerRunIds: z39.array(runId) }).strict() }).strict(),
5204
- z39.object({ kind: z39.literal("subagents"), since: iso, deadline: iso, detail: z39.object({ running: count }).strict() }).strict(),
5205
- z39.object({
5206
- kind: z39.literal("pr"),
5257
+ z40.object({ kind: z40.literal("peers"), since: iso, deadline: iso, detail: z40.object({ peerRunIds: z40.array(runId) }).strict() }).strict(),
5258
+ z40.object({ kind: z40.literal("subagents"), since: iso, deadline: iso, detail: z40.object({ running: count }).strict() }).strict(),
5259
+ z40.object({
5260
+ kind: z40.literal("pr"),
5207
5261
  since: iso,
5208
5262
  deadline: iso,
5209
- detail: z39.object({
5210
- number: z39.number().int().positive(),
5263
+ detail: z40.object({
5264
+ number: z40.number().int().positive(),
5211
5265
  target: prWaitUntilSchema,
5212
5266
  /** Check progress, while the CI progress registry holds some for this wait. */
5213
5267
  checks: activityPrProgressSchema.shape.checks.optional(),
5214
5268
  counts: activityPrProgressSchema.shape.counts.optional(),
5215
- truncated: z39.literal(true).optional()
5269
+ truncated: z40.literal(true).optional()
5216
5270
  }).strict()
5217
5271
  }).strict(),
5218
- z39.object({ kind: z39.literal("process"), since: iso, deadline: iso, detail: z39.object({ pid: z39.number().int(), note: z39.string().optional() }).strict() }).strict(),
5219
- 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(),
5220
- z39.object({ kind: z39.literal("timer"), since: iso, deadline: iso, detail: z39.object({ wakeAt: iso, note: z39.string().optional() }).strict() }).strict()
5272
+ z40.object({ kind: z40.literal("process"), since: iso, deadline: iso, detail: z40.object({ pid: z40.number().int(), note: z40.string().optional() }).strict() }).strict(),
5273
+ 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(),
5274
+ z40.object({ kind: z40.literal("timer"), since: iso, deadline: iso, detail: z40.object({ wakeAt: iso, note: z40.string().optional() }).strict() }).strict()
5221
5275
  ]);
5222
5276
  var activityRunShape = {
5223
5277
  runId,
5224
5278
  /** The display title: `titleSummary ?? title`. */
5225
- title: z39.string(),
5279
+ title: z40.string(),
5226
5280
  status: runStatusSchema,
5227
5281
  /** The `deriveAttention` rung id, never a label. */
5228
- rung: z39.enum(ATTENTION_RUNGS),
5282
+ rung: z40.enum(ATTENTION_RUNGS),
5229
5283
  runner: runnerSchema.optional(),
5230
- model: z39.string().optional(),
5231
- currentStepId: z39.string().optional(),
5232
- startedAt: z39.string().optional(),
5284
+ model: z40.string().optional(),
5285
+ currentStepId: z40.string().optional(),
5286
+ startedAt: z40.string().optional(),
5233
5287
  wait: activityWaitSchema.optional(),
5234
5288
  tool: activityToolSchema.optional(),
5235
5289
  /** Tool calls started per second, oldest first. */
5236
- rate: z39.array(count).length(ACTIVITY_RATE_SECONDS),
5290
+ rate: z40.array(count).length(ACTIVITY_RATE_SECONDS),
5237
5291
  /** One line of `RunRecord.error`. */
5238
- error: z39.string().max(ACTIVITY_ERROR_MAX).optional()
5292
+ error: z40.string().max(ACTIVITY_ERROR_MAX).optional()
5239
5293
  };
5240
- var activityWorkerSchema = z39.object({
5294
+ var activityWorkerSchema = z40.object({
5241
5295
  ...activityRunShape,
5242
5296
  /** The worker's current execution revision. */
5243
5297
  revision: count,
5244
5298
  /** The parent holds a collected result for this revision. */
5245
- collected: z39.boolean()
5299
+ collected: z40.boolean()
5246
5300
  }).strict();
5247
- var activityRunSchema = z39.object({ ...activityRunShape, workers: z39.array(activityWorkerSchema) }).strict();
5248
- var activityRequestSchema = z39.object({
5249
- requestId: z39.uuid(),
5250
- relationship: z39.enum(["family", "peer"]),
5301
+ var activityRunSchema = z40.object({ ...activityRunShape, workers: z40.array(activityWorkerSchema) }).strict();
5302
+ var activityRequestSchema = z40.object({
5303
+ requestId: z40.uuid(),
5304
+ relationship: z40.enum(["family", "peer"]),
5251
5305
  senderRunId: runId,
5252
5306
  recipientRunId: runId,
5253
- text: z39.string().max(ACTIVITY_TEXT_MAX),
5254
- senderTitle: z39.string().optional(),
5255
- recipientTitle: z39.string().optional(),
5307
+ text: z40.string().max(ACTIVITY_TEXT_MAX),
5308
+ senderTitle: z40.string().optional(),
5309
+ recipientTitle: z40.string().optional(),
5256
5310
  createdAt: iso,
5257
5311
  deadline: iso.optional()
5258
5312
  }).strict();
5259
- var activityClosedRequestSchema = z39.object({
5260
- requestId: z39.uuid(),
5313
+ var activityClosedRequestSchema = z40.object({
5314
+ requestId: z40.uuid(),
5261
5315
  senderRunId: runId,
5262
5316
  recipientRunId: runId,
5263
5317
  status: requestOutcomeSchema.shape.status,
5264
5318
  observedAt: iso
5265
5319
  }).strict();
5266
- var activityProjectSchema = z39.object({
5267
- projectId: z39.string(),
5268
- name: z39.string(),
5320
+ var activityProjectSchema = z40.object({
5321
+ projectId: z40.string(),
5322
+ name: z40.string(),
5269
5323
  /** False for a project this process has not loaded: its lists are empty because nothing was read. */
5270
- loaded: z39.boolean(),
5324
+ loaded: z40.boolean(),
5271
5325
  /** The project is loaded but its run store cannot open: the failure its project routes answer.
5272
5326
  * The lists are empty because nothing could be read, not because nothing runs. */
5273
- unavailable: z39.object({ status: z39.union([z39.literal(404), z39.literal(409), z39.literal(503)]), error: z39.string() }).strict().optional(),
5327
+ unavailable: z40.object({ status: z40.union([z40.literal(404), z40.literal(409), z40.literal(503)]), error: z40.string() }).strict().optional(),
5274
5328
  /** Root tasks in review: the summary chip (D8). */
5275
5329
  inReview: count,
5276
- tasks: z39.array(activityRunSchema),
5277
- requests: z39.array(activityRequestSchema),
5278
- closed: z39.array(activityClosedRequestSchema)
5330
+ tasks: z40.array(activityRunSchema),
5331
+ requests: z40.array(activityRequestSchema),
5332
+ closed: z40.array(activityClosedRequestSchema)
5279
5333
  }).strict();
5280
- var activitySnapshotSchema = z39.object({
5334
+ var activitySnapshotSchema = z40.object({
5281
5335
  /** The server clock; the client ticks ages from it. */
5282
5336
  generatedAt: iso,
5283
5337
  /** One entry, or every visible project for the global read. */
5284
- projects: z39.array(activityProjectSchema)
5338
+ projects: z40.array(activityProjectSchema)
5285
5339
  }).strict();
5286
- var activityQuerySchema = z39.object({
5287
- project: z39.union([z39.literal("default"), z39.string().regex(PROJECT_ID_PATTERN)]).optional()
5340
+ var activityQuerySchema = z40.object({
5341
+ project: z40.union([z40.literal("default"), z40.string().regex(PROJECT_ID_PATTERN)]).optional()
5288
5342
  });
5289
5343
 
5290
5344
  // ../contract/src/live-coordination.ts
5291
- import { z as z40 } from "zod";
5345
+ import { z as z41 } from "zod";
5292
5346
  var LIVE_PROTOCOL = 3;
5293
5347
  var LIVE_WORKER_NAME = "cezar-live-v3";
5294
5348
  var LEASE_MS = 15e3;
@@ -5297,111 +5351,111 @@ function allowedLiveRead(path) {
5297
5351
  if (!path.startsWith("/api/v1/") || path.includes("#") || /[\\\r\n]/.test(path)) return false;
5298
5352
  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);
5299
5353
  }
5300
- var liveDemandSchema = z40.discriminatedUnion("kind", [
5301
- z40.object({ kind: z40.literal("workspace") }),
5302
- liveRunDemandSchema.extend({ kind: z40.literal("run") }),
5303
- z40.object({ kind: z40.literal("topic"), topic: z40.string().min(1).max(128) }),
5354
+ var liveDemandSchema = z41.discriminatedUnion("kind", [
5355
+ z41.object({ kind: z41.literal("workspace") }),
5356
+ liveRunDemandSchema.extend({ kind: z41.literal("run") }),
5357
+ z41.object({ kind: z41.literal("topic"), topic: z41.string().min(1).max(128) }),
5304
5358
  // Preserve server-directed cadence (settled references use ten minutes). Only
5305
5359
  // bound the timer itself: larger delays overflow setTimeout into a tight loop.
5306
- z40.object({ kind: z40.literal("read"), path: z40.string().max(4096).refine(allowedLiveRead), intervalMs: z40.number().int().min(1e3).max(2147483647) })
5360
+ z41.object({ kind: z41.literal("read"), path: z41.string().max(4096).refine(allowedLiveRead), intervalMs: z41.number().int().min(1e3).max(2147483647) })
5307
5361
  ]);
5308
- var liveEntrySchema = z40.object({ id: z40.string().min(1).max(128), demand: liveDemandSchema });
5309
- var envelope = z40.object({ version: z40.literal(LIVE_PROTOCOL), documentId: z40.string().min(1).max(128), epoch: z40.number().int().nonnegative() });
5310
- var ownerInputSchema = z40.discriminatedUnion("type", [
5362
+ var liveEntrySchema = z41.object({ id: z41.string().min(1).max(128), demand: liveDemandSchema });
5363
+ var envelope = z41.object({ version: z41.literal(LIVE_PROTOCOL), documentId: z41.string().min(1).max(128), epoch: z41.number().int().nonnegative() });
5364
+ var ownerInputSchema = z41.discriminatedUnion("type", [
5311
5365
  envelope.extend({
5312
- type: z40.literal("sync"),
5313
- entries: z40.array(liveEntrySchema).max(64),
5366
+ type: z41.literal("sync"),
5367
+ entries: z41.array(liveEntrySchema).max(64),
5314
5368
  /** The document knows no workspace stream generation (its `ready` was lost, for example to
5315
5369
  * an epoch change): send it the stream's `ready` again (hearsay-tools/cezarion#2729). */
5316
- workspaceReady: z40.literal(true).optional()
5370
+ workspaceReady: z41.literal(true).optional()
5317
5371
  }).refine((value) => new Set(value.entries.map((e) => e.id)).size === value.entries.length),
5318
- envelope.extend({ type: z40.literal("ack"), id: z40.string(), seq: z40.number().int().nonnegative() }),
5319
- envelope.extend({ type: z40.literal("refresh"), id: z40.string() })
5372
+ envelope.extend({ type: z41.literal("ack"), id: z41.string(), seq: z41.number().int().nonnegative() }),
5373
+ envelope.extend({ type: z41.literal("refresh"), id: z41.string() })
5320
5374
  ]);
5321
- var wireFrameSchema = z40.object({ event: z40.string(), data: z40.string(), id: z40.string() });
5322
- var ownerOutputSchema = z40.discriminatedUnion("type", [
5323
- z40.object({ type: z40.literal("unavailable"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), reason: z40.string() }),
5324
- z40.object({ type: z40.literal("hello"), version: z40.literal(LIVE_PROTOCOL) }),
5325
- z40.object({ type: z40.literal("alive"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number() }),
5326
- z40.object({ type: z40.literal("frame"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), frame: z40.union([wireFrameSchema, liveRunFrameSchema]) }),
5327
- z40.object({ type: z40.literal("value"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), value: z40.unknown(), error: z40.string().optional() }),
5328
- z40.object({ type: z40.literal("reset"), version: z40.literal(LIVE_PROTOCOL), epoch: z40.number(), id: z40.string(), reason: z40.string() })
5375
+ var wireFrameSchema = z41.object({ event: z41.string(), data: z41.string(), id: z41.string() });
5376
+ var ownerOutputSchema = z41.discriminatedUnion("type", [
5377
+ z41.object({ type: z41.literal("unavailable"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), reason: z41.string() }),
5378
+ z41.object({ type: z41.literal("hello"), version: z41.literal(LIVE_PROTOCOL) }),
5379
+ z41.object({ type: z41.literal("alive"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number() }),
5380
+ z41.object({ type: z41.literal("frame"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), frame: z41.union([wireFrameSchema, liveRunFrameSchema]) }),
5381
+ z41.object({ type: z41.literal("value"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), value: z41.unknown(), error: z41.string().optional() }),
5382
+ z41.object({ type: z41.literal("reset"), version: z41.literal(LIVE_PROTOCOL), epoch: z41.number(), id: z41.string(), reason: z41.string() })
5329
5383
  ]);
5330
5384
  var runKey = (run) => `${run.projectId}/${run.runId}`;
5331
5385
 
5332
5386
  // ../contract/src/workspace-events.ts
5333
- import { z as z41 } from "zod";
5334
- var workspaceEventsQuerySchema = z41.object({
5335
- runs: z41.literal("summary").optional()
5387
+ import { z as z42 } from "zod";
5388
+ var workspaceEventsQuerySchema = z42.object({
5389
+ runs: z42.literal("summary").optional()
5336
5390
  });
5337
- var projectStamp = z41.string().min(1);
5338
- var frameSeq = z41.number().int().positive();
5339
- var workspaceRunSummaryEventSchema = z41.object({
5391
+ var projectStamp = z42.string().min(1);
5392
+ var frameSeq = z42.number().int().positive();
5393
+ var workspaceRunSummaryEventSchema = z42.object({
5340
5394
  project: projectStamp,
5341
5395
  seq: frameSeq,
5342
5396
  run: runSummarySchema,
5343
- relationships: z41.string().min(1)
5397
+ relationships: z42.string().min(1)
5344
5398
  });
5345
- var workspaceRunDeletedEventSchema = z41.object({
5399
+ var workspaceRunDeletedEventSchema = z42.object({
5346
5400
  project: projectStamp,
5347
5401
  seq: frameSeq,
5348
- id: z41.string().min(1)
5402
+ id: z42.string().min(1)
5349
5403
  });
5350
- var workspaceReadyEventSchema = z41.object({
5351
- generation: z41.string().min(1),
5352
- seq: z41.number().int().nonnegative()
5404
+ var workspaceReadyEventSchema = z42.object({
5405
+ generation: z42.string().min(1),
5406
+ seq: z42.number().int().nonnegative()
5353
5407
  });
5354
- var workspaceUsageEventSchema = z41.object({
5408
+ var workspaceUsageEventSchema = z42.object({
5355
5409
  project: projectStamp,
5356
- usage: z41.record(z41.string(), processUsageSchema)
5410
+ usage: z42.record(z42.string(), processUsageSchema)
5357
5411
  });
5358
- var runsIndexResponseSchema = z41.object({
5412
+ var runsIndexResponseSchema = z42.object({
5359
5413
  /** Newest first, across every registered project: each project's window
5360
5414
  * (hearsay-tools/cezarion#864) — every unarchived root run, plus its newest `perProjectLimit`
5361
5415
  * archived root runs. Owned workers are never included. Older archived runs are reached
5362
5416
  * through `GET /workspace/runs-search`. */
5363
- runs: z41.array(runIndexEntrySchema),
5417
+ runs: z42.array(runIndexEntrySchema),
5364
5418
  /** Additive: absent statuses mean "nothing warm", never "nothing to show". */
5365
5419
  referenceStatuses: referenceStatusesByProjectSchema,
5366
5420
  /** How many archived root runs each project contributes at most. Unarchived roots are never cut. */
5367
- perProjectLimit: z41.number(),
5421
+ perProjectLimit: z42.number(),
5368
5422
  /** Ids of the projects that had more archived root runs than `perProjectLimit`. */
5369
- truncated: z41.array(z41.string()),
5423
+ truncated: z42.array(z42.string()),
5370
5424
  /** The server process that answered: the workspace stream's `ready.generation`. An `eventSeq`
5371
5425
  * compares only within one generation. */
5372
- generation: z41.string().min(1),
5426
+ generation: z42.string().min(1),
5373
5427
  /** The last workspace stream `seq` this answer includes: every `run-summary` and `run-deleted`
5374
5428
  * frame at or below it is already in `runs`; a frame above it is newer than the snapshot. */
5375
- eventSeq: z41.number().int().nonnegative()
5429
+ eventSeq: z42.number().int().nonnegative()
5376
5430
  });
5377
5431
 
5378
5432
  // ../contract/src/permissions.ts
5379
- import { z as z42 } from "zod";
5380
- var permissionOptionKindSchema = z42.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
5381
- var permissionOptionSchema = z42.object({
5382
- id: z42.string().min(1).max(128),
5383
- label: z42.string().min(1),
5433
+ import { z as z43 } from "zod";
5434
+ var permissionOptionKindSchema = z43.enum(["allow_once", "allow_always", "reject_once", "reject_always"]);
5435
+ var permissionOptionSchema = z43.object({
5436
+ id: z43.string().min(1).max(128),
5437
+ label: z43.string().min(1),
5384
5438
  kind: permissionOptionKindSchema
5385
5439
  }).strict();
5386
- var permissionRequestedSchema = z42.object({
5387
- type: z42.literal("permission.requested"),
5388
- requestId: z42.string().min(1).max(128),
5389
- itemId: z42.string().optional(),
5390
- title: z42.string().min(1),
5391
- details: z42.string().optional(),
5392
- options: z42.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
5440
+ var permissionRequestedSchema = z43.object({
5441
+ type: z43.literal("permission.requested"),
5442
+ requestId: z43.string().min(1).max(128),
5443
+ itemId: z43.string().optional(),
5444
+ title: z43.string().min(1),
5445
+ details: z43.string().optional(),
5446
+ options: z43.array(permissionOptionSchema).min(1).refine((options) => new Set(options.map((option) => option.id)).size === options.length)
5393
5447
  }).strict();
5394
- var permissionResolvedSchema = z42.object({
5395
- type: z42.literal("permission.resolved"),
5396
- requestId: z42.string().min(1).max(128),
5397
- optionId: z42.string().optional(),
5398
- reason: z42.string().optional()
5448
+ var permissionResolvedSchema = z43.object({
5449
+ type: z43.literal("permission.resolved"),
5450
+ requestId: z43.string().min(1).max(128),
5451
+ optionId: z43.string().optional(),
5452
+ reason: z43.string().optional()
5399
5453
  }).strict();
5400
- var permissionDecisionSchema = z42.object({
5401
- requestId: z42.string().min(1).max(128),
5402
- optionId: z42.string().min(1).max(128)
5454
+ var permissionDecisionSchema = z43.object({
5455
+ requestId: z43.string().min(1).max(128),
5456
+ optionId: z43.string().min(1).max(128)
5403
5457
  }).strict();
5404
- var permissionDecisionResponseSchema = z42.object({ delivered: z42.literal(true) });
5458
+ var permissionDecisionResponseSchema = z43.object({ delivered: z43.literal(true) });
5405
5459
 
5406
5460
  // ../contract/src/defined.ts
5407
5461
  function defined(value) {
@@ -5671,83 +5725,83 @@ function isImagePath(path) {
5671
5725
  }
5672
5726
 
5673
5727
  // ../contract/src/provider-requests.ts
5674
- import { z as z43 } from "zod";
5675
- var providerConnectSchema = z43.object({
5728
+ import { z as z44 } from "zod";
5729
+ var providerConnectSchema = z44.object({
5676
5730
  provider: runnerSchema,
5677
5731
  /** Which agent account to sign in (spec 2026-07-29-agent-profiles). Absent = the discovered
5678
5732
  * default, which is what every pre-profiles client sends. Without this, "Connect" on a second
5679
5733
  * Claude account would open a login for the FIRST one and report success. */
5680
- profileId: z43.string().max(64).optional()
5734
+ profileId: z44.string().max(64).optional()
5681
5735
  }).strict();
5682
- var createAgentProfileSchema = z43.object({
5736
+ var createAgentProfileSchema = z44.object({
5683
5737
  provider: runnerSchema,
5684
- label: z43.string().trim().max(200).optional(),
5685
- configDir: z43.string().trim().min(1).max(4096)
5738
+ label: z44.string().trim().max(200).optional(),
5739
+ configDir: z44.string().trim().min(1).max(4096)
5686
5740
  }).strict();
5687
- var updateAgentProfileSchema = z43.object({
5688
- label: z43.string().trim().max(200).optional(),
5689
- configDir: z43.string().trim().min(1).max(4096).optional()
5741
+ var updateAgentProfileSchema = z44.object({
5742
+ label: z44.string().trim().max(200).optional(),
5743
+ configDir: z44.string().trim().min(1).max(4096).optional()
5690
5744
  }).strict().refine(
5691
5745
  (value) => value.label !== void 0 || value.configDir !== void 0,
5692
5746
  "send label or configDir"
5693
5747
  );
5694
- var selectAgentProfileSchema = z43.object({
5695
- projectId: z43.string().min(1).max(64),
5748
+ var selectAgentProfileSchema = z44.object({
5749
+ projectId: z44.string().min(1).max(64),
5696
5750
  provider: runnerSchema,
5697
- profileId: z43.string().max(64).nullable()
5751
+ profileId: z44.string().max(64).nullable()
5698
5752
  }).strict();
5699
5753
  var providerParamSchema = runnerSchema;
5700
- var providerEnabledSchema = z43.object({ enabled: z43.boolean() }).strict();
5701
- var providerRetrySchema = z43.object({
5702
- authFailureId: z43.string().min(1).max(128)
5754
+ var providerEnabledSchema = z44.object({ enabled: z44.boolean() }).strict();
5755
+ var providerRetrySchema = z44.object({
5756
+ authFailureId: z44.string().min(1).max(128)
5703
5757
  }).strict();
5704
- var providerRouteParamsSchema = z43.object({ provider: providerParamSchema });
5705
- var agentProfileRouteParamsSchema = z43.object({ id: z43.string() });
5706
- var providerSignInParamsSchema = z43.object({ id: z43.uuid() });
5707
- var providerSignInRedirectSchema = z43.object({
5758
+ var providerRouteParamsSchema = z44.object({ provider: providerParamSchema });
5759
+ var agentProfileRouteParamsSchema = z44.object({ id: z44.string() });
5760
+ var providerSignInParamsSchema = z44.object({ id: z44.uuid() });
5761
+ var providerSignInRedirectSchema = z44.object({
5708
5762
  /** The address the browser landed on after consent, or the code that page shows. */
5709
- redirectUrl: z43.string().trim().min(1).max(8192)
5763
+ redirectUrl: z44.string().trim().min(1).max(8192)
5710
5764
  }).strict();
5711
5765
 
5712
5766
  // ../contract/src/automation-requests.ts
5713
- import { z as z45 } from "zod";
5767
+ import { z as z46 } from "zod";
5714
5768
 
5715
5769
  // ../contract/src/automation-storage.ts
5716
- import { z as z44 } from "zod";
5717
- var storedAutomationEventSchema = z44.enum([
5770
+ import { z as z45 } from "zod";
5771
+ var storedAutomationEventSchema = z45.enum([
5718
5772
  "pull_request.opened",
5719
5773
  "issue.opened",
5720
5774
  "issue.labeled",
5721
5775
  "issue.unlabeled"
5722
5776
  ]);
5723
- var boundedString = z44.string().trim().min(1).max(200);
5724
- var stringList = z44.array(boundedString).max(100).optional();
5725
- var storedAutomationFiltersSchema = z44.object({
5726
- includeExisting: z44.boolean().optional(),
5777
+ var boundedString = z45.string().trim().min(1).max(200);
5778
+ var stringList = z45.array(boundedString).max(100).optional();
5779
+ var storedAutomationFiltersSchema = z45.object({
5780
+ includeExisting: z45.boolean().optional(),
5727
5781
  /** Require an open item and matching live labels before reservation and launch. */
5728
- requireCurrentLabels: z44.boolean().optional(),
5782
+ requireCurrentLabels: z45.boolean().optional(),
5729
5783
  authors: stringList,
5730
5784
  assignees: stringList,
5731
5785
  allLabels: stringList,
5732
5786
  anyLabels: stringList,
5733
5787
  excludeLabels: stringList,
5734
5788
  changedLabels: stringList,
5735
- lookbackDays: z44.number().int().min(1).max(90).default(7),
5736
- maxRecords: z44.number().int().min(1).max(100).default(25)
5789
+ lookbackDays: z45.number().int().min(1).max(90).default(7),
5790
+ maxRecords: z45.number().int().min(1).max(100).default(25)
5737
5791
  }).passthrough();
5738
- var storedAutomationTaskSchema = z44.object({
5739
- prompt: z44.string().min(1).max(1e5),
5740
- workflow: z44.string().trim().min(1).max(200).optional(),
5741
- steps: z44.array(workflowStepDefSchema).min(1).max(100).optional(),
5792
+ var storedAutomationTaskSchema = z45.object({
5793
+ prompt: z45.string().min(1).max(1e5),
5794
+ workflow: z45.string().trim().min(1).max(200).optional(),
5795
+ steps: z45.array(workflowStepDefSchema).min(1).max(100).optional(),
5742
5796
  runner: runnerSchema.optional(),
5743
- model: z44.string().trim().min(1).max(200).optional(),
5744
- effort: z44.string().trim().min(1).max(32).optional(),
5745
- variants: z44.union([z44.literal(1), z44.literal(2), z44.literal(3)]).optional(),
5746
- worktree: z44.boolean().optional(),
5747
- autonomous: z44.boolean().optional(),
5797
+ model: z45.string().trim().min(1).max(200).optional(),
5798
+ effort: z45.string().trim().min(1).max(32).optional(),
5799
+ variants: z45.union([z45.literal(1), z45.literal(2), z45.literal(3)]).optional(),
5800
+ worktree: z45.boolean().optional(),
5801
+ autonomous: z45.boolean().optional(),
5748
5802
  ...completionControlsShape,
5749
5803
  ...taskAccessShape,
5750
- systemPrompt: z44.string().max(1e5).optional()
5804
+ systemPrompt: z45.string().max(1e5).optional()
5751
5805
  }).passthrough().refine((task) => !(task.workflow && task.steps), {
5752
5806
  message: "task selects either a named workflow or inline steps, not both"
5753
5807
  });
@@ -5765,122 +5819,122 @@ var fillGithubDefaults = (raw) => {
5765
5819
  filters: record.filters ?? {}
5766
5820
  };
5767
5821
  };
5768
- var storedAutomationDefinitionObjectSchema = z44.object({
5769
- id: z44.string().min(1).max(100),
5770
- revision: z44.number().int().positive(),
5771
- name: z44.string().trim().min(1).max(200),
5772
- description: z44.string().max(2e3).optional(),
5773
- enabled: z44.boolean().default(false),
5822
+ var storedAutomationDefinitionObjectSchema = z45.object({
5823
+ id: z45.string().min(1).max(100),
5824
+ revision: z45.number().int().positive(),
5825
+ name: z45.string().trim().min(1).max(200),
5826
+ description: z45.string().max(2e3).optional(),
5827
+ enabled: z45.boolean().default(false),
5774
5828
  /** A definition written before schedules has no `kind`: it is a poll. */
5775
5829
  kind: automationKindSchema.default("github"),
5776
- events: z44.array(storedAutomationEventSchema).min(1).max(4).optional(),
5777
- intervalSeconds: z44.number().int().min(60).max(86400).optional(),
5830
+ events: z45.array(storedAutomationEventSchema).min(1).max(4).optional(),
5831
+ intervalSeconds: z45.number().int().min(60).max(86400).optional(),
5778
5832
  filters: storedAutomationFiltersSchema.optional(),
5779
5833
  // Passthrough like every other persisted layer: a schedule key a later build adds survives a save here.
5780
5834
  schedule: automationScheduleSchema.passthrough().optional(),
5781
5835
  task: storedAutomationTaskSchema,
5782
5836
  /** `once` schedules only (hearsay-tools/cezarion#1465): the archive record. */
5783
- archived: z44.object({
5784
- at: z44.string().datetime(),
5785
- outcome: z44.enum(["launched", "cancelled"]),
5786
- runId: z44.string().optional(),
5787
- receiptId: z44.string().optional(),
5788
- trigger: z44.enum(["schedule", "late", "manual", "retry"]).optional()
5837
+ archived: z45.object({
5838
+ at: z45.string().datetime(),
5839
+ outcome: z45.enum(["launched", "cancelled"]),
5840
+ runId: z45.string().optional(),
5841
+ receiptId: z45.string().optional(),
5842
+ trigger: z45.enum(["schedule", "late", "manual", "retry"]).optional()
5789
5843
  }).passthrough().optional(),
5790
- createdAt: z44.string().datetime(),
5791
- updatedAt: z44.string().datetime()
5844
+ createdAt: z45.string().datetime(),
5845
+ updatedAt: z45.string().datetime()
5792
5846
  }).passthrough().superRefine((definition, ctx) => {
5793
5847
  if (definition.kind === "schedule") {
5794
5848
  if (!definition.schedule) {
5795
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
5849
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["schedule"], message: "a scheduled automation needs a schedule" });
5796
5850
  }
5797
5851
  return;
5798
5852
  }
5799
5853
  if (!definition.events?.length) {
5800
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
5854
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["events"], message: "a GitHub automation needs at least one event" });
5801
5855
  }
5802
5856
  if (definition.intervalSeconds === void 0) {
5803
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
5857
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["intervalSeconds"], message: "a GitHub automation needs a poll interval" });
5804
5858
  }
5805
5859
  if (!definition.filters) {
5806
- ctx.addIssue({ code: z44.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
5860
+ ctx.addIssue({ code: z45.ZodIssueCode.custom, path: ["filters"], message: "a GitHub automation needs its bounded filter" });
5807
5861
  }
5808
5862
  if (definition.events?.some((event) => event === "issue.labeled" || event === "issue.unlabeled") && !definition.filters?.changedLabels?.length) {
5809
5863
  ctx.addIssue({
5810
- code: z44.ZodIssueCode.custom,
5864
+ code: z45.ZodIssueCode.custom,
5811
5865
  path: ["filters", "changedLabels"],
5812
5866
  message: "changedLabels is required for issue label events"
5813
5867
  });
5814
5868
  }
5815
5869
  });
5816
- var storedAutomationDefinitionSchema = z44.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
5817
- var storedAutomationDefinitionsFileSchema = z44.object({
5818
- version: z44.literal(1).default(1),
5819
- automations: z44.array(z44.unknown()).default([]),
5820
- tombstones: z44.record(z44.string(), z44.string().datetime()).optional()
5870
+ var storedAutomationDefinitionSchema = z45.preprocess(fillGithubDefaults, storedAutomationDefinitionObjectSchema);
5871
+ var storedAutomationDefinitionsFileSchema = z45.object({
5872
+ version: z45.literal(1).default(1),
5873
+ automations: z45.array(z45.unknown()).default([]),
5874
+ tombstones: z45.record(z45.string(), z45.string().datetime()).optional()
5821
5875
  }).passthrough();
5822
- var storedAutomationCursorSchema = z44.object({
5823
- timestamp: z44.string().datetime(),
5824
- tieBreaker: z44.string().optional()
5876
+ var storedAutomationCursorSchema = z45.object({
5877
+ timestamp: z45.string().datetime(),
5878
+ tieBreaker: z45.string().optional()
5825
5879
  }).passthrough();
5826
5880
  var storedAutomationHistoryScanSchema = automationHistoryScanSchema.extend({
5827
5881
  cursor: storedAutomationCursorSchema.optional()
5828
5882
  });
5829
- var storedAutomationRuntimeStateSchema = z44.object({
5830
- revision: z44.number().int().positive().optional(),
5831
- baselineAt: z44.string().datetime().optional(),
5883
+ var storedAutomationRuntimeStateSchema = z45.object({
5884
+ revision: z45.number().int().positive().optional(),
5885
+ baselineAt: z45.string().datetime().optional(),
5832
5886
  /** Arming time, independent of a history window's older lower bound. */
5833
- armedAt: z44.string().datetime().optional(),
5887
+ armedAt: z45.string().datetime().optional(),
5834
5888
  historyScan: storedAutomationHistoryScanSchema.optional(),
5835
5889
  cursor: storedAutomationCursorSchema.optional(),
5836
- frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
5837
- backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z44.string() }).optional(),
5838
- nextCheckAt: z44.string().datetime().optional(),
5839
- lastSuccessAt: z44.string().datetime().optional(),
5890
+ frozenHighWatermark: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
5891
+ backlogAfter: storedAutomationCursorSchema.extend({ tieBreaker: z45.string() }).optional(),
5892
+ nextCheckAt: z45.string().datetime().optional(),
5893
+ lastSuccessAt: z45.string().datetime().optional(),
5840
5894
  /** schedule kind: the next occurrence's instant and the last fired one's. */
5841
- nextRunAt: z44.string().datetime().optional(),
5842
- lastRunAt: z44.string().datetime().optional(),
5843
- etags: z44.record(z44.string(), z44.string()).optional(),
5844
- backoffUntil: z44.string().datetime().optional(),
5845
- consecutiveFailures: z44.number().int().nonnegative().optional(),
5895
+ nextRunAt: z45.string().datetime().optional(),
5896
+ lastRunAt: z45.string().datetime().optional(),
5897
+ etags: z45.record(z45.string(), z45.string()).optional(),
5898
+ backoffUntil: z45.string().datetime().optional(),
5899
+ consecutiveFailures: z45.number().int().nonnegative().optional(),
5846
5900
  ...automationLastErrorShape,
5847
5901
  /** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
5848
- onceOutcome: z44.enum(["failed", "missed"]).optional()
5902
+ onceOutcome: z45.enum(["failed", "missed"]).optional()
5849
5903
  }).passthrough();
5850
- var storedAutomationStateFileSchema = z44.object({
5851
- version: z44.literal(1).default(1),
5852
- states: z44.record(z44.string(), storedAutomationRuntimeStateSchema).default({})
5904
+ var storedAutomationStateFileSchema = z45.object({
5905
+ version: z45.literal(1).default(1),
5906
+ states: z45.record(z45.string(), storedAutomationRuntimeStateSchema).default({})
5853
5907
  }).passthrough();
5854
- var storedAutomationReceiptSchema = z44.object({
5855
- receiptId: z44.string().min(1),
5856
- receiptKey: z44.string().min(1),
5857
- eventId: z44.string().min(1),
5858
- automationId: z44.string().min(1),
5859
- revision: z44.number().int().positive(),
5860
- status: z44.enum(["reserved", "launched", "launch-error", "released"]),
5861
- runId: z44.string().optional(),
5862
- observedAt: z44.string().datetime(),
5863
- updatedAt: z44.string().datetime(),
5864
- error: z44.string().max(2e3).optional(),
5908
+ var storedAutomationReceiptSchema = z45.object({
5909
+ receiptId: z45.string().min(1),
5910
+ receiptKey: z45.string().min(1),
5911
+ eventId: z45.string().min(1),
5912
+ automationId: z45.string().min(1),
5913
+ revision: z45.number().int().positive(),
5914
+ status: z45.enum(["reserved", "launched", "launch-error", "released"]),
5915
+ runId: z45.string().optional(),
5916
+ observedAt: z45.string().datetime(),
5917
+ updatedAt: z45.string().datetime(),
5918
+ error: z45.string().max(2e3).optional(),
5865
5919
  /** schedule kind: the occurrence this receipt reserved, so a retry can fire it again. */
5866
- occurrenceAt: z44.string().datetime().optional(),
5867
- candidate: z44.object({
5868
- eventId: z44.string(),
5920
+ occurrenceAt: z45.string().datetime().optional(),
5921
+ candidate: z45.object({
5922
+ eventId: z45.string(),
5869
5923
  event: storedAutomationEventSchema,
5870
- timestamp: z44.string().datetime(),
5871
- tieBreaker: z44.string(),
5872
- repo: z44.string(),
5873
- nodeId: z44.string(),
5874
- number: z44.number().int().positive(),
5875
- title: z44.string().max(500),
5876
- url: z44.string().url(),
5877
- author: z44.string().max(200),
5878
- assignees: z44.array(z44.string().max(200)).max(100),
5879
- labels: z44.array(z44.string().max(200)).max(100),
5880
- changedLabel: z44.string().max(200).optional()
5924
+ timestamp: z45.string().datetime(),
5925
+ tieBreaker: z45.string(),
5926
+ repo: z45.string(),
5927
+ nodeId: z45.string(),
5928
+ number: z45.number().int().positive(),
5929
+ title: z45.string().max(500),
5930
+ url: z45.string().url(),
5931
+ author: z45.string().max(200),
5932
+ assignees: z45.array(z45.string().max(200)).max(100),
5933
+ labels: z45.array(z45.string().max(200)).max(100),
5934
+ changedLabel: z45.string().max(200).optional()
5881
5935
  }).passthrough().optional()
5882
5936
  }).passthrough();
5883
- var storedAutomationLogResultSchema = z44.enum([
5937
+ var storedAutomationLogResultSchema = z45.enum([
5884
5938
  "launched",
5885
5939
  "no-match",
5886
5940
  "duplicate",
@@ -5896,24 +5950,24 @@ var storedAutomationLogResultSchema = z44.enum([
5896
5950
  // once schedule
5897
5951
  "missed"
5898
5952
  ]);
5899
- var storedAutomationLogRecordSchema = z44.object({
5900
- seq: z44.number().int().positive(),
5901
- ts: z44.string().datetime(),
5902
- automationId: z44.string().min(1),
5903
- revision: z44.number().int().positive(),
5953
+ var storedAutomationLogRecordSchema = z45.object({
5954
+ seq: z45.number().int().positive(),
5955
+ ts: z45.string().datetime(),
5956
+ automationId: z45.string().min(1),
5957
+ revision: z45.number().int().positive(),
5904
5958
  event: storedAutomationEventSchema.optional(),
5905
5959
  result: storedAutomationLogResultSchema,
5906
- reason: z44.string().max(2e3).optional(),
5907
- durationMs: z44.number().int().nonnegative().optional(),
5908
- receiptId: z44.string().optional(),
5909
- runId: z44.string().optional(),
5910
- githubNumber: z44.number().int().positive().optional(),
5911
- githubTitle: z44.string().max(500).optional(),
5912
- githubUrl: z44.string().url().optional(),
5913
- rateLimit: z44.object({
5914
- bucket: z44.enum(["core", "search"]),
5915
- remaining: z44.number().int().nonnegative().optional(),
5916
- resetAt: z44.string().datetime().optional()
5960
+ reason: z45.string().max(2e3).optional(),
5961
+ durationMs: z45.number().int().nonnegative().optional(),
5962
+ receiptId: z45.string().optional(),
5963
+ runId: z45.string().optional(),
5964
+ githubNumber: z45.number().int().positive().optional(),
5965
+ githubTitle: z45.string().max(500).optional(),
5966
+ githubUrl: z45.string().url().optional(),
5967
+ rateLimit: z45.object({
5968
+ bucket: z45.enum(["core", "search"]),
5969
+ remaining: z45.number().int().nonnegative().optional(),
5970
+ resetAt: z45.string().datetime().optional()
5917
5971
  }).passthrough().optional()
5918
5972
  }).passthrough();
5919
5973
  function storedIsOnceSchedule(definition) {
@@ -5927,210 +5981,210 @@ function storedIsScheduleAutomation(definition) {
5927
5981
  }
5928
5982
 
5929
5983
  // ../contract/src/automation-requests.ts
5930
- var automationEditableSchema = z45.object({
5931
- name: z45.string().trim().min(1).max(200),
5932
- description: z45.string().max(2e3).optional(),
5933
- enabled: z45.boolean().optional(),
5984
+ var automationEditableSchema = z46.object({
5985
+ name: z46.string().trim().min(1).max(200),
5986
+ description: z46.string().max(2e3).optional(),
5987
+ enabled: z46.boolean().optional(),
5934
5988
  kind: automationKindSchema.optional(),
5935
- events: z45.array(automationEventSchema).min(1).max(4).optional(),
5936
- intervalSeconds: z45.number().int().min(60).max(86400).optional(),
5989
+ events: z46.array(automationEventSchema).min(1).max(4).optional(),
5990
+ intervalSeconds: z46.number().int().min(60).max(86400).optional(),
5937
5991
  filters: storedAutomationFiltersSchema.optional(),
5938
5992
  schedule: automationScheduleSchema.optional(),
5939
- task: z45.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
5993
+ task: z46.strictObject(storedAutomationTaskSchema.shape).omit({ variants: true }).refine((task) => !(task.workflow && task.steps), {
5940
5994
  message: "task selects either a named workflow or inline steps, not both"
5941
5995
  })
5942
5996
  }).strict();
5943
- var automationCreateSchema = automationEditableSchema.extend({ enable: z45.boolean().optional() });
5944
- var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z45.number().int().positive() });
5945
- var automationCheckRequestSchema = z45.object({ mode: z45.enum(["preview", "execute"]) }).strict();
5946
- var automationLogQuerySchema = z45.object({
5947
- automationId: z45.string().optional(),
5997
+ var automationCreateSchema = automationEditableSchema.extend({ enable: z46.boolean().optional() });
5998
+ var automationUpdateSchema = automationEditableSchema.extend({ expectedRevision: z46.number().int().positive() });
5999
+ var automationCheckRequestSchema = z46.object({ mode: z46.enum(["preview", "execute"]) }).strict();
6000
+ var automationLogQuerySchema = z46.object({
6001
+ automationId: z46.string().optional(),
5948
6002
  result: automationLogResultSchema.optional(),
5949
6003
  event: automationEventSchema.optional(),
5950
- since: z45.string().datetime().optional(),
5951
- cursor: z45.coerce.number().int().positive().optional(),
6004
+ since: z46.string().datetime().optional(),
6005
+ cursor: z46.coerce.number().int().positive().optional(),
5952
6006
  // Optional, not `.default(100)`: `AutomationStore.logs` already clamps `limit ?? 100` into
5953
6007
  // 1..100, so the default here was a second copy of it — and a defaulted key is REQUIRED in the
5954
6008
  // request type `queryZodValidator` publishes (see validators.ts on why the request side falls
5955
6009
  // back to the schema's output), which would have made every caller send a `?limit=` this route
5956
6010
  // never needed.
5957
- limit: z45.coerce.number().int().min(1).max(100).optional()
6011
+ limit: z46.coerce.number().int().min(1).max(100).optional()
5958
6012
  });
5959
6013
 
5960
6014
  // ../contract/src/workflow-requests.ts
5961
- import { z as z46 } from "zod";
5962
- var planSchema = z46.object({
6015
+ import { z as z47 } from "zod";
6016
+ var planSchema = z47.object({
5963
6017
  // Same bound as `createRunInputSchema.task` — this flows into `planChain` (legacy reference 429).
5964
- task: z46.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
6018
+ task: z47.string().trim().min(1).max(1e5, "must be at most 100000 characters"),
5965
6019
  /** The account the planner runs on, as `POST /runs` takes it: absent follows the project's
5966
6020
  * selection (hearsay-tools/squawk#4116). */
5967
- agentProfile: z46.string().max(64).optional()
6021
+ agentProfile: z47.string().max(64).optional()
5968
6022
  });
5969
- var parseWorkflowSchema = z46.object({
5970
- yaml: z46.string().min(1).max(1e5)
6023
+ var parseWorkflowSchema = z47.object({
6024
+ yaml: z47.string().min(1).max(1e5)
5971
6025
  });
5972
6026
 
5973
6027
  // ../contract/src/ui-state-requests.ts
5974
- import { z as z47 } from "zod";
6028
+ import { z as z48 } from "zod";
5975
6029
  var SKILL_USAGE_MAX_ENTRIES = 200;
5976
6030
  var UI_STATE_MAX_KEYS = 200;
5977
6031
  var uiStateSchema2 = uiStateSchema.extend({
5978
6032
  // null records a quick task with no selected skill or workflow.
5979
- lastTask: z47.object({
5980
- source: z47.enum(["workflow", "skill"]),
5981
- ref: z47.string().min(1).max(200)
6033
+ lastTask: z48.object({
6034
+ source: z48.enum(["workflow", "skill"]),
6035
+ ref: z48.string().min(1).max(200)
5982
6036
  }).nullable().optional(),
5983
6037
  // Most recent source choices, newest first.
5984
- recentSources: z47.array(
5985
- z47.object({
5986
- source: z47.enum(["workflow", "skill"]),
5987
- ref: z47.string().min(1).max(200)
6038
+ recentSources: z48.array(
6039
+ z48.object({
6040
+ source: z48.enum(["workflow", "skill"]),
6041
+ ref: z48.string().min(1).max(200)
5988
6042
  })
5989
6043
  ).max(50).optional(),
5990
- 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, {
6044
+ 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, {
5991
6045
  message: `skillUsage must have at most ${SKILL_USAGE_MAX_ENTRIES} entries`
5992
6046
  }).optional(),
5993
- promptTemplates: z47.array(
5994
- z47.object({
5995
- id: z47.string().min(1).max(64),
5996
- label: z47.string().trim().min(1).max(80),
5997
- text: z47.string().trim().min(1).max(2e3),
6047
+ promptTemplates: z48.array(
6048
+ z48.object({
6049
+ id: z48.string().min(1).max(64),
6050
+ label: z48.string().trim().min(1).max(80),
6051
+ text: z48.string().trim().min(1).max(2e3),
5998
6052
  // Skill names this template auto-applies for. Optional and additive: templates
5999
6053
  // written before this key existed keep validating, and stay manual-only.
6000
- skills: z47.array(z47.string().trim().min(1).max(200)).max(50).optional()
6054
+ skills: z48.array(z48.string().trim().min(1).max(200)).max(50).optional()
6001
6055
  })
6002
6056
  ).max(50).optional()
6003
6057
  }).passthrough();
6004
6058
  function capUiStateKeys(data, ctx) {
6005
6059
  if (Object.keys(data).length > UI_STATE_MAX_KEYS) {
6006
- ctx.addIssue({ code: z47.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
6060
+ ctx.addIssue({ code: z48.ZodIssueCode.custom, message: `ui-state has too many keys (max ${UI_STATE_MAX_KEYS})` });
6007
6061
  }
6008
6062
  }
6009
6063
  var uiStateBody = uiStateSchema2.superRefine(capUiStateKeys);
6010
6064
 
6011
6065
  // ../contract/src/run-requests.ts
6012
- import { z as z48 } from "zod";
6013
- var queuedMessagePatchSchema = z48.object({
6014
- text: z48.string().max(1e5).optional(),
6015
- images: z48.array(attachmentInputSchema).max(4).optional()
6066
+ import { z as z49 } from "zod";
6067
+ var queuedMessagePatchSchema = z49.object({
6068
+ text: z49.string().max(1e5).optional(),
6069
+ images: z49.array(attachmentInputSchema).max(4).optional()
6016
6070
  }).refine((m) => m.text !== void 0 || m.images !== void 0, {
6017
6071
  message: "message edit needs text or attachments"
6018
6072
  });
6019
- var continueSchema = z48.object({
6020
- text: z48.string().max(1e5, "must be at most 100000 characters").optional(),
6021
- images: z48.array(attachmentInputSchema).max(4).optional(),
6073
+ var continueSchema = z49.object({
6074
+ text: z49.string().max(1e5, "must be at most 100000 characters").optional(),
6075
+ images: z49.array(attachmentInputSchema).max(4).optional(),
6022
6076
  runner: runnerSchema.optional(),
6023
- model: z48.string().max(200).optional(),
6077
+ model: z49.string().max(200).optional(),
6024
6078
  /** Reasoning-effort pin (legacy reference 45). Omitted keeps the run's pin; empty string clears it. */
6025
- effort: z48.string().max(32).optional()
6079
+ effort: z49.string().max(32).optional()
6026
6080
  });
6027
- var archiveSchema = z48.object({
6028
- archived: z48.boolean().optional()
6081
+ var archiveSchema = z49.object({
6082
+ archived: z49.boolean().optional()
6029
6083
  });
6030
- var openInSchema = z48.object({
6084
+ var openInSchema = z49.object({
6031
6085
  // A short bound (legacy reference 429): matched against a downstream allowlist, so an editor id is never long.
6032
- target: z48.string().trim().min(1, "target required").max(200),
6033
- path: z48.string().max(1e3).optional()
6086
+ target: z49.string().trim().min(1, "target required").max(200),
6087
+ path: z49.string().max(1e3).optional()
6034
6088
  });
6035
6089
 
6036
6090
  // ../contract/src/query-requests.ts
6037
- import { z as z49 } from "zod";
6038
- var queryValue = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).optional();
6039
- var refreshQuery = z49.object({ refresh: queryValue });
6040
- var waitQuery = z49.object({ wait: queryValue });
6041
- var queryRunnerSchema = z49.union([z49.string(), z49.array(z49.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
6042
- var modelDiscoveryQuerySchema = z49.object({ runner: queryRunnerSchema, profileId: z49.string().max(64).optional() });
6043
- var strictRefreshQuerySchema = z49.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6044
- var browseQuerySchema = z49.object({ path: queryValue, showHidden: queryValue });
6045
- var worktreeFilesQuerySchema = z49.object({ path: queryValue, raw: queryValue });
6046
- var commitQuerySchema = z49.object({ structured: queryValue });
6091
+ import { z as z50 } from "zod";
6092
+ var queryValue = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).optional();
6093
+ var refreshQuery = z50.object({ refresh: queryValue });
6094
+ var waitQuery = z50.object({ wait: queryValue });
6095
+ var queryRunnerSchema = z50.union([z50.string(), z50.array(z50.string()).transform((v) => v[0])]).pipe(modelDiscoveryRunnerSchema);
6096
+ var modelDiscoveryQuerySchema = z50.object({ runner: queryRunnerSchema, profileId: z50.string().max(64).optional() });
6097
+ var strictRefreshQuerySchema = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6098
+ var browseQuerySchema = z50.object({ path: queryValue, showHidden: queryValue });
6099
+ var worktreeFilesQuerySchema = z50.object({ path: queryValue, raw: queryValue });
6100
+ var commitQuerySchema = z50.object({ structured: queryValue });
6047
6101
 
6048
6102
  // ../contract/src/github-requests.ts
6049
- import { z as z50 } from "zod";
6050
- var mergeNumberParams = z50.object({ number: z50.coerce.number().int().positive() });
6051
- var prChangesParams = z50.object({ number: z50.coerce.number().int().positive().safe() });
6052
- var prChangesQuery = z50.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6053
- var mergeBodySchema = z50.object({
6054
- method: z50.enum(["merge", "squash", "rebase"]),
6055
- expectedHeadSha: z50.string().regex(/^[0-9a-f]{40}$/),
6056
- overrideRules: z50.boolean().optional().default(false)
6103
+ import { z as z51 } from "zod";
6104
+ var mergeNumberParams = z51.object({ number: z51.coerce.number().int().positive() });
6105
+ var prChangesParams = z51.object({ number: z51.coerce.number().int().positive().safe() });
6106
+ var prChangesQuery = z51.object({ refresh: queryValue.refine((v) => v === void 0 || v === "1") });
6107
+ var mergeBodySchema = z51.object({
6108
+ method: z51.enum(["merge", "squash", "rebase"]),
6109
+ expectedHeadSha: z51.string().regex(/^[0-9a-f]{40}$/),
6110
+ overrideRules: z51.boolean().optional().default(false)
6057
6111
  }).strict();
6058
- var githubChecksQuerySchema = z50.object({ prs: z50.string().min(1) });
6059
- var githubRefsQuerySchema = z50.object({ prs: z50.string().optional(), issues: z50.string().optional() });
6112
+ var githubChecksQuerySchema = z51.object({ prs: z51.string().min(1) });
6113
+ var githubRefsQuerySchema = z51.object({ prs: z51.string().optional(), issues: z51.string().optional() });
6060
6114
 
6061
6115
  // ../contract/src/repo-requests.ts
6062
- import { z as z51 } from "zod";
6063
- var gitCommitSchema = z51.object({
6064
- message: z51.string().trim().min(1, "must not be empty").max(5e3)
6116
+ import { z as z52 } from "zod";
6117
+ var gitCommitSchema = z52.object({
6118
+ message: z52.string().trim().min(1, "must not be empty").max(5e3)
6065
6119
  });
6066
- var reclaimBodySchema = z51.object({}).passthrough();
6067
- var repoBranchSchema = z51.object({
6068
- name: z51.string().trim().min(1).max(200),
6069
- from: z51.string().trim().min(1).max(200).optional()
6120
+ var reclaimBodySchema = z52.object({}).passthrough();
6121
+ var repoBranchSchema = z52.object({
6122
+ name: z52.string().trim().min(1).max(200),
6123
+ from: z52.string().trim().min(1).max(200).optional()
6070
6124
  });
6071
- var reclaimRunParamsSchema = z51.object({ runId: z51.string().min(1) });
6125
+ var reclaimRunParamsSchema = z52.object({ runId: z52.string().min(1) });
6072
6126
 
6073
6127
  // ../contract/src/config-requests.ts
6074
- import { z as z52 } from "zod";
6128
+ import { z as z53 } from "zod";
6075
6129
  var setConfigSchema = setConfigInputSchema.extend({
6076
- systemPrompt: z52.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
6130
+ systemPrompt: z53.string().trim().max(2e4, "must be at most 20000 characters").nullable().optional()
6077
6131
  });
6078
- var setAgentConfigSchema = z52.object({
6079
- content: z52.string().max(2e6),
6080
- version: z52.string().nullable()
6132
+ var setAgentConfigSchema = z53.object({
6133
+ content: z53.string().max(2e6),
6134
+ version: z53.string().nullable()
6081
6135
  });
6082
6136
 
6083
6137
  // ../contract/src/workflow-file.ts
6084
- import { z as z53 } from "zod";
6085
- var workflowFileSchema = z53.object({
6086
- name: z53.string().min(1),
6087
- description: z53.string().optional(),
6088
- steps: z53.array(workflowStepDefSchema).min(1).optional(),
6089
- skills: z53.array(z53.string().trim().min(1)).min(1).optional()
6138
+ import { z as z54 } from "zod";
6139
+ var workflowFileSchema = z54.object({
6140
+ name: z54.string().min(1),
6141
+ description: z54.string().optional(),
6142
+ steps: z54.array(workflowStepDefSchema).min(1).optional(),
6143
+ skills: z54.array(z54.string().trim().min(1)).min(1).optional()
6090
6144
  }).refine((d) => Boolean(d.steps) !== Boolean(d.skills), {
6091
6145
  message: 'a workflow lists either "steps" or "skills", not both'
6092
6146
  });
6093
6147
 
6094
6148
  // ../contract/src/reports.ts
6095
- import { z as z54 } from "zod";
6149
+ import { z as z55 } from "zod";
6096
6150
  var REPORTS_QUERY_MAX = 1e3;
6097
- var cursorSchema = z54.string().min(1).max(1024);
6098
- var reportsQuerySchema = z54.object({
6099
- q: z54.string().max(REPORTS_QUERY_MAX).optional(),
6151
+ var cursorSchema = z55.string().min(1).max(1024);
6152
+ var reportsQuerySchema = z55.object({
6153
+ q: z55.string().max(REPORTS_QUERY_MAX).optional(),
6100
6154
  before: cursorSchema.optional(),
6101
- limit: z54.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
6155
+ limit: z55.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()
6102
6156
  }).strict();
6103
- var reportSchema = z54.object({
6104
- id: z54.uuid(),
6105
- runId: z54.uuid(),
6106
- name: z54.string(),
6107
- title: z54.string(),
6108
- createdAt: z54.iso.datetime(),
6109
- size: z54.number().int().nonnegative(),
6110
- taskTitle: z54.string(),
6157
+ var reportSchema = z55.object({
6158
+ id: z55.uuid(),
6159
+ runId: z55.uuid(),
6160
+ name: z55.string(),
6161
+ title: z55.string(),
6162
+ createdAt: z55.iso.datetime(),
6163
+ size: z55.number().int().nonnegative(),
6164
+ taskTitle: z55.string(),
6111
6165
  taskStatus: runStatusSchema
6112
6166
  }).strict();
6113
- var reportsResponseSchema = z54.object({
6114
- reports: z54.array(reportSchema),
6167
+ var reportsResponseSchema = z55.object({
6168
+ reports: z55.array(reportSchema),
6115
6169
  nextCursor: cursorSchema.nullable(),
6116
6170
  // Counts all matching cached rows with readable source summaries before page content checks.
6117
6171
  // A missing-content row dropped while filling this page can lower total on the next request.
6118
- total: z54.number().int().nonnegative()
6172
+ total: z55.number().int().nonnegative()
6119
6173
  }).strict();
6120
- var reportsStateSchema = z54.object({
6121
- epoch: z54.uuid(),
6122
- generation: z54.number().int().nonnegative(),
6123
- metadataGeneration: z54.number().int().nonnegative()
6174
+ var reportsStateSchema = z55.object({
6175
+ epoch: z55.uuid(),
6176
+ generation: z55.number().int().nonnegative(),
6177
+ metadataGeneration: z55.number().int().nonnegative()
6124
6178
  }).strict();
6125
- var reportsMetadataSchema = z54.object({
6126
- runId: z54.uuid(),
6127
- taskTitle: z54.string(),
6179
+ var reportsMetadataSchema = z55.object({
6180
+ runId: z55.uuid(),
6181
+ taskTitle: z55.string(),
6128
6182
  taskStatus: runStatusSchema
6129
6183
  }).strict();
6130
- var reportsFrameSchema = z54.discriminatedUnion("type", [
6131
- reportsStateSchema.extend({ type: z54.literal("snapshot") }),
6132
- reportsStateSchema.extend({ type: z54.literal("content") }),
6133
- reportsStateSchema.extend({ type: z54.literal("metadata"), runs: z54.array(reportsMetadataSchema) })
6184
+ var reportsFrameSchema = z55.discriminatedUnion("type", [
6185
+ reportsStateSchema.extend({ type: z55.literal("snapshot") }),
6186
+ reportsStateSchema.extend({ type: z55.literal("content") }),
6187
+ reportsStateSchema.extend({ type: z55.literal("metadata"), runs: z55.array(reportsMetadataSchema) })
6134
6188
  ]);
6135
6189
 
6136
6190
  // ../contract/src/report-title.ts
@@ -6152,108 +6206,108 @@ function controlLocation(control, separator = " \u2192 ") {
6152
6206
  }
6153
6207
 
6154
6208
  // ../contract/src/home-recovery.ts
6155
- import { z as z55 } from "zod";
6209
+ import { z as z56 } from "zod";
6156
6210
  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))$/;
6157
- var homeFileSchema = z55.string().regex(HOME_FILE_PATTERN);
6158
- var recoveryFile = z55.object({
6211
+ var homeFileSchema = z56.string().regex(HOME_FILE_PATTERN);
6212
+ var recoveryFile = z56.object({
6159
6213
  file: homeFileSchema,
6160
- detectedAt: z55.iso.datetime(),
6161
- canRestore: z55.boolean()
6214
+ detectedAt: z56.iso.datetime(),
6215
+ canRestore: z56.boolean()
6162
6216
  });
6163
6217
  var HOME_RECOVERY_REASONS = ["reset", "outside-write", "legacy-change"];
6164
- var homeRecoveryFileSchema = z55.discriminatedUnion("reason", [
6165
- recoveryFile.extend({ reason: z55.literal("reset") }),
6166
- recoveryFile.extend({ reason: z55.literal("outside-write") }),
6167
- recoveryFile.extend({ reason: z55.literal("legacy-change"), canImport: z55.boolean() })
6218
+ var homeRecoveryFileSchema = z56.discriminatedUnion("reason", [
6219
+ recoveryFile.extend({ reason: z56.literal("reset") }),
6220
+ recoveryFile.extend({ reason: z56.literal("outside-write") }),
6221
+ recoveryFile.extend({ reason: z56.literal("legacy-change"), canImport: z56.boolean() })
6168
6222
  ]);
6169
- var homeRecoverySchema = z55.object({ files: z55.array(homeRecoveryFileSchema) });
6223
+ var homeRecoverySchema = z56.object({ files: z56.array(homeRecoveryFileSchema) });
6170
6224
  function filterHomeRecoveryReasons(value, reasons) {
6171
6225
  if (!value || typeof value !== "object" || !("files" in value) || !Array.isArray(value.files)) return value;
6172
6226
  return { ...value, files: value.files.filter((row) => !(row && typeof row === "object" && "reason" in row && typeof row.reason === "string" && !reasons.includes(row.reason))) };
6173
6227
  }
6174
- var homeRecoveryReaderSchema = z55.preprocess(
6228
+ var homeRecoveryReaderSchema = z56.preprocess(
6175
6229
  (value) => filterHomeRecoveryReasons(value, HOME_RECOVERY_REASONS),
6176
6230
  homeRecoverySchema
6177
6231
  );
6178
- var homeRecoveryActionSchema = z55.object({ file: homeFileSchema, detectedAt: z55.iso.datetime() }).strict();
6232
+ var homeRecoveryActionSchema = z56.object({ file: homeFileSchema, detectedAt: z56.iso.datetime() }).strict();
6179
6233
 
6180
6234
  // ../contract/src/runner-skills.ts
6181
- import { z as z56 } from "zod";
6182
- var runnerSkillScopeSchema = z56.enum(["repo", "user", "system", "other"]);
6183
- var runnerSkillsQuerySchema = z56.object({
6235
+ import { z as z57 } from "zod";
6236
+ var runnerSkillScopeSchema = z57.enum(["repo", "user", "system", "other"]);
6237
+ var runnerSkillsQuerySchema = z57.object({
6184
6238
  runner: queryRunnerSchema,
6185
- account: z56.string().min(1).max(64).optional(),
6186
- refresh: z56.literal("1").optional()
6239
+ account: z57.string().min(1).max(64).optional(),
6240
+ refresh: z57.literal("1").optional()
6187
6241
  });
6188
- var runnerSkillSchema = z56.object({
6189
- id: z56.string(),
6190
- name: z56.string(),
6191
- description: z56.string().optional(),
6242
+ var runnerSkillSchema = z57.object({
6243
+ id: z57.string(),
6244
+ name: z57.string(),
6245
+ description: z57.string().optional(),
6192
6246
  scope: runnerSkillScopeSchema.optional(),
6193
- plugin: z56.string().optional(),
6194
- path: z56.string().optional()
6247
+ plugin: z57.string().optional(),
6248
+ path: z57.string().optional()
6195
6249
  });
6196
- var runnerSkillProblemSchema = z56.object({ message: z56.string(), path: z56.string().optional() });
6197
- var runnerSkillListSchema = z56.object({
6250
+ var runnerSkillProblemSchema = z57.object({ message: z57.string(), path: z57.string().optional() });
6251
+ var runnerSkillListSchema = z57.object({
6198
6252
  runner: runnerSchema,
6199
- skills: z56.array(runnerSkillSchema),
6200
- problems: z56.array(runnerSkillProblemSchema),
6201
- source: z56.enum(["live", "cache", "unavailable"]),
6202
- reason: z56.string().optional()
6253
+ skills: z57.array(runnerSkillSchema),
6254
+ problems: z57.array(runnerSkillProblemSchema),
6255
+ source: z57.enum(["live", "cache", "unavailable"]),
6256
+ reason: z57.string().optional()
6203
6257
  });
6204
6258
 
6205
6259
  // ../contract/src/runner-install.ts
6206
- import { z as z57 } from "zod";
6207
- var runnerInstallParamsSchema = z57.object({ runner: runnerSchema });
6208
- var runnerInstallActionSchema = z57.object({ action: z57.enum(["check", "install", "update", "remove"]) });
6209
- var runnerInstallPhaseSchema = z57.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
6210
- var runnerInstallStatusSchema = z57.object({
6211
- supported: z57.boolean(),
6212
- installedVersion: z57.string().nullable(),
6213
- latestVersion: z57.string().nullable(),
6214
- updateAvailable: z57.boolean(),
6260
+ import { z as z58 } from "zod";
6261
+ var runnerInstallParamsSchema = z58.object({ runner: runnerSchema });
6262
+ var runnerInstallActionSchema = z58.object({ action: z58.enum(["check", "install", "update", "remove"]) });
6263
+ var runnerInstallPhaseSchema = z58.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
6264
+ var runnerInstallStatusSchema = z58.object({
6265
+ supported: z58.boolean(),
6266
+ installedVersion: z58.string().nullable(),
6267
+ latestVersion: z58.string().nullable(),
6268
+ updateAvailable: z58.boolean(),
6215
6269
  phase: runnerInstallPhaseSchema,
6216
- error: z57.string().nullable()
6270
+ error: z58.string().nullable()
6217
6271
  });
6218
6272
 
6219
6273
  // ../contract/src/automation-tool.ts
6220
- import { z as z58 } from "zod";
6274
+ import { z as z59 } from "zod";
6221
6275
  var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
6222
- var id = z58.string().min(1).max(100);
6223
- var automationToolRequestSchema = z58.discriminatedUnion("action", [
6224
- z58.object({ action: z58.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
6225
- z58.object({ action: z58.literal("show"), id }).strict(),
6226
- z58.object({ action: z58.literal("preview"), id }).strict(),
6227
- z58.object({ action: z58.literal("enable"), id, explicit: z58.boolean().optional() }).strict()
6276
+ var id = z59.string().min(1).max(100);
6277
+ var automationToolRequestSchema = z59.discriminatedUnion("action", [
6278
+ z59.object({ action: z59.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
6279
+ z59.object({ action: z59.literal("show"), id }).strict(),
6280
+ z59.object({ action: z59.literal("preview"), id }).strict(),
6281
+ z59.object({ action: z59.literal("enable"), id, explicit: z59.boolean().optional() }).strict()
6228
6282
  ]);
6229
- var automationToolAnswerSchema = z58.union([
6230
- z58.object({
6231
- ok: z58.literal(true),
6283
+ var automationToolAnswerSchema = z59.union([
6284
+ z59.object({
6285
+ ok: z59.literal(true),
6232
6286
  automation: storedAutomationDefinitionSchema,
6233
- url: z58.string().optional(),
6234
- next_run_at: z58.string().optional(),
6235
- preview: z58.object({ matches: z58.number().int().nonnegative(), truncated: z58.boolean() }).optional()
6287
+ url: z59.string().optional(),
6288
+ next_run_at: z59.string().optional(),
6289
+ preview: z59.object({ matches: z59.number().int().nonnegative(), truncated: z59.boolean() }).optional()
6236
6290
  }),
6237
- z58.object({ ok: z58.literal(false), code: z58.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z58.string() })
6291
+ z59.object({ ok: z59.literal(false), code: z59.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z59.string() })
6238
6292
  ]);
6239
6293
 
6240
6294
  // ../contract/src/agent-tools.ts
6241
- import { z as z59 } from "zod";
6242
- var agentToolResultSchema = z59.object({
6243
- content: z59.array(z59.object({ type: z59.literal("text"), text: z59.string() })),
6244
- isError: z59.boolean().optional(),
6245
- details: z59.unknown()
6246
- });
6247
- var agentToolMetadataSchema = z59.object({
6248
- timeoutMs: z59.number().positive(),
6295
+ import { z as z60 } from "zod";
6296
+ var agentToolResultSchema = z60.object({
6297
+ content: z60.array(z60.object({ type: z60.literal("text"), text: z60.string() })),
6298
+ isError: z60.boolean().optional(),
6299
+ details: z60.unknown()
6300
+ });
6301
+ var agentToolMetadataSchema = z60.object({
6302
+ timeoutMs: z60.number().positive(),
6249
6303
  unavailable: agentToolResultSchema,
6250
- name: z59.string(),
6251
- description: z59.string(),
6252
- trigger: z59.string(),
6253
- label: z59.string(),
6254
- inputSchema: z59.object({ type: z59.literal("object"), properties: z59.record(z59.string(), z59.unknown()).optional() }).catchall(z59.unknown())
6304
+ name: z60.string(),
6305
+ description: z60.string(),
6306
+ trigger: z60.string(),
6307
+ label: z60.string(),
6308
+ inputSchema: z60.object({ type: z60.literal("object"), properties: z60.record(z60.string(), z60.unknown()).optional() }).catchall(z60.unknown())
6255
6309
  });
6256
- var agentToolCatalogSchema = z59.object({ tools: z59.array(agentToolMetadataSchema), instructions: z59.string() });
6310
+ var agentToolCatalogSchema = z60.object({ tools: z60.array(agentToolMetadataSchema), instructions: z60.string() });
6257
6311
  export {
6258
6312
  ACTIVITY_CHECKS_MAX,
6259
6313
  ACTIVITY_CHECK_NAME_MAX,
@@ -6331,6 +6385,7 @@ export {
6331
6385
  SCHEDULED_TASK_NOTE,
6332
6386
  SCHEDULE_HOURS_OPTIONS,
6333
6387
  SCHEDULE_TYPES,
6388
+ SESSION_CONTEXT_FILE_MAX_BYTES,
6334
6389
  SHARED_ATTACH_REFUSAL,
6335
6390
  SHARED_BASELINE,
6336
6391
  SHARED_BASELINE_REFUSAL,
@@ -6857,12 +6912,19 @@ export {
6857
6912
  selectAgentProfileSchema,
6858
6913
  sendAgentReportInputSchema,
6859
6914
  sendAgentReportResponseSchema,
6915
+ sessionContextFileSchema,
6916
+ sessionContextPreviewBlockSchema,
6917
+ sessionContextPreviewRequestSchema,
6918
+ sessionContextPreviewSchema,
6919
+ sessionContextProblemSchema,
6920
+ sessionContextRoleSchema,
6860
6921
  sessionRunner,
6861
6922
  setAgentConfigInputSchema,
6862
6923
  setAgentConfigSchema,
6863
6924
  setConfigInputSchema,
6864
6925
  setConfigResponseSchema,
6865
6926
  setConfigSchema,
6927
+ setSessionContextSchema,
6866
6928
  setWorkspaceConfigInputSchema,
6867
6929
  setWorkspaceUiStateInputSchema,
6868
6930
  sharedSpawnRefusal,