import type { Finding } from "../state/types.js"; export interface AffectedFileGrounding { /** Phantom (non-existent) paths stripped from findings, keyed by finding id. */ phantomPathsByFinding: Map; /** * IDs of findings that cited at least one path and were left with zero real * paths after stripping. Candidates for one bounded repair attempt, then drop. * Findings that never cited a path are NOT here — empty `affected_files` is a * legitimate "discover during documentation" state for extracted findings. */ zeroRealPathFindingIds: string[]; } /** * Strip phantom `affected_files` paths from extracted findings in place. * A path is real when it resolves (relative to `root`) to an existing file or * directory, or when a bare basename uniquely resolves to one tracked path. * Returns what was stripped so the caller can repair, drop, and record — nothing * is silently lost. */ export declare function groundAffectedFiles(root: string, findings: Finding[]): AffectedFileGrounding; /** * True when the evidence string cites at least one real repo path; a cited * line number must also exist in the file (a `path:9999` citation into a * 40-line file is not grounded). A bare basename resolves against the tracked * corpus (INV-B3-3); `corpus` is supplied by the caller so it is enumerated once * per pass, and defaults to a fresh enumeration for standalone callers. */ export declare function evidenceCitesRealPath(root: string, evidence: string, corpus?: ReadonlySet): boolean; export interface EvidenceGrounding { /** IDs of findings with no evidence entry citing a real repo path. */ ungroundedFindingIds: string[]; } /** * Mark each extracted finding `evidence_grounded` and downgrade ungrounded * findings to low confidence in place. Ungrounded findings are flagged for the * downstream judge/risk review — never dropped purely for being ungrounded, * since prose findings can be legitimately high-level. */ export declare function groundEvidence(root: string, findings: Finding[]): EvidenceGrounding; export interface ExtractedFindingGrounding { /** Findings kept after grounding (phantom paths stripped, evidence marked). */ findings: Finding[]; /** Findings dropped because every cited path was phantom (post-repair). */ dropped: { finding: Finding; phantomPaths: string[]; }[]; /** Phantom paths stripped from kept findings, keyed by finding id. */ phantomPathsByFinding: Map; /** IDs of kept findings whose evidence has no real-path citation. */ ungroundedFindingIds: string[]; } export interface GroundExtractedFindingsOptions { root: string; /** * One bounded repair attempt for findings whose cited paths were all * phantom: given the findings and their phantom paths, return corrected * repo-relative paths per finding id (omit a finding to withdraw it). * Mirrors the triage-phase retry-cap discipline — exactly one attempt. */ repairZeroPathFindings?: (requests: { finding: Finding; phantomPaths: string[]; }[]) => Promise>; /** * Set false for findings grounded by construction rather than by path * citation — contract-pipeline-promoted findings carry obligation-reference * evidence and must not be blanket-downgraded for lacking `path:line`. * Path grounding still runs. Defaults to true. */ evidenceGrounding?: boolean; } /** * Full deterministic grounding pass for LLM-extracted findings: strip phantom * paths, give all-phantom findings one bounded repair attempt, drop the * unrepaired, and classify evidence. Mutates kept findings in place and * returns the records the coverage ledger needs. */ export declare function groundExtractedFindings(findings: Finding[], options: GroundExtractedFindingsOptions): Promise; //# sourceMappingURL=grounding.d.ts.map