import type { ChatEntry } from '../agent/types.js';
/** Metadata for chat sessions */
export interface SessionMetadata {
    description?: string;
    tags?: string[];
    securityMode?: 'suggest' | 'auto-edit' | 'full-auto';
    agentMode?: 'plan' | 'code' | 'ask' | 'architect';
    tokenCount?: number;
    totalCost?: number;
    toolCallCount?: number;
    [key: string]: string | string[] | number | boolean | undefined;
}
export interface Session {
    id: string;
    name: string;
    workingDirectory: string;
    model: string;
    messages: SessionMessage[];
    createdAt: Date;
    lastAccessedAt: Date;
    metadata?: SessionMetadata;
}
export interface SessionMessage {
    type: 'user' | 'assistant' | 'tool_result' | 'tool_call' | 'reasoning' | 'plan_progress';
    content: string;
    timestamp: string;
    toolCallName?: string;
    toolCallSuccess?: boolean;
    /** Task state for cross-session continuity */
    taskState?: Record<string, unknown>;
}
export interface SessionStoreConfig {
    /** Use SQLite database instead of JSON files */
    useSQLite: boolean;
}
/**
 * Session Store for persisting and restoring chat sessions
 */
export declare class SessionStore {
    private currentSessionId;
    private autoSave;
    private config;
    private dbRepository;
    constructor(config?: Partial<SessionStoreConfig>);
    /**
     * Ensure the sessions directory exists
     */
    private ensureSessionsDirectory;
    /**
     * Create a new session
     */
    createSession(name?: string, model?: string): Promise<Session>;
    /**
     * Save a session to disk
     */
    saveSession(session: Session): Promise<void>;
    /**
     * Load a session from disk
     */
    loadSession(sessionId: string): Promise<Session | null>;
    /**
     * Update the current session with new messages
     */
    updateCurrentSession(chatHistory: ChatEntry[]): Promise<void>;
    /**
     * Add a message to the current session
     */
    addMessageToCurrentSession(entry: ChatEntry): Promise<void>;
    /**
     * Convert ChatEntry to SessionMessage
     */
    private convertChatEntryToMessage;
    /**
     * Convert ChatEntry array to SessionMessage array
     */
    private convertChatEntriesToMessages;
    /**
     * Convert SessionMessage array back to ChatEntry array
     */
    convertMessagesToChatEntries(messages: SessionMessage[]): ChatEntry[];
    /**
     * List all saved sessions
     */
    listSessions(): Promise<Session[]>;
    /**
     * Get recent sessions
     */
    getRecentSessions(count?: number): Promise<Session[]>;
    /**
     * Delete a session
     */
    deleteSession(sessionId: string): Promise<boolean>;
    /**
     * Clean up old sessions (keep only MAX_SESSIONS most recent)
     */
    cleanupOldSessions(): Promise<number>;
    /**
     * Export session to Markdown
     */
    exportToMarkdown(sessionId: string): Promise<string | null>;
    /**
     * Save session export to file
     */
    exportSessionToFile(sessionId: string, outputPath?: string): Promise<string | null>;
    /**
     * Export session to JSON format
     */
    exportToJson(sessionId: string): Promise<string | null>;
    /**
     * Export session to HTML format with syntax highlighting
     */
    exportToHtml(sessionId: string): Promise<string | null>;
    /**
     * Export session to file with specified format
     */
    exportSessionToFileWithFormat(sessionId: string, format: 'markdown' | 'json' | 'html', outputPath?: string): Promise<string | null>;
    /**
     * Resume a session (set as current)
     */
    resumeSession(sessionId: string): Promise<Session | null>;
    /**
     * Get the current session ID
     */
    getCurrentSessionId(): string | null;
    /**
     * Get the current session
     */
    getCurrentSession(): Promise<Session | null>;
    /**
     * Save task state for cross-session continuity
     */
    saveTaskState(taskState: Record<string, unknown>): Promise<void>;
    /**
     * Load the most recent task state from the current session
     */
    loadTaskState(): Promise<Record<string, unknown> | null>;
    /**
     * Set auto-save mode
     */
    setAutoSave(enabled: boolean): void;
    /**
     * Check if auto-save is enabled
     */
    isAutoSaveEnabled(): boolean;
    /**
     * Format session for display
     */
    formatSession(session: Session): string;
    /**
     * Format session list for display
     */
    formatSessionList(): Promise<string>;
    /**
     * Get session file path
     */
    private getSessionFilePath;
    /**
     * Generate a unique session ID
     */
    private generateSessionId;
    /**
     * Search sessions by content
     */
    searchSessions(query: string): Promise<Session[]>;
    /**
     * Get the most recent session
     */
    getLastSession(): Promise<Session | null>;
    /**
     * Resume the last session
     */
    resumeLastSession(): Promise<Session | null>;
    /**
     * Continue from last response (get last session and last message)
     */
    continueLastSession(): Promise<{
        session: Session;
        lastUserMessage: string;
    } | null>;
    /**
     * Get session by partial ID match
     */
    getSessionByPartialId(partialId: string): Promise<Session | null>;
    /**
     * Clone a session (for branching conversations)
     */
    cloneSession(sessionId: string, newName?: string): Promise<Session | null>;
    /**
     * Branch session at a specific message index
     */
    branchSession(sessionId: string, atMessageIndex: number, newName?: string): Promise<Session | null>;
    /**
     * Format help for session commands
     */
    formatHelp(): string;
}
export declare function getSessionStore(): SessionStore;
export declare function resetSessionStore(): void;
