@maintainabilityai/research-runner 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/bin/research-runner.js +2 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +209 -0
  6. package/dist/llm/anthropic-client.d.ts +39 -0
  7. package/dist/llm/anthropic-client.js +74 -0
  8. package/dist/llm/github-models-client.d.ts +46 -0
  9. package/dist/llm/github-models-client.js +78 -0
  10. package/dist/llm/llm-router.d.ts +46 -0
  11. package/dist/llm/llm-router.js +60 -0
  12. package/dist/mesh/get-mesh-sha.d.ts +1 -0
  13. package/dist/mesh/get-mesh-sha.js +27 -0
  14. package/dist/mesh/mesh-reader.d.ts +14 -0
  15. package/dist/mesh/mesh-reader.js +392 -0
  16. package/dist/mesh/prompt-loader.d.ts +22 -0
  17. package/dist/mesh/prompt-loader.js +119 -0
  18. package/dist/mesh/threat-model-reader.d.ts +33 -0
  19. package/dist/mesh/threat-model-reader.js +123 -0
  20. package/dist/runner/archeologist.d.ts +39 -0
  21. package/dist/runner/archeologist.js +620 -0
  22. package/dist/runner/audit-emitter.d.ts +62 -0
  23. package/dist/runner/audit-emitter.js +210 -0
  24. package/dist/runner/hatters-tag-builder.d.ts +52 -0
  25. package/dist/runner/hatters-tag-builder.js +40 -0
  26. package/dist/runner/nodes/analyze-architecture.d.ts +10 -0
  27. package/dist/runner/nodes/analyze-architecture.js +447 -0
  28. package/dist/runner/nodes/arxiv-search.d.ts +12 -0
  29. package/dist/runner/nodes/arxiv-search.js +52 -0
  30. package/dist/runner/nodes/clone-and-index.d.ts +32 -0
  31. package/dist/runner/nodes/clone-and-index.js +158 -0
  32. package/dist/runner/nodes/dedupe-and-rank.d.ts +27 -0
  33. package/dist/runner/nodes/dedupe-and-rank.js +98 -0
  34. package/dist/runner/nodes/deterministic-review.d.ts +55 -0
  35. package/dist/runner/nodes/deterministic-review.js +206 -0
  36. package/dist/runner/nodes/expert-review.d.ts +68 -0
  37. package/dist/runner/nodes/expert-review.js +197 -0
  38. package/dist/runner/nodes/gap-analysis.d.ts +48 -0
  39. package/dist/runner/nodes/gap-analysis.js +153 -0
  40. package/dist/runner/nodes/generate-prd-manifest.d.ts +53 -0
  41. package/dist/runner/nodes/generate-prd-manifest.js +209 -0
  42. package/dist/runner/nodes/hackernews-search.d.ts +12 -0
  43. package/dist/runner/nodes/hackernews-search.js +63 -0
  44. package/dist/runner/nodes/identify-gaps.d.ts +33 -0
  45. package/dist/runner/nodes/identify-gaps.js +185 -0
  46. package/dist/runner/nodes/plan-queries.d.ts +28 -0
  47. package/dist/runner/nodes/plan-queries.js +120 -0
  48. package/dist/runner/nodes/prd-validator.d.ts +51 -0
  49. package/dist/runner/nodes/prd-validator.js +203 -0
  50. package/dist/runner/nodes/synthesis-archaeology-validator.d.ts +22 -0
  51. package/dist/runner/nodes/synthesis-archaeology-validator.js +131 -0
  52. package/dist/runner/nodes/synthesis-validator.d.ts +51 -0
  53. package/dist/runner/nodes/synthesis-validator.js +185 -0
  54. package/dist/runner/nodes/synthesize-prd.d.ts +84 -0
  55. package/dist/runner/nodes/synthesize-prd.js +202 -0
  56. package/dist/runner/nodes/synthesize-report.d.ts +53 -0
  57. package/dist/runner/nodes/synthesize-report.js +188 -0
  58. package/dist/runner/nodes/tavily-search.d.ts +21 -0
  59. package/dist/runner/nodes/tavily-search.js +57 -0
  60. package/dist/runner/nodes/uspto-search.d.ts +13 -0
  61. package/dist/runner/nodes/uspto-search.js +62 -0
  62. package/dist/runner/nodes/verify-grounding.d.ts +54 -0
  63. package/dist/runner/nodes/verify-grounding.js +134 -0
  64. package/dist/runner/prd.d.ts +28 -0
  65. package/dist/runner/prd.js +494 -0
  66. package/dist/schemas/audit-event.d.ts +1151 -0
  67. package/dist/schemas/audit-event.js +141 -0
  68. package/dist/schemas/index.d.ts +17 -0
  69. package/dist/schemas/index.js +33 -0
  70. package/dist/schemas/mesh-context.d.ts +415 -0
  71. package/dist/schemas/mesh-context.js +95 -0
  72. package/dist/schemas/observed-architecture.d.ts +262 -0
  73. package/dist/schemas/observed-architecture.js +90 -0
  74. package/dist/schemas/prd-brief.d.ts +111 -0
  75. package/dist/schemas/prd-brief.js +37 -0
  76. package/dist/schemas/prd-doc.d.ts +249 -0
  77. package/dist/schemas/prd-doc.js +42 -0
  78. package/dist/schemas/prd-manifest.d.ts +171 -0
  79. package/dist/schemas/prd-manifest.js +73 -0
  80. package/dist/schemas/primitives.d.ts +47 -0
  81. package/dist/schemas/primitives.js +41 -0
  82. package/dist/schemas/query-plan.d.ts +33 -0
  83. package/dist/schemas/query-plan.js +25 -0
  84. package/dist/schemas/ranked-source.d.ts +82 -0
  85. package/dist/schemas/ranked-source.js +29 -0
  86. package/dist/schemas/research-brief.d.ts +114 -0
  87. package/dist/schemas/research-brief.js +49 -0
  88. package/dist/schemas/research-doc.d.ts +104 -0
  89. package/dist/schemas/research-doc.js +37 -0
  90. package/dist/search/arxiv-client.d.ts +41 -0
  91. package/dist/search/arxiv-client.js +88 -0
  92. package/dist/search/hackernews-client.d.ts +33 -0
  93. package/dist/search/hackernews-client.js +44 -0
  94. package/dist/search/provider-result.d.ts +25 -0
  95. package/dist/search/provider-result.js +2 -0
  96. package/dist/search/tavily-client.d.ts +38 -0
  97. package/dist/search/tavily-client.js +53 -0
  98. package/dist/search/uspto-client.d.ts +50 -0
  99. package/dist/search/uspto-client.js +112 -0
  100. package/dist/utils/run-id.d.ts +2 -0
  101. package/dist/utils/run-id.js +22 -0
  102. package/package.json +53 -0
