@cat-factory/contracts 0.186.0 → 0.188.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.
@@ -0,0 +1,1373 @@
1
+ import * as v from 'valibot';
2
+ /** Hard ceiling on rows one page may return. */
3
+ export declare const DEBUG_MAX_PAGE_LIMIT = 100;
4
+ /** Hard ceiling on the per-field body preview a LIST may inline. */
5
+ export declare const DEBUG_MAX_PREVIEW_CHARS = 4000;
6
+ /** Hard ceiling on the per-field body a POINT READ may return. */
7
+ export declare const DEBUG_MAX_BODY_CHARS = 200000;
8
+ /**
9
+ * Hard ceiling on a point read's slice offset — comfortably above the store's own per-body
10
+ * cap (512 kB), so every stored character is reachable, while still rejecting a garbage
11
+ * offset instead of quietly serving an empty slice for it.
12
+ */
13
+ export declare const DEBUG_MAX_BODY_OFFSET = 2000000;
14
+ /** Hard ceiling on a `contains` search term's length. */
15
+ export declare const DEBUG_MAX_SEARCH_CHARS = 256;
16
+ /**
17
+ * A bounded slice of a stored text body, and enough metadata to know what was left out.
18
+ *
19
+ * This is THE reason the surface is safe to hand to a model: a bare truncated string is
20
+ * indistinguishable from a short one, so a reader would confidently conclude "the agent
21
+ * returned nothing" from a payload that merely hit its budget. `totalChars` is always the
22
+ * full stored length, measured in SQL, even when `text` is empty.
23
+ */
24
+ export declare const debugTextSchema: v.ObjectSchema<{
25
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
26
+ readonly text: v.StringSchema<undefined>;
27
+ /**
28
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
29
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
30
+ */
31
+ readonly chars: v.NumberSchema<undefined>;
32
+ /**
33
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
34
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
35
+ * `offset + chars <= totalChars` always holds.
36
+ */
37
+ readonly offset: v.NumberSchema<undefined>;
38
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
39
+ readonly totalChars: v.NumberSchema<undefined>;
40
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
41
+ readonly truncated: v.BooleanSchema<undefined>;
42
+ /**
43
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
44
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
45
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
46
+ * to jump straight to the match without transferring the bytes before it.
47
+ */
48
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
49
+ }, undefined>;
50
+ export type DebugText = v.InferOutput<typeof debugTextSchema>;
51
+ /**
52
+ * The lean run projection every debug list/overview leads with. Deliberately a SUMMARY, not
53
+ * the internal `ExecutionInstance`: a run's persisted `detail` blob carries per-step gate,
54
+ * judge, follow-up, container and validation state that is megabytes on a long run and means
55
+ * nothing to an external caller. What survives is what identifies a run and says whether it
56
+ * is worth opening.
57
+ */
58
+ export declare const debugRunSummarySchema: v.ObjectSchema<{
59
+ readonly runId: v.StringSchema<undefined>;
60
+ /** The board block the run is anchored on (a task, a service frame, or a headless anchor). */
61
+ readonly blockId: v.StringSchema<undefined>;
62
+ readonly pipelineId: v.StringSchema<undefined>;
63
+ readonly pipelineName: v.StringSchema<undefined>;
64
+ readonly status: v.PicklistSchema<["running", "blocked", "done", "paused", "failed"], undefined>;
65
+ /** Epoch-ms creation stamp — also the value the keyset cursor is minted from. */
66
+ readonly createdAt: v.NumberSchema<undefined>;
67
+ /** Index of the step the run is currently on. */
68
+ readonly currentStep: v.NumberSchema<undefined>;
69
+ /** How many steps the run's pipeline has. */
70
+ readonly stepCount: v.NumberSchema<undefined>;
71
+ /** Structured failure diagnostics when the run failed; null otherwise. */
72
+ readonly failure: v.NullableSchema<v.ObjectSchema<{
73
+ readonly kind: v.PicklistSchema<["preflight", "dispatch", "environment", "evicted", "timeout", "agent", "job_failed", "rejected", "companion_rejected", "stalled", "cancelled", "unknown"], undefined>;
74
+ readonly message: v.StringSchema<undefined>;
75
+ readonly detail: v.NullableSchema<v.StringSchema<undefined>, undefined>;
76
+ readonly hint: v.NullableSchema<v.StringSchema<undefined>, undefined>;
77
+ readonly reason: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
78
+ readonly occurredAt: v.NumberSchema<undefined>;
79
+ readonly lastSubtasks: v.NullableSchema<v.ObjectSchema<{
80
+ readonly completed: v.NumberSchema<undefined>;
81
+ readonly inProgress: v.NumberSchema<undefined>;
82
+ readonly total: v.NumberSchema<undefined>;
83
+ readonly items: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
84
+ readonly label: v.StringSchema<undefined>;
85
+ readonly status: v.PicklistSchema<["pending", "in_progress", "completed"], undefined>;
86
+ }, undefined>, undefined>, undefined>;
87
+ }, undefined>, undefined>;
88
+ readonly stepIndex: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
89
+ }, undefined>, undefined>;
90
+ }, undefined>;
91
+ export type DebugRunSummary = v.InferOutput<typeof debugRunSummarySchema>;
92
+ /** Query params for `GET /api/v1/debug/runs`. */
93
+ export declare const listDebugRunsQuerySchema: v.ObjectSchema<{
94
+ /** Filter to one internal execution status (`running`/`blocked`/`paused`/`done`/`failed`/…). */
95
+ readonly status: v.OptionalSchema<v.PicklistSchema<["running", "blocked", "done", "paused", "failed"], undefined>, undefined>;
96
+ /** Inclusive lower bound on the run's `createdAt`. */
97
+ readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number of epoch milliseconds">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
98
+ /** Cap on rows returned (default 25, hard max {@link DEBUG_MAX_PAGE_LIMIT}). */
99
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
100
+ /** Opaque keyset cursor from a previous page's `nextCursor`. */
101
+ readonly cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
102
+ }, undefined>;
103
+ export type ListDebugRunsQuery = v.InferOutput<typeof listDebugRunsQuerySchema>;
104
+ export declare const debugRunListSchema: v.ObjectSchema<{
105
+ readonly runs: v.ArraySchema<v.ObjectSchema<{
106
+ readonly runId: v.StringSchema<undefined>;
107
+ /** The board block the run is anchored on (a task, a service frame, or a headless anchor). */
108
+ readonly blockId: v.StringSchema<undefined>;
109
+ readonly pipelineId: v.StringSchema<undefined>;
110
+ readonly pipelineName: v.StringSchema<undefined>;
111
+ readonly status: v.PicklistSchema<["running", "blocked", "done", "paused", "failed"], undefined>;
112
+ /** Epoch-ms creation stamp — also the value the keyset cursor is minted from. */
113
+ readonly createdAt: v.NumberSchema<undefined>;
114
+ /** Index of the step the run is currently on. */
115
+ readonly currentStep: v.NumberSchema<undefined>;
116
+ /** How many steps the run's pipeline has. */
117
+ readonly stepCount: v.NumberSchema<undefined>;
118
+ /** Structured failure diagnostics when the run failed; null otherwise. */
119
+ readonly failure: v.NullableSchema<v.ObjectSchema<{
120
+ readonly kind: v.PicklistSchema<["preflight", "dispatch", "environment", "evicted", "timeout", "agent", "job_failed", "rejected", "companion_rejected", "stalled", "cancelled", "unknown"], undefined>;
121
+ readonly message: v.StringSchema<undefined>;
122
+ readonly detail: v.NullableSchema<v.StringSchema<undefined>, undefined>;
123
+ readonly hint: v.NullableSchema<v.StringSchema<undefined>, undefined>;
124
+ readonly reason: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
125
+ readonly occurredAt: v.NumberSchema<undefined>;
126
+ readonly lastSubtasks: v.NullableSchema<v.ObjectSchema<{
127
+ readonly completed: v.NumberSchema<undefined>;
128
+ readonly inProgress: v.NumberSchema<undefined>;
129
+ readonly total: v.NumberSchema<undefined>;
130
+ readonly items: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
131
+ readonly label: v.StringSchema<undefined>;
132
+ readonly status: v.PicklistSchema<["pending", "in_progress", "completed"], undefined>;
133
+ }, undefined>, undefined>, undefined>;
134
+ }, undefined>, undefined>;
135
+ readonly stepIndex: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
136
+ }, undefined>, undefined>;
137
+ }, undefined>, undefined>;
138
+ /** Cursor for the next page, or null when this was the last page. */
139
+ readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
140
+ }, undefined>;
141
+ export type DebugRunList = v.InferOutput<typeof debugRunListSchema>;
142
+ /**
143
+ * One step of the run, projected to what a diagnosis actually reads. The internal
144
+ * `PipelineStep` carries two dozen per-kind state blobs (gate, judge, follow-ups, container,
145
+ * validation, reproduction, …) that are megabytes on a long run and meaningless without the
146
+ * engine's vocabulary; what survives here is the step's identity, its clocks, and the two
147
+ * things that explain a stuck step — whether its container kept dying, and what killed it.
148
+ */
149
+ export declare const debugRunStepSchema: v.ObjectSchema<{
150
+ readonly index: v.NumberSchema<undefined>;
151
+ readonly agentKind: v.StringSchema<undefined>;
152
+ /** Lifecycle state (`pending` / `working` / `waiting_decision` / `done` / …). */
153
+ readonly state: v.StringSchema<undefined>;
154
+ readonly progress: v.NumberSchema<undefined>;
155
+ /** The resolved model this step dispatched on, when the engine recorded one. */
156
+ readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
157
+ /** Whether the pipeline skipped this step. */
158
+ readonly skipped: v.BooleanSchema<undefined>;
159
+ /** Epoch ms the step first began executing; null until it starts. */
160
+ readonly startedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
161
+ /** Epoch ms the step finished; null until it completes. */
162
+ readonly finishedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
163
+ /**
164
+ * Epoch ms of the container agent's last observed sign of life. The field that separates a
165
+ * genuinely-active-but-quiet step (a reviewer reading hundreds of files) from a wedged one,
166
+ * which no other clock here can distinguish. Null on non-container steps.
167
+ */
168
+ readonly lastActivityAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
169
+ /** Live/last subtask counts for an async container step; null when none were reported. */
170
+ readonly subtasks: v.NullableSchema<v.ObjectSchema<{
171
+ readonly completed: v.NumberSchema<undefined>;
172
+ readonly inProgress: v.NumberSchema<undefined>;
173
+ readonly total: v.NumberSchema<undefined>;
174
+ }, undefined>, undefined>;
175
+ /** Characters of prose output the step produced (0 ⇒ it produced none). */
176
+ readonly outputChars: v.NumberSchema<undefined>;
177
+ /** Whether the step produced a structured result (`step.custom`). */
178
+ readonly hasStructuredResult: v.BooleanSchema<undefined>;
179
+ /** How many times this step's container was evicted/crashed and automatically re-dispatched. */
180
+ readonly evictionRecoveries: v.NumberSchema<undefined>;
181
+ /**
182
+ * The post-mortem retained from the FIRST container death on this step (exit state plus a
183
+ * scrubbed log tail). Null when the step's containers never died. Bounded like every other
184
+ * body on this surface.
185
+ */
186
+ readonly firstEvictionDetail: v.NullableSchema<v.ObjectSchema<{
187
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
188
+ readonly text: v.StringSchema<undefined>;
189
+ /**
190
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
191
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
192
+ */
193
+ readonly chars: v.NumberSchema<undefined>;
194
+ /**
195
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
196
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
197
+ * `offset + chars <= totalChars` always holds.
198
+ */
199
+ readonly offset: v.NumberSchema<undefined>;
200
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
201
+ readonly totalChars: v.NumberSchema<undefined>;
202
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
203
+ readonly truncated: v.BooleanSchema<undefined>;
204
+ /**
205
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
206
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
207
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
208
+ * to jump straight to the match without transferring the bytes before it.
209
+ */
210
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
211
+ }, undefined>, undefined>;
212
+ }, undefined>;
213
+ export type DebugRunStep = v.InferOutput<typeof debugRunStepSchema>;
214
+ /**
215
+ * Whether one telemetry sink has anything for this run, and how much. The point of the block
216
+ * is to stop a caller issuing four detail requests to discover three of them are empty —
217
+ * `available: false` means the sink's repository is not wired on this deployment, so a zero
218
+ * count there is "we never recorded this", not "nothing happened".
219
+ *
220
+ * Availability is REPOSITORY presence only. The capture-time gates (`LLM_RECORD_PROMPTS`, the
221
+ * per-workspace `storeAgentContext`) act at record time and are invisible here: a workspace
222
+ * that opted out of capture reads `available: true, count: 0`.
223
+ */
224
+ export declare const debugSinkStatusSchema: v.ObjectSchema<{
225
+ readonly available: v.BooleanSchema<undefined>;
226
+ readonly count: v.NumberSchema<undefined>;
227
+ }, undefined>;
228
+ export type DebugSinkStatus = v.InferOutput<typeof debugSinkStatusSchema>;
229
+ /** Severity of a derived diagnostic signal. */
230
+ export declare const debugSignalSeveritySchema: v.PicklistSchema<["info", "warning", "error"], undefined>;
231
+ export type DebugSignalSeverity = v.InferOutput<typeof debugSignalSeveritySchema>;
232
+ /**
233
+ * A precomputed diagnostic hint. These are derivations the caller could make itself from the
234
+ * rollups — which is exactly why they are here: a model that has to rediscover "13 of 40 calls
235
+ * were truncated" by arithmetic over a payload will sometimes get it wrong, and will always
236
+ * spend context doing it. `code` is machine-readable and stable; `message` restates it in
237
+ * prose so the payload is useful with no external key.
238
+ */
239
+ export declare const debugSignalSchema: v.ObjectSchema<{
240
+ readonly code: v.StringSchema<undefined>;
241
+ readonly severity: v.PicklistSchema<["info", "warning", "error"], undefined>;
242
+ readonly message: v.StringSchema<undefined>;
243
+ /** How many occurrences the signal counts (truncated calls, failed provisions, …); null when it counts nothing. */
244
+ readonly count: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
245
+ /** The agent kind the signal is about, when it is scoped to one. */
246
+ readonly agentKind: v.NullableSchema<v.StringSchema<undefined>, undefined>;
247
+ /** The step index the signal is about, when it is scoped to one. */
248
+ readonly stepIndex: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
249
+ }, undefined>;
250
+ export type DebugSignal = v.InferOutput<typeof debugSignalSchema>;
251
+ /**
252
+ * The run's diagnostic map: identity, per-step state, what each telemetry sink holds, the
253
+ * SQL-aggregated LLM rollups, and the derived signals. Composed from aggregates only — it
254
+ * reads no prompt, response or context body, so it stays cheap enough to be the first call a
255
+ * debugging client always makes.
256
+ */
257
+ export declare const debugRunOverviewSchema: v.ObjectSchema<{
258
+ /** Schema marker so a consuming model knows the shape without external docs. */
259
+ readonly kind: v.LiteralSchema<"cat-factory.run-debug-overview", undefined>;
260
+ readonly version: v.LiteralSchema<1, undefined>;
261
+ /** When this projection was computed (epoch ms). */
262
+ readonly generatedAt: v.NumberSchema<undefined>;
263
+ readonly run: v.ObjectSchema<{
264
+ readonly runId: v.StringSchema<undefined>;
265
+ /** The board block the run is anchored on (a task, a service frame, or a headless anchor). */
266
+ readonly blockId: v.StringSchema<undefined>;
267
+ readonly pipelineId: v.StringSchema<undefined>;
268
+ readonly pipelineName: v.StringSchema<undefined>;
269
+ readonly status: v.PicklistSchema<["running", "blocked", "done", "paused", "failed"], undefined>;
270
+ /** Epoch-ms creation stamp — also the value the keyset cursor is minted from. */
271
+ readonly createdAt: v.NumberSchema<undefined>;
272
+ /** Index of the step the run is currently on. */
273
+ readonly currentStep: v.NumberSchema<undefined>;
274
+ /** How many steps the run's pipeline has. */
275
+ readonly stepCount: v.NumberSchema<undefined>;
276
+ /** Structured failure diagnostics when the run failed; null otherwise. */
277
+ readonly failure: v.NullableSchema<v.ObjectSchema<{
278
+ readonly kind: v.PicklistSchema<["preflight", "dispatch", "environment", "evicted", "timeout", "agent", "job_failed", "rejected", "companion_rejected", "stalled", "cancelled", "unknown"], undefined>;
279
+ readonly message: v.StringSchema<undefined>;
280
+ readonly detail: v.NullableSchema<v.StringSchema<undefined>, undefined>;
281
+ readonly hint: v.NullableSchema<v.StringSchema<undefined>, undefined>;
282
+ readonly reason: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
283
+ readonly occurredAt: v.NumberSchema<undefined>;
284
+ readonly lastSubtasks: v.NullableSchema<v.ObjectSchema<{
285
+ readonly completed: v.NumberSchema<undefined>;
286
+ readonly inProgress: v.NumberSchema<undefined>;
287
+ readonly total: v.NumberSchema<undefined>;
288
+ readonly items: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
289
+ readonly label: v.StringSchema<undefined>;
290
+ readonly status: v.PicklistSchema<["pending", "in_progress", "completed"], undefined>;
291
+ }, undefined>, undefined>, undefined>;
292
+ }, undefined>, undefined>;
293
+ readonly stepIndex: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
294
+ }, undefined>, undefined>;
295
+ }, undefined>;
296
+ readonly steps: v.ArraySchema<v.ObjectSchema<{
297
+ readonly index: v.NumberSchema<undefined>;
298
+ readonly agentKind: v.StringSchema<undefined>;
299
+ /** Lifecycle state (`pending` / `working` / `waiting_decision` / `done` / …). */
300
+ readonly state: v.StringSchema<undefined>;
301
+ readonly progress: v.NumberSchema<undefined>;
302
+ /** The resolved model this step dispatched on, when the engine recorded one. */
303
+ readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
304
+ /** Whether the pipeline skipped this step. */
305
+ readonly skipped: v.BooleanSchema<undefined>;
306
+ /** Epoch ms the step first began executing; null until it starts. */
307
+ readonly startedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
308
+ /** Epoch ms the step finished; null until it completes. */
309
+ readonly finishedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
310
+ /**
311
+ * Epoch ms of the container agent's last observed sign of life. The field that separates a
312
+ * genuinely-active-but-quiet step (a reviewer reading hundreds of files) from a wedged one,
313
+ * which no other clock here can distinguish. Null on non-container steps.
314
+ */
315
+ readonly lastActivityAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
316
+ /** Live/last subtask counts for an async container step; null when none were reported. */
317
+ readonly subtasks: v.NullableSchema<v.ObjectSchema<{
318
+ readonly completed: v.NumberSchema<undefined>;
319
+ readonly inProgress: v.NumberSchema<undefined>;
320
+ readonly total: v.NumberSchema<undefined>;
321
+ }, undefined>, undefined>;
322
+ /** Characters of prose output the step produced (0 ⇒ it produced none). */
323
+ readonly outputChars: v.NumberSchema<undefined>;
324
+ /** Whether the step produced a structured result (`step.custom`). */
325
+ readonly hasStructuredResult: v.BooleanSchema<undefined>;
326
+ /** How many times this step's container was evicted/crashed and automatically re-dispatched. */
327
+ readonly evictionRecoveries: v.NumberSchema<undefined>;
328
+ /**
329
+ * The post-mortem retained from the FIRST container death on this step (exit state plus a
330
+ * scrubbed log tail). Null when the step's containers never died. Bounded like every other
331
+ * body on this surface.
332
+ */
333
+ readonly firstEvictionDetail: v.NullableSchema<v.ObjectSchema<{
334
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
335
+ readonly text: v.StringSchema<undefined>;
336
+ /**
337
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
338
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
339
+ */
340
+ readonly chars: v.NumberSchema<undefined>;
341
+ /**
342
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
343
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
344
+ * `offset + chars <= totalChars` always holds.
345
+ */
346
+ readonly offset: v.NumberSchema<undefined>;
347
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
348
+ readonly totalChars: v.NumberSchema<undefined>;
349
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
350
+ readonly truncated: v.BooleanSchema<undefined>;
351
+ /**
352
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
353
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
354
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
355
+ * to jump straight to the match without transferring the bytes before it.
356
+ */
357
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
358
+ }, undefined>, undefined>;
359
+ }, undefined>, undefined>;
360
+ /**
361
+ * Where and on what the run's most recent container step executed (backend, model, repo,
362
+ * control-plane host), when the engine recorded it. Null for a pure-inline run.
363
+ */
364
+ readonly diagnostics: v.NullableSchema<v.ObjectSchema<{
365
+ readonly lastDispatch: v.OptionalSchema<v.ObjectSchema<{
366
+ readonly stepIndex: v.NumberSchema<undefined>;
367
+ readonly agentKind: v.StringSchema<undefined>;
368
+ readonly model: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
369
+ readonly executionBackend: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
370
+ readonly repo: v.OptionalSchema<v.ObjectSchema<{
371
+ readonly owner: v.StringSchema<undefined>;
372
+ readonly name: v.StringSchema<undefined>;
373
+ readonly baseBranch: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
374
+ readonly provider: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
375
+ }, undefined>, undefined>;
376
+ readonly at: v.NumberSchema<undefined>;
377
+ }, undefined>, undefined>;
378
+ readonly host: v.OptionalSchema<v.ObjectSchema<{
379
+ readonly platform: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
380
+ }, undefined>, undefined>;
381
+ }, undefined>, undefined>;
382
+ readonly sinks: v.ObjectSchema<{
383
+ readonly llmCalls: v.ObjectSchema<{
384
+ readonly available: v.BooleanSchema<undefined>;
385
+ readonly count: v.NumberSchema<undefined>;
386
+ }, undefined>;
387
+ readonly agentContext: v.ObjectSchema<{
388
+ readonly available: v.BooleanSchema<undefined>;
389
+ readonly count: v.NumberSchema<undefined>;
390
+ }, undefined>;
391
+ readonly searchQueries: v.ObjectSchema<{
392
+ readonly available: v.BooleanSchema<undefined>;
393
+ readonly count: v.NumberSchema<undefined>;
394
+ }, undefined>;
395
+ readonly provisioningLog: v.ObjectSchema<{
396
+ readonly available: v.BooleanSchema<undefined>;
397
+ readonly count: v.NumberSchema<undefined>;
398
+ }, undefined>;
399
+ }, undefined>;
400
+ /**
401
+ * The run's model activity, aggregated in SQL. `byAgentKind` reuses the same insight shape
402
+ * the LLM-metrics export publishes, derived ratios included, so the two never disagree.
403
+ */
404
+ readonly llm: v.ObjectSchema<{
405
+ readonly totals: v.ObjectSchema<{
406
+ readonly calls: v.NumberSchema<undefined>;
407
+ readonly promptTokens: v.NumberSchema<undefined>;
408
+ readonly cacheReadTokens: v.NumberSchema<undefined>;
409
+ readonly cacheWriteTokens: v.NumberSchema<undefined>;
410
+ readonly cacheHitRate: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
411
+ readonly completionTokens: v.NumberSchema<undefined>;
412
+ readonly upstreamMs: v.NumberSchema<undefined>;
413
+ readonly overheadMs: v.NumberSchema<undefined>;
414
+ readonly transportOverheadRatio: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
415
+ readonly errors: v.NumberSchema<undefined>;
416
+ readonly warnings: v.NumberSchema<undefined>;
417
+ readonly truncatedCalls: v.NumberSchema<undefined>;
418
+ }, undefined>;
419
+ readonly byAgentKind: v.ArraySchema<v.ObjectSchema<{
420
+ readonly agentKind: v.StringSchema<undefined>;
421
+ readonly calls: v.NumberSchema<undefined>;
422
+ readonly promptTokens: v.NumberSchema<undefined>;
423
+ readonly cacheReadTokens: v.NumberSchema<undefined>;
424
+ readonly cacheWriteTokens: v.NumberSchema<undefined>;
425
+ readonly cacheHitRate: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
426
+ readonly completionTokens: v.NumberSchema<undefined>;
427
+ readonly peakCompletionTokens: v.NumberSchema<undefined>;
428
+ readonly maxOutputTokens: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
429
+ readonly outputHeadroomRatio: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
430
+ readonly truncatedCalls: v.NumberSchema<undefined>;
431
+ readonly upstreamMs: v.NumberSchema<undefined>;
432
+ readonly overheadMs: v.NumberSchema<undefined>;
433
+ readonly transportOverheadRatio: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
434
+ readonly errors: v.NumberSchema<undefined>;
435
+ readonly warnings: v.NumberSchema<undefined>;
436
+ }, undefined>, undefined>;
437
+ }, undefined>;
438
+ readonly signals: v.ArraySchema<v.ObjectSchema<{
439
+ readonly code: v.StringSchema<undefined>;
440
+ readonly severity: v.PicklistSchema<["info", "warning", "error"], undefined>;
441
+ readonly message: v.StringSchema<undefined>;
442
+ /** How many occurrences the signal counts (truncated calls, failed provisions, …); null when it counts nothing. */
443
+ readonly count: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
444
+ /** The agent kind the signal is about, when it is scoped to one. */
445
+ readonly agentKind: v.NullableSchema<v.StringSchema<undefined>, undefined>;
446
+ /** The step index the signal is about, when it is scoped to one. */
447
+ readonly stepIndex: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
448
+ }, undefined>, undefined>;
449
+ }, undefined>;
450
+ export type DebugRunOverview = v.InferOutput<typeof debugRunOverviewSchema>;
451
+ /** Classification of a recorded call, precomputed so a caller need not re-derive it. */
452
+ export declare const debugCallOutcomeSchema: v.PicklistSchema<["ok", "warning", "error"], undefined>;
453
+ export type DebugCallOutcome = v.InferOutput<typeof debugCallOutcomeSchema>;
454
+ /** Chronological direction a call page walks in. */
455
+ export declare const debugCallOrderSchema: v.PicklistSchema<["newest", "oldest"], undefined>;
456
+ export type DebugCallOrder = v.InferOutput<typeof debugCallOrderSchema>;
457
+ /** How the single-call point read presents the prompt delta. */
458
+ export declare const debugCallViewSchema: v.PicklistSchema<["raw", "messages"], undefined>;
459
+ export type DebugCallView = v.InferOutput<typeof debugCallViewSchema>;
460
+ /**
461
+ * One message of a parsed prompt delta (`?view=messages` on the point read). The parse is
462
+ * LENIENT — both telemetry producers store `JSON.stringify` of a `{ role, content }` array,
463
+ * but the content shapes differ (OpenAI-style strings/parts/`tool_calls` from the proxy,
464
+ * vendor content blocks from the harness transcript), so unrecognised parts degrade to a
465
+ * `[type]` placeholder rather than failing the message.
466
+ */
467
+ export declare const debugPromptMessageSchema: v.ObjectSchema<{
468
+ /**
469
+ * The message's absolute position in the FULL conversation (`elidedLeadingMessages` +
470
+ * its position in the delta), so two calls' parsed views line up without arithmetic.
471
+ */
472
+ readonly index: v.NumberSchema<undefined>;
473
+ /** The message's role verbatim (`system` / `user` / `assistant` / `tool` / …), `unknown` when absent. */
474
+ readonly role: v.StringSchema<undefined>;
475
+ /** The message's `name` field (a named tool/function turn), when the producer recorded one. */
476
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
477
+ /** The tool invocation a tool-result turn answers, when the producer recorded the id. */
478
+ readonly toolCallId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
479
+ /** Tool invocations an assistant turn requested: the tool's name plus its budgeted serialized arguments. */
480
+ readonly toolCalls: v.ArraySchema<v.ObjectSchema<{
481
+ readonly name: v.StringSchema<undefined>;
482
+ readonly args: v.ObjectSchema<{
483
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
484
+ readonly text: v.StringSchema<undefined>;
485
+ /**
486
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
487
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
488
+ */
489
+ readonly chars: v.NumberSchema<undefined>;
490
+ /**
491
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
492
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
493
+ * `offset + chars <= totalChars` always holds.
494
+ */
495
+ readonly offset: v.NumberSchema<undefined>;
496
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
497
+ readonly totalChars: v.NumberSchema<undefined>;
498
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
499
+ readonly truncated: v.BooleanSchema<undefined>;
500
+ /**
501
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
502
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
503
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
504
+ * to jump straight to the match without transferring the bytes before it.
505
+ */
506
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
507
+ }, undefined>;
508
+ }, undefined>, undefined>;
509
+ /** The message's textual content, budgeted INDEPENDENTLY of every other message's. */
510
+ readonly content: v.ObjectSchema<{
511
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
512
+ readonly text: v.StringSchema<undefined>;
513
+ /**
514
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
515
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
516
+ */
517
+ readonly chars: v.NumberSchema<undefined>;
518
+ /**
519
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
520
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
521
+ * `offset + chars <= totalChars` always holds.
522
+ */
523
+ readonly offset: v.NumberSchema<undefined>;
524
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
525
+ readonly totalChars: v.NumberSchema<undefined>;
526
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
527
+ readonly truncated: v.BooleanSchema<undefined>;
528
+ /**
529
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
530
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
531
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
532
+ * to jump straight to the match without transferring the bytes before it.
533
+ */
534
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
535
+ }, undefined>;
536
+ }, undefined>;
537
+ export type DebugPromptMessage = v.InferOutput<typeof debugPromptMessageSchema>;
538
+ /**
539
+ * One recorded model call. The three body fields are always PRESENT but empty unless the
540
+ * caller asked for a preview — their `totalChars` is measured in SQL either way, so a
541
+ * zero-cost sweep still shows exactly how much text each call holds.
542
+ *
543
+ * `prompt` is the call's DELTA — only the messages this call appended to its conversation.
544
+ * That is how the store keeps prompts (a container agent re-sends its whole growing history
545
+ * every turn, so storing the full array per call is ~21x redundant), and it is also the right
546
+ * shape for reading: walk one agent kind's calls with `order=oldest` and the concatenated
547
+ * deltas ARE the conversation, with no prefix re-sent to the caller either.
548
+ */
549
+ export declare const debugLlmCallSchema: v.ObjectSchema<{
550
+ readonly callId: v.StringSchema<undefined>;
551
+ readonly runId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
552
+ readonly agentKind: v.StringSchema<undefined>;
553
+ readonly provider: v.StringSchema<undefined>;
554
+ readonly model: v.StringSchema<undefined>;
555
+ readonly createdAt: v.NumberSchema<undefined>;
556
+ readonly outcome: v.PicklistSchema<["ok", "warning", "error"], undefined>;
557
+ readonly ok: v.BooleanSchema<undefined>;
558
+ readonly httpStatus: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
559
+ readonly errorMessage: v.NullableSchema<v.StringSchema<undefined>, undefined>;
560
+ readonly finishReason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
561
+ readonly streaming: v.BooleanSchema<undefined>;
562
+ /**
563
+ * WHICH slice of the run spent this call: the agent's own edit loop (`agent`), a pre-PR
564
+ * validation repair round (`validation-repair`), a reproduction-proof repair round
565
+ * (`reproduction-repair`), … Stamped by whoever owns the loop boundary, never reconstructed
566
+ * from timestamps, which is why it is worth reading rather than inferring.
567
+ *
568
+ * `''` means the call could not be attributed — an older harness image, an inline call, or the
569
+ * un-phased proxy path. That is a REAL slice, not a gap: a run whose calls are all `''` was
570
+ * metered by something that has no phase concept, NOT one that spent nothing outside the agent.
571
+ */
572
+ readonly phase: v.StringSchema<undefined>;
573
+ /**
574
+ * The call's ordinal within its job's telemetry sequence (0-based), so a phase's calls can be
575
+ * ordered by TURN rather than by wall clock.
576
+ *
577
+ * `null` where the producing channel has no turn concept — the LLM proxy sees one HTTP request
578
+ * at a time with no job-scoped counter. Deliberately not faked to 0, which would read as "the
579
+ * first turn" and sort every proxied call to the front of its phase.
580
+ */
581
+ readonly turnIndex: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
582
+ /** Messages in the FULL request (not just the delta below). */
583
+ readonly messageCount: v.NumberSchema<undefined>;
584
+ /** Tools offered to the model (0 ⇒ the agent could not edit anything). */
585
+ readonly toolCount: v.NumberSchema<undefined>;
586
+ readonly requestMaxTokens: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
587
+ /** FRESH (uncached) input tokens — exclusive of both cache classes below. */
588
+ readonly promptTokens: v.NumberSchema<undefined>;
589
+ /** Input tokens served from the provider's prefix cache (priced around 0.1x fresh). */
590
+ readonly cacheReadTokens: v.NumberSchema<undefined>;
591
+ /**
592
+ * Input tokens WRITTEN into the provider's cache (priced 1.25-2x fresh). Kept apart from
593
+ * the reads because summed together, a loop that keeps invalidating and re-writing its
594
+ * prefix is indistinguishable from one riding a warm cache — and telling those apart is
595
+ * often the whole question when a run costs more than it should.
596
+ */
597
+ readonly cacheWriteTokens: v.NumberSchema<undefined>;
598
+ readonly completionTokens: v.NumberSchema<undefined>;
599
+ readonly totalTokens: v.NumberSchema<undefined>;
600
+ readonly upstreamMs: v.NumberSchema<undefined>;
601
+ readonly overheadMs: v.NumberSchema<undefined>;
602
+ readonly totalMs: v.NumberSchema<undefined>;
603
+ /** Leading messages elided from `prompt` because an earlier call in the chain stored them. */
604
+ readonly elidedLeadingMessages: v.NumberSchema<undefined>;
605
+ /** The messages this call APPENDED, as JSON (see the note above). */
606
+ readonly prompt: v.ObjectSchema<{
607
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
608
+ readonly text: v.StringSchema<undefined>;
609
+ /**
610
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
611
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
612
+ */
613
+ readonly chars: v.NumberSchema<undefined>;
614
+ /**
615
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
616
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
617
+ * `offset + chars <= totalChars` always holds.
618
+ */
619
+ readonly offset: v.NumberSchema<undefined>;
620
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
621
+ readonly totalChars: v.NumberSchema<undefined>;
622
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
623
+ readonly truncated: v.BooleanSchema<undefined>;
624
+ /**
625
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
626
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
627
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
628
+ * to jump straight to the match without transferring the bytes before it.
629
+ */
630
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
631
+ }, undefined>;
632
+ /** The assistant's visible reply. */
633
+ readonly response: v.ObjectSchema<{
634
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
635
+ readonly text: v.StringSchema<undefined>;
636
+ /**
637
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
638
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
639
+ */
640
+ readonly chars: v.NumberSchema<undefined>;
641
+ /**
642
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
643
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
644
+ * `offset + chars <= totalChars` always holds.
645
+ */
646
+ readonly offset: v.NumberSchema<undefined>;
647
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
648
+ readonly totalChars: v.NumberSchema<undefined>;
649
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
650
+ readonly truncated: v.BooleanSchema<undefined>;
651
+ /**
652
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
653
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
654
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
655
+ * to jump straight to the match without transferring the bytes before it.
656
+ */
657
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
658
+ }, undefined>;
659
+ /** The model's separate reasoning channel, when it emits one. */
660
+ readonly reasoning: v.ObjectSchema<{
661
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
662
+ readonly text: v.StringSchema<undefined>;
663
+ /**
664
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
665
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
666
+ */
667
+ readonly chars: v.NumberSchema<undefined>;
668
+ /**
669
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
670
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
671
+ * `offset + chars <= totalChars` always holds.
672
+ */
673
+ readonly offset: v.NumberSchema<undefined>;
674
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
675
+ readonly totalChars: v.NumberSchema<undefined>;
676
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
677
+ readonly truncated: v.BooleanSchema<undefined>;
678
+ /**
679
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
680
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
681
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
682
+ * to jump straight to the match without transferring the bytes before it.
683
+ */
684
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
685
+ }, undefined>;
686
+ /**
687
+ * The prompt delta parsed into per-message rows, each budgeted independently — present only
688
+ * on a `?view=messages` point read. `null` there means the stored delta did not parse as a
689
+ * message array (the raw `prompt` is served instead, so the view degrades rather than
690
+ * returning nothing); absent means the caller did not ask for the view. Independent budgets
691
+ * are the point: in the raw view one enormous leading tool result must be paid for before
692
+ * anything after it is visible, while here every message shows its head. The response's
693
+ * worst case stays computable — `(messageCount − elidedLeadingMessages) × bodyChars`, both
694
+ * factors already on the list row.
695
+ */
696
+ readonly promptMessages: v.OptionalSchema<v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
697
+ /**
698
+ * The message's absolute position in the FULL conversation (`elidedLeadingMessages` +
699
+ * its position in the delta), so two calls' parsed views line up without arithmetic.
700
+ */
701
+ readonly index: v.NumberSchema<undefined>;
702
+ /** The message's role verbatim (`system` / `user` / `assistant` / `tool` / …), `unknown` when absent. */
703
+ readonly role: v.StringSchema<undefined>;
704
+ /** The message's `name` field (a named tool/function turn), when the producer recorded one. */
705
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
706
+ /** The tool invocation a tool-result turn answers, when the producer recorded the id. */
707
+ readonly toolCallId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
708
+ /** Tool invocations an assistant turn requested: the tool's name plus its budgeted serialized arguments. */
709
+ readonly toolCalls: v.ArraySchema<v.ObjectSchema<{
710
+ readonly name: v.StringSchema<undefined>;
711
+ readonly args: v.ObjectSchema<{
712
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
713
+ readonly text: v.StringSchema<undefined>;
714
+ /**
715
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
716
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
717
+ */
718
+ readonly chars: v.NumberSchema<undefined>;
719
+ /**
720
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
721
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
722
+ * `offset + chars <= totalChars` always holds.
723
+ */
724
+ readonly offset: v.NumberSchema<undefined>;
725
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
726
+ readonly totalChars: v.NumberSchema<undefined>;
727
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
728
+ readonly truncated: v.BooleanSchema<undefined>;
729
+ /**
730
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
731
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
732
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
733
+ * to jump straight to the match without transferring the bytes before it.
734
+ */
735
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
736
+ }, undefined>;
737
+ }, undefined>, undefined>;
738
+ /** The message's textual content, budgeted INDEPENDENTLY of every other message's. */
739
+ readonly content: v.ObjectSchema<{
740
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
741
+ readonly text: v.StringSchema<undefined>;
742
+ /**
743
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
744
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
745
+ */
746
+ readonly chars: v.NumberSchema<undefined>;
747
+ /**
748
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
749
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
750
+ * `offset + chars <= totalChars` always holds.
751
+ */
752
+ readonly offset: v.NumberSchema<undefined>;
753
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
754
+ readonly totalChars: v.NumberSchema<undefined>;
755
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
756
+ readonly truncated: v.BooleanSchema<undefined>;
757
+ /**
758
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
759
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
760
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
761
+ * to jump straight to the match without transferring the bytes before it.
762
+ */
763
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
764
+ }, undefined>;
765
+ }, undefined>, undefined>, undefined>, undefined>;
766
+ }, undefined>;
767
+ export type DebugLlmCall = v.InferOutput<typeof debugLlmCallSchema>;
768
+ /** Query params for `GET /api/v1/debug/runs/:runId/llm-calls`. */
769
+ export declare const listDebugLlmCallsQuerySchema: v.ObjectSchema<{
770
+ /** Narrow to one step kind's conversation (`coder`, `ci-fixer`, …), applied in SQL. */
771
+ readonly agentKind: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, undefined>;
772
+ /**
773
+ * Narrow to one PHASE's calls (`agent`, `validation-repair`, `reproduction-repair`, …), an
774
+ * exact match applied in SQL. This is how "what did the repair rounds cost" is answered in one
775
+ * request rather than by paging the run and grouping client-side.
776
+ *
777
+ * Unlike `agentKind` the EMPTY string is accepted and meaningful: it selects the unattributed
778
+ * slice (an older harness image, an inline call, the un-phased proxy path), which is otherwise
779
+ * unreachable as a query.
780
+ */
781
+ readonly phase: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 120, undefined>]>, undefined>;
782
+ /** Narrow to failing or warning (truncated / filtered) calls only. */
783
+ readonly outcome: v.OptionalSchema<v.PicklistSchema<["ok", "warning", "error"], undefined>, undefined>;
784
+ /**
785
+ * Narrow to calls whose prompt delta, response or reasoning CONTAINS this literal substring,
786
+ * matched case-insensitively in SQL. This is the surface's grep — the way a caller finds a
787
+ * tool-validation error, a repeated apology, or any known marker across thousands of calls
788
+ * in ONE request instead of paging every body through its own context. Matched rows report
789
+ * a per-body `matchOffset`; wildcards (`%`/`_`) match literally.
790
+ */
791
+ readonly contains: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 256, undefined>]>, undefined>;
792
+ /** `newest` (default) for triage; `oldest` to read a conversation forwards. */
793
+ readonly order: v.OptionalSchema<v.PicklistSchema<["newest", "oldest"], undefined>, undefined>;
794
+ /** Cap on rows returned (default 25, hard max {@link DEBUG_MAX_PAGE_LIMIT}). */
795
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
796
+ readonly cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
797
+ /**
798
+ * Per-field body preview budget, 0..{@link DEBUG_MAX_PREVIEW_CHARS}. Default 0: the sweep
799
+ * returns sizes only. Bodies are sliced IN SQL, so an un-previewed page never reads the
800
+ * text columns out of the store at all.
801
+ */
802
+ readonly bodyChars: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4000, undefined>]>, undefined>;
803
+ }, undefined>;
804
+ export type ListDebugLlmCallsQuery = v.InferOutput<typeof listDebugLlmCallsQuerySchema>;
805
+ export declare const debugLlmCallListSchema: v.ObjectSchema<{
806
+ readonly calls: v.ArraySchema<v.ObjectSchema<{
807
+ readonly callId: v.StringSchema<undefined>;
808
+ readonly runId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
809
+ readonly agentKind: v.StringSchema<undefined>;
810
+ readonly provider: v.StringSchema<undefined>;
811
+ readonly model: v.StringSchema<undefined>;
812
+ readonly createdAt: v.NumberSchema<undefined>;
813
+ readonly outcome: v.PicklistSchema<["ok", "warning", "error"], undefined>;
814
+ readonly ok: v.BooleanSchema<undefined>;
815
+ readonly httpStatus: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
816
+ readonly errorMessage: v.NullableSchema<v.StringSchema<undefined>, undefined>;
817
+ readonly finishReason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
818
+ readonly streaming: v.BooleanSchema<undefined>;
819
+ /**
820
+ * WHICH slice of the run spent this call: the agent's own edit loop (`agent`), a pre-PR
821
+ * validation repair round (`validation-repair`), a reproduction-proof repair round
822
+ * (`reproduction-repair`), … Stamped by whoever owns the loop boundary, never reconstructed
823
+ * from timestamps, which is why it is worth reading rather than inferring.
824
+ *
825
+ * `''` means the call could not be attributed — an older harness image, an inline call, or the
826
+ * un-phased proxy path. That is a REAL slice, not a gap: a run whose calls are all `''` was
827
+ * metered by something that has no phase concept, NOT one that spent nothing outside the agent.
828
+ */
829
+ readonly phase: v.StringSchema<undefined>;
830
+ /**
831
+ * The call's ordinal within its job's telemetry sequence (0-based), so a phase's calls can be
832
+ * ordered by TURN rather than by wall clock.
833
+ *
834
+ * `null` where the producing channel has no turn concept — the LLM proxy sees one HTTP request
835
+ * at a time with no job-scoped counter. Deliberately not faked to 0, which would read as "the
836
+ * first turn" and sort every proxied call to the front of its phase.
837
+ */
838
+ readonly turnIndex: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
839
+ /** Messages in the FULL request (not just the delta below). */
840
+ readonly messageCount: v.NumberSchema<undefined>;
841
+ /** Tools offered to the model (0 ⇒ the agent could not edit anything). */
842
+ readonly toolCount: v.NumberSchema<undefined>;
843
+ readonly requestMaxTokens: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
844
+ /** FRESH (uncached) input tokens — exclusive of both cache classes below. */
845
+ readonly promptTokens: v.NumberSchema<undefined>;
846
+ /** Input tokens served from the provider's prefix cache (priced around 0.1x fresh). */
847
+ readonly cacheReadTokens: v.NumberSchema<undefined>;
848
+ /**
849
+ * Input tokens WRITTEN into the provider's cache (priced 1.25-2x fresh). Kept apart from
850
+ * the reads because summed together, a loop that keeps invalidating and re-writing its
851
+ * prefix is indistinguishable from one riding a warm cache — and telling those apart is
852
+ * often the whole question when a run costs more than it should.
853
+ */
854
+ readonly cacheWriteTokens: v.NumberSchema<undefined>;
855
+ readonly completionTokens: v.NumberSchema<undefined>;
856
+ readonly totalTokens: v.NumberSchema<undefined>;
857
+ readonly upstreamMs: v.NumberSchema<undefined>;
858
+ readonly overheadMs: v.NumberSchema<undefined>;
859
+ readonly totalMs: v.NumberSchema<undefined>;
860
+ /** Leading messages elided from `prompt` because an earlier call in the chain stored them. */
861
+ readonly elidedLeadingMessages: v.NumberSchema<undefined>;
862
+ /** The messages this call APPENDED, as JSON (see the note above). */
863
+ readonly prompt: v.ObjectSchema<{
864
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
865
+ readonly text: v.StringSchema<undefined>;
866
+ /**
867
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
868
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
869
+ */
870
+ readonly chars: v.NumberSchema<undefined>;
871
+ /**
872
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
873
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
874
+ * `offset + chars <= totalChars` always holds.
875
+ */
876
+ readonly offset: v.NumberSchema<undefined>;
877
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
878
+ readonly totalChars: v.NumberSchema<undefined>;
879
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
880
+ readonly truncated: v.BooleanSchema<undefined>;
881
+ /**
882
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
883
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
884
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
885
+ * to jump straight to the match without transferring the bytes before it.
886
+ */
887
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
888
+ }, undefined>;
889
+ /** The assistant's visible reply. */
890
+ readonly response: v.ObjectSchema<{
891
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
892
+ readonly text: v.StringSchema<undefined>;
893
+ /**
894
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
895
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
896
+ */
897
+ readonly chars: v.NumberSchema<undefined>;
898
+ /**
899
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
900
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
901
+ * `offset + chars <= totalChars` always holds.
902
+ */
903
+ readonly offset: v.NumberSchema<undefined>;
904
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
905
+ readonly totalChars: v.NumberSchema<undefined>;
906
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
907
+ readonly truncated: v.BooleanSchema<undefined>;
908
+ /**
909
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
910
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
911
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
912
+ * to jump straight to the match without transferring the bytes before it.
913
+ */
914
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
915
+ }, undefined>;
916
+ /** The model's separate reasoning channel, when it emits one. */
917
+ readonly reasoning: v.ObjectSchema<{
918
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
919
+ readonly text: v.StringSchema<undefined>;
920
+ /**
921
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
922
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
923
+ */
924
+ readonly chars: v.NumberSchema<undefined>;
925
+ /**
926
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
927
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
928
+ * `offset + chars <= totalChars` always holds.
929
+ */
930
+ readonly offset: v.NumberSchema<undefined>;
931
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
932
+ readonly totalChars: v.NumberSchema<undefined>;
933
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
934
+ readonly truncated: v.BooleanSchema<undefined>;
935
+ /**
936
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
937
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
938
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
939
+ * to jump straight to the match without transferring the bytes before it.
940
+ */
941
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
942
+ }, undefined>;
943
+ /**
944
+ * The prompt delta parsed into per-message rows, each budgeted independently — present only
945
+ * on a `?view=messages` point read. `null` there means the stored delta did not parse as a
946
+ * message array (the raw `prompt` is served instead, so the view degrades rather than
947
+ * returning nothing); absent means the caller did not ask for the view. Independent budgets
948
+ * are the point: in the raw view one enormous leading tool result must be paid for before
949
+ * anything after it is visible, while here every message shows its head. The response's
950
+ * worst case stays computable — `(messageCount − elidedLeadingMessages) × bodyChars`, both
951
+ * factors already on the list row.
952
+ */
953
+ readonly promptMessages: v.OptionalSchema<v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
954
+ /**
955
+ * The message's absolute position in the FULL conversation (`elidedLeadingMessages` +
956
+ * its position in the delta), so two calls' parsed views line up without arithmetic.
957
+ */
958
+ readonly index: v.NumberSchema<undefined>;
959
+ /** The message's role verbatim (`system` / `user` / `assistant` / `tool` / …), `unknown` when absent. */
960
+ readonly role: v.StringSchema<undefined>;
961
+ /** The message's `name` field (a named tool/function turn), when the producer recorded one. */
962
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
963
+ /** The tool invocation a tool-result turn answers, when the producer recorded the id. */
964
+ readonly toolCallId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
965
+ /** Tool invocations an assistant turn requested: the tool's name plus its budgeted serialized arguments. */
966
+ readonly toolCalls: v.ArraySchema<v.ObjectSchema<{
967
+ readonly name: v.StringSchema<undefined>;
968
+ readonly args: v.ObjectSchema<{
969
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
970
+ readonly text: v.StringSchema<undefined>;
971
+ /**
972
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
973
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
974
+ */
975
+ readonly chars: v.NumberSchema<undefined>;
976
+ /**
977
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
978
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
979
+ * `offset + chars <= totalChars` always holds.
980
+ */
981
+ readonly offset: v.NumberSchema<undefined>;
982
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
983
+ readonly totalChars: v.NumberSchema<undefined>;
984
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
985
+ readonly truncated: v.BooleanSchema<undefined>;
986
+ /**
987
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
988
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
989
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
990
+ * to jump straight to the match without transferring the bytes before it.
991
+ */
992
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
993
+ }, undefined>;
994
+ }, undefined>, undefined>;
995
+ /** The message's textual content, budgeted INDEPENDENTLY of every other message's. */
996
+ readonly content: v.ObjectSchema<{
997
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
998
+ readonly text: v.StringSchema<undefined>;
999
+ /**
1000
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1001
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1002
+ */
1003
+ readonly chars: v.NumberSchema<undefined>;
1004
+ /**
1005
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1006
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1007
+ * `offset + chars <= totalChars` always holds.
1008
+ */
1009
+ readonly offset: v.NumberSchema<undefined>;
1010
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1011
+ readonly totalChars: v.NumberSchema<undefined>;
1012
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1013
+ readonly truncated: v.BooleanSchema<undefined>;
1014
+ /**
1015
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1016
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1017
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1018
+ * to jump straight to the match without transferring the bytes before it.
1019
+ */
1020
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1021
+ }, undefined>;
1022
+ }, undefined>, undefined>, undefined>, undefined>;
1023
+ }, undefined>, undefined>;
1024
+ readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1025
+ }, undefined>;
1026
+ export type DebugLlmCallList = v.InferOutput<typeof debugLlmCallListSchema>;
1027
+ /** Query params for the single-call point read. */
1028
+ export declare const getDebugLlmCallQuerySchema: v.ObjectSchema<{
1029
+ /**
1030
+ * Per-field budget, 0..{@link DEBUG_MAX_BODY_CHARS}. Absent ⇒ the ceiling itself: a body
1031
+ * longer than {@link DEBUG_MAX_BODY_CHARS} is still cut (and says so via `truncated`).
1032
+ * Under `view=messages` this is the PER-MESSAGE content budget.
1033
+ */
1034
+ readonly bodyChars: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 200000, undefined>]>, undefined>;
1035
+ /**
1036
+ * 0-based code-point offset the body slices start at (raw view only; a parsed message view
1037
+ * always reads each message whole and budgets its head). Pair with a searched list row's
1038
+ * `matchOffset` to read the text AROUND a match — the `grep -C` of this surface.
1039
+ */
1040
+ readonly bodyOffset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 2000000, undefined>]>, undefined>;
1041
+ /**
1042
+ * `raw` (default) returns the delta as stored JSON; `messages` parses it into per-message
1043
+ * rows with independent budgets (see `promptMessages`). Falls back to `raw` semantics when
1044
+ * the stored delta does not parse.
1045
+ */
1046
+ readonly view: v.OptionalSchema<v.PicklistSchema<["raw", "messages"], undefined>, undefined>;
1047
+ }, undefined>;
1048
+ export type GetDebugLlmCallQuery = v.InferOutput<typeof getDebugLlmCallQuerySchema>;
1049
+ /**
1050
+ * One captured dispatch, SIZES ONLY. A snapshot carries the whole composed system prompt, the
1051
+ * whole user prompt, every folded fragment body and the full content of every injected
1052
+ * context file — a single row can be megabytes, so the list never inlines any of it (there is
1053
+ * no `bodyChars` here on purpose: a truncated prefix of a fragment ARRAY answers no question a
1054
+ * size does not, and the point read is one hop away).
1055
+ */
1056
+ export declare const debugAgentContextEntrySchema: v.ObjectSchema<{
1057
+ readonly snapshotId: v.StringSchema<undefined>;
1058
+ readonly agentKind: v.StringSchema<undefined>;
1059
+ /** The step index within the run's pipeline this dispatch belongs to. */
1060
+ readonly stepIndex: v.NumberSchema<undefined>;
1061
+ readonly createdAt: v.NumberSchema<undefined>;
1062
+ readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1063
+ readonly harness: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1064
+ readonly systemPromptChars: v.NumberSchema<undefined>;
1065
+ readonly userPromptChars: v.NumberSchema<undefined>;
1066
+ /**
1067
+ * Serialized size of the best-practice fragments folded into the system prompt, and of the
1068
+ * files injected into the container as `.cat-context/*` (their bodies included).
1069
+ *
1070
+ * Sizes rather than element counts on purpose: counting the entries of those two JSON
1071
+ * columns means either parsing them — which reads the very bodies this projection exists to
1072
+ * avoid — or calling `json_array_length` on a column where one malformed row would fail the
1073
+ * whole page. For "is there a lot in here, and did it change between attempts", a length
1074
+ * answers just as well; the point read gives the actual arrays.
1075
+ */
1076
+ readonly fragmentsChars: v.NumberSchema<undefined>;
1077
+ readonly contextFilesChars: v.NumberSchema<undefined>;
1078
+ }, undefined>;
1079
+ export type DebugAgentContextEntry = v.InferOutput<typeof debugAgentContextEntrySchema>;
1080
+ /** Query params for `GET /api/v1/debug/runs/:runId/agent-context`. */
1081
+ export declare const listDebugAgentContextQuerySchema: v.ObjectSchema<{
1082
+ /** Narrow to one step's dispatches (a step re-dispatched on retry records one snapshot each). */
1083
+ readonly stepIndex: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
1084
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
1085
+ readonly cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
1086
+ }, undefined>;
1087
+ export type ListDebugAgentContextQuery = v.InferOutput<typeof listDebugAgentContextQuerySchema>;
1088
+ export declare const debugAgentContextListSchema: v.ObjectSchema<{
1089
+ readonly snapshots: v.ArraySchema<v.ObjectSchema<{
1090
+ readonly snapshotId: v.StringSchema<undefined>;
1091
+ readonly agentKind: v.StringSchema<undefined>;
1092
+ /** The step index within the run's pipeline this dispatch belongs to. */
1093
+ readonly stepIndex: v.NumberSchema<undefined>;
1094
+ readonly createdAt: v.NumberSchema<undefined>;
1095
+ readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1096
+ readonly harness: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1097
+ readonly systemPromptChars: v.NumberSchema<undefined>;
1098
+ readonly userPromptChars: v.NumberSchema<undefined>;
1099
+ /**
1100
+ * Serialized size of the best-practice fragments folded into the system prompt, and of the
1101
+ * files injected into the container as `.cat-context/*` (their bodies included).
1102
+ *
1103
+ * Sizes rather than element counts on purpose: counting the entries of those two JSON
1104
+ * columns means either parsing them — which reads the very bodies this projection exists to
1105
+ * avoid — or calling `json_array_length` on a column where one malformed row would fail the
1106
+ * whole page. For "is there a lot in here, and did it change between attempts", a length
1107
+ * answers just as well; the point read gives the actual arrays.
1108
+ */
1109
+ readonly fragmentsChars: v.NumberSchema<undefined>;
1110
+ readonly contextFilesChars: v.NumberSchema<undefined>;
1111
+ }, undefined>, undefined>;
1112
+ readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1113
+ }, undefined>;
1114
+ export type DebugAgentContextList = v.InferOutput<typeof debugAgentContextListSchema>;
1115
+ /** One folded best-practice fragment, with its body bounded. */
1116
+ export declare const debugAgentContextFragmentSchema: v.ObjectSchema<{
1117
+ readonly id: v.StringSchema<undefined>;
1118
+ readonly body: v.ObjectSchema<{
1119
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1120
+ readonly text: v.StringSchema<undefined>;
1121
+ /**
1122
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1123
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1124
+ */
1125
+ readonly chars: v.NumberSchema<undefined>;
1126
+ /**
1127
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1128
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1129
+ * `offset + chars <= totalChars` always holds.
1130
+ */
1131
+ readonly offset: v.NumberSchema<undefined>;
1132
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1133
+ readonly totalChars: v.NumberSchema<undefined>;
1134
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1135
+ readonly truncated: v.BooleanSchema<undefined>;
1136
+ /**
1137
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1138
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1139
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1140
+ * to jump straight to the match without transferring the bytes before it.
1141
+ */
1142
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1143
+ }, undefined>;
1144
+ }, undefined>;
1145
+ export type DebugAgentContextFragment = v.InferOutput<typeof debugAgentContextFragmentSchema>;
1146
+ /** One injected context file, with its (already secret-scrubbed) body bounded. */
1147
+ export declare const debugAgentContextFileSchema: v.ObjectSchema<{
1148
+ readonly path: v.StringSchema<undefined>;
1149
+ readonly title: v.StringSchema<undefined>;
1150
+ readonly url: v.StringSchema<undefined>;
1151
+ readonly content: v.ObjectSchema<{
1152
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1153
+ readonly text: v.StringSchema<undefined>;
1154
+ /**
1155
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1156
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1157
+ */
1158
+ readonly chars: v.NumberSchema<undefined>;
1159
+ /**
1160
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1161
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1162
+ * `offset + chars <= totalChars` always holds.
1163
+ */
1164
+ readonly offset: v.NumberSchema<undefined>;
1165
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1166
+ readonly totalChars: v.NumberSchema<undefined>;
1167
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1168
+ readonly truncated: v.BooleanSchema<undefined>;
1169
+ /**
1170
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1171
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1172
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1173
+ * to jump straight to the match without transferring the bytes before it.
1174
+ */
1175
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1176
+ }, undefined>;
1177
+ }, undefined>;
1178
+ export type DebugAgentContextFile = v.InferOutput<typeof debugAgentContextFileSchema>;
1179
+ /**
1180
+ * The full context one dispatch was provided. Every body is budgeted independently so one
1181
+ * enormous injected file cannot crowd out the prompts a reader actually came for.
1182
+ */
1183
+ export declare const debugAgentContextDetailSchema: v.ObjectSchema<{
1184
+ readonly snapshotId: v.StringSchema<undefined>;
1185
+ readonly runId: v.StringSchema<undefined>;
1186
+ readonly agentKind: v.StringSchema<undefined>;
1187
+ readonly stepIndex: v.NumberSchema<undefined>;
1188
+ readonly createdAt: v.NumberSchema<undefined>;
1189
+ readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1190
+ readonly harness: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1191
+ readonly systemPrompt: v.ObjectSchema<{
1192
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1193
+ readonly text: v.StringSchema<undefined>;
1194
+ /**
1195
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1196
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1197
+ */
1198
+ readonly chars: v.NumberSchema<undefined>;
1199
+ /**
1200
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1201
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1202
+ * `offset + chars <= totalChars` always holds.
1203
+ */
1204
+ readonly offset: v.NumberSchema<undefined>;
1205
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1206
+ readonly totalChars: v.NumberSchema<undefined>;
1207
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1208
+ readonly truncated: v.BooleanSchema<undefined>;
1209
+ /**
1210
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1211
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1212
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1213
+ * to jump straight to the match without transferring the bytes before it.
1214
+ */
1215
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1216
+ }, undefined>;
1217
+ readonly userPrompt: v.ObjectSchema<{
1218
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1219
+ readonly text: v.StringSchema<undefined>;
1220
+ /**
1221
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1222
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1223
+ */
1224
+ readonly chars: v.NumberSchema<undefined>;
1225
+ /**
1226
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1227
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1228
+ * `offset + chars <= totalChars` always holds.
1229
+ */
1230
+ readonly offset: v.NumberSchema<undefined>;
1231
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1232
+ readonly totalChars: v.NumberSchema<undefined>;
1233
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1234
+ readonly truncated: v.BooleanSchema<undefined>;
1235
+ /**
1236
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1237
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1238
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1239
+ * to jump straight to the match without transferring the bytes before it.
1240
+ */
1241
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1242
+ }, undefined>;
1243
+ readonly fragments: v.ArraySchema<v.ObjectSchema<{
1244
+ readonly id: v.StringSchema<undefined>;
1245
+ readonly body: v.ObjectSchema<{
1246
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1247
+ readonly text: v.StringSchema<undefined>;
1248
+ /**
1249
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1250
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1251
+ */
1252
+ readonly chars: v.NumberSchema<undefined>;
1253
+ /**
1254
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1255
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1256
+ * `offset + chars <= totalChars` always holds.
1257
+ */
1258
+ readonly offset: v.NumberSchema<undefined>;
1259
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1260
+ readonly totalChars: v.NumberSchema<undefined>;
1261
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1262
+ readonly truncated: v.BooleanSchema<undefined>;
1263
+ /**
1264
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1265
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1266
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1267
+ * to jump straight to the match without transferring the bytes before it.
1268
+ */
1269
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1270
+ }, undefined>;
1271
+ }, undefined>, undefined>;
1272
+ readonly contextFiles: v.ArraySchema<v.ObjectSchema<{
1273
+ readonly path: v.StringSchema<undefined>;
1274
+ readonly title: v.StringSchema<undefined>;
1275
+ readonly url: v.StringSchema<undefined>;
1276
+ readonly content: v.ObjectSchema<{
1277
+ /** The returned slice — `chars` characters of the stored body, starting at `offset`. */
1278
+ readonly text: v.StringSchema<undefined>;
1279
+ /**
1280
+ * Characters actually returned in {@link debugTextSchema} `text`, in Unicode CODE POINTS —
1281
+ * the unit SQL `length()`/`substr()` measure in (an emoji counts once, not twice).
1282
+ */
1283
+ readonly chars: v.NumberSchema<undefined>;
1284
+ /**
1285
+ * 0-based code-point position `text` starts at within the stored body — 0 unless the caller
1286
+ * asked for a later window via `?bodyOffset=`. Clamped to `totalChars`, so
1287
+ * `offset + chars <= totalChars` always holds.
1288
+ */
1289
+ readonly offset: v.NumberSchema<undefined>;
1290
+ /** Characters stored for this field (the full code-point length, regardless of what was returned). */
1291
+ readonly totalChars: v.NumberSchema<undefined>;
1292
+ /** True when `chars < totalChars`, i.e. `text` is not the entire stored body. */
1293
+ readonly truncated: v.BooleanSchema<undefined>;
1294
+ /**
1295
+ * 0-based code-point offset of the first case-insensitive occurrence of the request's
1296
+ * `?contains=` term in this body, or null when the term occurs only in a sibling body.
1297
+ * Present ONLY on rows of a searched list — pair it with the point read's `?bodyOffset=`
1298
+ * to jump straight to the match without transferring the bytes before it.
1299
+ */
1300
+ readonly matchOffset: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
1301
+ }, undefined>;
1302
+ }, undefined>, undefined>;
1303
+ /**
1304
+ * Redacted structural context (repo, branches, infra spec, the run's decisions and revision
1305
+ * feedback). Small and already deep-scrubbed at capture time, so it is returned whole.
1306
+ */
1307
+ readonly extras: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
1308
+ }, undefined>;
1309
+ export type DebugAgentContextDetail = v.InferOutput<typeof debugAgentContextDetailSchema>;
1310
+ /** Query params for the single-snapshot point read. */
1311
+ export declare const getDebugAgentContextQuerySchema: v.ObjectSchema<{
1312
+ /**
1313
+ * Per-body budget, 0..{@link DEBUG_MAX_BODY_CHARS}. Absent ⇒ the ceiling itself: a body
1314
+ * longer than {@link DEBUG_MAX_BODY_CHARS} is still cut (and says so via `truncated`).
1315
+ */
1316
+ readonly bodyChars: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 200000, undefined>]>, undefined>;
1317
+ /**
1318
+ * 0-based code-point offset every body slice starts at. Applied to ALL of the snapshot's
1319
+ * bodies uniformly (it exists to reach the tail of ONE large body the index sized; the
1320
+ * others simply run out and return empty slices past their end).
1321
+ */
1322
+ readonly bodyOffset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 2000000, undefined>]>, undefined>;
1323
+ }, undefined>;
1324
+ export type GetDebugAgentContextQuery = v.InferOutput<typeof getDebugAgentContextQuerySchema>;
1325
+ /** Query params for the two small-row lists (`search-queries`, `logs`). */
1326
+ export declare const listDebugPageQuerySchema: v.ObjectSchema<{
1327
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
1328
+ readonly cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
1329
+ }, undefined>;
1330
+ export type ListDebugPageQuery = v.InferOutput<typeof listDebugPageQuerySchema>;
1331
+ /**
1332
+ * The web searches the run's agents performed. Rows are small (the query text is capped at
1333
+ * 8 kB at capture time), so they are returned whole rather than as {@link debugTextSchema}.
1334
+ */
1335
+ export declare const debugSearchQueryListSchema: v.ObjectSchema<{
1336
+ readonly queries: v.ArraySchema<v.ObjectSchema<{
1337
+ readonly id: v.StringSchema<undefined>;
1338
+ readonly workspaceId: v.StringSchema<undefined>;
1339
+ readonly executionId: v.StringSchema<undefined>;
1340
+ readonly agentKind: v.StringSchema<undefined>;
1341
+ readonly provider: v.NullableSchema<v.PicklistSchema<["brave", "searxng"], undefined>, undefined>;
1342
+ readonly query: v.StringSchema<undefined>;
1343
+ readonly resultCount: v.NumberSchema<undefined>;
1344
+ readonly createdAt: v.NumberSchema<undefined>;
1345
+ }, undefined>, undefined>;
1346
+ readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1347
+ }, undefined>;
1348
+ export type DebugSearchQueryList = v.InferOutput<typeof debugSearchQueryListSchema>;
1349
+ /**
1350
+ * The run's slice of the provisioning event log — every attempt to spin up or tear down the
1351
+ * throwaway infrastructure it ran on, with the verbatim (secret-scrubbed) provider error. This
1352
+ * is the half of "why did it fail" that no model call can answer: a run whose container never
1353
+ * came up has no LLM telemetry at all, and this is where its cause of death is written.
1354
+ */
1355
+ export declare const debugLogListSchema: v.ObjectSchema<{
1356
+ readonly entries: v.ArraySchema<v.ObjectSchema<{
1357
+ readonly id: v.StringSchema<undefined>;
1358
+ readonly workspaceId: v.StringSchema<undefined>;
1359
+ readonly subsystem: v.PicklistSchema<["environment", "runner-pool", "container"], undefined>;
1360
+ readonly operation: v.PicklistSchema<["provision", "teardown", "status", "dispatch", "release", "poll-failure"], undefined>;
1361
+ readonly targetId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1362
+ readonly providerId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1363
+ readonly blockId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1364
+ readonly executionId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1365
+ readonly outcome: v.PicklistSchema<["success", "failure"], undefined>;
1366
+ readonly error: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1367
+ readonly detail: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1368
+ readonly createdAt: v.NumberSchema<undefined>;
1369
+ }, undefined>, undefined>;
1370
+ readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1371
+ }, undefined>;
1372
+ export type DebugLogList = v.InferOutput<typeof debugLogListSchema>;
1373
+ //# sourceMappingURL=debug-api.d.ts.map