glimmervoid 0.38.2 → 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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/glimmervoid.js +33 -42
  3. package/dist/chunks/{adapters-CAHxZYT3.js → adapters-B6tbX3Aj.js} +27 -14
  4. package/dist/chunks/{adapters-DDjC7_vG.js → adapters-CXQfLoyj.js} +1 -1
  5. package/dist/chunks/agent-api-cli-BBech5lF.js +1 -0
  6. package/dist/chunks/{agent-api-cli-B5Tm0wXO.js → agent-api-cli-BNHJTmNW.js} +44 -77
  7. package/dist/chunks/agent-api-core-DDrJQEdE.js +304 -0
  8. package/dist/chunks/{agent-setup-cli-DmMfCw5O.js → agent-setup-cli-CeBBwKuL.js} +2 -2
  9. package/dist/chunks/config-store-BZpN2djp.js +1 -0
  10. package/dist/chunks/{config-store-BUNZs4j7.js → config-store-DqMScSdg.js} +82 -268
  11. package/dist/chunks/contracts-CloExMlS.js +680 -0
  12. package/dist/chunks/{contracts-HVCEJfxs.js → control-messages-DpBaniJi.js} +1275 -1021
  13. package/dist/chunks/{git-version-rWZjF2Px.js → git-version-CJQMfxtZ.js} +2 -2
  14. package/dist/chunks/{grok-B6bsCgdd.js → grok-BLzhApwT.js} +7 -8
  15. package/dist/chunks/{guardrails-deps-Cb-ki4EU.js → guardrails-deps-CLxK4J-g.js} +1 -1
  16. package/dist/chunks/{json-file-CIJf0Cel.js → json-file-DFCTvPjj.js} +3 -7
  17. package/dist/chunks/{main-BNSbP-Yk.js → main-DDU8IvFD.js} +28791 -31978
  18. package/dist/chunks/{pair-cli-DNp8i5L4.js → pair-cli-CsOVTQGJ.js} +2 -2
  19. package/dist/chunks/{remote-config-C_s2pnLC.js → remote-config-HlABuLTp.js} +2 -2
  20. package/dist/chunks/{session-BlT68ppa.js → session-BwB43SCa.js} +119 -71
  21. package/dist/chunks/{session-routes-CT1JrjoT.js → session-routes-DNJzsckH.js} +25 -10
  22. package/dist/chunks/{settings-cli-BbzxCyG5.js → settings-cli-DkkbK-dj.js} +30 -156
  23. package/dist/chunks/settings-readout-core-DrXT4aWm.js +201 -0
  24. package/dist/chunks/{ssh-sign-cli-C74BGTQS.js → ssh-sign-cli-CYeKRevK.js} +2 -2
  25. package/dist/client/assets/index-BK9jLR47.js +148 -0
  26. package/dist/client/assets/index-CU_uqJmi.css +2 -0
  27. package/dist/client/assets/xterm-kR64YvZ-.js +79 -0
  28. package/dist/client/assets/zod-BRLv4KqJ.js +55 -0
  29. package/dist/client/index.html +7 -3
  30. package/dist/scripts/postinstall-path-check.js +21 -3
  31. package/dist/server/index.js +1 -1
  32. package/package.json +3 -4
  33. package/dist/chunks/agent-api-cli-BDu1CxZf.js +0 -1
  34. package/dist/chunks/agent-api-core-B_mUSenR.js +0 -341
  35. package/dist/chunks/browser-config-BrBT8269.js +0 -762
  36. package/dist/chunks/config-CjawSOBk.js +0 -219
  37. package/dist/chunks/config-store-MAVQhGMh.js +0 -1
  38. package/dist/chunks/factory-D7ryES9n.js +0 -240
  39. package/dist/chunks/knowledge-graph-cli-ByUJoKw_.js +0 -1354
  40. package/dist/client/assets/index-B5uVtedd.css +0 -1
  41. package/dist/client/assets/index-b13-NGGS.js +0 -275
@@ -1,525 +1,268 @@
1
- import { $ as SessionPrLinks, A as SessionState, B as MyPrKeepMergeableResult, F as LinkedPr, Ft as REPO_SLUG_RE, G as MyPrMergeWhenReadyRequest, H as MyPrMergeRequest, K as MyPrMergeWhenReadyResult, Lt as GithubPollingRefreshRequest, O as SessionDoc, Ot as hasRequiredActionHead, P as TaskTitle, Q as MyPrsStatus, Rt as GithubPollingRefreshResult, St as TeamReviewStatus, T as SESSION_DOC_PATH_MAX_CHARS, U as MyPrMergeResult, _ as ConversationApproval, _t as TeamReviewActionRequest, g as ConversationAnswers, k as SessionSnapshot, tt as CommitSha, v as ConversationApprovalDecision, vt as TeamReviewActionResult, x as PendingWakeup, z as MyPrKeepMergeableRequest, zt as githubPollingShape } from "./session-BlT68ppa.js";
2
- import "./browser-config-BrBT8269.js";
3
- import { _ as isSingleFactoryPathSegment, a as FactoryControlRequest, d as FactoryQueueIntentRequest, f as FactoryQueueIntentResult, h as FactoryState, o as FactoryControlResult, p as FactoryReviewVerdict } from "./factory-D7ryES9n.js";
4
- import { n as BUILTIN_AGENT_IDS } from "./config-CjawSOBk.js";
1
+ import { 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";
5
2
  import { z } from "zod";
6
- //#region shared/contracts/factory-decision-log.ts
7
- var FACTORY_DECISION_OUTPUT_MAX_BYTES = 16384;
8
- var FactoryDecisionKind = z.enum([
9
- "admission",
10
- "closeout",
11
- "merge",
12
- "verification",
13
- "exception",
14
- "landing",
15
- "trust"
16
- ]);
17
- var FactoryDecisionOutcome = z.enum([
18
- "refused",
19
- "available",
20
- "dispatched",
21
- "ended",
22
- "retry",
23
- "block",
24
- "merge",
25
- "merged",
26
- "failed",
27
- "stale",
28
- "passed",
29
- "raised",
30
- "stalled",
31
- "recovered",
32
- "granted"
33
- ]);
34
- var FactoryDecisionFailureClass = z.enum([
35
- "admission",
36
- "worker",
37
- "fence",
38
- "check",
39
- "review",
40
- "closeout",
41
- "verification",
42
- "stale",
43
- "exception",
44
- "stall",
45
- "landing"
46
- ]);
47
- var decisionCheck = z.strictObject({
48
- command: z.string(),
49
- pass: z.boolean(),
50
- output: z.string()
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
+ ])
51
16
  });
52
- var decisionFence = z.discriminatedUnion("ok", [z.strictObject({ ok: z.literal(true) }), z.strictObject({
53
- ok: z.literal(false),
54
- outside: z.array(z.string()),
55
- protected: z.array(z.string()),
56
- unsupportedProtectedPaths: z.array(z.string())
57
- })]);
58
- var decisionFields = {
59
- timestamp: z.iso.datetime(),
60
- projectId: z.string().min(1).max(128).refine(isSingleFactoryPathSegment),
61
- outcome: FactoryDecisionOutcome,
62
- workId: z.string().min(1).nullable(),
63
- intentId: z.string().min(1).nullable(),
64
- sessionId: z.string().min(1).nullable(),
65
- attempt: z.number().int().positive().nullable(),
66
- durationMs: z.number().int().nonnegative().nullable(),
67
- failureClass: FactoryDecisionFailureClass.nullable(),
68
- reason: z.string().max(3999).nullable()
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()
69
45
  };