@@ -0,0 +1,1151 @@
1
+ /**
2
+ * AuditEvent — the hash-chained JSONL events written to
3
+ * `.research-audit/<run_id>.jsonl` by every node in both pipelines.
4
+ *
5
+ * Discriminated by `node_kind`. The common envelope at the top of every
6
+ * variant carries the chain: `prev_event_hash` + `event_hash`, both
7
+ * SHA-256. The first event in a run has `prev_event_hash: null`. The
8
+ * `run_complete` event closes the run with a chain root hash.
9
+ *
10
+ * See docs/design/research-and-prd-agents.md §"Audit schema — per-node
11
+ * JSONL events" for the canonical definitions.
12
+ */
13
+ import { z } from 'zod';
14
+ /** `pure_api` — deterministic external HTTP call (Tavily, arXiv, USPTO, HN, GitHub REST). */
15
+ declare const PureApiEvent: z.ZodObject<{
16
+ run_id: z.ZodString;
17
+ /** Monotonically incrementing within a run, starting at 1. */
18
+ event_id: z.ZodNumber;
19
+ ts: z.ZodEffects<z.ZodString, string, string>;
20
+ node_name: z.ZodString;
21
+ duration_ms: z.ZodNumber;
22
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
23
+ prev_event_hash: z.ZodNullable<z.ZodString>;
24
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
25
+ event_hash: z.ZodString;
26
+ } & {
27
+ node_kind: z.ZodLiteral<"pure_api">;
28
+ api: z.ZodObject<{
29
+ provider: z.ZodString;
30
+ endpoint: z.ZodString;
31
+ /** Redacted query / body — secrets must NOT appear here. */
32
+ request_summary: z.ZodString;
33
+ http_status: z.ZodNumber;
34
+ response_byte_count: z.ZodNumber;
35
+ }, "strip", z.ZodTypeAny, {
36
+ provider: string;
37
+ endpoint: string;
38
+ request_summary: string;
39
+ http_status: number;
40
+ response_byte_count: number;
41
+ }, {
42
+ provider: string;
43
+ endpoint: string;
44
+ request_summary: string;
45
+ http_status: number;
46
+ response_byte_count: number;
47
+ }>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ run_id: string;
50
+ event_id: number;
51
+ ts: string;
52
+ node_name: string;
53
+ duration_ms: number;
54
+ prev_event_hash: string | null;
55
+ event_hash: string;
56
+ node_kind: "pure_api";
57
+ api: {
58
+ provider: string;
59
+ endpoint: string;
60
+ request_summary: string;
61
+ http_status: number;
62
+ response_byte_count: number;
63
+ };
64
+ }, {
65
+ run_id: string;
66
+ event_id: number;
67
+ ts: string;
68
+ node_name: string;
69
+ duration_ms: number;
70
+ prev_event_hash: string | null;
71
+ event_hash: string;
72
+ node_kind: "pure_api";
73
+ api: {
74
+ provider: string;
75
+ endpoint: string;
76
+ request_summary: string;
77
+ http_status: number;
78
+ response_byte_count: number;
79
+ };
80
+ }>;
81
+ /** `llm` — non-deterministic LLM call (plan_queries, synthesize, expert reviews). */
82
+ declare const LlmEvent: z.ZodObject<{
83
+ run_id: z.ZodString;
84
+ /** Monotonically incrementing within a run, starting at 1. */
85
+ event_id: z.ZodNumber;
86
+ ts: z.ZodEffects<z.ZodString, string, string>;
87
+ node_name: z.ZodString;
88
+ duration_ms: z.ZodNumber;
89
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
90
+ prev_event_hash: z.ZodNullable<z.ZodString>;
91
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
92
+ event_hash: z.ZodString;
93
+ } & {
94
+ node_kind: z.ZodLiteral<"llm">;
95
+ llm: z.ZodObject<{
96
+ provider: z.ZodEnum<["anthropic", "openai", "azure-openai", "github-models"]>;
97
+ model: z.ZodString;
98
+ prompt_pack: z.ZodObject<{
99
+ /** Path relative to mesh root, e.g. `.caterpillar/prompts/research/synthesis.md@v1.0.0`. */
100
+ path: z.ZodString;
101
+ sha256: z.ZodString;
102
+ }, "strip", z.ZodTypeAny, {
103
+ path: string;
104
+ sha256: string;
105
+ }, {
106
+ path: string;
107
+ sha256: string;
108
+ }>;
109
+ input_tokens: z.ZodNumber;
110
+ output_tokens: z.ZodNumber;
111
+ /** USD cost estimate. */
112
+ cost_usd: z.ZodNumber;
113
+ /** Guardrail decisions for this hop. */
114
+ guardrails: z.ZodObject<{
115
+ mode: z.ZodEnum<["strict", "default", "lenient"]>;
116
+ pre: z.ZodEnum<["PASS", "WARN", "BLOCK"]>;
117
+ post: z.ZodEnum<["PASS", "WARN", "BLOCK"]>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ mode: "strict" | "default" | "lenient";
120
+ pre: "PASS" | "WARN" | "BLOCK";
121
+ post: "PASS" | "WARN" | "BLOCK";
122
+ }, {
123
+ mode: "strict" | "default" | "lenient";
124
+ pre: "PASS" | "WARN" | "BLOCK";
125
+ post: "PASS" | "WARN" | "BLOCK";
126
+ }>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ guardrails: {
129
+ mode: "strict" | "default" | "lenient";
130
+ pre: "PASS" | "WARN" | "BLOCK";
131
+ post: "PASS" | "WARN" | "BLOCK";
132
+ };
133
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
134
+ model: string;
135
+ prompt_pack: {
136
+ path: string;
137
+ sha256: string;
138
+ };
139
+ input_tokens: number;
140
+ output_tokens: number;
141
+ cost_usd: number;
142
+ }, {
143
+ guardrails: {
144
+ mode: "strict" | "default" | "lenient";
145
+ pre: "PASS" | "WARN" | "BLOCK";
146
+ post: "PASS" | "WARN" | "BLOCK";
147
+ };
148
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
149
+ model: string;
150
+ prompt_pack: {
151
+ path: string;
152
+ sha256: string;
153
+ };
154
+ input_tokens: number;
155
+ output_tokens: number;
156
+ cost_usd: number;
157
+ }>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ run_id: string;
160
+ event_id: number;
161
+ ts: string;
162
+ node_name: string;
163
+ duration_ms: number;
164
+ prev_event_hash: string | null;
165
+ event_hash: string;
166
+ node_kind: "llm";
167
+ llm: {
168
+ guardrails: {
169
+ mode: "strict" | "default" | "lenient";
170
+ pre: "PASS" | "WARN" | "BLOCK";
171
+ post: "PASS" | "WARN" | "BLOCK";
172
+ };
173
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
174
+ model: string;
175
+ prompt_pack: {
176
+ path: string;
177
+ sha256: string;
178
+ };
179
+ input_tokens: number;
180
+ output_tokens: number;
181
+ cost_usd: number;
182
+ };
183
+ }, {
184
+ run_id: string;
185
+ event_id: number;
186
+ ts: string;
187
+ node_name: string;
188
+ duration_ms: number;
189
+ prev_event_hash: string | null;
190
+ event_hash: string;
191
+ node_kind: "llm";
192
+ llm: {
193
+ guardrails: {
194
+ mode: "strict" | "default" | "lenient";
195
+ pre: "PASS" | "WARN" | "BLOCK";
196
+ post: "PASS" | "WARN" | "BLOCK";
197
+ };
198
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
199
+ model: string;
200
+ prompt_pack: {
201
+ path: string;
202
+ sha256: string;
203
+ };
204
+ input_tokens: number;
205
+ output_tokens: number;
206
+ cost_usd: number;
207
+ };
208
+ }>;
209
+ /** `pure` — local-only deterministic computation (validate, dedupe, structural check). */
210
+ declare const PureEvent: z.ZodObject<{
211
+ run_id: z.ZodString;
212
+ /** Monotonically incrementing within a run, starting at 1. */
213
+ event_id: z.ZodNumber;
214
+ ts: z.ZodEffects<z.ZodString, string, string>;
215
+ node_name: z.ZodString;
216
+ duration_ms: z.ZodNumber;
217
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
218
+ prev_event_hash: z.ZodNullable<z.ZodString>;
219
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
220
+ event_hash: z.ZodString;
221
+ } & {
222
+ node_kind: z.ZodLiteral<"pure">;
223
+ pure: z.ZodObject<{
224
+ inputs_summary: z.ZodString;
225
+ outputs_summary: z.ZodString;
226
+ }, "strip", z.ZodTypeAny, {
227
+ inputs_summary: string;
228
+ outputs_summary: string;
229
+ }, {
230
+ inputs_summary: string;
231
+ outputs_summary: string;
232
+ }>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ run_id: string;
235
+ event_id: number;
236
+ ts: string;
237
+ node_name: string;
238
+ duration_ms: number;
239
+ prev_event_hash: string | null;
240
+ event_hash: string;
241
+ node_kind: "pure";
242
+ pure: {
243
+ inputs_summary: string;
244
+ outputs_summary: string;
245
+ };
246
+ }, {
247
+ run_id: string;
248
+ event_id: number;
249
+ ts: string;
250
+ node_name: string;
251
+ duration_ms: number;
252
+ prev_event_hash: string | null;
253
+ event_hash: string;
254
+ node_kind: "pure";
255
+ pure: {
256
+ inputs_summary: string;
257
+ outputs_summary: string;
258
+ };
259
+ }>;
260
+ /** `node_error` — any node failure, before any retry. */
261
+ declare const NodeErrorEvent: z.ZodObject<{
262
+ run_id: z.ZodString;
263
+ /** Monotonically incrementing within a run, starting at 1. */
264
+ event_id: z.ZodNumber;
265
+ ts: z.ZodEffects<z.ZodString, string, string>;
266
+ node_name: z.ZodString;
267
+ duration_ms: z.ZodNumber;
268
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
269
+ prev_event_hash: z.ZodNullable<z.ZodString>;
270
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
271
+ event_hash: z.ZodString;
272
+ } & {
273
+ node_kind: z.ZodLiteral<"node_error">;
274
+ error: z.ZodObject<{
275
+ message: z.ZodString;
276
+ /** Optional stack — redacted of secrets. */
277
+ stack: z.ZodOptional<z.ZodString>;
278
+ retryable: z.ZodBoolean;
279
+ }, "strip", z.ZodTypeAny, {
280
+ message: string;
281
+ retryable: boolean;
282
+ stack?: string | undefined;
283
+ }, {
284
+ message: string;
285
+ retryable: boolean;
286
+ stack?: string | undefined;
287
+ }>;
288
+ }, "strip", z.ZodTypeAny, {
289
+ run_id: string;
290
+ event_id: number;
291
+ ts: string;
292
+ node_name: string;
293
+ duration_ms: number;
294
+ prev_event_hash: string | null;
295
+ event_hash: string;
296
+ node_kind: "node_error";
297
+ error: {
298
+ message: string;
299
+ retryable: boolean;
300
+ stack?: string | undefined;
301
+ };
302
+ }, {
303
+ run_id: string;
304
+ event_id: number;
305
+ ts: string;
306
+ node_name: string;
307
+ duration_ms: number;
308
+ prev_event_hash: string | null;
309
+ event_hash: string;
310
+ node_kind: "node_error";
311
+ error: {
312
+ message: string;
313
+ retryable: boolean;
314
+ stack?: string | undefined;
315
+ };
316
+ }>;
317
+ /**
318
+ * `iteration_summary` — emitted once per PRD refinement loop iteration after
319
+ * `verify_grounding` resolves. Carries the 4 reviewer signals + composite +
320
+ * verdict in one place so the published PRD can render a score-progression
321
+ * table without re-parsing earlier events.
322
+ */
323
+ declare const IterationSummaryEvent: z.ZodObject<{
324
+ run_id: z.ZodString;
325
+ /** Monotonically incrementing within a run, starting at 1. */
326
+ event_id: z.ZodNumber;
327
+ ts: z.ZodEffects<z.ZodString, string, string>;
328
+ node_name: z.ZodString;
329
+ duration_ms: z.ZodNumber;
330
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
331
+ prev_event_hash: z.ZodNullable<z.ZodString>;
332
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
333
+ event_hash: z.ZodString;
334
+ } & {
335
+ node_kind: z.ZodLiteral<"iteration_summary">;
336
+ iteration: z.ZodNumber;
337
+ summary: z.ZodObject<{
338
+ det_arch: z.ZodObject<{
339
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR"]>;
340
+ invalid_citations: z.ZodNumber;
341
+ coverage_discrepancies: z.ZodNumber;
342
+ }, "strip", z.ZodTypeAny, {
343
+ severity: "PASS" | "MINOR" | "MAJOR";
344
+ invalid_citations: number;
345
+ coverage_discrepancies: number;
346
+ }, {
347
+ severity: "PASS" | "MINOR" | "MAJOR";
348
+ invalid_citations: number;
349
+ coverage_discrepancies: number;
350
+ }>;
351
+ det_sec: z.ZodObject<{
352
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR"]>;
353
+ invalid_citations: z.ZodNumber;
354
+ coverage_discrepancies: z.ZodNumber;
355
+ }, "strip", z.ZodTypeAny, {
356
+ severity: "PASS" | "MINOR" | "MAJOR";
357
+ invalid_citations: number;
358
+ coverage_discrepancies: number;
359
+ }, {
360
+ severity: "PASS" | "MINOR" | "MAJOR";
361
+ invalid_citations: number;
362
+ coverage_discrepancies: number;
363
+ }>;
364
+ llm_arch: z.ZodObject<{
365
+ score: z.ZodNumber;
366
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR", "BLOCKING"]>;
367
+ }, "strip", z.ZodTypeAny, {
368
+ score: number;
369
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
370
+ }, {
371
+ score: number;
372
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
373
+ }>;
374
+ llm_sec: z.ZodObject<{
375
+ score: z.ZodNumber;
376
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR", "BLOCKING"]>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ score: number;
379
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
380
+ }, {
381
+ score: number;
382
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
383
+ }>;
384
+ composite_score: z.ZodNumber;
385
+ /** |llm_arch.score - llm_sec.score| — used by verify_grounding for the disagreement rule. */
386
+ disagreement_delta: z.ZodNumber;
387
+ verdict: z.ZodEnum<["PASS", "ITERATE", "EXHAUSTED"]>;
388
+ reason: z.ZodString;
389
+ }, "strip", z.ZodTypeAny, {
390
+ composite_score: number;
391
+ det_arch: {
392
+ severity: "PASS" | "MINOR" | "MAJOR";
393
+ invalid_citations: number;
394
+ coverage_discrepancies: number;
395
+ };
396
+ det_sec: {
397
+ severity: "PASS" | "MINOR" | "MAJOR";
398
+ invalid_citations: number;
399
+ coverage_discrepancies: number;
400
+ };
401
+ llm_arch: {
402
+ score: number;
403
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
404
+ };
405
+ llm_sec: {
406
+ score: number;
407
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
408
+ };
409
+ disagreement_delta: number;
410
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
411
+ reason: string;
412
+ }, {
413
+ composite_score: number;
414
+ det_arch: {
415
+ severity: "PASS" | "MINOR" | "MAJOR";
416
+ invalid_citations: number;
417
+ coverage_discrepancies: number;
418
+ };
419
+ det_sec: {
420
+ severity: "PASS" | "MINOR" | "MAJOR";
421
+ invalid_citations: number;
422
+ coverage_discrepancies: number;
423
+ };
424
+ llm_arch: {
425
+ score: number;
426
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
427
+ };
428
+ llm_sec: {
429
+ score: number;
430
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
431
+ };
432
+ disagreement_delta: number;
433
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
434
+ reason: string;
435
+ }>;
436
+ }, "strip", z.ZodTypeAny, {
437
+ run_id: string;
438
+ iteration: number;
439
+ event_id: number;
440
+ ts: string;
441
+ node_name: string;
442
+ duration_ms: number;
443
+ prev_event_hash: string | null;
444
+ event_hash: string;
445
+ node_kind: "iteration_summary";
446
+ summary: {
447
+ composite_score: number;
448
+ det_arch: {
449
+ severity: "PASS" | "MINOR" | "MAJOR";
450
+ invalid_citations: number;
451
+ coverage_discrepancies: number;
452
+ };
453
+ det_sec: {
454
+ severity: "PASS" | "MINOR" | "MAJOR";
455
+ invalid_citations: number;
456
+ coverage_discrepancies: number;
457
+ };
458
+ llm_arch: {
459
+ score: number;
460
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
461
+ };
462
+ llm_sec: {
463
+ score: number;
464
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
465
+ };
466
+ disagreement_delta: number;
467
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
468
+ reason: string;
469
+ };
470
+ }, {
471
+ run_id: string;
472
+ iteration: number;
473
+ event_id: number;
474
+ ts: string;
475
+ node_name: string;
476
+ duration_ms: number;
477
+ prev_event_hash: string | null;
478
+ event_hash: string;
479
+ node_kind: "iteration_summary";
480
+ summary: {
481
+ composite_score: number;
482
+ det_arch: {
483
+ severity: "PASS" | "MINOR" | "MAJOR";
484
+ invalid_citations: number;
485
+ coverage_discrepancies: number;
486
+ };
487
+ det_sec: {
488
+ severity: "PASS" | "MINOR" | "MAJOR";
489
+ invalid_citations: number;
490
+ coverage_discrepancies: number;
491
+ };
492
+ llm_arch: {
493
+ score: number;
494
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
495
+ };
496
+ llm_sec: {
497
+ score: number;
498
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
499
+ };
500
+ disagreement_delta: number;
501
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
502
+ reason: string;
503
+ };
504
+ }>;
505
+ /** `run_complete` — final event emitted by verify_and_trigger. Closes the chain. */
506
+ declare const RunCompleteEvent: z.ZodObject<{
507
+ run_id: z.ZodString;
508
+ /** Monotonically incrementing within a run, starting at 1. */
509
+ event_id: z.ZodNumber;
510
+ ts: z.ZodEffects<z.ZodString, string, string>;
511
+ node_name: z.ZodString;
512
+ duration_ms: z.ZodNumber;
513
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
514
+ prev_event_hash: z.ZodNullable<z.ZodString>;
515
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
516
+ event_hash: z.ZodString;
517
+ } & {
518
+ node_kind: z.ZodLiteral<"run_complete">;
519
+ outcome: z.ZodObject<{
520
+ status: z.ZodEnum<["ok", "failed", "partial"]>;
521
+ mesh_sha: z.ZodString;
522
+ total_input_tokens: z.ZodNumber;
523
+ total_output_tokens: z.ZodNumber;
524
+ total_cost_usd: z.ZodNumber;
525
+ artifact_paths: z.ZodArray<z.ZodString, "many">;
526
+ pr_url: z.ZodOptional<z.ZodString>;
527
+ /** SHA-256 of the entire chain (the last event's event_hash). */
528
+ chain_root_hash: z.ZodString;
529
+ }, "strip", z.ZodTypeAny, {
530
+ status: "ok" | "failed" | "partial";
531
+ mesh_sha: string;
532
+ total_input_tokens: number;
533
+ total_output_tokens: number;
534
+ total_cost_usd: number;
535
+ artifact_paths: string[];
536
+ chain_root_hash: string;
537
+ pr_url?: string | undefined;
538
+ }, {
539
+ status: "ok" | "failed" | "partial";
540
+ mesh_sha: string;
541
+ total_input_tokens: number;
542
+ total_output_tokens: number;
543
+ total_cost_usd: number;
544
+ artifact_paths: string[];
545
+ chain_root_hash: string;
546
+ pr_url?: string | undefined;
547
+ }>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ run_id: string;
550
+ event_id: number;
551
+ ts: string;
552
+ node_name: string;
553
+ duration_ms: number;
554
+ prev_event_hash: string | null;
555
+ event_hash: string;
556
+ node_kind: "run_complete";
557
+ outcome: {
558
+ status: "ok" | "failed" | "partial";
559
+ mesh_sha: string;
560
+ total_input_tokens: number;
561
+ total_output_tokens: number;
562
+ total_cost_usd: number;
563
+ artifact_paths: string[];
564
+ chain_root_hash: string;
565
+ pr_url?: string | undefined;
566
+ };
567
+ }, {
568
+ run_id: string;
569
+ event_id: number;
570
+ ts: string;
571
+ node_name: string;
572
+ duration_ms: number;
573
+ prev_event_hash: string | null;
574
+ event_hash: string;
575
+ node_kind: "run_complete";
576
+ outcome: {
577
+ status: "ok" | "failed" | "partial";
578
+ mesh_sha: string;
579
+ total_input_tokens: number;
580
+ total_output_tokens: number;
581
+ total_cost_usd: number;
582
+ artifact_paths: string[];
583
+ chain_root_hash: string;
584
+ pr_url?: string | undefined;
585
+ };
586
+ }>;
587
+ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObject<{
588
+ run_id: z.ZodString;
589
+ /** Monotonically incrementing within a run, starting at 1. */
590
+ event_id: z.ZodNumber;
591
+ ts: z.ZodEffects<z.ZodString, string, string>;
592
+ node_name: z.ZodString;
593
+ duration_ms: z.ZodNumber;
594
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
595
+ prev_event_hash: z.ZodNullable<z.ZodString>;
596
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
597
+ event_hash: z.ZodString;
598
+ } & {
599
+ node_kind: z.ZodLiteral<"pure_api">;
600
+ api: z.ZodObject<{
601
+ provider: z.ZodString;
602
+ endpoint: z.ZodString;
603
+ /** Redacted query / body — secrets must NOT appear here. */
604
+ request_summary: z.ZodString;
605
+ http_status: z.ZodNumber;
606
+ response_byte_count: z.ZodNumber;
607
+ }, "strip", z.ZodTypeAny, {
608
+ provider: string;
609
+ endpoint: string;
610
+ request_summary: string;
611
+ http_status: number;
612
+ response_byte_count: number;
613
+ }, {
614
+ provider: string;
615
+ endpoint: string;
616
+ request_summary: string;
617
+ http_status: number;
618
+ response_byte_count: number;
619
+ }>;
620
+ }, "strip", z.ZodTypeAny, {
621
+ run_id: string;
622
+ event_id: number;
623
+ ts: string;
624
+ node_name: string;
625
+ duration_ms: number;
626
+ prev_event_hash: string | null;
627
+ event_hash: string;
628
+ node_kind: "pure_api";
629
+ api: {
630
+ provider: string;
631
+ endpoint: string;
632
+ request_summary: string;
633
+ http_status: number;
634
+ response_byte_count: number;
635
+ };
636
+ }, {
637
+ run_id: string;
638
+ event_id: number;
639
+ ts: string;
640
+ node_name: string;
641
+ duration_ms: number;
642
+ prev_event_hash: string | null;
643
+ event_hash: string;
644
+ node_kind: "pure_api";
645
+ api: {
646
+ provider: string;
647
+ endpoint: string;
648
+ request_summary: string;
649
+ http_status: number;
650
+ response_byte_count: number;
651
+ };
652
+ }>, z.ZodObject<{
653
+ run_id: z.ZodString;
654
+ /** Monotonically incrementing within a run, starting at 1. */
655
+ event_id: z.ZodNumber;
656
+ ts: z.ZodEffects<z.ZodString, string, string>;
657
+ node_name: z.ZodString;
658
+ duration_ms: z.ZodNumber;
659
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
660
+ prev_event_hash: z.ZodNullable<z.ZodString>;
661
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
662
+ event_hash: z.ZodString;
663
+ } & {
664
+ node_kind: z.ZodLiteral<"llm">;
665
+ llm: z.ZodObject<{
666
+ provider: z.ZodEnum<["anthropic", "openai", "azure-openai", "github-models"]>;
667
+ model: z.ZodString;
668
+ prompt_pack: z.ZodObject<{
669
+ /** Path relative to mesh root, e.g. `.caterpillar/prompts/research/synthesis.md@v1.0.0`. */
670
+ path: z.ZodString;
671
+ sha256: z.ZodString;
672
+ }, "strip", z.ZodTypeAny, {
673
+ path: string;
674
+ sha256: string;
675
+ }, {
676
+ path: string;
677
+ sha256: string;
678
+ }>;
679
+ input_tokens: z.ZodNumber;
680
+ output_tokens: z.ZodNumber;
681
+ /** USD cost estimate. */
682
+ cost_usd: z.ZodNumber;
683
+ /** Guardrail decisions for this hop. */
684
+ guardrails: z.ZodObject<{
685
+ mode: z.ZodEnum<["strict", "default", "lenient"]>;
686
+ pre: z.ZodEnum<["PASS", "WARN", "BLOCK"]>;
687
+ post: z.ZodEnum<["PASS", "WARN", "BLOCK"]>;
688
+ }, "strip", z.ZodTypeAny, {
689
+ mode: "strict" | "default" | "lenient";
690
+ pre: "PASS" | "WARN" | "BLOCK";
691
+ post: "PASS" | "WARN" | "BLOCK";
692
+ }, {
693
+ mode: "strict" | "default" | "lenient";
694
+ pre: "PASS" | "WARN" | "BLOCK";
695
+ post: "PASS" | "WARN" | "BLOCK";
696
+ }>;
697
+ }, "strip", z.ZodTypeAny, {
698
+ guardrails: {
699
+ mode: "strict" | "default" | "lenient";
700
+ pre: "PASS" | "WARN" | "BLOCK";
701
+ post: "PASS" | "WARN" | "BLOCK";
702
+ };
703
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
704
+ model: string;
705
+ prompt_pack: {
706
+ path: string;
707
+ sha256: string;
708
+ };
709
+ input_tokens: number;
710
+ output_tokens: number;
711
+ cost_usd: number;
712
+ }, {
713
+ guardrails: {
714
+ mode: "strict" | "default" | "lenient";
715
+ pre: "PASS" | "WARN" | "BLOCK";
716
+ post: "PASS" | "WARN" | "BLOCK";
717
+ };
718
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
719
+ model: string;
720
+ prompt_pack: {
721
+ path: string;
722
+ sha256: string;
723
+ };
724
+ input_tokens: number;
725
+ output_tokens: number;
726
+ cost_usd: number;
727
+ }>;
728
+ }, "strip", z.ZodTypeAny, {
729
+ run_id: string;
730
+ event_id: number;
731
+ ts: string;
732
+ node_name: string;
733
+ duration_ms: number;
734
+ prev_event_hash: string | null;
735
+ event_hash: string;
736
+ node_kind: "llm";
737
+ llm: {
738
+ guardrails: {
739
+ mode: "strict" | "default" | "lenient";
740
+ pre: "PASS" | "WARN" | "BLOCK";
741
+ post: "PASS" | "WARN" | "BLOCK";
742
+ };
743
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
744
+ model: string;
745
+ prompt_pack: {
746
+ path: string;
747
+ sha256: string;
748
+ };
749
+ input_tokens: number;
750
+ output_tokens: number;
751
+ cost_usd: number;
752
+ };
753
+ }, {
754
+ run_id: string;
755
+ event_id: number;
756
+ ts: string;
757
+ node_name: string;
758
+ duration_ms: number;
759
+ prev_event_hash: string | null;
760
+ event_hash: string;
761
+ node_kind: "llm";
762
+ llm: {
763
+ guardrails: {
764
+ mode: "strict" | "default" | "lenient";
765
+ pre: "PASS" | "WARN" | "BLOCK";
766
+ post: "PASS" | "WARN" | "BLOCK";
767
+ };
768
+ provider: "anthropic" | "openai" | "azure-openai" | "github-models";
769
+ model: string;
770
+ prompt_pack: {
771
+ path: string;
772
+ sha256: string;
773
+ };
774
+ input_tokens: number;
775
+ output_tokens: number;
776
+ cost_usd: number;
777
+ };
778
+ }>, z.ZodObject<{
779
+ run_id: z.ZodString;
780
+ /** Monotonically incrementing within a run, starting at 1. */
781
+ event_id: z.ZodNumber;
782
+ ts: z.ZodEffects<z.ZodString, string, string>;
783
+ node_name: z.ZodString;
784
+ duration_ms: z.ZodNumber;
785
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
786
+ prev_event_hash: z.ZodNullable<z.ZodString>;
787
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
788
+ event_hash: z.ZodString;
789
+ } & {
790
+ node_kind: z.ZodLiteral<"pure">;
791
+ pure: z.ZodObject<{
792
+ inputs_summary: z.ZodString;
793
+ outputs_summary: z.ZodString;
794
+ }, "strip", z.ZodTypeAny, {
795
+ inputs_summary: string;
796
+ outputs_summary: string;
797
+ }, {
798
+ inputs_summary: string;
799
+ outputs_summary: string;
800
+ }>;
801
+ }, "strip", z.ZodTypeAny, {
802
+ run_id: string;
803
+ event_id: number;
804
+ ts: string;
805
+ node_name: string;
806
+ duration_ms: number;
807
+ prev_event_hash: string | null;
808
+ event_hash: string;
809
+ node_kind: "pure";
810
+ pure: {
811
+ inputs_summary: string;
812
+ outputs_summary: string;
813
+ };
814
+ }, {
815
+ run_id: string;
816
+ event_id: number;
817
+ ts: string;
818
+ node_name: string;
819
+ duration_ms: number;
820
+ prev_event_hash: string | null;
821
+ event_hash: string;
822
+ node_kind: "pure";
823
+ pure: {
824
+ inputs_summary: string;
825
+ outputs_summary: string;
826
+ };
827
+ }>, z.ZodObject<{
828
+ run_id: z.ZodString;
829
+ /** Monotonically incrementing within a run, starting at 1. */
830
+ event_id: z.ZodNumber;
831
+ ts: z.ZodEffects<z.ZodString, string, string>;
832
+ node_name: z.ZodString;
833
+ duration_ms: z.ZodNumber;
834
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
835
+ prev_event_hash: z.ZodNullable<z.ZodString>;
836
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
837
+ event_hash: z.ZodString;
838
+ } & {
839
+ node_kind: z.ZodLiteral<"node_error">;
840
+ error: z.ZodObject<{
841
+ message: z.ZodString;
842
+ /** Optional stack — redacted of secrets. */
843
+ stack: z.ZodOptional<z.ZodString>;
844
+ retryable: z.ZodBoolean;
845
+ }, "strip", z.ZodTypeAny, {
846
+ message: string;
847
+ retryable: boolean;
848
+ stack?: string | undefined;
849
+ }, {
850
+ message: string;
851
+ retryable: boolean;
852
+ stack?: string | undefined;
853
+ }>;
854
+ }, "strip", z.ZodTypeAny, {
855
+ run_id: string;
856
+ event_id: number;
857
+ ts: string;
858
+ node_name: string;
859
+ duration_ms: number;
860
+ prev_event_hash: string | null;
861
+ event_hash: string;
862
+ node_kind: "node_error";
863
+ error: {
864
+ message: string;
865
+ retryable: boolean;
866
+ stack?: string | undefined;
867
+ };
868
+ }, {
869
+ run_id: string;
870
+ event_id: number;
871
+ ts: string;
872
+ node_name: string;
873
+ duration_ms: number;
874
+ prev_event_hash: string | null;
875
+ event_hash: string;
876
+ node_kind: "node_error";
877
+ error: {
878
+ message: string;
879
+ retryable: boolean;
880
+ stack?: string | undefined;
881
+ };
882
+ }>, z.ZodObject<{
883
+ run_id: z.ZodString;
884
+ /** Monotonically incrementing within a run, starting at 1. */
885
+ event_id: z.ZodNumber;
886
+ ts: z.ZodEffects<z.ZodString, string, string>;
887
+ node_name: z.ZodString;
888
+ duration_ms: z.ZodNumber;
889
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
890
+ prev_event_hash: z.ZodNullable<z.ZodString>;
891
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
892
+ event_hash: z.ZodString;
893
+ } & {
894
+ node_kind: z.ZodLiteral<"iteration_summary">;
895
+ iteration: z.ZodNumber;
896
+ summary: z.ZodObject<{
897
+ det_arch: z.ZodObject<{
898
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR"]>;
899
+ invalid_citations: z.ZodNumber;
900
+ coverage_discrepancies: z.ZodNumber;
901
+ }, "strip", z.ZodTypeAny, {
902
+ severity: "PASS" | "MINOR" | "MAJOR";
903
+ invalid_citations: number;
904
+ coverage_discrepancies: number;
905
+ }, {
906
+ severity: "PASS" | "MINOR" | "MAJOR";
907
+ invalid_citations: number;
908
+ coverage_discrepancies: number;
909
+ }>;
910
+ det_sec: z.ZodObject<{
911
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR"]>;
912
+ invalid_citations: z.ZodNumber;
913
+ coverage_discrepancies: z.ZodNumber;
914
+ }, "strip", z.ZodTypeAny, {
915
+ severity: "PASS" | "MINOR" | "MAJOR";
916
+ invalid_citations: number;
917
+ coverage_discrepancies: number;
918
+ }, {
919
+ severity: "PASS" | "MINOR" | "MAJOR";
920
+ invalid_citations: number;
921
+ coverage_discrepancies: number;
922
+ }>;
923
+ llm_arch: z.ZodObject<{
924
+ score: z.ZodNumber;
925
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR", "BLOCKING"]>;
926
+ }, "strip", z.ZodTypeAny, {
927
+ score: number;
928
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
929
+ }, {
930
+ score: number;
931
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
932
+ }>;
933
+ llm_sec: z.ZodObject<{
934
+ score: z.ZodNumber;
935
+ severity: z.ZodEnum<["PASS", "MINOR", "MAJOR", "BLOCKING"]>;
936
+ }, "strip", z.ZodTypeAny, {
937
+ score: number;
938
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
939
+ }, {
940
+ score: number;
941
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
942
+ }>;
943
+ composite_score: z.ZodNumber;
944
+ /** |llm_arch.score - llm_sec.score| — used by verify_grounding for the disagreement rule. */
945
+ disagreement_delta: z.ZodNumber;
946
+ verdict: z.ZodEnum<["PASS", "ITERATE", "EXHAUSTED"]>;
947
+ reason: z.ZodString;
948
+ }, "strip", z.ZodTypeAny, {
949
+ composite_score: number;
950
+ det_arch: {
951
+ severity: "PASS" | "MINOR" | "MAJOR";
952
+ invalid_citations: number;
953
+ coverage_discrepancies: number;
954
+ };
955
+ det_sec: {
956
+ severity: "PASS" | "MINOR" | "MAJOR";
957
+ invalid_citations: number;
958
+ coverage_discrepancies: number;
959
+ };
960
+ llm_arch: {
961
+ score: number;
962
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
963
+ };
964
+ llm_sec: {
965
+ score: number;
966
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
967
+ };
968
+ disagreement_delta: number;
969
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
970
+ reason: string;
971
+ }, {
972
+ composite_score: number;
973
+ det_arch: {
974
+ severity: "PASS" | "MINOR" | "MAJOR";
975
+ invalid_citations: number;
976
+ coverage_discrepancies: number;
977
+ };
978
+ det_sec: {
979
+ severity: "PASS" | "MINOR" | "MAJOR";
980
+ invalid_citations: number;
981
+ coverage_discrepancies: number;
982
+ };
983
+ llm_arch: {
984
+ score: number;
985
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
986
+ };
987
+ llm_sec: {
988
+ score: number;
989
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
990
+ };
991
+ disagreement_delta: number;
992
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
993
+ reason: string;
994
+ }>;
995
+ }, "strip", z.ZodTypeAny, {
996
+ run_id: string;
997
+ iteration: number;
998
+ event_id: number;
999
+ ts: string;
1000
+ node_name: string;
1001
+ duration_ms: number;
1002
+ prev_event_hash: string | null;
1003
+ event_hash: string;
1004
+ node_kind: "iteration_summary";
1005
+ summary: {
1006
+ composite_score: number;
1007
+ det_arch: {
1008
+ severity: "PASS" | "MINOR" | "MAJOR";
1009
+ invalid_citations: number;
1010
+ coverage_discrepancies: number;
1011
+ };
1012
+ det_sec: {
1013
+ severity: "PASS" | "MINOR" | "MAJOR";
1014
+ invalid_citations: number;
1015
+ coverage_discrepancies: number;
1016
+ };
1017
+ llm_arch: {
1018
+ score: number;
1019
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
1020
+ };
1021
+ llm_sec: {
1022
+ score: number;
1023
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
1024
+ };
1025
+ disagreement_delta: number;
1026
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
1027
+ reason: string;
1028
+ };
1029
+ }, {
1030
+ run_id: string;
1031
+ iteration: number;
1032
+ event_id: number;
1033
+ ts: string;
1034
+ node_name: string;
1035
+ duration_ms: number;
1036
+ prev_event_hash: string | null;
1037
+ event_hash: string;
1038
+ node_kind: "iteration_summary";
1039
+ summary: {
1040
+ composite_score: number;
1041
+ det_arch: {
1042
+ severity: "PASS" | "MINOR" | "MAJOR";
1043
+ invalid_citations: number;
1044
+ coverage_discrepancies: number;
1045
+ };
1046
+ det_sec: {
1047
+ severity: "PASS" | "MINOR" | "MAJOR";
1048
+ invalid_citations: number;
1049
+ coverage_discrepancies: number;
1050
+ };
1051
+ llm_arch: {
1052
+ score: number;
1053
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
1054
+ };
1055
+ llm_sec: {
1056
+ score: number;
1057
+ severity: "PASS" | "MINOR" | "MAJOR" | "BLOCKING";
1058
+ };
1059
+ disagreement_delta: number;
1060
+ verdict: "PASS" | "ITERATE" | "EXHAUSTED";
1061
+ reason: string;
1062
+ };
1063
+ }>, z.ZodObject<{
1064
+ run_id: z.ZodString;
1065
+ /** Monotonically incrementing within a run, starting at 1. */
1066
+ event_id: z.ZodNumber;
1067
+ ts: z.ZodEffects<z.ZodString, string, string>;
1068
+ node_name: z.ZodString;
1069
+ duration_ms: z.ZodNumber;
1070
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
1071
+ prev_event_hash: z.ZodNullable<z.ZodString>;
1072
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
1073
+ event_hash: z.ZodString;
1074
+ } & {
1075
+ node_kind: z.ZodLiteral<"run_complete">;
1076
+ outcome: z.ZodObject<{
1077
+ status: z.ZodEnum<["ok", "failed", "partial"]>;
1078
+ mesh_sha: z.ZodString;
1079
+ total_input_tokens: z.ZodNumber;
1080
+ total_output_tokens: z.ZodNumber;
1081
+ total_cost_usd: z.ZodNumber;
1082
+ artifact_paths: z.ZodArray<z.ZodString, "many">;
1083
+ pr_url: z.ZodOptional<z.ZodString>;
1084
+ /** SHA-256 of the entire chain (the last event's event_hash). */
1085
+ chain_root_hash: z.ZodString;
1086
+ }, "strip", z.ZodTypeAny, {
1087
+ status: "ok" | "failed" | "partial";
1088
+ mesh_sha: string;
1089
+ total_input_tokens: number;
1090
+ total_output_tokens: number;
1091
+ total_cost_usd: number;
1092
+ artifact_paths: string[];
1093
+ chain_root_hash: string;
1094
+ pr_url?: string | undefined;
1095
+ }, {
1096
+ status: "ok" | "failed" | "partial";
1097
+ mesh_sha: string;
1098
+ total_input_tokens: number;
1099
+ total_output_tokens: number;
1100
+ total_cost_usd: number;
1101
+ artifact_paths: string[];
1102
+ chain_root_hash: string;
1103
+ pr_url?: string | undefined;
1104
+ }>;
1105
+ }, "strip", z.ZodTypeAny, {
1106
+ run_id: string;
1107
+ event_id: number;
1108
+ ts: string;
1109
+ node_name: string;
1110
+ duration_ms: number;
1111
+ prev_event_hash: string | null;
1112
+ event_hash: string;
1113
+ node_kind: "run_complete";
1114
+ outcome: {
1115
+ status: "ok" | "failed" | "partial";
1116
+ mesh_sha: string;
1117
+ total_input_tokens: number;
1118
+ total_output_tokens: number;
1119
+ total_cost_usd: number;
1120
+ artifact_paths: string[];
1121
+ chain_root_hash: string;
1122
+ pr_url?: string | undefined;
1123
+ };
1124
+ }, {
1125
+ run_id: string;
1126
+ event_id: number;
1127
+ ts: string;
1128
+ node_name: string;
1129
+ duration_ms: number;
1130
+ prev_event_hash: string | null;
1131
+ event_hash: string;
1132
+ node_kind: "run_complete";
1133
+ outcome: {
1134
+ status: "ok" | "failed" | "partial";
1135
+ mesh_sha: string;
1136
+ total_input_tokens: number;
1137
+ total_output_tokens: number;
1138
+ total_cost_usd: number;
1139
+ artifact_paths: string[];
1140
+ chain_root_hash: string;
1141
+ pr_url?: string | undefined;
1142
+ };
1143
+ }>]>;
1144
+ export type AuditEvent = z.infer<typeof AuditEvent>;
1145
+ export type PureApiEvent = z.infer<typeof PureApiEvent>;
1146
+ export type LlmEvent = z.infer<typeof LlmEvent>;
1147
+ export type PureEvent = z.infer<typeof PureEvent>;
1148
+ export type NodeErrorEvent = z.infer<typeof NodeErrorEvent>;
1149
+ export type IterationSummaryEvent = z.infer<typeof IterationSummaryEvent>;
1150
+ export type RunCompleteEvent = z.infer<typeof RunCompleteEvent>;
1151
+ export {};