UNPKG

context-forge

Version:

AI orchestration platform with autonomous teams, enhancement planning, migration tools, 25+ slash commands, checkpoints & hooks. Multi-IDE: Claude, Cursor, Windsurf, Cline, Copilot

101 lines 3.35 kB
import { EventEmitter } from 'events'; import { AgentMessage, CommunicationModel } from '../types/orchestration'; export interface MessageHandler { (message: AgentMessage): Promise<void>; } export interface CommunicationStats { totalMessages: number; messagesByType: Record<string, number>; messagesByAgent: Record<string, number>; averageResponseTime: number; blockedMessages: number; escalations: number; } export declare class AgentCommunicationService extends EventEmitter { private messages; private messageHandlers; private responseTimeTracker; private stats; private communicationModel; private agentHierarchy; constructor(communicationModel?: CommunicationModel); /** * Set the communication model */ setCommunicationModel(model: CommunicationModel): void; /** * Register agent hierarchy */ registerAgentHierarchy(agentId: string, supervisorId?: string): void; /** * Subscribe to messages for a specific agent */ subscribe(agentId: string, handler: MessageHandler): void; /** * Send a message between agents */ sendMessage(fromAgent: string, toAgent: string, type: AgentMessage['type'], content: string, metadata?: Record<string, any>, requiresResponse?: boolean): Promise<AgentMessage>; /** * Validate communication path based on model */ private isValidCommunicationPath; /** * Check if agent is orchestrator (has no supervisor) */ private isOrchestrator; /** * Deliver message to recipient */ private deliverMessage; /** * Send a response to a message */ sendResponse(originalMessageId: string, fromAgent: string, content: string, metadata?: Record<string, any>): Promise<void>; /** * Broadcast message to multiple agents */ broadcast(fromAgent: string, toAgents: string[], type: AgentMessage['type'], content: string, metadata?: Record<string, any>): Promise<void>; /** * Get pending messages for an agent */ getPendingMessages(agentId: string): AgentMessage[]; /** * Check if message has response */ private hasResponse; /** * Update statistics */ private updateStats; /** * Update average response time */ private updateAverageResponseTime; /** * Get communication statistics */ getStats(): CommunicationStats; /** * Get recent messages */ getRecentMessages(limit?: number): AgentMessage[]; /** * Get message history */ getMessageHistory(limit?: number): AgentMessage[]; /** * Get conversation between two agents */ getConversation(agent1: string, agent2: string): AgentMessage[]; /** * Clear old messages */ clearOldMessages(olderThan: Date): number; /** * Create standard message templates */ createStatusUpdate(fromAgent: string, completed: string[], current: string, blocked?: string, eta?: string): string; createTaskAssignment(taskId: string, taskName: string, description: string, priority: 'critical' | 'high' | 'medium' | 'low', criteria: string[]): string; createEscalation(issue: string, impact: string, attemptedSolutions: string[], recommendation?: string): string; } //# sourceMappingURL=agentCommunication.d.ts.map