/**
 * WhatsApp-Orchestrator Bridge
 *
 * Routes messages between WhatsApp and the Crewly orchestrator,
 * enabling mobile control of AI teams via WhatsApp.
 *
 * @module services/whatsapp/bridge
 */
import { EventEmitter } from 'events';
import type { MessageQueueService } from '../messaging/message-queue.service.js';
/**
 * Bridge configuration
 */
export interface WhatsAppBridgeConfig {
    /** Orchestrator session name */
    orchestratorSession: string;
    /** Maximum response length before truncation */
    maxResponseLength: number;
    /** Response timeout in ms */
    responseTimeoutMs: number;
}
/**
 * WhatsAppOrchestratorBridge class
 *
 * Routes messages between WhatsApp and the Crewly orchestrator.
 * Mirrors the SlackOrchestratorBridge pattern with WhatsApp-specific handling.
 *
 * @example
 * ```typescript
 * const bridge = getWhatsAppOrchestratorBridge();
 * await bridge.initialize();
 * ```
 */
export declare class WhatsAppOrchestratorBridge extends EventEmitter {
    private logger;
    private whatsappService;
    private chatV2;
    private messageQueueService;
    private config;
    private initialized;
    private boundMessageHandler;
    /**
     * Create a new WhatsAppOrchestratorBridge
     *
     * @param config - Partial configuration to override defaults
     */
    constructor(config?: Partial<WhatsAppBridgeConfig>);
    /**
     * Initialize the bridge.
     * Sets up message listeners for WhatsApp incoming messages.
     */
    initialize(): Promise<void>;
    /**
     * Check if bridge is initialized
     *
     * @returns True if initialized
     */
    isInitialized(): boolean;
    /**
     * Set the message queue service for enqueuing messages to the orchestrator.
     *
     * @param service - The MessageQueueService instance
     */
    setMessageQueueService(service: MessageQueueService): void;
    /**
     * Get current configuration
     *
     * @returns A copy of the current configuration
     */
    getConfig(): WhatsAppBridgeConfig;
    /**
     * Handle incoming WhatsApp message.
     * Routes the message to the orchestrator and sends the response back.
     *
     * @param message - Incoming WhatsApp message
     */
    private handleWhatsAppMessage;
    /**
     * Send message to orchestrator via the message queue and wait for response.
     *
     * @param message - Message text to send
     * @param context - Conversation context
     * @returns Orchestrator response or offline/error message
     */
    private sendToOrchestrator;
    /**
     * Route a message to the Auditor agent as a fallback when the orchestrator is offline.
     *
     * Enqueues the message targeting the Auditor's session so the queue processor
     * delivers it to the Auditor PTY. Includes source context for the Auditor.
     *
     * @param message - Original user message
     * @param context - WhatsApp conversation context
     * @returns Acknowledgement message to the user
     */
    private sendToAuditorFallback;
    /**
     * Cleanup bridge resources.
     * Removes only this bridge's event listener and resets initialization state.
     */
    cleanup(): void;
    /**
     * Send a text response back to a WhatsApp chat.
     *
     * @param chatId - Destination chat JID
     * @param text - Response text
     */
    sendWhatsAppResponse(chatId: string, text: string): Promise<void>;
}
/**
 * Get WhatsApp bridge singleton
 *
 * @returns WhatsAppOrchestratorBridge instance
 */
export declare function getWhatsAppOrchestratorBridge(): WhatsAppOrchestratorBridge;
/**
 * Reset WhatsApp bridge singleton (for testing)
 */
export declare function resetWhatsAppOrchestratorBridge(): void;
//# sourceMappingURL=whatsapp-orchestrator-bridge.d.ts.map