/**
 * Vector Search
 *
 * Vector similarity search backed by the sqlite-vec (`vec0`) loadable
 * extension. sqlite-vec is the sole backend — there is no brute-force fallback
 * and no separate embedding BLOB store. When sqlite-vec cannot be loaded (a
 * platform without a prebuilt, or a `--no-optional` install), semantic search
 * is simply unavailable: queries return nothing and stores are no-ops. The
 * graph and keyword search are unaffected.
 *
 * Embeddings live only in the `vec0` virtual table. A sibling `vec_map` plain
 * table carries the node_id ↔ rowid mapping plus the model/content_hash
 * staleness metadata that drives incremental re-embedding.
 */
import { SqliteDatabase } from '../db/sqlite-adapter';
/**
 * Options for vector search
 */
export interface VectorSearchOptions {
    /** Maximum number of results to return */
    limit?: number;
    /** Minimum similarity score (0-1) */
    minScore?: number;
    /** Node kinds to filter results */
    nodeKinds?: import('../types').Node['kind'][];
}
/**
 * Vector Search Manager
 *
 * Handles vector storage and similarity search for semantic code search.
 */
export declare class VectorSearchManager {
    private db;
    private vecEnabled;
    private embeddingDimension;
    private currentModel?;
    constructor(db: SqliteDatabase, dimension?: number, currentModel?: string);
    /**
     * Initialize vector search.
     *
     * Loads the sqlite-vec extension and creates the vec0 + vec_map tables. If
     * sqlite-vec is unavailable on this platform/install, leaves the manager
     * disabled (`vecEnabled = false`) — every operation then no-ops and search
     * returns no results.
     */
    initialize(): Promise<void>;
    /**
     * Load the sqlite-vec loadable extension into this connection. Returns false
     * (rather than throwing) when the extension isn't available — a missing
     * platform prebuilt, a `--no-optional` install, or the package not resolving.
     */
    private loadSqliteVec;
    /**
     * Create the vec0 virtual table (dimension baked in at CREATE time) and the
     * vec_map metadata table. Idempotent.
     */
    private createVecTables;
    /**
     * If vec_map holds rows embedded with a model other than the configured one,
     * drop the vec store so `embedAllNodes()` re-embeds into a fresh space. Safe
     * before the tables exist (first run) — it checks for vec_map first.
     */
    private clearIfModelChanged;
    /**
     * Whether the sqlite-vec backend is loaded and usable.
     */
    isVecEnabled(): boolean;
    /**
     * Look up the vec_items rowid for a node, or null if it has no vector.
     */
    private rowidForNode;
    /**
     * Store a vector embedding for a node.
     */
    storeVector(nodeId: string, embedding: Float32Array, model: string, contentHash?: string): void;
    /**
     * Store multiple vectors in a single transaction.
     */
    storeVectorBatch(entries: Array<{
        nodeId: string;
        embedding: Float32Array;
        contentHash?: string;
    }>, model: string): void;
    /**
     * Insert or replace a single node's vector in vec0 + vec_map.
     */
    private storeOne;
    /**
     * Get the stored vector for a node, or null if it has none.
     */
    getVector(nodeId: string): Float32Array | null;
    /**
     * Delete the vector for a node.
     */
    deleteVector(nodeId: string): void;
    /**
     * Search for similar vectors via vec0 KNN.
     */
    search(queryEmbedding: Float32Array, options?: VectorSearchOptions): Array<{
        nodeId: string;
        score: number;
    }>;
    /**
     * Count of stored vectors.
     */
    getVectorCount(): number;
    /**
     * Whether a node has any stored vector.
     */
    hasVector(nodeId: string): boolean;
    /**
     * Whether a node has a vector matching the current model + embedded text.
     */
    hasCurrentVector(nodeId: string, model: string, contentHash: string): boolean;
    /**
     * All node IDs that have vectors.
     */
    getIndexedNodeIds(): string[];
    /**
     * Delete vectors whose node no longer exists in the graph.
     */
    deleteStaleVectors(): number;
    /**
     * Clear all vectors.
     */
    clear(): void;
    /**
     * Rebuild the vec0 index in place from its own current contents.
     *
     * Reads every stored vector out of vec0, drops + recreates the virtual table
     * at the current dimension/metric, and re-inserts — preserving rowids and the
     * `vec_map` mapping. This is a self-contained reindex: it does NOT re-embed
     * (embeddings are read back from vec0), so it costs no embedding-API calls.
     * Use it to recover a corrupted index or to re-materialize after changing
     * vec0 parameters. No-op when sqlite-vec is unavailable.
     */
    rebuildVecIndex(): void;
}
/**
 * Create a vector search manager
 */
export declare function createVectorSearch(db: SqliteDatabase, dimension?: number, currentModel?: string): VectorSearchManager;
//# sourceMappingURL=search.d.ts.map