/**
 * Vector Manager
 *
 * High-level manager that coordinates embedding generation and vector search.
 */
import { SqliteDatabase } from '../db/sqlite-adapter';
import { Node, SearchResult, SearchOptions } from '../types';
import { EmbedderOptions } from './embedder';
import { SqliteVssLoadablePaths } from './sqlite-vss-probe';
import { QueryBuilder } from '../db/queries';
/**
 * Progress callback for embedding generation
 */
export interface EmbeddingProgress {
    /** Current node index */
    current: number;
    /** Total nodes to embed */
    total: number;
    /** Current node being embedded */
    nodeName?: string;
    /** Optional status for non-progress updates such as quota waits */
    status?: 'embedding' | 'waiting';
    /** Human-readable detail for the current status */
    detail?: string;
}
/**
 * Options for the vector manager
 */
export interface VectorManagerOptions {
    /** Embedder options */
    embedder?: EmbedderOptions;
    /** Node kinds to embed (default: functions, methods, classes, interfaces) */
    nodeKinds?: Node['kind'][];
    /** Batch size for embedding generation */
    batchSize?: number;
    /** Init-probed sqlite-vss extension paths for ANN search */
    sqliteVssLoadablePaths?: SqliteVssLoadablePaths;
    /**
     * Project root, used to read each node's source body for embedding. When
     * omitted, embeddings fall back to metadata-only — back-compat for callers
     * that don't have a project root handy.
     */
    projectRoot?: string;
}
/**
 * Vector Manager
 *
 * Provides high-level interface for semantic search:
 * - Generates embeddings for code nodes
 * - Stores embeddings in the database
 * - Performs semantic similarity search
 */
export declare class VectorManager {
    private embedder;
    private searchManager;
    private queries;
    private nodeKinds;
    private batchSize;
    private projectRoot;
    private initialized;
    constructor(db: SqliteDatabase, queries: QueryBuilder, options?: VectorManagerOptions);
    /**
     * Read a node's source body from disk. Returns undefined when projectRoot
     * isn't set, the path escapes the root, the file can't be read, or the node
     * has no line range — caller falls back to metadata-only embedding text.
     *
     * Uses the per-call fileCache so a 50-method class reads its file once
     * instead of 50 times.
     */
    private getNodeBody;
    /**
     * Initialize the vector manager
     *
     * Validates embedding configuration and initializes vector search.
     */
    initialize(): Promise<void>;
    /**
     * Check if the vector manager is initialized
     */
    isInitialized(): boolean;
    /**
     * Generate embeddings for all eligible nodes
     *
     * @param onProgress - Optional progress callback
     * @returns Number of nodes embedded
     */
    embedAllNodes(onProgress?: (progress: EmbeddingProgress) => void): Promise<number>;
    /**
     * Generate embedding for a single node
     *
     * @param node - Node to embed
     */
    embedNode(node: Node): Promise<void>;
    /**
     * Semantic search for nodes matching a query
     *
     * @param query - Natural language query
     * @param options - Search options
     * @returns Array of search results with similarity scores
     */
    search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
    /**
     * Find nodes similar to a given node
     *
     * @param nodeId - ID of the node to find similar nodes for
     * @param options - Search options
     * @returns Array of similar nodes with similarity scores
     */
    findSimilar(nodeId: string, options?: SearchOptions): Promise<SearchResult[]>;
    /**
     * Delete embedding for a node
     *
     * @param nodeId - ID of the node
     */
    deleteNodeEmbedding(nodeId: string): void;
    /**
     * Get statistics about vector storage
     */
    getStats(): {
        totalVectors: number;
        vssEnabled: boolean;
        modelId: string;
    };
    /**
     * Clear all vectors
     */
    clear(): void;
    /**
     * Delete vectors for nodes that no longer exist.
     */
    deleteStaleVectors(): number;
    /**
     * Rebuild the VSS index
     */
    rebuildIndex(): void;
    /**
     * Release resources
     */
    dispose(): void;
    private hashText;
    private reportEmbedderStatus;
}
/**
 * Create a vector manager
 */
export declare function createVectorManager(db: SqliteDatabase, queries: QueryBuilder, options?: VectorManagerOptions): VectorManager;
//# sourceMappingURL=manager.d.ts.map