glimmervoid 0.39.0 → 0.40.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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/glimmervoid.js +22 -25
  3. package/dist/chunks/{adapters-B9tP9MXC.js → adapters-B6tbX3Aj.js} +4 -3
  4. package/dist/chunks/{adapters-Buu6yI71.js → adapters-CXQfLoyj.js} +1 -1
  5. package/dist/chunks/agent-api-cli-BBech5lF.js +1 -0
  6. package/dist/chunks/{agent-api-cli-2_RwTTTJ.js → agent-api-cli-BNHJTmNW.js} +46 -17
  7. package/dist/chunks/agent-api-core-DDrJQEdE.js +304 -0
  8. package/dist/chunks/{agent-setup-cli-C1nFdgFg.js → agent-setup-cli-CeBBwKuL.js} +1 -1
  9. package/dist/chunks/config-store-BZpN2djp.js +1 -0
  10. package/dist/chunks/{config-store-n23JDU4E.js → config-store-DqMScSdg.js} +20 -1
  11. package/dist/chunks/contracts-CloExMlS.js +680 -0
  12. package/dist/chunks/{contracts-DYQW11de.js → control-messages-DpBaniJi.js} +1201 -1794
  13. package/dist/chunks/{git-version-DXozXVnb.js → git-version-CJQMfxtZ.js} +1 -1
  14. package/dist/chunks/{grok-DeGAXgZF.js → grok-BLzhApwT.js} +1 -1
  15. package/dist/chunks/{main-D4uwk-_M.js → main-DDU8IvFD.js} +26436 -24806
  16. package/dist/chunks/{pair-cli-D9DZBqk0.js → pair-cli-CsOVTQGJ.js} +2 -2
  17. package/dist/chunks/{remote-config-DiLwnzBq.js → remote-config-HlABuLTp.js} +1 -1
  18. package/dist/chunks/{session-D2EbiysG.js → session-BwB43SCa.js} +103 -43
  19. package/dist/chunks/{session-routes-BQAZzMKZ.js → session-routes-DNJzsckH.js} +23 -3
  20. package/dist/chunks/{settings-cli-DP4t-I9U.js → settings-cli-DkkbK-dj.js} +30 -156
  21. package/dist/chunks/settings-readout-core-DrXT4aWm.js +201 -0
  22. package/dist/chunks/{ssh-sign-cli-D2RIs-iN.js → ssh-sign-cli-CYeKRevK.js} +2 -2
  23. package/dist/client/assets/index-BK9jLR47.js +148 -0
  24. package/dist/client/assets/index-CU_uqJmi.css +2 -0
  25. package/dist/client/index.html +4 -3
  26. package/dist/server/index.js +1 -1
  27. package/package.json +2 -2
  28. package/dist/chunks/agent-api-cli-PfCov-qb.js +0 -1
  29. package/dist/chunks/agent-api-core-D2HLgBEe.js +0 -180
  30. package/dist/chunks/config-store-8Z9vkWvf.js +0 -1
  31. package/dist/client/assets/index-C0YUJwjz.css +0 -2
  32. package/dist/client/assets/index-w8lG-tk2.js +0 -148
@@ -1,1836 +1,1305 @@
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";
1
+ import { A as SessionSnapshot, Et as TeamReviewStatus, F as TaskTitle, G as MyPrMergeRequest, H as MyPrKeepMergeableResult, Ht as GithubPollingRefreshResult, I as LinkedPr, J as MyPrMergeWhenReadyRequest, K as MyPrMergeResult, L as MyPr, Lt as GH_SEGMENT, Mt as hasRequiredActionHead, St as TeamReviewActionResult, Ut as GithubPrsFreshness, V as MyPrKeepMergeableRequest, Vt as GithubPollingRefreshRequest, Wt as githubPollingShape, X as MyPrSearchNode, Y as MyPrMergeWhenReadyResult, _ as ConversationApproval, at as CommitSha, b as PendingWakeup, g as ConversationAnswers, h as CoherenceHooksState, it as repositoryName, j as SessionState, k as SessionDoc, lt as GithubReviewDecision, mt as ReviewChecksState, nt as SessionPrLinks, rt as pullRequestKeyFormat, tt as MyPrsStatus, v as ConversationApprovalDecision, w as SESSION_DOC_PATH_MAX_CHARS, xt as TeamReviewActionRequest, zt as REPO_SLUG_RE } from "./session-BwB43SCa.js";
4
2
  import { z } from "zod";
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"
3
+ //#region shared/contracts/issues.ts
4
+ var IssueRepoSlug = z.string().regex(REPO_SLUG_RE);
5
+ var IssueKey = z.string().regex(new RegExp(`${REPO_SLUG_RE.source.slice(0, -1)}#[1-9][0-9]*$`));
6
+ var IssuePullRequest = z.object({
7
+ number: z.number().int().positive(),
8
+ url: z.string().url(),
9
+ title: z.string(),
10
+ state: z.enum([
11
+ "open",
12
+ "draft",
13
+ "merged",
14
+ "closed"
15
+ ])
14
16
  });
