import { ChatEntry } from "../agent/grok-agent.js"; export interface SessionState { session: string; persona: string; personaColor: string; mood: string; moodColor: string; activeTask: string; activeTaskAction: string; activeTaskColor: string; cwd: string; contextCurrent: number; contextMax: number; } /** * SQLite-based chat history manager with support for concurrent access */ export declare class ChatHistoryManager { private static instance; private static customHistoryPath; private dbPath; private db; private constructor(); /** * Set a custom database path (must be called before getInstance) */ static setCustomHistoryPath(filePath: string): void; static getInstance(): ChatHistoryManager; /** * Get the database file path */ getContextFilePath(): string; private ensureHistoryDirExists; /** * Migrate from JSON files to SQLite if JSON files exist and DB is empty */ private migrateFromJSONIfNeeded; /** * Load chat history from database */ loadHistory(): ChatEntry[]; /** * Add a single message to the database (atomic operation) */ addMessage(entry: ChatEntry): void; /** * Save chat history to database (replaces entire history) * This maintains backward compatibility but is less efficient than addMessage */ saveHistory(history: ChatEntry[]): void; /** * Save raw messages log (for backward compatibility) * In SQLite version, this is stored alongside the messages */ saveMessages(messages: any[]): void; /** * Create a backup of the database */ backupHistory(): string | null; /** * Clear all data from database with automatic backup */ clearHistory(): void; /** * Save session state to database */ saveSessionState(state: SessionState): void; /** * Load session state from database */ loadSessionState(): SessionState | null; /** * Get the debug log file path */ getDebugLogPath(): string; /** * Static method to get debug log path */ static getDebugLogPath(): string; /** * Get messages in a specific range (for pagination) */ getMessagesRange(offset: number, limit: number): ChatEntry[]; /** * Get the total number of messages */ getMessageCount(): number; /** * Export current database to JSON format (for debugging/backup) */ exportToJSON(): string; }