/**
 * Chat Gateway Module
 *
 * Integrates chat functionality with the WebSocket infrastructure.
 * Forwards chat events from ChatService to connected clients.
 *
 * @module websocket/chat.gateway
 */
import { Server as SocketIOServer } from 'socket.io';
import type { ChatMessage, ChatSender } from '../types/chat.types.js';
/**
 * Chat Gateway class for WebSocket-based chat messaging.
 *
 * Provides:
 * - Real-time chat message broadcasting
 * - Typing indicator support
 * - Conversation update notifications
 * - Terminal output to chat message processing
 */
export declare class ChatGateway {
    private io;
    private logger;
    private chatV2;
    private initialized;
    /**
     * Create a new ChatGateway.
     *
     * @param io - Socket.IO server instance
     */
    constructor(io: SocketIOServer);
    /**
     * Initialize the chat gateway.
     *
     * Subscribes to chat-v2 message events and wires the
     * client-facing WebSocket handlers.
     */
    initialize(): Promise<void>;
    /**
     * Subscribe to ChatV2Service events and broadcast to WebSocket clients.
     * Phase 6c of the unified-chat-message-store spec — replaces the
     * legacy ChatService EventEmitter wiring.
     */
    private setupChatV2Listeners;
    /**
     * Set up WebSocket event handlers for chat-specific events.
     */
    private setupWebSocketHandlers;
    /**
     * Broadcast a message to all clients in the chat room.
     *
     * @param event - Event name
     * @param message - Message to broadcast
     */
    private broadcast;
    /**
     * Broadcast a message to a specific conversation room.
     *
     * @param conversationId - Conversation ID
     * @param event - Event name
     * @param message - Message to broadcast
     */
    private broadcastToConversation;
    /**
     * Process terminal output and convert to chat message if applicable.
     *
     * Checks for response markers in terminal output and creates
     * chat messages from extracted content.
     *
     * @param sessionId - The session/agent ID that produced the output
     * @param output - Raw terminal output
     * @param conversationId - Target conversation ID
     * @returns The created chat message, or null if no response marker found
     */
    processTerminalOutput(sessionId: string, output: string, conversationId?: string): Promise<ChatMessage | null>;
    /**
     * Process a unified [NOTIFY] message and add it directly to a conversation.
     *
     * Unlike `processTerminalOutput`, this method takes pre-extracted content
     * from a [NOTIFY] payload — no regex extraction needed. Optional metadata
     * (e.g. Slack delivery tracking fields) is merged into the message metadata.
     *
     * @param sessionId - The session/agent ID that produced the output
     * @param content - Pre-extracted markdown content from NotifyPayload.message
     * @param conversationId - Target conversation ID
     * @param metadata - Optional additional metadata to attach to the message
     * @returns The created chat message, or null on failure
     */
    processNotifyMessage(sessionId: string, content: string, conversationId: string, metadata?: Record<string, unknown>): Promise<ChatMessage | null>;
    /**
     * Emit a typing indicator for the orchestrator.
     *
     * Call this when the orchestrator starts/stops processing a message.
     *
     * @param conversationId - Conversation ID
     * @param isTyping - Whether the orchestrator is typing
     */
    emitOrchestratorTyping(conversationId: string, isTyping: boolean): void;
    /**
     * Emit a typing indicator for an agent.
     *
     * @param conversationId - Conversation ID
     * @param sender - Agent sender information
     * @param isTyping - Whether the agent is typing
     */
    emitAgentTyping(conversationId: string, sender: ChatSender, isTyping: boolean): void;
    /**
     * Emit a typing indicator via the WebSocket broadcast channel.
     * Phase 6c: typing indicators were previously emitted on the
     * legacy ChatService EventEmitter; with that retired, the gateway
     * sources them directly. Typing is transient and never persisted,
     * so no chat-v2 write is involved.
     *
     * @param conversationId - Conversation ID
     * @param sender - Sender descriptor
     * @param isTyping - Whether the sender is typing
     */
    private broadcastTyping;
    /**
     * Check if the gateway is initialized.
     *
     * @returns True if initialized
     */
    isInitialized(): boolean;
}
/**
 * Initialize the ChatGateway with a Socket.IO server.
 *
 * @param io - Socket.IO server instance
 * @returns The ChatGateway instance
 */
export declare function initializeChatGateway(io: SocketIOServer): Promise<ChatGateway>;
/**
 * Get the ChatGateway instance.
 *
 * @returns The ChatGateway instance or null if not initialized
 */
export declare function getChatGateway(): ChatGateway | null;
/**
 * Reset the ChatGateway instance (for testing).
 */
export declare function resetChatGateway(): void;
//# sourceMappingURL=chat.gateway.d.ts.map