@fro.bot/systematic 3.17.0 → 3.18.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.
- package/HARNESSES.md +26 -0
- package/dist/ce-review-validator.d.ts +23 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +438 -30
- package/dist/{index-y33enbkc.js → index-v8y6h7y4.js} +577 -368
- package/dist/index.js +1 -1
- package/dist/lib/review-artifact-schema.d.ts +171 -1
- package/dist/lib/review-return-validator.d.ts +59 -0
- package/dist/pi.js +576 -367
- package/package.json +9 -7
- package/skills/ce-review/SKILL.md +72 -36
- package/skills/ce-review/references/findings-schema.json +271 -192
- package/skills/ce-review/references/persona-catalog.md +39 -25
- package/skills/ce-review/references/review-output-template.md +3 -3
- package/skills/ce-review/references/review-summary-schema.json +7 -1
- package/skills/ce-review/references/subagent-template.md +8 -2
- package/skills/ce-review/references/synthesis-artifact-contract.md +96 -11
- package/skills/ce-review/scripts/validate-review.mjs +7187 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const REVIEW_ARTIFACT_CUSTOM_MESSAGES: readonly ['severity count must match rejected finding count', 'filtered findings require a validation reason', 'risk-critical dispatches require a non-empty selection surface', 'satisfied risk coverage requires a citing input finding ID', 'unsatisfied risk coverage must not cite an input finding ID', 'passed validation must not include a reason; non-passed validation requires a reason'];
|
|
2
|
+
export declare const REVIEW_ARTIFACT_CUSTOM_MESSAGES: readonly ['severity count must match rejected finding count', 'filtered findings require a validation reason', 'risk-critical dispatches require a non-empty selection surface', 'satisfied risk coverage requires a citing input finding ID', 'unsatisfied risk coverage must not cite an input finding ID', 'passed validation must not include a reason; non-passed validation requires a reason', 'validation_unavailable dispatches must record zero input findings', 'a completed run must not contain validation_unavailable evidence', 'a validation_unavailable persona must not have an input finding', 'every synthesized input finding ID must resolve to an admitted ledger row', 'every provenance submitter must be represented by a cited admitted ledger row', 'satisfied risk coverage must cite an admitted ledger row', 'duplicate admitted input finding IDs are not allowed', 'every cited admitted reviewer must appear in provenance.submitters', 'provenance.submitters must not contain duplicate reviewers', 'provenance.agreement_credit must not contain duplicate reviewers', 'provenance.agreement_credit must not overlap provenance.submitters', 'provenance.agreement_credit requires an eligible returned persona with admitted evidence', 'satisfied risk coverage must cite a validated finding on the lost persona selection surface', 'satisfied risk coverage must cite an admitted ledger row owned by another persona'];
|
|
3
3
|
export declare const DispatchOutcomeSchema: z.ZodEnum<{
|
|
4
4
|
empty: "empty";
|
|
5
5
|
findings: "findings";
|
|
6
6
|
malformed: "malformed";
|
|
7
7
|
never_returned: "never_returned";
|
|
8
|
+
validation_unavailable: "validation_unavailable";
|
|
8
9
|
}>;
|
|
9
10
|
export declare const DispositionSchema: z.ZodEnum<{
|
|
10
11
|
filtered: "filtered";
|
|
@@ -131,6 +132,7 @@ export declare const ReviewArtifactSchema: z.ZodObject<{
|
|
|
131
132
|
findings: "findings";
|
|
132
133
|
malformed: "malformed";
|
|
133
134
|
never_returned: "never_returned";
|
|
135
|
+
validation_unavailable: "validation_unavailable";
|
|
134
136
|
}>;
|
|
135
137
|
input_finding_count: z.ZodNumber;
|
|
136
138
|
rejection_reason: z.ZodOptional<z.ZodString>;
|
|
@@ -266,4 +268,172 @@ export declare const ReviewArtifactSchema: z.ZodObject<{
|
|
|
266
268
|
}, z.core.$strict>>;
|
|
267
269
|
}, z.core.$strict>;
|
|
268
270
|
export type ReviewArtifact = z.infer<typeof ReviewArtifactSchema>;
|
|
271
|
+
/** A single finding as returned by a reviewer persona. */
|
|
272
|
+
export declare const SubAgentFindingSchema: z.ZodObject<{
|
|
273
|
+
title: z.ZodString;
|
|
274
|
+
severity: z.ZodEnum<{
|
|
275
|
+
P0: "P0";
|
|
276
|
+
P1: "P1";
|
|
277
|
+
P2: "P2";
|
|
278
|
+
P3: "P3";
|
|
279
|
+
}>;
|
|
280
|
+
file: z.ZodString;
|
|
281
|
+
line: z.ZodNumber;
|
|
282
|
+
why_it_matters: z.ZodString;
|
|
283
|
+
autofix_class: z.ZodEnum<{
|
|
284
|
+
advisory: "advisory";
|
|
285
|
+
gated_auto: "gated_auto";
|
|
286
|
+
manual: "manual";
|
|
287
|
+
safe_auto: "safe_auto";
|
|
288
|
+
}>;
|
|
289
|
+
owner: z.ZodEnum<{
|
|
290
|
+
"downstream-resolver": "downstream-resolver";
|
|
291
|
+
human: "human";
|
|
292
|
+
release: "release";
|
|
293
|
+
"review-fixer": "review-fixer";
|
|
294
|
+
}>;
|
|
295
|
+
requires_verification: z.ZodBoolean;
|
|
296
|
+
suggested_fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
297
|
+
confidence: z.ZodNumber;
|
|
298
|
+
evidence: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
299
|
+
overflow: z.ZodLiteral<true>;
|
|
300
|
+
excerpt: z.ZodString;
|
|
301
|
+
}, z.core.$strict>]>>;
|
|
302
|
+
pre_existing: z.ZodBoolean;
|
|
303
|
+
}, z.core.$strict>;
|
|
304
|
+
/** A finding after the parent adds its disposition; parent-owned. */
|
|
305
|
+
export declare const ParentFindingSchema: z.ZodObject<{
|
|
306
|
+
title: z.ZodString;
|
|
307
|
+
severity: z.ZodEnum<{
|
|
308
|
+
P0: "P0";
|
|
309
|
+
P1: "P1";
|
|
310
|
+
P2: "P2";
|
|
311
|
+
P3: "P3";
|
|
312
|
+
}>;
|
|
313
|
+
file: z.ZodString;
|
|
314
|
+
line: z.ZodNumber;
|
|
315
|
+
why_it_matters: z.ZodString;
|
|
316
|
+
autofix_class: z.ZodEnum<{
|
|
317
|
+
advisory: "advisory";
|
|
318
|
+
gated_auto: "gated_auto";
|
|
319
|
+
manual: "manual";
|
|
320
|
+
safe_auto: "safe_auto";
|
|
321
|
+
}>;
|
|
322
|
+
owner: z.ZodEnum<{
|
|
323
|
+
"downstream-resolver": "downstream-resolver";
|
|
324
|
+
human: "human";
|
|
325
|
+
release: "release";
|
|
326
|
+
"review-fixer": "review-fixer";
|
|
327
|
+
}>;
|
|
328
|
+
requires_verification: z.ZodBoolean;
|
|
329
|
+
suggested_fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
330
|
+
confidence: z.ZodNumber;
|
|
331
|
+
evidence: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
332
|
+
overflow: z.ZodLiteral<true>;
|
|
333
|
+
excerpt: z.ZodString;
|
|
334
|
+
}, z.core.$strict>]>>;
|
|
335
|
+
pre_existing: z.ZodBoolean;
|
|
336
|
+
disposition: z.ZodEnum<{
|
|
337
|
+
filtered: "filtered";
|
|
338
|
+
merged: "merged";
|
|
339
|
+
rejected: "rejected";
|
|
340
|
+
suppressed: "suppressed";
|
|
341
|
+
surviving: "surviving";
|
|
342
|
+
}>;
|
|
343
|
+
}, z.core.$strict>;
|
|
344
|
+
/** The raw return contract a reviewer persona must satisfy. */
|
|
345
|
+
export declare const SubAgentReturnSchema: z.ZodObject<{
|
|
346
|
+
reviewer: z.ZodString;
|
|
347
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
348
|
+
title: z.ZodString;
|
|
349
|
+
severity: z.ZodEnum<{
|
|
350
|
+
P0: "P0";
|
|
351
|
+
P1: "P1";
|
|
352
|
+
P2: "P2";
|
|
353
|
+
P3: "P3";
|
|
354
|
+
}>;
|
|
355
|
+
file: z.ZodString;
|
|
356
|
+
line: z.ZodNumber;
|
|
357
|
+
why_it_matters: z.ZodString;
|
|
358
|
+
autofix_class: z.ZodEnum<{
|
|
359
|
+
advisory: "advisory";
|
|
360
|
+
gated_auto: "gated_auto";
|
|
361
|
+
manual: "manual";
|
|
362
|
+
safe_auto: "safe_auto";
|
|
363
|
+
}>;
|
|
364
|
+
owner: z.ZodEnum<{
|
|
365
|
+
"downstream-resolver": "downstream-resolver";
|
|
366
|
+
human: "human";
|
|
367
|
+
release: "release";
|
|
368
|
+
"review-fixer": "review-fixer";
|
|
369
|
+
}>;
|
|
370
|
+
requires_verification: z.ZodBoolean;
|
|
371
|
+
suggested_fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
372
|
+
confidence: z.ZodNumber;
|
|
373
|
+
evidence: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
374
|
+
overflow: z.ZodLiteral<true>;
|
|
375
|
+
excerpt: z.ZodString;
|
|
376
|
+
}, z.core.$strict>]>>;
|
|
377
|
+
pre_existing: z.ZodBoolean;
|
|
378
|
+
}, z.core.$strict>>;
|
|
379
|
+
residual_risks: z.ZodArray<z.ZodString>;
|
|
380
|
+
testing_gaps: z.ZodArray<z.ZodString>;
|
|
381
|
+
}, z.core.$strict>;
|
|
382
|
+
/** The parent-persisted record contract; adds harness and dispatch outcome. */
|
|
383
|
+
export declare const ParentRecordSchema: z.ZodObject<{
|
|
384
|
+
reviewer: z.ZodString;
|
|
385
|
+
harness: z.ZodEnum<{
|
|
386
|
+
"claude-code": "claude-code";
|
|
387
|
+
opencode: "opencode";
|
|
388
|
+
pi: "pi";
|
|
389
|
+
}>;
|
|
390
|
+
dispatch_outcome: z.ZodEnum<{
|
|
391
|
+
empty: "empty";
|
|
392
|
+
findings: "findings";
|
|
393
|
+
malformed: "malformed";
|
|
394
|
+
never_returned: "never_returned";
|
|
395
|
+
validation_unavailable: "validation_unavailable";
|
|
396
|
+
}>;
|
|
397
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
398
|
+
title: z.ZodString;
|
|
399
|
+
severity: z.ZodEnum<{
|
|
400
|
+
P0: "P0";
|
|
401
|
+
P1: "P1";
|
|
402
|
+
P2: "P2";
|
|
403
|
+
P3: "P3";
|
|
404
|
+
}>;
|
|
405
|
+
file: z.ZodString;
|
|
406
|
+
line: z.ZodNumber;
|
|
407
|
+
why_it_matters: z.ZodString;
|
|
408
|
+
autofix_class: z.ZodEnum<{
|
|
409
|
+
advisory: "advisory";
|
|
410
|
+
gated_auto: "gated_auto";
|
|
411
|
+
manual: "manual";
|
|
412
|
+
safe_auto: "safe_auto";
|
|
413
|
+
}>;
|
|
414
|
+
owner: z.ZodEnum<{
|
|
415
|
+
"downstream-resolver": "downstream-resolver";
|
|
416
|
+
human: "human";
|
|
417
|
+
release: "release";
|
|
418
|
+
"review-fixer": "review-fixer";
|
|
419
|
+
}>;
|
|
420
|
+
requires_verification: z.ZodBoolean;
|
|
421
|
+
suggested_fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
422
|
+
confidence: z.ZodNumber;
|
|
423
|
+
evidence: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
424
|
+
overflow: z.ZodLiteral<true>;
|
|
425
|
+
excerpt: z.ZodString;
|
|
426
|
+
}, z.core.$strict>]>>;
|
|
427
|
+
pre_existing: z.ZodBoolean;
|
|
428
|
+
disposition: z.ZodEnum<{
|
|
429
|
+
filtered: "filtered";
|
|
430
|
+
merged: "merged";
|
|
431
|
+
rejected: "rejected";
|
|
432
|
+
suppressed: "suppressed";
|
|
433
|
+
surviving: "surviving";
|
|
434
|
+
}>;
|
|
435
|
+
}, z.core.$strict>>;
|
|
436
|
+
residual_risks: z.ZodArray<z.ZodString>;
|
|
437
|
+
testing_gaps: z.ZodArray<z.ZodString>;
|
|
438
|
+
}, z.core.$strict>;
|
|
269
439
|
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded, no-write structural validator for a single raw `ce:review` persona
|
|
3
|
+
* return read from stdin.
|
|
4
|
+
*
|
|
5
|
+
* The runner is deliberately synchronous to match `runLegacyCli`'s shape and to
|
|
6
|
+
* avoid a temp-file or async stdin dance. Behavior is injectable (argv, fd,
|
|
7
|
+
* TTY, chunk reader, sinks) so tests can exercise real code paths without
|
|
8
|
+
* mutating global state.
|
|
9
|
+
*/
|
|
10
|
+
export declare const VALIDATE_REVIEW_RETURN_USAGE = "Usage: systematic validate-review-return";
|
|
11
|
+
/** Input cap in bytes. Reads stop at {@link MAX_REVIEW_RETURN_BYTES} plus one. */
|
|
12
|
+
export declare const MAX_REVIEW_RETURN_BYTES: number;
|
|
13
|
+
/** Maximum number of projected issue lines emitted before the summary. */
|
|
14
|
+
export declare const MAX_PROJECTED_ISSUE_LINES = 8;
|
|
15
|
+
export declare const REVIEW_RETURN_VALID_MESSAGE = "Review return is valid";
|
|
16
|
+
export declare const REVIEW_RETURN_EMPTY_MESSAGE = "Review return is empty";
|
|
17
|
+
export declare const REVIEW_RETURN_INVALID_UTF8_MESSAGE = "Review return is not valid UTF-8";
|
|
18
|
+
export declare const REVIEW_RETURN_MALFORMED_JSON_MESSAGE = "Review return is not valid JSON";
|
|
19
|
+
export declare const REVIEW_RETURN_OVERSIZED_MESSAGE = "Review return exceeds the 1 MiB input limit";
|
|
20
|
+
export declare const REVIEW_RETURN_READ_FAILED_MESSAGE = "Review return could not be read from stdin";
|
|
21
|
+
export declare const REVIEW_RETURN_TTY_MESSAGE = "validate-review-return reads one JSON document from stdin; interactive input is not supported";
|
|
22
|
+
/** One bounded, payload-safe projected validation issue. */
|
|
23
|
+
export interface ReviewReturnIssue {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly code: string;
|
|
26
|
+
}
|
|
27
|
+
export type ReviewReturnValidation = {
|
|
28
|
+
readonly ok: true;
|
|
29
|
+
} | {
|
|
30
|
+
readonly ok: false;
|
|
31
|
+
/** Full issue count, even when {@link ReviewReturnValidation.issues} is capped. */
|
|
32
|
+
readonly total: number;
|
|
33
|
+
readonly issues: readonly ReviewReturnIssue[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Pure value-validation seam. Projects only safe Zod path segments and issue
|
|
37
|
+
* codes; never issue messages, unrecognized key names, or payload values.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateReviewReturnValue(value: unknown): ReviewReturnValidation;
|
|
40
|
+
export declare function formatReviewReturnValidationFailure(total: number): string;
|
|
41
|
+
export type ReadChunk = (fd: number, buffer: Buffer, offset: number, length: number, position: number | null) => number;
|
|
42
|
+
export interface ReviewReturnValidatorOptions {
|
|
43
|
+
readonly argv: readonly string[];
|
|
44
|
+
readonly fd?: number;
|
|
45
|
+
readonly isTTY?: boolean;
|
|
46
|
+
readonly readChunk?: ReadChunk;
|
|
47
|
+
readonly outputSink?: (message: string) => void;
|
|
48
|
+
readonly errorSink?: (message: string) => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate exactly one raw persona return from stdin.
|
|
52
|
+
*
|
|
53
|
+
* Exit statuses:
|
|
54
|
+
* - 0: a schema-valid `SubAgentReturnSchema` document.
|
|
55
|
+
* - 1: the returned input was empty, oversized, invalid UTF-8, malformed JSON,
|
|
56
|
+
* carried trailing data, or failed the schema.
|
|
57
|
+
* - 2: the check did not run (usage, TTY, or stdin read failure).
|
|
58
|
+
*/
|
|
59
|
+
export declare function runReviewReturnValidator(options: ReviewReturnValidatorOptions): number;
|