/**
 * Realtime Voice API Infrastructure
 *
 * Base handler and processor for realtime voice communication.
 * Supports bidirectional audio streaming with providers like OpenAI and Gemini.
 *
 * @module voice/RealtimeVoiceAPI
 */
import type { TTSAudioFormat, RealtimeAudioChunk, RealtimeConfig, RealtimeEventHandlers, RealtimeHandler, RealtimeSession, RealtimeSessionState } from "../types/index.js";
/**
 * Realtime Processor class for orchestrating realtime voice operations
 *
 * Provides a unified interface for realtime voice across multiple providers.
 *
 * @example
 * ```typescript
 * // Register a handler (typically done in providerRegistry.ts on startup)
 * RealtimeProcessor.registerHandler('openai-realtime', openaiHandler);
 *
 * // Connect to a session — the first arg is the registered handler key,
 * // and `config.provider` must match the same key.
 * const session = await RealtimeProcessor.connect('openai-realtime', {
 *   provider: 'openai-realtime',
 *   voice: 'alloy',
 *   systemPrompt: 'You are a helpful assistant.'
 * });
 *
 * // Send audio
 * await RealtimeProcessor.sendAudio('openai-realtime', audioBuffer);
 *
 * // Disconnect
 * await RealtimeProcessor.disconnect('openai-realtime');
 * ```
 */
export declare class RealtimeProcessor {
    /**
     * Handler registry mapping provider names to Realtime handlers
     */
    private static readonly handlers;
    /**
     * Active sessions by provider
     */
    private static readonly sessions;
    /**
     * Register a Realtime handler for a specific provider
     *
     * @param providerName - Provider identifier (e.g., 'openai', 'gemini')
     * @param handler - Realtime handler implementation
     */
    static registerHandler(providerName: string, handler: RealtimeHandler): void;
    /**
     * Get a registered Realtime handler by provider name.
     *
     * Exposed publicly so module-level auto-registration code can reuse an
     * already-registered primary handler when backfilling its aliases.
     */
    static getHandler(providerName: string): RealtimeHandler | undefined;
    /**
     * Check if a provider is supported
     */
    static supports(providerName: string): boolean;
    /**
     * Get list of all registered providers
     */
    static getProviders(): string[];
    /**
     * Connect to a realtime session
     *
     * @param provider - Provider identifier
     * @param config - Session configuration
     * @param handlers - Event handlers
     * @returns Session information
     */
    static connect(provider: string, config: RealtimeConfig, handlers?: RealtimeEventHandlers): Promise<RealtimeSession>;
    /**
     * Disconnect from a realtime session
     *
     * @param provider - Provider identifier
     */
    static disconnect(provider: string): Promise<void>;
    /**
     * Send audio to a realtime session
     *
     * @param provider - Provider identifier
     * @param audio - Audio data
     */
    static sendAudio(provider: string, audio: Buffer | RealtimeAudioChunk): Promise<void>;
    /**
     * Send text to a realtime session
     *
     * @param provider - Provider identifier
     * @param text - Text to send
     */
    static sendText(provider: string, text: string): Promise<void>;
    /**
     * Trigger a response from the model (manual turn detection)
     *
     * @param provider - Provider identifier
     */
    static triggerResponse(provider: string): Promise<void>;
    /**
     * Cancel the current response
     *
     * @param provider - Provider identifier
     */
    static cancelResponse(provider: string): Promise<void>;
    /**
     * Get current session for a provider
     *
     * @param provider - Provider identifier
     * @returns Session or null
     */
    static getSession(provider: string): RealtimeSession | null;
    /**
     * Check if a provider has an active session
     *
     * @param provider - Provider identifier
     */
    static isConnected(provider: string): boolean;
    /**
     * Get supported formats for a provider
     *
     * @param provider - Provider identifier
     */
    static getSupportedFormats(provider: string): TTSAudioFormat[];
    /**
     * Clear all handlers and sessions (for testing)
     */
    static clearHandlers(): void;
}
/**
 * Base Realtime Handler with common functionality
 *
 * Providers can extend this class for common behavior.
 */
export declare abstract class BaseRealtimeHandler implements RealtimeHandler {
    abstract readonly name: RealtimeConfig["provider"];
    protected session: RealtimeSession | null;
    protected eventHandlers: RealtimeEventHandlers | null;
    protected state: RealtimeSessionState;
    abstract connect(config: RealtimeConfig): Promise<RealtimeSession>;
    abstract disconnect(): Promise<void>;
    abstract sendAudio(audio: Buffer | RealtimeAudioChunk): Promise<void>;
    abstract isConfigured(): boolean;
    abstract getSupportedFormats(): TTSAudioFormat[];
    isConnected(): boolean;
    getSession(): RealtimeSession | null;
    on(handlers: RealtimeEventHandlers): void;
    off(): void;
    /**
     * Emit state change event
     */
    protected emitStateChange(newState: RealtimeSessionState): void;
    /**
     * Emit audio event
     */
    protected emitAudio(chunk: RealtimeAudioChunk): void;
    /**
     * Emit transcript event
     */
    protected emitTranscript(text: string, isFinal: boolean): void;
    /**
     * Emit text event
     */
    protected emitText(text: string, isFinal: boolean): void;
    /**
     * Emit function call event
     */
    protected emitFunctionCall(name: string, args: Record<string, unknown>): Promise<unknown>;
    /**
     * Emit error event
     */
    protected emitError(error: Error): void;
    /**
     * Emit turn start event
     */
    protected emitTurnStart(): void;
    /**
     * Emit turn end event
     */
    protected emitTurnEnd(): void;
    /**
     * Create a session object
     */
    protected createSession(id: string, config: RealtimeConfig): RealtimeSession;
}
