/**
 * Session Repository
 *
 * Repository for session and message storage.
 */
import type Database from 'better-sqlite3';
import type { Session, Message } from '../schema.js';
export interface SessionFilter {
    projectId?: string;
    isArchived?: boolean;
    model?: string;
    limit?: number;
    offset?: number;
    orderBy?: 'updated_at' | 'created_at' | 'total_cost';
    order?: 'ASC' | 'DESC';
}
export interface SessionWithMessages extends Session {
    messages: Message[];
}
export declare class SessionRepository {
    private db;
    constructor(db?: Database.Database);
    /**
     * Create a new session
     */
    createSession(session: Omit<Session, 'created_at' | 'updated_at' | 'total_tokens_in' | 'total_tokens_out' | 'total_cost' | 'message_count' | 'tool_calls_count' | 'is_archived'>): Session;
    /**
     * Get session by ID
     */
    getSessionById(id: string): Session | null;
    /**
     * Get session with all messages
     */
    getSessionWithMessages(id: string): SessionWithMessages | null;
    /**
     * Find sessions by filter
     */
    findSessions(filter?: SessionFilter): Session[];
    /**
     * Update session statistics
     */
    updateSessionStats(id: string, stats: {
        tokensIn?: number;
        tokensOut?: number;
        cost?: number;
        toolCalls?: number;
    }): boolean;
    /**
     * Archive/unarchive session
     */
    setArchived(id: string, archived: boolean): boolean;
    /**
     * Delete session (cascades to messages)
     */
    deleteSession(id: string): boolean;
    /**
     * Add message to session
     */
    addMessage(message: Omit<Message, 'id' | 'created_at'>): Message;
    /**
     * Get messages for session
     */
    getMessages(sessionId: string, limit?: number): Message[];
    /**
     * Get recent messages (for context window)
     */
    getRecentMessages(sessionId: string, limit?: number): Message[];
    /**
     * Delete messages from session
     */
    deleteMessages(sessionId: string, fromId?: number): number;
    /**
     * Get session statistics
     */
    getStats(projectId?: string): {
        totalSessions: number;
        activeSessions: number;
        archivedSessions: number;
        totalMessages: number;
        totalCost: number;
        totalTokensIn: number;
        totalTokensOut: number;
    };
    /**
     * Get cost summary by model
     */
    getCostByModel(): {
        model: string;
        cost: number;
        sessions: number;
    }[];
    private deserializeSession;
    private deserializeMessage;
}
export declare function getSessionRepository(): SessionRepository;
export declare function resetSessionRepository(): void;