70
- var FactoryDecisionLogLine = z.discriminatedUnion("kind", [
71
- z.strictObject({
72
- ...decisionFields,
73
- kind: z.literal("admission"),
74
- outcome: z.enum([
75
- "refused",
76
- "available",
77
- "dispatched",
78
- "ended",
79
- "block"
80
- ])
81
- }),
82
- z.strictObject({
83
- ...decisionFields,
84
- kind: z.literal("closeout"),
85
- outcome: z.enum([
86
- "retry",
87
- "block",
88
- "merge"
89
- ]),
90
- attempt: z.number().int().positive(),
91
- durationMs: z.number().int().nonnegative(),
92
- fence: decisionFence.nullable(),
93
- checks: z.array(decisionCheck).refine((checks) => checks.reduce((totalBytes, check) => totalBytes + new TextEncoder().encode(check.output).length, 0) <= FACTORY_DECISION_OUTPUT_MAX_BYTES),
94
- review: FactoryReviewVerdict.nullable()
95
- }),
96
- z.strictObject({
97
- ...decisionFields,
98
- kind: z.literal("merge"),
99
- outcome: z.literal("merged"),
100
- mergedSha: z.string().regex(/^[a-f0-9]{40,64}$/)
101
- }),
102
- z.strictObject({
103
- ...decisionFields,
104
- kind: z.literal("verification"),
105
- outcome: z.enum([
106
- "failed",
107
- "stale",
108
- "passed"
109
- ])
110
- }),
111
- z.strictObject({
112
- ...decisionFields,
113
- kind: z.literal("exception"),
114
- outcome: z.enum(["raised", "stalled"])
115
- }),
116
- z.strictObject({
117
- ...decisionFields,
118
- kind: z.literal("landing"),
119
- outcome: z.enum(["failed", "recovered"])
120
- }),
121
- z.strictObject({
122
- ...decisionFields,
123
- kind: z.literal("trust"),
124
- outcome: z.literal("granted")
125
- })
126
- ]).superRefine((line, context) => {
127
- const isFailure = [
128
- "refused",
129
- "retry",
130
- "block",
131
- "failed",
132
- "stale",
133
- "raised",
134
- "stalled"
135
- ].includes(line.outcome);
136
- if (isFailure && line.failureClass === null) context.addIssue({
137
- code: "custom",
138
- path: ["failureClass"],
139
- message: "Failure requires a failure class"
140
- });
141
- if (!isFailure && line.outcome !== "ended" && line.failureClass !== null) context.addIssue({
142
- code: "custom",
143
- path: ["failureClass"],
144
- message: "Success requires a null failure class"
145
- });
146
- });
147
- //#endregion
148
- //#region shared/contracts/telemetry.ts
149
- var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
150
- var SESSION_EXIT_KINDS = Object.freeze([
151
- "clean",
152
- "error",
153
- "signal",
154
- "no_output"
155
- ]);
156
- var nonNegativeInteger = z.number().int().nonnegative();
157
- var boundedText = z.string().max(512);
158
- var AppStartedProperties = z.object({}).strict();
159
- var AppActiveProperties = z.object({ active_session_count: nonNegativeInteger }).strict();
160
- var SessionStartedProperties = z.object({ adapter: z.enum(TELEMETRY_ADAPTERS) }).strict();
161
- var SessionEndedProperties = z.object({
162
- adapter: z.enum(TELEMETRY_ADAPTERS),
163
- exit_kind: z.enum(SESSION_EXIT_KINDS),
164
- duration_seconds: nonNegativeInteger
165
- }).strict();
166
- var ExceptionFrame = z.object({
167
- platform: z.enum(["node:javascript", "web:javascript"]),
168
- function: boundedText,
169
- filename: boundedText,
170
- lineno: nonNegativeInteger,
171
- colno: nonNegativeInteger,
172
- in_app: z.boolean()
173
- }).strict();
174
- var ExceptionProperties = z.object({
175
- $exception_list: z.array(z.object({
176
- type: boundedText,
177
- value: boundedText,
178
- mechanism: z.object({
179
- handled: z.boolean(),
180
- synthetic: z.boolean(),
181
- type: z.literal("generic")
182
- }).strict(),
183
- stacktrace: z.object({
184
- type: z.literal("raw"),
185
- frames: z.array(ExceptionFrame).max(64)
186
- }).strict()
187
- }).strict()).length(1),
188
- $exception_level: z.enum(["error", "fatal"])
189
- }).strict();
190
- var AiGenerationProperties = z.object({
191
- $ai_trace_id: z.string().regex(/^[0-9a-f]{64}$/),
192
- $ai_provider: z.string().max(64),
193
- $ai_model: z.string().max(128),
194
- $ai_input_tokens: nonNegativeInteger,
195
- $ai_output_tokens: nonNegativeInteger,
196
- $ai_cache_read_input_tokens: nonNegativeInteger.optional(),
197
- $ai_cache_creation_input_tokens: nonNegativeInteger.optional(),
198
- $ai_total_cost_usd: z.number().finite().nonnegative().optional(),
199
- agent_adapter: z.enum(TELEMETRY_ADAPTERS)
200
- }).strict();
201
- var FactoryDecisionProperties = z.object({
202
- kind: FactoryDecisionKind,
203
- outcome: FactoryDecisionOutcome,
204
- failure_class: FactoryDecisionFailureClass.nullable(),
205
- duration_ms: nonNegativeInteger.nullable(),
206
- attempt: nonNegativeInteger.nullable()
207
- }).strict();
208
- var TELEMETRY_EVENT_SCHEMAS = Object.freeze({
209
- app_started: AppStartedProperties,
210
- app_active: AppActiveProperties,
211
- session_started: SessionStartedProperties,
212
- session_ended: SessionEndedProperties,
213
- $exception: ExceptionProperties,
214
- $ai_generation: AiGenerationProperties,
215
- factory_decision: FactoryDecisionProperties
216
- });
217
- Object.freeze([
218
- {
219
- name: "app_started",
220
- description: "The server started listening."
221
- },
222
- {
223
- name: "app_active",
224
- description: "Once a day while the server runs, with how many sessions are live."
225
- },
226
- {
227
- name: "session_started",
228
- description: "A session spawned, with which kind of agent (any custom agent counts as `custom`)."
229
- },
230
- {
231
- name: "session_ended",
232
- description: "A session exited: how it exited and how long it ran, in whole seconds."
233
- },
234
- {
235
- name: "$exception",
236
- 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."
237
- },
238
- {
239
- name: "$ai_generation",
240
- description: "Per agent session and model, after each usage scan, for usage recorded in the last 24 hours: token counts, the model name and estimated cost, under a one-way hash of the session. A model name outside the shipped pricing table is sent as unknown. No prompts or output."
241
- },
242
- {
243
- name: "factory_decision",
244
- description: "Each time the factory decides something (a dispatch, a close-out attempt, a merge, a watch or verification result, an exception, a landing, a Claude Code folder trust grant): which kind of decision, how it came out, the class of failure when it failed, how long it took and which attempt it was. Never the objective, the reason, check output, a path or a repository name."
245
- }
246
- ]);
247
- Object.freeze([
248
- "app_version",
249
- "os_platform",
250
- "node_major",
251
- "install_flavor",
252
- "is_bundled",
253
- "is_dev_install"
46
+ var IssueSource = z.enum([
47
+ "project",
48
+ "me",
49
+ "team"
254
50
  ]);
255
- Object.freeze(["$release_id"]);
256
- var TELEMETRY_KILL_SWITCH_FLAG = "telemetry-enabled";
257
- var FeatureFlagsResponse = z.object({
258
- flags: z.object({ [TELEMETRY_KILL_SWITCH_FLAG]: z.object({ enabled: z.boolean() }).passthrough().optional() }).passthrough(),
259
- errorsWhileComputingFlags: z.boolean().optional()
260
- }).passthrough();
261
- var PendingCrashReport = z.object({
262
- timestamp: z.string(),
263
- properties: ExceptionProperties
264
- }).strict();
265
- var TelemetryState = z.object({
266
- installId: z.uuid(),
267
- noticeShownAt: z.string().nullable().optional(),
268
- remoteDisabled: z.boolean().optional()
269
- });
270
- //#endregion
271
- //#region shared/contracts/benchmark.ts
272
- var BENCHMARK_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
273
- var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
274
- var repoSlug = z.string().regex(/^[^/\s]+\/[^/\s]+$/);
275
- var timestamp$1 = z.number().finite();
276
- var nonEmptyText = z.string().min(1);
277
- var BENCHMARK_INJECTED_ENV_NAMES = Object.freeze(["CLAUDE_CODE_OAUTH_TOKEN"]);
278
- var BenchmarkId = z.string().regex(BENCHMARK_ID_RE);
279
- function hasUniqueIds(entries) {
280
- return new Set(entries.map((entry) => entry.id)).size === entries.length;
281
- }
282
- var BenchmarkCaseSource = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
283
- kind: z.literal("github-merged-prs"),
284
- repo: repoSlug,
285
- minBodies: z.number().int().min(1),
286
- limit: z.number().int().min(1).max(500)
287
- })]);
288
- var BenchmarkWorkspace = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("none") }), z.strictObject({ kind: z.literal("pr-checkout") })]);
289
- var BenchmarkSubjectOutput = z.enum(["review-findings", "json"]);
290
- var BenchmarkSubject = z.strictObject({
291
- promptTemplate: nonEmptyText,
292
- output: BenchmarkSubjectOutput,
293
- timeoutSeconds: z.number().int().min(30).max(14400)
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"])
294
66
  });
295
- var BenchmarkArm = z.strictObject({
296
- id: BenchmarkId,
297
- 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(),
298
- extraArgs: z.array(z.string()).optional(),
299
- setup: z.strictObject({ command: z.array(nonEmptyText).min(1) }).optional()
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()
300
80
  });
