@snag-run/core 0.3.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,567 @@
1
+ import { z } from "zod";
2
+ declare const SCHEMA_ID: "failure-map/v1";
3
+ /** FMEA risk factors (each 1-5). RPN = severity * frequency * detection. The
4
+ * default bounded encoding; see {@link generationSchemaNoNumericBounds} for the
5
+ * gateway-safe variant (#231). */
6
+ export declare const scoresSchema: z.ZodObject<{
7
+ severity: z.ZodNumber;
8
+ frequency: z.ZodNumber;
9
+ detection: z.ZodNumber;
10
+ }, z.core.$strip>;
11
+ export type Scores = z.infer<typeof scoresSchema>;
12
+ /** A non-failure node on the map (the happy-path spine + branches). */
13
+ export declare const flowNodeSchema: z.ZodObject<{
14
+ type: z.ZodEnum<{
15
+ step: "step";
16
+ decision: "decision";
17
+ terminal: "terminal";
18
+ recovery: "recovery";
19
+ }>;
20
+ id: z.ZodString;
21
+ label: z.ZodString;
22
+ group: z.ZodOptional<z.ZodString>;
23
+ sourceRef: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ export type FlowNode = z.infer<typeof flowNodeSchema>;
26
+ /** A failure node / failure mode. Carries the required FMEA fields. */
27
+ export declare const failureNodeSchema: z.ZodObject<{
28
+ scores: z.ZodObject<{
29
+ severity: z.ZodNumber;
30
+ frequency: z.ZodNumber;
31
+ detection: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ type: z.ZodLiteral<"failure">;
34
+ class: z.ZodString;
35
+ silent: z.ZodBoolean;
36
+ handled: z.ZodBoolean;
37
+ reviewWouldMiss: z.ZodBoolean;
38
+ trigger: z.ZodString;
39
+ manifestation: z.ZodString;
40
+ suggestedFix: z.ZodString;
41
+ fixEffort: z.ZodOptional<z.ZodEnum<{
42
+ trivial: "trivial";
43
+ small: "small";
44
+ medium: "medium";
45
+ large: "large";
46
+ }>>;
47
+ fingerprint: z.ZodOptional<z.ZodString>;
48
+ id: z.ZodString;
49
+ label: z.ZodString;
50
+ group: z.ZodOptional<z.ZodString>;
51
+ sourceRef: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>;
53
+ export type FailureNode = z.infer<typeof failureNodeSchema>;
54
+ /** Discriminated union on `type`: failure vs. flow node. */
55
+ export declare const nodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ scores: z.ZodObject<{
57
+ severity: z.ZodNumber;
58
+ frequency: z.ZodNumber;
59
+ detection: z.ZodNumber;
60
+ }, z.core.$strip>;
61
+ type: z.ZodLiteral<"failure">;
62
+ class: z.ZodString;
63
+ silent: z.ZodBoolean;
64
+ handled: z.ZodBoolean;
65
+ reviewWouldMiss: z.ZodBoolean;
66
+ trigger: z.ZodString;
67
+ manifestation: z.ZodString;
68
+ suggestedFix: z.ZodString;
69
+ fixEffort: z.ZodOptional<z.ZodEnum<{
70
+ trivial: "trivial";
71
+ small: "small";
72
+ medium: "medium";
73
+ large: "large";
74
+ }>>;
75
+ fingerprint: z.ZodOptional<z.ZodString>;
76
+ id: z.ZodString;
77
+ label: z.ZodString;
78
+ group: z.ZodOptional<z.ZodString>;
79
+ sourceRef: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodEnum<{
82
+ step: "step";
83
+ decision: "decision";
84
+ terminal: "terminal";
85
+ recovery: "recovery";
86
+ }>;
87
+ id: z.ZodString;
88
+ label: z.ZodString;
89
+ group: z.ZodOptional<z.ZodString>;
90
+ sourceRef: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strip>], "type">;
92
+ export type Node = z.infer<typeof nodeSchema>;
93
+ export declare const edgeSchema: z.ZodObject<{
94
+ from: z.ZodString;
95
+ to: z.ZodString;
96
+ type: z.ZodEnum<{
97
+ recovery: "recovery";
98
+ failure: "failure";
99
+ happy: "happy";
100
+ branch: "branch";
101
+ }>;
102
+ condition: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>;
104
+ export type Edge = z.infer<typeof edgeSchema>;
105
+ /**
106
+ * The LLM generation surface: the tight { nodes, edges } analysis the model
107
+ * produces. Smallest surface = best structured-output reliability.
108
+ */
109
+ export declare const generationSchema: z.ZodObject<{
110
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
111
+ scores: z.ZodObject<{
112
+ severity: z.ZodNumber;
113
+ frequency: z.ZodNumber;
114
+ detection: z.ZodNumber;
115
+ }, z.core.$strip>;
116
+ type: z.ZodLiteral<"failure">;
117
+ class: z.ZodString;
118
+ silent: z.ZodBoolean;
119
+ handled: z.ZodBoolean;
120
+ reviewWouldMiss: z.ZodBoolean;
121
+ trigger: z.ZodString;
122
+ manifestation: z.ZodString;
123
+ suggestedFix: z.ZodString;
124
+ fixEffort: z.ZodOptional<z.ZodEnum<{
125
+ trivial: "trivial";
126
+ small: "small";
127
+ medium: "medium";
128
+ large: "large";
129
+ }>>;
130
+ fingerprint: z.ZodOptional<z.ZodString>;
131
+ id: z.ZodString;
132
+ label: z.ZodString;
133
+ group: z.ZodOptional<z.ZodString>;
134
+ sourceRef: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ type: z.ZodEnum<{
137
+ step: "step";
138
+ decision: "decision";
139
+ terminal: "terminal";
140
+ recovery: "recovery";
141
+ }>;
142
+ id: z.ZodString;
143
+ label: z.ZodString;
144
+ group: z.ZodOptional<z.ZodString>;
145
+ sourceRef: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strip>], "type">>;
147
+ edges: z.ZodArray<z.ZodObject<{
148
+ from: z.ZodString;
149
+ to: z.ZodString;
150
+ type: z.ZodEnum<{
151
+ recovery: "recovery";
152
+ failure: "failure";
153
+ happy: "happy";
154
+ branch: "branch";
155
+ }>;
156
+ condition: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>>;
158
+ }, z.core.$strip>;
159
+ export type Generation = z.infer<typeof generationSchema>;
160
+ export declare const generationSchemaNoNumericBounds: z.ZodObject<{
161
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
162
+ scores: z.ZodObject<{
163
+ severity: z.ZodNumber;
164
+ frequency: z.ZodNumber;
165
+ detection: z.ZodNumber;
166
+ }, z.core.$strip>;
167
+ type: z.ZodLiteral<"failure">;
168
+ class: z.ZodString;
169
+ silent: z.ZodBoolean;
170
+ handled: z.ZodBoolean;
171
+ reviewWouldMiss: z.ZodBoolean;
172
+ trigger: z.ZodString;
173
+ manifestation: z.ZodString;
174
+ suggestedFix: z.ZodString;
175
+ fixEffort: z.ZodOptional<z.ZodEnum<{
176
+ trivial: "trivial";
177
+ small: "small";
178
+ medium: "medium";
179
+ large: "large";
180
+ }>>;
181
+ fingerprint: z.ZodOptional<z.ZodString>;
182
+ id: z.ZodString;
183
+ label: z.ZodString;
184
+ group: z.ZodOptional<z.ZodString>;
185
+ sourceRef: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ type: z.ZodEnum<{
188
+ step: "step";
189
+ decision: "decision";
190
+ terminal: "terminal";
191
+ recovery: "recovery";
192
+ }>;
193
+ id: z.ZodString;
194
+ label: z.ZodString;
195
+ group: z.ZodOptional<z.ZodString>;
196
+ sourceRef: z.ZodOptional<z.ZodString>;
197
+ }, z.core.$strip>], "type">>;
198
+ edges: z.ZodArray<z.ZodObject<{
199
+ from: z.ZodString;
200
+ to: z.ZodString;
201
+ type: z.ZodEnum<{
202
+ recovery: "recovery";
203
+ failure: "failure";
204
+ happy: "happy";
205
+ branch: "branch";
206
+ }>;
207
+ condition: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strip>>;
209
+ }, z.core.$strip>;
210
+ export declare const REQUIRED_SOURCEREF_MESSAGE = "every code-map failure node must cite the file:line it lives on \u2014 set sourceRef (e.g. \"worktree.go:110\")";
211
+ /** The bounded code-intake generation surface: {@link generationSchema} with a
212
+ * required `sourceRef` on failure nodes (#272). Sent to providers that accept
213
+ * integer numeric bounds (anthropic). */
214
+ export declare const generationSchemaCode: z.ZodObject<{
215
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
216
+ scores: z.ZodObject<{
217
+ severity: z.ZodNumber;
218
+ frequency: z.ZodNumber;
219
+ detection: z.ZodNumber;
220
+ }, z.core.$strip>;
221
+ sourceRef: z.ZodString;
222
+ type: z.ZodLiteral<"failure">;
223
+ class: z.ZodString;
224
+ silent: z.ZodBoolean;
225
+ handled: z.ZodBoolean;
226
+ reviewWouldMiss: z.ZodBoolean;
227
+ trigger: z.ZodString;
228
+ manifestation: z.ZodString;
229
+ suggestedFix: z.ZodString;
230
+ fixEffort: z.ZodOptional<z.ZodEnum<{
231
+ trivial: "trivial";
232
+ small: "small";
233
+ medium: "medium";
234
+ large: "large";
235
+ }>>;
236
+ fingerprint: z.ZodOptional<z.ZodString>;
237
+ id: z.ZodString;
238
+ label: z.ZodString;
239
+ group: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ type: z.ZodEnum<{
242
+ step: "step";
243
+ decision: "decision";
244
+ terminal: "terminal";
245
+ recovery: "recovery";
246
+ }>;
247
+ id: z.ZodString;
248
+ label: z.ZodString;
249
+ group: z.ZodOptional<z.ZodString>;
250
+ sourceRef: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strip>], "type">>;
252
+ edges: z.ZodArray<z.ZodObject<{
253
+ from: z.ZodString;
254
+ to: z.ZodString;
255
+ type: z.ZodEnum<{
256
+ recovery: "recovery";
257
+ failure: "failure";
258
+ happy: "happy";
259
+ branch: "branch";
260
+ }>;
261
+ condition: z.ZodOptional<z.ZodString>;
262
+ }, z.core.$strip>>;
263
+ }, z.core.$strip>;
264
+ /** The bounds-free code-intake generation surface: {@link
265
+ * generationSchemaNoNumericBounds} with a required `sourceRef` on failure nodes
266
+ * (#272). Sent to OpenAI-compatible gateways that reject integer bounds. */
267
+ export declare const generationSchemaCodeNoNumericBounds: z.ZodObject<{
268
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
269
+ scores: z.ZodObject<{
270
+ severity: z.ZodNumber;
271
+ frequency: z.ZodNumber;
272
+ detection: z.ZodNumber;
273
+ }, z.core.$strip>;
274
+ sourceRef: z.ZodString;
275
+ type: z.ZodLiteral<"failure">;
276
+ class: z.ZodString;
277
+ silent: z.ZodBoolean;
278
+ handled: z.ZodBoolean;
279
+ reviewWouldMiss: z.ZodBoolean;
280
+ trigger: z.ZodString;
281
+ manifestation: z.ZodString;
282
+ suggestedFix: z.ZodString;
283
+ fixEffort: z.ZodOptional<z.ZodEnum<{
284
+ trivial: "trivial";
285
+ small: "small";
286
+ medium: "medium";
287
+ large: "large";
288
+ }>>;
289
+ fingerprint: z.ZodOptional<z.ZodString>;
290
+ id: z.ZodString;
291
+ label: z.ZodString;
292
+ group: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strip>, z.ZodObject<{
294
+ type: z.ZodEnum<{
295
+ step: "step";
296
+ decision: "decision";
297
+ terminal: "terminal";
298
+ recovery: "recovery";
299
+ }>;
300
+ id: z.ZodString;
301
+ label: z.ZodString;
302
+ group: z.ZodOptional<z.ZodString>;
303
+ sourceRef: z.ZodOptional<z.ZodString>;
304
+ }, z.core.$strip>], "type">>;
305
+ edges: z.ZodArray<z.ZodObject<{
306
+ from: z.ZodString;
307
+ to: z.ZodString;
308
+ type: z.ZodEnum<{
309
+ recovery: "recovery";
310
+ failure: "failure";
311
+ happy: "happy";
312
+ branch: "branch";
313
+ }>;
314
+ condition: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strip>>;
316
+ }, z.core.$strip>;
317
+ export declare const flatGenerationSchema: z.ZodObject<{
318
+ nodes: z.ZodArray<z.ZodObject<{
319
+ id: z.ZodString;
320
+ type: z.ZodEnum<{
321
+ step: "step";
322
+ decision: "decision";
323
+ terminal: "terminal";
324
+ recovery: "recovery";
325
+ failure: "failure";
326
+ }>;
327
+ label: z.ZodString;
328
+ group: z.ZodNullable<z.ZodString>;
329
+ sourceRef: z.ZodNullable<z.ZodString>;
330
+ class: z.ZodNullable<z.ZodString>;
331
+ silent: z.ZodNullable<z.ZodBoolean>;
332
+ handled: z.ZodNullable<z.ZodBoolean>;
333
+ reviewWouldMiss: z.ZodNullable<z.ZodBoolean>;
334
+ trigger: z.ZodNullable<z.ZodString>;
335
+ manifestation: z.ZodNullable<z.ZodString>;
336
+ suggestedFix: z.ZodNullable<z.ZodString>;
337
+ fixEffort: z.ZodNullable<z.ZodEnum<{
338
+ trivial: "trivial";
339
+ small: "small";
340
+ medium: "medium";
341
+ large: "large";
342
+ }>>;
343
+ scores: z.ZodNullable<z.ZodObject<{
344
+ severity: z.ZodNumber;
345
+ frequency: z.ZodNumber;
346
+ detection: z.ZodNumber;
347
+ }, z.core.$strip>>;
348
+ }, z.core.$strip>>;
349
+ edges: z.ZodArray<z.ZodObject<{
350
+ from: z.ZodString;
351
+ to: z.ZodString;
352
+ type: z.ZodEnum<{
353
+ recovery: "recovery";
354
+ failure: "failure";
355
+ happy: "happy";
356
+ branch: "branch";
357
+ }>;
358
+ condition: z.ZodNullable<z.ZodString>;
359
+ }, z.core.$strip>>;
360
+ }, z.core.$strip>;
361
+ export type FlatGeneration = z.infer<typeof flatGenerationSchema>;
362
+ /**
363
+ * Project a flat strict-mode generation ({@link flatGenerationSchema}) back onto
364
+ * the canonical discriminated-union {@link Generation}: drop the `null`
365
+ * failure-only fields from flow nodes, keep them on failure nodes, strip `null`
366
+ * optionals, then re-validate through {@link generationSchema}. That final parse
367
+ * re-imposes everything the flat surface relaxed for strict's sake — the 1-5
368
+ * `scores` bounds, the per-`type` required fields (a `failure` node missing its
369
+ * `scores`/`class` throws here), unique ids and edge referential integrity — so a
370
+ * malformed flat map fails exactly as a malformed union map would. `input` is
371
+ * `unknown` (defence-in-depth for an injected seam): it is parsed through the flat
372
+ * schema first.
373
+ */
374
+ export declare function normalizeFlatGeneration(input: unknown): Generation;
375
+ /**
376
+ * Repair LLM-emitted node ids to the canonical {@link NODE_ID_PATTERN} (#280)
377
+ * and rewrite every edge endpoint with the SAME mapping so references stay
378
+ * intact (an un-rewritten endpoint would become a dangling edge). Ids are
379
+ * mechanical identifiers — a bad character should be slugified, never fatal.
380
+ *
381
+ * Identity-preserving by construction:
382
+ * - Distinct raw ids that slugify to the same value are kept distinct (a `_2`,
383
+ * `_3`, … suffix on collision), so two nodes never silently merge.
384
+ * - Equal raw ids map to the same slug, so a genuine duplicate-id still trips
385
+ * {@link refineNodesAndEdges} downstream (this does not paper over duplicates).
386
+ * - An empty slug (all-punctuation id) falls back to `node`.
387
+ * - An edge endpoint with no matching node id is left as-is, so a dangling edge
388
+ * still surfaces as a referential-integrity error rather than being hidden.
389
+ *
390
+ * Does NOT touch the semantic `fingerprint` (over class/trigger/manifestation),
391
+ * so stable identity / reconciliation is unaffected.
392
+ */
393
+ export declare function coerceNodeIds(generation: Generation): Generation;
394
+ /** Split a code subject's `ref` ("a.go, dir/b.go") into its discovered path set
395
+ * (#272). Absent/empty ref → empty set (scope unknown: format is still checked,
396
+ * path membership is not). */
397
+ export declare function scopePathsFromRef(ref: string | undefined): Set<string>;
398
+ /**
399
+ * Validate a failure node's `sourceRef` as a concrete, in-scope citation (#272).
400
+ * Returns a human-readable problem (used verbatim as the retry/repair hint the
401
+ * model sees on a re-prompt) or `null` when the ref is acceptable. A valid ref is
402
+ * `file:line` (or `file:line-line`) whose `file` is one of the analyzed-scope
403
+ * paths. When `scopePaths` is empty the path-membership check is skipped (scope
404
+ * unknown) — the `file:line` shape is still enforced.
405
+ */
406
+ export declare function sourceRefProblem(ref: string | null | undefined, scopePaths: ReadonlySet<string>): string | null;
407
+ /**
408
+ * The artifact a Snag Map is derived from. `kind` is *what is being analyzed in
409
+ * the world* — `document` (a design) or `process` (a real business process; the
410
+ * intake is reserved, not wired yet), or a code grain: `function` ⊂ `module` ⊂
411
+ * `capability` (the cross-cutting grain spanning modules/boundaries, derived
412
+ * agentically by-name, #85), with `pull_request` the orthogonal change-axis. The
413
+ * enum is *additive* — already-committed maps keep validating as kinds are added.
414
+ */
415
+ export declare const subjectSchema: z.ZodObject<{
416
+ kind: z.ZodEnum<{
417
+ function: "function";
418
+ pull_request: "pull_request";
419
+ document: "document";
420
+ process: "process";
421
+ module: "module";
422
+ capability: "capability";
423
+ }>;
424
+ ref: z.ZodOptional<z.ZodString>;
425
+ title: z.ZodString;
426
+ sourceSha: z.ZodOptional<z.ZodString>;
427
+ }, z.core.$strip>;
428
+ export type Subject = z.infer<typeof subjectSchema>;
429
+ /** The code-intake subject kinds — the grains derived from existing source:
430
+ * `module` (review scope, {@link deriveCodeSubject}) and `capability` (by-name
431
+ * discovery, {@link deriveCapabilitySubject}). These are exactly the kinds for
432
+ * which a failure node MUST cite a `sourceRef` (#272); the spec kinds
433
+ * (`document`/`process`/`pull_request`) have no single source line to anchor.
434
+ * (`function` is in the enum but no intake derives it yet — it joins here when
435
+ * wired.) */
436
+ export declare function isCodeIntakeKind(kind: Subject["kind"]): boolean;
437
+ /** The harnesses that can drive the engine (#297) — pure provenance, nothing
438
+ * branches on the value. `snag` is the native CLI on API tokens; `claude-code`
439
+ * and `codex` are skills/wrappers that drive the same engine on a subscription.
440
+ * Knowing which produced a map is what makes the native-API-vs-via-harness
441
+ * quality comparison (eval / model-support work) possible. Additive: a new
442
+ * harness joins the enum without breaking already-committed maps. */
443
+ export declare const HARNESSES: readonly ["snag", "claude-code", "codex"];
444
+ export type Harness = (typeof HARNESSES)[number];
445
+ /** Default harness when none is declared — the native `snag` CLI. */
446
+ export declare const DEFAULT_HARNESS: Harness;
447
+ /**
448
+ * Engine-stamped provenance (never produced by the LLM) — the poor-man's
449
+ * observability bridge to a future trace server.
450
+ */
451
+ export declare const metaSchema: z.ZodObject<{
452
+ engineVersion: z.ZodString;
453
+ generatedAt: z.ZodString;
454
+ harness: z.ZodOptional<z.ZodEnum<{
455
+ snag: "snag";
456
+ "claude-code": "claude-code";
457
+ codex: "codex";
458
+ }>>;
459
+ adapter: z.ZodString;
460
+ providerName: z.ZodOptional<z.ZodString>;
461
+ model: z.ZodString;
462
+ apiUrl: z.ZodOptional<z.ZodString>;
463
+ promptVersion: z.ZodString;
464
+ gatherStoppedAtCap: z.ZodOptional<z.ZodBoolean>;
465
+ temperature: z.ZodOptional<z.ZodNumber>;
466
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
467
+ tokenUsage: z.ZodObject<{
468
+ input: z.ZodNumber;
469
+ output: z.ZodNumber;
470
+ total: z.ZodNumber;
471
+ }, z.core.$strip>;
472
+ }, z.core.$strip>;
473
+ export type Meta = z.infer<typeof metaSchema>;
474
+ /** The full persisted failure-map/v1 document: envelope + analysis. */
475
+ export declare const failureMapSchema: z.ZodObject<{
476
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
477
+ scores: z.ZodObject<{
478
+ severity: z.ZodNumber;
479
+ frequency: z.ZodNumber;
480
+ detection: z.ZodNumber;
481
+ }, z.core.$strip>;
482
+ type: z.ZodLiteral<"failure">;
483
+ class: z.ZodString;
484
+ silent: z.ZodBoolean;
485
+ handled: z.ZodBoolean;
486
+ reviewWouldMiss: z.ZodBoolean;
487
+ trigger: z.ZodString;
488
+ manifestation: z.ZodString;
489
+ suggestedFix: z.ZodString;
490
+ fixEffort: z.ZodOptional<z.ZodEnum<{
491
+ trivial: "trivial";
492
+ small: "small";
493
+ medium: "medium";
494
+ large: "large";
495
+ }>>;
496
+ fingerprint: z.ZodOptional<z.ZodString>;
497
+ id: z.ZodString;
498
+ label: z.ZodString;
499
+ group: z.ZodOptional<z.ZodString>;
500
+ sourceRef: z.ZodOptional<z.ZodString>;
501
+ }, z.core.$strip>, z.ZodObject<{
502
+ type: z.ZodEnum<{
503
+ step: "step";
504
+ decision: "decision";
505
+ terminal: "terminal";
506
+ recovery: "recovery";
507
+ }>;
508
+ id: z.ZodString;
509
+ label: z.ZodString;
510
+ group: z.ZodOptional<z.ZodString>;
511
+ sourceRef: z.ZodOptional<z.ZodString>;
512
+ }, z.core.$strip>], "type">>;
513
+ edges: z.ZodArray<z.ZodObject<{
514
+ from: z.ZodString;
515
+ to: z.ZodString;
516
+ type: z.ZodEnum<{
517
+ recovery: "recovery";
518
+ failure: "failure";
519
+ happy: "happy";
520
+ branch: "branch";
521
+ }>;
522
+ condition: z.ZodOptional<z.ZodString>;
523
+ }, z.core.$strip>>;
524
+ schema: z.ZodLiteral<"failure-map/v1">;
525
+ subject: z.ZodObject<{
526
+ kind: z.ZodEnum<{
527
+ function: "function";
528
+ pull_request: "pull_request";
529
+ document: "document";
530
+ process: "process";
531
+ module: "module";
532
+ capability: "capability";
533
+ }>;
534
+ ref: z.ZodOptional<z.ZodString>;
535
+ title: z.ZodString;
536
+ sourceSha: z.ZodOptional<z.ZodString>;
537
+ }, z.core.$strip>;
538
+ meta: z.ZodObject<{
539
+ engineVersion: z.ZodString;
540
+ generatedAt: z.ZodString;
541
+ harness: z.ZodOptional<z.ZodEnum<{
542
+ snag: "snag";
543
+ "claude-code": "claude-code";
544
+ codex: "codex";
545
+ }>>;
546
+ adapter: z.ZodString;
547
+ providerName: z.ZodOptional<z.ZodString>;
548
+ model: z.ZodString;
549
+ apiUrl: z.ZodOptional<z.ZodString>;
550
+ promptVersion: z.ZodString;
551
+ gatherStoppedAtCap: z.ZodOptional<z.ZodBoolean>;
552
+ temperature: z.ZodOptional<z.ZodNumber>;
553
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
554
+ tokenUsage: z.ZodObject<{
555
+ input: z.ZodNumber;
556
+ output: z.ZodNumber;
557
+ total: z.ZodNumber;
558
+ }, z.core.$strip>;
559
+ }, z.core.$strip>;
560
+ }, z.core.$strip>;
561
+ export type FailureMap = z.infer<typeof failureMapSchema>;
562
+ export { SCHEMA_ID };
563
+ /** Parse + validate the LLM generation surface; throws on invalid input. */
564
+ export declare function parseGeneration(input: unknown): Generation;
565
+ /** Parse + validate a full failure-map/v1 document; throws on invalid input. */
566
+ export declare function parseFailureMap(input: unknown): FailureMap;
567
+ //# sourceMapp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