import type Database from 'better-sqlite3';
import type { ChatContextType, ChatMessage, ChatMessageStatus, ChatRole, ChatSubagentTask, ChatThread, ChatThreadMeta, TodoItem, UsageStats } from '../../shared/entities.js';
export declare class ChatService {
    private db;
    constructor(db: Database.Database);
    createThread(title?: string | null, opts?: {
        contextType?: ChatContextType;
        briefPath?: string | null;
        patchPath?: string | null;
    }): ChatThread;
    /** M21: list threads attached to a brief (path-keyed lookup). */
    listThreadsForBrief(briefPath: string): ChatThreadMeta[];
    /** M23: list threads attached to a patch (path-keyed lookup). */
    listThreadsForPatch(patchPath: string): ChatThreadMeta[];
    /** M23: count threads for a patch (cheap version for list UI). */
    threadCountForPatch(patchPath: string): number;
    listThreads(): ChatThreadMeta[];
    getThread(id: string, limit?: number, offset?: number): {
        thread: ChatThread;
        messages: ChatMessage[];
        subagentTasks: ChatSubagentTask[];
    } | null;
    getThreadMeta(id: string): ChatThread | null;
    deleteThread(id: string): {
        deleted: true;
    };
    addMessage(threadId: string, role: ChatRole, content: string, toolName?: string | null, toolId?: string | null, subagentTaskId?: string | null, planMode?: boolean, status?: ChatMessageStatus): ChatMessage;
    startSubagentTask(threadId: string, taskId: string, description: string, toolUseId: string | null): void;
    updateSubagentTaskProgress(threadId: string, taskId: string, description: string): void;
    completeSubagentTask(threadId: string, taskId: string, status: string, summary: string | null): void;
    listSubagentTasks(threadId: string): ChatSubagentTask[];
    getMessages(threadId: string, limit?: number, offset?: number): ChatMessage[];
    updateTitle(threadId: string, title: string): void;
    setLastSessionId(threadId: string, sessionId: string): void;
    setInitialSystemPrompt(threadId: string, prompt: string): void;
    getInitialSystemPrompt(threadId: string): string | null;
    /**
     * M05 session-lock: snapshot `{ model, architectureConfig }` z PIERWSZEJ tury.
     * Punkt odniesienia dla guarda `RESUME_CONFIG_LOCKED` — model i pola reasoningu
     * sa session-immutable. Idempotentny (UPDATE tylko gdy kolumna jest NULL), wiec
     * no-op na 2.+ turze. Wzorowane na `setInitialSystemPrompt`.
     */
    setInitialArchitectureConfig(threadId: string, snapshot: {
        model: string;
        architectureConfig: Record<string, unknown>;
    }): void;
    /** Debug-only — NIE w domyslnej projekcji GET /api/threads/:id (jak initial_system_prompt). */
    getInitialArchitectureConfig(threadId: string): string | null;
    setLastUsage(threadId: string, usage: UsageStats): void;
    attachTurnUsage(threadId: string, messageId: number, usage: UsageStats): void;
    setLastContextSize(threadId: string, contextSize: number): void;
    attachTurnContextSize(threadId: string, messageId: number, contextSize: number): void;
    markToolUseComplete(threadId: string, toolUseId: string): void;
    finalizeStreamingRows(threadId: string): void;
    finalizeAllStreamingRows(): void;
    updateCurrentTodoItems(threadId: string, items: TodoItem[] | null): void;
    updateThreadSettings(threadId: string, patch: {
        planMode?: boolean;
    }): ChatThread;
    private findThread;
    private getThreadRow;
    private hydrateThread;
    private hydrateMessage;
    private hydrateSubagentTask;
}
