@sentry/warden 0.36.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/cli/args.d.ts +1 -2
  2. package/dist/cli/args.d.ts.map +1 -1
  3. package/dist/cli/args.js +0 -4
  4. package/dist/cli/args.js.map +1 -1
  5. package/dist/cli/commands/init.d.ts.map +1 -1
  6. package/dist/cli/commands/init.js +12 -1
  7. package/dist/cli/commands/init.js.map +1 -1
  8. package/dist/cli/commands/runs.d.ts.map +1 -1
  9. package/dist/cli/commands/runs.js +10 -10
  10. package/dist/cli/commands/runs.js.map +1 -1
  11. package/dist/cli/context.d.ts +3 -0
  12. package/dist/cli/context.d.ts.map +1 -1
  13. package/dist/cli/context.js +4 -1
  14. package/dist/cli/context.js.map +1 -1
  15. package/dist/cli/files.d.ts +9 -3
  16. package/dist/cli/files.d.ts.map +1 -1
  17. package/dist/cli/files.js +28 -8
  18. package/dist/cli/files.js.map +1 -1
  19. package/dist/cli/main.d.ts +28 -2
  20. package/dist/cli/main.d.ts.map +1 -1
  21. package/dist/cli/main.js +149 -65
  22. package/dist/cli/main.js.map +1 -1
  23. package/dist/cli/output/formatters.d.ts +7 -4
  24. package/dist/cli/output/formatters.d.ts.map +1 -1
  25. package/dist/cli/output/formatters.js +51 -17
  26. package/dist/cli/output/formatters.js.map +1 -1
  27. package/dist/cli/output/index.d.ts +2 -2
  28. package/dist/cli/output/index.d.ts.map +1 -1
  29. package/dist/cli/output/index.js +2 -2
  30. package/dist/cli/output/index.js.map +1 -1
  31. package/dist/cli/output/jsonl-schema-gen.d.ts.map +1 -1
  32. package/dist/cli/output/jsonl-schema-gen.js +15 -4
  33. package/dist/cli/output/jsonl-schema-gen.js.map +1 -1
  34. package/dist/cli/output/jsonl.d.ts +176 -47
  35. package/dist/cli/output/jsonl.d.ts.map +1 -1
  36. package/dist/cli/output/jsonl.js +102 -49
  37. package/dist/cli/output/jsonl.js.map +1 -1
  38. package/dist/cli/output/tasks.d.ts.map +1 -1
  39. package/dist/cli/output/tasks.js +3 -6
  40. package/dist/cli/output/tasks.js.map +1 -1
  41. package/dist/cli/output/usage-breakdown.d.ts +92 -0
  42. package/dist/cli/output/usage-breakdown.d.ts.map +1 -0
  43. package/dist/cli/output/usage-breakdown.js +214 -0
  44. package/dist/cli/output/usage-breakdown.js.map +1 -0
  45. package/dist/cli/terminal.d.ts +0 -1
  46. package/dist/cli/terminal.d.ts.map +1 -1
  47. package/dist/cli/terminal.js +4 -30
  48. package/dist/cli/terminal.js.map +1 -1
  49. package/dist/config/loader.d.ts +9 -1
  50. package/dist/config/loader.d.ts.map +1 -1
  51. package/dist/config/loader.js +48 -0
  52. package/dist/config/loader.js.map +1 -1
  53. package/dist/config/schema.d.ts +35 -13
  54. package/dist/config/schema.d.ts.map +1 -1
  55. package/dist/config/schema.js +24 -4
  56. package/dist/config/schema.js.map +1 -1
  57. package/dist/config/writer.d.ts.map +1 -1
  58. package/dist/config/writer.js +0 -6
  59. package/dist/config/writer.js.map +1 -1
  60. package/dist/diff/classify.d.ts +1 -15
  61. package/dist/diff/classify.d.ts.map +1 -1
  62. package/dist/diff/classify.js +1 -55
  63. package/dist/diff/classify.js.map +1 -1
  64. package/dist/event/schedule-context.d.ts +5 -0
  65. package/dist/event/schedule-context.d.ts.map +1 -1
  66. package/dist/event/schedule-context.js +2 -2
  67. package/dist/event/schedule-context.js.map +1 -1
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +2 -3
  71. package/dist/index.js.map +1 -1
  72. package/dist/output/github-checks.d.ts +19 -0
  73. package/dist/output/github-checks.d.ts.map +1 -1
  74. package/dist/output/github-checks.js +93 -19
  75. package/dist/output/github-checks.js.map +1 -1
  76. package/dist/output/github-issues.d.ts +1 -19
  77. package/dist/output/github-issues.d.ts.map +1 -1
  78. package/dist/output/github-issues.js +0 -142
  79. package/dist/output/github-issues.js.map +1 -1
  80. package/dist/output/issue-renderer.d.ts.map +1 -1
  81. package/dist/output/issue-renderer.js +0 -3
  82. package/dist/output/issue-renderer.js.map +1 -1
  83. package/dist/output/renderer.d.ts.map +1 -1
  84. package/dist/output/renderer.js +3 -16
  85. package/dist/output/renderer.js.map +1 -1
  86. package/dist/output/stale.d.ts +6 -1
  87. package/dist/output/stale.d.ts.map +1 -1
  88. package/dist/output/stale.js +11 -3
  89. package/dist/output/stale.js.map +1 -1
  90. package/dist/output/types.d.ts +0 -1
  91. package/dist/output/types.d.ts.map +1 -1
  92. package/dist/sdk/analyze.d.ts.map +1 -1
  93. package/dist/sdk/analyze.js +20 -5
  94. package/dist/sdk/analyze.js.map +1 -1
  95. package/dist/sdk/post-process.d.ts.map +1 -1
  96. package/dist/sdk/post-process.js +12 -25
  97. package/dist/sdk/post-process.js.map +1 -1
  98. package/dist/sdk/prepare.d.ts.map +1 -1
  99. package/dist/sdk/prepare.js +14 -5
  100. package/dist/sdk/prepare.js.map +1 -1
  101. package/dist/sdk/prompt.d.ts.map +1 -1
  102. package/dist/sdk/prompt.js +1 -8
  103. package/dist/sdk/prompt.js.map +1 -1
  104. package/dist/sdk/runtimes/claude.d.ts.map +1 -1
  105. package/dist/sdk/runtimes/claude.js +12 -4
  106. package/dist/sdk/runtimes/claude.js.map +1 -1
  107. package/dist/sdk/runtimes/pi.d.ts.map +1 -1
  108. package/dist/sdk/runtimes/pi.js +10 -6
  109. package/dist/sdk/runtimes/pi.js.map +1 -1
  110. package/dist/sdk/runtimes/types.d.ts +8 -2
  111. package/dist/sdk/runtimes/types.d.ts.map +1 -1
  112. package/dist/sdk/runtimes/types.js.map +1 -1
  113. package/dist/sdk/scan-policy.d.ts +32 -0
  114. package/dist/sdk/scan-policy.d.ts.map +1 -0
  115. package/dist/sdk/scan-policy.js +355 -0
  116. package/dist/sdk/scan-policy.js.map +1 -0
  117. package/dist/sdk/types.d.ts +16 -3
  118. package/dist/sdk/types.d.ts.map +1 -1
  119. package/dist/sdk/types.js.map +1 -1
  120. package/dist/sdk/usage.d.ts +9 -1
  121. package/dist/sdk/usage.d.ts.map +1 -1
  122. package/dist/sdk/usage.js +94 -0
  123. package/dist/sdk/usage.js.map +1 -1
  124. package/dist/sdk/verify.d.ts.map +1 -1
  125. package/dist/sdk/verify.js +0 -6
  126. package/dist/sdk/verify.js.map +1 -1
  127. package/dist/sentry-trace.d.ts +3 -3
  128. package/dist/sentry-trace.d.ts.map +1 -1
  129. package/dist/sentry-trace.js +5 -5
  130. package/dist/sentry-trace.js.map +1 -1
  131. package/dist/sentry.d.ts +2 -1
  132. package/dist/sentry.d.ts.map +1 -1
  133. package/dist/sentry.js +12 -9
  134. package/dist/sentry.js.map +1 -1
  135. package/dist/types/index.d.ts +38 -13
  136. package/dist/types/index.d.ts.map +1 -1
  137. package/dist/types/index.js +23 -8
  138. package/dist/types/index.js.map +1 -1
  139. package/package.json +3 -3
  140. package/src/builtin-skills/code-review/SKILL.md +0 -1
  141. package/src/builtin-skills/code-review/SOURCES.md +0 -1
  142. package/src/builtin-skills/security-review/SKILL.md +0 -1
  143. package/dist/cli/fix.d.ts +0 -39
  144. package/dist/cli/fix.d.ts.map +0 -1
  145. package/dist/cli/fix.js +0 -277
  146. package/dist/cli/fix.js.map +0 -1
  147. package/dist/sdk/fix-quality.d.ts +0 -26
  148. package/dist/sdk/fix-quality.d.ts.map +0 -1
  149. package/dist/sdk/fix-quality.js +0 -188
  150. package/dist/sdk/fix-quality.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { SkillReport, SkillError } from '../../types/index.js';
