import type { Database } from "./database.js"; import type { CodeChunk, ChunkType } from "../types/index.js"; export declare class ChunkStore { private db; private insertStmt; private getByFileStmt; private deleteByFileStmt; private searchFtsStmt; private getByIdStmt; private getByNameStmt; constructor(db: Database); insert(fileId: number, type: ChunkType, name: string | null, signature: string | null, startLine: number, endLine: number, content: string, description: string | null, tokenCount: number): number; getByFile(fileId: number): CodeChunk[]; deleteByFile(fileId: number): void; searchFts(query: string, limit?: number): (CodeChunk & { rank: number; })[]; getById(id: number): CodeChunk | undefined; /** * Batched fetch by a set of chunk ids. Used by hybrid-search to enrich * the RRF candidate set in one query instead of N point reads. The * `WHERE id IN (...)` shape is built dynamically because better-sqlite3 * doesn't support array binding; we cap chunk-count at MAX_CANDIDATES * (~500) upstream so the SQL stays well under SQLITE_MAX_VARIABLE_NUMBER. * Returns chunks in arbitrary order — caller is responsible for the * (chunkId → CodeChunk) mapping if ordering matters. */ getByIds(ids: number[]): CodeChunk[]; getByName(namePattern: string, limit?: number): CodeChunk[]; /** * Same shape as getByName, but JOINs in the containing file's path and * pagerank in a single indexed query so callers don't need to follow * up with a full fileStore.getAll() scan. Issue #6: the first-call * latency on sverklo_lookup was dominated by that scan warming up * prepared statements over the files table. */ getByNameWithFile(namePattern: string, limit?: number): (CodeChunk & { filePath: string; pagerank: number; fileLanguage: string; })[]; count(): number; /** Update the purpose field on a chunk (P1-12). */ updatePurpose(chunkId: number, purpose: string | null): void; /** Read just the purpose for a chunk — cheap query path used by the * enrichment cache check. */ getPurpose(chunkId: number): string | null; getAllWithFile(): (CodeChunk & { filePath: string; pagerank: number; })[]; }