/** * 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 session file by session ID. * Scans the PI session directory for .jsonl files and matches by the header's `id` field. * Returns the full file path, or null if not found. */ declare function findPISessionFile(sessionId: string): string | null; /** * Create a session file backup at an explicit file path. * The backup is stored as `.turn-.bak`. * Returns the backup path, or null if the file doesn't exist. */ declare function backupSessionFile(filePath: string, turnIndex: number): string | null; /** * Restore a session file from a turn backup. * Returns true if the backup was found and restored. */ declare function restoreSessionFile(filePath: string, turnIndex: number): boolean; /** * 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; /** * 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): string | null; declare function restoreBackup(sessionId: string, turnIndex: number): boolean; /** * 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, cleanupBackupsForFile, };