/** * Durable session persistence: saving a conversation to its session store file * and remembering which session was last active. * * The crash-snapshot half of this module now lives in session-recovery.ts, and * the "which directory does this call mean" layer both halves share lives in * session-persistence-scope.ts. This file stays the single import site every * consumer already uses: the full previously-public API is re-exported below, * name for name, so no caller changes as a result of the split. */ import { type SessionPersistenceOptions, type SessionSnapshot } from './session-persistence-scope.js'; export { getLastSessionPointerPath, getRecoveryDir, getRecoveryFilePath, getUserSessionsDir, type SessionPersistenceLegacyOptions, type SessionPersistenceOptions, type SessionPersistencePaths, type SessionPersistenceSurfaceOptions, type SessionSnapshot, } from './session-persistence-scope.js'; export { autoRestoreRecovery, checkRecoveryFile, checkRecoveryForSession, consumeRecovery, deleteRecoveryFile, loadRecoveryConversation, removeRecoveryPoint, writeRecoveryFile, type RecoveryConsumeResult, type RecoveryFileInfo, type RecoveryReceiptSink, type RecoveryRemoveResult, type RecoveryRestoreResult, } from './session-recovery.js'; export declare function generateUserSessionId(): string; export declare function saveSession(sessionId: string, data: SessionSnapshot, model: string, provider: string, title?: string, options?: SessionPersistenceOptions, /** * Who caused this save. Defaults to `'auto'`, the honest default for every * existing caller (shutdownRuntime's save-on-exit, and any other call site * that has not been updated to state it was an explicit user action). Pass * `'user'` only from a call site the user directly triggered (e.g. a * `/save` command in a consuming surface), so the session-conversations * retention store (runtime/retention/append-only-registry.ts) never expires * a session the user explicitly asked to keep. */ saveSource?: 'user' | 'auto'): void; export declare function persistConversation(sessionId: string, data: SessionSnapshot, model: string, provider: string, title?: string, options?: SessionPersistenceOptions, saveSource?: 'user' | 'auto'): void; /** * Record which session was last active. * * Written to a pid-suffixed temp file and renamed into place: `rename()` within * one directory is atomic on every POSIX filesystem, so a crash mid-write can * only ever leave the temp file behind, never a half-written pointer where a * good one used to be. (The read side already treats a torn pointer as absent, * which is the safe direction; this makes a torn pointer impossible to produce * in the first place.) The pid suffix keeps two processes writing the same * pointer from sharing a temp name. */ export declare function writeLastSessionPointer(sessionId: string, options?: SessionPersistenceOptions): void; /** * The session id last recorded by writeLastSessionPointer, or null. * * Validated BY CONTENT, not by existence: the file is parsed and the id is * required to be a non-empty string, so a torn pointer reads as absent. * * It deliberately does NOT check that the referenced session still exists. This * function answers "which id was recorded", which is a question about the * pointer file alone, resolving the referent needs the sessions directory and * the SessionManager's filename rule, and callers that only want the id (a * resume prompt deciding whether to offer anything, a diagnostic) would be made * to pay for a stat they do not need. The referent check belongs with the * caller that dereferences it, which is loadLastConversation below, and that * is where the dangling pointer is retired, so the split costs no housekeeping. */ export declare function readLastSessionPointer(options?: SessionPersistenceOptions): string | null; export declare function loadLastConversation(options?: SessionPersistenceOptions): SessionSnapshot | null; //# sourceMappingURL=session-persistence.d.ts.map