3
+ export { JsonlUsageBreakdownEntrySchema, JsonlUsageBreakdownSchema, auxiliaryUsageFromBreakdown, buildJsonlUsageBreakdown, scanUsageFromBreakdown, usageStatsHaveValue, type JsonlUsageBreakdown, type JsonlUsageBreakdownEntry, } from './usage-breakdown.js';
3
4
  /**
4
5
  * Sentinel value recorded in JSONL metadata when no model is explicitly configured.
5
6
  */
@@ -62,7 +63,7 @@ export declare const JsonlFileRecordSchema: z.ZodPreprocess<z.ZodObject<{
62
63
  }, z.core.$strip>>;
63
64
  }, z.core.$strip>>;
64
65
  export type JsonlFileRecord = z.infer<typeof JsonlFileRecordSchema>;
65
- /** Unit of work scanned by Warden. New run logs contain only this record type. */
66
+ /** Unit of work scanned by Warden, emitted during streaming and finalization. */
66
67
  export declare const JsonlChunkRecordSchema: z.ZodObject<{
67
68
  schemaVersion: z.ZodLiteral<1>;
68
69
  run: z.ZodObject<{
@@ -112,10 +113,6 @@ export declare const JsonlChunkRecordSchema: z.ZodObject<{
112
113
  startLine: z.ZodNumber;
113
114
  endLine: z.ZodOptional<z.ZodNumber>;
114
115
  }, z.core.$strip>>>;
115
- suggestedFix: z.ZodOptional<z.ZodObject<{
116
- description: z.ZodString;
117
- diff: z.ZodString;
118
- }, z.core.$strip>>;
119
116
  sourceSnippet: z.ZodOptional<z.ZodObject<{
120
117
  path: z.ZodString;
121
118
  language: z.ZodOptional<z.ZodString>;
@@ -131,27 +128,57 @@ export declare const JsonlChunkRecordSchema: z.ZodObject<{
131
128
  }, z.core.$strip>>;
132
129
  elapsedMs: z.ZodOptional<z.ZodNumber>;
133
130
  }, z.core.$strip>>;
134
- usage: z.ZodOptional<z.ZodObject<{
135
- inputTokens: z.ZodNumber;
136
- outputTokens: z.ZodNumber;
137
- cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
138
- cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
139
- cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
140
- cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
141
- webSearchRequests: z.ZodOptional<z.ZodNumber>;
142
- costUSD: z.ZodNumber;
131
+ usageBreakdown: z.ZodOptional<z.ZodObject<{
132
+ scan: z.ZodOptional<z.ZodObject<{
133
+ model: z.ZodOptional<z.ZodString>;
134
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ runtime: z.ZodOptional<z.ZodString>;
136
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
137
+ usage: z.ZodObject<{
138
+ inputTokens: z.ZodNumber;
139
+ outputTokens: z.ZodNumber;
140
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
141
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
142
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
143
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
144
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
145
+ costUSD: z.ZodNumber;
146
+ }, z.core.$strip>;
147
+ }, z.core.$strip>>;
148
+ auxiliary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
149
+ model: z.ZodOptional<z.ZodString>;
150
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ runtime: z.ZodOptional<z.ZodString>;
152
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ usage: z.ZodObject<{
154
+ inputTokens: z.ZodNumber;
155
+ outputTokens: z.ZodNumber;
156
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
157
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
158
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
159
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
160
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
161
+ costUSD: z.ZodNumber;
162
+ }, z.core.$strip>;
163
+ }, z.core.$strip>>>;
164
+ total: z.ZodObject<{
165
+ model: z.ZodOptional<z.ZodString>;
166
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
167
+ runtime: z.ZodOptional<z.ZodString>;
168
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
+ usage: z.ZodObject<{
170
+ inputTokens: z.ZodNumber;
171
+ outputTokens: z.ZodNumber;
172
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
173
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
174
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
175
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
176
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
177
+ costUSD: z.ZodNumber;
178
+ }, z.core.$strip>;
179
+ }, z.core.$strip>;
143
180
  }, z.core.$strip>>;
144
181
  durationMs: z.ZodNumber;
145
- auxiliaryUsage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
146
- inputTokens: z.ZodNumber;
147
- outputTokens: z.ZodNumber;
148
- cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
149
- cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
150
- cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
151
- cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
152
- webSearchRequests: z.ZodOptional<z.ZodNumber>;
153
- costUSD: z.ZodNumber;
154
- }, z.core.$strip>>>;
155
182
  error: z.ZodOptional<z.ZodObject<{
156
183
  code: z.ZodEnum<{
157
184
  unknown: "unknown";
@@ -181,6 +208,15 @@ export declare const JsonlChunkRecordSchema: z.ZodObject<{
181
208
  reason: z.ZodEnum<{
182
209
  pattern: "pattern";
183
210
  builtin: "builtin";
211
+ "ignored:builtin": "ignored:builtin";
212
+ "ignored:user": "ignored:user";
213
+ "ignored:generated": "ignored:generated";
214
+ "limit:file_size": "limit:file_size";
215
+ "limit:file_lines": "limit:file_lines";
216
+ "limit:file_read": "limit:file_read";
217
+ "limit:file_count": "limit:file_count";
218
+ "limit:changed_lines": "limit:changed_lines";
219
+ "limit:missing_patch": "limit:missing_patch";
184
220
  }>;
185
221
  pattern: z.ZodOptional<z.ZodString>;
186
222
  }, z.core.$strip>>>;
@@ -213,6 +249,7 @@ export declare const JsonlChunkRecordSchema: z.ZodObject<{
213
249
  }, z.core.$strip>>;
214
250
  }, z.core.$strip>;
215
251
  export type JsonlChunkRecord = z.infer<typeof JsonlChunkRecordSchema>;
252
+ export declare function parseJsonlChunkRecord(value: unknown): JsonlChunkRecord | undefined;
216
253
  /**
217
254
  * One skill's analysis results. This is the shared SkillReport plus a `run`
218
255
  * block of run-wide metadata, so any new SkillReport field is automatically
@@ -246,10 +283,6 @@ export declare const JsonlRecordSchema: z.ZodObject<{
246
283
  startLine: z.ZodNumber;
247
284
  endLine: z.ZodOptional<z.ZodNumber>;
248
285
  }, z.core.$strip>>>;
249
- suggestedFix: z.ZodOptional<z.ZodObject<{
250
- description: z.ZodString;
251
- diff: z.ZodString;
252
- }, z.core.$strip>>;
253
286
  sourceSnippet: z.ZodOptional<z.ZodObject<{
254
287
  path: z.ZodString;
255
288
  language: z.ZodOptional<z.ZodString>;
@@ -282,6 +315,15 @@ export declare const JsonlRecordSchema: z.ZodObject<{
282
315
  reason: z.ZodEnum<{
283
316
  pattern: "pattern";
284
317
  builtin: "builtin";
318
+ "ignored:builtin": "ignored:builtin";
319
+ "ignored:user": "ignored:user";
320
+ "ignored:generated": "ignored:generated";
321
+ "limit:file_size": "limit:file_size";
322
+ "limit:file_lines": "limit:file_lines";
323
+ "limit:file_read": "limit:file_read";
324
+ "limit:file_count": "limit:file_count";
325
+ "limit:changed_lines": "limit:changed_lines";
326
+ "limit:missing_patch": "limit:missing_patch";
285
327
  }>;
286
328
  pattern: z.ZodOptional<z.ZodString>;
287
329
  }, z.core.$strip>>>;
@@ -379,6 +421,12 @@ export declare const JsonlRecordSchema: z.ZodObject<{
379
421
  webSearchRequests: z.ZodOptional<z.ZodNumber>;
380
422
  costUSD: z.ZodNumber;
381
423
  }, z.core.$strip>>>;
424
+ auxiliaryUsageAttribution: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
425
+ model: z.ZodOptional<z.ZodString>;
426
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
427
+ runtime: z.ZodOptional<z.ZodString>;
428
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
429
+ }, z.core.$strip>>>;
382
430
  files: z.ZodOptional<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
383
431
  filename: z.ZodString;
384
432
  findings: z.ZodNumber;
@@ -405,6 +453,56 @@ export declare const JsonlRecordSchema: z.ZodObject<{
405
453
  model: z.ZodOptional<z.ZodString>;
406
454
  headSha: z.ZodOptional<z.ZodString>;
407
455
  }, z.core.$strip>;
456
+ usageBreakdown: z.ZodOptional<z.ZodObject<{
457
+ scan: z.ZodOptional<z.ZodObject<{
458
+ model: z.ZodOptional<z.ZodString>;
459
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
460
+ runtime: z.ZodOptional<z.ZodString>;
461
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
462
+ usage: z.ZodObject<{
463
+ inputTokens: z.ZodNumber;
464
+ outputTokens: z.ZodNumber;
465
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
466
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
467
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
468
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
469
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
470
+ costUSD: z.ZodNumber;
471
+ }, z.core.$strip>;
472
+ }, z.core.$strip>>;
473
+ auxiliary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
474
+ model: z.ZodOptional<z.ZodString>;
475
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
476
+ runtime: z.ZodOptional<z.ZodString>;
477
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
478
+ usage: z.ZodObject<{
479
+ inputTokens: z.ZodNumber;
480
+ outputTokens: z.ZodNumber;
481
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
482
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
483
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
484
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
485
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
486
+ costUSD: z.ZodNumber;
487
+ }, z.core.$strip>;
488
+ }, z.core.$strip>>>;
489
+ total: z.ZodObject<{
490
+ model: z.ZodOptional<z.ZodString>;
491
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
492
+ runtime: z.ZodOptional<z.ZodString>;
493
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
494
+ usage: z.ZodObject<{
495
+ inputTokens: z.ZodNumber;
496
+ outputTokens: z.ZodNumber;
497
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
498
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
499
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
500
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
501
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
502
+ costUSD: z.ZodNumber;
503
+ }, z.core.$strip>;
504
+ }, z.core.$strip>;
505
+ }, z.core.$strip>>;
408
506
  }, z.core.$strip>;
409
507
  export type JsonlRecord = z.infer<typeof JsonlRecordSchema>;
410
508
  /** Aggregate summary across all skills (always the last JSONL line). */
@@ -429,27 +527,57 @@ export declare const JsonlSummaryRecordSchema: z.ZodObject<{
429
527
  medium: z.ZodNumber;
430
528
  low: z.ZodNumber;
431
529
  }, z.core.$strip>>;
432
- usage: z.ZodOptional<z.ZodObject<{
433
- inputTokens: z.ZodNumber;
434
- outputTokens: z.ZodNumber;
435
- cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
436
- cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
437
- cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
438
- cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
439
- webSearchRequests: z.ZodOptional<z.ZodNumber>;
440
- costUSD: z.ZodNumber;
530
+ usageBreakdown: z.ZodOptional<z.ZodObject<{
531
+ scan: z.ZodOptional<z.ZodObject<{
532
+ model: z.ZodOptional<z.ZodString>;
533
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
534
+ runtime: z.ZodOptional<z.ZodString>;
535
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
536
+ usage: z.ZodObject<{
537
+ inputTokens: z.ZodNumber;
538
+ outputTokens: z.ZodNumber;
539
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
540
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
541
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
542
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
543
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
544
+ costUSD: z.ZodNumber;
545
+ }, z.core.$strip>;
546
+ }, z.core.$strip>>;
547
+ auxiliary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
548
+ model: z.ZodOptional<z.ZodString>;
549
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
550
+ runtime: z.ZodOptional<z.ZodString>;
551
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
552
+ usage: z.ZodObject<{
553
+ inputTokens: z.ZodNumber;
554
+ outputTokens: z.ZodNumber;
555
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
556
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
557
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
558
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
559
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
560
+ costUSD: z.ZodNumber;
561
+ }, z.core.$strip>;
562
+ }, z.core.$strip>>>;
563
+ total: z.ZodObject<{
564
+ model: z.ZodOptional<z.ZodString>;
565
+ models: z.ZodOptional<z.ZodArray<z.ZodString>>;
566
+ runtime: z.ZodOptional<z.ZodString>;
567
+ runtimes: z.ZodOptional<z.ZodArray<z.ZodString>>;
568
+ usage: z.ZodObject<{
569
+ inputTokens: z.ZodNumber;
570
+ outputTokens: z.ZodNumber;
571
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
572
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
573
+ cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
574
+ cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
575
+ webSearchRequests: z.ZodOptional<z.ZodNumber>;
576
+ costUSD: z.ZodNumber;
577
+ }, z.core.$strip>;
578
+ }, z.core.$strip>;
441
579
  }, z.core.$strip>>;
442
580
  totalSkippedFiles: z.ZodOptional<z.ZodNumber>;
443
- auxiliaryUsage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
444
- inputTokens: z.ZodNumber;
445
- outputTokens: z.ZodNumber;
446
- cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
447
- cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
448
- cacheCreation5mInputTokens: z.ZodOptional<z.ZodNumber>;
449
- cacheCreation1hInputTokens: z.ZodOptional<z.ZodNumber>;
450
- webSearchRequests: z.ZodOptional<z.ZodNumber>;
451
- costUSD: z.ZodNumber;
452
- }, z.core.$strip>>>;
453
581
  failedSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
454
582
  totalFailedHunks: z.ZodOptional<z.ZodNumber>;
455
583
  totalFailedExtractions: z.ZodOptional<z.ZodNumber>;
@@ -479,6 +607,7 @@ export declare const JsonlSummaryRecordSchema: z.ZodObject<{
479
607
  }, z.core.$strip>>;
480
608
  }, z.core.$strip>;
