import type { Message } from '../types/core.js';
export interface Session {
    id: string;
    title: string;
    createdAt: string;
    lastAccessedAt: string;
    messageCount: number;
    provider: string;
    model: string;
    workingDirectory: string;
    messages: Message[];
}
export interface SessionMetadata {
    id: string;
    title: string;
    createdAt: string;
    lastAccessedAt: string;
    messageCount: number;
    provider: string;
    model: string;
    workingDirectory: string;
}
export declare class SessionManager {
    private sessionsDir;
    private sessionsIndexPath;
    private initialized;
    /** Serializes read-modify-write of sessions.json to prevent lost updates from concurrent autosave/resume. */
    private indexWriteLock;
    /** Optional explicit directory override (used by tests). */
    private readonly overrideDir?;
    constructor(sessionsDir?: string);
    private resolveSessionsDir;
    initialize(): Promise<void>;
    createSession(sessionData: Omit<Session, 'id' | 'createdAt' | 'lastAccessedAt'>): Promise<Session>;
    saveSession(session: Session): Promise<void>;
    /** Read the index file (internal helper — not locked). */
    private readIndex;
    /**
     * Rebuild the index by scanning session files on disk.
     * Called when the index is missing, corrupt, or empty despite files existing.
     */
    private rebuildIndex;
    listSessions(options?: {
        workingDirectory?: string;
    }): Promise<SessionMetadata[]>;
    /** Read a session from disk without updating lastAccessedAt (no write). */
    readSession(sessionId: string): Promise<Session | null>;
    loadSession(sessionId: string): Promise<Session | null>;
    deleteSession(sessionId: string): Promise<void>;
    getSessionDirectory(): string;
    /** Run a read-modify-write on the index one at a time to avoid lost updates. */
    private withIndexLock;
    private enforceSessionLimits;
    private cleanupOldSessions;
}
export declare const sessionManager: SessionManager;
//# sourceMappingURL=session-manager.d.ts.map