/**
 * Local LLM Providers
 *
 * Native JavaScript/TypeScript LLM providers for offline use:
 * - node-llama-cpp: Native Node.js bindings for llama.cpp
 * - WebLLM: Browser-based LLM with WebGPU
 * - Ollama: HTTP API to local Ollama server
 *
 * These providers allow Grok CLI to function without cloud API dependencies.
 */
import { EventEmitter } from 'events';
export type LocalProviderType = 'ollama' | 'local-llama' | 'webllm';
export interface LocalLLMMessage {
    role: 'system' | 'user' | 'assistant';
    content: string;
}
export interface LocalLLMResponse {
    content: string;
    tokensUsed: number;
    model: string;
    provider: LocalProviderType;
    generationTime: number;
}
export interface LocalProviderConfig {
    model?: string;
    modelPath?: string;
    endpoint?: string;
    maxTokens?: number;
    temperature?: number;
    gpuLayers?: number;
    contextSize?: number;
}
export interface LocalLLMProvider {
    readonly type: LocalProviderType;
    readonly name: string;
    initialize(config: LocalProviderConfig): Promise<void>;
    isReady(): boolean;
    isAvailable(): Promise<boolean>;
    complete(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): Promise<LocalLLMResponse>;
    stream(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): AsyncIterable<string>;
    getModels(): Promise<string[]>;
    dispose(): void;
    on(event: string, listener: (...args: unknown[]) => void): this;
    emit(event: string, ...args: unknown[]): boolean;
}
/**
 * Native Node.js LLM provider using node-llama-cpp
 *
 * Advantages:
 * - No external dependencies (Ollama not required)
 * - Direct C++ bindings = lowest latency
 * - Fine-grained control over model parameters
 * - Supports CUDA, Metal, and CPU inference
 *
 * Usage:
 * ```typescript
 * const provider = new NodeLlamaCppProvider();
 * await provider.initialize({ modelPath: './models/llama-3.1-8b.gguf' });
 * const response = await provider.complete([{ role: 'user', content: 'Hello!' }]);
 * ```
 */
export declare class NodeLlamaCppProvider extends EventEmitter implements LocalLLMProvider {
    readonly type: LocalProviderType;
    readonly name = "node-llama-cpp";
    private config;
    private model;
    private context;
    private ready;
    private modelsDir;
    constructor();
    initialize(config: LocalProviderConfig): Promise<void>;
    isReady(): boolean;
    isAvailable(): Promise<boolean>;
    complete(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): Promise<LocalLLMResponse>;
    stream(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): AsyncIterable<string>;
    getModels(): Promise<string[]>;
    dispose(): void;
}
/**
 * Browser-based LLM provider using WebLLM
 *
 * Advantages:
 * - Runs in browser with WebGPU
 * - Zero server requirements
 * - Can be used in Electron apps
 * - Progressive model download with caching
 *
 * Limitations:
 * - Requires WebGPU support
 * - Not available in pure Node.js (requires browser/Electron)
 *
 * Usage:
 * ```typescript
 * const provider = new WebLLMProvider();
 * await provider.initialize({ model: 'Llama-3.1-8B-Instruct-q4f16_1-MLC' });
 * const response = await provider.complete([{ role: 'user', content: 'Hello!' }]);
 * ```
 */
export declare class WebLLMProvider extends EventEmitter implements LocalLLMProvider {
    readonly type: LocalProviderType;
    readonly name = "WebLLM";
    private config;
    private engine;
    private ready;
    initialize(config: LocalProviderConfig): Promise<void>;
    isReady(): boolean;
    isAvailable(): Promise<boolean>;
    complete(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): Promise<LocalLLMResponse>;
    stream(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): AsyncIterable<string>;
    getModels(): Promise<string[]>;
    dispose(): void;
}
/**
 * Enhanced Ollama provider with better streaming and model management
 *
 * Advantages:
 * - Most mature local LLM solution
 * - Easy model management (pull, list, remove)
 * - Supports many models out of the box
 * - OpenAI-compatible API
 *
 * Usage:
 * ```typescript
 * const provider = new OllamaProvider();
 * await provider.initialize({ model: 'llama3.1', endpoint: 'http://localhost:11434' });
 * const response = await provider.complete([{ role: 'user', content: 'Hello!' }]);
 * ```
 */
export declare class OllamaProvider extends EventEmitter implements LocalLLMProvider {
    readonly type: LocalProviderType;
    readonly name = "Ollama";
    private config;
    private ready;
    private endpoint;
    initialize(config: LocalProviderConfig): Promise<void>;
    isReady(): boolean;
    isAvailable(): Promise<boolean>;
    pullModel(model: string): Promise<void>;
    complete(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): Promise<LocalLLMResponse>;
    stream(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): AsyncIterable<string>;
    getModels(): Promise<string[]>;
    dispose(): void;
}
/**
 * Manager for local LLM providers
 *
 * Handles provider selection, fallback, and unified interface.
 */
export declare class LocalProviderManager extends EventEmitter {
    private providers;
    private activeProvider;
    /**
     * Register and initialize a provider
     */
    registerProvider(type: LocalProviderType, config: LocalProviderConfig): Promise<void>;
    /**
     * Create provider instance
     */
    private createProvider;
    /**
     * Get active provider
     */
    getActiveProvider(): LocalLLMProvider | null;
    /**
     * Set active provider
     */
    setActiveProvider(type: LocalProviderType): void;
    /**
     * Auto-detect best available provider
     */
    autoDetectProvider(): Promise<LocalProviderType | null>;
    /**
     * Complete with active provider (with fallback)
     */
    complete(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): Promise<LocalLLMResponse>;
    /**
     * Stream with active provider
     */
    stream(messages: LocalLLMMessage[], options?: Partial<LocalProviderConfig>): AsyncIterable<string>;
    /**
     * Get all registered providers
     */
    getRegisteredProviders(): LocalProviderType[];
    /**
     * Dispose all providers
     */
    dispose(): void;
}
export declare function getLocalProviderManager(): LocalProviderManager;
export declare function resetLocalProviderManager(): void;
/**
 * Auto-configure best available local provider
 */
export declare function autoConfigureLocalProvider(preferredProvider?: LocalProviderType): Promise<LocalProviderManager>;
