/** * Gateway initialization for Discord, Slack, and Telegram. * * Extracted from cli/commands/start.ts to keep the orchestrator thin. * All logic and function signatures are unchanged. * * Responsibilities: * 1. Creates `gateways` array for cleanup tracking * 2. Constructs `gatewayMultiAgentConfig` and `gatewayMultiAgentRuntime` objects * 3. Initializes Discord gateway (if config.discord enabled): * - Normalizes guild config via normalizeDiscordGuilds() * - Creates DiscordGateway instance * - Creates gatewayInterface object with sendMessage/sendFile/sendImage * - Calls agentLoop.setDiscordGateway(gatewayInterface) * - Wires multi-agent handler's gateway tool executor * - Calls discordGateway.start() * 4. Initializes Slack gateway (if config.slack enabled): * - Creates SlackGateway instance * - Creates slackGatewayInterface * - Calls toolExecutor.setSlackGateway(slackGatewayInterface) * - Calls slackGateway.start() * 5. Initializes Telegram gateway (if config.telegram enabled): * - Creates TelegramGateway instance * - Wires toolExecutor.setTelegramGateway() and agentLoop.setTelegramGateway() * - Calls telegramGateway.start() */ import type { MAMAConfig } from '../config/types.js'; import { AgentLoop } from '../../agent/index.js'; import { GatewayToolExecutor } from '../../agent/gateway-tool-executor.js'; import type { SQLiteDatabase } from '../../sqlite.js'; import { DiscordGateway, SlackGateway, TelegramGateway, MessageRouter } from '../../gateways/index.js'; /** * Result returned by initGateways. */ export interface GatewayInitResult { discordGateway: DiscordGateway | null; slackGateway: SlackGateway | null; telegramGateway: TelegramGateway | null; gateways: Array<{ stop: () => Promise; }>; } /** * Initialize Discord, Slack, and Telegram gateways. * * Reads config, creates gateway instances, wires them to the agent loop * and tool executor, and starts each enabled gateway. */ export declare function initGateways(config: MAMAConfig, messageRouter: MessageRouter, toolExecutor: GatewayToolExecutor, agentLoop: AgentLoop, runtimeBackend: 'claude' | 'codex' | 'codex-mcp', db: SQLiteDatabase): Promise; //# sourceMappingURL=gateway-init.d.ts.map