import { z } from 'zod'; import { type Resolver } from './source-url-validator.js'; import { type FetchImpl } from './source-hash.js'; export type Dispatcher = (prompt: string) => Promise; declare const verdictSchema: z.ZodObject<{ entry_name: z.ZodString; audit_date: z.ZodString; model: z.ZodString; verdict: z.ZodEnum<["current", "minor-drift", "major-drift", "superseded"]>; sources_checked: z.ZodArray, "many">; findings: z.ZodArray; drift_kind: z.ZodString; }, "strip", z.ZodTypeAny, { severity: "P0" | "P1" | "P2" | "P3"; claim_in_entry: string; evidence_url: string; evidence_date: string; source_excerpt: string; drift_kind: string; }, { severity: "P0" | "P1" | "P2" | "P3"; claim_in_entry: string; evidence_url: string; evidence_date: string; source_excerpt: string; drift_kind: string; }>, "many">; proposed_changes: z.ZodArray; rationale: z.ZodString; new_text: z.ZodOptional; }, "strip", z.ZodTypeAny, { kind: "replace" | "delete" | "insert"; location: string; rationale: string; new_text?: string | undefined; }, { kind: "replace" | "delete" | "insert"; location: string; rationale: string; new_text?: string | undefined; }>, "many">; proposed_version_pin: z.ZodOptional>; preserve_warnings: z.ZodArray; source_unverifiable: z.ZodOptional; }, "strip", z.ZodTypeAny, { verdict: "current" | "superseded" | "minor-drift" | "major-drift"; findings: { severity: "P0" | "P1" | "P2" | "P3"; claim_in_entry: string; evidence_url: string; evidence_date: string; source_excerpt: string; drift_kind: string; }[]; model: string; entry_name: string; audit_date: string; sources_checked: { url: string; summary: string; retrieved_at: string; content_hash: string; }[]; proposed_changes: { kind: "replace" | "delete" | "insert"; location: string; rationale: string; new_text?: string | undefined; }[]; preserve_warnings: string[]; proposed_version_pin?: string | null | undefined; source_unverifiable?: boolean | undefined; }, { verdict: "current" | "superseded" | "minor-drift" | "major-drift"; findings: { severity: "P0" | "P1" | "P2" | "P3"; claim_in_entry: string; evidence_url: string; evidence_date: string; source_excerpt: string; drift_kind: string; }[]; model: string; entry_name: string; audit_date: string; sources_checked: { url: string; summary: string; retrieved_at: string; content_hash: string; }[]; proposed_changes: { kind: "replace" | "delete" | "insert"; location: string; rationale: string; new_text?: string | undefined; }[]; preserve_warnings: string[]; proposed_version_pin?: string | null | undefined; source_unverifiable?: boolean | undefined; }>; export type AuditVerdict = z.infer; export interface RunEntryAuditOptions { /** Override the meta-prompt path. Defaults to the bundled `content/tools/knowledge-audit-entry.md`. */ promptPath?: string; /** Override the DNS resolver used for the rebinding guard (round-5 F-001). Default: Node `dns.promises`. */ resolver?: Resolver; /** Override the fetch implementation. Tests inject a mock. Default: undici fetch via fetchAndHash. */ fetchImpl?: FetchImpl; /** * Skip prefetching source bodies. Used only by tests that supply fixture * URLs which aren't expected to resolve (e.g. `https://x`) and don't care * about the prefetched-sources payload. Defaults to running the prefetch. */ skipPrefetch?: boolean; /** * Override "now" for date stamping. Tests pin this for determinism; in * production it defaults to the real current date. See `stampVerdictRunDates`. */ now?: Date; } export declare function runEntryAudit(entryPath: string, dispatch: Dispatcher, opts?: RunEntryAuditOptions): Promise; /** * Replace the LLM-claimed `audit_date` and every `sources_checked[].retrieved_at` * with the harness-measured run date (`ymd`, a UTC YYYY-MM-DD). Other fields — * including each finding's `evidence_date`, which describes the external * evidence rather than our review — are left untouched. * * INVARIANT: `runEntryAudit` prefetches every source in a single pass (see the * prefetch loop above), so all sources share one fetch date and stamping them * with the single run date is accurate. If a future code path ever fetches * sources across day boundaries or reuses cached fetches, switch to stamping * each source with its own captured fetch timestamp instead of one run date. */ export declare function stampVerdictRunDates(verdict: AuditVerdict, ymd: string): AuditVerdict; /** * Make a verdict self-consistent with the spec contract (enforced in * audit-apply.ts; spec §A.4): `current` and `minor-drift` carry findings only, * never edits. A non-conforming * model — observed with DeepSeek, which follows the constraint less strictly * than Claude — can return `proposed_changes` alongside one of those verdicts. * Hard-failing there leaves the entry perpetually "due" and starves the * 10-entry daily audit budget. Instead, demote the changes to advisory * `preserve_warnings` so the verdict applies cleanly and the entry gets * reviewed-stamped. Demoting (not upgrading to major-drift) is deliberate: * upgrading would push unexpected rewrites of stable entries through, bypassing * the MMR-corroboration and anti-over-rewrite gates that major-drift requires. */ export declare function normalizeVerdict(verdict: AuditVerdict): AuditVerdict; export {}; //# sourceMappingURL=audit-runner.d.ts.map