import type Database from "better-sqlite3"; import { type ChatAccessContext } from "../core/access.js"; export interface MessageRow { id: number; chat_id: string; sender_id: string; role: string; content_text: string | null; content_type: string; thread_id: string | null; created_at: string; sender_name: string | null; } export interface ContinuationMessageRow { sender_id: string | null; role: string; sender_name: string | null; content_text: string; } export interface SessionMessageRow { id: number; role: "user" | "assistant"; content_text: string; } export interface MessageFilter { since?: string; before?: string; role?: string; userId?: string; contentType?: string; threadId?: string; allThreads?: boolean; } export declare function listMessages(db: Database.Database, options: ChatAccessContext & MessageFilter & { targetChatId: string; limit: number; offset?: number; }): MessageRow[]; export declare function searchMessages(db: Database.Database, options: ChatAccessContext & MessageFilter & { query: string; searchAll?: boolean; targetChatId?: string; targetChatType?: "p2p" | "group"; limit: number; }): MessageRow[]; export declare function getMessageForAccess(db: Database.Database, id: number, ctx: ChatAccessContext): MessageRow | undefined; export declare function getMessageContextRows(db: Database.Database, chatId: string, messageId: number, contextCount: number): MessageRow[]; export declare function listContinuationMessages(db: Database.Database, options: { chatId: string; threadId?: string; mainThreadOnly?: boolean; beforeMsgId?: number; limit: number; }): ContinuationMessageRow[]; export declare function listSessionMessages(db: Database.Database, sessionId: string): SessionMessageRow[];