301
- var BenchmarkScorer = z.discriminatedUnion("kind", [z.strictObject({
302
- kind: z.literal("llm-judge-match"),
303
- model: nonEmptyText
304
- })]);
305
- var BenchmarkSuite = z.strictObject({
306
- id: BenchmarkId,
307
- title: nonEmptyText,
308
- caseSource: BenchmarkCaseSource,
309
- workspace: BenchmarkWorkspace,
310
- subject: BenchmarkSubject,
311
- arms: z.array(BenchmarkArm).min(2).refine(hasUniqueIds, { message: "arm ids must be unique" }),
312
- baselineArm: BenchmarkId,
313
- trials: z.number().int().min(1).max(20),
314
- scorer: BenchmarkScorer
315
- }).refine((suite) => suite.arms.some((arm) => arm.id === suite.baselineArm), {
316
- message: "baselineArm must name one of the arms",
317
- path: ["baselineArm"]
81
+ var IssuesSearchResponse = z.object({
82
+ items: z.array(z.unknown()),
83
+ total_count: z.number().int().nonnegative(),
84
+ incomplete_results: z.boolean()
318
85
  });
319
- var BenchmarkReference = z.strictObject({
320
- id: BenchmarkId,
321
- text: nonEmptyText,
322
- tags: z.array(BenchmarkId),
323
- path: nonEmptyText.optional(),
324
- line: z.number().int().positive().optional()
86
+ z.object({
87
+ ok: z.boolean(),
88
+ items: z.array(IssueUpdate),
89
+ isComplete: z.boolean(),
90
+ error: z.string()
325
91
  });
326
- var BenchmarkCaseOrigin = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("manual") }), z.strictObject({
327
- kind: z.literal("github-pr"),
328
- repo: repoSlug,
329
- number: z.number().int().positive(),
330
- url: nonEmptyText,
331
- minedAt: timestamp$1
332
- })]);
333
- var BenchmarkCase = z.strictObject({
334
- id: BenchmarkId,
335
- input: z.record(z.string(), z.unknown()),
336
- references: z.array(BenchmarkReference).min(1).refine(hasUniqueIds, { message: "reference ids must be unique" }),
337
- source: BenchmarkCaseOrigin
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({})
338
102
  });
339
- var PrCheckoutCaseInput = z.object({
340
- repo: repoSlug,
341
- number: z.number().int().positive(),
342
- reviewedSha: CommitSha,
343
- baseSha: CommitSha,
344
- changedFiles: z.array(nonEmptyText)
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()
345
172
  });
346
- var BenchmarkMatchVerdict = z.enum([
347
- "found",
348
- "partial",
349
- "missed"
350
- ]);
351
- var BenchmarkJudgement = z.strictObject({
352
- referenceId: BenchmarkId,
353
- verdict: BenchmarkMatchVerdict,
354
- findingIndexes: z.array(z.number().int().nonnegative())
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()
355
188
  });
356
- var BenchmarkCellStatus = z.enum([
357
- "scored",
358
- "invalid",
359
- "error"
189
+ var PLAN_REVIEW_STATE_VALUES = Object.freeze([
190
+ "open",
191
+ "released",
192
+ "decided",
193
+ "closed"
360
194
  ]);
361
- var BenchmarkCellResult = z.strictObject({
362
- caseId: BenchmarkId,
363
- armId: BenchmarkId,
364
- trial: z.number().int().min(1),
365
- status: BenchmarkCellStatus,
366
- startedAt: timestamp$1,
367
- finishedAt: timestamp$1,
368
- degradedReasons: z.array(nonEmptyText),
369
- findingCount: z.number().int().nonnegative(),
370
- judgements: z.array(BenchmarkJudgement),
371
- costUsd: z.number().finite().nonnegative().nullable(),
372
- error: nonEmptyText.nullable()
373
- });
374
- var BenchmarkRunStatus = z.enum([
375
- "running",
376
- "completed",
377
- "interrupted",
378
- "failed"
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"
379
201
  ]);
380
- var BenchmarkRun = z.strictObject({
381
- id: BenchmarkId,
382
- suiteId: BenchmarkId,
383
- status: BenchmarkRunStatus,
384
- startedAt: timestamp$1,
385
- finishedAt: timestamp$1.nullable(),
386
- error: nonEmptyText.nullable(),
387
- cells: z.array(BenchmarkCellResult)
388
- });
389
- var nullableRatio = z.number().min(0).max(1).nullable();
390
- var BenchmarkArmScore = z.strictObject({
391
- trials: z.number().int().nonnegative(),
392
- recall: nullableRatio,
393
- recallByTag: z.record(BenchmarkId, nullableRatio),
394
- degraded: z.number().int().nonnegative(),
395
- invalid: z.number().int().nonnegative(),
396
- costUsd: z.number().finite().nonnegative().nullable()
397
- });
398
- var BenchmarkReportRow = z.strictObject({
399
- caseId: BenchmarkId,
400
- arms: z.record(BenchmarkId, BenchmarkArmScore),
401
- deltaVsBaseline: z.record(BenchmarkId, z.number().min(-1).max(1).nullable())
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)
402
206
  });
403
- var BenchmarkReport = z.strictObject({
404
- runId: BenchmarkId,
405
- suiteId: BenchmarkId,
406
- status: BenchmarkRunStatus,
407
- baselineArm: BenchmarkId,
408
- armIds: z.array(BenchmarkId),
409
- rows: z.array(BenchmarkReportRow),
410
- totals: z.record(BenchmarkId, BenchmarkArmScore)
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()
411
215
  });
412
- var BenchmarkAction = z.enum([
413
- "mine",
414
- "run",
415
- "cancel"
416
- ]);
417
- var BenchmarkActionRequest = z.object({
418
- suiteId: BenchmarkId,
419
- action: BenchmarkAction
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()
420
221
  });
421
- var BenchmarkActionResult = z.object({
422
- suiteId: BenchmarkId,
423
- action: BenchmarkAction,
424
- ok: z.boolean(),
425
- error: z.string().optional(),
426
- runId: BenchmarkId.optional()
222
+ var PlanReviewOpenRevision = z.object({
223
+ revision: z.number().int().positive(),
224
+ since: z.number().finite()
427
225
  });
428
- var BenchmarkCellPhase = z.enum([
429
- "setup",
430
- "preflight",
431
- "workspace",
432
- "subject",
433
- "judge"
434
- ]);
435
- var BenchmarkInFlightCell = z.object({
436
- suiteId: BenchmarkId,
437
- runId: BenchmarkId,
438
- caseId: BenchmarkId.nullable(),
439
- armId: BenchmarkId,
440
- trial: z.number().int().min(1),
441
- phase: BenchmarkCellPhase,
442
- cellIndex: z.number().int().nonnegative(),
443
- cellCount: z.number().int().positive(),
444
- startedAt: timestamp$1
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()
445
234
  });
446
- var BenchmarkSuiteSummary = z.object({
447
- id: BenchmarkId,
448
- title: z.string(),
449
- error: z.string().nullable(),
450
- caseCount: z.number().int().nonnegative(),
451
- candidateCount: z.number().int().nonnegative(),
452
- armIds: z.array(BenchmarkId),
453
- baselineArm: BenchmarkId.nullable(),
454
- latestReport: BenchmarkReport.nullable()
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()
455
242
  });
456
- var BenchmarkStatus = z.object({
457
- type: z.literal("benchmark-status"),
458
- ts: timestamp$1,
459
- configured: z.boolean(),
460
- reason: z.string().nullable(),
461
- suites: z.array(BenchmarkSuiteSummary),
462
- inFlight: BenchmarkInFlightCell.nullable()
463
- }).passthrough();
464
- var githubAuthor = z.object({
465
- __typename: z.string(),
466
- login: z.string()
467
- }).nullable();
468
- var MergedPrListing = z.object({
469
- number: z.number().int().positive(),
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(),
470
253
  title: z.string(),
471
- url: nonEmptyText,
472
- mergedAt: z.string().nullable(),
473
- reviewThreads: z.object({ totalCount: z.number().int().nonnegative() }),
474
- reviews: z.object({ totalCount: z.number().int().nonnegative() })
475
- });
476
- var MinedReviewThread = z.object({
477
- path: z.string(),
478
- line: z.number().int().positive().nullable(),
479
- originalLine: z.number().int().positive().nullable(),
480
- comments: z.object({ nodes: z.array(z.object({
481
- databaseId: z.number().int().positive(),
482
- author: githubAuthor,
483
- body: z.string(),
484
- createdAt: z.string(),
485
- originalCommit: z.object({ oid: CommitSha }).nullable()
486
- })) })
487
- });
488
- var MinedReview = z.object({
489
- databaseId: z.number().int().positive(),
490
- author: githubAuthor,
491
- body: z.string(),
492
- submittedAt: z.string().nullable(),
493
- commit: z.object({ oid: CommitSha }).nullable()
254
+ hasPlan: z.boolean()
494
255
  });
495
- var MinedBaseEvent = z.discriminatedUnion("__typename", [z.object({
496
- __typename: z.literal("BaseRefChangedEvent"),
497
- createdAt: z.string()
498
- }), z.object({
499
- __typename: z.literal("BaseRefForcePushedEvent"),
500
- createdAt: z.string(),
501
- beforeCommit: z.object({ oid: CommitSha }).nullable()
502
- })]);
503
- var MinedPrReviewData = z.object({
504
- author: githubAuthor,
505
- baseRefOid: CommitSha,
506
- reviewThreads: z.object({
507
- pageInfo: z.object({ hasNextPage: z.boolean() }),
508
- nodes: z.array(MinedReviewThread)
509
- }),
510
- reviews: z.object({
511
- pageInfo: z.object({ hasNextPage: z.boolean() }),
512
- nodes: z.array(MinedReview)
513
- }),
514
- timelineItems: z.object({
515
- pageInfo: z.object({ hasNextPage: z.boolean() }),
516
- nodes: z.array(MinedBaseEvent)
517
- })
256
+ var PlanDraftPush = z.object({
257
+ id: z.string(),
258
+ agentId: z.string().nullable(),
259
+ planFilePath: z.string(),
260
+ changedAt: z.number().finite()
518
261
  });
519
- var CommitComparison = z.object({
520
- mergeBaseSha: CommitSha,
521
- changedFiles: z.array(nonEmptyText),
522
- isFileListComplete: z.boolean()
262
+ var PlanResponseFrame = z.object({
263
+ id: z.string(),
264
+ reviews: z.array(PlanReview),
265
+ body: PlanRevisionBody.nullable()
523
266
  });
524
267
  Object.freeze([
525
268
  "file",
@@ -556,480 +299,1007 @@ var ChangedFile = z.strictObject({
556
299
  status: ChangedFileStatus,
557
300
  isCommitted: z.boolean()
558
301
  });
559
- var SubsystemFact = z.strictObject({
560
- factId,
561
- agentsPath: repoPath,
562
- title: z.string(),
563
- paths: z.array(repoPath).min(1)
302
+ var SubsystemFact = z.strictObject({
303
+ factId,
304
+ agentsPath: repoPath,
305
+ title: z.string(),
306
+ paths: z.array(repoPath).min(1)
307
+ });
308
+ var CoChangeGap = z.strictObject({
309
+ factId,
310
+ path: repoPath,
311
+ partner: repoPath,
312
+ support: count,
313
+ confidence: z.number().min(0).max(1)
314
+ });
315
+ var HotspotFact = z.strictObject({
316
+ factId,
317
+ path: repoPath,
318
+ commitCount: count,
319
+ fixCommitCount: count
320
+ });
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
329
+ });
330
+ var UntestedFileFact = z.strictObject({
331
+ factId,
332
+ path: repoPath
333
+ });
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"
382
+ ]);
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()
391
+ });
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"
405
+ ]);
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()
414
+ };
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()
422
+ });
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
+ })
503
+ ]);
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)
507
+ })]);
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())
514
+ });
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()
522
+ });
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)
529
+ })]);
530
+ var SessionCoherence = z.strictObject({
531
+ journal: CoherenceJournalReading,
532
+ updatedAt: z.number().finite()
533
+ });
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()
546
+ });
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
+ })
592
+ ]);
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({})
600
+ });
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)
620
+ });
621
+ //#endregion
622
+ //#region shared/contracts/update-journal.ts
623
+ var UpdateChannel = z.enum(["release", "main"]);
624
+ var UpdateRunState = z.enum([
625
+ "idle",
626
+ "running",
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
672
+ });
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"
564
679
  });
