/**
 * Enhanced Search Module
 *
 * High-performance code search using bundled ripgrep binary.
 * Features:
 * - Streaming search with real-time results
 * - Symbol search (functions, classes, interfaces)
 * - Reference search (find all usages)
 * - Context-aware results with surrounding lines
 * - Smart LRU caching
 *
 * Uses @vscode/ripgrep for bundled binary (no system dependency)
 */
import { ChildProcess } from 'child_process';
import { EventEmitter } from 'events';
export interface SearchMatch {
    file: string;
    line: number;
    column: number;
    text: string;
    match: string;
    contextBefore?: string[];
    contextAfter?: string[];
}
export interface SymbolMatch {
    name: string;
    type: 'function' | 'class' | 'interface' | 'type' | 'const' | 'variable' | 'method' | 'property';
    file: string;
    line: number;
    signature?: string;
    exported: boolean;
}
export interface SearchOptions {
    caseSensitive?: boolean;
    wholeWord?: boolean;
    regex?: boolean;
    maxResults?: number;
    includeGlob?: string[];
    excludeGlob?: string[];
    fileTypes?: string[];
    contextLines?: number;
    includeHidden?: boolean;
    followSymlinks?: boolean;
    timeout?: number;
}
export interface StreamingSearchOptions extends SearchOptions {
    onMatch?: (match: SearchMatch) => void;
    onProgress?: (filesSearched: number, matchCount: number) => void;
    onComplete?: (results: SearchMatch[], stats: SearchStats) => void;
    onError?: (error: Error) => void;
}
export interface SearchStats {
    filesSearched: number;
    matchCount: number;
    duration: number;
    cached: boolean;
}
export interface SymbolSearchOptions {
    types?: SymbolMatch['type'][];
    exportedOnly?: boolean;
    includeGlob?: string[];
    excludeGlob?: string[];
}
export declare class EnhancedSearch extends EventEmitter {
    private workdir;
    private cache;
    private symbolCache;
    private activeProcesses;
    constructor(workdir?: string);
    /**
     * Set working directory
     */
    setWorkdir(dir: string): void;
    /**
     * Get the ripgrep binary path (bundled)
     */
    getRipgrepPath(): string;
    /**
     * Stream search results in real-time
     * Emits 'match', 'progress', 'complete', 'error' events
     */
    streamSearch(query: string, options?: StreamingSearchOptions): ChildProcess;
    /**
     * Standard search with Promise API (uses cache)
     */
    search(query: string, options?: SearchOptions): Promise<{
        results: SearchMatch[];
        stats: SearchStats;
    }>;
    /**
     * Find symbols (functions, classes, interfaces, etc.)
     * Uses simple keyword search + post-processing for reliability
     */
    findSymbols(name: string, options?: SymbolSearchOptions): Promise<SymbolMatch[]>;
    /**
     * Detect symbol type from code line
     */
    private detectSymbolType;
    /**
     * Parse symbol from search result (simple approach)
     */
    private parseSymbolSimple;
    /**
     * Find all references to a symbol
     */
    findReferences(symbolName: string, options?: SearchOptions): Promise<SearchMatch[]>;
    /**
     * Find definition of a symbol
     */
    findDefinition(symbolName: string): Promise<SymbolMatch | null>;
    /**
     * Search for multiple patterns at once
     */
    searchMultiple(patterns: string[], options?: SearchOptions & {
        operator?: 'OR' | 'AND';
    }): Promise<Map<string, SearchMatch[]>>;
    /**
     * Cancel all active searches
     */
    cancelAll(): void;
    /**
     * Clear caches
     */
    clearCache(): void;
    /**
     * Get cache statistics
     */
    getCacheStats(): {
        searchCache: number;
        symbolCache: number;
    };
    private buildRipgrepArgs;
    private parseMatchData;
    private parseSymbol;
    private deduplicateSymbols;
    private getGlobsForLanguage;
    private createCacheKey;
}
export declare function getEnhancedSearch(workdir?: string): EnhancedSearch;
export declare function resetEnhancedSearch(): void;
