/**
 * Semantic Search for Conversation History
 *
 * Provides intelligent search through conversation history:
 * - Keyword matching with ranking
 * - Fuzzy search
 * - Context-aware results
 * - Time-based filtering
 */
export interface ConversationMessage {
    id: string;
    role: 'user' | 'assistant' | 'system';
    content: string;
    timestamp: Date;
    sessionId: string;
    metadata?: {
        tools?: string[];
        files?: string[];
        tokens?: number;
    };
}
export interface SearchResult {
    message: ConversationMessage;
    score: number;
    highlights: string[];
    matchType: 'exact' | 'fuzzy' | 'semantic';
}
export interface SearchOptions {
    /** Maximum results to return */
    limit?: number;
    /** Minimum score threshold (0-1) */
    minScore?: number;
    /** Filter by role */
    role?: 'user' | 'assistant' | 'system';
    /** Filter by session ID */
    sessionId?: string;
    /** Filter by date range */
    dateRange?: {
        from?: Date;
        to?: Date;
    };
    /** Include context (messages before/after) */
    contextSize?: number;
    /** Enable fuzzy matching */
    fuzzyMatch?: boolean;
    /** Search in specific fields */
    searchFields?: ('content' | 'tools' | 'files')[];
}
/**
 * Semantic Search Engine
 */
export declare class SemanticSearchEngine {
    private messages;
    private indexPath;
    private wordIndex;
    private stopWords;
    constructor(indexPath?: string);
    /**
     * Add message to index
     */
    addMessage(message: ConversationMessage): void;
    /**
     * Add multiple messages
     */
    addMessages(messages: ConversationMessage[]): void;
    /**
     * Trim messages if exceeding max limit.
     * Removes oldest messages and rebuilds index.
     */
    private trimIfNeeded;
    /**
     * Trim word index entries to prevent unbounded growth.
     * Keeps only the most recent message IDs for each word.
     */
    private trimWordIndex;
    /**
     * Get memory statistics for monitoring
     */
    getMemoryStats(): {
        messageCount: number;
        maxMessages: number;
        indexSize: number;
        indexMemoryEstimate: string;
    };
    /**
     * Search conversation history
     */
    search(query: string, options?: SearchOptions): SearchResult[];
    /**
     * Search by similarity to a message
     */
    findSimilar(messageId: string, limit?: number): SearchResult[];
    /**
     * Get recent messages
     */
    getRecent(limit?: number): ConversationMessage[];
    /**
     * Get messages by session
     */
    getBySession(sessionId: string): ConversationMessage[];
    /**
     * Get statistics
     */
    getStats(): {
        totalMessages: number;
        totalSessions: number;
        indexedWords: number;
        oldestMessage?: Date;
        newestMessage?: Date;
    };
    /**
     * Clear index
     */
    clear(): void;
    /**
     * Remove old messages
     */
    pruneOlderThan(days: number): number;
    /**
     * Format search results
     */
    formatResults(results: SearchResult[]): string;
    /**
     * Index a message
     */
    private indexMessage;
    /**
     * Rebuild entire index
     */
    private rebuildIndex;
    /**
     * Find candidate messages using index
     */
    private findCandidates;
    /**
     * Score a message against query
     */
    private scoreMessage;
    /**
     * Fuzzy match two terms
     */
    private fuzzyMatch;
    /**
     * Tokenize text into searchable terms
     */
    private tokenize;
    /**
     * Add context messages to results
     */
    private addContext;
    /**
     * Load index from file
     */
    private loadIndex;
    /**
     * Save index to file
     */
    private saveIndex;
}
/**
 * Get or create semantic search engine
 */
export declare function getSemanticSearchEngine(): SemanticSearchEngine;
/**
 * Quick search helper
 */
export declare function searchHistory(query: string, options?: SearchOptions): SearchResult[];
export default SemanticSearchEngine;