481
609
  export type JsonlSummaryRecord = z.infer<typeof JsonlSummaryRecordSchema>;
610
+ export declare function parseJsonlSummaryRecord(value: unknown): JsonlSummaryRecord | undefined;
482
611
  /** Per-evaluation detail for fix evaluation records. */
483
612
  export declare const JsonlFixEvalDetailSchema: z.ZodObject<{
484
613
  path: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/cli/output/jsonl.ts"],"names":[],"mappings":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,CAAC,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,GACA,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI3E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;CACzB;AAsID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAmDjE;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,qFAAqF;IACrF,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAwG9E"}
@@ -3,9 +3,11 @@ import { randomUUID } from 'node:crypto';
3
3
  import { dirname, join, resolve } from 'node:path';
4
4
  import { z } from 'zod';
5
5
  import { UsageStatsSchema, SkillReportSchema, FileReportSchema, FindingSchema, AuxiliaryUsageMapSchema, FixStatusSchema, isExtractionErrorCode, SkillErrorSchema, SkippedFileSchema, HunkTraceSchema, } from '../../types/index.js';
6
- import { mergeAuxiliaryUsage } from '../../sdk/usage.js';
6
+ import { mergeAuxiliaryUsage, mergeAuxiliaryUsageAttribution } from '../../sdk/usage.js';
7
7
  import { logger } from '../../sentry.js';
