/**
 * File-based storage implementation for recording entries and session index.
 *
 * Stores recording entries in JSONL files organized by session:
 * {recordingsDir}/{sessionId}/recording.jsonl
 *
 * Maintains a session index at:
 * {recordingsDir}/sessions.json
 *
 * Uses buffered writes for performance - entries are added to a buffer
 * and flushed to disk asynchronously.
 */
import type { RecordingEntry, RecordingSession } from "../types.js";
/** Result from creating a snapshot */
export interface SnapshotResult {
    /** Files skipped from snapshot due to size limit */
    skippedFiles: Array<{
        path: string;
        size: number;
    }>;
}
/**
 * File-based storage for recording entries and session index.
 *
 * Entries are stored in JSONL format (one JSON object per line) in
 * session-specific directories. The session index is stored as a
 * JSON array that gets overwritten on each update.
 *
 * Session index saves are debounced to avoid excessive disk writes
 * when multiple updates occur in rapid succession.
 */
export declare class SessionRecordingStorage {
    private readonly recordingsDir;
    private buffer;
    private flushPromise;
    private currentSessionId;
    private storageInitialized;
    private sessions;
    private sessionsLoaded;
    private loadSessionIndexPromise;
    private sessionIndexSaveTimeout;
    private sessionIndexDirty;
    constructor(recordingsDir: string);
    /**
     * Get the path to a session's directory.
     */
    private getSessionDir;
    /**
     * Get the path to a session's recording file.
     */
    private getSessionFilePath;
    /**
     * Get the path to the sessions index file.
     */
    private getSessionsIndexPath;
    /**
     * Ensures the storage directory exists for the current session.
     * Creates directory if needed.
     */
    private ensureStorageExists;
    /**
     * Ensures the recordings directory exists.
     */
    private ensureRecordingsDirExists;
    /**
     * Load the session index from disk.
     * Uses a promise to prevent concurrent loads from racing.
     */
    private loadSessionIndex;
    /**
     * Actually load the session index from disk.
     */
    private doLoadSessionIndex;
    /**
     * Save the session index to disk immediately.
     * Clears any pending debounced save.
     */
    private saveSessionIndexNow;
    /**
     * Schedule a debounced save of the session index.
     * Multiple calls within the debounce window will only trigger one save.
     */
    private scheduleSaveSessionIndex;
    /**
     * Add a new session to the index.
     * Saves immediately since new sessions should be persisted right away.
     */
    addSession(session: RecordingSession): Promise<void>;
    /**
     * Update an existing session in the index.
     * Uses debounced save to batch rapid updates.
     */
    updateSession(session: RecordingSession): Promise<void>;
    /**
     * Get a session by ID.
     * Returns undefined if not found.
     */
    getSession(sessionId: string): Promise<RecordingSession | undefined>;
    /**
     * List all sessions from the index.
     * Returns sessions in chronological order (oldest first).
     */
    listSessions(): Promise<RecordingSession[]>;
    /**
     * Get the size of a session's recording file in bytes.
     * Returns 0 if the file doesn't exist yet.
     */
    getSessionFileSize(sessionId: string): Promise<number>;
    /**
     * Delete oldest sessions to keep only the specified number.
     * Sessions are stored oldest-first, so we delete from the beginning.
     */
    deleteOldestSessions(keepCount: number): Promise<void>;
    /**
     * Add a recording entry for the given session.
     * Appends to buffer and schedules async flush.
     */
    add(sessionId: string, entry: RecordingEntry): void;
    /**
     * Schedule a flush of the buffer to disk.
     * Uses a simple debounce - if a flush is already pending, don't schedule another.
     */
    private scheduleFlush;
    /**
     * Flush all buffered entries to disk.
     */
    private flush;
    /**
     * Create a zip snapshot of the app directory for a session.
     * This captures the state of the codebase when the session started.
     *
     * @param sessionId - The session ID to create the snapshot for
     * @param appRootDirPath - The root directory of the application
     * @param maxFileSizeBytes - Max file size to include (default 1MB)
     * @returns Information about skipped files
     */
    createSnapshot(sessionId: string, appRootDirPath: string, maxFileSizeBytes?: number): Promise<SnapshotResult>;
    /**
     * Recursively walk a directory and return all file paths.
     */
    private walkDirectory;
    /**
     * Clear all entries for a specific session or all sessions.
     */
    clear(sessionId?: string): Promise<void>;
}
//# sourceMappingURL=session-recording-storage.d.ts.map