import type { NormalizedMessage } from '../api/types.js'; export interface SessionData { id: string; /** ms unix de creación. */ createdAt: number; /** ms unix del último turno escrito. */ updatedAt: number; /** cwd cuando se creó la sesión. */ cwd: string; model: string; messages: NormalizedMessage[]; } export declare class Session { private data; private constructor(); static create(opts: { cwd: string; model: string; }): Session; static load(id: string): Session | null; /** Devuelve la sesión más reciente CON al menos un turno, por data.updatedAt. * Ignora sesiones vacías (messages = []) para que `sq -c` nunca cargue * una sesión recién creada que no tiene contexto. */ static loadLatest(): Session | null; /** Lista sesiones con al menos un turno, ordenadas por updatedAt desc. */ static list(): Array<{ id: string; updatedAt: number; cwd: string; model: string; turnCount: number; }>; getId(): string; getMessages(): NormalizedMessage[]; getModel(): string; getCwd(): string; updateMessages(messages: NormalizedMessage[]): void; updateModel(model: string): void; private persist; } /** * Auto-prune de sesiones: se llama al arrancar sq. Elimina: * - Stubs: sesiones sin ningún mensaje de user (abriste sq y saliste). * - Muy viejas: updatedAt < now - maxAgeDays. * - Excedente: si tras lo anterior siguen sobrando más de maxKeep, borra * las más antiguas por updatedAt hasta dejar maxKeep. * * Devuelve cuántas se borraron. Best-effort: ignora errores de fs. */ export declare function pruneSessions(opts?: { maxKeep?: number; maxAgeDays?: number; }): number; //# sourceMappingURL=session.d.ts.map