glimmervoid 0.38.2 → 0.39.0

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 (37) hide show
  1. package/dist/bin/glimmervoid.js +23 -29
  2. package/dist/chunks/{adapters-CAHxZYT3.js → adapters-B9tP9MXC.js} +26 -14
  3. package/dist/chunks/{adapters-DDjC7_vG.js → adapters-Buu6yI71.js} +1 -1
  4. package/dist/chunks/{agent-api-cli-B5Tm0wXO.js → agent-api-cli-2_RwTTTJ.js} +4 -66
  5. package/dist/chunks/{agent-api-cli-BDu1CxZf.js → agent-api-cli-PfCov-qb.js} +1 -1
  6. package/dist/chunks/agent-api-core-D2HLgBEe.js +180 -0
  7. package/dist/chunks/{agent-setup-cli-DmMfCw5O.js → agent-setup-cli-C1nFdgFg.js} +2 -2
  8. package/dist/chunks/config-store-8Z9vkWvf.js +1 -0
  9. package/dist/chunks/{config-store-BUNZs4j7.js → config-store-n23JDU4E.js} +63 -268
  10. package/dist/chunks/{contracts-HVCEJfxs.js → contracts-DYQW11de.js} +1018 -171
  11. package/dist/chunks/{git-version-rWZjF2Px.js → git-version-DXozXVnb.js} +2 -2
  12. package/dist/chunks/{grok-B6bsCgdd.js → grok-DeGAXgZF.js} +7 -8
  13. package/dist/chunks/{guardrails-deps-Cb-ki4EU.js → guardrails-deps-CLxK4J-g.js} +1 -1
  14. package/dist/chunks/{json-file-CIJf0Cel.js → json-file-DFCTvPjj.js} +3 -7
  15. package/dist/chunks/{main-BNSbP-Yk.js → main-D4uwk-_M.js} +16436 -21253
  16. package/dist/chunks/{pair-cli-DNp8i5L4.js → pair-cli-D9DZBqk0.js} +2 -2
  17. package/dist/chunks/{remote-config-C_s2pnLC.js → remote-config-DiLwnzBq.js} +2 -2
  18. package/dist/chunks/{session-BlT68ppa.js → session-D2EbiysG.js} +20 -32
  19. package/dist/chunks/{session-routes-CT1JrjoT.js → session-routes-BQAZzMKZ.js} +3 -8
  20. package/dist/chunks/{settings-cli-BbzxCyG5.js → settings-cli-DP4t-I9U.js} +3 -3
  21. package/dist/chunks/{ssh-sign-cli-C74BGTQS.js → ssh-sign-cli-D2RIs-iN.js} +2 -2
  22. package/dist/client/assets/index-C0YUJwjz.css +2 -0
  23. package/dist/client/assets/index-w8lG-tk2.js +148 -0
  24. package/dist/client/assets/xterm-kR64YvZ-.js +79 -0
  25. package/dist/client/assets/zod-BRLv4KqJ.js +55 -0
  26. package/dist/client/index.html +5 -2
  27. package/dist/scripts/postinstall-path-check.js +21 -3
  28. package/dist/server/index.js +1 -1
  29. package/package.json +2 -3
  30. package/dist/chunks/agent-api-core-B_mUSenR.js +0 -341
  31. package/dist/chunks/browser-config-BrBT8269.js +0 -762
  32. package/dist/chunks/config-CjawSOBk.js +0 -219
  33. package/dist/chunks/config-store-MAVQhGMh.js +0 -1
  34. package/dist/chunks/factory-D7ryES9n.js +0 -240
  35. package/dist/chunks/knowledge-graph-cli-ByUJoKw_.js +0 -1354
  36. package/dist/client/assets/index-B5uVtedd.css +0 -1
  37. package/dist/client/assets/index-b13-NGGS.js +0 -275
@@ -1,149 +1,800 @@
1
- import { $ as SessionPrLinks, A as SessionState, B as MyPrKeepMergeableResult, F as LinkedPr, Ft as REPO_SLUG_RE, G as MyPrMergeWhenReadyRequest, H as MyPrMergeRequest, K as MyPrMergeWhenReadyResult, Lt as GithubPollingRefreshRequest, O as SessionDoc, Ot as hasRequiredActionHead, P as TaskTitle, Q as MyPrsStatus, Rt as GithubPollingRefreshResult, St as TeamReviewStatus, T as SESSION_DOC_PATH_MAX_CHARS, U as MyPrMergeResult, _ as ConversationApproval, _t as TeamReviewActionRequest, g as ConversationAnswers, k as SessionSnapshot, tt as CommitSha, v as ConversationApprovalDecision, vt as TeamReviewActionResult, x as PendingWakeup, z as MyPrKeepMergeableRequest, zt as githubPollingShape } from "./session-BlT68ppa.js";
2
- import "./browser-config-BrBT8269.js";
3
- import { _ as isSingleFactoryPathSegment, a as FactoryControlRequest, d as FactoryQueueIntentRequest, f as FactoryQueueIntentResult, h as FactoryState, o as FactoryControlResult, p as FactoryReviewVerdict } from "./factory-D7ryES9n.js";
4
- import { n as BUILTIN_AGENT_IDS } from "./config-CjawSOBk.js";
1
+ import { $ as CommitSha, B as MyPrMergeRequest, D as SessionSnapshot, E as SessionDoc, Et as hasRequiredActionHead, Ft as GithubPollingRefreshRequest, G as MyPrSearchNode, It as GithubPollingRefreshResult, L as MyPrKeepMergeableRequest, Lt as githubPollingShape, M as TaskTitle, N as LinkedPr, Nt as REPO_SLUG_RE, O as SessionState, Pt as repoParts, Q as repositoryName, R as MyPrKeepMergeableResult, U as MyPrMergeWhenReadyRequest, V as MyPrMergeResult, W as MyPrMergeWhenReadyResult, X as MyPrsStatus, Z as SessionPrLinks, _ as PendingWakeup, bt as TeamReviewStatus, f as CoherenceHooksState, gt as TeamReviewActionResult, h as ConversationApprovalDecision, ht as TeamReviewActionRequest, jt as GH_SEGMENT, m as ConversationApproval, p as ConversationAnswers, x as SESSION_DOC_PATH_MAX_CHARS } from "./session-D2EbiysG.js";
2
+ import { n as isRecord } from "./coerce-NSst8oRP.js";
3
+ import path from "node:path";
5
4
  import { z } from "zod";
