/** * Slack Multi-Bot Manager * * Manages multiple Slack bot clients for multi-agent system. * Each agent with slack_bot_token + slack_app_token gets its own SocketModeClient. * * Mirrors MultiBotManager (Discord) but uses Slack-specific APIs: * - SocketModeClient for real-time events * - WebClient for API calls (chat.postMessage, auth.test) * - bot_id based identification (instead of Discord's author.id) */ import { SocketModeClient } from '@slack/socket-mode'; import { WebClient } from '@slack/web-api'; import type { MultiAgentConfig } from './types.js'; /** * Slack bot instance for an agent */ interface SlackAgentBot { agentId: string; socketClient: SocketModeClient; webClient: WebClient; botToken: string; appToken: string; connected: boolean; userId?: string; botId?: string; botName?: string; } /** * Slack mention event structure */ export interface SlackMentionEvent { type: string; channel: string; user: string; text: string; ts: string; thread_ts?: string; bot_id?: string; channel_type?: string; } /** * Slack Multi-Bot Manager * * Creates and manages multiple Slack bot clients, * one for each agent with dedicated slack_bot_token + slack_app_token. */ export declare class SlackMultiBotManager { private config; private bots; private mainBotUserId; private mainBotId; private mainBotToken; private mainBotAgentId; /** Callback for when an agent bot receives a mention */ private onMentionCallback; /** Safe logger that sanitizes sensitive information */ private logger; /** Rate limiter for Slack API calls */ private rateLimiter; constructor(config: MultiAgentConfig); /** * Set main bot user ID (from SlackGateway auth.test) */ setMainBotUserId(userId: string): void; /** * Set main bot ID (from SlackGateway auth.test) */ setMainBotId(botId: string): void; /** * Set main bot token (to avoid duplicate connections) */ setMainBotToken(token: string): void; /** * Register callback for when an agent bot receives a mention */ onMention(callback: (agentId: string, event: SlackMentionEvent, webClient: WebClient) => Promise): void; /** * Initialize all agent bots */ initialize(): Promise; /** * Create a Slack bot for an agent */ private createAgentBot; /** * Check if a bot_id belongs to one of our agent bots */ isFromAgentBot(botId: string): string | null; /** * Check if an agent has its own bot */ hasAgentBot(agentId: string): boolean; /** * Get agent bot */ getAgentBot(agentId: string): SlackAgentBot | undefined; /** * Send a message as a specific agent's bot */ sendAsAgent(agentId: string, channelId: string, content: string, threadTs?: string): Promise; /** * Reply to a message as a specific agent's bot (always in thread) */ replyAsAgent(agentId: string, channelId: string, threadTs: string, content: string): Promise; /** * Get all connected agent IDs */ getConnectedAgents(): string[]; /** * Get a map of agentId → Slack userId for all connected bots */ getBotUserIdMap(): Map; /** * Resolve an agent ID from a Slack user ID (reverse lookup) */ resolveAgentIdFromUserId(userId: string): string | null; /** * Get a specific agent bot's WebClient (for sending messages as that bot) */ getAgentWebClient(agentId: string): WebClient | null; /** * Get the agent ID that maps to the main bot */ getMainBotAgentId(): string | null; /** * Stop a specific agent's bot */ stopAgentBot(agentId: string): Promise; /** * Stop all agent bots */ stopAll(): Promise; /** * Get status of all bots */ getStatus(): Record; } export {}; //# sourceMappingURL=slack-multi-bot-manager.d.ts.map