/**
 * Multi-Path Code Retrieval System
 *
 * Based on CodeRAG paper (arXiv 2509.16112):
 * - Log probability-guided query construction
 * - Multiple retrieval paths for better coverage
 * - Preference-aligned reranking
 * - 40-60% improvement in exact match
 *
 * Also incorporates RepoFuse dual context fusion:
 * - Code analogies (similar code patterns)
 * - Semantic relationships (related concepts)
 */
import { EventEmitter } from 'events';
export interface CodeChunk {
    id: string;
    filePath: string;
    content: string;
    startLine: number;
    endLine: number;
    type: 'function' | 'class' | 'module' | 'block' | 'file';
    symbols: string[];
    dependencies: string[];
    embedding?: number[];
    score?: number;
}
export interface RetrievalQuery {
    text: string;
    type: 'semantic' | 'lexical' | 'hybrid';
    filters?: {
        filePatterns?: string[];
        symbolTypes?: string[];
        maxResults?: number;
    };
}
export interface RetrievalPath {
    name: string;
    queryTransform: (query: string, context?: QueryContext) => string;
    weight: number;
}
export interface QueryContext {
    currentFile?: string;
    cursorPosition?: {
        line: number;
        column: number;
    };
    recentFiles?: string[];
    errorMessage?: string;
    taskType?: 'completion' | 'repair' | 'refactor' | 'understand';
}
export interface RetrievalResult {
    chunks: CodeChunk[];
    paths: Array<{
        name: string;
        results: CodeChunk[];
        queryUsed: string;
    }>;
    fusedContext: string;
    tokensUsed: number;
}
export interface MultiPathConfig {
    resultsPerPath: number;
    totalResults: number;
    enableReranking: boolean;
    rerankingModel?: string;
    enableCache: boolean;
    cacheTTL: number;
    minSimilarity: number;
}
export declare class MultiPathRetrieval extends EventEmitter {
    private config;
    private paths;
    private cache;
    private codeIndex;
    constructor(config?: Partial<MultiPathConfig>);
    /**
     * Perform multi-path retrieval
     */
    retrieve(query: string, context?: QueryContext): Promise<RetrievalResult>;
    /**
     * Execute a single retrieval path
     */
    private executePath;
    /**
     * Fuse results from multiple paths using reciprocal rank fusion
     */
    private fuseResults;
    /**
     * Rerank results based on relevance
     */
    private rerank;
    /**
     * Build fused context string from chunks
     */
    private buildFusedContext;
    /**
     * Index a code file
     */
    indexFile(filePath: string): Promise<void>;
    /**
     * Index a directory
     */
    indexDirectory(dirPath: string, patterns?: string[]): Promise<void>;
    /**
     * Extract code chunks from file content
     */
    private extractChunks;
    /**
     * Extract symbols from code
     */
    private extractSymbols;
    /**
     * Extract dependencies from code
     */
    private extractDependencies;
    /**
     * Find files matching patterns
     */
    private findFiles;
    /**
     * Simple glob matching
     */
    private matchGlob;
    /**
     * Get cache key
     */
    private getCacheKey;
    /**
     * Estimate tokens
     */
    private estimateTokens;
    /**
     * Add custom retrieval path
     */
    addPath(path: RetrievalPath): void;
    /**
     * Clear cache
     */
    clearCache(): void;
    /**
     * Clear index
     */
    clearIndex(): void;
    /**
     * Get index statistics
     */
    getIndexStats(): {
        files: number;
        chunks: number;
        totalTokens: number;
    };
    /**
     * Dispose resources and cleanup
     */
    dispose(): void;
}
export declare function getMultiPathRetrieval(config?: Partial<MultiPathConfig>): MultiPathRetrieval;
export declare function resetMultiPathRetrieval(): void;
