import { BaseSqliteRepository } from './base-sqlite-repository.js'; import { threads } from '../schema/index.js'; import type { TaskRow } from './task.repository.js'; export type ThreadRow = typeof threads.$inferSelect; export type NewThread = typeof threads.$inferInsert; export declare class ThreadRepository extends BaseSqliteRepository { private readonly dbPath?; constructor(opts?: { dbPath?: string; dbRoot?: string; }); resolveDbPath(): string; private openHandle; private validateWorkspaceId; private topLevelTaskPredicateSql; findAllThreads(workspaceId?: string): ThreadRow[]; findThreadById(threadId: string, workspaceId?: string): ThreadRow | undefined; threadExists(threadId: string, workspaceId?: string): boolean; aggregateTaskStats(threadId: string, workspaceId?: string): { taskCount: number; inputTokens: number; outputTokens: number; cachedInputTokens: number; costUsd: number; agentIds: string[]; }; findTopLevelTasks(threadId: string, workspaceId?: string, limit?: number): TaskRow[]; findAllTasks(threadId: string, workspaceId?: string): TaskRow[]; findTaskById(threadId: string, taskId: string, workspaceId?: string): { task: TaskRow; children: TaskRow[]; } | undefined; batchFetchTasks(threadIds: string[], workspaceId?: string): Map; updateThreadTitle(threadId: string, title: string, workspaceId?: string): void; upsertThread(threadId: string, opts: { platform: string; workspaceId?: string; title?: string; titleLocked?: boolean; }): void; ensureThread(threadId: string, platform: string, workspaceId?: string): void; saveUserMessage(threadId: string, text: string, opts?: { platform?: string; model?: string; }): { firstMessage: boolean; }; saveAssistantMessage(threadId: string, text: string, opts?: { platform?: string; model?: string; inputTokens?: number; outputTokens?: number; cachedInputTokens?: number; }): void; updateThread(threadId: string, patch: { title?: string; titleLocked?: boolean; }): void; togglePin(threadId: string, workspaceId?: string): { pinned: boolean; } | null; reorderPins(threadIds: string[], workspaceId?: string): void; toggleStar(threadId: string, workspaceId?: string): { starred: boolean; } | null; }