@simonren/quorum 0.7.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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -0
  3. package/commands/multi-consult.md +109 -0
  4. package/commands/multi-review.md +139 -0
  5. package/dist/adapters/base.d.ts +120 -0
  6. package/dist/adapters/base.js +98 -0
  7. package/dist/adapters/claude.d.ts +25 -0
  8. package/dist/adapters/claude.js +217 -0
  9. package/dist/adapters/codex.d.ts +20 -0
  10. package/dist/adapters/codex.js +227 -0
  11. package/dist/adapters/gemini.d.ts +20 -0
  12. package/dist/adapters/gemini.js +197 -0
  13. package/dist/adapters/index.d.ts +12 -0
  14. package/dist/adapters/index.js +15 -0
  15. package/dist/cli/check.d.ts +20 -0
  16. package/dist/cli/check.js +78 -0
  17. package/dist/cli/codex.d.ts +11 -0
  18. package/dist/cli/codex.js +255 -0
  19. package/dist/cli/gemini.d.ts +12 -0
  20. package/dist/cli/gemini.js +253 -0
  21. package/dist/commands.d.ts +28 -0
  22. package/dist/commands.js +105 -0
  23. package/dist/config.d.ts +244 -0
  24. package/dist/config.js +179 -0
  25. package/dist/consult-prompt.d.ts +10 -0
  26. package/dist/consult-prompt.js +72 -0
  27. package/dist/context.d.ts +1538 -0
  28. package/dist/context.js +383 -0
  29. package/dist/decoders/claude.d.ts +53 -0
  30. package/dist/decoders/claude.js +106 -0
  31. package/dist/decoders/codex.d.ts +71 -0
  32. package/dist/decoders/codex.js +145 -0
  33. package/dist/decoders/gemini.d.ts +33 -0
  34. package/dist/decoders/gemini.js +58 -0
  35. package/dist/decoders/index.d.ts +6 -0
  36. package/dist/decoders/index.js +3 -0
  37. package/dist/errors.d.ts +46 -0
  38. package/dist/errors.js +192 -0
  39. package/dist/executor.d.ts +103 -0
  40. package/dist/executor.js +244 -0
  41. package/dist/handoff.d.ts +270 -0
  42. package/dist/handoff.js +599 -0
  43. package/dist/index.d.ts +18 -0
  44. package/dist/index.js +134 -0
  45. package/dist/pipeline.d.ts +135 -0
  46. package/dist/pipeline.js +462 -0
  47. package/dist/prompt-v2.d.ts +38 -0
  48. package/dist/prompt-v2.js +391 -0
  49. package/dist/prompt.d.ts +71 -0
  50. package/dist/prompt.js +309 -0
  51. package/dist/schema.d.ts +660 -0
  52. package/dist/schema.js +536 -0
  53. package/dist/tools/consult.d.ts +104 -0
  54. package/dist/tools/consult.js +220 -0
  55. package/dist/tools/feedback.d.ts +91 -0
  56. package/dist/tools/feedback.js +117 -0
  57. package/dist/types.d.ts +105 -0
  58. package/dist/types.js +31 -0
  59. package/package.json +54 -0
