import type { LLMProvider } from '../runtime/types.js'; import type { ClaimVerdict } from './types.js'; import type { FindingSeverity } from './finding-verify.js'; /** The finding the patch claims to remediate. Same shape family as ExternalFinding. */ export interface PatchFinding { id: string; ruleId?: string; cwe?: string; owasp?: string; severity: FindingSeverity; title: string; /** The vulnerability claim: description + impact, verbatim. */ assertion: string; /** The scanner's suggested remediation guidance, if any. */ remediation?: string; evidence: Array<{ file: string; line: number; snippet: string; context?: string; }>; } export interface PatchVerifyRequest { /** Provenance; future sources get their own literal. */ source: 'shipsafe-suggest-fix'; finding: PatchFinding; /** The ORIGINAL (pre-patch) content of the file the finding lives in. */ file: { path: string; content: string; }; /** The candidate fix as a unified diff. */ patch: string; language?: string; budget?: { maxCostUsd?: number; }; } export type PatchVerdict = 'verified' | 'failed' | 'unverifiable'; export interface PatchClaimResult { claimId: string; category: 'remediation' | 'correctness' | 'security' | 'error-handling' | 'edge-case'; severity: 'critical' | 'high' | 'medium' | 'low'; description: string; verdict: ClaimVerdict; reasoning: string; method: 'formal' | 'llm'; /** Patched-file lines the claim cites (audit claims only). */ lines?: number[]; } export interface PatchVerifyResponse { verdict: PatchVerdict; claims: PatchClaimResult[]; stats: { formal: number; llm: number; durationMs: number; costUsd: number; /** Audit claims discarded for citing only code the diff never touched. */ outOfScopeDropped?: number; }; /** Only when verdict === 'unverifiable'. */ unverifiableReason?: string; } interface Hunk { oldLines: string[]; newLines: string[]; } export declare function parseUnifiedDiff(patch: string): Hunk[]; /** 1-based inclusive line range in the PATCHED file that a hunk rewrote. */ export type ChangedRange = { start: number; end: number; }; export type ApplyResult = { ok: true; content: string; changedRanges: ChangedRange[]; } | { ok: false; reason: string; }; export declare function applyUnifiedDiff(content: string, patch: string): ApplyResult; export interface PatchVerifyDeps { /** Injectable for tests; defaults to the configured Assay provider. */ provider?: LLMProvider; model?: string; } export declare function verifyPatch(request: PatchVerifyRequest, deps?: PatchVerifyDeps): Promise; export {};