565
- var CoChangeGap = z.strictObject({
566
- factId,
567
- path: repoPath,
568
- partner: repoPath,
569
- support: count,
570
- confidence: z.number().min(0).max(1)
680
+ var NON_NEGATIVE_NUMBER_RANGE = Object.freeze({
681
+ min: 0,
682
+ label: "zero or more"
571
683
  });
572
- var HotspotFact = z.strictObject({
573
- factId,
574
- path: repoPath,
575
- commitCount: count,
576
- fixCommitCount: count
684
+ var FLYING_ANIMALS_GAP_RANGE = Object.freeze({
685
+ min: 0,
686
+ max: 300
577
687
  });
578
- var BlastRadiusFact = z.strictObject({
579
- factId,
580
- path: repoPath,
581
- directDependents: cappedPaths,
582
- directDependentCount: count,
583
- transitiveDependentCount: count,
584
- dependentTests: cappedPaths,
585
- dependentTestCount: count
688
+ var FLYING_ANIMALS_DURATION_RANGE = Object.freeze({
689
+ min: 1,
690
+ max: 60
586
691
  });
587
- var UntestedFileFact = z.strictObject({
588
- factId,
589
- path: repoPath
692
+ var FLYING_ANIMALS_SCALE_RANGE = Object.freeze({
693
+ min: .5,
694
+ max: 2
590
695
  });
591
- var CollisionFact = z.strictObject({
592
- factId,
593
- path: repoPath,
594
- otherSessionId: z.string().min(1),
595
- otherSessionName: z.string()
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
596
703
  });
597
- var CrossRepoLink = z.strictObject({
598
- factId,
599
- providerRepo: z.string().min(1),
600
- packageName: z.string().min(1),
601
- packageDir: z.string(),
602
- consumerManifest: repoPath,
603
- versionSpec: z.string(),
604
- isLocalLink: z.boolean(),
605
- providerChangedPathCount: count,
606
- importers: cappedPaths,
607
- importerCount: count,
608
- changedImporterCount: count
704
+ var REPLAY_BUFFER_KB_RANGE = Object.freeze({
705
+ min: 64,
706
+ max: 16384
609
707
  });
610
- var RepoChangeMap = z.strictObject({
611
- name: z.string().min(1),
612
- root: z.string().min(1),
613
- sessionPathPrefix: z.string(),
614
- base: z.string().nullable(),
615
- files: z.array(ChangedFile),
616
- subsystems: z.array(SubsystemFact),
617
- coChangeGaps: z.array(CoChangeGap),
618
- hotspots: z.array(HotspotFact),
619
- blastRadius: z.array(BlastRadiusFact),
620
- untestedFiles: z.array(UntestedFileFact),
621
- collisions: z.array(CollisionFact),
622
- links: z.array(CrossRepoLink),
623
- error: z.string().nullable()
708
+ var MEMORY_RESERVE_MB_RANGE = Object.freeze({
709
+ min: 0,
710
+ max: 65536
624
711
  });
625
- var NarrativeClaim = z.strictObject({
626
- text: z.string().min(1).max(600),
627
- factIds: z.array(factId).min(1)
712
+ var PORT_RANGE = Object.freeze({
713
+ min: 0,
714
+ max: 65535
628
715
  });
629
- var ChangeNarrative = z.strictObject({
630
- factsHash: z.string().min(1),
631
- model: z.string().nullable(),
632
- claims: z.array(NarrativeClaim).max(12)
716
+ var TASK_TITLE_TIMEOUT_RANGE = Object.freeze({
717
+ min: 0,
718
+ exclusiveMin: true,
719
+ max: 2147483647 / 1e3
633
720
  });
634
- var NarratorState = z.enum([
635
- "disabled",
636
- "pending",
637
- "ready",
638
- "failed"
639
- ]);
640
- var ChangeMap = z.strictObject({
641
- sessionId: z.string().min(1),
642
- sig: z.string().nullable(),
643
- generatedAt: z.number().finite(),
644
- repos: z.array(RepoChangeMap),
645
- narrative: ChangeNarrative.nullable(),
646
- narratorState: NarratorState,
647
- error: z.string().min(1).optional()
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"
648
740
  });
649
- //#endregion
650
- //#region shared/contracts/issues.ts
651
- var IssueRepoSlug = z.string().regex(REPO_SLUG_RE);
652
- var IssueKey = z.string().regex(new RegExp(`${REPO_SLUG_RE.source.slice(0, -1)}#[1-9][0-9]*$`));
653
- var IssuePullRequest = z.object({
654
- number: z.number().int().positive(),
655
- url: z.string().url(),
656
- title: z.string(),
657
- state: z.enum([
658
- "open",
659
- "draft",
660
- "merged",
661
- "closed"
662
- ])
741
+ var POSTHOG_TRAFFIC_MULTIPLIER_RANGE = Object.freeze({
742
+ min: 1,
743
+ label: "at least 1"
663
744
  });
664
- var GithubIssuePullRequestsRepository = z.object({ issue: z.object({ closedByPullRequestsReferences: z.object({ nodes: z.array(z.object({
665
- number: IssuePullRequest.shape.number,
666
- url: IssuePullRequest.shape.url,
667
- title: IssuePullRequest.shape.title,
668
- state: z.enum([
669
- "OPEN",
670
- "MERGED",
671
- "CLOSED"
672
- ]),
673
- isDraft: z.boolean()
674
- }).nullable()).max(5) }) }).nullable() });
675
- var issueFields = {
676
- key: z.string(),
677
- repo: IssueRepoSlug,
678
- number: z.number().int().positive(),
679
- title: z.string(),
680
- url: z.string().url(),
681
- labels: z.array(z.string()),
682
- assignees: z.array(z.string()),
683
- author: z.string(),
684
- comments: z.number().int().nonnegative(),
685
- createdAt: z.iso.datetime(),
686
- updatedAt: z.iso.datetime()
687
- };
688
- var IssueSource = z.enum([
689
- "project",
690
- "me",
691
- "team"
692
- ]);
693
- var cachedIssueFields = {
694
- ...issueFields,
695
- sources: z.array(IssueSource).nonempty().refine((sources) => new Set(sources).size === sources.length),
696
- teams: z.array(IssueRepoSlug),
697
- projectId: z.string().nullable(),
698
- pullRequests: z.array(IssuePullRequest).max(5).default([])
699
- };
700
- var CachedIssueRow = z.object(cachedIssueFields).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
701
- var IssueRow = z.object({
702
- ...cachedIssueFields,
703
- sessionId: z.string().nullable().default(null)
704
- }).refine((issue) => issue.key === `${issue.repo}#${issue.number}`);
705
- var IssueUpdate = z.object({
706
- ...issueFields,
707
- state: z.enum(["open", "closed"])
745
+ var POSTHOG_TRAFFIC_MIN_USERS_RANGE = Object.freeze({
746
+ min: 1,
747
+ label: "at least 1"
708
748
  });
709
- var GithubIssueResponse = z.object({
710
- number: issueFields.number,
711
- title: issueFields.title,
712
- html_url: issueFields.url,
713
- state: z.enum(["open", "closed"]),
714
- labels: z.array(z.union([z.string(), z.object({ name: z.string() })])),
715
- assignees: z.array(z.object({ login: z.string() })),
716
- user: z.object({ login: z.string() }).nullable(),
717
- comments: issueFields.comments,
718
- created_at: issueFields.createdAt,
719
- updated_at: issueFields.updatedAt,
720
- repository_url: z.string().url().optional(),
721
- pull_request: z.unknown().optional()
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"
722
754
  });
723
- var IssuesSearchResponse = z.object({
724
- items: z.array(z.unknown()),
725
- total_count: z.number().int().nonnegative(),
726
- incomplete_results: z.boolean()
755
+ var USAGE_SCAN_INTERVAL_RANGE = Object.freeze({
756
+ min: 1,
757
+ max: 1440
727
758
  });
728
- z.object({
729
- ok: z.boolean(),
730
- items: z.array(IssueUpdate),
731
- isComplete: z.boolean(),
732
- error: z.string()
759
+ var USAGE_RETAIN_DAYS_RANGE = Object.freeze({
760
+ min: 1,
761
+ max: 3650
733
762
  });
734
- var IssuesState = z.object({
735
- issues: z.array(CachedIssueRow),
736
- lastSyncAt: z.number().finite().nonnegative().nullable(),
737
- perRepoSync: z.record(IssueRepoSlug, z.object({
738
- lastSyncAt: z.number().finite().nonnegative().nullable(),
739
- ticks: z.number().int().nonnegative(),
740
- needsFullReconcile: z.boolean()
741
- })),
742
- sessionLinks: z.record(IssueKey, z.string()).default({}),
743
- pullRequestsFetchedAt: z.record(IssueKey, z.iso.datetime()).default({})
763
+ var USAGE_WAREHOUSE_RETAIN_DAYS_RANGE = Object.freeze({
764
+ min: 30,
765
+ max: 3650
744
766
  });
745
- var IssuesStatus = z.object({
746
- type: z.literal("issues-status"),
747
- ts: z.number().finite(),
748
- configured: z.boolean(),
749
- reason: z.string().nullable(),
750
- lastSyncAt: z.number().finite().nonnegative().nullable(),
751
- issues: z.array(IssueRow),
752
- ...githubPollingShape
753
- }).passthrough();
754
- var PLAN_FEEDBACK_MAX_CHARS = 2e4;
755
- var PLAN_COMMENT_MAX_CHARS = 4e3;
756
- var PLAN_BODY_CAP_BYTES = 524288;
757
- var PLAN_HOOK_OUTPUT_MAX_CHARS = 1e4;
758
- var PLAN_HOOK_EVENT = "permissionrequest-plan";
759
- var PLAN_RESULT_HOOK_EVENT = "posttooluse-plan";
760
- var PLAN_TOOL_NAME = "ExitPlanMode";
761
- var HEADING_SCAN_MAX_CHARS = 4096;
762
- var ATX_HEADING = /^ {0,3}(#{1,6})[ \t]+(.*)$/;
763
- function capPlanTitle(text) {
764
- const trimmed = text.trim();
765
- if (trimmed.length <= 120) return trimmed;
766
- return trimmed.slice(0, 120);
767
- }
768
- function withoutClosingHeadingMarks(text) {
769
- const trimmed = text.trimEnd();
770
- let textEnd = trimmed.length;
771
- while (textEnd > 0 && trimmed[textEnd - 1] === "#") textEnd--;
772
- if (textEnd === trimmed.length || textEnd === 0) return trimmed;
773
- const charBeforeMarks = trimmed[textEnd - 1];
774
- if (charBeforeMarks !== " " && charBeforeMarks !== " ") return trimmed;
775
- return trimmed.slice(0, textEnd).trimEnd();
776
- }
777
- function parseAtxHeading(line, { overlongLine }) {
778
- if (overlongLine === "reject" && line.length > 4096) return null;
779
- const heading = ATX_HEADING.exec(line.slice(0, HEADING_SCAN_MAX_CHARS));
780
- if (!heading) return null;
781
- return {
782
- level: heading[1].length,
783
- text: withoutClosingHeadingMarks(heading[2])
784
- };
785
- }
786
- function headingTitle(line) {
787
- return parseAtxHeading(line, { overlongLine: "truncate" })?.text ?? "";
788
- }
789
- function planTitle(plan) {
790
- const lines = typeof plan === "string" ? plan.split(/\r?\n/) : [];
791
- for (const line of lines) {
792
- const title = headingTitle(line);
793
- if (title.length > 0) return capPlanTitle(title);
767
+ var USAGE_SESSION_BLOCK_HOURS_RANGE = Object.freeze({
768
+ min: 1,
769
+ max: 24
770
+ });
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
777
+ });
778
+ var CHANGE_MAP_NARRATOR_TIMEOUT_RANGE = Object.freeze({
779
+ min: 15,
780
+ max: 600
781
+ });
782
+ var KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE = Object.freeze({
783
+ min: 5,
784
+ max: 120
785
+ });
786
+ var WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE = Object.freeze({
787
+ min: 1,
788
+ max: 5
789
+ });
790
+ var WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE = Object.freeze({
791
+ min: 1,
792
+ max: 50
793
+ });
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
826
+ });
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" })
864
+ }),
865
+ z.strictObject({
866
+ type: z.literal("label"),
867
+ name: WorkflowLabelName
868
+ }),
869
+ z.strictObject({
870
+ type: z.literal("comment"),
871
+ body: WorkflowCommentBody
872
+ })
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
+ });
794
913
  }
795
- return capPlanTitle(lines.find((line) => line.trim().length > 0) ?? "");
914
+ });
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 })
937
+ });
938
+ var WorkflowPr = z.strictObject({
939
+ repo: repositoryName,
940
+ number: z.number().int().positive(),
941
+ title: z.string(),
942
+ url: z.url(),
943
+ author: z.string().nullable(),
944
+ state: z.enum([
945
+ "OPEN",
946
+ "MERGED",
947
+ "CLOSED"
948
+ ]),
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,
956
+ labels: z.array(z.string()),
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()
965
+ });
966
+ var WorkflowRepoSnapshot = z.strictObject({
967
+ polledAtMs: nonnegativeInteger,
968
+ prs: z.array(WorkflowPr)
969
+ });
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();
796
976
  }
797
- var ExitPlanModeInput = z.object({
798
- plan: z.string().min(1),
799
- planFilePath: z.string().min(1),
800
- agent_id: z.string().min(1).optional(),
801
- agent_type: z.string().min(1).optional()
802
- }).passthrough();
803
- var ExitPlanModeHookPayload = z.object({
804
- tool_name: z.literal(PLAN_TOOL_NAME),
805
- tool_input: ExitPlanModeInput,
806
- agent_id: z.string().min(1).optional(),
807
- agent_type: z.string().min(1).optional()
808
- }).passthrough();
809
- var ExitPlanModeRequest = z.object({
810
- plan: z.string(),
811
- planFilePath: z.string(),
812
- agentId: z.string().nullable(),
813
- agentType: z.string().nullable()
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
814
986
  });
815
- function parseExitPlanModeHookPayload(body) {
816
- const parsed = ExitPlanModeHookPayload.safeParse(body);
817
- if (!parsed.success) return null;
818
- const input = parsed.data.tool_input;
819
- return {
820
- plan: input.plan,
821
- planFilePath: input.planFilePath,
822
- agentId: parsed.data.agent_id ?? input.agent_id ?? null,
823
- agentType: parsed.data.agent_type ?? input.agent_type ?? null
824
- };
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;
825
1047
  }
826
- var PlanRevision = ExitPlanModeRequest.extend({
827
- sessionId: z.string().min(1),
828
- revision: z.number().int().positive(),
829
- receivedAt: z.number().finite()
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)
830
1060
  });
831
- var PLAN_REVIEW_STATE_VALUES = Object.freeze([
832
- "open",
833
- "released",
834
- "decided",
835
- "closed"
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"]
1084
+ });
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()
1091
+ });
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
1104
+ });
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)
1111
+ });
1112
+ var BenchmarkMatchVerdict = z.enum([
1113
+ "found",
1114
+ "partial",
1115
+ "missed"
836
1116
  ]);
837
- var PlanReviewStateValue = z.enum(PLAN_REVIEW_STATE_VALUES);
838
- var PLAN_DECISION_KINDS = Object.freeze([
839
- "approve",
840
- "approve-accept-edits",
841
- "revise",
842
- "terminal"
1117
+ var BenchmarkJudgement = z.strictObject({
1118
+ referenceId: BenchmarkId,
1119
+ verdict: BenchmarkMatchVerdict,
1120
+ findingIndexes: z.array(z.number().int().nonnegative())
1121
+ });
1122
+ var BenchmarkCellStatus = z.enum([
1123
+ "scored",
1124
+ "invalid",
1125
+ "error"
843
1126
  ]);
844
- var PlanDecisionKind = z.enum(PLAN_DECISION_KINDS);
845
- var PlanSectionComment = z.object({
846
- heading: z.string().max(PLAN_COMMENT_MAX_CHARS).nullable(),
847
- comment: z.string().min(1).max(PLAN_COMMENT_MAX_CHARS)
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()
848
1139
  });
849
- var PlanDecision = z.object({
850
- id: z.string().min(1),
851
- agentId: z.string().nullable(),
852
- revision: z.number().int().positive(),
853
- decision: PlanDecisionKind,
854
- feedback: z.string().max(PLAN_FEEDBACK_MAX_CHARS).optional(),
855
- comments: z.array(PlanSectionComment).max(40).optional(),
856
- plan: z.string().min(1).max(PLAN_BODY_CAP_BYTES).optional()
1140
+ var BenchmarkRunStatus = z.enum([
1141
+ "running",
1142
+ "completed",
1143
+ "interrupted",
1144
+ "failed"
1145
+ ]);
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)
857
1154
  });
858
- var PlanRevisionSummary = z.object({
859
- revision: z.number().int().positive(),
860
- receivedAt: z.number().finite(),
861
- chars: z.number().int().nonnegative(),
862
- title: z.string()
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()
863
1163
  });
864
- var PlanReviewOpenRevision = z.object({
865
- revision: z.number().int().positive(),
866
- since: z.number().finite()
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())
867
1168
  });
868
- var PlanReview = z.object({
869
- agentId: z.string().nullable(),
870
- agentType: z.string().nullable(),
871
- revisions: z.array(PlanRevisionSummary),
872
- state: PlanReviewStateValue,
873
- openRevision: PlanReviewOpenRevision.nullable(),
874
- approvedRevision: z.number().int().positive().nullable(),
875
- lastDecision: PlanDecisionKind.nullable()
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)
876
1177
  });
877
- z.object({ reviews: z.array(PlanReview) });
878
- var PlanRevisionBody = z.object({
879
- agentId: z.string().nullable(),
880
- revision: z.number().int().nonnegative(),
881
- plan: z.string(),
882
- planFilePath: z.string(),
883
- receivedAt: z.number().finite()
1178
+ var BenchmarkAction = z.enum([
1179
+ "mine",
1180
+ "run",
1181
+ "cancel"
1182
+ ]);
1183
+ var BenchmarkActionRequest = z.object({
1184
+ suiteId: BenchmarkId,
1185
+ action: BenchmarkAction
884
1186
  });
885
- var PlanChangedPush = z.object({
886
- id: z.string(),
887
- agentId: z.string().nullable(),
888
- agentType: z.string().nullable(),
889
- revision: z.number().int().positive(),
890
- receivedAt: z.number().finite(),
891
- state: PlanReviewStateValue,
892
- lastDecision: PlanDecisionKind.nullable(),
893
- approvedRevision: z.number().int().positive().nullable(),
894
- chars: z.number().int().nonnegative(),
1187
+ var BenchmarkActionResult = z.object({
1188
+ suiteId: BenchmarkId,
1189
+ action: BenchmarkAction,
1190
+ ok: z.boolean(),
1191
+ error: z.string().optional(),
1192
+ runId: BenchmarkId.optional()
1193
+ });
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,
895
1214
  title: z.string(),
896
- 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()
897
1221
  });
898
- var PlanDraftPush = z.object({
899
- id: z.string(),
900
- agentId: z.string().nullable(),
901
- planFilePath: z.string(),
902
- 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() })
903
1241
  });
904
- var PlanResponseFrame = z.object({
905
- id: z.string(),
906
- reviews: z.array(PlanReview),
907
- 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
+ })) })
908
1253
  });
