/**
 * Web Search Grounding
 *
 * Provides real-time web search capabilities for AI responses:
 * - Search engine integration (DuckDuckGo, Brave, Google)
 * - Result extraction and summarization
 * - Source citation
 * - Knowledge grounding
 *
 * Inspired by Gemini CLI's web search grounding feature.
 */
import { EventEmitter } from 'events';
export type SearchEngine = 'duckduckgo' | 'brave' | 'google' | 'searx' | 'auto';
export interface SearchResult {
    title: string;
    url: string;
    snippet: string;
    source: string;
    publishedDate?: string;
    relevanceScore?: number;
}
export interface SearchResponse {
    query: string;
    engine: SearchEngine;
    results: SearchResult[];
    totalResults?: number;
    searchTime: number;
    timestamp: number;
}
export interface WebSearchConfig {
    /** Preferred search engine */
    engine: SearchEngine;
    /** Maximum results per search */
    maxResults: number;
    /** Include source citations */
    includeCitations: boolean;
    /** Safe search level */
    safeSearch: 'off' | 'moderate' | 'strict';
    /** API keys */
    apiKeys: {
        brave?: string;
        google?: string;
        googleCx?: string;
        searxInstance?: string;
    };
    /** Cache settings */
    cache: {
        enabled: boolean;
        ttl: number;
    };
    /** Timeout in ms */
    timeout: number;
}
export interface GroundingContext {
    query: string;
    results: SearchResult[];
    summary: string;
    citations: string[];
    confidence: number;
}
export declare class WebSearchManager extends EventEmitter {
    private config;
    private cache;
    constructor(config?: Partial<WebSearchConfig>);
    /**
     * Perform web search
     */
    search(query: string, options?: Partial<{
        engine: SearchEngine;
        maxResults: number;
    }>): Promise<SearchResponse>;
    /**
     * Get grounding context for a query
     */
    getGroundingContext(query: string): Promise<GroundingContext>;
    /**
     * Search and format for AI context
     */
    searchForContext(query: string): Promise<string>;
    /**
     * Clear search cache
     */
    clearCache(): void;
    /**
     * Format search status
     */
    formatStatus(): string;
    /**
     * Dispose resources and cleanup
     */
    dispose(): void;
    private searchDuckDuckGo;
    private parseDuckDuckGoResults;
    private cleanDuckDuckGoUrl;
    private searchBrave;
    private searchGoogle;
    private searchSearx;
    private searchWithFallback;
    private searchByEngine;
    private generateSummary;
    private calculateConfidence;
    private decodeHtml;
    private httpGet;
}
export declare function getWebSearchManager(config?: Partial<WebSearchConfig>): WebSearchManager;
export declare function resetWebSearchManager(): void;
