/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */ /** * Code-index SQL layer, schema plus every direct table operation for * CodeIndexStore's bun:sqlite database (Stage A, see CHANGELOG 0.38.0; extracted from * code-index-store.ts to keep that file within the 800-line source discipline). * * Three tables: * - `code_chunks` chunk metadata (path/lang/symbol/kind/lines/hashes) * - `code_vectors` vec0 virtual table keyed by rowid * - `code_index_meta` key/value build provenance, currently the embedding * provider id the index was last fully built with, so search() can refuse * to compare query vectors from a different provider's space against the * stored vectors (see CodeIndexStore.getProviderMismatch). * * Every function takes the Database handle explicitly, this module holds no * state and never opens/closes connections; CodeIndexStore owns the lifecycle. */ import type { Database } from 'bun:sqlite'; import type { CodeChunk } from './code-index-chunking.js'; export type ChunkRow = { rowid: number; chunk_id: string; path: string; lang: string; symbol: string; kind: string; start_line: number; end_line: number; content_hash: string; mtime: number; file_hash: string; }; export type VectorRow = { rowid: number; chunk_id: string; distance: number; }; /** Meta key for the embedding provider id the index was last fully built with. */ export declare const EMBEDDING_PROVIDER_META_KEY = "embedding_provider_id"; export declare const CHUNK_ROW_COLUMNS = "rowid, chunk_id, path, lang, symbol, kind, start_line, end_line, content_hash, mtime, file_hash"; /** Target `PRAGMA user_version` for the code index store. */ export declare const CODE_INDEX_SCHEMA_VERSION = 1; export declare function createCodeIndexSchema(db: Database): void; export declare function getCodeIndexMeta(db: Database, key: string): string | null; export declare function setCodeIndexMeta(db: Database, key: string, value: string): void; export declare function writeChunk(db: Database, chunk: CodeChunk, embedding: Float32Array): void; export declare function deleteChunksForPath(db: Database, relPath: string): void; export declare function getFileHash(db: Database, relPath: string): string | null; export declare function getChunkById(db: Database, chunkId: string): CodeChunk | null; export declare function countChunksForPath(db: Database, relPath: string): number; export declare function countIndexedFiles(db: Database): number; export declare function countIndexedChunks(db: Database): number; export declare function listIndexedPaths(db: Database): string[]; export declare function rowToChunk(row: ChunkRow): CodeChunk; //# sourceMappingURL=code-index-db.d.ts.map