909
- //#endregion
910
- //#region shared/contracts/trace.ts
911
- var MAX_RAW_LINE_CHARS = 4e3;
912
- var TraceRecordBase = z.object({
913
- ts: z.number().finite(),
914
- uuid: z.string().nullable(),
915
- parentUuid: z.string().nullable(),
916
- vendorSessionId: z.string().min(1),
917
- agentId: z.string().min(1).optional(),
918
- agentType: z.string().min(1).optional(),
919
- transcriptOffset: z.number().int().nonnegative().optional(),
920
- 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()
921
1260
  });
922
- var TraceRecord = z.discriminatedUnion("kind", [
923
- TraceRecordBase.extend({
924
- kind: z.literal("prompt"),
925
- text: z.string()
926
- }),
927
- TraceRecordBase.extend({
928
- kind: z.literal("expansion"),
929
- text: z.string(),
930
- toolUseId: z.string().min(1).optional()
931
- }),
932
- TraceRecordBase.extend({
933
- kind: z.literal("thinking"),
934
- text: z.string()
935
- }),
936
- TraceRecordBase.extend({
937
- kind: z.literal("assistant"),
938
- text: z.string()
939
- }),
940
- TraceRecordBase.extend({
941
- kind: z.literal("tool_call"),
942
- toolUseId: z.string().min(1),
943
- name: z.string().min(1),
944
- input: z.unknown()
945
- }),
946
- TraceRecordBase.extend({
947
- kind: z.literal("tool_result"),
948
- toolUseId: z.string().min(1),
949
- content: z.string(),
950
- isError: z.boolean(),
951
- truncated: z.boolean()
952
- }),
953
- TraceRecordBase.extend({
954
- kind: z.literal("session"),
955
- vendor: z.string().min(1),
956
- transcriptPath: z.string().min(1),
957
- 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)
958
1275
  }),
959
- TraceRecordBase.extend({
960
- kind: z.literal("notice"),
961
- text: z.string().max(MAX_RAW_LINE_CHARS)
1276
+ reviews: z.object({
1277
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
1278
+ nodes: z.array(MinedReview)
962
1279
  }),
963
- TraceRecordBase.extend({
964
- kind: z.literal("raw"),
965
- line: z.string().max(MAX_RAW_LINE_CHARS)
1280
+ timelineItems: z.object({
1281
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
1282
+ nodes: z.array(MinedBaseEvent)
966
1283
  })
967
- ]);
968
- var TraceCheckpoint = z.object({
969
- transcriptPath: z.string().min(1),
970
- vendorSessionId: z.string().min(1),
971
- offset: z.number().int().nonnegative(),
972
- ingestedSubagentPaths: z.array(z.string().min(1)),
973
- offsetByTranscriptPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({}),
974
- subagentOffsetByPath: z.record(z.string().min(1), z.number().int().nonnegative()).default({})
975
1284
  });
976
- //#endregion
977
- //#region shared/contracts/update-journal.ts
978
- var UpdateChannel = z.enum(["release", "main"]);
979
- var UpdateRunState = z.enum([
980
- "idle",
981
- "running",
982
- "staged",
983
- "succeeded",
984
- "failed",
985
- "discarded",
986
- "interrupted"
987
- ]);
988
- var UpdateStepId = z.enum([
989
- "fetch",
990
- "stage",
991
- "install",
992
- "link-deps",
993
- "build"
994
- ]);
995
- var UpdateStepStatus = z.enum([
996
- "pending",
997
- "running",
998
- "succeeded",
999
- "failed"
1000
- ]);
1001
- var UpdateJournalStep = z.object({
1002
- id: UpdateStepId,
1003
- status: UpdateStepStatus,
1004
- startedAt: z.number().finite().nullable(),
1005
- finishedAt: z.number().finite().nullable(),
1006
- outputTail: z.array(z.string())
1007
- }).strict();
1008
- var UpdateJournal = z.object({
1009
- state: UpdateRunState,
1010
- fromSha: z.string().nullable(),
1011
- toSha: z.string().nullable(),
1012
- toVersion: z.string().nullable(),
1013
- channel: UpdateChannel,
1014
- steps: z.array(UpdateJournalStep),
1015
- activeStep: UpdateStepId.nullable(),
1016
- reason: z.string().nullable(),
1017
- startedAt: z.number().finite().nullable(),
1018
- finishedAt: z.number().finite().nullable(),
1019
- failedAtHandOff: z.boolean().optional()
1020
- }).strict();
1021
- var UpdateJournalSummary = UpdateJournal.pick({
1022
- state: true,
1023
- activeStep: true,
1024
- reason: true,
1025
- startedAt: true,
1026
- finishedAt: true
1285
+ var CommitComparison = z.object({
1286
+ mergeBaseSha: CommitSha,
1287
+ changedFiles: z.array(nonEmptyText),
1288
+ isFileListComplete: z.boolean()
1027
1289
  });
1028
1290
  //#endregion
1029
1291
  //#region shared/contracts/control-messages.ts
1030
1292
  var requestId = z.string().nullable().optional();
1031
1293
  var sessionId = z.string();
1032
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
+ }
1033
1303
  function loose(type, shape) {
1034
1304
  return z.looseObject({
1035
1305
  type: z.literal(type),
@@ -1047,11 +1317,14 @@ var opaqueObject = openObject();
1047
1317
  var opaqueArray = z.array(z.unknown());
1048
1318
  var planRevisionNumber = z.number().int().positive();
1049
1319
  var sessionDocPath = z.string().min(1).max(SESSION_DOC_PATH_MAX_CHARS);
1050
- var trailSteps = z.array(openObject({
1320
+ var trailSteps = z.array(z.union([openObject({
1051
1321
  at: timestamp,
1052
1322
  tool: z.string(),
1053
1323
  detail: z.string()
1054
- }));
1324
+ }), openObject({
1325
+ at: timestamp,
1326
+ note: z.string()
1327
+ })]));
1055
1328
  z.object({
1056
1329
  id: z.string(),
1057
1330
  label: z.string(),
@@ -1059,6 +1332,13 @@ z.object({
1059
1332
  args: z.array(z.string()),
1060
1333
  resolvable: z.boolean().nullable()
1061
1334
  }).strict();
1335
+ var TelegramDeliveryStatus = z.object({
1336
+ setupWarning: nullableString,
1337
+ lastFailure: z.object({
1338
+ message: z.string(),
1339
+ failedAt: timestamp
1340
+ }).nullable()
1341
+ });
1062
1342
  var SessionCardFields = z.object({
1063
1343
  id: sessionId,
1064
1344
  session: z.string(),
@@ -1073,6 +1353,7 @@ var SessionCardFields = z.object({
1073
1353
  worktree: z.boolean(),
1074
1354
  workspace: z.boolean().optional(),
1075
1355
  guarded: z.boolean().optional(),
1356
+ guardrailsReleased: z.boolean().optional(),
1076
1357
  resumeSessionId: nullableString,
1077
1358
  ephemeral: z.boolean().optional(),
1078
1359
  linkedPrs: z.array(LinkedPr).optional()
@@ -1153,7 +1434,9 @@ var clientVariants = [
1153
1434
  repos: z.array(z.string()).optional(),
1154
1435
  agent: z.string().optional(),
1155
1436
  dangerouslySkipPermissions: z.boolean().optional(),
1156
- unguarded: z.boolean().optional()
1437
+ unguarded: z.boolean().optional(),
1438
+ runInPlace: z.boolean().optional(),
1439
+ requestId
1157
1440
  }),
1158
1441
  loose("list-conversations", {
1159
1442
  id: sessionId,
@@ -1239,14 +1522,6 @@ var clientVariants = [
1239
1522
  message: "only discard may omit head",
1240
1523
  path: ["head"]
1241
1524
  }),
1242
- loose("factory-queue-intent", {
1243
- ...FactoryQueueIntentRequest.shape,
1244
- requestId
1245
- }),
1246
- loose("factory-control", {
1247
- ...FactoryControlRequest.shape,
1248
- requestId
1249
- }),
1250
1525
  loose("benchmark-action", {
1251
1526
  ...BenchmarkActionRequest.shape,
1252
1527
  requestId
@@ -1271,6 +1546,7 @@ var clientVariants = [
1271
1546
  id: z.unknown().optional(),
1272
1547
  requestId
1273
1548
  }),
1549
+ loose("telegram-test", { requestId }),
1274
1550
  loose("request-usage-report", {
1275
1551
  requestId,
1276
1552
  days: z.unknown().optional(),
@@ -1313,6 +1589,10 @@ var clientVariants = [
1313
1589
  id: sessionId,
1314
1590
  isOn: z.boolean()
1315
1591
  }),
1592
+ loose("set-session-guardrails", {
1593
+ id: sessionId,
1594
+ isOn: z.boolean()
1595
+ }),
1316
1596
  loose("conversation-approval", {
1317
1597
  id: sessionId,
1318
1598
  requestId: ConversationApproval.shape.requestId,
@@ -1331,6 +1611,14 @@ var clientVariants = [
1331
1611
  baseHash: z.string().min(1),
1332
1612
  requestId
1333
1613
  }),
1614
+ loose("session-coherence-journal", {
1615
+ id: sessionId,
1616
+ requestId
1617
+ }),
1618
+ loose("session-setup", {
1619
+ id: sessionId,
1620
+ requestId
1621
+ }),
1334
1622
  loose("client-error", ClientErrorReport.shape),
1335
1623
  loose("dismiss", {
1336
1624
  id: sessionId,
@@ -1344,6 +1632,7 @@ Object.freeze([
1344
1632
  "snapshot",
1345
1633
  "hooks-report",
1346
1634
  "save-hook-result",
1635
+ "add-session-result",
1347
1636
  "delete-hook-result",
1348
1637
  "workspace-repos",
1349
1638
  "set-workspace-repos-result",
@@ -1356,6 +1645,7 @@ Object.freeze([
1356
1645
  "session-prs",
1357
1646
  "session-modified",
1358
1647
  "session-git",
1648
+ "session-coherence-hooks",
1359
1649
  "session-agents",
1360
1650
  "session-wakeup",
1361
1651
  "session-prompt",
@@ -1381,6 +1671,10 @@ Object.freeze([
1381
1671
  "session-docs-snapshot",
1382
1672
  "session-doc-response",
1383
1673
  "session-doc-save-result",
1674
+ "session-coherence",
1675
+ "session-coherence-snapshot",
1676
+ "session-coherence-journal-response",
1677
+ "session-setup-response",
1384
1678
  "notify",
1385
1679
  "update-status",
1386
1680
  "update-progress",
@@ -1407,8 +1701,6 @@ Object.freeze([
1407
1701
  "radar-issue-action-result",
1408
1702
  "team-review-action-result",
1409
1703
  "benchmark-action-result",
1410
- "factory-queue-intent-result",
1411
- "factory-control-result",
1412
1704
  "my-pr-merge-result",
1413
1705
  "my-pr-keep-mergeable-result",
1414
1706
  "my-pr-merge-when-ready-result",
@@ -1416,7 +1708,6 @@ Object.freeze([
1416
1708
  "radar-archive-investigation-result",
1417
1709
  "team-review-status",
1418
1710
  "benchmark-status",
1419
- "factory-state",
1420
1711
  "my-prs-status",
1421
1712
  "issues-status",
1422
1713
  "usage-sessions",
@@ -1465,6 +1756,12 @@ var serverVariants = [
1465
1756
  error: optionalError,
1466
1757
  hook: opaqueObject.optional()
1467
1758
  }),
1759
+ loose("add-session-result", {
1760
+ requestId,
1761
+ ok: z.boolean(),
1762
+ error: optionalError,
1763
+ reason: z.enum(["not-git"]).optional()
1764
+ }),
1468
1765
  loose("delete-hook-result", {
1469
1766
  requestId,
1470
1767
  ok: z.boolean(),
@@ -1493,7 +1790,8 @@ var serverVariants = [
1493
1790
  event: z.string(),
1494
1791
  timestamp,
1495
1792
  skipPerms: z.boolean().optional(),
1496
- saneYolo: z.boolean().optional()
1793
+ saneYolo: z.boolean().optional(),
1794
+ failureReason: z.string().optional()
1497
1795
  }),
1498
1796
  loose("session-added", SessionCardFields.shape),
1499
1797
  loose("session-modified", SessionCardFields.shape),
@@ -1519,6 +1817,10 @@ var serverVariants = [
1519
1817
  id: sessionId,
1520
1818
  worktree: z.boolean()
1521
1819
  }),
1820
+ loose("session-coherence-hooks", {
1821
+ id: sessionId,
1822
+ coherenceHooks: CoherenceHooksState.nullable()
1823
+ }),
1522
1824
  loose("session-agents", {
1523
1825
  id: sessionId,
1524
1826
  activeAgents: z.number().int().nonnegative(),
@@ -1660,6 +1962,25 @@ var serverVariants = [
1660
1962
  conflict: z.boolean().optional(),
1661
1963
  error: optionalError
1662
1964
  }),
1965
+ loose("session-coherence", {
1966
+ id: sessionId,
1967
+ ...SessionCoherence.shape
1968
+ }),
1969
+ loose("session-coherence-snapshot", { sessions: z.record(z.string(), SessionCoherence) }),
1970
+ loose("session-coherence-journal-response", {
1971
+ requestId,
1972
+ id: sessionId,
1973
+ ok: z.boolean(),
1974
+ entries: z.array(CoherenceJournalEntry).max(200),
1975
+ error: optionalError
1976
+ }),
1977
+ loose("session-setup-response", {
1978
+ requestId,
1979
+ id: sessionId,
1980
+ ok: z.boolean(),
1981
+ setup: SessionSetup.optional(),
1982
+ error: optionalError
1983
+ }),
1663
1984
  loose("notify", {
1664
1985
  session: z.string(),
1665
1986
  category: z.string(),
@@ -1712,7 +2033,8 @@ var serverVariants = [
1712
2033
  root: z.string(),
1713
2034
  projects: z.array(openObject({
1714
2035
  name: z.string(),
1715
- path: z.string()
2036
+ path: z.string(),
2037
+ isGit: z.boolean().optional()
1716
2038
  }))
1717
2039
  })),
1718
2040
  suggestions: z.array(openObject({
@@ -1819,14 +2141,6 @@ var serverVariants = [
1819
2141
  ...TeamReviewActionResult.shape,
1820
2142
  requestId
1821
2143
  }),
1822
- loose("factory-queue-intent-result", {
1823
- ...FactoryQueueIntentResult.shape,
1824
- requestId
1825
- }),
1826
- loose("factory-control-result", {
1827
- ...FactoryControlResult.shape,
1828
- requestId
1829
- }),
1830
2144
  loose("benchmark-action-result", {
1831
2145
  ...BenchmarkActionResult.shape,
1832
2146
  requestId
@@ -1852,10 +2166,16 @@ var serverVariants = [
1852
2166
  ok: z.boolean(),
1853
2167
  error: optionalError
1854
2168
  }),
2169
+ loose("telegram-test-result", {
2170
+ requestId,
2171
+ ok: z.boolean(),
2172
+ error: optionalError,
2173
+ telegramDelivery: TelegramDeliveryStatus.nullable()
2174
+ }),
1855
2175
  TeamReviewStatus,
1856
2176
  BenchmarkStatus,
1857
- loose("factory-state", FactoryState.shape),
1858
2177
  MyPrsStatus,
2178
+ GithubPrsFrame,
1859
2179
  IssuesStatus,
1860
2180
  loose("usage-sessions", {
1861
2181
  ts: timestamp,
@@ -1948,71 +2268,5 @@ var serverVariants = [
1948
2268
  loose("restarting")
1949
2269
  ];
1950
2270
  z.discriminatedUnion("type", serverVariants);
1951
- var viewerCols = z.number().int().min(1).max(500);
1952
- var viewerRows = z.number().int().min(1).max(200);
1953
- var DataClientMessage = z.discriminatedUnion("type", [
1954
- z.object({
1955
- type: z.literal("input"),
1956
- data: z.string()
1957
- }),
1958
- z.object({
1959
- type: z.literal("claim"),
1960
- cols: viewerCols,
1961
- rows: viewerRows
1962
- }),
1963
- z.object({ type: z.literal("unview") })
1964
- ]);
1965
- z.object({
1966
- type: z.literal("pty-size"),
1967
- cols: viewerCols,
1968
- rows: viewerRows,
1969
- seq: z.number().int().nonnegative()
1970
- });
1971
- var DATA_ATTACH_HISTORY_PARAM = "history";
1972
- var DEEP_HISTORY_SCROLLBACK_LINES = 5e3;
1973
- var DataAttachHistory = z.enum(["screen", "deep"]);
1974
- function decodeJson(raw) {
1975
- try {
1976
- return JSON.parse(raw);
1977
- } catch {
1978
- return null;
1979
- }
1980
- }
1981
- function parseDataClientMessage(raw) {
1982
- const parsed = DataClientMessage.safeParse(decodeJson(raw));
1983
- if (!parsed.success) return null;
1984
- return parsed.data;
1985
- }
1986
- function parseDataAttachHistory(rawUrl) {
1987
- if (typeof rawUrl !== "string") return "screen";
1988
- const queryAt = rawUrl.indexOf("?");
1989
- if (queryAt === -1) return "screen";
1990
- const query = new URLSearchParams(rawUrl.slice(queryAt + 1).split("#")[0]);
1991
- const parsed = DataAttachHistory.safeParse(query.get(DATA_ATTACH_HISTORY_PARAM));
1992
- if (!parsed.success) return "screen";
1993
- return parsed.data;
1994
- }
1995
- //#endregion
1996
- //#region shared/contracts/hooks.ts
1997
- var HTTP_URL_RE = /^https?:\/\/\S+$/i;
1998
- var HookPayload = z.record(z.string(), z.unknown());
1999
- var HookEnvelope = z.object({
2000
- glimmervoidId: z.string().min(1),
2001
- event: z.string().min(1),
2002
- token: z.string().nullable().optional(),
2003
- payload: HookPayload
2004
- });
2005
- z.object({
2006
- id: z.string().min(1),
2007
- name: z.string().min(1),
2008
- event: z.string().min(1),
2009
- matcher: z.string().optional(),
2010
- type: z.enum(["command", "http"]),
2011
- command: z.string().optional(),
2012
- url: z.string().optional(),
2013
- timeout: z.number().int().positive().optional(),
2014
- enabled: z.boolean(),
2015
- projects: z.array(z.string()).optional()
2016
- }).passthrough();
2017
2271
  //#endregion
2018
- export { ChangeMap as A, MergedPrListing as B, GithubIssuePullRequestsRepository as C, IssuesSearchResponse as D, IssueUpdate as E, BenchmarkJudgement as F, TELEMETRY_EVENT_SCHEMAS as G, PrCheckoutCaseInput as H, BenchmarkRun as I, FACTORY_DECISION_OUTPUT_MAX_BYTES as J, TELEMETRY_KILL_SWITCH_FLAG as K, BenchmarkStatus as L, BenchmarkActionRequest as M, BenchmarkCase as N, IssuesState as O, BenchmarkId as P, BenchmarkSuite as R, planTitle as S, IssueKey as T, FeatureFlagsResponse as U, MinedPrReviewData as V, PendingCrashReport as W, FactoryDecisionLogLine as Y, PLAN_RESULT_HOOK_EVENT as _, parseDataClientMessage as a, PlanRevision as b, DIFF_ANNOTATION_NOTE_MAX_CHARS as c, MAX_RAW_LINE_CHARS as d, TraceCheckpoint as f, PLAN_HOOK_OUTPUT_MAX_CHARS as g, PLAN_HOOK_EVENT as h, parseDataAttachHistory as i, changeMapFactId as j, IssuesStatus as k, InstallFlavor as l, PLAN_BODY_CAP_BYTES as m, HookEnvelope as n, CONTROL_FRAME_MAX_BYTES as o, TraceRecord as p, TelemetryState as q, DEEP_HISTORY_SCROLLBACK_LINES as r, ClientMessage as s, HTTP_URL_RE as t, UpdateJournal as u, PLAN_TOOL_NAME as v, GithubIssueResponse as w, parseExitPlanModeHookPayload as x, PlanDecision as y, CommitComparison as z };
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 };