8
8
  import { countBySeverity } from './formatters.js';
9
+ import { JsonlUsageBreakdownSchema, aggregateReportAuxiliaryUsageAttribution, aggregateUsageStatsPreservingOptional, auxiliaryUsageAttributionFromBreakdown, auxiliaryUsageFromBreakdown, buildJsonlUsageBreakdown, scanUsageFromBreakdown, usageAttributionFromReports, } from './usage-breakdown.js';
10
+ export { JsonlUsageBreakdownEntrySchema, JsonlUsageBreakdownSchema, auxiliaryUsageFromBreakdown, buildJsonlUsageBreakdown, scanUsageFromBreakdown, usageStatsHaveValue, } from './usage-breakdown.js';
9
11
  /**
10
12
  * Sentinel value recorded in JSONL metadata when no model is explicitly configured.
11
13
  */
@@ -59,7 +61,7 @@ export const JsonlRunMetadataSchema = z.object({
59
61
  });
60
62
  /** Per-file breakdown within a skill record (re-exported from shared types). */
61
63
  export const JsonlFileRecordSchema = FileReportSchema;
62
- /** Unit of work scanned by Warden. New run logs contain only this record type. */
64
+ /** Unit of work scanned by Warden, emitted during streaming and finalization. */
63
65
  export const JsonlChunkRecordSchema = z.object({
64
66
  schemaVersion: z.literal(1),
65
67
  run: JsonlRunMetadataSchema,
@@ -73,13 +75,29 @@ export const JsonlChunkRecordSchema = z.object({
73
75
  }),
74
76
  status: z.enum(['ok', 'error', 'skipped']),
75
77
  findings: z.array(FindingSchema),
76
- usage: UsageStatsSchema.optional(),
78
+ usageBreakdown: JsonlUsageBreakdownSchema.optional(),
77
79
  durationMs: z.number().nonnegative(),
78
- auxiliaryUsage: AuxiliaryUsageMapSchema.optional(),
79
80
  error: SkillErrorSchema.optional(),
80
81
  skippedFiles: z.array(SkippedFileSchema).optional(),
81
82
  trace: HunkTraceSchema.optional(),
82
83
  });
