/**
 * Cloud Sync Retry Queue
 *
 * Replaces fire-and-forget cloud sync with a queue that retries failed syncs.
 * Supports both audit metadata sync and quarantine content sync payloads.
 * Uses SQLite sync_queue table with exponential backoff.
 */
import type { SyncedMemoryRecord } from './memory-sync.js';
import type { GraphSyncEnvelope } from './graph-sync.js';
export interface SyncEntry {
    source_type: string;
    source_identifier: string;
    trust_score: number;
    sensitivity_level: string;
    firewall_result: string;
    anomaly_score: number;
    threat_indicators: string[];
    reason: string | null;
    pipeline_duration_ms: number;
    device_id: string;
    device_name: string;
    platform: string;
    timestamp: string;
}
export interface QuarantineSyncEntry {
    original_content: string;
    original_title?: string;
    source_type: string;
    source_identifier: string;
    reason: string;
    threat_indicators: string[];
    anomaly_score: number;
    firewall_result: string;
    device_id: string;
    device_name: string;
    timestamp: string;
}
export interface QueueStats {
    pending: number;
    failed: number;
    synced: number;
    byKind: Record<'audit' | 'quarantine' | 'memory' | 'graph' | 'unknown', {
        pending: number;
        failed: number;
        synced: number;
    }>;
    oldestPendingAt: string | null;
    nextRetryAt: string | null;
    lastError: string | null;
    lastErrorKind: 'audit' | 'quarantine' | 'memory' | 'graph' | 'unknown' | null;
    latestFailureAt: string | null;
}
export interface SyncQueueResult {
    processed: number;
    succeeded: number;
    failed: number;
    permanentlyFailed: number;
}
export interface ReconcileQueueResult {
    removed: number;
}
/**
 * Enqueue a failed sync entry for later retry.
 * INSERT into sync_queue with exponential backoff schedule.
 */
export declare function enqueueFailedSync(entry: SyncEntry): void;
/**
 * Enqueue a failed quarantine sync entry for later retry.
 */
export declare function enqueueFailedQuarantineSync(entry: QuarantineSyncEntry): void;
/**
 * Enqueue a failed memory sync entry for later retry.
 */
export declare function enqueueFailedMemorySync(entry: SyncedMemoryRecord): void;
export declare function enqueueFailedGraphSync(entry: GraphSyncEnvelope): void;
/**
 * Trim the queue back to `maxRows`, evicting lowest-value rows first:
 * already-synced history → terminally-failed → oldest pending. Returns the
 * number of rows dropped. Best-effort and never throws.
 */
export declare function enforceQueueCap(maxRows?: number): number;
/**
 * Process pending items in the retry queue.
 * SELECT pending WHERE next_retry_at <= now, retry each (up to 10 per tick).
 * Awaits each fetch so results are accurate and no double-processing occurs.
 */
export declare function processRetryQueue(): Promise<SyncQueueResult>;
/**
 * Get queue statistics by status.
 */
export declare function getQueueStats(): QueueStats;
export declare function reconcileSyncQueue(options?: {
    kinds?: Array<'memory' | 'graph' | 'audit' | 'quarantine'>;
    statuses?: Array<'pending' | 'failed'>;
    maxCreatedAt?: string | null;
}): ReconcileQueueResult;
/**
 * Purge old entries from the queue.
 * DELETE WHERE created_at < 7 days ago.
 * Returns the number of rows deleted.
 */
export declare function purgeOldEntries(): number;
