/**
 * OpenClaw-inspired 2-Step Memory Search System
 *
 * Workflow:
 * 1. Semantic search to find relevant content
 * 2. Targeted retrieval to minimize token usage
 *
 * Features:
 * - Semantic similarity scoring
 * - File-based memory storage
 * - Configurable minScore and maxResults
 * - Context-efficient retrieval
 */
import { EventEmitter } from 'events';
export interface MemoryEntry {
    id: string;
    content: string;
    metadata: {
        source: string;
        path: string;
        lineStart: number;
        lineEnd: number;
        timestamp: Date;
        tags?: string[];
        importance?: number;
    };
    embedding?: number[];
}
export interface SearchResult {
    entry: MemoryEntry;
    score: number;
    matchedTerms: string[];
    snippet: string;
}
export interface SearchOptions {
    maxResults?: number;
    minScore?: number;
    tags?: string[];
    sources?: string[];
    dateRange?: {
        start?: Date;
        end?: Date;
    };
}
export interface RetrievalOptions {
    from?: number;
    lines?: number;
    context?: number;
}
export interface RetrievalResult {
    content: string;
    path: string;
    lineStart: number;
    lineEnd: number;
    totalLines: number;
}
export interface MemorySearchConfig {
    memoryDir: string;
    indexFile?: string;
    maxMemorySize?: number;
    embeddingProvider?: 'local' | 'openai' | 'none';
}
export declare class SemanticMemorySearch extends EventEmitter {
    private config;
    private index;
    private invertedIndex;
    private loaded;
    constructor(config?: Partial<MemorySearchConfig>);
    /**
     * Initialize and load the memory index
     */
    initialize(): Promise<void>;
    /**
     * Step 1: Semantic search across memory
     */
    search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
    /**
     * Step 2: Targeted retrieval from file
     */
    retrieve(filePath: string, options?: RetrievalOptions): Promise<RetrievalResult>;
    /**
     * Add a memory entry
     */
    add(content: string, metadata: Partial<MemoryEntry['metadata']>): Promise<string>;
    /**
     * Remove a memory entry
     */
    remove(id: string): Promise<boolean>;
    /**
     * Update a memory entry
     */
    update(id: string, content: string, metadata?: Partial<MemoryEntry['metadata']>): Promise<boolean>;
    /**
     * Load the index from disk
     */
    private loadIndex;
    /**
     * Save the index to disk
     */
    private saveIndex;
    /**
     * Scan memory directory for markdown files
     */
    private scanMemoryFiles;
    /**
     * Find all markdown files recursively
     */
    private findMarkdownFiles;
    /**
     * Index an entry in the inverted index
     */
    private indexEntry;
    /**
     * Tokenize text into terms
     */
    private tokenize;
    /**
     * Check if a term is a stop word
     */
    private isStopWord;
    /**
     * Calculate relevance score
     */
    private calculateScore;
    /**
     * Extract a relevant snippet from content
     */
    private extractSnippet;
    /**
     * Generate a unique ID
     */
    private generateId;
    /**
     * Get statistics
     */
    getStats(): {
        totalEntries: number;
        totalTerms: number;
        sources: Record<string, number>;
        avgEntryLength: number;
    };
    /**
     * Clear all memory
     */
    clear(): Promise<void>;
}
export declare function getSemanticMemorySearch(config?: Partial<MemorySearchConfig>): SemanticMemorySearch;
export declare function resetSemanticMemorySearch(): void;
/**
 * Convenience: Search and retrieve in one call
 */
export declare function searchAndRetrieve(query: string, options?: SearchOptions & {
    retrieveLines?: number;
}): Promise<Array<{
    result: SearchResult;
    content: string;
}>>;