84
+ const JsonlLegacyChunkRecordSchema = JsonlChunkRecordSchema.extend({
85
+ usage: UsageStatsSchema.optional(),
86
+ auxiliaryUsage: AuxiliaryUsageMapSchema.optional(),
87
+ });
88
+ function normalizeChunkRecord(record) {
89
+ const { usage, auxiliaryUsage, ...chunk } = record;
90
+ return {
91
+ ...chunk,
92
+ usageBreakdown: chunk.usageBreakdown ?? buildJsonlUsageBreakdown(usage, auxiliaryUsage, {
93
+ scan: { model: chunk.model },
94
+ }),
95
+ };
96
+ }
97
+ export function parseJsonlChunkRecord(value) {
98
+ const result = JsonlLegacyChunkRecordSchema.safeParse(value);
99
+ return result.success ? normalizeChunkRecord(result.data) : undefined;
100
+ }
83
101
  /**
84
102
  * One skill's analysis results. This is the shared SkillReport plus a `run`
85
103
  * block of run-wide metadata, so any new SkillReport field is automatically
@@ -87,6 +105,7 @@ export const JsonlChunkRecordSchema = z.object({
87
105
  */
88
106
  export const JsonlRecordSchema = SkillReportSchema.extend({
89
107
  run: JsonlRunMetadataSchema,
108
+ usageBreakdown: JsonlUsageBreakdownSchema.optional(),
90
109
  });
