/**
 * Audit retention + size-pressure valve (Phase 8a).
 *
 * `logAudit()` inserts a defence_audit row on EVERY pipeline run (including
 * per-tool-response scans) and nothing ever deletes them — the table grows
 * forever. The DB has a 100MB hard limit (init.ts MAX_DB_SIZE) that BLOCKS all
 * writes once exceeded, and consolidation/vacuum can't shrink audit rows that
 * are never deleted, so a busy agent bricks its own memory store with no
 * recovery path.
 *
 * Retention alone would break lifetime stats: getLifetimeStats() scans the
 * whole defence_audit table, so deleting old rows would make every lifetime
 * total silently undercount after a purge. So retention is COUPLED with an
 * aggregate rollup — before deleting, the to-be-deleted rows' stat
 * contributions are folded into the single-row `audit_aggregates` table, and
 * getLifetimeStats() returns `aggregate + scan(remaining)`. Totals never regress.
 */
/** Default age-based retention window. */
export declare const DEFAULT_RETENTION_DAYS = 90;
/**
 * Hard ceiling on live defence_audit rows under size pressure. When the DB file
 * crosses the warning threshold, the valve trims the oldest rows down to (at
 * most) this many so audit growth can't carry the file to the 100MB block.
 */
export declare const AUDIT_PRESSURE_ROW_CAP = 100000;
/**
 * Age-based retention: roll the contributions of rows older than the cutoff into
 * audit_aggregates, then DELETE them. Aggregate + delete run in one transaction
 * so a crash can't drop rows without first banking their stats (which would make
 * lifetime totals regress). Returns the number of rows deleted.
 */
export declare function purgeOldAuditEntries(retentionDays?: number): number;
/**
 * Size-pressure valve. Cheap to call: it first checks the DB file size and bails
 * unless the file has crossed the warning threshold (reusing the codebase's
 * existing 50MB WARN_DB_SIZE via checkDatabaseSize(), so we don't keep a second
 * copy of the threshold). When over pressure, it trims the OLDEST audit rows
 * down to a row cap — same aggregate-then-delete path as age retention — so
 * audit growth can never carry the DB to the 100MB block.
 *
 * Thresholds are injectable for tests. Simulating a real 50MB file (and, on a
 * `:memory:` DB, ANY measurable file size) is impractical, so passing
 * `warnBytes` BYPASSES the file-size gate entirely and drives the row-cap trim
 * directly; `maxRows` sets the cap. In production neither is passed and the gate
 * uses the live file size vs WARN_DB_SIZE.
 */
export declare function purgeAuditUnderSizePressure(options?: {
    warnBytes?: number;
    maxRows?: number;
}): number;
