/** * Multi-Agent Orchestrator * * Manages agent selection, trigger matching, and loop prevention * for multi-agent Discord conversations. */ import type { MultiAgentConfig, AgentPersonaConfig, ChainState, AgentSelectionResult, MessageContext, AgentResponseRecord } from './types.js'; /** * Multi-Agent Orchestrator * * Responsibilities: * 1. Select which agent(s) should respond to a message * 2. Track response chains to prevent infinite loops * 3. Manage per-agent cooldowns * 4. Reset chain state on human messages */ export declare class MultiAgentOrchestrator { private logger; private config; private categoryRouter; /** Chain state per channel: Map */ private chainStates; /** Per-channel chain length overrides */ private chainLimitOverrides; /** Last response time per agent: Map */ private agentCooldowns; /** Response history for debugging: limited to last 100 entries */ private responseHistory; private readonly MAX_HISTORY; constructor(config: MultiAgentConfig); /** * Update configuration (for hot reload) */ updateConfig(config: MultiAgentConfig): void; /** * Get agent configuration by ID */ getAgent(agentId: string): AgentPersonaConfig | undefined; /** * Get all enabled agents */ getEnabledAgents(): AgentPersonaConfig[]; /** * Select which agents should respond to a message */ selectRespondingAgents(context: MessageContext): AgentSelectionResult; /** * Select limited responders for non-bot messages unless free-chat is explicitly enabled. * This protects the pool from burst fan-out and queue overflow while preserving explicit mentions. */ private limitAutoResponderSelection; /** * Determine whether a message should be auto-responded by a single agent. */ private shouldLimitAutoSelection; /** * Record an agent response (updates chain state and cooldowns) */ recordAgentResponse(agentId: string, channelId: string, messageId?: string): void; /** * Reset chain state for a channel (called on human message) */ resetChain(channelId: string): void; /** * Override max chain length for a channel (runtime). */ setChannelChainLimit(channelId: string, maxChainLength: number): void; /** * Clear max chain length override for a channel. */ clearChannelChainLimit(channelId: string): void; /** * Get effective max chain length for a channel. */ private getMaxChainLength; /** * Get chain state for a channel */ getChainState(channelId: string): ChainState; /** * Check if an agent is ready (not on cooldown) */ isAgentReady(agentId: string): boolean; /** * Find explicit trigger prefix match */ private findExplicitTrigger; /** * Find agents that match keywords in the message */ private findKeywordMatches; /** * Extract agent ID from a bot message's display name * @example "**🔧 DevBot**: Hello" -> "developer" */ extractAgentIdFromMessage(messageContent: string): string | null; /** * Strip trigger prefix from message content */ stripTriggerPrefix(content: string, agentId: string): string; /** * Get response history for debugging */ getResponseHistory(): AgentResponseRecord[]; /** * Clear all state (for testing) */ clearState(): void; } //# sourceMappingURL=orchestrator.d.ts.map