@@ -0,0 +1,660 @@
1
+ /**
2
+ * Structured Output Schemas for AI Review
3
+ *
4
+ * Uses Zod for strict validation of reviewer output.
5
+ * This replaces the fragile regex-based markdown validation.
6
+ */
7
+ import { z } from 'zod';
8
+ export declare const SeverityLevel: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
9
+ export type SeverityLevel = z.infer<typeof SeverityLevel>;
10
+ export declare const ConfidenceLevel: z.ZodEnum<["verified", "high", "medium", "low", "uncertain"]>;
11
+ export type ConfidenceLevel = z.infer<typeof ConfidenceLevel>;
12
+ export declare const ConfidenceScore: z.ZodNumber;
13
+ export type ConfidenceScore = z.infer<typeof ConfidenceScore>;
14
+ /**
15
+ * Sentinel used when a reviewer omits `confidence` on a finding, agreement,
16
+ * or disagreement. Confidence is required by the Zod schema, but external
17
+ * CLIs occasionally drop the field — rather than reject the whole review,
18
+ * normalization fills it with this midpoint value. 0.5 reads as "the
19
+ * reviewer did not commit to a confidence" without skewing the result
20
+ * toward "confidently right" or "confidently wrong".
21
+ */
22
+ export declare const DEFAULT_FINDING_CONFIDENCE = 0.5;
23
+ export declare const CodeLocation: z.ZodObject<{
24
+ file: z.ZodString;
25
+ line_start: z.ZodOptional<z.ZodNumber>;
26
+ line_end: z.ZodOptional<z.ZodNumber>;
27
+ column_start: z.ZodOptional<z.ZodNumber>;
28
+ column_end: z.ZodOptional<z.ZodNumber>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ file: string;
31
+ line_start?: number | undefined;
32
+ line_end?: number | undefined;
33
+ column_start?: number | undefined;
34
+ column_end?: number | undefined;
35
+ }, {
36
+ file: string;
37
+ line_start?: number | undefined;
38
+ line_end?: number | undefined;
39
+ column_start?: number | undefined;
40
+ column_end?: number | undefined;
41
+ }>;
42
+ export type CodeLocation = z.infer<typeof CodeLocation>;
43
+ export declare const ReviewFinding: z.ZodObject<{
44
+ id: z.ZodString;
45
+ category: z.ZodEnum<["security", "performance", "architecture", "correctness", "maintainability", "scalability", "testing", "documentation", "best-practice", "other"]>;
46
+ severity: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
47
+ confidence: z.ZodNumber;
48
+ title: z.ZodString;
49
+ description: z.ZodString;
50
+ location: z.ZodOptional<z.ZodObject<{
51
+ file: z.ZodString;
52
+ line_start: z.ZodOptional<z.ZodNumber>;
53
+ line_end: z.ZodOptional<z.ZodNumber>;
54
+ column_start: z.ZodOptional<z.ZodNumber>;
55
+ column_end: z.ZodOptional<z.ZodNumber>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ file: string;
58
+ line_start?: number | undefined;
59
+ line_end?: number | undefined;
60
+ column_start?: number | undefined;
61
+ column_end?: number | undefined;
62
+ }, {
63
+ file: string;
64
+ line_start?: number | undefined;
65
+ line_end?: number | undefined;
66
+ column_start?: number | undefined;
67
+ column_end?: number | undefined;
68
+ }>>;
69
+ evidence: z.ZodOptional<z.ZodString>;
70
+ suggestion: z.ZodOptional<z.ZodString>;
71
+ cwe_id: z.ZodOptional<z.ZodString>;
72
+ owasp_category: z.ZodOptional<z.ZodString>;
73
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ severity: "high" | "info" | "critical" | "medium" | "low";
76
+ title: string;
77
+ description: string;
78
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
79
+ confidence: number;
80
+ id: string;
81
+ location?: {
82
+ file: string;
83
+ line_start?: number | undefined;
84
+ line_end?: number | undefined;
85
+ column_start?: number | undefined;
86
+ column_end?: number | undefined;
87
+ } | undefined;
88
+ suggestion?: string | undefined;
89
+ evidence?: string | undefined;
90
+ cwe_id?: string | undefined;
91
+ owasp_category?: string | undefined;
92
+ tags?: string[] | undefined;
93
+ }, {
94
+ severity: "high" | "info" | "critical" | "medium" | "low";
95
+ title: string;
96
+ description: string;
97
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
98
+ confidence: number;
99
+ id: string;
100
+ location?: {
101
+ file: string;
102
+ line_start?: number | undefined;
103
+ line_end?: number | undefined;
104
+ column_start?: number | undefined;
105
+ column_end?: number | undefined;
106
+ } | undefined;
107
+ suggestion?: string | undefined;
108
+ evidence?: string | undefined;
109
+ cwe_id?: string | undefined;
110
+ owasp_category?: string | undefined;
111
+ tags?: string[] | undefined;
112
+ }>;
113
+ export type ReviewFinding = z.infer<typeof ReviewFinding>;
114
+ export declare const Agreement: z.ZodObject<{
115
+ original_claim: z.ZodString;
116
+ assessment: z.ZodEnum<["correct", "mostly_correct", "partially_correct"]>;
117
+ confidence: z.ZodNumber;
118
+ supporting_evidence: z.ZodOptional<z.ZodString>;
119
+ notes: z.ZodOptional<z.ZodString>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ confidence: number;
122
+ original_claim: string;
123
+ assessment: "correct" | "mostly_correct" | "partially_correct";
124
+ supporting_evidence?: string | undefined;
125
+ notes?: string | undefined;
126
+ }, {
127
+ confidence: number;
128
+ original_claim: string;
129
+ assessment: "correct" | "mostly_correct" | "partially_correct";
130
+ supporting_evidence?: string | undefined;
131
+ notes?: string | undefined;
132
+ }>;
133
+ export type Agreement = z.infer<typeof Agreement>;
134
+ export declare const Disagreement: z.ZodObject<{
135
+ original_claim: z.ZodString;
136
+ issue: z.ZodEnum<["incorrect", "misleading", "incomplete", "outdated", "hallucinated"]>;
137
+ confidence: z.ZodNumber;
138
+ reason: z.ZodString;
139
+ correction: z.ZodOptional<z.ZodString>;
140
+ evidence: z.ZodOptional<z.ZodString>;
141
+ }, "strip", z.ZodTypeAny, {
142
+ confidence: number;
143
+ reason: string;
144
+ original_claim: string;
145
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
146
+ evidence?: string | undefined;
147
+ correction?: string | undefined;
148
+ }, {
149
+ confidence: number;
150
+ reason: string;
151
+ original_claim: string;
152
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
153
+ evidence?: string | undefined;
154
+ correction?: string | undefined;
155
+ }>;
156
+ export type Disagreement = z.infer<typeof Disagreement>;
157
+ export declare const Alternative: z.ZodObject<{
158
+ topic: z.ZodString;
159
+ current_approach: z.ZodString;
160
+ alternative: z.ZodString;
161
+ tradeoffs: z.ZodObject<{
162
+ pros: z.ZodArray<z.ZodString, "many">;
163
+ cons: z.ZodArray<z.ZodString, "many">;
164
+ }, "strip", z.ZodTypeAny, {
165
+ pros: string[];
166
+ cons: string[];
167
+ }, {
168
+ pros: string[];
169
+ cons: string[];
170
+ }>;
171
+ recommendation: z.ZodEnum<["strongly_prefer", "consider", "situational", "informational"]>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ topic: string;
174
+ tradeoffs: {
175
+ pros: string[];
176
+ cons: string[];
177
+ };
178
+ current_approach: string;
179
+ alternative: string;
180
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
181
+ }, {
182
+ topic: string;
183
+ tradeoffs: {
184
+ pros: string[];
185
+ cons: string[];
186
+ };
187
+ current_approach: string;
188
+ alternative: string;
189
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
190
+ }>;
191
+ export type Alternative = z.infer<typeof Alternative>;
192
+ export declare const RiskAssessment: z.ZodObject<{
193
+ overall_level: z.ZodEnum<["critical", "high", "medium", "low", "minimal"]>;
194
+ score: z.ZodNumber;
195
+ summary: z.ZodString;
196
+ top_concerns: z.ZodArray<z.ZodString, "many">;
197
+ mitigations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ summary: string;
200
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
201
+ score: number;
202
+ top_concerns: string[];
203
+ mitigations?: string[] | undefined;
204
+ }, {
205
+ summary: string;
206
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
207
+ score: number;
208
+ top_concerns: string[];
209
+ mitigations?: string[] | undefined;
210
+ }>;
211
+ export type RiskAssessment = z.infer<typeof RiskAssessment>;
212
+ export declare const UncertaintyResponse: z.ZodObject<{
213
+ uncertainty_index: z.ZodNumber;
214
+ verified: z.ZodBoolean;
215
+ finding: z.ZodString;
216
+ recommendation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ verified: boolean;
219
+ uncertainty_index: number;
220
+ finding: string;
221
+ recommendation?: string | null | undefined;
222
+ }, {
223
+ verified: boolean;
224
+ uncertainty_index: number;
225
+ finding: string;
226
+ recommendation?: string | null | undefined;
227
+ }>;
228
+ export type UncertaintyResponse = z.infer<typeof UncertaintyResponse>;
229
+ export declare const QuestionAnswer: z.ZodObject<{
230
+ question_index: z.ZodNumber;
231
+ answer: z.ZodString;
232
+ confidence: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ question_index: number;
235
+ answer: string;
236
+ confidence?: number | null | undefined;
237
+ }, {
238
+ question_index: number;
239
+ answer: string;
240
+ confidence?: number | null | undefined;
241
+ }>;
242
+ export type QuestionAnswer = z.infer<typeof QuestionAnswer>;
243
+ export declare const ReviewOutput: z.ZodObject<{
244
+ reviewer: z.ZodString;
245
+ timestamp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
+ findings: z.ZodArray<z.ZodObject<{
247
+ id: z.ZodString;
248
+ category: z.ZodEnum<["security", "performance", "architecture", "correctness", "maintainability", "scalability", "testing", "documentation", "best-practice", "other"]>;
249
+ severity: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
250
+ confidence: z.ZodNumber;
251
+ title: z.ZodString;
252
+ description: z.ZodString;
253
+ location: z.ZodOptional<z.ZodObject<{
254
+ file: z.ZodString;
255
+ line_start: z.ZodOptional<z.ZodNumber>;
256
+ line_end: z.ZodOptional<z.ZodNumber>;
257
+ column_start: z.ZodOptional<z.ZodNumber>;
258
+ column_end: z.ZodOptional<z.ZodNumber>;
259
+ }, "strip", z.ZodTypeAny, {
260
+ file: string;
261
+ line_start?: number | undefined;
262
+ line_end?: number | undefined;
263
+ column_start?: number | undefined;
264
+ column_end?: number | undefined;
265
+ }, {
266
+ file: string;
267
+ line_start?: number | undefined;
268
+ line_end?: number | undefined;
269
+ column_start?: number | undefined;
270
+ column_end?: number | undefined;
271
+ }>>;
272
+ evidence: z.ZodOptional<z.ZodString>;
273
+ suggestion: z.ZodOptional<z.ZodString>;
274
+ cwe_id: z.ZodOptional<z.ZodString>;
275
+ owasp_category: z.ZodOptional<z.ZodString>;
276
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
277
+ }, "strip", z.ZodTypeAny, {
278
+ severity: "high" | "info" | "critical" | "medium" | "low";
279
+ title: string;
280
+ description: string;
281
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
282
+ confidence: number;
283
+ id: string;
284
+ location?: {
285
+ file: string;
286
+ line_start?: number | undefined;
287
+ line_end?: number | undefined;
288
+ column_start?: number | undefined;
289
+ column_end?: number | undefined;
290
+ } | undefined;
291
+ suggestion?: string | undefined;
292
+ evidence?: string | undefined;
293
+ cwe_id?: string | undefined;
294
+ owasp_category?: string | undefined;
295
+ tags?: string[] | undefined;
296
+ }, {
297
+ severity: "high" | "info" | "critical" | "medium" | "low";
298
+ title: string;
299
+ description: string;
300
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
301
+ confidence: number;
302
+ id: string;
303
+ location?: {
304
+ file: string;
305
+ line_start?: number | undefined;
306
+ line_end?: number | undefined;
307
+ column_start?: number | undefined;
308
+ column_end?: number | undefined;
309
+ } | undefined;
310
+ suggestion?: string | undefined;
311
+ evidence?: string | undefined;
312
+ cwe_id?: string | undefined;
313
+ owasp_category?: string | undefined;
314
+ tags?: string[] | undefined;
315
+ }>, "many">;
316
+ agreements: z.ZodArray<z.ZodObject<{
317
+ original_claim: z.ZodString;
318
+ assessment: z.ZodEnum<["correct", "mostly_correct", "partially_correct"]>;
319
+ confidence: z.ZodNumber;
320
+ supporting_evidence: z.ZodOptional<z.ZodString>;
321
+ notes: z.ZodOptional<z.ZodString>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ confidence: number;
324
+ original_claim: string;
325
+ assessment: "correct" | "mostly_correct" | "partially_correct";
326
+ supporting_evidence?: string | undefined;
327
+ notes?: string | undefined;
328
+ }, {
329
+ confidence: number;
330
+ original_claim: string;
331
+ assessment: "correct" | "mostly_correct" | "partially_correct";
332
+ supporting_evidence?: string | undefined;
333
+ notes?: string | undefined;
334
+ }>, "many">;
335
+ disagreements: z.ZodArray<z.ZodObject<{
336
+ original_claim: z.ZodString;
337
+ issue: z.ZodEnum<["incorrect", "misleading", "incomplete", "outdated", "hallucinated"]>;
338
+ confidence: z.ZodNumber;
339
+ reason: z.ZodString;
340
+ correction: z.ZodOptional<z.ZodString>;
341
+ evidence: z.ZodOptional<z.ZodString>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ confidence: number;
344
+ reason: string;
345
+ original_claim: string;
346
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
347
+ evidence?: string | undefined;
348
+ correction?: string | undefined;
349
+ }, {
350
+ confidence: number;
351
+ reason: string;
352
+ original_claim: string;
353
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
354
+ evidence?: string | undefined;
355
+ correction?: string | undefined;
356
+ }>, "many">;
357
+ alternatives: z.ZodArray<z.ZodObject<{
358
+ topic: z.ZodString;
359
+ current_approach: z.ZodString;
360
+ alternative: z.ZodString;
361
+ tradeoffs: z.ZodObject<{
362
+ pros: z.ZodArray<z.ZodString, "many">;
363
+ cons: z.ZodArray<z.ZodString, "many">;
364
+ }, "strip", z.ZodTypeAny, {
365
+ pros: string[];
366
+ cons: string[];
367
+ }, {
368
+ pros: string[];
369
+ cons: string[];
370
+ }>;
371
+ recommendation: z.ZodEnum<["strongly_prefer", "consider", "situational", "informational"]>;
372
+ }, "strip", z.ZodTypeAny, {
373
+ topic: string;
374
+ tradeoffs: {
375
+ pros: string[];
376
+ cons: string[];
377
+ };
378
+ current_approach: string;
379
+ alternative: string;
380
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
381
+ }, {
382
+ topic: string;
383
+ tradeoffs: {
384
+ pros: string[];
385
+ cons: string[];
386
+ };
387
+ current_approach: string;
388
+ alternative: string;
389
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
390
+ }>, "many">;
391
+ uncertainty_responses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
392
+ uncertainty_index: z.ZodNumber;
393
+ verified: z.ZodBoolean;
394
+ finding: z.ZodString;
395
+ recommendation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
396
+ }, "strip", z.ZodTypeAny, {
397
+ verified: boolean;
398
+ uncertainty_index: number;
399
+ finding: string;
400
+ recommendation?: string | null | undefined;
401
+ }, {
402
+ verified: boolean;
403
+ uncertainty_index: number;
404
+ finding: string;
405
+ recommendation?: string | null | undefined;
406
+ }>, "many">>>;
407
+ question_answers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
408
+ question_index: z.ZodNumber;
409
+ answer: z.ZodString;
410
+ confidence: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ question_index: number;
413
+ answer: string;
414
+ confidence?: number | null | undefined;
415
+ }, {
416
+ question_index: number;
417
+ answer: string;
418
+ confidence?: number | null | undefined;
419
+ }>, "many">>>;
420
+ risk_assessment: z.ZodObject<{
421
+ overall_level: z.ZodEnum<["critical", "high", "medium", "low", "minimal"]>;
422
+ score: z.ZodNumber;
423
+ summary: z.ZodString;
424
+ top_concerns: z.ZodArray<z.ZodString, "many">;
425
+ mitigations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
426
+ }, "strip", z.ZodTypeAny, {
427
+ summary: string;
428
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
429
+ score: number;
430
+ top_concerns: string[];
431
+ mitigations?: string[] | undefined;
432
+ }, {
433
+ summary: string;
434
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
435
+ score: number;
436
+ top_concerns: string[];
437
+ mitigations?: string[] | undefined;
438
+ }>;
439
+ files_examined: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
440
+ execution_notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
441
+ }, "strip", z.ZodTypeAny, {
442
+ findings: {
443
+ severity: "high" | "info" | "critical" | "medium" | "low";
444
+ title: string;
445
+ description: string;
446
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
447
+ confidence: number;
448
+ id: string;
449
+ location?: {
450
+ file: string;
451
+ line_start?: number | undefined;
452
+ line_end?: number | undefined;
453
+ column_start?: number | undefined;
454
+ column_end?: number | undefined;
455
+ } | undefined;
456
+ suggestion?: string | undefined;
457
+ evidence?: string | undefined;
458
+ cwe_id?: string | undefined;
459
+ owasp_category?: string | undefined;
460
+ tags?: string[] | undefined;
461
+ }[];
462
+ alternatives: {
463
+ topic: string;
464
+ tradeoffs: {
465
+ pros: string[];
466
+ cons: string[];
467
+ };
468
+ current_approach: string;
469
+ alternative: string;
470
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
471
+ }[];
472
+ reviewer: string;
473
+ agreements: {
474
+ confidence: number;
475
+ original_claim: string;
476
+ assessment: "correct" | "mostly_correct" | "partially_correct";
477
+ supporting_evidence?: string | undefined;
478
+ notes?: string | undefined;
479
+ }[];
480
+ disagreements: {
481
+ confidence: number;
482
+ reason: string;
483
+ original_claim: string;
484
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
485
+ evidence?: string | undefined;
486
+ correction?: string | undefined;
487
+ }[];
488
+ risk_assessment: {
489
+ summary: string;
490
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
491
+ score: number;
492
+ top_concerns: string[];
493
+ mitigations?: string[] | undefined;
494
+ };
495
+ timestamp?: string | null | undefined;
496
+ uncertainty_responses?: {
497
+ verified: boolean;
498
+ uncertainty_index: number;
499
+ finding: string;
500
+ recommendation?: string | null | undefined;
501
+ }[] | null | undefined;
502
+ question_answers?: {
503
+ question_index: number;
504
+ answer: string;
505
+ confidence?: number | null | undefined;
506
+ }[] | null | undefined;
507
+ files_examined?: string[] | null | undefined;
508
+ execution_notes?: string | null | undefined;
509
+ }, {
510
+ findings: {
511
+ severity: "high" | "info" | "critical" | "medium" | "low";
512
+ title: string;
513
+ description: string;
514
+ category: "security" | "performance" | "architecture" | "correctness" | "maintainability" | "scalability" | "testing" | "documentation" | "other" | "best-practice";
515
+ confidence: number;
516
+ id: string;
517
+ location?: {
518
+ file: string;
519
+ line_start?: number | undefined;
520
+ line_end?: number | undefined;
521
+ column_start?: number | undefined;
522
+ column_end?: number | undefined;
523
+ } | undefined;
524
+ suggestion?: string | undefined;
525
+ evidence?: string | undefined;
526
+ cwe_id?: string | undefined;
527
+ owasp_category?: string | undefined;
528
+ tags?: string[] | undefined;
529
+ }[];
530
+ alternatives: {
531
+ topic: string;
532
+ tradeoffs: {
533
+ pros: string[];
534
+ cons: string[];
535
+ };
536
+ current_approach: string;
537
+ alternative: string;
538
+ recommendation: "strongly_prefer" | "consider" | "situational" | "informational";
539
+ }[];
540
+ reviewer: string;
541
+ agreements: {
542
+ confidence: number;
543
+ original_claim: string;
544
+ assessment: "correct" | "mostly_correct" | "partially_correct";
545
+ supporting_evidence?: string | undefined;
546
+ notes?: string | undefined;
547
+ }[];
548
+ disagreements: {
549
+ confidence: number;
550
+ reason: string;
551
+ original_claim: string;
552
+ issue: "incorrect" | "misleading" | "incomplete" | "outdated" | "hallucinated";
553
+ evidence?: string | undefined;
554
+ correction?: string | undefined;
555
+ }[];
556
+ risk_assessment: {
557
+ summary: string;
558
+ overall_level: "high" | "critical" | "medium" | "low" | "minimal";
559
+ score: number;
560
+ top_concerns: string[];
561
+ mitigations?: string[] | undefined;
562
+ };
563
+ timestamp?: string | null | undefined;
564
+ uncertainty_responses?: {
565
+ verified: boolean;
566
+ uncertainty_index: number;
567
+ finding: string;
568
+ recommendation?: string | null | undefined;
569
+ }[] | null | undefined;
570
+ question_answers?: {
571
+ question_index: number;
572
+ answer: string;
573
+ confidence?: number | null | undefined;
574
+ }[] | null | undefined;
575
+ files_examined?: string[] | null | undefined;
576
+ execution_notes?: string | null | undefined;
577
+ }>;
578
+ export type ReviewOutput = z.infer<typeof ReviewOutput>;
579
+ export declare const PeerScore: z.ZodObject<{
580
+ finding_id: z.ZodString;
581
+ validity: z.ZodEnum<["valid", "questionable", "invalid", "cannot_assess"]>;
582
+ confidence: z.ZodNumber;
583
+ notes: z.ZodOptional<z.ZodString>;
584
+ }, "strip", z.ZodTypeAny, {
585
+ confidence: number;
586
+ finding_id: string;
587
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
588
+ notes?: string | undefined;
589
+ }, {
590
+ confidence: number;
591
+ finding_id: string;
592
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
593
+ notes?: string | undefined;
594
+ }>;
595
+ export type PeerScore = z.infer<typeof PeerScore>;
596
+ export declare const PeerReview: z.ZodObject<{
597
+ reviewer: z.ZodString;
598
+ reviewed_model: z.ZodString;
599
+ scores: z.ZodArray<z.ZodObject<{
600
+ finding_id: z.ZodString;
601
+ validity: z.ZodEnum<["valid", "questionable", "invalid", "cannot_assess"]>;
602
+ confidence: z.ZodNumber;
603
+ notes: z.ZodOptional<z.ZodString>;
604
+ }, "strip", z.ZodTypeAny, {
605
+ confidence: number;
606
+ finding_id: string;
607
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
608
+ notes?: string | undefined;
609
+ }, {
610
+ confidence: number;
611
+ finding_id: string;
612
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
613
+ notes?: string | undefined;
614
+ }>, "many">;
615
+ overall_quality: z.ZodNumber;
616
+ summary: z.ZodOptional<z.ZodString>;
617
+ }, "strip", z.ZodTypeAny, {
618
+ reviewer: string;
619
+ reviewed_model: string;
620
+ scores: {
621
+ confidence: number;
622
+ finding_id: string;
623
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
624
+ notes?: string | undefined;
625
+ }[];
626
+ overall_quality: number;
627
+ summary?: string | undefined;
628
+ }, {
629
+ reviewer: string;
630
+ reviewed_model: string;
631
+ scores: {
632
+ confidence: number;
633
+ finding_id: string;
634
+ validity: "valid" | "questionable" | "invalid" | "cannot_assess";
635
+ notes?: string | undefined;
636
+ }[];
637
+ overall_quality: number;
638
+ summary?: string | undefined;
639
+ }>;
640
+ export type PeerReview = z.infer<typeof PeerReview>;
641
+ /**
642
+ * Generate a simplified JSON schema for embedding in prompts.
643
+ * External CLIs don't support Zod directly, so we provide a JSON schema.
644
+ */
645
+ export declare function getReviewOutputJsonSchema(): object;
646
+ /**
647
+ * Attempt to parse and validate reviewer output.
648
+ * Returns the validated output or null if invalid.
649
+ */
650
+ export declare function parseReviewOutput(rawOutput: string): ReviewOutput | null;
651
+ /**
652
+ * Check if a review output contains substantive content worth returning.
653
+ * Centralizes the "is this review empty?" check that was duplicated in adapters.
654
+ */
655
+ export declare function isSubstantiveReview(output: ReviewOutput): boolean;
656
+ /**
657
+ * Convert legacy markdown format to structured output (best effort).
658
+ * This provides backwards compatibility during transition.
659
+ */
660
+ export declare function parseLegacyMarkdownOutput(markdown: string, reviewer: string): ReviewOutput | null;