15
- var FLYING_ANIMALS_GAP_RANGE = Object.freeze({
16
- min: 0,
17
- max: 300
17
+ var GithubIssuePullRequestsRepository = z.object({ issue: z.object({ closedByPullRequestsReferences: z.object({ nodes: z.array(z.object({
18
+ number: IssuePullRequest.shape.number,
19
+ url: IssuePullRequest.shape.url,
20
+ title: IssuePullRequest.shape.title,
21
+ state: z.enum([
22
+ "OPEN",
23
+ "MERGED",
24
+ "CLOSED"
25
+ ]),
26
+ isDraft: z.boolean()
27
+ }).nullable()).max(5) }) }).nullable() });
28
+ function issuePullRequestStateFromGithub({ state, isDraft }) {
29
+ if (state === "OPEN") return isDraft ? "draft" : "open";
30
+ if (state === "MERGED") return "merged";
31
+ return "closed";
32
+ }
33
+ var issueFields = {
34
+ key: z.string(),
35
+ repo: IssueRepoSlug,
36
+ number: z.number().int().positive(),
37
+ title: z.string(),
38
+ url: z.string().url(),
39
+ labels: z.array(z.string()),
40
+ assignees: z.array(z.string()),
41
+ author: z.string(),
42
+ comments: z.number().int().nonnegative(),
43
+ createdAt: z.iso.datetime(),
44
+ updatedAt: z.iso.datetime()
45
+ };
46
+ var IssueSource = z.enum([
47
+ "project",
48
+ "me",
49
+ "team"
50
+ ]);
51
+ var cachedIssueFields = {
52
+ ...issueFields,
53
+ sources: z.array(IssueSource).nonempty().refine((sources) => new Set(sources).size === sources.length),
54
+ teams: z.array(IssueRepoSlug),
55
+ projectId: z.string().nullable(),
56
+ pullRequests: z.array(IssuePullRequest).max(5).default([])
57
+ };
58
+ var CachedIssueRow = z.object(cachedIssueFields).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
59
+ var IssueRow = z.object({
60
+ ...cachedIssueFields,
61
+ sessionId: z.string().nullable().default(null)
62
+ }).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
63
+ var IssueUpdate = z.object({
64
+ ...issueFields,
65
+ state: z.enum(["open", "closed"])
18
66
  });
19
- var FLYING_ANIMALS_DURATION_RANGE = Object.freeze({
20
- min: 1,
21
- max: 60
67
+ var GithubIssueResponse = z.object({
68
+ number: issueFields.number,
69
+ title: issueFields.title,
70
+ html_url: issueFields.url,
71
+ state: z.enum(["open", "closed"]),
72
+ labels: z.array(z.union([z.string(), z.object({ name: z.string() })])),
73
+ assignees: z.array(z.object({ login: z.string() })),
74
+ user: z.object({ login: z.string() }).nullable(),
75
+ comments: issueFields.comments,
76
+ created_at: issueFields.createdAt,
77
+ updated_at: issueFields.updatedAt,
78
+ repository_url: z.string().url().optional(),
79
+ pull_request: z.unknown().optional()
22
80
  });
23
- var FLYING_ANIMALS_SCALE_RANGE = Object.freeze({
24
- min: .5,
25
- max: 2
81
+ var IssuesSearchResponse = z.object({
82
+ items: z.array(z.unknown()),
83
+ total_count: z.number().int().nonnegative(),
84
+ incomplete_results: z.boolean()
26
85
  });
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
86
+ z.object({
87
+ ok: z.boolean(),
88
+ items: z.array(IssueUpdate),
89
+ isComplete: z.boolean(),
90
+ error: z.string()
34
91
  });
35
- var REPLAY_BUFFER_KB_RANGE = Object.freeze({
36
- min: 64,
37
- max: 16384
92
+ var IssuesState = z.object({
93
+ issues: z.array(CachedIssueRow),
94
+ lastSyncAt: z.number().finite().nonnegative().nullable(),
95
+ perRepoSync: z.record(IssueRepoSlug, z.object({
96
+ lastSyncAt: z.number().finite().nonnegative().nullable(),
97
+ ticks: z.number().int().nonnegative(),
98
+ needsFullReconcile: z.boolean()
99
+ })),
100
+ sessionLinks: z.record(IssueKey, z.string()).default({}),
101
+ pullRequestsFetchedAt: z.record(IssueKey, z.iso.datetime()).default({})
38
102
  });
39
- var MEMORY_RESERVE_MB_RANGE = Object.freeze({
40
- min: 0,
41
- max: 65536
103
+ var IssuesStatus = z.object({
104
+ type: z.literal("issues-status"),
105
+ ts: z.number().finite(),
106
+ configured: z.boolean(),
107
+ reason: z.string().nullable(),
108
+ lastSyncAt: z.number().finite().nonnegative().nullable(),
109
+ issues: z.array(IssueRow),
110
+ ...githubPollingShape
111
+ }).passthrough();
112
+ var PLAN_FEEDBACK_MAX_CHARS = 2e4;
113
+ var PLAN_COMMENT_MAX_CHARS = 4e3;
114
+ var PLAN_BODY_CAP_BYTES = 524288;
115
+ var PLAN_HOOK_OUTPUT_MAX_CHARS = 1e4;
116
+ var PLAN_HOOK_EVENT = "permissionrequest-plan";
117
+ var PLAN_RESULT_HOOK_EVENT = "posttooluse-plan";
118
+ var PLAN_TOOL_NAME = "ExitPlanMode";
119
+ var HEADING_SCAN_MAX_CHARS = 4096;
120
+ var ATX_HEADING = /^ {0,3}(#{1,6})[ \t]+(.*)$/;
121
+ function capPlanTitle(text) {
122
+ const trimmed = text.trim();
123
+ if (trimmed.length <= 120) return trimmed;
124
+ return trimmed.slice(0, 120);
125
+ }
126
+ function withoutClosingHeadingMarks(text) {
127
+ const trimmed = text.trimEnd();
128
+ let textEnd = trimmed.length;
129
+ while (textEnd > 0 && trimmed[textEnd - 1] === "#") textEnd--;
130
+ if (textEnd === trimmed.length || textEnd === 0) return trimmed;
131
+ const charBeforeMarks = trimmed[textEnd - 1];
132
+ if (charBeforeMarks !== " " && charBeforeMarks !== " ") return trimmed;
133
+ return trimmed.slice(0, textEnd).trimEnd();
134
+ }
135
+ function parseAtxHeading(line, { overlongLine }) {
136
+ if (overlongLine === "reject" && line.length > 4096) return null;
137
+ const heading = ATX_HEADING.exec(line.slice(0, HEADING_SCAN_MAX_CHARS));
138
+ if (!heading) return null;
139
+ return {
140
+ level: heading[1].length,
141
+ text: withoutClosingHeadingMarks(heading[2])
142
+ };
143
+ }
144
+ function headingTitle(line) {
145
+ return parseAtxHeading(line, { overlongLine: "truncate" })?.text ?? "";
146
+ }
147
+ function planTitle(plan) {
148
+ const lines = typeof plan === "string" ? plan.split(/\r?\n/) : [];
149
+ for (const line of lines) {
150
+ const title = headingTitle(line);
151
+ if (title.length > 0) return capPlanTitle(title);
152
+ }
153
+ return capPlanTitle(lines.find((line) => line.trim().length > 0) ?? "");
154
+ }
155
+ var ExitPlanModeInput = z.object({
156
+ plan: z.string().min(1),
157
+ planFilePath: z.string().min(1),
158
+ agent_id: z.string().min(1).optional(),
159
+ agent_type: z.string().min(1).optional()
160
+ }).passthrough();
161
+ var ExitPlanModeHookPayload = z.object({
162
+ tool_name: z.literal(PLAN_TOOL_NAME),
163
+ tool_input: ExitPlanModeInput,
164
+ agent_id: z.string().min(1).optional(),
165
+ agent_type: z.string().min(1).optional()
166
+ }).passthrough();
167
+ var ExitPlanModeRequest = z.object({
168
+ plan: z.string(),
169
+ planFilePath: z.string(),
170
+ agentId: z.string().nullable(),
171
+ agentType: z.string().nullable()
42
172
  });
43
- var PORT_RANGE = Object.freeze({
44
- min: 0,
45
- max: 65535
173
+ function parseExitPlanModeHookPayload(body) {
174
+ const parsed = ExitPlanModeHookPayload.safeParse(body);
175
+ if (!parsed.success) return null;
176
+ const input = parsed.data.tool_input;
177
+ return {
178
+ plan: input.plan,
179
+ planFilePath: input.planFilePath,
180
+ agentId: parsed.data.agent_id ?? input.agent_id ?? null,
181
+ agentType: parsed.data.agent_type ?? input.agent_type ?? null
182
+ };
183
+ }
184
+ var PlanRevision = ExitPlanModeRequest.extend({
185
+ sessionId: z.string().min(1),
186
+ revision: z.number().int().positive(),
187
+ receivedAt: z.number().finite()
46
188
  });
47
- var TASK_TITLE_TIMEOUT_RANGE = Object.freeze({
48
- min: 0,
49
- exclusiveMin: true,
50
- max: 2147483647 / 1e3
189
+ var PLAN_REVIEW_STATE_VALUES = Object.freeze([
190
+ "open",
191
+ "released",
192
+ "decided",
193
+ "closed"
194
+ ]);
195
+ var PlanReviewStateValue = z.enum(PLAN_REVIEW_STATE_VALUES);
196
+ var PLAN_DECISION_KINDS = Object.freeze([
197
+ "approve",
198
+ "approve-accept-edits",
199
+ "revise",
200
+ "terminal"
201
+ ]);
202
+ var PlanDecisionKind = z.enum(PLAN_DECISION_KINDS);
203
+ var PlanSectionComment = z.object({
204
+ heading: z.string().max(PLAN_COMMENT_MAX_CHARS).nullable(),
205
+ comment: z.string().min(1).max(PLAN_COMMENT_MAX_CHARS)
51
206
  });
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"
207
+ var PlanDecision = z.object({
208
+ id: z.string().min(1),
209
+ agentId: z.string().nullable(),
210
+ revision: z.number().int().positive(),
211
+ decision: PlanDecisionKind,
212
+ feedback: z.string().max(PLAN_FEEDBACK_MAX_CHARS).optional(),
213
+ comments: z.array(PlanSectionComment).max(40).optional(),
214
+ plan: z.string().min(1).max(PLAN_BODY_CAP_BYTES).optional()
71
215
  });
72
- var POSTHOG_TRAFFIC_MULTIPLIER_RANGE = Object.freeze({
73
- min: 1,
74
- label: "at least 1"
216
+ var PlanRevisionSummary = z.object({
217
+ revision: z.number().int().positive(),
218
+ receivedAt: z.number().finite(),
219
+ chars: z.number().int().nonnegative(),
220
+ title: z.string()
75
221
  });
76
- var POSTHOG_TRAFFIC_MIN_USERS_RANGE = Object.freeze({
77
- min: 1,
78
- label: "at least 1"
222
+ var PlanReviewOpenRevision = z.object({
223
+ revision: z.number().int().positive(),
224
+ since: z.number().finite()
79
225
  });
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"
226
+ var PlanReview = z.object({
227
+ agentId: z.string().nullable(),
228
+ agentType: z.string().nullable(),
229
+ revisions: z.array(PlanRevisionSummary),
230
+ state: PlanReviewStateValue,
231
+ openRevision: PlanReviewOpenRevision.nullable(),
232
+ approvedRevision: z.number().int().positive().nullable(),
233
+ lastDecision: PlanDecisionKind.nullable()
85
234
  });
86
- var USAGE_SCAN_INTERVAL_RANGE = Object.freeze({
87
- min: 1,
88
- max: 1440
235
+ z.object({ reviews: z.array(PlanReview) });
236
+ var PlanRevisionBody = z.object({
237
+ agentId: z.string().nullable(),
238
+ revision: z.number().int().nonnegative(),
239
+ plan: z.string(),
240
+ planFilePath: z.string(),
241
+ receivedAt: z.number().finite()
89
242
  });
90
- var USAGE_RETAIN_DAYS_RANGE = Object.freeze({
91
- min: 1,
92
- max: 3650
243
+ var PlanChangedPush = z.object({
244
+ id: z.string(),
245
+ agentId: z.string().nullable(),
246
+ agentType: z.string().nullable(),
247
+ revision: z.number().int().positive(),
248
+ receivedAt: z.number().finite(),
249
+ state: PlanReviewStateValue,
250
+ lastDecision: PlanDecisionKind.nullable(),
251
+ approvedRevision: z.number().int().positive().nullable(),
252
+ chars: z.number().int().nonnegative(),
253
+ title: z.string(),
254
+ hasPlan: z.boolean()
93
255
  });
94
- var USAGE_WAREHOUSE_RETAIN_DAYS_RANGE = Object.freeze({
95
- min: 30,
96
- max: 3650
256
+ var PlanDraftPush = z.object({
257
+ id: z.string(),
258
+ agentId: z.string().nullable(),
259
+ planFilePath: z.string(),
260
+ changedAt: z.number().finite()
97
261
  });
98
- var USAGE_SESSION_BLOCK_HOURS_RANGE = Object.freeze({
99
- min: 1,
100
- max: 24
262
+ var PlanResponseFrame = z.object({
263
+ id: z.string(),
264
+ reviews: z.array(PlanReview),
265
+ body: PlanRevisionBody.nullable()
101
266
  });
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
267
+ Object.freeze([
268
+ "file",
269
+ "subsystem",
270
+ "co-change",
271
+ "hotspot",
272
+ "blast",
273
+ "untested",
274
+ "collision",
275
+ "link"
276
+ ]);
277
+ function changeMapFactId(kind, repoName, ...parts) {
278
+ return [
279
+ kind,
280
+ repoName,
281
+ ...parts
282
+ ].join(":");
283
+ }
284
+ var factId = z.string().min(1);
285
+ var repoPath = z.string().min(1);
286
+ var count = z.number().int().nonnegative();
287
+ var cappedPaths = z.array(repoPath).max(20);
288
+ var ChangedFileStatus = z.enum([
289
+ "added",
290
+ "modified",
291
+ "deleted",
292
+ "renamed",
293
+ "untracked"
294
+ ]);
295
+ var ChangedFile = z.strictObject({
296
+ factId,
297
+ path: repoPath,
298
+ previousPath: repoPath.optional(),
299
+ status: ChangedFileStatus,
300
+ isCommitted: z.boolean()
108
301
  });
109
- var CHANGE_MAP_NARRATOR_TIMEOUT_RANGE = Object.freeze({
110
- min: 15,
111
- max: 600
302
+ var SubsystemFact = z.strictObject({
303
+ factId,
304
+ agentsPath: repoPath,
305
+ title: z.string(),
306
+ paths: z.array(repoPath).min(1)
112
307
  });
113
- var KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE = Object.freeze({
114
- min: 5,
115
- max: 120
308
+ var CoChangeGap = z.strictObject({
309
+ factId,
310
+ path: repoPath,
311
+ partner: repoPath,
312
+ support: count,
313
+ confidence: z.number().min(0).max(1)
116
314
  });
117
- var WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE = Object.freeze({
118
- min: 1,
119
- max: 5
315
+ var HotspotFact = z.strictObject({
316
+ factId,
317
+ path: repoPath,
318
+ commitCount: count,
319
+ fixCommitCount: count
120
320
  });
121
- var WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE = Object.freeze({
122
- min: 1,
123
- max: 50
321
+ var BlastRadiusFact = z.strictObject({
322
+ factId,
323
+ path: repoPath,
324
+ directDependents: cappedPaths,
325
+ directDependentCount: count,
326
+ transitiveDependentCount: count,
327
+ dependentTests: cappedPaths,
328
+ dependentTestCount: count
124
329
  });
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
330
+ var UntestedFileFact = z.strictObject({
331
+ factId,
332
+ path: repoPath
157
333
  });
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"
255
- ]);
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"
267
- ]);
268
- var WORKFLOW_ACTION_TYPES = Object.freeze([
269
- "notify",
270
- "spawn",
271
- "label",
272
- "comment"
334
+ var CollisionFact = z.strictObject({
335
+ factId,
336
+ path: repoPath,
337
+ otherSessionId: z.string().min(1),
338
+ otherSessionName: z.string()
339
+ });
340
+ var CrossRepoLink = z.strictObject({
341
+ factId,
342
+ providerRepo: z.string().min(1),
343
+ packageName: z.string().min(1),
344
+ packageDir: z.string(),
345
+ consumerManifest: repoPath,
346
+ versionSpec: z.string(),
347
+ isLocalLink: z.boolean(),
348
+ providerChangedPathCount: count,
349
+ importers: cappedPaths,
350
+ importerCount: count,
351
+ changedImporterCount: count
352
+ });
353
+ var RepoChangeMap = z.strictObject({
354
+ name: z.string().min(1),
355
+ root: z.string().min(1),
356
+ sessionPathPrefix: z.string(),
357
+ base: z.string().nullable(),
358
+ files: z.array(ChangedFile),
359
+ subsystems: z.array(SubsystemFact),
360
+ coChangeGaps: z.array(CoChangeGap),
361
+ hotspots: z.array(HotspotFact),
362
+ blastRadius: z.array(BlastRadiusFact),
363
+ untestedFiles: z.array(UntestedFileFact),
364
+ collisions: z.array(CollisionFact),
365
+ links: z.array(CrossRepoLink),
366
+ error: z.string().nullable()
367
+ });
368
+ var NarrativeClaim = z.strictObject({
369
+ text: z.string().min(1).max(600),
370
+ factIds: z.array(factId).min(1)
371
+ });
372
+ var ChangeNarrative = z.strictObject({
373
+ factsHash: z.string().min(1),
374
+ model: z.string().nullable(),
375
+ claims: z.array(NarrativeClaim).max(12)
376
+ });
377
+ var NarratorState = z.enum([
378
+ "disabled",
379
+ "pending",
380
+ "ready",
381
+ "failed"
273
382
  ]);
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 });
282
- };
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") }),
292
- z.strictObject({
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" })
295
- }),
296
- z.strictObject({
297
- type: z.literal("label"),
298
- name: WorkflowLabelName
299
- }),
300
- z.strictObject({
301
- type: z.literal("comment"),
302
- body: WorkflowCommentBody
303
- })
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 })
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)
383
+ var ChangeMap = z.strictObject({
384
+ sessionId: z.string().min(1),
385
+ sig: z.string().nullable(),
386
+ generatedAt: z.number().finite(),
387
+ repos: z.array(RepoChangeMap),
388
+ narrative: ChangeNarrative.nullable(),
389
+ narratorState: NarratorState,
390
+ error: z.string().min(1).optional()
400
391
  });
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"
392
+ var CoherenceJournalKind = z.enum([
393
+ "decision",
394
+ "retraction",
395
+ "conjecture",
396
+ "resolution",
397
+ "dismissal",
398
+ "defect",
399
+ "experiment",
400
+ "close",
401
+ "unable",
402
+ "escalation",
403
+ "acknowledgement",
404
+ "enactment"
612
405
  ]);
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()
406
+ var recordHead = {
407
+ id: z.string().min(1),
408
+ at: z.iso.datetime(),
409
+ session: z.string(),
410
+ agent: z.string(),
411
+ commit: z.string().nullable(),
412
+ dirty: z.boolean(),
413
+ binding: z.string()
721
414
  };
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
- }
798
- //#endregion
799
- //#region shared/contracts/telemetry.ts
800
- var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
801
- var SESSION_EXIT_KINDS = Object.freeze([
802
- "clean",
803
- "error",
804
- "signal",
805
- "no_output"
806
- ]);
807
- var nonNegativeInteger = z.number().int().nonnegative();
808
- var boundedText = z.string().max(512);
809
- var AppStartedProperties = z.object({}).strict();
810
- var AppActiveProperties = z.object({ active_session_count: nonNegativeInteger }).strict();
811
- var SessionStartedProperties = z.object({ adapter: z.enum(TELEMETRY_ADAPTERS) }).strict();
812
- var SessionEndedProperties = z.object({
813
- adapter: z.enum(TELEMETRY_ADAPTERS),
814
- exit_kind: z.enum(SESSION_EXIT_KINDS),
815
- duration_seconds: nonNegativeInteger
816
- }).strict();
817
- var ExceptionFrame = z.object({
818
- platform: z.enum(["node:javascript", "web:javascript"]),
819
- function: boundedText,
820
- filename: boundedText,
821
- lineno: nonNegativeInteger,
822
- colno: nonNegativeInteger,
823
- in_app: z.boolean()
824
- }).strict();
825
- var ExceptionProperties = z.object({
826
- $exception_list: z.array(z.object({
827
- type: boundedText,
828
- value: boundedText,
829
- mechanism: z.object({
830
- handled: z.boolean(),
831
- synthetic: z.boolean(),
832
- type: z.literal("generic")
833
- }).strict(),
834
- stacktrace: z.object({
835
- type: z.literal("raw"),
836
- frames: z.array(ExceptionFrame).max(64)
837
- }).strict()
838
- }).strict()).length(1),
839
- $exception_level: z.enum(["error", "fatal"])
840
- }).strict();
841
- var AiGenerationProperties = z.object({
842
- $ai_trace_id: z.string().regex(/^[0-9a-f]{64}$/),
843
- $ai_provider: z.string().max(64),
844
- $ai_model: z.string().max(128),
845
- $ai_input_tokens: nonNegativeInteger,
846
- $ai_output_tokens: nonNegativeInteger,
847
- $ai_cache_read_input_tokens: nonNegativeInteger.optional(),
848
- $ai_cache_creation_input_tokens: nonNegativeInteger.optional(),
849
- $ai_total_cost_usd: z.number().finite().nonnegative().optional(),
850
- agent_adapter: z.enum(TELEMETRY_ADAPTERS)
851
- }).strict();
852
- var TELEMETRY_EVENT_SCHEMAS = Object.freeze({
853
- app_started: AppStartedProperties,
854
- app_active: AppActiveProperties,
855
- session_started: SessionStartedProperties,
856
- session_ended: SessionEndedProperties,
857
- $exception: ExceptionProperties,
858
- $ai_generation: AiGenerationProperties
415
+ var reference = {
416
+ of: z.string().min(1),
417
+ because: z.string()
418
+ };
419
+ var step = z.looseObject({
420
+ id: z.string(),
421
+ text: z.string()
859
422
  });
860
- Object.freeze([
861
- {
862
- name: "app_started",
863
- description: "The server started listening."
864
- },
865
- {
866
- name: "app_active",
867
- description: "Once a day while the server runs, with how many sessions are live."
868
- },
869
- {
870
- name: "session_started",
871
- description: "A session spawned, with which kind of agent (any custom agent counts as `custom`)."
872
- },
873
- {
874
- name: "session_ended",
875
- description: "A session exited: how it exited and how long it ran, in whole seconds."
876
- },
877
- {
878
- name: "$exception",
879
- description: "An error in the server or the dashboard: its type, an error code when it has one, and stack frames with file paths cut to the package or URL path. Never the error message. Each distinct error is sent once per run, and a crash is sent on the next start."
880
- },
881
- {
882
- name: "$ai_generation",
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."
884
- }
885
- ]);
886
- Object.freeze([
887
- "app_version",
888
- "os_platform",
889
- "node_major",
890
- "install_flavor",
891
- "is_bundled",
892
- "is_dev_install"
423
+ var KnownJournalRecord = z.discriminatedUnion("kind", [
424
+ z.looseObject({
425
+ ...recordHead,
426
+ kind: z.literal("decision"),
427
+ chose: z.string(),
428
+ over: z.array(z.string()),
429
+ because: z.string()
430
+ }),
431
+ z.looseObject({
432
+ ...recordHead,
433
+ kind: z.literal("retraction"),
434
+ ...reference
435
+ }),
436
+ z.looseObject({
437
+ ...recordHead,
438
+ kind: z.literal("conjecture"),
439
+ observation: z.string(),
440
+ couldBe: z.array(z.string()),
441
+ discriminatedBy: z.string()
442
+ }),
443
+ z.looseObject({
444
+ ...recordHead,
445
+ kind: z.literal("resolution"),
446
+ ...reference,
447
+ as: z.string().optional()
448
+ }),
449
+ z.looseObject({
450
+ ...recordHead,
451
+ kind: z.literal("dismissal"),
452
+ ...reference
453
+ }),
454
+ z.looseObject({
455
+ ...recordHead,
456
+ kind: z.literal("defect"),
457
+ what: z.string(),
458
+ evidence: z.string(),
459
+ files: z.array(z.string())
460
+ }),
461
+ z.looseObject({
462
+ ...recordHead,
463
+ kind: z.literal("experiment"),
464
+ expectation: z.string(),
465
+ context: z.array(z.string()),
466
+ actions: z.array(step),
467
+ criteria: z.array(step)
468
+ }),
469
+ z.looseObject({
470
+ ...recordHead,
471
+ kind: z.literal("close"),
472
+ of: z.string(),
473
+ outcome: z.enum([
474
+ "success",
475
+ "failure",
476
+ "inconclusive"
477
+ ]),
478
+ results: z.record(z.string(), z.unknown())
479
+ }),
480
+ z.looseObject({
481
+ ...recordHead,
482
+ kind: z.literal("unable"),
483
+ what: z.string(),
484
+ because: z.string()
485
+ }),
486
+ z.looseObject({
487
+ ...recordHead,
488
+ kind: z.literal("escalation"),
489
+ what: z.string(),
490
+ because: z.string()
491
+ }),
492
+ z.looseObject({
493
+ ...recordHead,
494
+ kind: z.literal("acknowledgement"),
495
+ ...reference
496
+ }),
497
+ z.looseObject({
498
+ ...recordHead,
499
+ kind: z.literal("enactment"),
500
+ practice: z.string(),
501
+ results: z.record(z.string(), z.unknown())
502
+ })
893
503
  ]);
894
- Object.freeze(["$release_id"]);
895
- var TELEMETRY_KILL_SWITCH_FLAG = "telemetry-enabled";
896
- var FeatureFlagsResponse = z.object({
897
- flags: z.object({ [TELEMETRY_KILL_SWITCH_FLAG]: z.object({ enabled: z.boolean() }).passthrough().optional() }).passthrough(),
898
- errorsWhileComputingFlags: z.boolean().optional()
899
- }).passthrough();
900
- var PendingCrashReport = z.object({
901
- timestamp: z.string(),
902
- properties: ExceptionProperties
903
- }).strict();
904
- var TelemetryState = z.object({
905
- installId: z.uuid(),
906
- noticeShownAt: z.string().nullable().optional(),
907
- remoteDisabled: z.boolean().optional()
908
- });
909
- //#endregion
910
- //#region shared/contracts/benchmark.ts
911
- var BENCHMARK_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
912
- var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
913
- var repoSlug = z.string().regex(/^[^/\s]+\/[^/\s]+$/);
914
- var timestamp$1 = z.number().finite();
915
- var nonEmptyText = z.string().min(1);
916
- var BENCHMARK_INJECTED_ENV_NAMES = Object.freeze(["CLAUDE_CODE_OAUTH_TOKEN"]);
917
- var BenchmarkId = z.string().regex(BENCHMARK_ID_RE);
918
- function hasUniqueIds(entries) {
919
- return new Set(entries.map((entry) => entry.id)).size === entries.length;
920
- }
921
- var BenchmarkCaseSource = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
922
- kind: z.literal("github-merged-prs"),
923
- repo: repoSlug,
924
- minBodies: z.number().int().min(1),
925
- limit: z.number().int().min(1).max(500)
926
- })]);
927
- var BenchmarkWorkspace = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("none") }), z.strictObject({ kind: z.literal("pr-checkout") })]);
928
- var BenchmarkSubjectOutput = z.enum(["review-findings", "json"]);
929
- var BenchmarkSubject = z.strictObject({
930
- promptTemplate: nonEmptyText,
931
- output: BenchmarkSubjectOutput,
932
- timeoutSeconds: z.number().int().min(30).max(14400)
933
- });
934
- var BenchmarkArm = z.strictObject({
935
- id: BenchmarkId,
936
- env: z.record(z.string().regex(ENV_NAME_RE), z.string()).refine((env) => BENCHMARK_INJECTED_ENV_NAMES.every((name) => !Object.hasOwn(env, name)), { message: `arm env must not set ${BENCHMARK_INJECTED_ENV_NAMES.join(", ")}; Glimmervoid injects it per cell` }).optional(),
937
- extraArgs: z.array(z.string()).optional(),
938
- setup: z.strictObject({ command: z.array(nonEmptyText).min(1) }).optional()
939
- });
940
- var BenchmarkScorer = z.discriminatedUnion("kind", [z.strictObject({
941
- kind: z.literal("llm-judge-match"),
942
- model: nonEmptyText
504
+ var CoherenceJournalRecord = z.union([KnownJournalRecord, z.object({
505
+ id: z.string().min(1),
506
+ kind: z.string().min(1).refine((kind) => !CoherenceJournalKind.safeParse(kind).success)
943
507
  })]);
944
- var BenchmarkSuite = z.strictObject({
945
- id: BenchmarkId,
946
- title: nonEmptyText,
947
- caseSource: BenchmarkCaseSource,
948
- workspace: BenchmarkWorkspace,
949
- subject: BenchmarkSubject,
950
- arms: z.array(BenchmarkArm).min(2).refine(hasUniqueIds, { message: "arm ids must be unique" }),
951
- baselineArm: BenchmarkId,
952
- trials: z.number().int().min(1).max(20),
953
- scorer: BenchmarkScorer
954
- }).refine((suite) => suite.arms.some((arm) => arm.id === suite.baselineArm), {
955
- message: "baselineArm must name one of the arms",
956
- path: ["baselineArm"]
508
+ var CoherenceJournalOutput = z.looseObject({
509
+ branch: z.string().nullable(),
510
+ escalations: z.array(z.unknown()),
511
+ records: z.array(CoherenceJournalRecord),
512
+ citedBy: z.record(z.string(), z.array(z.unknown())),
513
+ damaged: z.array(z.unknown())
957
514
  });
958
- var BenchmarkReference = z.strictObject({
959
- id: BenchmarkId,
960
- text: nonEmptyText,
961
- tags: z.array(BenchmarkId),
962
- path: nonEmptyText.optional(),
963
- line: z.number().int().positive().optional()
515
+ var CoherenceJournalEntry = z.strictObject({
516
+ id: z.string().min(1),
517
+ at: z.iso.datetime().nullable(),
518
+ kind: z.string().min(1),
519
+ text: z.string().max(280),
520
+ detail: z.string().max(280).nullable(),
521
+ supersedes: z.string().nullable()
964
522
  });
965
- var BenchmarkCaseOrigin = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
966
- kind: z.literal("github-pr"),
967
- repo: repoSlug,
968
- number: z.number().int().positive(),
969
- url: nonEmptyText,
970
- minedAt: timestamp$1
523
+ var CoherenceJournalReading = z.discriminatedUnion("ok", [z.strictObject({
524
+ ok: z.literal(true),
525
+ latest: CoherenceJournalEntry.nullable()
526
+ }), z.strictObject({
527
+ ok: z.literal(false),
528
+ reason: z.string().min(1).max(200)
971
529
  })]);
972
- var BenchmarkCase = z.strictObject({
973
- id: BenchmarkId,
974
- input: z.record(z.string(), z.unknown()),
975
- references: z.array(BenchmarkReference).min(1).refine(hasUniqueIds, { message: "reference ids must be unique" }),
976
- source: BenchmarkCaseOrigin
530
+ var SessionCoherence = z.strictObject({
531
+ journal: CoherenceJournalReading,
532
+ updatedAt: z.number().finite()
977
533
  });
978
- var PrCheckoutCaseInput = z.object({
979
- repo: repoSlug,
980
- number: z.number().int().positive(),
981
- reviewedSha: CommitSha,
982
- baseSha: CommitSha,
983
- changedFiles: z.array(nonEmptyText)
534
+ //#endregion
535
+ //#region shared/contracts/trace.ts
536
+ var MAX_RAW_LINE_CHARS = 4e3;
537
+ var TraceRecordBase = z.object({
538
+ ts: z.number().finite(),
539
+ uuid: z.string().nullable(),
540
+ parentUuid: z.string().nullable(),
541
+ vendorSessionId: z.string().min(1),
542
+ agentId: z.string().min(1).optional(),
543
+ agentType: z.string().min(1).optional(),
544
+ transcriptOffset: z.number().int().nonnegative().optional(),
545
+ truncated: z.boolean().optional()
984
546
  });
985
- var BenchmarkMatchVerdict = z.enum([
986
- "found",
987
- "partial",
988
- "missed"
547
+ var TraceRecord = z.discriminatedUnion("kind", [
548
+ TraceRecordBase.extend({
549
+ kind: z.literal("prompt"),
550
+ text: z.string()
551
+ }),
552
+ TraceRecordBase.extend({
553
+ kind: z.literal("expansion"),
554
+ text: z.string(),
555
+ toolUseId: z.string().min(1).optional()
556
+ }),
557
+ TraceRecordBase.extend({
558
+ kind: z.literal("thinking"),
559
+ text: z.string()
560
+ }),
561
+ TraceRecordBase.extend({
562
+ kind: z.literal("assistant"),
563
+ text: z.string()
564
+ }),
565
+ TraceRecordBase.extend({
566
+ kind: z.literal("tool_call"),
567
+ toolUseId: z.string().min(1),
568
+ name: z.string().min(1),
569
+ input: z.unknown()
570
+ }),
571
+ TraceRecordBase.extend({
572
+ kind: z.literal("tool_result"),
573
+ toolUseId: z.string().min(1),
574
+ content: z.string(),
575
+ isError: z.boolean(),
576
+ truncated: z.boolean()
577
+ }),
578
+ TraceRecordBase.extend({
579
+ kind: z.literal("session"),
580
+ vendor: z.string().min(1),
581
+ transcriptPath: z.string().min(1),
582
+ reason: z.string().min(1).optional()
583
+ }),
584
+ TraceRecordBase.extend({
585
+ kind: z.literal("notice"),
586
+ text: z.string().max(MAX_RAW_LINE_CHARS)
587
+ }),
588
+ TraceRecordBase.extend({
589
+ kind: z.literal("raw"),
590
+ line: z.string().max(MAX_RAW_LINE_CHARS)
591
+ })
989
592
  ]);
990
- var BenchmarkJudgement = z.strictObject({
991
- referenceId: BenchmarkId,
992
- verdict: BenchmarkMatchVerdict,
993
- findingIndexes: z.array(z.number().int().nonnegative())
593
+ var TraceCheckpoint = z.object({
594
+ transcriptPath: z.string().min(1),
595
+ vendorSessionId: z.string().min(1),
596
+ offset: z.number().int().nonnegative(),
597
+ ingestedSubagentPaths: z.array(z.string().min(1)),
598
+ offsetByTranscriptPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({}),
599
+ subagentOffsetByPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({})
994
600
  });
995
- var BenchmarkCellStatus = z.enum([
996
- "scored",
997
- "invalid",
998
- "error"
999
- ]);
1000
- var BenchmarkCellResult = z.strictObject({
1001
- caseId: BenchmarkId,
1002
- armId: BenchmarkId,
1003
- trial: z.number().int().min(1),
1004
- status: BenchmarkCellStatus,
1005
- startedAt: timestamp$1,
1006
- finishedAt: timestamp$1,
1007
- degradedReasons: z.array(nonEmptyText),
1008
- findingCount: z.number().int().nonnegative(),
1009
- judgements: z.array(BenchmarkJudgement),
1010
- costUsd: z.number().finite().nonnegative().nullable(),
1011
- error: nonEmptyText.nullable()
601
+ //#endregion
602
+ //#region shared/contracts/session-setup.ts
603
+ var setupName = z.string().max(16384);
604
+ var setupNames = z.array(setupName).max(4096);
605
+ var SessionSetup = z.object({
606
+ model: setupName.nullable(),
607
+ mcpServers: setupNames,
608
+ plugins: z.array(z.object({
609
+ name: setupName,
610
+ skills: setupNames,
611
+ agents: setupNames
612
+ })).max(4096),
613
+ skills: setupNames,
614
+ agents: setupNames,
615
+ hookEvents: z.array(z.object({
616
+ event: setupName,
617
+ runCount: z.number().int().nonnegative()
618
+ })).max(4096),
619
+ hookCommands: z.array(z.string().max(65536)).max(4096)
1012
620
  });
1013
- var BenchmarkRunStatus = z.enum([
621
+ //#endregion
622
+ //#region shared/contracts/update-journal.ts
623
+ var UpdateChannel = z.enum(["release", "main"]);
624
+ var UpdateRunState = z.enum([
625
+ "idle",
1014
626
  "running",
1015
- "completed",
1016
- "interrupted",
1017
- "failed"
1018
- ]);
1019
- var BenchmarkRun = z.strictObject({
1020
- id: BenchmarkId,
1021
- suiteId: BenchmarkId,
1022
- status: BenchmarkRunStatus,
1023
- startedAt: timestamp$1,
1024
- finishedAt: timestamp$1.nullable(),
1025
- error: nonEmptyText.nullable(),
1026
- cells: z.array(BenchmarkCellResult)
1027
- });
1028
- var nullableRatio = z.number().min(0).max(1).nullable();
1029
- var BenchmarkArmScore = z.strictObject({
1030
- trials: z.number().int().nonnegative(),
1031
- recall: nullableRatio,
1032
- recallByTag: z.record(BenchmarkId, nullableRatio),
1033
- degraded: z.number().int().nonnegative(),
1034
- invalid: z.number().int().nonnegative(),
1035
- costUsd: z.number().finite().nonnegative().nullable()
627
+ "staged",
628
+ "succeeded",
629
+ "failed",
630
+ "discarded",
631
+ "interrupted"
632
+ ]);
633
+ var UpdateStepId = z.enum([
634
+ "fetch",
635
+ "stage",
636
+ "install",
637
+ "link-deps",
638
+ "build"
639
+ ]);
640
+ var UpdateStepStatus = z.enum([
641
+ "pending",
642
+ "running",
643
+ "succeeded",
644
+ "failed"
645
+ ]);
646
+ var UpdateJournalStep = z.object({
647
+ id: UpdateStepId,
648
+ status: UpdateStepStatus,
649
+ startedAt: z.number().finite().nullable(),
650
+ finishedAt: z.number().finite().nullable(),
651
+ outputTail: z.array(z.string())
652
+ }).strict();
653
+ var UpdateJournal = z.object({
654
+ state: UpdateRunState,
655
+ fromSha: z.string().nullable(),
656
+ toSha: z.string().nullable(),
657
+ toVersion: z.string().nullable(),
658
+ channel: UpdateChannel,
659
+ steps: z.array(UpdateJournalStep),
660
+ activeStep: UpdateStepId.nullable(),
661
+ reason: z.string().nullable(),
662
+ startedAt: z.number().finite().nullable(),
663
+ finishedAt: z.number().finite().nullable(),
664
+ failedAtHandOff: z.boolean().optional()
665
+ }).strict();
666
+ var UpdateJournalSummary = UpdateJournal.pick({
667
+ state: true,
668
+ activeStep: true,
669
+ reason: true,
670
+ startedAt: true,
671
+ finishedAt: true
1036
672
  });
1037
- var BenchmarkReportRow = z.strictObject({
1038
- caseId: BenchmarkId,
1039
- arms: z.record(BenchmarkId, BenchmarkArmScore),
1040
- deltaVsBaseline: z.record(BenchmarkId, z.number().min(-1).max(1).nullable())
673
+ //#endregion
674
+ //#region shared/settings-ranges.ts
675
+ var POSITIVE_NUMBER_RANGE = Object.freeze({
676
+ min: 0,
677
+ exclusiveMin: true,
678
+ label: "a positive number"
1041
679
  });
1042
- var BenchmarkReport = z.strictObject({
1043
- runId: BenchmarkId,
1044
- suiteId: BenchmarkId,
1045
- status: BenchmarkRunStatus,
1046
- baselineArm: BenchmarkId,
1047
- armIds: z.array(BenchmarkId),
1048
- rows: z.array(BenchmarkReportRow),
1049
- totals: z.record(BenchmarkId, BenchmarkArmScore)
680
+ var NON_NEGATIVE_NUMBER_RANGE = Object.freeze({
681
+ min: 0,
682
+ label: "zero or more"
1050
683
  });
1051
- var BenchmarkAction = z.enum([
1052
- "mine",
1053
- "run",
1054
- "cancel"
1055
- ]);
1056
- var BenchmarkActionRequest = z.object({
1057
- suiteId: BenchmarkId,
1058
- action: BenchmarkAction
684
+ var FLYING_ANIMALS_GAP_RANGE = Object.freeze({
685
+ min: 0,
686
+ max: 300
1059
687
  });
1060
- var BenchmarkActionResult = z.object({
1061
- suiteId: BenchmarkId,
1062
- action: BenchmarkAction,
1063
- ok: z.boolean(),
1064
- error: z.string().optional(),
1065
- runId: BenchmarkId.optional()
688
+ var FLYING_ANIMALS_DURATION_RANGE = Object.freeze({
689
+ min: 1,
690
+ max: 60
1066
691
  });
1067
- var BenchmarkCellPhase = z.enum([
1068
- "setup",
1069
- "preflight",
1070
- "workspace",
1071
- "subject",
1072
- "judge"
1073
- ]);
1074
- var BenchmarkInFlightCell = z.object({
1075
- suiteId: BenchmarkId,
1076
- runId: BenchmarkId,
1077
- caseId: BenchmarkId.nullable(),
1078
- armId: BenchmarkId,
1079
- trial: z.number().int().min(1),
1080
- phase: BenchmarkCellPhase,
1081
- cellIndex: z.number().int().nonnegative(),
1082
- cellCount: z.number().int().positive(),
1083
- startedAt: timestamp$1
692
+ var FLYING_ANIMALS_SCALE_RANGE = Object.freeze({
693
+ min: .5,
694
+ max: 2
1084
695
  });
1085
- var BenchmarkSuiteSummary = z.object({
1086
- id: BenchmarkId,
1087
- title: z.string(),
1088
- error: z.string().nullable(),
1089
- caseCount: z.number().int().nonnegative(),
1090
- candidateCount: z.number().int().nonnegative(),
1091
- armIds: z.array(BenchmarkId),
1092
- baselineArm: BenchmarkId.nullable(),
1093
- latestReport: BenchmarkReport.nullable()
696
+ var FLYING_ANIMALS_DEFAULTS = Object.freeze({
697
+ flyingAnimalsMinGapSeconds: 20,
698
+ flyingAnimalsMaxGapSeconds: 40,
699
+ flyingAnimalsMinDurationSeconds: 6.9,
700
+ flyingAnimalsMaxDurationSeconds: 11.5,
701
+ flyingAnimalsScale: 1,
702
+ flyingAnimalsOnPhone: true
1094
703
  });
1095
- var BenchmarkStatus = z.object({
1096
- type: z.literal("benchmark-status"),
1097
- ts: timestamp$1,
1098
- configured: z.boolean(),
1099
- reason: z.string().nullable(),
1100
- suites: z.array(BenchmarkSuiteSummary),
1101
- inFlight: BenchmarkInFlightCell.nullable()
1102
- }).passthrough();
1103
- var githubAuthor = z.object({
1104
- __typename: z.string(),
1105
- login: z.string()
1106
- }).nullable();
1107
- var MergedPrListing = z.object({
1108
- number: z.number().int().positive(),
1109
- title: z.string(),
1110
- url: nonEmptyText,
1111
- mergedAt: z.string().nullable(),
1112
- reviewThreads: z.object({ totalCount: z.number().int().nonnegative() }),
1113
- reviews: z.object({ totalCount: z.number().int().nonnegative() })
704
+ var REPLAY_BUFFER_KB_RANGE = Object.freeze({
705
+ min: 64,
706
+ max: 16384
1114
707
  });
1115
- var MinedReviewThread = z.object({
1116
- path: z.string(),
1117
- line: z.number().int().positive().nullable(),
1118
- originalLine: z.number().int().positive().nullable(),
1119
- comments: z.object({ nodes: z.array(z.object({
1120
- databaseId: z.number().int().positive(),
1121
- author: githubAuthor,
1122
- body: z.string(),
1123
- createdAt: z.string(),
1124
- originalCommit: z.object({ oid: CommitSha }).nullable()
1125
- })) })
708
+ var MEMORY_RESERVE_MB_RANGE = Object.freeze({
709
+ min: 0,
710
+ max: 65536
1126
711
  });
1127
- var MinedReview = z.object({
1128
- databaseId: z.number().int().positive(),
1129
- author: githubAuthor,
1130
- body: z.string(),
1131
- submittedAt: z.string().nullable(),
1132
- commit: z.object({ oid: CommitSha }).nullable()
712
+ var PORT_RANGE = Object.freeze({
713
+ min: 0,
714
+ max: 65535
1133
715
  });
1134
- var MinedBaseEvent = z.discriminatedUnion("__typename", [z.object({
1135
- __typename: z.literal("BaseRefChangedEvent"),
1136
- createdAt: z.string()
1137
- }), z.object({
1138
- __typename: z.literal("BaseRefForcePushedEvent"),
1139
- createdAt: z.string(),
1140
- beforeCommit: z.object({ oid: CommitSha }).nullable()
1141
- })]);
1142
- var MinedPrReviewData = z.object({
1143
- author: githubAuthor,
1144
- baseRefOid: CommitSha,
1145
- reviewThreads: z.object({
1146
- pageInfo: z.object({ hasNextPage: z.boolean() }),
1147
- nodes: z.array(MinedReviewThread)
1148
- }),
1149
- reviews: z.object({
1150
- pageInfo: z.object({ hasNextPage: z.boolean() }),
1151
- nodes: z.array(MinedReview)
1152
- }),
1153
- timelineItems: z.object({
1154
- pageInfo: z.object({ hasNextPage: z.boolean() }),
1155
- nodes: z.array(MinedBaseEvent)
1156
- })
716
+ var TASK_TITLE_TIMEOUT_RANGE = Object.freeze({
717
+ min: 0,
718
+ exclusiveMin: true,
719
+ max: 2147483647 / 1e3
1157
720
  });
1158
- var CommitComparison = z.object({
1159
- mergeBaseSha: CommitSha,
1160
- changedFiles: z.array(nonEmptyText),
1161
- isFileListComplete: z.boolean()
721
+ var BRANCH_GC_STALE_DAYS_RANGE = POSITIVE_NUMBER_RANGE;
722
+ var BRANCH_GC_INTERVAL_MS_RANGE = POSITIVE_NUMBER_RANGE;
723
+ var VISIONS_QUIET_MS_RANGE = POSITIVE_NUMBER_RANGE;
724
+ var VISIONS_COOLDOWN_MS_RANGE = POSITIVE_NUMBER_RANGE;
725
+ var VISIONS_MAX_PER_HOUR_RANGE = POSITIVE_NUMBER_RANGE;
726
+ var VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE = NON_NEGATIVE_NUMBER_RANGE;
727
+ var VISIONS_DISPATCH_TIMEOUT_RANGE = POSITIVE_NUMBER_RANGE;
728
+ var VISIONS_INTENT_THREAD_TTL_MS_RANGE = POSITIVE_NUMBER_RANGE;
729
+ var POSTHOG_INTERVAL_RANGE = POSITIVE_NUMBER_RANGE;
730
+ var POSTHOG_MAX_CONCURRENT_RANGE = POSITIVE_NUMBER_RANGE;
731
+ var POSTHOG_INVESTIGATION_TIMEOUT_RANGE = POSITIVE_NUMBER_RANGE;
732
+ var POSTHOG_MIN_USERS_RANGE = POSITIVE_NUMBER_RANGE;
733
+ var POSTHOG_ESCALATION_RANGE = POSITIVE_NUMBER_RANGE;
734
+ var POSTHOG_RECURRENCE_WINDOW_RANGE = POSITIVE_NUMBER_RANGE;
735
+ var POSTHOG_TRANSIENT_RECURRENCE_RANGE = POSITIVE_NUMBER_RANGE;
736
+ var POSTHOG_FIX_TIMEOUT_RANGE = Object.freeze({
737
+ min: 60,
738
+ max: 21600,
739
+ label: "between 60 and 21600"
1162
740
  });
1163
- Object.freeze([
1164
- "file",
1165
- "subsystem",
1166
- "co-change",
1167
- "hotspot",
1168
- "blast",
1169
- "untested",
1170
- "collision",
1171
- "link"
1172
- ]);
1173
- function changeMapFactId(kind, repoName, ...parts) {
1174
- return [
1175
- kind,
1176
- repoName,
1177
- ...parts
1178
- ].join(":");
1179
- }
1180
- var factId = z.string().min(1);
1181
- var repoPath = z.string().min(1);
1182
- var count = z.number().int().nonnegative();
1183
- var cappedPaths = z.array(repoPath).max(20);
1184
- var ChangedFileStatus = z.enum([
1185
- "added",
1186
- "modified",
1187
- "deleted",
1188
- "renamed",
1189
- "untracked"
1190
- ]);
1191
- var ChangedFile = z.strictObject({
1192
- factId,
1193
- path: repoPath,
1194
- previousPath: repoPath.optional(),
1195
- status: ChangedFileStatus,
1196
- isCommitted: z.boolean()
741
+ var POSTHOG_TRAFFIC_MULTIPLIER_RANGE = Object.freeze({
742
+ min: 1,
743
+ label: "at least 1"
1197
744
  });
1198
- var SubsystemFact = z.strictObject({
1199
- factId,
1200
- agentsPath: repoPath,
1201
- title: z.string(),
1202
- paths: z.array(repoPath).min(1)
745
+ var POSTHOG_TRAFFIC_MIN_USERS_RANGE = Object.freeze({
746
+ min: 1,
747
+ label: "at least 1"
1203
748
  });
1204
- var CoChangeGap = z.strictObject({
1205
- factId,
1206
- path: repoPath,
1207
- partner: repoPath,
1208
- support: count,
1209
- confidence: z.number().min(0).max(1)
749
+ var POSTHOG_TRAFFIC_COOLDOWN_RANGE = NON_NEGATIVE_NUMBER_RANGE;
750
+ var POSTHOG_TRAFFIC_BASELINE_RANGE = Object.freeze({
751
+ min: 1,
752
+ max: 30,
753
+ label: "between 1 and 30"
1210
754
  });
1211
- var HotspotFact = z.strictObject({
1212
- factId,
1213
- path: repoPath,
1214
- commitCount: count,
1215
- fixCommitCount: count
755
+ var USAGE_SCAN_INTERVAL_RANGE = Object.freeze({
756
+ min: 1,
757
+ max: 1440
1216
758
  });
1217
- var BlastRadiusFact = z.strictObject({
1218
- factId,
1219
- path: repoPath,
1220
- directDependents: cappedPaths,
1221
- directDependentCount: count,
1222
- transitiveDependentCount: count,
1223
- dependentTests: cappedPaths,
1224
- dependentTestCount: count
759
+ var USAGE_RETAIN_DAYS_RANGE = Object.freeze({
760
+ min: 1,
761
+ max: 3650
1225
762
  });
1226
- var UntestedFileFact = z.strictObject({
1227
- factId,
1228
- path: repoPath
763
+ var USAGE_WAREHOUSE_RETAIN_DAYS_RANGE = Object.freeze({
764
+ min: 30,
765
+ max: 3650
1229
766
  });
1230
- var CollisionFact = z.strictObject({
1231
- factId,
1232
- path: repoPath,
1233
- otherSessionId: z.string().min(1),
1234
- otherSessionName: z.string()
767
+ var USAGE_SESSION_BLOCK_HOURS_RANGE = Object.freeze({
768
+ min: 1,
769
+ max: 24
1235
770
  });
1236
- var CrossRepoLink = z.strictObject({
1237
- factId,
1238
- providerRepo: z.string().min(1),
1239
- packageName: z.string().min(1),
1240
- packageDir: z.string(),
1241
- consumerManifest: repoPath,
1242
- versionSpec: z.string(),
1243
- isLocalLink: z.boolean(),
1244
- providerChangedPathCount: count,
1245
- importers: cappedPaths,
1246
- importerCount: count,
1247
- changedImporterCount: count
771
+ var USAGE_BUDGET_RANGE = POSITIVE_NUMBER_RANGE;
772
+ var USAGE_INTEGER_RANGES = Object.freeze({
773
+ scanIntervalMinutes: USAGE_SCAN_INTERVAL_RANGE,
774
+ retainDays: USAGE_RETAIN_DAYS_RANGE,
775
+ warehouseRetainDays: USAGE_WAREHOUSE_RETAIN_DAYS_RANGE,
776
+ sessionBlockHours: USAGE_SESSION_BLOCK_HOURS_RANGE
1248
777
  });
1249
- var RepoChangeMap = z.strictObject({
1250
- name: z.string().min(1),
1251
- root: z.string().min(1),
1252
- sessionPathPrefix: z.string(),
1253
- base: z.string().nullable(),
1254
- files: z.array(ChangedFile),
1255
- subsystems: z.array(SubsystemFact),
1256
- coChangeGaps: z.array(CoChangeGap),
1257
- hotspots: z.array(HotspotFact),
1258
- blastRadius: z.array(BlastRadiusFact),
1259
- untestedFiles: z.array(UntestedFileFact),
1260
- collisions: z.array(CollisionFact),
1261
- links: z.array(CrossRepoLink),
1262
- error: z.string().nullable()
778
+ var CHANGE_MAP_NARRATOR_TIMEOUT_RANGE = Object.freeze({
779
+ min: 15,
780
+ max: 600
1263
781
  });
1264
- var NarrativeClaim = z.strictObject({
1265
- text: z.string().min(1).max(600),
1266
- factIds: z.array(factId).min(1)
782
+ var KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE = Object.freeze({
783
+ min: 5,
784
+ max: 120
1267
785
  });
1268
- var ChangeNarrative = z.strictObject({
1269
- factsHash: z.string().min(1),
1270
- model: z.string().nullable(),
1271
- claims: z.array(NarrativeClaim).max(12)
786
+ var WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE = Object.freeze({
787
+ min: 1,
788
+ max: 5
1272
789
  });
1273
- var NarratorState = z.enum([
1274
- "disabled",
1275
- "pending",
1276
- "ready",
1277
- "failed"
1278
- ]);
1279
- var ChangeMap = z.strictObject({
1280
- sessionId: z.string().min(1),
1281
- sig: z.string().nullable(),
1282
- generatedAt: z.number().finite(),
1283
- repos: z.array(RepoChangeMap),
1284
- narrative: ChangeNarrative.nullable(),
1285
- narratorState: NarratorState,
1286
- error: z.string().min(1).optional()
790
+ var WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE = Object.freeze({
791
+ min: 1,
792
+ max: 50
1287
793
  });
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()
794
+ Object.freeze({
795
+ NON_NEGATIVE_NUMBER_RANGE,
796
+ FLYING_ANIMALS_GAP_RANGE,
797
+ FLYING_ANIMALS_DURATION_RANGE,
798
+ FLYING_ANIMALS_SCALE_RANGE,
799
+ CHANGE_MAP_NARRATOR_TIMEOUT_RANGE,
800
+ KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE,
801
+ PORT_RANGE,
802
+ POSTHOG_ESCALATION_RANGE,
803
+ POSTHOG_FIX_TIMEOUT_RANGE,
804
+ POSTHOG_INTERVAL_RANGE,
805
+ POSTHOG_INVESTIGATION_TIMEOUT_RANGE,
806
+ POSTHOG_MAX_CONCURRENT_RANGE,
807
+ POSTHOG_MIN_USERS_RANGE,
808
+ POSTHOG_TRAFFIC_BASELINE_RANGE,
809
+ POSTHOG_TRAFFIC_COOLDOWN_RANGE,
810
+ POSTHOG_TRAFFIC_MIN_USERS_RANGE,
811
+ POSTHOG_TRAFFIC_MULTIPLIER_RANGE,
812
+ REPLAY_BUFFER_KB_RANGE,
813
+ MEMORY_RESERVE_MB_RANGE,
814
+ TASK_TITLE_TIMEOUT_RANGE,
815
+ USAGE_BUDGET_RANGE,
816
+ USAGE_RETAIN_DAYS_RANGE,
817
+ USAGE_SCAN_INTERVAL_RANGE,
818
+ VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE,
819
+ VISIONS_COOLDOWN_MS_RANGE,
820
+ VISIONS_DISPATCH_TIMEOUT_RANGE,
821
+ VISIONS_INTENT_THREAD_TTL_MS_RANGE,
822
+ VISIONS_MAX_PER_HOUR_RANGE,
823
+ VISIONS_QUIET_MS_RANGE,
824
+ WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE,
825
+ WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE
1318
826
  });
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()
827
+ //#endregion
828
+ //#region shared/contracts/workflows.ts
829
+ var WORKFLOW_TRIGGERS = Object.freeze([
830
+ "opened",
831
+ "checks-failed",
832
+ "review-requested",
833
+ "approved",
834
+ "commented",
835
+ "merged"
836
+ ]);
837
+ var WORKFLOW_ACTION_TYPES = Object.freeze([
838
+ "notify",
839
+ "spawn",
840
+ "label",
841
+ "comment"
842
+ ]);
843
+ var WORKFLOW_PROMPT_TEMPLATE_MAX_CHARACTERS = 2e4;
844
+ var WORKFLOW_COMMENT_BODY_MAX_CHARACTERS = 65536;
845
+ var WORKFLOW_LABEL_NAME_MAX_CHARACTERS = 50;
846
+ var RULE_ID = /^[a-z0-9][a-z0-9-]{0,63}$/;
847
+ var UNSAFE_LABEL_NAME = /[\x00-\x1f\x7f,]|^-/;
848
+ var integerInRange = (field, range) => {
849
+ const message = `${field} must be an integer between ${range.min} and ${range.max}`;
850
+ return z.number({ error: message }).int({ error: message }).min(range.min, { error: message }).max(range.max, { error: message });
851
+ };
852
+ var workflowsEnabled = z.boolean({ error: "workflows.enabled must be a boolean" });
853
+ var workflowsMaxConcurrentSessions = integerInRange("workflows.maxConcurrentSessions", WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE);
854
+ var workflowsMaxActionsPerPoll = integerInRange("workflows.maxActionsPerPoll", WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE);
855
+ 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` });
856
+ 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" });
857
+ 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" });
858
+ var WorkflowTrigger = z.enum(WORKFLOW_TRIGGERS, { error: `workflows.rules[].trigger must be one of ${WORKFLOW_TRIGGERS.join(", ")}` });
859
+ var WorkflowAction = z.discriminatedUnion("type", [
860
+ z.strictObject({ type: z.literal("notify") }),
861
+ z.strictObject({
862
+ type: z.literal("spawn"),
863
+ 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" })
1387
864
  }),
1388
- z.looseObject({
1389
- ...recordHead,
1390
- kind: z.literal("acknowledgement"),
1391
- ...reference
865
+ z.strictObject({
866
+ type: z.literal("label"),
867
+ name: WorkflowLabelName
1392
868
  }),
1393
- z.looseObject({
1394
- ...recordHead,
1395
- kind: z.literal("enactment"),
1396
- practice: z.string(),
1397
- results: z.record(z.string(), z.unknown())
869
+ z.strictObject({
870
+ type: z.literal("comment"),
871
+ body: WorkflowCommentBody
1398
872
  })
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()
873
+ ], { error: `workflows.rules[].actions[].type must be one of ${WORKFLOW_ACTION_TYPES.join(", ")}` });
874
+ var WorkflowFilters = z.strictObject({
875
+ mine: z.boolean({ error: "workflows.rules[].filters.mine must be a boolean" }).optional(),
876
+ teamReviewRequested: z.boolean({ error: "workflows.rules[].filters.teamReviewRequested must be a boolean" }).optional(),
877
+ 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(),
878
+ labels: nonEmptyList("workflows.rules[].filters.labels", WorkflowLabelName).optional(),
879
+ 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()
880
+ }, { error: "workflows.rules[].filters must be an object" });
881
+ 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" });
882
+ var WorkflowRuleEnabled = z.boolean({ error: "workflows.rules[].enabled must be a boolean" });
883
+ var WorkflowRule = z.strictObject({
884
+ id: WorkflowRuleId,
885
+ 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" }),
886
+ enabled: WorkflowRuleEnabled.default(false),
887
+ repos: nonEmptyList("workflows.rules[].repos", repositoryName),
888
+ filters: WorkflowFilters.default({}),
889
+ trigger: WorkflowTrigger,
890
+ actions: nonEmptyList("workflows.rules[].actions", WorkflowAction)
891
+ }, { error: "workflows.rules[] must be an object" });
892
+ var WorkflowsSettings = z.strictObject({
893
+ enabled: workflowsEnabled.default(true),
894
+ maxConcurrentSessions: workflowsMaxConcurrentSessions.default(2),
895
+ maxActionsPerPoll: workflowsMaxActionsPerPoll.default(20),
896
+ rules: z.array(WorkflowRule, { error: "workflows.rules must be an array" }).default([])
897
+ }, { error: "workflows must be an object" }).superRefine((settings, ctx) => {
898
+ const claimedIds = /* @__PURE__ */ new Set();
899
+ for (const [index, rule] of settings.rules.entries()) {
900
+ if (!claimedIds.has(rule.id)) {
901
+ claimedIds.add(rule.id);
902
+ continue;
903
+ }
904
+ ctx.addIssue({
905
+ code: "custom",
906
+ path: [
907
+ "rules",
908
+ index,
909
+ "id"
910
+ ],
911
+ message: `workflows.rules[${index}].id "${rule.id}" is declared more than once`
912
+ });
913
+ }
1418
914
  });
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()
915
+ var WorkflowRuleToggle = z.strictObject({
916
+ id: WorkflowRuleId,
917
+ enabled: WorkflowRuleEnabled
918
+ }, { error: "a dashboard update of workflows.rules[] carries only id and enabled" });
919
+ var WorkflowsSettingsUpdate = z.strictObject({
920
+ enabled: workflowsEnabled.optional(),
921
+ maxConcurrentSessions: workflowsMaxConcurrentSessions.optional(),
922
+ maxActionsPerPoll: workflowsMaxActionsPerPoll.optional(),
923
+ rules: z.array(WorkflowRuleToggle, { error: "workflows.rules must be an array" }).optional()
924
+ }, { error: "a dashboard update of workflows carries only enabled, maxConcurrentSessions, maxActionsPerPoll and rule toggles" });
925
+ var nonnegativeInteger = z.number().int().nonnegative();
926
+ var checksState = z.enum([
927
+ "SUCCESS",
928
+ "FAILURE",
929
+ "PENDING",
930
+ "ERROR",
931
+ "EXPECTED"
932
+ ]).nullable();
933
+ var WorkflowSearchNode = MyPrSearchNode.extend({
934
+ author: z.object({ login: z.string() }).nullable(),
935
+ labels: z.object({ nodes: z.array(z.object({ name: z.string() })) }),
936
+ comments: z.object({ totalCount: nonnegativeInteger })
1429
937
  });
1430
- //#endregion
1431
- //#region shared/contracts/issues.ts
1432
- var IssueRepoSlug = z.string().regex(REPO_SLUG_RE);
1433
- var IssueKey = z.string().regex(new RegExp(`${REPO_SLUG_RE.source.slice(0, -1)}#[1-9][0-9]*$`));
1434
- var IssuePullRequest = z.object({
938
+ var WorkflowPr = z.strictObject({
939
+ repo: repositoryName,
1435
940
  number: z.number().int().positive(),
1436
- url: z.string().url(),
1437
941
  title: z.string(),
1438
- state: z.enum([
1439
- "open",
1440
- "draft",
1441
- "merged",
1442
- "closed"
1443
- ])
1444
- });
1445
- var GithubIssuePullRequestsRepository = z.object({ issue: z.object({ closedByPullRequestsReferences: z.object({ nodes: z.array(z.object({
1446
- number: IssuePullRequest.shape.number,
1447
- url: IssuePullRequest.shape.url,
1448
- title: IssuePullRequest.shape.title,
942
+ url: z.url(),
943
+ author: z.string().nullable(),
1449
944
  state: z.enum([
1450
945
  "OPEN",
1451
946
  "MERGED",
1452
947
  "CLOSED"
1453
948
  ]),
1454
- isDraft: z.boolean()
1455
- }).nullable()).max(5) }) }).nullable() });
1456
- var issueFields = {
1457
- key: z.string(),
1458
- repo: IssueRepoSlug,
1459
- number: z.number().int().positive(),
1460
- title: z.string(),
1461
- url: z.string().url(),
949
+ createdAt: z.string(),
950
+ mergedAt: z.string().nullable(),
951
+ isDraft: z.boolean(),
952
+ isCrossRepository: z.boolean(),
953
+ baseRefName: z.string(),
954
+ headRefName: z.string().min(1),
955
+ headRefOid: CommitSha,
1462
956
  labels: z.array(z.string()),
1463
- assignees: z.array(z.string()),
1464
- author: z.string(),
1465
- comments: z.number().int().nonnegative(),
1466
- createdAt: z.iso.datetime(),
1467
- updatedAt: z.iso.datetime()
1468
- };
1469
- var IssueSource = z.enum([
1470
- "project",
1471
- "me",
1472
- "team"
1473
- ]);
1474
- var cachedIssueFields = {
1475
- ...issueFields,
1476
- sources: z.array(IssueSource).nonempty().refine((sources) => new Set(sources).size === sources.length),
1477
- teams: z.array(IssueRepoSlug),
1478
- projectId: z.string().nullable(),
1479
- pullRequests: z.array(IssuePullRequest).max(5).default([])
1480
- };
1481
- var CachedIssueRow = z.object(cachedIssueFields).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
1482
- var IssueRow = z.object({
1483
- ...cachedIssueFields,
1484
- sessionId: z.string().nullable().default(null)
1485
- }).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
1486
- var IssueUpdate = z.object({
1487
- ...issueFields,
1488
- state: z.enum(["open", "closed"])
957
+ commentCount: nonnegativeInteger,
958
+ reviewRequests: z.array(z.string()),
959
+ checksState,
960
+ reviewDecision: z.enum([
961
+ "APPROVED",
962
+ "CHANGES_REQUESTED",
963
+ "REVIEW_REQUIRED"
964
+ ]).nullable()
1489
965
  });
1490
- var GithubIssueResponse = z.object({
1491
- number: issueFields.number,
1492
- title: issueFields.title,
1493
- html_url: issueFields.url,
1494
- state: z.enum(["open", "closed"]),
1495
- labels: z.array(z.union([z.string(), z.object({ name: z.string() })])),
1496
- assignees: z.array(z.object({ login: z.string() })),
1497
- user: z.object({ login: z.string() }).nullable(),
1498
- comments: issueFields.comments,
1499
- created_at: issueFields.createdAt,
1500
- updated_at: issueFields.updatedAt,
1501
- repository_url: z.string().url().optional(),
1502
- pull_request: z.unknown().optional()
966
+ var WorkflowRepoSnapshot = z.strictObject({
967
+ polledAtMs: nonnegativeInteger,
968
+ prs: z.array(WorkflowPr)
1503
969
  });
1504
- var IssuesSearchResponse = z.object({
1505
- items: z.array(z.unknown()),
1506
- total_count: z.number().int().nonnegative(),
1507
- incomplete_results: z.boolean()
970
+ var WorkflowsState = z.strictObject({ repos: z.record(z.string().regex(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/), WorkflowRepoSnapshot) });
971
+ //#endregion
972
+ //#region shared/contracts/github-prs.ts
973
+ var GithubPrKey = z.string().refine((key) => pullRequestKeyFormat.safeParse(key).success && key === key.toLowerCase() && Number.isSafeInteger(Number(key.slice(key.lastIndexOf("#") + 1))));
974
+ function comparablePrKey(pr) {
975
+ return `${pr.repo}#${pr.number}`.toLowerCase();
976
+ }
977
+ var GithubPrLightSearchNode = z.object({
978
+ repository: MyPrSearchNode.shape.repository.pick({ nameWithOwner: true }),
979
+ number: MyPrSearchNode.shape.number,
980
+ updatedAt: MyPrSearchNode.shape.updatedAt,
981
+ headRefOid: MyPrSearchNode.shape.headRefOid,
982
+ state: MyPrSearchNode.shape.state,
983
+ commits: z.object({ nodes: z.array(z.object({ commit: z.object({ statusCheckRollup: z.object({ state: MyPr.shape.checks.shape.state }).nullable() }) })) }),
984
+ reviewDecision: MyPrSearchNode.shape.reviewDecision,
985
+ mergeable: MyPrSearchNode.shape.mergeable
986
+ });
987
+ var GithubPrDetailNode = MyPrSearchNode.extend({
988
+ author: WorkflowSearchNode.shape.author.unwrap().extend({ __typename: z.string().optional() }).nullable(),
989
+ labels: WorkflowSearchNode.shape.labels,
990
+ comments: WorkflowSearchNode.shape.comments,
991
+ latestReviews: z.object({ nodes: z.array(MyPrSearchNode.shape.latestReviews.shape.nodes.element.extend({ commit: z.object({ oid: z.string() }).nullable().optional() })) }),
992
+ writerOpinionatedReviews: MyPrSearchNode.shape.latestOpinionatedReviews.optional()
993
+ });
994
+ var GithubPr = z.strictObject({
995
+ key: GithubPrKey,
996
+ id: MyPrSearchNode.shape.id,
997
+ repo: MyPr.shape.repo,
998
+ number: MyPr.shape.number,
999
+ title: MyPr.shape.title,
1000
+ url: MyPr.shape.url,
1001
+ author: WorkflowPr.shape.author,
1002
+ isAuthorBot: z.boolean(),
1003
+ labels: WorkflowPr.shape.labels,
1004
+ commentCount: WorkflowPr.shape.commentCount,
1005
+ isDraft: MyPr.shape.isDraft,
1006
+ state: MyPr.shape.state,
1007
+ createdAt: MyPr.shape.createdAt,
1008
+ mergedAt: MyPr.shape.mergedAt,
1009
+ updatedAt: MyPr.shape.updatedAt,
1010
+ baseRefName: MyPr.shape.baseRefName,
1011
+ baseRefOid: MyPr.shape.baseRefOid,
1012
+ headRefName: MyPr.shape.headRefName,
1013
+ headRefOid: MyPr.shape.headRefOid,
1014
+ isCrossRepository: MyPr.shape.isCrossRepository,
1015
+ isInMergeQueue: MyPr.shape.isInMergeQueue,
1016
+ mergeMethod: MyPr.shape.mergeMethod,
1017
+ mergeable: MyPr.shape.mergeable,
1018
+ mergeStateStatus: MyPr.shape.mergeStateStatus,
1019
+ reviewDecision: GithubReviewDecision.nullable(),
1020
+ checks: MyPr.shape.checks.strict(),
1021
+ rollupState: ReviewChecksState.nullable(),
1022
+ unresolvedThreads: MyPr.shape.unresolvedThreads,
1023
+ threads: z.array(MyPr.shape.threads.element.strict()),
1024
+ behindBy: MyPr.shape.behindBy,
1025
+ reviewRequests: z.array(MyPr.shape.reviewRequests.element.strict()),
1026
+ approvals: MyPr.shape.approvals,
1027
+ reviews: z.array(MyPr.shape.reviews.element.extend({ commit: CommitSha.nullable() }).strict()),
1028
+ opinionatedWriterReviewStates: z.array(z.string())
1029
+ }).refine((pr) => pr.key === comparablePrKey(pr));
1030
+ var GithubPrsFrame = z.looseObject({
1031
+ type: z.literal("github-prs"),
1032
+ ts: z.number().finite().nonnegative(),
1033
+ prs: z.record(GithubPrKey, GithubPr).refine((prs) => Object.entries(prs).every(([key, pr]) => key === pr.key)),
1034
+ freshness: GithubPrsFreshness
1035
+ });
1036
+ //#endregion
1037
+ //#region shared/contracts/benchmark.ts
1038
+ var BENCHMARK_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
1039
+ var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
1040
+ var repoSlug = z.string().regex(/^[^/\s]+\/[^/\s]+$/);
1041
+ var timestamp$1 = z.number().finite();
1042
+ var nonEmptyText = z.string().min(1);
1043
+ var BENCHMARK_INJECTED_ENV_NAMES = Object.freeze(["CLAUDE_CODE_OAUTH_TOKEN"]);
1044
+ var BenchmarkId = z.string().regex(BENCHMARK_ID_RE);
1045
+ function hasUniqueIds(entries) {
1046
+ return new Set(entries.map((entry) => entry.id)).size === entries.length;
1047
+ }
1048
+ var BenchmarkCaseSource = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
1049
+ kind: z.literal("github-merged-prs"),
1050
+ repo: repoSlug,
1051
+ minBodies: z.number().int().min(1),
1052
+ limit: z.number().int().min(1).max(500)
1053
+ })]);
1054
+ var BenchmarkWorkspace = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("none") }), z.strictObject({ kind: z.literal("pr-checkout") })]);
1055
+ var BenchmarkSubjectOutput = z.enum(["review-findings", "json"]);
1056
+ var BenchmarkSubject = z.strictObject({
1057
+ promptTemplate: nonEmptyText,
1058
+ output: BenchmarkSubjectOutput,
1059
+ timeoutSeconds: z.number().int().min(30).max(14400)
1060
+ });
1061
+ var BenchmarkArm = z.strictObject({
1062
+ id: BenchmarkId,
1063
+ env: z.record(z.string().regex(ENV_NAME_RE), z.string()).refine((env) => BENCHMARK_INJECTED_ENV_NAMES.every((name) => !Object.hasOwn(env, name)), { message: `arm env must not set ${BENCHMARK_INJECTED_ENV_NAMES.join(", ")}; Glimmervoid injects it per cell` }).optional(),
1064
+ extraArgs: z.array(z.string()).optional(),
1065
+ setup: z.strictObject({ command: z.array(nonEmptyText).min(1) }).optional()
1066
+ });
1067
+ var BenchmarkScorer = z.discriminatedUnion("kind", [z.strictObject({
1068
+ kind: z.literal("llm-judge-match"),
1069
+ model: nonEmptyText
1070
+ })]);
1071
+ var BenchmarkSuite = z.strictObject({
1072
+ id: BenchmarkId,
1073
+ title: nonEmptyText,
1074
+ caseSource: BenchmarkCaseSource,
1075
+ workspace: BenchmarkWorkspace,
1076
+ subject: BenchmarkSubject,
1077
+ arms: z.array(BenchmarkArm).min(2).refine(hasUniqueIds, { message: "arm ids must be unique" }),
1078
+ baselineArm: BenchmarkId,
1079
+ trials: z.number().int().min(1).max(20),
1080
+ scorer: BenchmarkScorer
1081
+ }).refine((suite) => suite.arms.some((arm) => arm.id === suite.baselineArm), {
1082
+ message: "baselineArm must name one of the arms",
1083
+ path: ["baselineArm"]
1508
1084
  });
1509
- z.object({
1510
- ok: z.boolean(),
1511
- items: z.array(IssueUpdate),
1512
- isComplete: z.boolean(),
1513
- error: z.string()
1085
+ var BenchmarkReference = z.strictObject({
1086
+ id: BenchmarkId,
1087
+ text: nonEmptyText,
1088
+ tags: z.array(BenchmarkId),
1089
+ path: nonEmptyText.optional(),
1090
+ line: z.number().int().positive().optional()
1514
1091
  });
1515
- var IssuesState = z.object({
1516
- issues: z.array(CachedIssueRow),
1517
- lastSyncAt: z.number().finite().nonnegative().nullable(),
1518
- perRepoSync: z.record(IssueRepoSlug, z.object({
1519
- lastSyncAt: z.number().finite().nonnegative().nullable(),
1520
- ticks: z.number().int().nonnegative(),
1521
- needsFullReconcile: z.boolean()
1522
- })),
1523
- sessionLinks: z.record(IssueKey, z.string()).default({}),
1524
- pullRequestsFetchedAt: z.record(IssueKey, z.iso.datetime()).default({})
1092
+ var BenchmarkCaseOrigin = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
1093
+ kind: z.literal("github-pr"),
1094
+ repo: repoSlug,
1095
+ number: z.number().int().positive(),
1096
+ url: nonEmptyText,
1097
+ minedAt: timestamp$1
1098
+ })]);
1099
+ var BenchmarkCase = z.strictObject({
1100
+ id: BenchmarkId,
1101
+ input: z.record(z.string(), z.unknown()),
1102
+ references: z.array(BenchmarkReference).min(1).refine(hasUniqueIds, { message: "reference ids must be unique" }),
1103
+ source: BenchmarkCaseOrigin
1525
1104
  });
1526
- var IssuesStatus = z.object({
1527
- type: z.literal("issues-status"),
1528
- ts: z.number().finite(),
1529
- configured: z.boolean(),
1530
- reason: z.string().nullable(),
1531
- lastSyncAt: z.number().finite().nonnegative().nullable(),
1532
- issues: z.array(IssueRow),
1533
- ...githubPollingShape
1534
- }).passthrough();
1535
- var PLAN_FEEDBACK_MAX_CHARS = 2e4;
1536
- var PLAN_COMMENT_MAX_CHARS = 4e3;
1537
- var PLAN_BODY_CAP_BYTES = 524288;
1538
- var PLAN_HOOK_OUTPUT_MAX_CHARS = 1e4;
1539
- var PLAN_HOOK_EVENT = "permissionrequest-plan";
1540
- var PLAN_RESULT_HOOK_EVENT = "posttooluse-plan";
1541
- var PLAN_TOOL_NAME = "ExitPlanMode";
1542
- var HEADING_SCAN_MAX_CHARS = 4096;
1543
- var ATX_HEADING = /^ {0,3}(#{1,6})[ \t]+(.*)$/;
1544
- function capPlanTitle(text) {
1545
- const trimmed = text.trim();
1546
- if (trimmed.length <= 120) return trimmed;
1547
- return trimmed.slice(0, 120);
1548
- }
1549
- function withoutClosingHeadingMarks(text) {
1550
- const trimmed = text.trimEnd();
1551
- let textEnd = trimmed.length;
1552
- while (textEnd > 0 && trimmed[textEnd - 1] === "#") textEnd--;
1553
- if (textEnd === trimmed.length || textEnd === 0) return trimmed;
1554
- const charBeforeMarks = trimmed[textEnd - 1];
1555
- if (charBeforeMarks !== " " && charBeforeMarks !== " ") return trimmed;
1556
- return trimmed.slice(0, textEnd).trimEnd();
1557
- }
1558
- function parseAtxHeading(line, { overlongLine }) {
1559
- if (overlongLine === "reject" && line.length > 4096) return null;
1560
- const heading = ATX_HEADING.exec(line.slice(0, HEADING_SCAN_MAX_CHARS));
1561
- if (!heading) return null;
1562
- return {
1563
- level: heading[1].length,
1564
- text: withoutClosingHeadingMarks(heading[2])
1565
- };
1566
- }
1567
- function headingTitle(line) {
1568
- return parseAtxHeading(line, { overlongLine: "truncate" })?.text ?? "";
1569
- }
1570
- function planTitle(plan) {
1571
- const lines = typeof plan === "string" ? plan.split(/\r?\n/) : [];
1572
- for (const line of lines) {
1573
- const title = headingTitle(line);
1574
- if (title.length > 0) return capPlanTitle(title);
1575
- }
1576
- return capPlanTitle(lines.find((line) => line.trim().length > 0) ?? "");
1577
- }
1578
- var ExitPlanModeInput = z.object({
1579
- plan: z.string().min(1),
1580
- planFilePath: z.string().min(1),
1581
- agent_id: z.string().min(1).optional(),
1582
- agent_type: z.string().min(1).optional()
1583
- }).passthrough();
1584
- var ExitPlanModeHookPayload = z.object({
1585
- tool_name: z.literal(PLAN_TOOL_NAME),
1586
- tool_input: ExitPlanModeInput,
1587
- agent_id: z.string().min(1).optional(),
1588
- agent_type: z.string().min(1).optional()
1589
- }).passthrough();
1590
- var ExitPlanModeRequest = z.object({
1591
- plan: z.string(),
1592
- planFilePath: z.string(),
1593
- agentId: z.string().nullable(),
1594
- agentType: z.string().nullable()
1105
+ var PrCheckoutCaseInput = z.object({
1106
+ repo: repoSlug,
1107
+ number: z.number().int().positive(),
1108
+ reviewedSha: CommitSha,
1109
+ baseSha: CommitSha,
1110
+ changedFiles: z.array(nonEmptyText)
1595
1111
  });
1596
- function parseExitPlanModeHookPayload(body) {
1597
- const parsed = ExitPlanModeHookPayload.safeParse(body);
1598
- if (!parsed.success) return null;
1599
- const input = parsed.data.tool_input;
1600
- return {
1601
- plan: input.plan,
1602
- planFilePath: input.planFilePath,
1603
- agentId: parsed.data.agent_id ?? input.agent_id ?? null,
1604
- agentType: parsed.data.agent_type ?? input.agent_type ?? null
1605
- };
1606
- }
1607
- var PlanRevision = ExitPlanModeRequest.extend({
1608
- sessionId: z.string().min(1),
1609
- revision: z.number().int().positive(),
1610
- receivedAt: z.number().finite()
1112
+ var BenchmarkMatchVerdict = z.enum([
1113
+ "found",
1114
+ "partial",
1115
+ "missed"
1116
+ ]);
1117
+ var BenchmarkJudgement = z.strictObject({
1118
+ referenceId: BenchmarkId,
1119
+ verdict: BenchmarkMatchVerdict,
1120
+ findingIndexes: z.array(z.number().int().nonnegative())
1611
1121
  });
1612
- var PLAN_REVIEW_STATE_VALUES = Object.freeze([
1613
- "open",
1614
- "released",
1615
- "decided",
1616
- "closed"
1122
+ var BenchmarkCellStatus = z.enum([
1123
+ "scored",
1124
+ "invalid",
1125
+ "error"
1617
1126
  ]);
1618
- var PlanReviewStateValue = z.enum(PLAN_REVIEW_STATE_VALUES);
1619
- var PLAN_DECISION_KINDS = Object.freeze([
1620
- "approve",
1621
- "approve-accept-edits",
1622
- "revise",
1623
- "terminal"
1127
+ var BenchmarkCellResult = z.strictObject({
1128
+ caseId: BenchmarkId,
1129
+ armId: BenchmarkId,
1130
+ trial: z.number().int().min(1),
1131
+ status: BenchmarkCellStatus,
1132
+ startedAt: timestamp$1,
1133
+ finishedAt: timestamp$1,
1134
+ degradedReasons: z.array(nonEmptyText),
1135
+ findingCount: z.number().int().nonnegative(),
1136
+ judgements: z.array(BenchmarkJudgement),
1137
+ costUsd: z.number().finite().nonnegative().nullable(),
1138
+ error: nonEmptyText.nullable()
1139
+ });
1140
+ var BenchmarkRunStatus = z.enum([
1141
+ "running",
1142
+ "completed",
1143
+ "interrupted",
1144
+ "failed"
1624
1145
  ]);
1625
- var PlanDecisionKind = z.enum(PLAN_DECISION_KINDS);
1626
- var PlanSectionComment = z.object({
1627
- heading: z.string().max(PLAN_COMMENT_MAX_CHARS).nullable(),
1628
- comment: z.string().min(1).max(PLAN_COMMENT_MAX_CHARS)
1146
+ var BenchmarkRun = z.strictObject({
1147
+ id: BenchmarkId,
1148
+ suiteId: BenchmarkId,
1149
+ status: BenchmarkRunStatus,
1150
+ startedAt: timestamp$1,
1151
+ finishedAt: timestamp$1.nullable(),
1152
+ error: nonEmptyText.nullable(),
1153
+ cells: z.array(BenchmarkCellResult)
1629
1154
  });
1630
- var PlanDecision = z.object({
1631
- id: z.string().min(1),
1632
- agentId: z.string().nullable(),
1633
- revision: z.number().int().positive(),
1634
- decision: PlanDecisionKind,
1635
- feedback: z.string().max(PLAN_FEEDBACK_MAX_CHARS).optional(),
1636
- comments: z.array(PlanSectionComment).max(40).optional(),
1637
- plan: z.string().min(1).max(PLAN_BODY_CAP_BYTES).optional()
1155
+ var nullableRatio = z.number().min(0).max(1).nullable();
1156
+ var BenchmarkArmScore = z.strictObject({
1157
+ trials: z.number().int().nonnegative(),
1158
+ recall: nullableRatio,
1159
+ recallByTag: z.record(BenchmarkId, nullableRatio),
1160
+ degraded: z.number().int().nonnegative(),
1161
+ invalid: z.number().int().nonnegative(),
1162
+ costUsd: z.number().finite().nonnegative().nullable()
1638
1163
  });
1639
- var PlanRevisionSummary = z.object({
1640
- revision: z.number().int().positive(),
1641
- receivedAt: z.number().finite(),
1642
- chars: z.number().int().nonnegative(),
1643
- title: z.string()
1164
+ var BenchmarkReportRow = z.strictObject({
1165
+ caseId: BenchmarkId,
1166
+ arms: z.record(BenchmarkId, BenchmarkArmScore),
1167
+ deltaVsBaseline: z.record(BenchmarkId, z.number().min(-1).max(1).nullable())
1644
1168
  });
1645
- var PlanReviewOpenRevision = z.object({
1646
- revision: z.number().int().positive(),
1647
- since: z.number().finite()
1169
+ var BenchmarkReport = z.strictObject({
1170
+ runId: BenchmarkId,
1171
+ suiteId: BenchmarkId,
1172
+ status: BenchmarkRunStatus,
1173
+ baselineArm: BenchmarkId,
1174
+ armIds: z.array(BenchmarkId),
1175
+ rows: z.array(BenchmarkReportRow),
1176
+ totals: z.record(BenchmarkId, BenchmarkArmScore)
1648
1177
  });
1649
- var PlanReview = z.object({
1650
- agentId: z.string().nullable(),
1651
- agentType: z.string().nullable(),
1652
- revisions: z.array(PlanRevisionSummary),
1653
- state: PlanReviewStateValue,
1654
- openRevision: PlanReviewOpenRevision.nullable(),
1655
- approvedRevision: z.number().int().positive().nullable(),
1656
- lastDecision: PlanDecisionKind.nullable()
1178
+ var BenchmarkAction = z.enum([
1179
+ "mine",
1180
+ "run",
1181
+ "cancel"
1182
+ ]);
1183
+ var BenchmarkActionRequest = z.object({
1184
+ suiteId: BenchmarkId,
1185
+ action: BenchmarkAction
1657
1186
  });
1658
- z.object({ reviews: z.array(PlanReview) });
1659
- var PlanRevisionBody = z.object({
1660
- agentId: z.string().nullable(),
1661
- revision: z.number().int().nonnegative(),
1662
- plan: z.string(),
1663
- planFilePath: z.string(),
1664
- receivedAt: z.number().finite()
1187
+ var BenchmarkActionResult = z.object({
1188
+ suiteId: BenchmarkId,
1189
+ action: BenchmarkAction,
1190
+ ok: z.boolean(),
1191
+ error: z.string().optional(),
1192
+ runId: BenchmarkId.optional()
1665
1193
  });
1666
- var PlanChangedPush = z.object({
1667
- id: z.string(),
1668
- agentId: z.string().nullable(),
1669
- agentType: z.string().nullable(),
1670
- revision: z.number().int().positive(),
1671
- receivedAt: z.number().finite(),
1672
- state: PlanReviewStateValue,
1673
- lastDecision: PlanDecisionKind.nullable(),
1674
- approvedRevision: z.number().int().positive().nullable(),
1675
- chars: z.number().int().nonnegative(),
1194
+ var BenchmarkCellPhase = z.enum([
1195
+ "setup",
1196
+ "preflight",
1197
+ "workspace",
1198
+ "subject",
1199
+ "judge"
1200
+ ]);
1201
+ var BenchmarkInFlightCell = z.object({
1202
+ suiteId: BenchmarkId,
1203
+ runId: BenchmarkId,
1204
+ caseId: BenchmarkId.nullable(),
1205
+ armId: BenchmarkId,
1206
+ trial: z.number().int().min(1),
1207
+ phase: BenchmarkCellPhase,
1208
+ cellIndex: z.number().int().nonnegative(),
1209
+ cellCount: z.number().int().positive(),
1210
+ startedAt: timestamp$1
1211
+ });
1212
+ var BenchmarkSuiteSummary = z.object({
1213
+ id: BenchmarkId,
1676
1214
  title: z.string(),
1677
- hasPlan: z.boolean()
1215
+ error: z.string().nullable(),
1216
+ caseCount: z.number().int().nonnegative(),
1217
+ candidateCount: z.number().int().nonnegative(),
1218
+ armIds: z.array(BenchmarkId),
1219
+ baselineArm: BenchmarkId.nullable(),
1220
+ latestReport: BenchmarkReport.nullable()
1678
1221
  });
1679
- var PlanDraftPush = z.object({
1680
- id: z.string(),
1681
- agentId: z.string().nullable(),
1682
- planFilePath: z.string(),
1683
- changedAt: z.number().finite()
1222
+ var BenchmarkStatus = z.object({
1223
+ type: z.literal("benchmark-status"),
1224
+ ts: timestamp$1,
1225
+ configured: z.boolean(),
1226
+ reason: z.string().nullable(),
1227
+ suites: z.array(BenchmarkSuiteSummary),
1228
+ inFlight: BenchmarkInFlightCell.nullable()
1229
+ }).passthrough();
1230
+ var githubAuthor = z.object({
1231
+ __typename: z.string(),
1232
+ login: z.string()
1233
+ }).nullable();
1234
+ var MergedPrListing = z.object({
1235
+ number: z.number().int().positive(),
1236
+ title: z.string(),
1237
+ url: nonEmptyText,
1238
+ mergedAt: z.string().nullable(),
1239
+ reviewThreads: z.object({ totalCount: z.number().int().nonnegative() }),
1240
+ reviews: z.object({ totalCount: z.number().int().nonnegative() })
1684
1241
  });
1685
- var PlanResponseFrame = z.object({
1686
- id: z.string(),
1687
- reviews: z.array(PlanReview),
1688
- body: PlanRevisionBody.nullable()
1242
+ var MinedReviewThread = z.object({
1243
+ path: z.string(),
1244
+ line: z.number().int().positive().nullable(),
1245
+ originalLine: z.number().int().positive().nullable(),
1246
+ comments: z.object({ nodes: z.array(z.object({
1247
+ databaseId: z.number().int().positive(),
1248
+ author: githubAuthor,
1249
+ body: z.string(),
1250
+ createdAt: z.string(),
1251
+ originalCommit: z.object({ oid: CommitSha }).nullable()
1252
+ })) })
1689
1253
  });
1690
- //#endregion
1691
- //#region shared/contracts/trace.ts
1692
- var MAX_RAW_LINE_CHARS = 4e3;
1693
- var TraceRecordBase = z.object({
1694
- ts: z.number().finite(),
1695
- uuid: z.string().nullable(),
1696
- parentUuid: z.string().nullable(),
1697
- vendorSessionId: z.string().min(1),
1698
- agentId: z.string().min(1).optional(),
1699
- agentType: z.string().min(1).optional(),
1700
- transcriptOffset: z.number().int().nonnegative().optional(),
1701
- truncated: z.boolean().optional()
1254
+ var MinedReview = z.object({
1255
+ databaseId: z.number().int().positive(),
1256
+ author: githubAuthor,
1257
+ body: z.string(),
1258
+ submittedAt: z.string().nullable(),
1259
+ commit: z.object({ oid: CommitSha }).nullable()
1702
1260
  });
1703
- var TraceRecord = z.discriminatedUnion("kind", [
1704
- TraceRecordBase.extend({
1705
- kind: z.literal("prompt"),
1706
- text: z.string()
1707
- }),
1708
- TraceRecordBase.extend({
1709
- kind: z.literal("expansion"),
1710
- text: z.string(),
1711
- toolUseId: z.string().min(1).optional()
1712
- }),
1713
- TraceRecordBase.extend({
1714
- kind: z.literal("thinking"),
1715
- text: z.string()
1716
- }),
1717
- TraceRecordBase.extend({
1718
- kind: z.literal("assistant"),
1719
- text: z.string()
1720
- }),
1721
- TraceRecordBase.extend({
1722
- kind: z.literal("tool_call"),
1723
- toolUseId: z.string().min(1),
1724
- name: z.string().min(1),
1725
- input: z.unknown()
1726
- }),
1727
- TraceRecordBase.extend({
1728
- kind: z.literal("tool_result"),
1729
- toolUseId: z.string().min(1),
1730
- content: z.string(),
1731
- isError: z.boolean(),
1732
- truncated: z.boolean()
1733
- }),
1734
- TraceRecordBase.extend({
1735
- kind: z.literal("session"),
1736
- vendor: z.string().min(1),
1737
- transcriptPath: z.string().min(1),
1738
- reason: z.string().min(1).optional()
1261
+ var MinedBaseEvent = z.discriminatedUnion("__typename", [z.object({
1262
+ __typename: z.literal("BaseRefChangedEvent"),
1263
+ createdAt: z.string()
1264
+ }), z.object({
1265
+ __typename: z.literal("BaseRefForcePushedEvent"),
1266
+ createdAt: z.string(),
1267
+ beforeCommit: z.object({ oid: CommitSha }).nullable()
1268
+ })]);
1269
+ var MinedPrReviewData = z.object({
1270
+ author: githubAuthor,
1271
+ baseRefOid: CommitSha,
1272
+ reviewThreads: z.object({
1273
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
1274
+ nodes: z.array(MinedReviewThread)
1739
1275
  }),
1740
- TraceRecordBase.extend({
1741
- kind: z.literal("notice"),
1742
- text: z.string().max(MAX_RAW_LINE_CHARS)
1276
+ reviews: z.object({
1277
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
1278
+ nodes: z.array(MinedReview)
1743
1279
  }),
1744
- TraceRecordBase.extend({
1745
- kind: z.literal("raw"),
1746
- line: z.string().max(MAX_RAW_LINE_CHARS)
1280
+ timelineItems: z.object({
1281
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
1282
+ nodes: z.array(MinedBaseEvent)
1747
1283
  })
1748
- ]);
1749
- var TraceCheckpoint = z.object({
1750
- transcriptPath: z.string().min(1),
1751
- vendorSessionId: z.string().min(1),
1752
- offset: z.number().int().nonnegative(),
1753
- ingestedSubagentPaths: z.array(z.string().min(1)),
1754
- offsetByTranscriptPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({}),
1755
- subagentOffsetByPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({})
1756
- });
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
1284
  });
1777
- //#endregion
1778
- //#region shared/contracts/update-journal.ts
1779
- var UpdateChannel = z.enum(["release", "main"]);
1780
- var UpdateRunState = z.enum([
1781
- "idle",
1782
- "running",
1783
- "staged",
1784
- "succeeded",
1785
- "failed",
1786
- "discarded",
1787
- "interrupted"
1788
- ]);
1789
- var UpdateStepId = z.enum([
1790
- "fetch",
1791
- "stage",
1792
- "install",
1793
- "link-deps",
1794
- "build"
1795
- ]);
1796
- var UpdateStepStatus = z.enum([
1797
- "pending",
1798
- "running",
1799
- "succeeded",
1800
- "failed"
1801
- ]);
1802
- var UpdateJournalStep = z.object({
1803
- id: UpdateStepId,
1804
- status: UpdateStepStatus,
1805
- startedAt: z.number().finite().nullable(),
1806
- finishedAt: z.number().finite().nullable(),
1807
- outputTail: z.array(z.string())
1808
- }).strict();
1809
- var UpdateJournal = z.object({
1810
- state: UpdateRunState,
1811
- fromSha: z.string().nullable(),
1812
- toSha: z.string().nullable(),
1813
- toVersion: z.string().nullable(),
1814
- channel: UpdateChannel,
1815
- steps: z.array(UpdateJournalStep),
1816
- activeStep: UpdateStepId.nullable(),
1817
- reason: z.string().nullable(),
1818
- startedAt: z.number().finite().nullable(),
1819
- finishedAt: z.number().finite().nullable(),
1820
- failedAtHandOff: z.boolean().optional()
1821
- }).strict();
1822
- var UpdateJournalSummary = UpdateJournal.pick({
1823
- state: true,
1824
- activeStep: true,
1825
- reason: true,
1826
- startedAt: true,
1827
- finishedAt: true
1285
+ var CommitComparison = z.object({
1286
+ mergeBaseSha: CommitSha,
1287
+ changedFiles: z.array(nonEmptyText),
1288
+ isFileListComplete: z.boolean()
1828
1289
  });
1829
1290
  //#endregion
1830
1291
  //#region shared/contracts/control-messages.ts
1831
1292
  var requestId = z.string().nullable().optional();
1832
1293
  var sessionId = z.string();
1833
1294
  var PullRequestKey = SessionPrLinks.shape.unlinkedKeys.unwrap().element;
1295
+ var GITHUB_PULL_REQUEST_URL_RE = /^https:\/\/github\.com\/([^/\s]+\/[^/\s]+)\/pull\/([0-9]+)(?:[/?#].*)?$/i;
1296
+ function pullRequestKeyFromReference(reference) {
1297
+ const trimmedReference = reference.trim();
1298
+ const urlMatch = GITHUB_PULL_REQUEST_URL_RE.exec(trimmedReference);
1299
+ const candidateKey = urlMatch ? `${urlMatch[1]}#${urlMatch[2]}` : trimmedReference;
1300
+ const parsedKey = PullRequestKey.safeParse(candidateKey);
1301
+ return parsedKey.success ? parsedKey.data : null;
1302
+ }
1834
1303
  function loose(type, shape) {
1835
1304
  return z.looseObject({
1836
1305
  type: z.literal(type),
@@ -1848,11 +1317,14 @@ var opaqueObject = openObject();
1848
1317
  var opaqueArray = z.array(z.unknown());
1849
1318
  var planRevisionNumber = z.number().int().positive();
1850
1319
  var sessionDocPath = z.string().min(1).max(SESSION_DOC_PATH_MAX_CHARS);
1851
- var trailSteps = z.array(openObject({
1320
+ var trailSteps = z.array(z.union([openObject({
1852
1321
  at: timestamp,
1853
1322
  tool: z.string(),
1854
1323
  detail: z.string()
1855
- }));
1324
+ }), openObject({
1325
+ at: timestamp,
1326
+ note: z.string()
1327
+ })]));
1856
1328
  z.object({
1857
1329
  id: z.string(),
1858
1330
  label: z.string(),
@@ -2703,6 +2175,7 @@ var serverVariants = [
2703
2175
  TeamReviewStatus,
2704
2176
  BenchmarkStatus,
2705
2177
  MyPrsStatus,
2178
+ GithubPrsFrame,
2706
2179
  IssuesStatus,
2707
2180
  loose("usage-sessions", {
2708
2181
  ts: timestamp,
@@ -2795,71 +2268,5 @@ var serverVariants = [
2795
2268
  loose("restarting")
2796
2269
  ];
2797
2270
  z.discriminatedUnion("type", serverVariants);
2798
- var viewerCols = z.number().int().min(1).max(500);
2799
- var viewerRows = z.number().int().min(1).max(200);
2800
- var DataClientMessage = z.discriminatedUnion("type", [
2801
- z.object({
2802
- type: z.literal("input"),
2803
- data: z.string()
2804
- }),
2805
- z.object({
2806
- type: z.literal("claim"),
2807
- cols: viewerCols,
2808
- rows: viewerRows
2809
- }),
2810
- z.object({ type: z.literal("unview") })
2811
- ]);
2812
- z.object({
2813
- type: z.literal("pty-size"),
2814
- cols: viewerCols,
2815
- rows: viewerRows,
2816
- seq: z.number().int().nonnegative()
2817
- });
2818
- var DATA_ATTACH_HISTORY_PARAM = "history";
2819
- var DEEP_HISTORY_SCROLLBACK_LINES = 5e3;
2820
- var DataAttachHistory = z.enum(["screen", "deep"]);
2821
- function decodeJson(raw) {
2822
- try {
2823
- return JSON.parse(raw);
2824
- } catch {
2825
- return null;
2826
- }
2827
- }
2828
- function parseDataClientMessage(raw) {
2829
- const parsed = DataClientMessage.safeParse(decodeJson(raw));
2830
- if (!parsed.success) return null;
2831
- return parsed.data;
2832
- }
2833
- function parseDataAttachHistory(rawUrl) {
2834
- if (typeof rawUrl !== "string") return "screen";
2835
- const queryAt = rawUrl.indexOf("?");
2836
- if (queryAt === -1) return "screen";
2837
- const query = new URLSearchParams(rawUrl.slice(queryAt + 1).split("#")[0]);
2838
- const parsed = DataAttachHistory.safeParse(query.get(DATA_ATTACH_HISTORY_PARAM));
2839
- if (!parsed.success) return "screen";
2840
- return parsed.data;
2841
- }
2842
- //#endregion
2843
- //#region shared/contracts/hooks.ts
2844
- var HTTP_URL_RE = /^https?:\/\/\S+$/i;
2845
- var HookPayload = z.record(z.string(), z.unknown());
2846
- var HookEnvelope = z.object({
2847
- glimmervoidId: z.string().min(1),
2848
- event: z.string().min(1),
2849
- token: z.string().nullable().optional(),
2850
- payload: HookPayload
2851
- });
2852
- z.object({
2853
- id: z.string().min(1),
2854
- name: z.string().min(1),
2855
- event: z.string().min(1),
2856
- matcher: z.string().optional(),
2857
- type: z.enum(["command", "http"]),
2858
- command: z.string().optional(),
2859
- url: z.string().optional(),
2860
- timeout: z.number().int().positive().optional(),
2861
- enabled: z.boolean(),
2862
- projects: z.array(z.string()).optional()
2863
- }).passthrough();
2864
2271
  //#endregion
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 };
2272
+ export { USAGE_BUDGET_RANGE as $, FLYING_ANIMALS_DEFAULTS as A, IssueKey as At, POSTHOG_FIX_TIMEOUT_RANGE as B, WorkflowLabelName as C, PLAN_TOOL_NAME as Ct, BRANCH_GC_INTERVAL_MS_RANGE as D, planTitle as Dt, WorkflowsState as E, parseExitPlanModeHookPayload as Et, MEMORY_RESERVE_MB_RANGE as F, issuePullRequestStateFromGithub as Ft, POSTHOG_RECURRENCE_WINDOW_RANGE as G, POSTHOG_INVESTIGATION_TIMEOUT_RANGE as H, NON_NEGATIVE_NUMBER_RANGE as I, POSTHOG_TRAFFIC_MIN_USERS_RANGE as J, POSTHOG_TRAFFIC_BASELINE_RANGE as K, PORT_RANGE as L, FLYING_ANIMALS_GAP_RANGE as M, IssuesSearchResponse as Mt, FLYING_ANIMALS_SCALE_RANGE as N, IssuesState as Nt, BRANCH_GC_STALE_DAYS_RANGE as O, GithubIssuePullRequestsRepository as Ot, KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE as P, IssuesStatus as Pt, TASK_TITLE_TIMEOUT_RANGE as Q, POSITIVE_NUMBER_RANGE as R, WorkflowCommentBody as S, PLAN_RESULT_HOOK_EVENT as St, WorkflowsSettingsUpdate as T, PlanRevision as Tt, POSTHOG_MAX_CONCURRENT_RANGE as U, POSTHOG_INTERVAL_RANGE as V, POSTHOG_MIN_USERS_RANGE as W, POSTHOG_TRANSIENT_RECURRENCE_RANGE as X, POSTHOG_TRAFFIC_MULTIPLIER_RANGE as Y, REPLAY_BUFFER_KB_RANGE as Z, GithubPrDetailNode as _, ChangeMap as _t, pullRequestKeyFromReference as a, VISIONS_DISPATCH_TIMEOUT_RANGE as at, GithubPrsFrame as b, PLAN_HOOK_EVENT as bt, BenchmarkId as c, VISIONS_QUIET_MS_RANGE as ct, BenchmarkStatus as d, UpdateJournal as dt, USAGE_INTEGER_RANGES as et, BenchmarkSuite as f, SessionSetup as ft, PrCheckoutCaseInput as g, CoherenceJournalOutput as gt, MinedPrReviewData as h, TraceRecord as ht, InstallFlavor as i, VISIONS_COOLDOWN_MS_RANGE as it, FLYING_ANIMALS_DURATION_RANGE as j, IssueUpdate as jt, CHANGE_MAP_NARRATOR_TIMEOUT_RANGE as k, GithubIssueResponse as kt, BenchmarkJudgement as l, WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE as lt, MergedPrListing as m, TraceCheckpoint as mt, ClientMessage as n, USAGE_SCAN_INTERVAL_RANGE as nt, BenchmarkActionRequest as o, VISIONS_INTENT_THREAD_TTL_MS_RANGE as ot, CommitComparison as p, MAX_RAW_LINE_CHARS as pt, POSTHOG_TRAFFIC_COOLDOWN_RANGE as q, DIFF_ANNOTATION_NOTE_MAX_CHARS as r, VISIONS_ACTIVITY_MAX_PER_HOUR_RANGE as rt, BenchmarkCase as s, VISIONS_MAX_PER_HOUR_RANGE as st, CONTROL_FRAME_MAX_BYTES as t, USAGE_RETAIN_DAYS_RANGE as tt, BenchmarkRun as u, WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE as ut, GithubPrKey as v, changeMapFactId as vt, WorkflowsSettings as w, PlanDecision as wt, comparablePrKey as x, PLAN_HOOK_OUTPUT_MAX_CHARS as xt, GithubPrLightSearchNode as y, PLAN_BODY_CAP_BYTES as yt, POSTHOG_ESCALATION_RANGE as z };