export declare const STATE_SCHEMA_VERSION = 2; export type RenderMode = "static" | "rendered"; /** * Permissive snapshot of a finding stored in state for carry-forward across * delta runs. The canonical Finding type lives in types.ts; state intentionally * accepts a wider shape so we can persist whatever fields the engine emitted at * audit time without coupling state IO to the rule-result schema. */ export interface Finding { id: string; ruleId: string; severity: string; confidence: string; message: string; url?: string; [key: string]: unknown; } export interface UrlStateEntry { contentHash: string; fetchedAt: string; status: number; /** Kept for back-compat within v2; derived from `findings`. */ findingIds: string[]; /** Full finding records persisted so unchanged URLs can carry findings forward. */ findings: Finding[]; /** Ruleset signature at the time this URL was last fetched. */ rulesetVersion: string; /** HTTP `Last-Modified` response header captured at fetch. */ lastModified?: string; /** HTTP `ETag` response header captured at fetch. */ etag?: string; /** Sitemap `` value associated with this URL at the audit. */ sitemapLastmodAtAudit?: string; gscMetricsAtLastRun?: { impressions: number; clicks: number; period: string; }; } export interface RunState { version: number; lastRun: string; /** ISO timestamp of the last full (non-delta) audit. */ lastFullAuditAt: string; source: string; renderMode: RenderMode; /** Ruleset signature at the time this state file was written. */ rulesetVersion: string; urls: Record; summary: { score: number; totalFindings: number; byCategory: Record; }; } /** * Normalize HTML so content hashing is stable across irrelevant diffs. * * Strips: HTML comments, script bodies, style bodies, whitespace runs. * * Known limitations (use as "likely-unchanged" signal, not proof): * - Attribute order changes are NOT normalized (regex parser, not DOM) * - Inline event handlers and `data-*` attributes with dynamic values * (nonces, CSRF tokens) will produce different hashes */ export declare function normalizeHtmlForHash(html: string): string; export declare function computeContentHash(html: string): string; export declare function readState(path: string): Promise; export declare function writeState(path: string, state: RunState): Promise; //# sourceMappingURL=state.d.ts.map