6
- //#region shared/contracts/factory-decision-log.ts
7
- var FACTORY_DECISION_OUTPUT_MAX_BYTES = 16384;
8
- var FactoryDecisionKind = z.enum([
9
- "admission",
10
- "closeout",
11
- "merge",
12
- "verification",
13
- "exception",
14
- "landing",
15
- "trust"
5
+ //#region shared/settings-ranges.ts
6
+ var POSITIVE_NUMBER_RANGE = Object.freeze({
7
+ min: 0,
8
+ exclusiveMin: true,
9
+ label: "a positive number"
10
+ });
11
+ var NON_NEGATIVE_NUMBER_RANGE = Object.freeze({
12
+ min: 0,
13
+ label: "zero or more"
14
+ });
15
+ var FLYING_ANIMALS_GAP_RANGE = Object.freeze({
16
+ min: 0,
17
+ max: 300
18
+ });
19
+ var FLYING_ANIMALS_DURATION_RANGE = Object.freeze({
20
+ min: 1,
21
+ max: 60
22
+ });
23
+ var FLYING_ANIMALS_SCALE_RANGE = Object.freeze({
24
+ min: .5,
25
+ max: 2
26
+ });
27
+ var FLYING_ANIMALS_DEFAULTS = Object.freeze({
28
+ flyingAnimalsMinGapSeconds: 20,
29
+ flyingAnimalsMaxGapSeconds: 40,
30
+ flyingAnimalsMinDurationSeconds: 6.9,
31
+ flyingAnimalsMaxDurationSeconds: 11.5,
32
+ flyingAnimalsScale: 1,
33
+ flyingAnimalsOnPhone: true
34
+ });
35
+ var REPLAY_BUFFER_KB_RANGE = Object.freeze({
36
+ min: 64,
37
+ max: 16384
38
+ });
39
+ var MEMORY_RESERVE_MB_RANGE = Object.freeze({
40
+ min: 0,
41
+ max: 65536
42
+ });
43
+ var PORT_RANGE = Object.freeze({
44
+ min: 0,
45
+ max: 65535
46
+ });
47
+ var TASK_TITLE_TIMEOUT_RANGE = Object.freeze({
48
+ min: 0,
49
+ exclusiveMin: true,
50
+ max: 2147483647 / 1e3
51
+ });
52
+ var BRANCH_GC_STALE_DAYS_RANGE = POSITIVE_NUMBER_RANGE;
53
+ var BRANCH_GC_INTERVAL_MS_RANGE = POSITIVE_NUMBER_RANGE;
54
+ var VISIONS_QUIET_MS_RANGE = POSITIVE_NUMBER_RANGE;
55
+ var VISIONS_COOLDOWN_MS_RANGE = POSITIVE_NUMBER_RANGE;
56
+ var VISIONS_MAX_PER_HOUR_RANGE = POSITIVE_NUMBER_RANGE;
57
+ var VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE = NON_NEGATIVE_NUMBER_RANGE;
58
+ var VISIONS_DISPATCH_TIMEOUT_RANGE = POSITIVE_NUMBER_RANGE;
59
+ var VISIONS_INTENT_THREAD_TTL_MS_RANGE = POSITIVE_NUMBER_RANGE;
60
+ var POSTHOG_INTERVAL_RANGE = POSITIVE_NUMBER_RANGE;
61
+ var POSTHOG_MAX_CONCURRENT_RANGE = POSITIVE_NUMBER_RANGE;
62
+ var POSTHOG_INVESTIGATION_TIMEOUT_RANGE = POSITIVE_NUMBER_RANGE;
63
+ var POSTHOG_MIN_USERS_RANGE = POSITIVE_NUMBER_RANGE;
64
+ var POSTHOG_ESCALATION_RANGE = POSITIVE_NUMBER_RANGE;
65
+ var POSTHOG_RECURRENCE_WINDOW_RANGE = POSITIVE_NUMBER_RANGE;
66
+ var POSTHOG_TRANSIENT_RECURRENCE_RANGE = POSITIVE_NUMBER_RANGE;
67
+ var POSTHOG_FIX_TIMEOUT_RANGE = Object.freeze({
68
+ min: 60,
69
+ max: 21600,
70
+ label: "between 60 and 21600"
71
+ });
72
+ var POSTHOG_TRAFFIC_MULTIPLIER_RANGE = Object.freeze({
73
+ min: 1,
74
+ label: "at least 1"
75
+ });
76
+ var POSTHOG_TRAFFIC_MIN_USERS_RANGE = Object.freeze({
77
+ min: 1,
78
+ label: "at least 1"
79
+ });
80
+ var POSTHOG_TRAFFIC_COOLDOWN_RANGE = NON_NEGATIVE_NUMBER_RANGE;
81
+ var POSTHOG_TRAFFIC_BASELINE_RANGE = Object.freeze({
82
+ min: 1,
83
+ max: 30,
84
+ label: "between 1 and 30"
85
+ });
86
+ var USAGE_SCAN_INTERVAL_RANGE = Object.freeze({
87
+ min: 1,
88
+ max: 1440
89
+ });
90
+ var USAGE_RETAIN_DAYS_RANGE = Object.freeze({
91
+ min: 1,
92
+ max: 3650
93
+ });
94
+ var USAGE_WAREHOUSE_RETAIN_DAYS_RANGE = Object.freeze({
95
+ min: 30,
96
+ max: 3650
97
+ });
98
+ var USAGE_SESSION_BLOCK_HOURS_RANGE = Object.freeze({
99
+ min: 1,
100
+ max: 24
101
+ });
102
+ var USAGE_BUDGET_RANGE = POSITIVE_NUMBER_RANGE;
103
+ var USAGE_INTEGER_RANGES = Object.freeze({
104
+ scanIntervalMinutes: USAGE_SCAN_INTERVAL_RANGE,
105
+ retainDays: USAGE_RETAIN_DAYS_RANGE,
106
+ warehouseRetainDays: USAGE_WAREHOUSE_RETAIN_DAYS_RANGE,
107
+ sessionBlockHours: USAGE_SESSION_BLOCK_HOURS_RANGE
108
+ });
109
+ var CHANGE_MAP_NARRATOR_TIMEOUT_RANGE = Object.freeze({
110
+ min: 15,
111
+ max: 600
112
+ });
113
+ var KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE = Object.freeze({
114
+ min: 5,
115
+ max: 120
116
+ });
117
+ var WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE = Object.freeze({
118
+ min: 1,
119
+ max: 5
120
+ });
121
+ var WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE = Object.freeze({
122
+ min: 1,
123
+ max: 50
124
+ });
125
+ Object.freeze({
126
+ NON_NEGATIVE_NUMBER_RANGE,
127
+ FLYING_ANIMALS_GAP_RANGE,
128
+ FLYING_ANIMALS_DURATION_RANGE,
129
+ FLYING_ANIMALS_SCALE_RANGE,
130
+ CHANGE_MAP_NARRATOR_TIMEOUT_RANGE,
131
+ KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE,
132
+ PORT_RANGE,
133
+ POSTHOG_ESCALATION_RANGE,
134
+ POSTHOG_FIX_TIMEOUT_RANGE,
135
+ POSTHOG_INTERVAL_RANGE,
136
+ POSTHOG_INVESTIGATION_TIMEOUT_RANGE,
137
+ POSTHOG_MAX_CONCURRENT_RANGE,
138
+ POSTHOG_MIN_USERS_RANGE,
139
+ POSTHOG_TRAFFIC_BASELINE_RANGE,
140
+ POSTHOG_TRAFFIC_COOLDOWN_RANGE,
141
+ POSTHOG_TRAFFIC_MIN_USERS_RANGE,
142
+ POSTHOG_TRAFFIC_MULTIPLIER_RANGE,
143
+ REPLAY_BUFFER_KB_RANGE,
144
+ MEMORY_RESERVE_MB_RANGE,
145
+ TASK_TITLE_TIMEOUT_RANGE,
146
+ USAGE_BUDGET_RANGE,
147
+ USAGE_RETAIN_DAYS_RANGE,
148
+ USAGE_SCAN_INTERVAL_RANGE,
149
+ VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE,
150
+ VISIONS_COOLDOWN_MS_RANGE,
151
+ VISIONS_DISPATCH_TIMEOUT_RANGE,
152
+ VISIONS_INTENT_THREAD_TTL_MS_RANGE,
153
+ VISIONS_MAX_PER_HOUR_RANGE,
154
+ VISIONS_QUIET_MS_RANGE,
155
+ WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE,
156
+ WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE
157
+ });
158
+ //#endregion
159
+ //#region shared/contracts/config-numbers-core.ts
160
+ var POSTHOG_WHOLE_NUMBER_ROUNDING = {
161
+ maxConcurrentInvestigations: Math.ceil,
162
+ minUsersToInvestigate: Math.ceil,
163
+ userEscalationThreshold: Math.ceil,
164
+ trafficSpikeMinUsers: Math.ceil,
165
+ trafficSpikeBaselineDays: Math.floor
166
+ };
167
+ var LEGACY_INTEGER_FIELDS = [
168
+ {
169
+ path: [
170
+ "visions",
171
+ "dispatch",
172
+ "quietMs"
173
+ ],
174
+ min: 1,
175
+ round: Math.floor
176
+ },
177
+ {
178
+ path: [
179
+ "visions",
180
+ "dispatch",
181
+ "cooldownMs"
182
+ ],
183
+ min: 1,
184
+ round: Math.floor
185
+ },
186
+ {
187
+ path: [
188
+ "visions",
189
+ "dispatch",
190
+ "maxPerHour"
191
+ ],
192
+ min: 1,
193
+ round: Math.floor
194
+ },
195
+ {
196
+ path: [
197
+ "visions",
198
+ "dispatch",
199
+ "activityMaxPerHour"
200
+ ],
201
+ min: 0,
202
+ round: Math.floor
203
+ },
204
+ {
205
+ path: [
206
+ "visions",
207
+ "dispatch",
208
+ "dispatchTimeoutSeconds"
209
+ ],
210
+ min: 1,
211
+ round: Math.floor
212
+ },
213
+ {
214
+ path: [
215
+ "visions",
216
+ "intent",
217
+ "threadTtlMs"
218
+ ],
219
+ min: 1,
220
+ round: Math.floor
221
+ },
222
+ ...Object.entries(POSTHOG_WHOLE_NUMBER_ROUNDING).map(([key, round]) => ({
223
+ path: ["posthog", key],
224
+ min: 1,
225
+ round
226
+ }))
227
+ ];
228
+ function normalizeIntegerField(config, path, min, round) {
229
+ let target = config;
230
+ for (const segment of path.slice(0, -1)) {
231
+ const block = target[segment];
232
+ if (!isRecord(block)) return;
233
+ target[segment] = { ...block };
234
+ target = target[segment];
235
+ }
236
+ const key = path.at(-1);
237
+ const value = target[key];
238
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return;
239
+ if (Number.isInteger(value)) return;
240
+ target[key] = Math.min(Number.MAX_SAFE_INTEGER, Math.max(min, round(value)));
241
+ }
242
+ function normalizeLegacyConfigNumbers(candidate) {
243
+ const normalized = { ...candidate };
244
+ const replayBufferKB = candidate.replayBufferKB;
245
+ if (typeof replayBufferKB === "number" && Number.isFinite(replayBufferKB) && replayBufferKB >= 0 && replayBufferKB <= REPLAY_BUFFER_KB_RANGE.max) normalized.replayBufferKB = Math.max(REPLAY_BUFFER_KB_RANGE.min, Math.floor(replayBufferKB));
246
+ for (const { path, min, round } of LEGACY_INTEGER_FIELDS) normalizeIntegerField(normalized, path, min, round);
247
+ return normalized;
248
+ }
249
+ //#endregion
250
+ //#region shared/usage-config.ts
251
+ var USAGE_COST_MODES = Object.freeze([
252
+ "auto",
253
+ "calculate",
254
+ "display"
16
255
  ]);
17
- var FactoryDecisionOutcome = z.enum([
18
- "refused",
19
- "available",
20
- "dispatched",
21
- "ended",
22
- "retry",
23
- "block",
24
- "merge",
25
- "merged",
26
- "failed",
27
- "stale",
28
- "passed",
29
- "raised",
30
- "stalled",
31
- "recovered",
32
- "granted"
256
+ var USAGE_VENDOR_KEYS = Object.freeze(["codex", "grok"]);
257
+ var USAGE_BUDGET_KEYS = Object.freeze(["dailyUsd", "monthlyUsd"]);
258
+ //#endregion
259
+ //#region shared/contracts/workflows.ts
260
+ var WORKFLOW_TRIGGERS = Object.freeze([
261
+ "opened",
262
+ "checks-failed",
263
+ "review-requested",
264
+ "approved",
265
+ "commented",
266
+ "merged"
33
267
  ]);
34
- var FactoryDecisionFailureClass = z.enum([
35
- "admission",
36
- "worker",
37
- "fence",
38
- "check",
39
- "review",
40
- "closeout",
41
- "verification",
42
- "stale",
43
- "exception",
44
- "stall",
45
- "landing"
268
+ var WORKFLOW_ACTION_TYPES = Object.freeze([
269
+ "notify",
270
+ "spawn",
271
+ "label",
272
+ "comment"
46
273
  ]);
47
- var decisionCheck = z.strictObject({
48
- command: z.string(),
49
- pass: z.boolean(),
50
- output: z.string()
51
- });
52
- var decisionFence = z.discriminatedUnion("ok", [z.strictObject({ ok: z.literal(true) }), z.strictObject({
53
- ok: z.literal(false),
54
- outside: z.array(z.string()),
55
- protected: z.array(z.string()),
56
- unsupportedProtectedPaths: z.array(z.string())
57
- })]);
58
- var decisionFields = {
59
- timestamp: z.iso.datetime(),
60
- projectId: z.string().min(1).max(128).refine(isSingleFactoryPathSegment),
61
- outcome: FactoryDecisionOutcome,
62
- workId: z.string().min(1).nullable(),
63
- intentId: z.string().min(1).nullable(),
64
- sessionId: z.string().min(1).nullable(),
65
- attempt: z.number().int().positive().nullable(),
66
- durationMs: z.number().int().nonnegative().nullable(),
67
- failureClass: FactoryDecisionFailureClass.nullable(),
68
- reason: z.string().max(3999).nullable()
274
+ var WORKFLOW_PROMPT_TEMPLATE_MAX_CHARACTERS = 2e4;
275
+ var WORKFLOW_COMMENT_BODY_MAX_CHARACTERS = 65536;
276
+ var WORKFLOW_LABEL_NAME_MAX_CHARACTERS = 50;
277
+ var RULE_ID = /^[a-z0-9][a-z0-9-]{0,63}$/;
278
+ var UNSAFE_LABEL_NAME = /[\x00-\x1f\x7f,]|^-/;
279
+ var integerInRange = (field, range) => {
280
+ const message = `${field} must be an integer between ${range.min} and ${range.max}`;
281
+ return z.number({ error: message }).int({ error: message }).min(range.min, { error: message }).max(range.max, { error: message });
69
282
  };
70
- var FactoryDecisionLogLine = z.discriminatedUnion("kind", [
71
- z.strictObject({
72
- ...decisionFields,
73
- kind: z.literal("admission"),
74
- outcome: z.enum([
75
- "refused",
76
- "available",
77
- "dispatched",
78
- "ended",
79
- "block"
80
- ])
81
- }),
82
- z.strictObject({
83
- ...decisionFields,
84
- kind: z.literal("closeout"),
85
- outcome: z.enum([
86
- "retry",
87
- "block",
88
- "merge"
89
- ]),
90
- attempt: z.number().int().positive(),
91
- durationMs: z.number().int().nonnegative(),
92
- fence: decisionFence.nullable(),
93
- checks: z.array(decisionCheck).refine((checks) => checks.reduce((totalBytes, check) => totalBytes + new TextEncoder().encode(check.output).length, 0) <= FACTORY_DECISION_OUTPUT_MAX_BYTES),
94
- review: FactoryReviewVerdict.nullable()
95
- }),
283
+ var workflowsEnabled = z.boolean({ error: "workflows.enabled must be a boolean" });
284
+ var workflowsMaxConcurrentSessions = integerInRange("workflows.maxConcurrentSessions", WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE);
285
+ var workflowsMaxActionsPerPoll = integerInRange("workflows.maxActionsPerPoll", WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE);
286
+ var nonEmptyList = (field, item) => z.array(item, { error: `${field} must be an array` }).min(1, { error: `${field} must list at least one entry when present` });
287
+ var WorkflowLabelName = z.string({ error: "a workflow label name must be a string" }).trim().min(1, { error: "a workflow label name must not be empty" }).max(WORKFLOW_LABEL_NAME_MAX_CHARACTERS, { error: `a workflow label name must be at most ${WORKFLOW_LABEL_NAME_MAX_CHARACTERS} characters` }).refine((name) => !UNSAFE_LABEL_NAME.test(name), { error: "a workflow label name must not start with a dash or hold a comma or control character" });
288
+ var WorkflowCommentBody = z.string({ error: "a workflow comment body must be a string" }).min(1, { error: "a workflow comment body must not be empty" }).max(WORKFLOW_COMMENT_BODY_MAX_CHARACTERS, { error: `a workflow comment body must be at most ${WORKFLOW_COMMENT_BODY_MAX_CHARACTERS} characters` }).refine((body) => body.trim().length > 0, { error: "a workflow comment body must not be blank" });
289
+ var WorkflowTrigger = z.enum(WORKFLOW_TRIGGERS, { error: `workflows.rules[].trigger must be one of ${WORKFLOW_TRIGGERS.join(", ")}` });
290
+ var WorkflowAction = z.discriminatedUnion("type", [
291
+ z.strictObject({ type: z.literal("notify") }),
96
292
  z.strictObject({
97
- ...decisionFields,
98
- kind: z.literal("merge"),
99
- outcome: z.literal("merged"),
100
- mergedSha: z.string().regex(/^[a-f0-9]{40,64}$/)
293
+ type: z.literal("spawn"),
294
+ promptTemplate: z.string({ error: "a spawn action needs a promptTemplate string" }).min(1, { error: "a spawn action promptTemplate must not be empty" }).max(WORKFLOW_PROMPT_TEMPLATE_MAX_CHARACTERS, { error: `a spawn action promptTemplate must be at most ${WORKFLOW_PROMPT_TEMPLATE_MAX_CHARACTERS} characters` }).refine((template) => template.trim().length > 0, { error: "a spawn action promptTemplate must not be blank" })
101
295
  }),
102
296
  z.strictObject({
103
- ...decisionFields,
104
- kind: z.literal("verification"),
105
- outcome: z.enum([
106
- "failed",
107
- "stale",
108
- "passed"
109
- ])
297
+ type: z.literal("label"),
298
+ name: WorkflowLabelName
110
299
  }),
111
300
  z.strictObject({
112
- ...decisionFields,
113
- kind: z.literal("exception"),
114
- outcome: z.enum(["raised", "stalled"])
115
- }),
116
- z.strictObject({
117
- ...decisionFields,
118
- kind: z.literal("landing"),
119
- outcome: z.enum(["failed", "recovered"])
120
- }),
121
- z.strictObject({
122
- ...decisionFields,
123
- kind: z.literal("trust"),
124
- outcome: z.literal("granted")
301
+ type: z.literal("comment"),
302
+ body: WorkflowCommentBody
125
303
  })
126
- ]).superRefine((line, context) => {
127
- const isFailure = [
128
- "refused",
129
- "retry",
130
- "block",
131
- "failed",
132
- "stale",
133
- "raised",
134
- "stalled"
135
- ].includes(line.outcome);
136
- if (isFailure && line.failureClass === null) context.addIssue({
137
- code: "custom",
138
- path: ["failureClass"],
139
- message: "Failure requires a failure class"
140
- });
141
- if (!isFailure && line.outcome !== "ended" && line.failureClass !== null) context.addIssue({
142
- code: "custom",
143
- path: ["failureClass"],
144
- message: "Success requires a null failure class"
145
- });
304
+ ], { error: `workflows.rules[].actions[].type must be one of ${WORKFLOW_ACTION_TYPES.join(", ")}` });
305
+ var WorkflowFilters = z.strictObject({
306
+ mine: z.boolean({ error: "workflows.rules[].filters.mine must be a boolean" }).optional(),
307
+ teamReviewRequested: z.boolean({ error: "workflows.rules[].filters.teamReviewRequested must be a boolean" }).optional(),
308
+ authors: nonEmptyList("workflows.rules[].filters.authors", z.string({ error: "workflows.rules[].filters.authors must hold GitHub logins" }).regex(GH_SEGMENT, { error: "workflows.rules[].filters.authors must hold GitHub logins" })).optional(),
309
+ labels: nonEmptyList("workflows.rules[].filters.labels", WorkflowLabelName).optional(),
310
+ baseBranches: nonEmptyList("workflows.rules[].filters.baseBranches", z.string({ error: "workflows.rules[].filters.baseBranches must hold branch names" }).min(1, { error: "workflows.rules[].filters.baseBranches must hold branch names" })).optional()
311
+ }, { error: "workflows.rules[].filters must be an object" });
312
+ var WorkflowRuleId = z.string({ error: "workflows.rules[].id must be a string" }).regex(RULE_ID, { error: "workflows.rules[].id must be 1 to 64 lowercase letters, digits and dashes, starting with a letter or digit" });
313
+ var WorkflowRuleEnabled = z.boolean({ error: "workflows.rules[].enabled must be a boolean" });
314
+ var WorkflowRule = z.strictObject({
315
+ id: WorkflowRuleId,
316
+ name: z.string({ error: "workflows.rules[].name must be a string" }).trim().min(1, { error: "workflows.rules[].name must not be empty" }).max(80, { error: "workflows.rules[].name must be at most 80 characters" }),
317
+ enabled: WorkflowRuleEnabled.default(false),
318
+ repos: nonEmptyList("workflows.rules[].repos", repositoryName),
319
+ filters: WorkflowFilters.default({}),
320
+ trigger: WorkflowTrigger,
321
+ actions: nonEmptyList("workflows.rules[].actions", WorkflowAction)
322
+ }, { error: "workflows.rules[] must be an object" });
323
+ var WorkflowsSettings = z.strictObject({
324
+ enabled: workflowsEnabled.default(true),
325
+ maxConcurrentSessions: workflowsMaxConcurrentSessions.default(2),
326
+ maxActionsPerPoll: workflowsMaxActionsPerPoll.default(20),
327
+ rules: z.array(WorkflowRule, { error: "workflows.rules must be an array" }).default([])
328
+ }, { error: "workflows must be an object" }).superRefine((settings, ctx) => {
329
+ const claimedIds = /* @__PURE__ */ new Set();
330
+ for (const [index, rule] of settings.rules.entries()) {
331
+ if (!claimedIds.has(rule.id)) {
332
+ claimedIds.add(rule.id);
333
+ continue;
334
+ }
335
+ ctx.addIssue({
336
+ code: "custom",
337
+ path: [
338
+ "rules",
339
+ index,
340
+ "id"
341
+ ],
342
+ message: `workflows.rules[${index}].id "${rule.id}" is declared more than once`
343
+ });
344
+ }
345
+ });
346
+ var WorkflowRuleToggle = z.strictObject({
347
+ id: WorkflowRuleId,
348
+ enabled: WorkflowRuleEnabled
349
+ }, { error: "a dashboard update of workflows.rules[] carries only id and enabled" });
350
+ var WorkflowsSettingsUpdate = z.strictObject({
351
+ enabled: workflowsEnabled.optional(),
352
+ maxConcurrentSessions: workflowsMaxConcurrentSessions.optional(),
353
+ maxActionsPerPoll: workflowsMaxActionsPerPoll.optional(),
354
+ rules: z.array(WorkflowRuleToggle, { error: "workflows.rules must be an array" }).optional()
355
+ }, { error: "a dashboard update of workflows carries only enabled, maxConcurrentSessions, maxActionsPerPoll and rule toggles" });
356
+ var nonnegativeInteger = z.number().int().nonnegative();
357
+ var checksState = z.enum([
358
+ "SUCCESS",
359
+ "FAILURE",
360
+ "PENDING",
361
+ "ERROR",
362
+ "EXPECTED"
363
+ ]).nullable();
364
+ var WorkflowSearchNode = MyPrSearchNode.extend({
365
+ author: z.object({ login: z.string() }).nullable(),
366
+ labels: z.object({ nodes: z.array(z.object({ name: z.string() })) }),
367
+ comments: z.object({ totalCount: nonnegativeInteger })
146
368
  });
369
+ var WorkflowPr = z.strictObject({
370
+ repo: repositoryName,
371
+ number: z.number().int().positive(),
372
+ title: z.string(),
373
+ url: z.url(),
374
+ author: z.string().nullable(),
375
+ state: z.enum([
376
+ "OPEN",
377
+ "MERGED",
378
+ "CLOSED"
379
+ ]),
380
+ createdAt: z.string(),
381
+ mergedAt: z.string().nullable(),
382
+ isDraft: z.boolean(),
383
+ isCrossRepository: z.boolean(),
384
+ baseRefName: z.string(),
385
+ headRefName: z.string().min(1),
386
+ headRefOid: CommitSha,
387
+ labels: z.array(z.string()),
388
+ commentCount: nonnegativeInteger,
389
+ reviewRequests: z.array(z.string()),
390
+ checksState,
391
+ reviewDecision: z.enum([
392
+ "APPROVED",
393
+ "CHANGES_REQUESTED",
394
+ "REVIEW_REQUIRED"
395
+ ]).nullable()
396
+ });
397
+ var WorkflowRepoSnapshot = z.strictObject({
398
+ polledAtMs: nonnegativeInteger,
399
+ prs: z.array(WorkflowPr)
400
+ });
401
+ var WorkflowsState = z.strictObject({ repos: z.record(z.string().regex(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/), WorkflowRepoSnapshot) });
402
+ //#endregion
403
+ //#region shared/contracts/browser-config.ts
404
+ var optionalBoolean = (field) => z.boolean({ error: `${field} must be a boolean` }).optional();
405
+ var optionalString = (field, trim = false) => {
406
+ const schema = z.string({ error: `${field} must be a string` });
407
+ return (trim ? schema.transform((value) => value.trim()) : schema).optional();
408
+ };
409
+ var numberRangeLabel = (range) => {
410
+ if (range.label) return range.label;
411
+ if (range.max != null) return `between ${range.min} and ${range.max}`;
412
+ if (range.exclusiveMin) return `greater than ${range.min}`;
413
+ return `at least ${range.min}`;
414
+ };
415
+ var optionalNumber = (field, range = POSITIVE_NUMBER_RANGE) => z.number({ error: `${field} must be ${numberRangeLabel(range)}` }).finite().refine((value) => !range.exclusiveMin || value > range.min, { message: `${field} must be ${numberRangeLabel(range)}` }).refine((value) => range.exclusiveMin || value >= range.min, { message: `${field} must be ${numberRangeLabel(range)}` }).refine((value) => range.max == null || value <= range.max, { message: `${field} must be ${numberRangeLabel(range)}` }).optional();
416
+ var optionalWholeNumber = (field, range) => optionalNumber(field, range).unwrap().int({ error: `${field} must be a whole number ${numberRangeLabel(range)}` }).optional();
417
+ var optionalInteger = (field, range) => z.number({ error: `${field} must be an integer between ${range.min} and ${range.max}` }).int({ error: `${field} must be an integer between ${range.min} and ${range.max}` }).min(range.min, { error: `${field} must be an integer between ${range.min} and ${range.max}` }).max(range.max, { error: `${field} must be an integer between ${range.min} and ${range.max}` }).optional();
418
+ var optionalObject = (field, shape) => z.object(shape, { error: `${field} must be an object` }).nullable().optional();
419
+ var optionalLooseObject = (field) => z.object({}, { error: `${field} must be an object` }).passthrough().nullable().optional();
420
+ var CHANGE_MAP_NARRATOR_ENGINES = Object.freeze(["claude", "codex"]);
421
+ var UPDATE_CHANNELS = Object.freeze(["release", "main"]);
422
+ var POST_TURN_CHECK_MODES = Object.freeze(["report", "fix"]);
423
+ var ChangeMapSettings = optionalObject("changeMap", { narrator: optionalObject("changeMap.narrator", {
424
+ enabled: optionalBoolean("changeMap.narrator.enabled"),
425
+ engine: z.enum(CHANGE_MAP_NARRATOR_ENGINES, { error: `changeMap.narrator.engine must be one of ${CHANGE_MAP_NARRATOR_ENGINES.join(", ")}` }).optional(),
426
+ model: optionalString("changeMap.narrator.model", true),
427
+ timeoutSeconds: optionalInteger("changeMap.narrator.timeoutSeconds", CHANGE_MAP_NARRATOR_TIMEOUT_RANGE)
428
+ }) });
429
+ var TaskTitleSettings = z.object({ refiner: z.object({
430
+ enabled: optionalBoolean("taskTitle.refiner.enabled"),
431
+ model: optionalString("taskTitle.refiner.model", true),
432
+ minIntervalSeconds: optionalNumber("taskTitle.refiner.minIntervalSeconds", { min: 0 }),
433
+ timeoutSeconds: optionalNumber("taskTitle.refiner.timeoutSeconds", TASK_TITLE_TIMEOUT_RANGE)
434
+ }, { error: "taskTitle.refiner must be an object" }).nullable().optional() }, { error: "taskTitle must be an object" }).nullable().optional();
435
+ var BRANCH_GC_SETTINGS_SHAPE = {
436
+ enabled: optionalBoolean("branchGc.enabled"),
437
+ worktrees: optionalBoolean("branchGc.worktrees"),
438
+ prefixes: z.array(z.string({ error: "branchGc.prefixes must be an array of strings" }).min(1, { error: "branchGc.prefixes entries must be non-empty strings" }), { error: "branchGc.prefixes must be an array of strings" }).optional(),
439
+ dryRun: optionalBoolean("branchGc.dryRun"),
440
+ staleDays: optionalNumber("branchGc.staleDays", BRANCH_GC_STALE_DAYS_RANGE),
441
+ deleteUnmerged: optionalBoolean("branchGc.deleteUnmerged"),
442
+ intervalMs: optionalNumber("branchGc.intervalMs", BRANCH_GC_INTERVAL_MS_RANGE)
443
+ };
444
+ var BranchGcFileSettings = z.object(BRANCH_GC_SETTINGS_SHAPE, { error: "branchGc must be an object" });
445
+ var BranchGcSettings = optionalObject("branchGc", BRANCH_GC_SETTINGS_SHAPE);
446
+ var BranchGcControlSettings = BranchGcFileSettings.omit({
447
+ prefixes: true,
448
+ dryRun: true,
449
+ worktrees: true
450
+ }).nullable().optional();
451
+ Object.freeze(["enabled", "deleteUnmerged"]);
452
+ Object.freeze(["staleDays", "intervalMs"]);
453
+ var PostTurnChecksSettings = optionalObject("postTurnChecks", { mode: z.enum(POST_TURN_CHECK_MODES, { error: "postTurnChecks.mode must be one of report, fix" }).optional() });
454
+ var VisionsSettings = optionalObject("visions", {
455
+ enabled: optionalBoolean("visions.enabled"),
456
+ autoFix: optionalBoolean("visions.autoFix"),
457
+ projects: z.array(z.string({ error: "visions.projects must be an array of strings" }), { error: "visions.projects must be an array of strings" }).optional(),
458
+ dispatch: optionalObject("visions.dispatch", {
459
+ enabled: optionalBoolean("visions.dispatch.enabled"),
460
+ model: optionalString("visions.dispatch.model", true),
461
+ quietMs: optionalWholeNumber("visions.dispatch.quietMs", VISIONS_QUIET_MS_RANGE),
462
+ cooldownMs: optionalWholeNumber("visions.dispatch.cooldownMs", VISIONS_COOLDOWN_MS_RANGE),
463
+ maxPerHour: optionalWholeNumber("visions.dispatch.maxPerHour", VISIONS_MAX_PER_HOUR_RANGE),
464
+ activityMaxPerHour: optionalWholeNumber("visions.dispatch.activityMaxPerHour", VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE),
465
+ dispatchTimeoutSeconds: optionalWholeNumber("visions.dispatch.dispatchTimeoutSeconds", VISIONS_DISPATCH_TIMEOUT_RANGE)
466
+ }),
467
+ intent: optionalObject("visions.intent", { threadTtlMs: optionalWholeNumber("visions.intent.threadTtlMs", VISIONS_INTENT_THREAD_TTL_MS_RANGE) })
468
+ });
469
+ var GithubSettings = z.object({ teams: z.array(z.string({ error: "github.teams must be an array of org/slug strings" }).refine((team) => repoParts(team) !== null, { message: "github.teams entries must be org/slug with valid GitHub segments" }), { error: "github.teams must be an array of org/slug strings" }).optional() }, { error: "github must be an object" }).nullable().optional();
470
+ var TeamReviewSettings = optionalObject("teamReview", {
471
+ enabled: optionalBoolean("teamReview.enabled"),
472
+ autoRebaseMyPrs: optionalBoolean("teamReview.autoRebaseMyPrs"),
473
+ keepMergeableEnabled: optionalBoolean("teamReview.keepMergeableEnabled"),
474
+ mergeQueueEnabled: optionalBoolean("teamReview.mergeQueueEnabled"),
475
+ keepMergeableTimeoutMinutes: optionalInteger("teamReview.keepMergeableTimeoutMinutes", KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE),
476
+ org: optionalString("teamReview.org", true),
477
+ team: optionalString("teamReview.team", true),
478
+ skill: optionalString("teamReview.skill", true),
479
+ reReviewAfterHours: optionalNumber("teamReview.reReviewAfterHours"),
480
+ skipIdleAfterDays: optionalNumber("teamReview.skipIdleAfterDays")
481
+ });
482
+ var BenchmarksSettings = optionalObject("benchmarks", { enabled: optionalBoolean("benchmarks.enabled") });
483
+ var CoherenceSettings = optionalObject("coherence", { enabled: optionalBoolean("coherence.enabled") });
484
+ var posthogNumberRanges = {
485
+ intervalMinutes: POSTHOG_INTERVAL_RANGE,
486
+ maxConcurrentInvestigations: POSTHOG_MAX_CONCURRENT_RANGE,
487
+ investigationTimeoutSeconds: POSTHOG_INVESTIGATION_TIMEOUT_RANGE,
488
+ fixTimeoutSeconds: POSTHOG_FIX_TIMEOUT_RANGE,
489
+ minUsersToInvestigate: POSTHOG_MIN_USERS_RANGE,
490
+ userEscalationThreshold: POSTHOG_ESCALATION_RANGE,
491
+ recurrenceWindowDays: POSTHOG_RECURRENCE_WINDOW_RANGE,
492
+ transientRecurrenceLimit: POSTHOG_TRANSIENT_RECURRENCE_RANGE,
493
+ trafficSpikeMultiplier: POSTHOG_TRAFFIC_MULTIPLIER_RANGE,
494
+ trafficSpikeMinUsers: POSTHOG_TRAFFIC_MIN_USERS_RANGE,
495
+ trafficSpikeCooldownMinutes: POSTHOG_TRAFFIC_COOLDOWN_RANGE,
496
+ trafficSpikeBaselineDays: POSTHOG_TRAFFIC_BASELINE_RANGE
497
+ };
498
+ var PosthogSettings = optionalObject("posthog", {
499
+ enabled: optionalBoolean("posthog.enabled"),
500
+ recurrenceDedupe: optionalBoolean("posthog.recurrenceDedupe"),
501
+ trafficSpikeEnabled: optionalBoolean("posthog.trafficSpikeEnabled"),
502
+ autoFix: optionalBoolean("posthog.autoFix"),
503
+ host: optionalString("posthog.host", true).refine((value) => value == null || !value || /^https?:\/\//i.test(value), { message: "posthog.host must be an http(s) URL" }),
504
+ apiKey: optionalString("posthog.apiKey", true),
505
+ repoPath: optionalString("posthog.repoPath", true),
506
+ projects: z.union([z.literal("all"), z.array(z.number({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).int({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).positive({ error: "posthog.projects must be \"all\" or an array of positive integer project ids" }), { error: "posthog.projects must be \"all\" or an array of positive integer project ids" })], { error: "posthog.projects must be \"all\" or an array of positive integer project ids" }).optional(),
507
+ projectMap: z.record(z.string(), z.unknown(), { error: "posthog.projectMap must be an object" }).optional(),
508
+ ...Object.fromEntries(Object.entries(posthogNumberRanges).map(([key, range]) => [key, Object.hasOwn(POSTHOG_WHOLE_NUMBER_ROUNDING, key) ? optionalWholeNumber(`posthog.${key}`, range) : optionalNumber(`posthog.${key}`, range)]))
509
+ });
510
+ var usageCostModeMessage = `usage.costMode must be one of ${USAGE_COST_MODES.join(", ")}`;
511
+ var usageVendorShape = Object.fromEntries(USAGE_VENDOR_KEYS.map((key) => [key, optionalBoolean(`usage.vendors.${key}`)]));
512
+ var usageBudgetShape = Object.fromEntries(USAGE_BUDGET_KEYS.map((key) => [key, z.number({ error: `usage.budget.${key} must be a positive number or null` }).positive({ error: `usage.budget.${key} must be a positive number or null` }).nullable().optional()]));
513
+ var createUsageSettings = (isAbsolutePath) => optionalObject("usage", {
514
+ enabled: optionalBoolean("usage.enabled"),
515
+ fetchPricing: optionalBoolean("usage.fetchPricing"),
516
+ planLimits: optionalBoolean("usage.planLimits"),
517
+ rtkSavings: optionalBoolean("usage.rtkSavings"),
518
+ scanIntervalMinutes: optionalInteger("usage.scanIntervalMinutes", USAGE_INTEGER_RANGES.scanIntervalMinutes),
519
+ retainDays: optionalInteger("usage.retainDays", USAGE_INTEGER_RANGES.retainDays),
520
+ warehouseRetainDays: optionalInteger("usage.warehouseRetainDays", USAGE_INTEGER_RANGES.warehouseRetainDays),
521
+ sessionBlockHours: optionalInteger("usage.sessionBlockHours", USAGE_INTEGER_RANGES.sessionBlockHours),
522
+ costMode: z.enum(USAGE_COST_MODES, { error: usageCostModeMessage }).optional(),
523
+ vendors: optionalObject("usage.vendors", usageVendorShape),
524
+ budget: optionalObject("usage.budget", usageBudgetShape),
525
+ extraProjectsDirs: z.array(z.string({ error: "usage.extraProjectsDirs must be an array of absolute paths" }), { error: "usage.extraProjectsDirs must be an array of absolute paths" }).transform((directories) => directories.map((directory) => directory.trim())).refine((directories) => directories.every((directory) => directory && isAbsolutePath(directory)), { message: "usage.extraProjectsDirs entries must be absolute paths" }).optional()
526
+ });
527
+ var TelegramSettings = optionalObject("telegram", {
528
+ botToken: optionalString("telegram.botToken", true),
529
+ chatId: optionalString("telegram.chatId", true)
530
+ });
531
+ var IngestSettings = z.object({ enabled: optionalBoolean("ingest.enabled") }, { error: "ingest must be an object" }).passthrough().optional();
532
+ var TraceSettings = z.object({ enabled: optionalBoolean("trace.enabled") }, { error: "trace must be an object" }).optional();
533
+ var PlanReviewSettings = z.object({ enabled: optionalBoolean("planReview.enabled") }, { error: "planReview must be an object" }).optional();
534
+ var optionalPathList = (field) => z.array(z.string({ error: `${field} must be an array of paths` }).trim().min(1, { error: `${field} must be an array of paths` }), { error: `${field} must be an array of paths` }).optional();
535
+ var guardrailsShape = {
536
+ unguardedRepos: optionalPathList("guardrails.unguardedRepos"),
537
+ blockedPaths: optionalPathList("guardrails.blockedPaths"),
538
+ unreadablePaths: optionalPathList("guardrails.unreadablePaths")
539
+ };
540
+ var isHomeRelativePath = (entry) => entry === "~" || entry.startsWith("~/") || entry.startsWith("~\\");
541
+ var createGuardrailsSettings = (isAbsolutePath) => z.object({
542
+ ...guardrailsShape,
543
+ blockedPaths: z.array(z.string({ error: "guardrails.blockedPaths must be an array of paths" }).trim().min(1, { error: "guardrails.blockedPaths must be an array of paths" }).refine((entry) => isHomeRelativePath(entry) || isAbsolutePath(entry), { message: "guardrails.blockedPaths entries must be absolute paths or start with ~/" }), { error: "guardrails.blockedPaths must be an array of paths" }).optional()
544
+ }, { error: "guardrails must be an object" }).strict().optional();
545
+ var GuardrailsFileSettings = z.object(guardrailsShape, { error: "guardrails must be an object" }).passthrough().optional();
546
+ var telemetryShape = { enabled: optionalBoolean("telemetry.enabled") };
547
+ var TelemetrySettings = z.object(telemetryShape, { error: "telemetry must be an object" }).strict().optional();
548
+ var TelemetryFileSettings = z.object(telemetryShape, { error: "telemetry must be an object" }).passthrough().optional();
549
+ var createBrowserConfigShape = (isAbsolutePath) => ({
550
+ port: z.number().int().min(PORT_RANGE.min).max(PORT_RANGE.max).optional(),
551
+ notifyDebounceMs: z.number().finite().nonnegative().optional(),
552
+ phoneEscalationMs: z.number().finite().nonnegative().optional(),
553
+ replayBufferKB: optionalWholeNumber("replayBufferKB", REPLAY_BUFFER_KB_RANGE),
554
+ sessionMemoryReserveMB: optionalWholeNumber("sessionMemoryReserveMB", MEMORY_RESERVE_MB_RANGE),
555
+ cursorBlink: optionalBoolean("cursorBlink"),
556
+ debugMode: optionalBoolean("debugMode"),
557
+ conversationView: optionalBoolean("conversationView"),
558
+ streamerMode: optionalBoolean("streamerMode"),
559
+ detectBackgroundAgents: optionalBoolean("detectBackgroundAgents"),
560
+ recordSignals: optionalBoolean("recordSignals"),
561
+ rtk: optionalBoolean("rtk"),
562
+ saneYolo: optionalBoolean("saneYolo"),
563
+ skipPermissionsByDefault: optionalBoolean("skipPermissionsByDefault"),
564
+ checkForUpdates: optionalBoolean("checkForUpdates"),
565
+ updateChannel: z.enum(UPDATE_CHANNELS, { error: "updateChannel must be one of release, main" }).optional(),
566
+ autoResume: optionalBoolean("autoResume"),
567
+ telegramNotifications: optionalBoolean("telegramNotifications"),
568
+ integrationBranch: optionalString("integrationBranch").nullable(),
569
+ worktreeRoot: optionalString("worktreeRoot"),
570
+ worktreeShare: z.array(z.string()).optional(),
571
+ repoRoots: z.array(z.string()).optional(),
572
+ changeMap: ChangeMapSettings,
573
+ taskTitle: TaskTitleSettings,
574
+ branchGc: BranchGcSettings,
575
+ postTurnChecks: PostTurnChecksSettings,
576
+ visions: VisionsSettings,
577
+ github: GithubSettings,
578
+ teamReview: TeamReviewSettings,
579
+ benchmarks: BenchmarksSettings,
580
+ coherence: CoherenceSettings,
581
+ posthog: PosthogSettings,
582
+ usage: createUsageSettings(isAbsolutePath),
583
+ telegram: TelegramSettings,
584
+ ingest: IngestSettings,
585
+ guardrails: createGuardrailsSettings(isAbsolutePath),
586
+ telemetry: TelemetrySettings,
587
+ workflows: WorkflowsSettings.nullable().optional()
588
+ });
589
+ var createBrowserConfig = (isAbsolutePath) => z.object(createBrowserConfigShape(isAbsolutePath));
590
+ //#endregion
591
+ //#region shared/contracts/config.ts
592
+ var BrowserConfig = createBrowserConfig(path.isAbsolute);
593
+ var BROWSER_CONFIG_SHAPE = BrowserConfig.shape;
594
+ var ConfigUpdate = z.object({
595
+ ...BROWSER_CONFIG_SHAPE,
596
+ notifyDebounceMs: z.number({ error: "notifyDebounceMs must be a positive number" }).finite().positive({ error: "notifyDebounceMs must be a positive number" }).optional(),
597
+ phoneEscalationMs: z.number({ error: "phoneEscalationMs must be a positive number" }).finite().positive({ error: "phoneEscalationMs must be a positive number" }).optional(),
598
+ branchGc: BranchGcControlSettings,
599
+ worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
600
+ worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
601
+ worktreeRerere: optionalBoolean("worktreeRerere"),
602
+ workflows: WorkflowsSettingsUpdate.optional()
603
+ }).omit({
604
+ port: true,
605
+ worktreeShare: true
606
+ }).strict();
607
+ var AGENT_ID_RE = /^[a-z][a-z0-9-]{1,31}$/;
608
+ var BUILTIN_AGENT_IDS = Object.freeze([
609
+ "claude-code",
610
+ "codex",
611
+ "grok"
612
+ ]);
613
+ var AGENT_ID_SHAPE_MESSAGE = "an agent id of 2 to 32 characters of lowercase letters, digits and dashes, starting with a letter";
614
+ var AGENT_COMMAND_BASENAME_RE = /^[A-Za-z0-9._+-]+$/;
615
+ var AGENT_COMMAND_ABSOLUTE_RE = /^(?:\/|[A-Za-z]:[\\/])[A-Za-z0-9._+\-\\/]*[A-Za-z0-9._+-]$/;
616
+ var AGENT_COMMAND_SHAPE_MESSAGE = "a bare command name or an absolute path, built only from letters, digits, dot, underscore, plus, dash and path separators";
617
+ function isSpawnableCommand(command) {
618
+ if (AGENT_COMMAND_BASENAME_RE.test(command)) return true;
619
+ return AGENT_COMMAND_ABSOLUTE_RE.test(command);
620
+ }
621
+ var GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE = /[~^:?*[\\]/;
622
+ var GIT_BRANCH_FORBIDDEN_SEQUENCES = [
623
+ "..",
624
+ "@{",
625
+ "//"
626
+ ];
627
+ function isControlOrSpaceCharacter(character) {
628
+ const codePoint = character.charCodeAt(0);
629
+ return codePoint <= 32 || codePoint === 127;
630
+ }
631
+ function isGitBranchName(name) {
632
+ if (name === "" || name === "@" || name === "HEAD") return false;
633
+ if (name.startsWith("-") || name.startsWith("/") || name.endsWith("/") || name.endsWith(".")) return false;
634
+ if (GIT_BRANCH_FORBIDDEN_SEQUENCES.some((sequence) => name.includes(sequence))) return false;
635
+ if (GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE.test(name) || [...name].some(isControlOrSpaceCharacter)) return false;
636
+ return name.split("/").every((component) => !component.startsWith(".") && !component.endsWith(".lock"));
637
+ }
638
+ var CustomAgentDeclaration = z.object({
639
+ id: z.string({ error: "customAgents[].id must be a string" }).regex(AGENT_ID_RE, { error: `customAgents[].id must be ${AGENT_ID_SHAPE_MESSAGE}` }),
640
+ label: z.string({ error: "customAgents[].label must be a string" }).min(1, { error: "customAgents[].label must not be empty" }).max(60, { error: "customAgents[].label must be at most 60 characters" }),
641
+ command: z.string({ error: "customAgents[].command must be a string" }).min(1, { error: "customAgents[].command must not be empty" }).refine((command) => command.trim().length > 0, { error: "customAgents[].command must not be blank" }).refine(isSpawnableCommand, { error: `customAgents[].command must be ${AGENT_COMMAND_SHAPE_MESSAGE}` }),
642
+ args: z.array(z.string({ error: "customAgents[].args must be an array of strings" }), { error: "customAgents[].args must be an array of strings" }).default([]),
643
+ idleTitle: z.string({ error: "customAgents[].idleTitle must be a string" }).optional(),
644
+ busyTitle: z.string({ error: "customAgents[].busyTitle must be a string" }).optional()
645
+ }).strict();
646
+ var CustomAgentDeclarations = z.array(CustomAgentDeclaration, { error: "customAgents must be an array" }).superRefine((declarations, ctx) => {
647
+ const claimedIds = new Set(BUILTIN_AGENT_IDS);
648
+ for (const [index, declaration] of declarations.entries()) {
649
+ if (!claimedIds.has(declaration.id)) {
650
+ claimedIds.add(declaration.id);
651
+ continue;
652
+ }
653
+ const message = BUILTIN_AGENT_IDS.some((builtinAgentId) => builtinAgentId === declaration.id) ? `customAgents[${index}].id "${declaration.id}" collides with the builtin agent of the same id` : `customAgents[${index}].id "${declaration.id}" is declared more than once`;
654
+ ctx.addIssue({
655
+ code: "custom",
656
+ path: [index, "id"],
657
+ message
658
+ });
659
+ }
660
+ });
661
+ var TaskTitleSources = z.object({
662
+ customTitle: TaskTitle.nullable().optional(),
663
+ pendingPromptTitle: TaskTitle.nullable().optional(),
664
+ refinedTitle: TaskTitle.nullable().optional(),
665
+ aiTitle: TaskTitle.nullable().optional(),
666
+ oscTitle: TaskTitle.nullable().optional(),
667
+ promptTitle: TaskTitle.nullable().optional()
668
+ }).strict();
669
+ var TASK_TITLE_SOURCE_PRIORITY = [
670
+ "customTitle",
671
+ "pendingPromptTitle",
672
+ "refinedTitle",
673
+ "aiTitle",
674
+ "oscTitle",
675
+ "promptTitle"
676
+ ];
677
+ var PersistedTaskTitle = z.object({
678
+ taskTitle: TaskTitle.min(1),
679
+ isCustom: z.boolean(),
680
+ sources: TaskTitleSources
681
+ }).strict().refine(({ taskTitle, isCustom, sources }) => {
682
+ const source = TASK_TITLE_SOURCE_PRIORITY.find((candidate) => sources[candidate]?.trim());
683
+ if (!source) return false;
684
+ return sources[source]?.replace(/\s+/g, " ").trim() === taskTitle && isCustom === (source === "customTitle");
685
+ });
686
+ var ProjectConfig = z.object({
687
+ id: z.string().optional(),
688
+ name: z.string().optional(),
689
+ customTitle: TaskTitle.optional(),
690
+ taskTitleState: PersistedTaskTitle.optional().catch(void 0),
691
+ prLinks: SessionPrLinks.optional().catch(void 0),
692
+ path: z.string(),
693
+ repos: z.array(z.string()).min(2).optional(),
694
+ baseBranch: z.string().refine(isGitBranchName, { error: "projects[].baseBranch must be a git branch name" }).optional(),
695
+ agent: z.string({ error: "projects[].agent must be a string" }).regex(AGENT_ID_RE, { error: `projects[].agent must be ${AGENT_ID_SHAPE_MESSAGE}` }).optional(),
696
+ codexBypassHookTrust: z.boolean().optional(),
697
+ conversationView: z.boolean({ error: "projects[].conversationView must be a boolean" }).optional(),
698
+ dangerouslySkipPermissions: z.boolean({ error: "projects[].dangerouslySkipPermissions must be a boolean" }).optional(),
699
+ unguarded: z.boolean({ error: "projects[].unguarded must be a boolean" }).optional()
700
+ }).passthrough();
701
+ var FILE_CONFIG_SHAPE = {
702
+ ...BROWSER_CONFIG_SHAPE,
703
+ changeMap: ChangeMapSettings,
704
+ branchGc: optionalLooseObject("branchGc"),
705
+ coder: z.object({ appSlug: z.string().optional() }).loose().optional(),
706
+ visions: optionalLooseObject("visions"),
707
+ github: GithubSettings,
708
+ teamReview: optionalLooseObject("teamReview"),
709
+ benchmarks: optionalLooseObject("benchmarks"),
710
+ coherence: optionalLooseObject("coherence"),
711
+ posthog: optionalLooseObject("posthog"),
712
+ usage: optionalLooseObject("usage"),
713
+ telegram: optionalLooseObject("telegram"),
714
+ ingest: optionalLooseObject("ingest"),
715
+ workflows: optionalLooseObject("workflows"),
716
+ guardrails: GuardrailsFileSettings,
717
+ telemetry: TelemetryFileSettings,
718
+ trace: TraceSettings,
719
+ planReview: PlanReviewSettings,
720
+ customAgents: CustomAgentDeclarations.optional()
721
+ };
722
+ var Config = z.object({
723
+ ...FILE_CONFIG_SHAPE,
724
+ detectScheduledWakeups: optionalBoolean("detectScheduledWakeups"),
725
+ worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
726
+ worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
727
+ worktreeRerere: optionalBoolean("worktreeRerere"),
728
+ postTurnChecks: z.record(z.string(), z.unknown()).optional(),
729
+ hooks: z.unknown().optional(),
730
+ remote: z.object({
731
+ enabled: z.boolean().optional(),
732
+ port: z.number().int().min(1).max(65535).nullable().optional(),
733
+ publicHost: z.string().optional(),
734
+ allowedOrigins: z.array(z.string()).optional(),
735
+ ownerLogin: z.string().optional()
736
+ }).passthrough().optional(),
737
+ projects: z.array(ProjectConfig)
738
+ }).passthrough().superRefine((config, ctx) => {
739
+ if (!Array.isArray(config.projects)) return;
740
+ const declaredAgentIds = new Set(BUILTIN_AGENT_IDS);
741
+ for (const declaration of config.customAgents ?? []) declaredAgentIds.add(declaration.id);
742
+ for (const [index, project] of config.projects.entries()) {
743
+ const agent = project?.agent;
744
+ if (typeof agent !== "string" || !AGENT_ID_RE.test(agent)) continue;
745
+ if (declaredAgentIds.has(agent)) continue;
746
+ ctx.addIssue({
747
+ code: "custom",
748
+ path: [
749
+ "projects",
750
+ index,
751
+ "agent"
752
+ ],
753
+ message: `projects[${index}].agent "${agent}" names no known agent; declare it under customAgents or use one of ${[...declaredAgentIds].join(", ")}`
754
+ });
755
+ }
756
+ });
757
+ var CONFIG_BLOCK_KEYS = Object.freeze([
758
+ "changeMap",
759
+ "taskTitle",
760
+ "branchGc",
761
+ "postTurnChecks",
762
+ "visions",
763
+ "github",
764
+ "teamReview",
765
+ "benchmarks",
766
+ "coherence",
767
+ "posthog",
768
+ "usage",
769
+ "telegram",
770
+ "ingest",
771
+ "guardrails",
772
+ "telemetry",
773
+ "workflows",
774
+ "coder"
775
+ ]);
776
+ var CONFIG_SCALAR_KEYS = Object.freeze(Object.keys(BROWSER_CONFIG_SHAPE).filter((key) => {
777
+ if (CONFIG_BLOCK_KEYS.includes(key)) return false;
778
+ return key !== "port" && key !== "repoRoots" && key !== "worktreeShare";
779
+ }));
780
+ var RUNTIME_CONFIG_SCALAR_KEYS = Object.freeze([
781
+ ...CONFIG_SCALAR_KEYS,
782
+ "worktreeAutoRebase",
783
+ "worktreeSyncOnStart",
784
+ "worktreeRerere"
785
+ ]);
786
+ Object.freeze([
787
+ "detectScheduledWakeups",
788
+ "worktreeAutoRebase",
789
+ "worktreeSyncOnStart",
790
+ "worktreeRerere",
791
+ "hooks",
792
+ "remote",
793
+ "projects"
794
+ ]);
795
+ function configIssueMessage(error) {
796
+ return error.issues[0]?.message || "settings are invalid";
797
+ }
147
798
  //#endregion
148
799
  //#region shared/contracts/telemetry.ts
149
800
  var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
@@ -198,21 +849,13 @@ var AiGenerationProperties = z.object({
198
849
  $ai_total_cost_usd: z.number().finite().nonnegative().optional(),
199
850
  agent_adapter: z.enum(TELEMETRY_ADAPTERS)
200
851
  }).strict();
201
- var FactoryDecisionProperties = z.object({
202
- kind: FactoryDecisionKind,
203
- outcome: FactoryDecisionOutcome,
204
- failure_class: FactoryDecisionFailureClass.nullable(),
205
- duration_ms: nonNegativeInteger.nullable(),
206
- attempt: nonNegativeInteger.nullable()
207
- }).strict();
208
852
  var TELEMETRY_EVENT_SCHEMAS = Object.freeze({
209
853
  app_started: AppStartedProperties,
210
854
  app_active: AppActiveProperties,
211
855
  session_started: SessionStartedProperties,
212
856
  session_ended: SessionEndedProperties,
213
857
  $exception: ExceptionProperties,
214
- $ai_generation: AiGenerationProperties,
215
- factory_decision: FactoryDecisionProperties
858
+ $ai_generation: AiGenerationProperties
216
859
  });
217
860
  Object.freeze([
218
861
  {
@@ -238,10 +881,6 @@ Object.freeze([
238
881
  {
239
882
  name: "$ai_generation",
240
883
  description: "Per agent session and model, after each usage scan, for usage recorded in the last 24 hours: token counts, the model name and estimated cost, under a one-way hash of the session. A model name outside the shipped pricing table is sent as unknown. No prompts or output."
241
- },
242
- {
243
- name: "factory_decision",
244
- description: "Each time the factory decides something (a dispatch, a close-out attempt, a merge, a watch or verification result, an exception, a landing, a Claude Code folder trust grant): which kind of decision, how it came out, the class of failure when it failed, how long it took and which attempt it was. Never the objective, the reason, check output, a path or a repository name."
245
884
  }
246
885
  ]);
247
886
  Object.freeze([
@@ -646,6 +1285,148 @@ var ChangeMap = z.strictObject({
646
1285
  narratorState: NarratorState,
647
1286
  error: z.string().min(1).optional()
648
1287
  });
1288
+ var CoherenceJournalKind = z.enum([
1289
+ "decision",
1290
+ "retraction",
1291
+ "conjecture",
1292
+ "resolution",
1293
+ "dismissal",
1294
+ "defect",
1295
+ "experiment",
1296
+ "close",
1297
+ "unable",
1298
+ "escalation",
1299
+ "acknowledgement",
1300
+ "enactment"
1301
+ ]);
1302
+ var recordHead = {
1303
+ id: z.string().min(1),
1304
+ at: z.iso.datetime(),
1305
+ session: z.string(),
1306
+ agent: z.string(),
1307
+ commit: z.string().nullable(),
1308
+ dirty: z.boolean(),
1309
+ binding: z.string()
1310
+ };
1311
+ var reference = {
1312
+ of: z.string().min(1),
1313
+ because: z.string()
1314
+ };
1315
+ var step = z.looseObject({
1316
+ id: z.string(),
1317
+ text: z.string()
1318
+ });
1319
+ var KnownJournalRecord = z.discriminatedUnion("kind", [
1320
+ z.looseObject({
1321
+ ...recordHead,
1322
+ kind: z.literal("decision"),
1323
+ chose: z.string(),
1324
+ over: z.array(z.string()),
1325
+ because: z.string()
1326
+ }),
1327
+ z.looseObject({
1328
+ ...recordHead,
1329
+ kind: z.literal("retraction"),
1330
+ ...reference
1331
+ }),
1332
+ z.looseObject({
1333
+ ...recordHead,
1334
+ kind: z.literal("conjecture"),
1335
+ observation: z.string(),
1336
+ couldBe: z.array(z.string()),
1337
+ discriminatedBy: z.string()
1338
+ }),
1339
+ z.looseObject({
1340
+ ...recordHead,
1341
+ kind: z.literal("resolution"),
1342
+ ...reference,
1343
+ as: z.string().optional()
1344
+ }),
1345
+ z.looseObject({
1346
+ ...recordHead,
1347
+ kind: z.literal("dismissal"),
1348
+ ...reference
1349
+ }),
1350
+ z.looseObject({
1351
+ ...recordHead,
1352
+ kind: z.literal("defect"),
1353
+ what: z.string(),
1354
+ evidence: z.string(),
1355
+ files: z.array(z.string())
1356
+ }),
1357
+ z.looseObject({
1358
+ ...recordHead,
1359
+ kind: z.literal("experiment"),
1360
+ expectation: z.string(),
1361
+ context: z.array(z.string()),
1362
+ actions: z.array(step),
1363
+ criteria: z.array(step)
1364
+ }),
1365
+ z.looseObject({
1366
+ ...recordHead,
1367
+ kind: z.literal("close"),
1368
+ of: z.string(),
1369
+ outcome: z.enum([
1370
+ "success",
1371
+ "failure",
1372
+ "inconclusive"
1373
+ ]),
1374
+ results: z.record(z.string(), z.unknown())
1375
+ }),
1376
+ z.looseObject({
1377
+ ...recordHead,
1378
+ kind: z.literal("unable"),
1379
+ what: z.string(),
1380
+ because: z.string()
1381
+ }),
1382
+ z.looseObject({
1383
+ ...recordHead,
1384
+ kind: z.literal("escalation"),
1385
+ what: z.string(),
1386
+ because: z.string()
1387
+ }),
1388
+ z.looseObject({
1389
+ ...recordHead,
1390
+ kind: z.literal("acknowledgement"),
1391
+ ...reference
1392
+ }),
1393
+ z.looseObject({
1394
+ ...recordHead,
1395
+ kind: z.literal("enactment"),
1396
+ practice: z.string(),
1397
+ results: z.record(z.string(), z.unknown())
1398
+ })
1399
+ ]);
1400
+ var CoherenceJournalRecord = z.union([KnownJournalRecord, z.object({
1401
+ id: z.string().min(1),
1402
+ kind: z.string().min(1).refine((kind) => !CoherenceJournalKind.safeParse(kind).success)
1403
+ })]);
1404
+ var CoherenceJournalOutput = z.looseObject({
1405
+ branch: z.string().nullable(),
1406
+ escalations: z.array(z.unknown()),
1407
+ records: z.array(CoherenceJournalRecord),
1408
+ citedBy: z.record(z.string(), z.array(z.unknown())),
1409
+ damaged: z.array(z.unknown())
1410
+ });
1411
+ var CoherenceJournalEntry = z.strictObject({
1412
+ id: z.string().min(1),
1413
+ at: z.iso.datetime().nullable(),
1414
+ kind: z.string().min(1),
1415
+ text: z.string().max(280),
1416
+ detail: z.string().max(280).nullable(),
1417
+ supersedes: z.string().nullable()
1418
+ });
1419
+ var CoherenceJournalReading = z.discriminatedUnion("ok", [z.strictObject({
1420
+ ok: z.literal(true),
1421
+ latest: CoherenceJournalEntry.nullable()
1422
+ }), z.strictObject({
1423
+ ok: z.literal(false),
1424
+ reason: z.string().min(1).max(200)
1425
+ })]);
1426
+ var SessionCoherence = z.strictObject({
1427
+ journal: CoherenceJournalReading,
1428
+ updatedAt: z.number().finite()
1429
+ });
649
1430
  //#endregion
650
1431
  //#region shared/contracts/issues.ts
651
1432
  var IssueRepoSlug = z.string().regex(REPO_SLUG_RE);
@@ -974,6 +1755,26 @@ var TraceCheckpoint = z.object({
974
1755
  subagentOffsetByPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({})
975
1756
  });
976
1757
  //#endregion
1758
+ //#region shared/contracts/session-setup.ts
1759
+ var setupName = z.string().max(16384);
1760
+ var setupNames = z.array(setupName).max(4096);
1761
+ var SessionSetup = z.object({
1762
+ model: setupName.nullable(),
1763
+ mcpServers: setupNames,
1764
+ plugins: z.array(z.object({
1765
+ name: setupName,
1766
+ skills: setupNames,
1767
+ agents: setupNames
1768
+ })).max(4096),
1769
+ skills: setupNames,
1770
+ agents: setupNames,
1771
+ hookEvents: z.array(z.object({
1772
+ event: setupName,
1773
+ runCount: z.number().int().nonnegative()
1774
+ })).max(4096),
1775
+ hookCommands: z.array(z.string().max(65536)).max(4096)
1776
+ });
1777
+ //#endregion
977
1778
  //#region shared/contracts/update-journal.ts
978
1779
  var UpdateChannel = z.enum(["release", "main"]);
979
1780
  var UpdateRunState = z.enum([
@@ -1059,6 +1860,13 @@ z.object({
1059
1860
  args: z.array(z.string()),
1060
1861
  resolvable: z.boolean().nullable()
1061
1862
  }).strict();
1863
+ var TelegramDeliveryStatus = z.object({
1864
+ setupWarning: nullableString,
1865
+ lastFailure: z.object({
1866
+ message: z.string(),
1867
+ failedAt: timestamp
1868
+ }).nullable()
1869
+ });
1062
1870
  var SessionCardFields = z.object({
1063
1871
  id: sessionId,
1064
1872
  session: z.string(),
@@ -1073,6 +1881,7 @@ var SessionCardFields = z.object({
1073
1881
  worktree: z.boolean(),
1074
1882
  workspace: z.boolean().optional(),
1075
1883
  guarded: z.boolean().optional(),
1884
+ guardrailsReleased: z.boolean().optional(),
1076
1885
  resumeSessionId: nullableString,
1077
1886
  ephemeral: z.boolean().optional(),
1078
1887
  linkedPrs: z.array(LinkedPr).optional()
@@ -1153,7 +1962,9 @@ var clientVariants = [
1153
1962
  repos: z.array(z.string()).optional(),
1154
1963
  agent: z.string().optional(),
1155
1964
  dangerouslySkipPermissions: z.boolean().optional(),
1156
- unguarded: z.boolean().optional()
1965
+ unguarded: z.boolean().optional(),
1966
+ runInPlace: z.boolean().optional(),
1967
+ requestId
1157
1968
  }),
1158
1969
  loose("list-conversations", {
1159
1970
  id: sessionId,
@@ -1239,14 +2050,6 @@ var clientVariants = [
1239
2050
  message: "only discard may omit head",
1240
2051
  path: ["head"]
1241
2052
  }),
1242
- loose("factory-queue-intent", {
1243
- ...FactoryQueueIntentRequest.shape,
1244
- requestId
1245
- }),
1246
- loose("factory-control", {
1247
- ...FactoryControlRequest.shape,
1248
- requestId
1249
- }),
1250
2053
  loose("benchmark-action", {
1251
2054
  ...BenchmarkActionRequest.shape,
1252
2055
  requestId
@@ -1271,6 +2074,7 @@ var clientVariants = [
1271
2074
  id: z.unknown().optional(),
1272
2075
  requestId
1273
2076
  }),
2077
+ loose("telegram-test", { requestId }),
1274
2078
  loose("request-usage-report", {
1275
2079
  requestId,
1276
2080
  days: z.unknown().optional(),
@@ -1313,6 +2117,10 @@ var clientVariants = [
1313
2117
  id: sessionId,
1314
2118
  isOn: z.boolean()
1315
2119
  }),
2120
+ loose("set-session-guardrails", {
2121
+ id: sessionId,
2122
+ isOn: z.boolean()
2123
+ }),
1316
2124
  loose("conversation-approval", {
1317
2125
  id: sessionId,
1318
2126
  requestId: ConversationApproval.shape.requestId,
@@ -1331,6 +2139,14 @@ var clientVariants = [
1331
2139
  baseHash: z.string().min(1),
1332
2140
  requestId
1333
2141
  }),
2142
+ loose("session-coherence-journal", {
2143
+ id: sessionId,
2144
+ requestId
2145
+ }),
2146
+ loose("session-setup", {
2147
+ id: sessionId,
2148
+ requestId
2149
+ }),
1334
2150
  loose("client-error", ClientErrorReport.shape),
1335
2151
  loose("dismiss", {
1336
2152
  id: sessionId,
@@ -1344,6 +2160,7 @@ Object.freeze([
1344
2160
  "snapshot",
1345
2161
  "hooks-report",
1346
2162
  "save-hook-result",
2163
+ "add-session-result",
1347
2164
  "delete-hook-result",
1348
2165
  "workspace-repos",
1349
2166
  "set-workspace-repos-result",
@@ -1356,6 +2173,7 @@ Object.freeze([
1356
2173
  "session-prs",
1357
2174
  "session-modified",
1358
2175
  "session-git",
2176
+ "session-coherence-hooks",
1359
2177
  "session-agents",
1360
2178
  "session-wakeup",
1361
2179
  "session-prompt",
@@ -1381,6 +2199,10 @@ Object.freeze([
1381
2199
  "session-docs-snapshot",
1382
2200
  "session-doc-response",
1383
2201
  "session-doc-save-result",
2202
+ "session-coherence",
2203
+ "session-coherence-snapshot",
2204
+ "session-coherence-journal-response",
2205
+ "session-setup-response",
1384
2206
  "notify",
1385
2207
  "update-status",
1386
2208
  "update-progress",
@@ -1407,8 +2229,6 @@ Object.freeze([
1407
2229
  "radar-issue-action-result",
1408
2230
  "team-review-action-result",
1409
2231
  "benchmark-action-result",
1410
- "factory-queue-intent-result",
1411
- "factory-control-result",
1412
2232
  "my-pr-merge-result",
1413
2233
  "my-pr-keep-mergeable-result",
1414
2234
  "my-pr-merge-when-ready-result",
@@ -1416,7 +2236,6 @@ Object.freeze([
1416
2236
  "radar-archive-investigation-result",
1417
2237
  "team-review-status",
1418
2238
  "benchmark-status",
1419
- "factory-state",
1420
2239
  "my-prs-status",
1421
2240
  "issues-status",
1422
2241
  "usage-sessions",
@@ -1465,6 +2284,12 @@ var serverVariants = [
1465
2284
  error: optionalError,
1466
2285
  hook: opaqueObject.optional()
1467
2286
  }),
2287
+ loose("add-session-result", {
2288
+ requestId,
2289
+ ok: z.boolean(),
2290
+ error: optionalError,
2291
+ reason: z.enum(["not-git"]).optional()
2292
+ }),
1468
2293
  loose("delete-hook-result", {
1469
2294
  requestId,
1470
2295
  ok: z.boolean(),
@@ -1493,7 +2318,8 @@ var serverVariants = [
1493
2318
  event: z.string(),
1494
2319
  timestamp,
1495
2320
  skipPerms: z.boolean().optional(),
1496
- saneYolo: z.boolean().optional()
2321
+ saneYolo: z.boolean().optional(),
2322
+ failureReason: z.string().optional()
1497
2323
  }),
1498
2324
  loose("session-added", SessionCardFields.shape),
1499
2325
  loose("session-modified", SessionCardFields.shape),
@@ -1519,6 +2345,10 @@ var serverVariants = [
1519
2345
  id: sessionId,
1520
2346
  worktree: z.boolean()
1521
2347
  }),
2348
+ loose("session-coherence-hooks", {
2349
+ id: sessionId,
2350
+ coherenceHooks: CoherenceHooksState.nullable()
2351
+ }),
1522
2352
  loose("session-agents", {
1523
2353
  id: sessionId,
1524
2354
  activeAgents: z.number().int().nonnegative(),
@@ -1660,6 +2490,25 @@ var serverVariants = [
1660
2490
  conflict: z.boolean().optional(),
1661
2491
  error: optionalError
1662
2492
  }),
2493
+ loose("session-coherence", {
2494
+ id: sessionId,
2495
+ ...SessionCoherence.shape
2496
+ }),
2497
+ loose("session-coherence-snapshot", { sessions: z.record(z.string(), SessionCoherence) }),
2498
+ loose("session-coherence-journal-response", {
2499
+ requestId,
2500
+ id: sessionId,
2501
+ ok: z.boolean(),
2502
+ entries: z.array(CoherenceJournalEntry).max(200),
2503
+ error: optionalError
2504
+ }),
2505
+ loose("session-setup-response", {
2506
+ requestId,
2507
+ id: sessionId,
2508
+ ok: z.boolean(),
2509
+ setup: SessionSetup.optional(),
2510
+ error: optionalError
2511
+ }),
1663
2512
  loose("notify", {
1664
2513
  session: z.string(),
1665
2514
  category: z.string(),
@@ -1712,7 +2561,8 @@ var serverVariants = [
1712
2561
  root: z.string(),
1713
2562
  projects: z.array(openObject({
1714
2563
  name: z.string(),
1715
- path: z.string()
2564
+ path: z.string(),
2565
+ isGit: z.boolean().optional()
1716
2566
  }))
1717
2567
  })),
1718
2568
  suggestions: z.array(openObject({
@@ -1819,14 +2669,6 @@ var serverVariants = [
1819
2669
  ...TeamReviewActionResult.shape,
1820
2670
  requestId
1821
2671
  }),
1822
- loose("factory-queue-intent-result", {
1823
- ...FactoryQueueIntentResult.shape,
1824
- requestId
1825
- }),
1826
- loose("factory-control-result", {
1827
- ...FactoryControlResult.shape,
1828
- requestId
1829
- }),
1830
2672
  loose("benchmark-action-result", {
1831
2673
  ...BenchmarkActionResult.shape,
1832
2674
  requestId
@@ -1852,9 +2694,14 @@ var serverVariants = [
1852
2694
  ok: z.boolean(),
1853
2695
  error: optionalError
1854
2696
  }),
2697
+ loose("telegram-test-result", {
2698
+ requestId,
2699
+ ok: z.boolean(),
2700
+ error: optionalError,
2701
+ telegramDelivery: TelegramDeliveryStatus.nullable()
2702
+ }),
1855
2703
  TeamReviewStatus,
1856
2704
  BenchmarkStatus,
1857
- loose("factory-state", FactoryState.shape),
1858
2705
  MyPrsStatus,
1859
2706
  IssuesStatus,
1860
2707
  loose("usage-sessions", {
@@ -2015,4 +2862,4 @@ z.object({
2015
2862
  projects: z.array(z.string()).optional()
2016
2863
  }).passthrough();
2017
2864
  //#endregion
2018
- export { ChangeMap as A, MergedPrListing as B, GithubIssuePullRequestsRepository as C, IssuesSearchResponse as D, IssueUpdate as E, BenchmarkJudgement as F, TELEMETRY_EVENT_SCHEMAS as G, PrCheckoutCaseInput as H, BenchmarkRun as I, FACTORY_DECISION_OUTPUT_MAX_BYTES as J, TELEMETRY_KILL_SWITCH_FLAG as K, BenchmarkStatus as L, BenchmarkActionRequest as M, BenchmarkCase as N, IssuesState as O, BenchmarkId as P, BenchmarkSuite as R, planTitle as S, IssueKey as T, FeatureFlagsResponse as U, MinedPrReviewData as V, PendingCrashReport as W, FactoryDecisionLogLine as Y, PLAN_RESULT_HOOK_EVENT as _, parseDataClientMessage as a, PlanRevision as b, DIFF_ANNOTATION_NOTE_MAX_CHARS as c, MAX_RAW_LINE_CHARS as d, TraceCheckpoint as f, PLAN_HOOK_OUTPUT_MAX_CHARS as g, PLAN_HOOK_EVENT as h, parseDataAttachHistory as i, changeMapFactId as j, IssuesStatus as k, InstallFlavor as l, PLAN_BODY_CAP_BYTES as m, HookEnvelope as n, CONTROL_FRAME_MAX_BYTES as o, TraceRecord as p, TelemetryState as q, DEEP_HISTORY_SCROLLBACK_LINES as r, ClientMessage as s, HTTP_URL_RE as t, UpdateJournal as u, PLAN_TOOL_NAME as v, GithubIssueResponse as w, parseExitPlanModeHookPayload as x, PlanDecision as y, CommitComparison as z };
2865
+ export { Config as $, IssuesStatus as A, POSTHOG_TRAFFIC_MULTIPLIER_RANGE as At, BenchmarkSuite as B, planTitle as C, MEMORY_RESERVE_MB_RANGE as Ct, IssueUpdate as D, POSTHOG_FIX_TIMEOUT_RANGE as Dt, IssueKey as E, POSITIVE_NUMBER_RANGE as Et, BenchmarkCase as F, USAGE_RETAIN_DAYS_RANGE as Ft, FeatureFlagsResponse as G, MergedPrListing as H, BenchmarkId as I, USAGE_SCAN_INTERVAL_RANGE as It, TELEMETRY_KILL_SWITCH_FLAG as J, PendingCrashReport as K, BenchmarkJudgement as L, WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE as Lt, ChangeMap as M, TASK_TITLE_TIMEOUT_RANGE as Mt, changeMapFactId as N, USAGE_BUDGET_RANGE as Nt, IssuesSearchResponse as O, POSTHOG_TRAFFIC_BASELINE_RANGE as Ot, BenchmarkActionRequest as P, USAGE_INTEGER_RANGES as Pt, BrowserConfig as Q, BenchmarkRun as R, WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE as Rt, parseExitPlanModeHookPayload as S, KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE as St, GithubIssueResponse as T, PORT_RANGE as Tt, MinedPrReviewData as U, CommitComparison as V, PrCheckoutCaseInput as W, AGENT_ID_SHAPE_MESSAGE as X, TelemetryState as Y, BUILTIN_AGENT_IDS as Z, PLAN_HOOK_OUTPUT_MAX_CHARS as _, CHANGE_MAP_NARRATOR_TIMEOUT_RANGE as _t, parseDataClientMessage as a, BranchGcFileSettings as at, PlanDecision as b, FLYING_ANIMALS_GAP_RANGE as bt, DIFF_ANNOTATION_NOTE_MAX_CHARS as c, UPDATE_CHANNELS as ct, SessionSetup as d, WorkflowSearchNode as dt, ConfigUpdate as et, MAX_RAW_LINE_CHARS as f, WorkflowsSettings as ft, PLAN_HOOK_EVENT as g, normalizeLegacyConfigNumbers as gt, PLAN_BODY_CAP_BYTES as h, USAGE_VENDOR_KEYS as ht, parseDataAttachHistory as i, configIssueMessage as it, CoherenceJournalOutput as j, REPLAY_BUFFER_KB_RANGE as jt, IssuesState as k, POSTHOG_TRAFFIC_MIN_USERS_RANGE as kt, InstallFlavor as l, WorkflowCommentBody as lt, TraceRecord as m, USAGE_COST_MODES as mt, HookEnvelope as n, RUNTIME_CONFIG_SCALAR_KEYS as nt, CONTROL_FRAME_MAX_BYTES as o, CHANGE_MAP_NARRATOR_ENGINES as ot, TraceCheckpoint as p, WorkflowsState as pt, TELEMETRY_EVENT_SCHEMAS as q, DEEP_HISTORY_SCROLLBACK_LINES as r, TASK_TITLE_SOURCE_PRIORITY as rt, ClientMessage as s, POST_TURN_CHECK_MODES as st, HTTP_URL_RE as t, PersistedTaskTitle as tt, UpdateJournal as u, WorkflowLabelName as ut, PLAN_RESULT_HOOK_EVENT as v, FLYING_ANIMALS_DEFAULTS as vt, GithubIssuePullRequestsRepository as w, NON_NEGATIVE_NUMBER_RANGE as wt, PlanRevision as x, FLYING_ANIMALS_SCALE_RANGE as xt, PLAN_TOOL_NAME as y, FLYING_ANIMALS_DURATION_RANGE as yt, BenchmarkStatus as z };