91
110
  /** Normalized output shape — what we emit. */
92
111
  const BySeverityOutputSchema = z.object({
@@ -122,9 +141,8 @@ export const JsonlSummaryRecordSchema = z.object({
122
141
  type: z.literal('summary'),
123
142
  totalFindings: z.number().int().nonnegative(),
124
143
  bySeverity: BySeveritySchema,
125
- usage: UsageStatsSchema.optional(),
144
+ usageBreakdown: JsonlUsageBreakdownSchema.optional(),
126
145
  totalSkippedFiles: z.number().int().nonnegative().optional(),
127
- auxiliaryUsage: AuxiliaryUsageMapSchema.optional(),
128
146
  failedSkills: z.array(z.string()).optional(),
129
147
  totalFailedHunks: z.number().int().nonnegative().optional(),
130
148
  totalFailedExtractions: z.number().int().nonnegative().optional(),
@@ -135,6 +153,21 @@ export const JsonlSummaryRecordSchema = z.object({
135
153
  */
136
154
  error: SkillErrorSchema.optional(),
137
155
  });
156
+ const JsonlLegacySummaryRecordSchema = JsonlSummaryRecordSchema.extend({
157
+ usage: UsageStatsSchema.optional(),
158
+ auxiliaryUsage: AuxiliaryUsageMapSchema.optional(),
159
+ });
160
+ function normalizeSummaryRecord(record) {
161
+ const { usage, auxiliaryUsage, ...summary } = record;
162
+ return {
163
+ ...summary,
164
+ usageBreakdown: summary.usageBreakdown ?? buildJsonlUsageBreakdown(usage, auxiliaryUsage),
165
+ };
166
+ }
167
+ export function parseJsonlSummaryRecord(value) {
168
+ const result = JsonlLegacySummaryRecordSchema.safeParse(value);
169
+ return result.success ? normalizeSummaryRecord(result.data) : undefined;
170
+ }
138
171
  /** Per-evaluation detail for fix evaluation records. */
139
172
  export const JsonlFixEvalDetailSchema = z.object({
140
173
  path: z.string(),
@@ -165,16 +198,7 @@ function aggregateUsage(reports) {
165
198
  const usages = reports.map((r) => r.usage).filter((u) => u !== undefined);
166
199
  if (usages.length === 0)
167
200
  return undefined;
168
- return usages.reduce((acc, u) => ({
169
- inputTokens: acc.inputTokens + u.inputTokens,
170
- outputTokens: acc.outputTokens + u.outputTokens,
171
- cacheReadInputTokens: (acc.cacheReadInputTokens ?? 0) + (u.cacheReadInputTokens ?? 0),
172
- cacheCreationInputTokens: (acc.cacheCreationInputTokens ?? 0) + (u.cacheCreationInputTokens ?? 0),
173
- cacheCreation5mInputTokens: (acc.cacheCreation5mInputTokens ?? 0) + (u.cacheCreation5mInputTokens ?? 0),
174
- cacheCreation1hInputTokens: (acc.cacheCreation1hInputTokens ?? 0) + (u.cacheCreation1hInputTokens ?? 0),
175
- webSearchRequests: (acc.webSearchRequests ?? 0) + (u.webSearchRequests ?? 0),
176
- costUSD: acc.costUSD + u.costUSD,
177
- }));
201
+ return aggregateUsageStatsPreservingOptional(usages);
178
202
  }
179
203
  /**
180
204
  * Build a JSONL run metadata block. `durationMs` is a snapshot at write
@@ -201,13 +225,22 @@ export function buildSkillJsonlRecord(report, run) {
201
225
  hunkFailures: report.hunkFailures?.length ? report.hunkFailures : undefined,
202
226
  traces: report.traces?.length ? report.traces : undefined,
203
227
  };
204
- return { ...trimmed, run };
228
+ return {
229
+ ...trimmed,
230
+ run,
231
+ usageBreakdown: buildJsonlUsageBreakdown(report.usage, report.auxiliaryUsage, {
232
+ scan: { model: report.model, runtime: report.runtime },
233
+ auxiliary: report.auxiliaryUsageAttribution,
234
+ }),
235
+ };
205
236
  }
206
237
  /** Build the aggregate summary JSONL record. */
207
238
  export function buildSummaryJsonlRecord(reports, run, error) {
208
239
  const allFindings = reports.flatMap((r) => r.findings);
209
240
  const totalSkippedFiles = reports.reduce((n, r) => n + (r.skippedFiles?.length ?? 0), 0);
210
241
  const totalAuxiliaryUsage = reports.reduce((acc, r) => mergeAuxiliaryUsage(acc, r.auxiliaryUsage), undefined);
242
+ const totalAuxiliaryUsageAttribution = aggregateReportAuxiliaryUsageAttribution(reports);
243
+ const usage = aggregateUsage(reports);
211
244
  const failedSkills = reports.filter((r) => r.error).map((r) => r.skill);
212
245
  const totalFailedHunks = reports.reduce((n, r) => n + (r.failedHunks ?? 0), 0);
213
246
  const totalFailedExtractions = reports.reduce((n, r) => n + (r.failedExtractions ?? 0), 0);
@@ -216,9 +249,11 @@ export function buildSummaryJsonlRecord(reports, run, error) {
216
249
  type: 'summary',
217
250
  totalFindings: allFindings.length,
218
251
  bySeverity: countBySeverity(allFindings),
219
- usage: aggregateUsage(reports),
252
+ usageBreakdown: buildJsonlUsageBreakdown(usage, totalAuxiliaryUsage, {
253
+ scan: usageAttributionFromReports(reports),
254
+ auxiliary: totalAuxiliaryUsageAttribution,
255
+ }),
220
256
  totalSkippedFiles: totalSkippedFiles > 0 ? totalSkippedFiles : undefined,
221
- auxiliaryUsage: totalAuxiliaryUsage,
222
257
  failedSkills: failedSkills.length > 0 ? failedSkills : undefined,
223
258
  totalFailedHunks: totalFailedHunks > 0 ? totalFailedHunks : undefined,
224
259
  totalFailedExtractions: totalFailedExtractions > 0 ? totalFailedExtractions : undefined,
@@ -339,10 +374,12 @@ function reportsFromChunks(chunks) {
339
374
  for (const [skill, records] of bySkill) {
340
375
  const reportLevelError = records.find(isReportLevelErrorRecord)?.error;
341
376
  const chunkRecords = records.filter((record) => !isReportLevelErrorRecord(record));
377
+ const analysisChunkRecords = chunkRecords.filter(isAnalysisChunkRecord);
342
378
  const aggregateRecords = chunkRecords.length > 0 ? chunkRecords : records;
343
379
  const findings = aggregateRecords.flatMap((r) => r.findings);
344
- const usage = aggregateRecords.reduce((acc, r) => addUsage(acc, r.usage), undefined);
345
- const auxiliaryUsage = aggregateRecords.reduce((acc, r) => mergeAuxiliaryUsage(acc, r.auxiliaryUsage), undefined);
380
+ const usage = aggregateRecords.reduce((acc, r) => addUsage(acc, scanUsageFromBreakdown(r.usageBreakdown)), undefined);
381
+ const auxiliaryUsage = aggregateRecords.reduce((acc, r) => mergeAuxiliaryUsage(acc, auxiliaryUsageFromBreakdown(r.usageBreakdown)), undefined);
382
+ const auxiliaryUsageAttribution = aggregateRecords.reduce((acc, r) => mergeAuxiliaryUsageAttribution(acc, auxiliaryUsageAttributionFromBreakdown(r.usageBreakdown)), undefined);
346
383
  const traces = aggregateRecords.flatMap((r) => r.trace ? [r.trace] : []);
347
384
  const filesByName = new Map();
348
385
  const hunkFailures = [];
@@ -354,7 +391,7 @@ function reportsFromChunks(chunks) {
354
391
  filename: record.chunk.file,
355
392
  findings: (existing?.findings ?? 0) + record.findings.length,
356
393
  durationMs: (existing?.durationMs ?? 0) + record.durationMs,
357
- usage: addUsage(existing?.usage, record.usage),
394
+ usage: addUsage(existing?.usage, scanUsageFromBreakdown(record.usageBreakdown)),
358
395
  });
359
396
  }
360
397
  if (record.status === 'error' && record.error && !isReportLevelErrorRecord(record)) {
@@ -367,11 +404,11 @@ function reportsFromChunks(chunks) {
367
404
  });
368
405
  }
369
406
  }
370
- const failedHunks = chunkRecords.filter((r) => r.status === 'error' && r.error && !isExtractionErrorCode(r.error.code)).length;
371
- const failedExtractions = chunkRecords.filter((r) => r.status === 'error' && r.error && isExtractionErrorCode(r.error.code)).length;
372
- const allChunksFailed = chunkRecords.length > 0 &&
407
+ const failedHunks = analysisChunkRecords.filter((r) => r.status === 'error' && r.error && !isExtractionErrorCode(r.error.code)).length;
408
+ const failedExtractions = analysisChunkRecords.filter((r) => r.status === 'error' && r.error && isExtractionErrorCode(r.error.code)).length;
409
+ const allChunksFailed = analysisChunkRecords.length > 0 &&
373
410
  findings.length === 0 &&
374
- chunkRecords.every((record) => record.status === 'error');
411
+ analysisChunkRecords.every((record) => record.status === 'error');
375
412
  const report = {
376
413
  skill,
377
414
  summary: summarizeFindings(skill, findings),
@@ -387,11 +424,13 @@ function reportsFromChunks(chunks) {
387
424
  else if (allChunksFailed) {
388
425
  report.error = {
389
426
  code: 'all_hunks_failed',
390
- message: `All ${chunkRecords.length} ${chunkRecords.length === 1 ? 'chunk' : 'chunks'} failed to analyze.`,
427
+ message: `All ${analysisChunkRecords.length} ${analysisChunkRecords.length === 1 ? 'chunk' : 'chunks'} failed to analyze.`,
391
428
  };
392
429
  }
393
430
  if (auxiliaryUsage)
394
431
  report.auxiliaryUsage = auxiliaryUsage;
432
+ if (auxiliaryUsageAttribution)
433
+ report.auxiliaryUsageAttribution = auxiliaryUsageAttribution;
395
434
  if (failedHunks > 0)
396
435
  report.failedHunks = failedHunks;
397
436
  if (failedExtractions > 0)
@@ -409,6 +448,15 @@ function reportsFromChunks(chunks) {
409
448
  function isReportLevelErrorRecord(record) {
410
449
  return record.status === 'error' && record.chunk.file === '' && Boolean(record.error);
411
450
  }
451
+ function isUsageOnlyPostProcessingRecord(record) {
452
+ return record.chunk.file === '' && record.chunk.lineRange === 'post-processing';
453
+ }
454
+ function isSkippedFilesMetadataRecord(record) {
455
+ return record.status === 'skipped' && record.chunk.lineRange === '' && (record.skippedFiles?.length ?? 0) > 0;
456
+ }
457
+ function isAnalysisChunkRecord(record) {
458
+ return !isUsageOnlyPostProcessingRecord(record) && !isSkippedFilesMetadataRecord(record);
459
+ }
412
460
  export function parseJsonlReports(content) {
413
461
  const lines = content.trim().split('\n').filter((line) => line.trim());
414
462
  const reports = [];
@@ -418,17 +466,19 @@ export function parseJsonlReports(content) {
418
466
  for (const line of lines) {
419
467
  try {
420
468
  const parsed = JSON.parse(line);
421
- const chunk = JsonlChunkRecordSchema.safeParse(parsed);
422
- if (chunk.success) {
423
- chunks.push(chunk.data);
469
+ const chunk = parseJsonlChunkRecord(parsed);
470
+ if (chunk) {
471
+ chunks.push(chunk);
424
472
  if (!runMetadata)
425
- runMetadata = chunk.data.run;
426
- totalDurationMs = Math.max(totalDurationMs, chunk.data.run.durationMs);
473
+ runMetadata = chunk.run;
474
+ totalDurationMs = Math.max(totalDurationMs, chunk.run.durationMs);
427
475
  continue;
428
476
  }
429
477
  // Skip summary record (but capture metadata from it)
430
478
  if (parsed.type === 'summary') {
431
- const summary = JsonlSummaryRecordSchema.parse(parsed);
479
+ const summary = parseJsonlSummaryRecord(parsed);
480
+ if (!summary)
481
+ throw new Error('Invalid summary record');
432
482
  runMetadata = summary.run;
433
483
  totalDurationMs = summary.run.durationMs;
434
484
  continue;
@@ -440,7 +490,7 @@ export function parseJsonlReports(content) {
440
490
  continue;
441
491
  // A JsonlRecord is a SkillReport + { run }. Strip `run` to get the
442
492
  // SkillReport without rebuilding it field-by-field.
443
- const { run, ...report } = JsonlRecordSchema.parse(parsed);
493
+ const { run, usageBreakdown: _usageBreakdown, ...report } = JsonlRecordSchema.parse(parsed);
444
494
  reports.push(report);
445
495
  // Capture run metadata from first record if no summary yet
446
496
  if (!runMetadata) {
@@ -482,30 +532,33 @@ export function parseLogMetadata(filePath) {
482
532
  for (const line of lines) {
483
533
  try {
484
534
  const parsed = JSON.parse(line);
485
- const chunk = JsonlChunkRecordSchema.safeParse(parsed);
486
- if (chunk.success) {
487
- chunks.push(chunk.data);
535
+ const chunk = parseJsonlChunkRecord(parsed);
536
+ if (chunk) {
537
+ chunks.push(chunk);
488
538
  recognizedRecords++;
489
- if (!skills.includes(chunk.data.skill)) {
490
- skills.push(chunk.data.skill);
539
+ if (!skills.includes(chunk.skill)) {
540
+ skills.push(chunk.skill);
491
541
  }
492
- if (!model && chunk.data.model) {
493
- model = chunk.data.model;
542
+ if (!model && chunk.model) {
543
+ model = chunk.model;
494
544
  }
495
- if (!model && chunk.data.run.model) {
496
- model = chunk.data.run.model;
545
+ if (!model && chunk.run.model) {
546
+ model = chunk.run.model;
497
547
  }
498
- if (!headSha && chunk.data.run.headSha) {
499
- headSha = chunk.data.run.headSha;
548
+ if (!headSha && chunk.run.headSha) {
549
+ headSha = chunk.run.headSha;
500
550
  }
501
551
  if (!firstRun)
502
- firstRun = chunk.data.run;
503
- if (chunk.data.chunk.file) {
504
- uniqueFiles.add(chunk.data.chunk.file);
552
+ firstRun = chunk.run;
553
+ if (chunk.chunk.file) {
554
+ uniqueFiles.add(chunk.chunk.file);
505
555
  }
506
556
  }
507
557
  else if (parsed.type === 'summary') {
508
- summary = JsonlSummaryRecordSchema.parse(parsed);
558
+ const parsedSummary = parseJsonlSummaryRecord(parsed);
559
+ if (!parsedSummary)
560
+ throw new Error('Invalid summary record');
561
+ summary = parsedSummary;
509
562
  recognizedRecords++;
510
563
  if (!model && parsed.run?.model && typeof parsed.run.model === 'string') {
511
564
  model = parsed.run.model;