import { type KbChunk } from "../schema";
export interface NewChunkInput {
    content: string;
    embedding: number[];
}
export interface ChunkSearchResult {
    content: string;
    title: string | null;
    url: string | null;
    distance: number;
}
/**
 * Tenant-scoped semantic search over kb_chunks via pgvector cosine distance
 * (uses the HNSW index on kbChunks.embedding). `tenantId` is filtered in the
 * WHERE clause, never inferred from the join alone (docs/REQUIREMENTS.md rule 1).
 * Returns the closest `limit` chunks with their source document's title/url for
 * citation, plus the raw distance so the caller can apply a relevance cutoff
 * (lower = more similar; 0 = identical).
 */
export declare function searchChunks(tenantId: string, queryEmbedding: number[], limit?: number): Promise<ChunkSearchResult[]>;
/**
 * Replaces all chunks for a document atomically -- a save fully replaces, never
 * versions. Wrapped in a single `db.transaction()` (node-postgres supports real
 * interactive transactions) so the delete and re-insert either both land or
 * neither does, leaving no window where the document has no chunks.
 */
export declare function replaceChunksForDocument(tenantId: string, kbDocumentId: string, chunks: NewChunkInput[]): Promise<KbChunk[]>;
