/** * Reads a Cursor conversation from the SQLite state.vscdb and converts it * to the FullMessage[] format used by the indexer. * * Cursor stores conversations in: * ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb * * Key namespaces used: * composerData: — session metadata + ordered bubble headers * bubbleId:: — individual message bubbles * * Bubble types: * type 1 — user message (field: text) * type 2 — AI message (field: text, or toolFormerData for tool calls) * * Tool call bubbles have toolFormerData: * { name, rawArgs (JSON string), result (JSON string), status } * * Empty AI bubbles (no text, no toolFormerData) are placeholder/streaming * artifacts — we skip them. */ import Database from "better-sqlite3"; import type { FullMessage } from "./types"; interface BubbleHeader { bubbleId: string; type: 1 | 2; } interface ComposerData { composerId: string; name?: string; fullConversationHeadersOnly?: BubbleHeader[]; status?: string; createdAt?: number; lastUpdatedAt?: number; } export declare function resolveCursorDbPath(): string; /** * Opens the Cursor state.vscdb in read-only mode and returns a wrapper. * The caller must call close() when done. */ export declare function openCursorDb(dbPath?: string): Database.Database; /** * Reads composer metadata for a given composerId. */ export declare function getComposerData(db: Database.Database, composerId: string): ComposerData | null; /** * Lists all composerIds in the DB, ordered by most-recently-updated first. * Used by the incremental indexer to find new/updated sessions. */ export declare function listComposerIds(db: Database.Database): string[]; /** * Reads all messages for a Cursor conversation from the DB and converts them * to FullMessage[]. Preserves the order defined by fullConversationHeadersOnly. * * @param db Open Cursor state.vscdb connection * @param composerId The conversation ID (same as conversation_id in hook payload) */ export declare function cursorSessionToMessages(db: Database.Database, composerId: string): FullMessage[]; /** * Derives a session title from the first user message text. */ export declare function deriveCursorSessionTitle(composer: ComposerData, messages: FullMessage[]): string; export {}; //# sourceMappingURL=cursor-to-messages.d.ts.map