import type { ChatEntry } from "../agent/llm-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; backend: string; baseUrl: string; apiKeyEnvVar: string; model: string; supportsVision?: boolean; } export interface ContextData { systemPrompt: string; chatHistory: ChatEntry[]; sessionState?: SessionState; promptVariables?: Record; } /** * Manages chat history persistence to ~/.zds-ai/context.json or custom path */ export declare class ChatHistoryManager { private static instance; private static customHistoryFilePath; private historyFilePath; private constructor(); /** * Set a custom history file path (must be called before getInstance) */ static setCustomHistoryPath(filePath: string): void; static getInstance(): ChatHistoryManager; /** * Get the context file path (main history JSON file) */ getContextFilePath(): string; private ensureHistoryDirExists; /** * Deserialize chat entries from parsed JSON */ private deserializeChatEntries; /** * Load context (system prompt + chat history) * Supports both old format (array) and new format (object) */ loadContext(): ContextData; /** * Serialize chat entries for JSON storage */ private serializeChatEntries; /** * Save context (system prompt + chat history + session state + prompt variables) in new format * Automatically exports persistent prompt variables */ saveContext(systemPrompt: string, chatHistory: ChatEntry[], sessionState?: SessionState, promptVariables?: Record): void; /** * Save raw messages log to file (OpenAI format messages) */ saveMessages(messages: any[]): void; /** * Create a backup of all session files (history, messages, state, debug log) */ backupHistory(): string | null; /** * Clear all session files (history, messages, state, debug log) with automatic backup */ clearHistory(): void; /** * Save session state (persona, mood, task, cwd) to file */ saveSessionState(state: SessionState): void; /** * Load session state from file */ loadSessionState(): SessionState | null; /** * Get the debug log file path based on the context file */ getDebugLogPath(): string; /** * Static method to get debug log path (for use before agent is created) */ static getDebugLogPath(): string; }