/**
 * SQLite backup via VACUUM INTO with snapshot rotation.
 *
 * Produces self-contained, WAL-free copies of CLEO SQLite databases
 * (tasks.db, brain.db, conduit.db at project tier; nexus.db, signaldock.db at
 * global tier) into `.cleo/backups/sqlite/` (project) or
 * `$XDG_DATA_HOME/cleo/backups/sqlite/` (global) with a configurable rotation
 * limit. Also provides raw-file backup for the global-salt binary (not SQLite).
 * All errors are swallowed — backup failure must never interrupt normal operation.
 *
 * @task T4873
 * @task T5158 — extended to cover brain.db
 * @task T306  — extended to cover global-tier nexus.db (epic T299)
 * @task T369  — extended to cover conduit.db (project), signaldock.db (global),
 *               and global-salt raw-file backup (epic T310)
 * @epic T4867
 */
/** Options accepted by {@link vacuumIntoBackup} and {@link vacuumIntoBackupAll}. */
export interface VacuumOptions {
    /**
     * Working directory used to resolve the project-local `.cleo/backups/sqlite/`
     * directory. Defaults to `process.cwd()` (delegated to {@link getCleoDir}).
     */
    cwd?: string;
    /** When true, bypass the {@link DEBOUNCE_MS} debounce window. */
    force?: boolean;
}
/**
 * Create a VACUUM INTO snapshot of the primary SQLite database (tasks.db).
 *
 * Debounced by default (30s). Pass `force: true` to bypass debounce. This
 * function is retained for backward compatibility with existing call sites
 * in `data-safety.ts` / `data-safety-central.ts` that only snapshot tasks.db.
 *
 * Prefer {@link vacuumIntoBackupAll} for new code — it snapshots every
 * registered database (currently tasks.db + brain.db) and shares the same
 * debounce + rotation guarantees.
 *
 * Non-fatal: all errors are swallowed — backup failure must never
 * interrupt normal operation.
 */
export declare function vacuumIntoBackup(opts?: VacuumOptions): Promise<void>;
/**
 * Create VACUUM INTO snapshots of all registered CLEO SQLite databases
 * (currently tasks.db + brain.db). Each database is debounced independently.
 *
 * This is the preferred entry point for session-lifecycle hooks and
 * pre-destructive-operation snapshots — it guarantees that BRAIN memory is
 * snapshotted alongside task state.
 *
 * Non-fatal: errors are swallowed per database so a brain.db failure cannot
 * block a tasks.db snapshot (and vice versa).
 */
export declare function vacuumIntoBackupAll(opts?: VacuumOptions): Promise<void>;
/**
 * List existing tasks.db snapshots (newest first).
 *
 * Retained for backward compatibility. For new code prefer
 * {@link listSqliteBackupsAll}.
 */
export declare function listSqliteBackups(cwd?: string): Array<{
    name: string;
    path: string;
    mtimeMs: number;
}>;
/**
 * List existing brain.db snapshots (newest first).
 */
export declare function listBrainBackups(cwd?: string): Array<{
    name: string;
    path: string;
    mtimeMs: number;
}>;
/**
 * Aggregated listing of all registered SQLite snapshots.
 *
 * Returns an object keyed by snapshot prefix (`tasks`, `brain`) where each
 * value is the per-prefix list sorted newest-first. Missing prefixes are
 * represented as empty arrays.
 */
export declare function listSqliteBackupsAll(cwd?: string): Record<string, Array<{
    name: string;
    path: string;
    mtimeMs: number;
}>>;
/**
 * Backup scope: project (per-project `.cleo/`) or global (`$XDG_DATA_HOME/cleo/`).
 *
 * @task T306
 * @epic T299
 */
