import type { SessionInfo, FullMessage, SessionSource } from "./types"; import type { DatabaseProvider } from "./providers/types"; import type { Database } from "./database"; export interface IndexerOptions { /** Override the DB path (useful for testing). Falls back to resolveDbPath(). */ dbPath?: string; /** Override the OpenAI API key. Falls back to OPENAI_API_KEY env var. */ openAiApiKey?: string; /** Override the embedding model. Falls back to text-embedding-3-large. */ embeddingModel?: string; /** Path to the original transcript file. Stored in sessions_meta for re-indexing. */ transcriptPath?: string; } /** * Incrementally indexes new messages from a session into the vector DB. * * Accepts either a DatabaseProvider (async, backend-agnostic) or a legacy * Database handle (sync, SQLite only). New callers should use DatabaseProvider. * * Only messages that have not been previously indexed are processed: * - We store the last indexed message ID in sessions_meta. * - On each call, we filter to messages that come AFTER that ID. * - Each new message is converted to markdown, chunked, embedded and stored. */ export declare function indexNewMessages(db: Database | DatabaseProvider, session: SessionInfo, messages: FullMessage[], source?: SessionSource, options?: Pick): Promise<{ indexed: number; skipped: number; }>; /** * Convenience wrapper that opens its own DB connection. * Used by the OpenCode indexer-cli and by tests. */ export declare function indexNewMessagesWithOptions(session: SessionInfo, messages: FullMessage[], source?: SessionSource, options?: IndexerOptions): Promise<{ indexed: number; skipped: number; }>; /** * Re-indexes all messages in a session from scratch. * Useful for repairing a corrupted or stale index. */ export declare function reindexSession(session: SessionInfo, messages: FullMessage[], options?: IndexerOptions): Promise<{ indexed: number; }>; /** * Convenience wrapper using DatabaseProvider. * Used by indexer CLIs that have already resolved their backend config. */ export declare function indexNewMessagesWithProvider(provider: DatabaseProvider, session: SessionInfo, messages: FullMessage[], source?: SessionSource, options?: Pick): Promise<{ indexed: number; skipped: number; }>; /** * Re-indexes all messages in a session from scratch using DatabaseProvider. */ export declare function reindexSessionWithProvider(provider: DatabaseProvider, session: SessionInfo, messages: FullMessage[], options?: Pick): Promise<{ indexed: number; }>; //# sourceMappingURL=indexer.d.ts.map