audit-tools 0.32.58 → 0.32.59

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.
@@ -1,32 +0,0 @@
1
- import type { Finding } from "audit-tools/shared";
2
- /** Source tag stamped on a lean-fast-path extracted plan (distinguishes it from `contract_pipeline`). */
3
- export declare const LEAN_FAST_PATH_SOURCE = "lean_fast_path";
4
- export declare const LEAN_LIGHT_REVIEW_SCHEMA_VERSION: "remediate-code-lean-light-review/v1alpha1";
5
- export type LeanLightReviewDisposition = "clear" | "escalate";
6
- /**
7
- * Interpret a host-written light-review verdict, fail-safe toward escalation:
8
- * any malformed / ambiguous verdict, or an `escalate` with no stated concern,
9
- * routes to the full pipeline. The floor must never silently pass — when in
10
- * doubt, escalate (a wrong call costs extra pipeline work, never skipped review).
11
- */
12
- export declare function interpretLeanLightReviewVerdict(raw: unknown): {
13
- disposition: LeanLightReviewDisposition;
14
- concerns: string[];
15
- };
16
- /** The minimal `extracted-plan.json` shape the lean path emits. */
17
- export interface LeanExtractedPlan {
18
- plan_id: string;
19
- findings: Finding[];
20
- project_type: string;
21
- source: typeof LEAN_FAST_PATH_SOURCE;
22
- candidate_closing_actions: string[];
23
- }
24
- /**
25
- * Build the lean extracted plan from the approved findings. Blocks are
26
- * intentionally omitted: `normalizeExtractedPlan` synthesizes one block per
27
- * finding and `applyPlanPipeline` then merges blocks sharing a file + splits by
28
- * context budget — the same deterministic block derivation the contract pipeline
29
- * feeds into, single-sourced rather than reimplemented here.
30
- */
31
- export declare function buildLeanExtractedPlan(findings: Finding[], planId: string): LeanExtractedPlan;
32
- //# sourceMappingURL=leanFastPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leanFastPath.d.ts","sourceRoot":"","sources":["../../../src/remediate/steps/leanFastPath.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,yGAAyG;AACzG,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAatD,eAAO,MAAM,gCAAgC,EAC3C,2CAAoD,CAAC;AAEvD,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,UAAU,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,OAAO,GAAG;IAC7D,WAAW,EAAE,0BAA0B,CAAC;IACxC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAmCA;AAED,mEAAmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,qBAAqB,CAAC;IACrC,yBAAyB,EAAE,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EAAE,EACnB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAQnB"}
@@ -1,103 +0,0 @@
1
- // The `low`-risk tier's realization: the lean plan builder + the light adversarial
2
- // review floor.
3
- //
4
- // Most remediation runs route through the heavy contract pipeline
5
- // (goal_normalization → … → critic → judge → implementation_dag), which exists to
6
- // reason about DESIGN correctness for complex/coupled changes. That is the right
7
- // machinery for a tangled change — and overkill for a handful of concrete, already-
8
- // grounded fixes.
9
- //
10
- // The decision of WHEN to skip that loop is NOT made here anymore: it is the
11
- // self-scaling risk dial. A run takes the lean path IFF its effective risk tier is
12
- // `low` (`src/remediate/riskSignal.ts` — the intake path/breadth/intent signal folded
13
- // with the finding-level `findingRiskEvidence`). This module owns only the low tier's
14
- // two mechanisms: the light adversarial review floor (`interpretLeanLightReviewVerdict`
15
- // — `adversarialDepthForTier("low") === "light"`) and the lean `extracted-plan.json`
16
- // builder. Folding the old standalone `evaluateFastPath` boolean into the tier killed a
17
- // second classifier that could DISAGREE with the risk signal (a grounded 5-finding batch
18
- // touching `src/shared/quota` was "fast-path eligible" AND risk-tier `high`, and bypassed
19
- // the pipeline anyway).
20
- //
21
- // What the lean path KEEPS (the retained safety net): the produced plan rejoins the
22
- // normal plan→implement→close machinery — deterministic grounding re-pass,
23
- // applyPlanPipeline's block derivation + affected-file hash snapshot (integrity check),
24
- // the implement-phase per-node verify-before-merge, and the tool-owned final whole-repo
25
- // gate. A lean-pathed fix that breaks something fails its verify and routes to triage; it
26
- // never silently lands. What it DROPS: only the adversarial contract DESIGN loop +
27
- // obligation derivation — the work that earns its cost on the coupled/systemic changes the
28
- // tier has already routed away.
29
- //
30
- // Pure + deterministic: no IO, no clock, no randomness. The caller supplies the plan id
31
- // so this stays trivially unit-testable.
32
- import { isRecord } from "audit-tools/shared";
33
- /** Source tag stamped on a lean-fast-path extracted plan (distinguishes it from `contract_pipeline`). */
34
- export const LEAN_FAST_PATH_SOURCE = "lean_fast_path";
35
- // ── T1 slice 3b — lean-path light adversarial review ────────────────────────────
36
- //
37
- // The fast path no longer SKIPS adversarial scrutiny — that would be a
38
- // zero-scrutiny fork, and remediation legitimately catches upstream (audit)
39
- // errors. Instead an eligible run runs ONE bounded LIGHT adversarial pass over
40
- // the approved findings (the floor: light, never off) before the lean plan is
41
- // trusted. A clear verdict proceeds to the lean plan; a verdict that surfaces a
42
- // real concern escalates the run (evidence the change is harder than assessed)
43
- // and routes it to the full contract pipeline. The verdict is a mechanical
44
- // on-disk gate, NOT a "please self-check" instruction the host might ignore.
45
- export const LEAN_LIGHT_REVIEW_SCHEMA_VERSION = "remediate-code-lean-light-review/v1alpha1";
46
- /**
47
- * Interpret a host-written light-review verdict, fail-safe toward escalation:
48
- * any malformed / ambiguous verdict, or an `escalate` with no stated concern,
49
- * routes to the full pipeline. The floor must never silently pass — when in
50
- * doubt, escalate (a wrong call costs extra pipeline work, never skipped review).
51
- */
52
- export function interpretLeanLightReviewVerdict(raw) {
53
- if (!isRecord(raw)) {
54
- return { disposition: "escalate", concerns: ["unreadable light-review verdict"] };
55
- }
56
- // Schema-version gate: a verdict that does not carry the exact expected
57
- // schema_version is not a trustworthy light-review emission (it may be a stale,
58
- // mis-shaped, or wrong-contract artifact). Fail safe toward escalation rather
59
- // than trusting an unversioned `clear`.
60
- if (raw.schema_version !== LEAN_LIGHT_REVIEW_SCHEMA_VERSION) {
61
- return {
62
- disposition: "escalate",
63
- concerns: [
64
- `light-review verdict schema_version must be "${LEAN_LIGHT_REVIEW_SCHEMA_VERSION}"`,
65
- ],
66
- };
67
- }
68
- const concerns = Array.isArray(raw.concerns)
69
- ? raw.concerns.filter((c) => typeof c === "string")
70
- : [];
71
- if (raw.disposition === "clear") {
72
- return { disposition: "clear", concerns: [] };
73
- }
74
- if (raw.disposition === "escalate") {
75
- return {
76
- disposition: "escalate",
77
- concerns: concerns.length > 0
78
- ? concerns
79
- : ["light review escalated without a stated concern"],
80
- };
81
- }
82
- return {
83
- disposition: "escalate",
84
- concerns: ["light-review verdict missing a valid disposition"],
85
- };
86
- }
87
- /**
88
- * Build the lean extracted plan from the approved findings. Blocks are
89
- * intentionally omitted: `normalizeExtractedPlan` synthesizes one block per
90
- * finding and `applyPlanPipeline` then merges blocks sharing a file + splits by
91
- * context budget — the same deterministic block derivation the contract pipeline
92
- * feeds into, single-sourced rather than reimplemented here.
93
- */
94
- export function buildLeanExtractedPlan(findings, planId) {
95
- return {
96
- plan_id: planId,
97
- findings,
98
- project_type: "unknown",
99
- source: LEAN_FAST_PATH_SOURCE,
100
- candidate_closing_actions: ["none"],
101
- };
102
- }
103
- //# sourceMappingURL=leanFastPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leanFastPath.js","sourceRoot":"","sources":["../../../src/remediate/steps/leanFastPath.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,gBAAgB;AAChB,EAAE;AACF,kEAAkE;AAClE,kFAAkF;AAClF,iFAAiF;AACjF,oFAAoF;AACpF,kBAAkB;AAClB,EAAE;AACF,6EAA6E;AAC7E,mFAAmF;AACnF,sFAAsF;AACtF,sFAAsF;AACt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