export type BackupScope = 'project' | 'global';
/**
 * Snapshot a global-tier SQLite database via VACUUM INTO.
 *
 * Writes to `$XDG_DATA_HOME/cleo/backups/sqlite/<dbName>-YYYYMMDD-HHmmss.db`
 * and enforces a per-prefix rotation window (default 10 snapshots).
 *
 * Non-fatal: errors from any individual step are surfaced via the return value
 * but never thrown — a failed snapshot MUST NOT interrupt normal operation.
 *
 * @param dbName         - Which global-tier DB to snapshot (`'nexus'` or `'signaldock'`)
 * @param opts.rotation  - Maximum retained snapshots per prefix (default 10)
 * @param opts.cleoHomeOverride - Override `getCleoHome()` path (use in tests to target a tmp dir)
 * @returns Object containing the new snapshot path and any rotated (deleted) file paths
 *
 * @task T306
 * @task T369 — activated signaldock target (epic T310)
 * @epic T299
 * @why ADR-036 §Backup Mechanism requires VACUUM INTO rotation at the global tier;
 *      nexus.db has zero backup coverage prior to v2026.4.11.
 */
export declare function vacuumIntoGlobalBackup(dbName: 'nexus' | 'signaldock', opts?: {
    rotation?: number;
    cleoHomeOverride?: string;
}): Promise<{
    snapshotPath: string;
    rotated: string[];
}>;
/**
 * A single entry returned by {@link listGlobalSqliteBackups}.
 *
 * @task T306
 * @epic T299
 */
export interface GlobalBackupEntry {
    /** Snapshot filename, e.g. `nexus-20260408-143022.db`. */
    name: string;
    /** Absolute path to the snapshot file. */
    path: string;
    /** File size in bytes. */
    size: number;
    /** Last-modified timestamp. */
    mtime: Date;
}
/**
 * List global-tier SQLite backups from `$XDG_DATA_HOME/cleo/backups/sqlite/`,
 * optionally filtered by prefix (e.g. `'nexus'`). Sorted newest-first by mtime.
 *
 * Returns an empty array when the backup directory does not exist.
 *
 * @param prefix            - Optional prefix filter; when omitted all `.db` snapshot files are listed
 * @param cleoHomeOverride  - Override `getCleoHome()` path (use in tests to target a tmp dir)
 *
 * @task T306
 * @epic T299
 */
export declare function listGlobalSqliteBackups(prefix?: string, cleoHomeOverride?: string): GlobalBackupEntry[];
/**
 * Creates a raw-file backup of the global-salt binary at
 * `${getCleoHome()}/backups/global-salt-YYYYMMDD-HHmmss` with `0o600`
 * permissions. Rotates to {@link MAX_SNAPSHOTS} (10) copies, deleting the
 * oldest when the limit is reached.
 *
 * Non-fatal: errors are swallowed — salt backup failure must never block cleo.
 * Returns empty strings and no rotated paths on failure.
 *
 * @param opts.cleoHomeOverride - Override `getCleoHome()` path (use in tests to target a tmp dir)
 * @returns Object with the new snapshot path and any rotated (deleted) file paths
 *
 * @task T369
 * @epic T310
 * @why ADR-037 §5 — global-salt is security-critical; losing it invalidates
 *      all API keys. Backup enables recovery from accidental deletion.
 */
export declare function backupGlobalSalt(opts?: {
    cleoHomeOverride?: string;
}): Promise<{
    snapshotPath: string;
    rotated: string[];
}>;
/**
 * A single entry returned by {@link listGlobalSaltBackups}.
 *
 * @task T369
 * @epic T310
 */
export interface GlobalSaltBackupEntry {
    /** Backup filename, e.g. `global-salt-20260408-143022`. */
    name: string;
    /** Absolute path to the backup file. */
    path: string;
    /** File size in bytes (should be 32 for a valid global-salt). */
    size: number;
    /** Last-modified timestamp. */
    mtime: Date;
}
/**
 * List global-salt backup files from `$XDG_DATA_HOME/cleo/backups/`, sorted
 * newest-first by mtime.
 *
 * Returns an empty array when the backup directory does not exist.
 *
 * @param cleoHomeOverride - Override `getCleoHome()` path (use in tests to target a tmp dir)
 *
 * @task T369
 * @epic T310
 */
export declare function listGlobalSaltBackups(cleoHomeOverride?: string): GlobalSaltBackupEntry[];
//# sourceMappingURL=sqlite-backup.d.ts.map