export type EntityAuditRunStatus = 'running' | 'complete' | 'failed' | 'timeout'; export interface EntityAuditQueueAdapter { prepare(sql: string): { run: (...params: unknown[]) => { changes: number; lastInsertRowid: number | bigint; }; get: (...params: unknown[]) => unknown; all: (...params: unknown[]) => unknown[]; }; } export interface EntityAuditRunSpec { reason?: string; baseline_run_id?: string | null; } export interface EntityAuditRunRow { id: string; status: EntityAuditRunStatus; baseline_run_id: string | null; classification: 'improved' | 'stable' | 'regressed' | 'inconclusive' | null; metric_summary_json: string | null; reason: string | null; created_at: number; completed_at: number | null; } export interface EntityAuditQueueOptions { adapter: EntityAuditQueueAdapter; timeBudgetMs?: number; now?: () => number; } export declare const DEFAULT_AUDIT_TIME_BUDGET_MS: number; export declare class AuditRunInProgressError extends Error { readonly code = "entity.audit_run_in_progress"; readonly doc_section = "#audit-run-in-progress"; constructor(); toErrorEnvelope(): { error: { code: string; message: string; hint: string; doc_url: string; }; }; } export declare class EntityAuditRunQueue { private readonly adapter; private readonly timeBudgetMs; private readonly now; constructor(opts: EntityAuditQueueOptions); /** * Insert a fresh `running` audit run. A second concurrent insert fails loudly * via the migration 028 partial unique index and is surfaced as * AuditRunInProgressError by this method. */ enqueue(spec?: EntityAuditRunSpec): { run_id: string; created_at: number; }; getStatus(runId: string): EntityAuditRunRow | null; list(limit?: number): EntityAuditRunRow[]; complete(runId: string, result: { classification: 'improved' | 'stable' | 'regressed' | 'inconclusive'; metric_summary: unknown; }): void; fail(runId: string, reason: string): void; markTimeout(runId: string, reason?: string): void; /** * Called on boot. Any runs in `running` status survived a crash/restart and * must be marked failed so the partial unique index does not remain held. */ recoverOrphans(reason?: string): number; getTimeBudgetMs(): number; } //# sourceMappingURL=entity-audit-queue.d.ts.map