/**
 * Vector Search
 *
 * Provides vector similarity search using sqlite-vss extension.
 * Falls back to brute-force cosine similarity if sqlite-vss is not available.
 */
import { SqliteDatabase } from '../db/sqlite-adapter';
import { Node } from '../types';
import { SqliteVssLoadablePaths } from './sqlite-vss-probe';
/**
 * 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?: Node['kind'][];
}
/**
 * Vector Search Manager
 *
 * Handles vector storage and similarity search for semantic code search.
 */
export declare class VectorSearchManager {
    private db;
    private vssEnabled;
    private embeddingDimension;
    private vssLoadablePaths?;
    private currentModel?;
    constructor(db: SqliteDatabase, dimension?: number, vssLoadablePaths?: SqliteVssLoadablePaths, currentModel?: string);
    /**
     * Initialize vector search
     *
     * Attempts to load sqlite-vss extension. Falls back to brute-force
     * search if the extension is not available.
     */
    initialize(): Promise<void>;
    /**
     * If `vectors` contains any rows tagged with a model other than the
     * currently configured one, drop the VSS tables (if present) and clear
     * the BLOB store. `VectorManager.embedAllNodes()` will then re-embed
     * everything on the next sync.
     */
    private clearIfModelChanged;
    /**
     * Load the sqlite-vss extension
     */
    private loadVssExtension;
    /**
     * Create the VSS virtual table for vector search. Dimension is baked into
     * the virtual table at CREATE time; the model-change wipe in
     * `clearIfModelChanged()` guarantees we never see a stale `vss_vectors`
     * at a different dimension by the time we get here.
     */
    private createVssTable;
    /**
     * Ensure the basic vectors table exists (for fallback mode)
     */
    private ensureVectorsTable;
    /**
     * Check if VSS extension is enabled
     */
    isVssEnabled(): boolean;
    /**
     * Store a vector embedding for a node
     *
     * @param nodeId - ID of the node
     * @param embedding - Vector embedding
     * @param model - Model used to generate embedding
     */
    storeVector(nodeId: string, embedding: Float32Array, model: string, contentHash?: string): void;
    /**
     * Store vector in VSS virtual table
     */
    private storeInVss;
    /**
     * Store multiple vectors in a batch
     *
     * @param entries - Array of node IDs and embeddings
     * @param model - Model used to generate embeddings
     */
    storeVectorBatch(entries: Array<{
        nodeId: string;
        embedding: Float32Array;
        contentHash?: string;
    }>, model: string): void;
    /**
     * Get vector for a node
     *
     * @param nodeId - ID of the node
     * @returns Embedding or null if not found
     */
    getVector(nodeId: string): Float32Array | null;
    /**
     * Delete vector for a node
     *
     * @param nodeId - ID of the node
     */
    deleteVector(nodeId: string): void;
    /**
     * Search for similar vectors
     *
     * @param queryEmbedding - Query vector to search for
     * @param options - Search options
     * @returns Array of node IDs with similarity scores
     */
    search(queryEmbedding: Float32Array, options?: VectorSearchOptions): Array<{
        nodeId: string;
        score: number;
    }>;
    /**
     * Search using sqlite-vss KNN search
     */
    private searchWithVss;
    /**
     * Brute-force search using cosine similarity
     */
    private searchBruteForce;
    /**
     * Get count of stored vectors
     */
    getVectorCount(): number;
    /**
     * Check if a node has a vector
     */
    hasVector(nodeId: string): boolean;
    /**
     * Check if a node has a vector matching the current embedded text.
     */
    hasCurrentVector(nodeId: string, model: string, contentHash: string): boolean;
    /**
     * Get all node IDs that have vectors
     */
    getIndexedNodeIds(): string[];
    /**
     * Delete vectors whose node no longer exists.
     */
    deleteStaleVectors(): number;
    /**
     * Clear all vectors
     */
    clear(): void;
    /**
     * Rebuild VSS index from vectors table
     *
     * Useful after bulk operations or if VSS index gets out of sync.
     */
    rebuildVssIndex(): void;
}
/**
 * Create a vector search manager
 */
export declare function createVectorSearch(db: SqliteDatabase, dimension?: number, vssLoadablePaths?: SqliteVssLoadablePaths, currentModel?: string): VectorSearchManager;
//# sourceMappingURL=search.d.ts.map