export declare const SCHEMA_VERSION = 11; export declare const SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS conversation_files (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n\n absolute_path TEXT NOT NULL UNIQUE,\n parent_dir TEXT NOT NULL,\n file_name TEXT NOT NULL,\n\n account TEXT NOT NULL DEFAULT 'default',\n\n size_bytes INTEGER NOT NULL DEFAULT 0,\n mtime_ms INTEGER NOT NULL DEFAULT 0,\n\n last_indexed_offset INTEGER NOT NULL DEFAULT 0,\n last_indexed_line INTEGER NOT NULL DEFAULT 0,\n\n reducer_state TEXT,\n\n content_fingerprint TEXT,\n\n status TEXT NOT NULL DEFAULT 'active',\n\n last_indexed_at TEXT,\n created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n deleted_at TEXT\n);\n\nCREATE INDEX IF NOT EXISTS idx_conversation_files_status ON conversation_files(status);\nCREATE INDEX IF NOT EXISTS idx_conversation_files_parent_dir ON conversation_files(parent_dir);\nCREATE INDEX IF NOT EXISTS idx_conversation_files_account ON conversation_files(account);\n\nCREATE TABLE IF NOT EXISTS conversations (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n\n file_id INTEGER NOT NULL UNIQUE,\n\n source_path TEXT NOT NULL UNIQUE,\n -- Which provider produced this row. Canonical identity is (provider,\n -- source_path); session_id stays non-unique across providers too.\n provider TEXT NOT NULL DEFAULT 'claude-code',\n kind TEXT,\n external_session_id TEXT,\n session_id TEXT NOT NULL,\n session_name TEXT,\n -- JSON NameSlots the name was resolved from; lets a side-store change\n -- re-resolve the name without reparsing the transcript.\n name_slots TEXT,\n\n project_path TEXT,\n project_name TEXT,\n account TEXT NOT NULL DEFAULT 'default',\n branch TEXT,\n\n preview TEXT,\n content_snippet TEXT,\n\n message_count INTEGER NOT NULL DEFAULT 0,\n -- Count of messages parseConversation() produces (broader than message_count;\n -- includes tool_use-only and thinking-only lines). The total for bounded paging.\n page_message_count INTEGER NOT NULL DEFAULT 0,\n last_message_sender TEXT NOT NULL DEFAULT 'user',\n timestamp TEXT,\n\n -- Monotonic write counter; the highest value is the most recently indexed\n -- row. Drives last-writer-wins resolution for shared session_ids (matching\n -- the in-memory sessionId map), at the sub-second precision updated_at lacks.\n index_seq INTEGER NOT NULL DEFAULT 0,\n\n first_sent_at TEXT,\n first_sent_text TEXT,\n\n last_sent_at TEXT,\n last_sent_text TEXT,\n\n model TEXT,\n is_subagent INTEGER NOT NULL DEFAULT 0,\n -- The parent's JSONL PATH (matched against source_path), not an id.\n parent_session_id TEXT,\n -- The subagent's own id (Claude agentId), and the parent's session UUID.\n subagent_id TEXT,\n parent_session_uuid TEXT,\n is_teammate INTEGER NOT NULL DEFAULT 0,\n team_name TEXT,\n tool_names_json TEXT,\n last_prompt TEXT,\n\n is_imported_from_claude INTEGER NOT NULL DEFAULT 0,\n is_imported_from_codex INTEGER NOT NULL DEFAULT 0,\n is_imported_from_cursor INTEGER NOT NULL DEFAULT 0,\n\n status TEXT NOT NULL DEFAULT 'active',\n\n created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n FOREIGN KEY (file_id) REFERENCES conversation_files(id)\n);\n\nCREATE INDEX IF NOT EXISTS idx_conversations_session_id ON conversations(session_id);\nCREATE INDEX IF NOT EXISTS idx_conversations_provider_session ON conversations(provider, session_id);\nCREATE INDEX IF NOT EXISTS idx_conversations_provider_recent ON conversations(provider, timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_provider_project_branch ON conversations(provider, project_path, branch);\nCREATE INDEX IF NOT EXISTS idx_conversations_recent ON conversations(timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_project_recent ON conversations(project_path, timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_project_branch_recent ON conversations(project_path, branch, timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_account_recent ON conversations(account, timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_subagent_recent ON conversations(is_subagent, timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_conversations_team_recent ON conversations(team_name, timestamp DESC);\n\n-- Full-text search index over conversation body + metadata. Kept separate from\n-- the metadata tables so list-screen queries stay small and fast. One FTS row\n-- per conversation, replaced on each upsert.\n--\n-- The row's rowid IS conversation_files.id. That is load-bearing, not cosmetic:\n-- FTS5's query planner only handles MATCH, rowid and rank, so any other\n-- constraint (including a source_path equality on an UNINDEXED column) has no\n-- index and linear-scans the whole table. At ~128 KB of body per row that would\n-- mean scanning the entire corpus on every append. Look rows up by rowid.\n-- source_path stays stored-but-UNINDEXED so a search hit can resolve back to a\n-- conversations row.\n--\n-- Body is three columns, not one: text > thinking > tools priority has to\n-- survive an append (a new user message belongs in the text column, not after\n-- the tool output already written). They are deliberately NOT concatenated into\n-- a fourth column - that would double-weight body hits and inflate bm25 length.\nCREATE VIRTUAL TABLE IF NOT EXISTS conversation_messages_fts USING fts5(\n source_path UNINDEXED,\n text,\n thinking,\n tools,\n project_name,\n session_id,\n session_name,\n account,\n model,\n branch,\n tool_names,\n tokenize = 'unicode61'\n);\n\n-- Seek index for large conversations: every N messages, record the byte offset\n-- where the next message's line begins plus the parser's cross-line state\n-- (pending tool_use blocks, team info) needed to resume an equivalent parse\n-- from that point. Lets getConversationPage() read a window near the end of a\n-- huge file without parsing from byte 0.\nCREATE TABLE IF NOT EXISTS message_checkpoints (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n source_path TEXT NOT NULL,\n message_index INTEGER NOT NULL,\n byte_offset INTEGER NOT NULL,\n line_number INTEGER NOT NULL,\n parser_state TEXT NOT NULL,\n created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n\nCREATE INDEX IF NOT EXISTS idx_message_checkpoints_lookup\n ON message_checkpoints(source_path, message_index);\n\n-- Per-directory mtime watermark for the discovery dir-mtime gate (skips the\n-- glob for a directory whose file/subdir SET hasn't changed; never skips\n-- per-file classify()). One row for a profile's projectsDir itself (parent_root\n-- IS NULL) and one row per immediate project subdirectory discovered under it\n-- (parent_root = the projectsDir path). has_nested marks a project dir known to\n-- contain files below its own top level (e.g. subagents/) \u2014 those always\n-- re-glob regardless of mtime, since a project-dir-level watermark can't see a\n-- change two levels down.\nCREATE TABLE IF NOT EXISTS scanned_dirs (\n path TEXT PRIMARY KEY,\n parent_root TEXT,\n mtime_ms INTEGER NOT NULL,\n has_nested INTEGER NOT NULL DEFAULT 0,\n updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n\nCREATE INDEX IF NOT EXISTS idx_scanned_dirs_parent_root ON scanned_dirs(parent_root);\n"; //# sourceMappingURL=schema.d.ts.map