/** * Derive the Claude Code project directory hash from DATA_DIR. * Claude Code encodes project directories by replacing '/' and '.' with '-'. * e.g. /home/user/.cortex → -home-user--cortex */ declare function getProjectHash(): string; /** * Get the path to a Claude Code session JSONL file. */ declare function getSessionFilePath(sessionId: string): string; /** Find a PI transcript from its exact id-bearing filename without opening JSONL bodies. */ declare function findPISessionFile(sessionId: string, sessionDir?: string): Promise; /** Create `.turn-.bak` without blocking the event loop. */ declare function backupSessionFile(filePath: string, turnIndex: number): Promise; /** Derive the exact transcript path encoded by a recorded turn backup. */ declare function sessionFileFromBackupPath(backupPath: string, turnIndex: number): string | null; /** Restore from an immutable backup pathname recorded in the conversation ledger. */ declare function restoreSessionBackup(backupPath: string, turnIndex: number): Promise; /** Restore a session file from a turn backup without blocking the event loop. */ declare function restoreSessionFile(filePath: string, turnIndex: number): Promise; /** * Delete backups for turns strictly after the given index for a specific session file. * Backups are named `.turn-.bak`. */ declare function cleanupBackupsForFile(filePath: string, afterTurnIndex: number): void; declare function cleanupAllBackupsForFile(filePath: string): void; /** * Create a backup of the session file before processing a turn. * Returns the backup path, or null if the session file doesn't exist yet. */ declare function createBackup(sessionId: string, turnIndex: number): Promise; declare function restoreBackup(sessionId: string, turnIndex: number): Promise; /** * Delete all backup files for a session. * Called on !new to clean up. */ declare function cleanupAllBackups(sessionId: string): void; /** * Delete backups for turns strictly after the given index. * Called after rollback to remove invalidated backups. */ declare function cleanupBackupsAfter(sessionId: string, afterTurnIndex: number): void; export { getSessionFilePath, createBackup, restoreBackup, cleanupAllBackups, cleanupBackupsAfter, getProjectHash, findPISessionFile, backupSessionFile, restoreSessionFile, restoreSessionBackup, sessionFileFromBackupPath, cleanupBackupsForFile, cleanupAllBackupsForFile, };