audit-tools 0.30.22 → 0.30.24
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/dist/remediate/riskSignal.d.ts +16 -0
- package/dist/remediate/riskSignal.d.ts.map +1 -1
- package/dist/remediate/riskSignal.js +8 -0
- package/dist/remediate/riskSignal.js.map +1 -1
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +10 -0
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.d.ts +8 -0
- package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.js +17 -5
- package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
- package/dist/remediate/steps/leanFastPath.d.ts +20 -0
- package/dist/remediate/steps/leanFastPath.d.ts.map +1 -1
- package/dist/remediate/steps/leanFastPath.js +41 -1
- package/dist/remediate/steps/leanFastPath.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +150 -18
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/steps/types.d.ts +1 -1
- package/dist/remediate/steps/types.d.ts.map +1 -1
- package/dist/remediate/steps/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextStep.d.ts","sourceRoot":"","sources":["../../../src/remediate/steps/nextStep.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EAGV,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6W,KAAK,sBAAsB,EAA8C,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,YAAY,EAA8B,KAAK,qBAAqB,EAA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IAC5C,cAAc,EAAE,OAAO,oCAAoC,CAAC;IAC5D,6EAA6E;IAC7E,WAAW,EAAE,iBAAiB,CAAC;IAC/B;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAsB,kCAAkC,CACtD,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,gBAAgB,GAAG,SAAS,GACvC,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CA6B/C"}
|
|
@@ -20,13 +20,13 @@ import { checkAffectedFileIntegrity } from "../utils/fileIntegrity.js";
|
|
|
20
20
|
import { resolveIntakeStep } from "./intakeResolver.js";
|
|
21
21
|
import { runCommand } from "../utils/commands.js";
|
|
22
22
|
import { buildNextContractPipelineStep, shouldEnterContractPipeline, writePathASeedFromFindings, } from "./contractPipeline.js";
|
|
23
|
-
import { evaluateFastPath, buildLeanExtractedPlan, distinctAffectedFiles, } from "./leanFastPath.js";
|
|
23
|
+
import { evaluateFastPath, buildLeanExtractedPlan, distinctAffectedFiles, interpretLeanLightReviewVerdict, LEAN_LIGHT_REVIEW_SCHEMA_VERSION, } from "./leanFastPath.js";
|
|
24
24
|
import { contractArtifactExists, contractPipelineDir, } from "../contractPipeline/artifactStore.js";
|
|
25
25
|
import { buildReviewRequest, applyReviewResolution, } from "../review/reviewGate.js";
|
|
26
26
|
import { buildAutonomousReviewDecision } from "../review/autonomousGate.js";
|
|
27
27
|
import { runFindingFilterPass } from "../findingFilter.js";
|
|
28
28
|
import { intakePaths, isIntakeReady, readIntakeArtifacts, resolveManifestSources, } from "../intake.js";
|
|
29
|
-
import { ensureIntakeRiskSignal } from "../riskSignal.js";
|
|
29
|
+
import { ensureIntakeRiskSignal, readIntakeRiskSignal, writeIntakeRiskSignal, escalateRiskSignal, } from "../riskSignal.js";
|
|
30
30
|
import { ambiguityReviewPrompt, clarificationPrompt, collectIntakeClarificationsPrompt, collectStartingPointPrompt, loaderCommand, reviewApprovalPrompt, synthesizeIntakePrompt, triagePrompt, } from "./prompts.js";
|
|
31
31
|
export function resolveHostDispatchCapability(options) {
|
|
32
32
|
if (options.hostCanDispatchSubagents !== undefined) {
|
|
@@ -1706,6 +1706,112 @@ async function runReviewApprovalGate(root, artifactsDir, survivors, autonomous =
|
|
|
1706
1706
|
declined,
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
|
+
// ── T1 slice 3b — lean-path light adversarial review gate ───────────────────────
|
|
1710
|
+
//
|
|
1711
|
+
// Mirrors the review-approval gate's emit→resume→consume idiom, but the step is
|
|
1712
|
+
// WORK (status "ready"), not a human decision — so it runs identically in
|
|
1713
|
+
// attended and autonomous modes (the host agent executes the light pass like any
|
|
1714
|
+
// phase). Fires (and at most once) only when the fast path is eligible.
|
|
1715
|
+
function leanLightReviewVerdictPath(artifactsDir) {
|
|
1716
|
+
return join(artifactsDir, "lean_light_review_verdict.json");
|
|
1717
|
+
}
|
|
1718
|
+
function leanLightReviewDecisionPath(artifactsDir) {
|
|
1719
|
+
return join(artifactsDir, "lean_light_review_decision.json");
|
|
1720
|
+
}
|
|
1721
|
+
/** Render the bounded light-adversarial-review prompt over the approved findings. */
|
|
1722
|
+
function leanLightReviewPrompt(approved, verdictPath) {
|
|
1723
|
+
const findingLines = approved
|
|
1724
|
+
.map((f) => {
|
|
1725
|
+
const files = (f.affected_files ?? [])
|
|
1726
|
+
.map((loc) => loc?.path)
|
|
1727
|
+
.filter((p) => Boolean(p))
|
|
1728
|
+
.join(", ");
|
|
1729
|
+
return `- \`${f.id}\` — ${f.title ?? "(untitled)"}${files ? ` (${files})` : ""}`;
|
|
1730
|
+
})
|
|
1731
|
+
.join("\n");
|
|
1732
|
+
const nextCommand = loaderCommand("next-step");
|
|
1733
|
+
return `# Lean fast path — light adversarial review
|
|
1734
|
+
|
|
1735
|
+
These findings cleared the simplicity gate and are headed for the lean fast path (straight to plan→implement, skipping the full contract pipeline). Before they are trusted, do ONE **lightweight adversarial pass** — the floor that replaces the full design loop here. This is proportionate, not an exhaustive counterexample search: remediation legitimately catches upstream audit errors, so nothing skips review entirely.
|
|
1736
|
+
|
|
1737
|
+
## Findings to review
|
|
1738
|
+
${findingLines || "_(none)_"}
|
|
1739
|
+
|
|
1740
|
+
## Your task
|
|
1741
|
+
Adopt a brief adversarial stance and ask, across the set:
|
|
1742
|
+
- Is any finding actually wrong, already-fixed, or not grounded in the cited code?
|
|
1743
|
+
- Would the proposed fix break a caller, an invariant, or an adjacent behavior?
|
|
1744
|
+
- Are any two of these coupled / sharing a file in a way that needs seam reconciliation (i.e. NOT really independent)?
|
|
1745
|
+
- Is anything subtler or more architectural than the simplicity gate assumed?
|
|
1746
|
+
|
|
1747
|
+
Write your verdict to exactly:
|
|
1748
|
+
|
|
1749
|
+
\`${verdictPath}\`
|
|
1750
|
+
|
|
1751
|
+
\`\`\`json
|
|
1752
|
+
{
|
|
1753
|
+
"schema_version": "${LEAN_LIGHT_REVIEW_SCHEMA_VERSION}",
|
|
1754
|
+
"disposition": "clear | escalate",
|
|
1755
|
+
"concerns": ["<required & non-empty when escalate; the concrete concern(s)>"],
|
|
1756
|
+
"created_at": "<ISO-8601>"
|
|
1757
|
+
}
|
|
1758
|
+
\`\`\`
|
|
1759
|
+
|
|
1760
|
+
- **clear** — the light pass surfaced no real concern; the lean path may proceed.
|
|
1761
|
+
- **escalate** — a genuine concern surfaced. This is evidence the change is harder than assessed; the run escalates to the full contract pipeline (full independent review). When in doubt, escalate — a wrong call costs extra pipeline work, never a skipped review.
|
|
1762
|
+
|
|
1763
|
+
After writing the verdict, run:
|
|
1764
|
+
|
|
1765
|
+
\`${nextCommand}\`
|
|
1766
|
+
`;
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* The lean light-review gate. Idempotent across next-step calls: once a decision
|
|
1770
|
+
* is recorded it is consumed directly. Returns a halt step while awaiting the
|
|
1771
|
+
* host's verdict, then `clear` (proceed to the lean plan) or `escalate` (route to
|
|
1772
|
+
* the full pipeline with the concerns).
|
|
1773
|
+
*/
|
|
1774
|
+
async function runLeanLightReviewGate(root, artifactsDir, approved) {
|
|
1775
|
+
const decisionPath = leanLightReviewDecisionPath(artifactsDir);
|
|
1776
|
+
const existing = await readOptionalJsonFile(decisionPath);
|
|
1777
|
+
if (existing) {
|
|
1778
|
+
return existing.disposition === "clear"
|
|
1779
|
+
? { kind: "clear" }
|
|
1780
|
+
: { kind: "escalate", concerns: existing.concerns ?? [] };
|
|
1781
|
+
}
|
|
1782
|
+
const verdictPath = leanLightReviewVerdictPath(artifactsDir);
|
|
1783
|
+
if (!existsSync(verdictPath)) {
|
|
1784
|
+
const step = await writeCurrentStep({
|
|
1785
|
+
stepKind: "lean_light_review",
|
|
1786
|
+
status: "ready",
|
|
1787
|
+
runId: randomRunId("LEANREVIEW"),
|
|
1788
|
+
repoRoot: root,
|
|
1789
|
+
artifactsDir,
|
|
1790
|
+
prompt: leanLightReviewPrompt(approved, verdictPath),
|
|
1791
|
+
allowedCommands: [loaderCommand("next-step")],
|
|
1792
|
+
stopCondition: "Stop after writing the lean light-review verdict and running next-step.",
|
|
1793
|
+
artifactPaths: { lean_light_review_verdict: verdictPath },
|
|
1794
|
+
});
|
|
1795
|
+
return { kind: "halt", step };
|
|
1796
|
+
}
|
|
1797
|
+
// Verdict present → interpret + record a durable decision, then archive the
|
|
1798
|
+
// consumed verdict so the gate can never re-emit.
|
|
1799
|
+
const raw = await readOptionalJsonFile(verdictPath);
|
|
1800
|
+
const interp = interpretLeanLightReviewVerdict(raw);
|
|
1801
|
+
const record = {
|
|
1802
|
+
schema_version: LEAN_LIGHT_REVIEW_SCHEMA_VERSION,
|
|
1803
|
+
disposition: interp.disposition,
|
|
1804
|
+
concerns: interp.concerns,
|
|
1805
|
+
created_at: new Date().toISOString(),
|
|
1806
|
+
};
|
|
1807
|
+
await writeJsonFile(decisionPath, record);
|
|
1808
|
+
if (existsSync(verdictPath)) {
|
|
1809
|
+
await withFsRetry(() => rename(verdictPath, `${verdictPath}.consumed-${Date.now()}`));
|
|
1810
|
+
}
|
|
1811
|
+
return interp.disposition === "clear"
|
|
1812
|
+
? { kind: "clear" }
|
|
1813
|
+
: { kind: "escalate", concerns: interp.concerns };
|
|
1814
|
+
}
|
|
1709
1815
|
/**
|
|
1710
1816
|
* Re-emit the autonomous-run leftovers (findings left LIVE, neither auto-fixed
|
|
1711
1817
|
* nor durably rejected) as a standard, re-consumable audit deliverable pair:
|
|
@@ -1833,25 +1939,51 @@ async function handleReadyIntakeContractPipeline(root, artifactsDir, options) {
|
|
|
1833
1939
|
await persistReviewFilterDispositions(artifactsDir, originals, filter);
|
|
1834
1940
|
// A1 — conservative lean fast path. When the approved set is a handful
|
|
1835
1941
|
// of grounded, high-confidence, localized, non-cross-cutting findings,
|
|
1836
|
-
//
|
|
1837
|
-
// the plan→implement→close machinery (per-node
|
|
1838
|
-
// final whole-repo gate) is the retained safety
|
|
1839
|
-
//
|
|
1840
|
-
//
|
|
1942
|
+
// the run skips the heavy contract DESIGN loop and synthesizes the
|
|
1943
|
+
// extracted plan directly; the plan→implement→close machinery (per-node
|
|
1944
|
+
// verify-before-merge + the final whole-repo gate) is the retained safety
|
|
1945
|
+
// net. Runs only here — on Path A (structured_audit), the only intake
|
|
1946
|
+
// with a pre-existing finding set to judge.
|
|
1947
|
+
//
|
|
1948
|
+
// T1 slice 3b — the fast path is NOT zero-scrutiny: an eligible run first
|
|
1949
|
+
// runs a bounded LIGHT adversarial review over the approved findings (the
|
|
1950
|
+
// floor, never off). A clear verdict proceeds to the lean plan; a verdict
|
|
1951
|
+
// that surfaces a real concern escalates the risk signal (evidence the
|
|
1952
|
+
// work is harder than assessed) and routes to the full pipeline below.
|
|
1841
1953
|
const fast = evaluateFastPath(gate.approved);
|
|
1842
1954
|
if (fast.eligible) {
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
if (
|
|
1848
|
-
|
|
1955
|
+
const review = await runLeanLightReviewGate(root, artifactsDir, gate.approved);
|
|
1956
|
+
if (review.kind === "halt") {
|
|
1957
|
+
return review.step;
|
|
1958
|
+
}
|
|
1959
|
+
if (review.kind === "escalate") {
|
|
1960
|
+
// Escalate-on-evidence: raise the signal to at least `medium` so the
|
|
1961
|
+
// full pipeline's adversarial depth is `full` (see slice 3a), then
|
|
1962
|
+
// fall through to the full pipeline.
|
|
1963
|
+
const current = await readIntakeRiskSignal(artifactsDir);
|
|
1964
|
+
if (current) {
|
|
1965
|
+
await writeIntakeRiskSignal(artifactsDir, escalateRiskSignal(current, {
|
|
1966
|
+
tier: "medium",
|
|
1967
|
+
reason: `lean light review surfaced a concern: ${review.concerns.join("; ")}`,
|
|
1968
|
+
}));
|
|
1969
|
+
}
|
|
1970
|
+
process.stderr.write(`[remediate-code] Lean light review escalated (${review.concerns.join("; ")}); routing to the full contract pipeline.\n`);
|
|
1971
|
+
}
|
|
1972
|
+
else {
|
|
1973
|
+
// Clear verdict → proceed with the lean plan.
|
|
1974
|
+
const leanPlan = buildLeanExtractedPlan(gate.approved, randomRunId("LEAN"));
|
|
1975
|
+
await writeJsonFile(intakePaths(artifactsDir).extractedPlan, leanPlan);
|
|
1976
|
+
process.stderr.write(`[remediate-code] Lean fast path: ${fast.reason}; light review clear. Routing to plan→implement.\n`);
|
|
1977
|
+
const planned = await handlePendingExtractedPlan(root, artifactsDir, { status: "pending" }, leanPlan);
|
|
1978
|
+
if (planned) {
|
|
1979
|
+
return planned;
|
|
1980
|
+
}
|
|
1981
|
+
// Defensive: a deterministically-built lean plan should always
|
|
1982
|
+
// normalize. If it somehow didn't, handlePendingExtractedPlan removed
|
|
1983
|
+
// the file; fall through to the full pipeline (the safety net) rather
|
|
1984
|
+
// than stalling the run.
|
|
1985
|
+
process.stderr.write("[remediate-code] Lean fast-path plan failed to materialize; falling back to the contract pipeline.\n");
|
|
1849
1986
|
}
|
|
1850
|
-
// Defensive: a deterministically-built lean plan should always
|
|
1851
|
-
// normalize. If it somehow didn't, handlePendingExtractedPlan removed
|
|
1852
|
-
// the file; fall through to the full pipeline (the safety net) rather
|
|
1853
|
-
// than stalling the run.
|
|
1854
|
-
process.stderr.write("[remediate-code] Lean fast-path plan failed to materialize; falling back to the contract pipeline.\n");
|
|
1855
1987
|
}
|
|
1856
1988
|
// Seed the pipeline with the approved survivors only. When that set is
|
|
1857
1989
|
// narrower than the originals (anything filtered or declined), route the
|