/**
 * SmartPerfetto Agent Message Bus
 *
 * Phase 4.1: Inter-agent communication system
 *
 * The message bus enables:
 * 1. Task dispatch from Master to domain agents
 * 2. Response collection from agents
 * 3. Inter-agent queries (e.g., FrameAgent asks CPUAgent for scheduling data)
 * 4. Broadcast messages (hypothesis updates, evidence found, etc.)
 *
 * Message Flow:
 * Master → dispatch task → Agent → execute → response → Master
 *                              ↓
 *                         query other agent
 *                              ↓
 *                         receive answer
 */
import { EventEmitter } from 'events';
import { AgentMessage, BroadcastMessage, AgentTask, AgentResponse, InterAgentQuestion, SharedAgentContext, Hypothesis } from '../types/agentProtocol';
import { Finding } from '../types';
import { BaseAgent } from '../agents/base/baseAgent';
/**
 * Message handler function type
 */
export type MessageHandler = (message: AgentMessage) => Promise<void>;
/**
 * Query handler function type
 */
export type QueryHandler = (question: InterAgentQuestion) => Promise<any>;
/**
 * Message bus configuration
 */
export interface MessageBusConfig {
    /** Maximum pending messages per agent */
    maxPendingMessages: number;
    /** Message timeout in ms */
    messageTimeoutMs: number;
    /** Enable message logging */
    enableLogging: boolean;
    /** Maximum concurrent task executions */
    maxConcurrentTasks: number;
}
/**
 * Agent Message Bus
 *
 * Central communication hub for all agents in a session.
 * Handles task dispatch, response collection, and inter-agent queries.
 */
export declare class AgentMessageBus extends EventEmitter {
    private config;
    private agents;
    private pendingMessages;
    private messageQueue;
    private sharedContext;
    private isProcessing;
    private taskSemaphore;
    private perAgentSemaphore;
    constructor(config?: Partial<MessageBusConfig>);
    /**
     * Register an agent with the message bus
     */
    registerAgent(agent: BaseAgent): void;
    /**
     * Unregister an agent
     */
    unregisterAgent(agentId: string): void;
    /**
     * Get registered agent
     */
    getAgent(agentId: string): BaseAgent | undefined;
    /**
     * Get all registered agents
     */
    getAllAgents(): BaseAgent[];
    /**
     * Set shared context for all agents
     */
    setSharedContext(context: SharedAgentContext): void;
    /**
     * Get shared context
     */
    getSharedContext(): SharedAgentContext | null;
    /**
     * Update hypotheses in shared context
     */
    updateHypothesis(hypothesis: Hypothesis): void;
    /**
     * Add confirmed finding to shared context
     */
    addConfirmedFinding(finding: Finding): void;
    /**
     * Send a task to an agent
     */
    dispatchTask(task: AgentTask): Promise<AgentResponse>;
    /**
     * Dispatch multiple tasks in parallel
     */
    dispatchTasksParallel(tasks: AgentTask[]): Promise<AgentResponse[]>;
    /**
     * Send a query from one agent to another
     */
    query(from: string, to: string, question: InterAgentQuestion): Promise<any>;
    /**
     * Broadcast a message to all agents
     */
    broadcast(message: BroadcastMessage): void;
    /**
     * Process agent response and update shared context
     */
    private processAgentResponse;
    /**
     * Create a shared context
     */
    createSharedContext(sessionId: string, traceId: string): SharedAgentContext;
    /**
     * Get investigation summary
     */
    getInvestigationSummary(): string;
    /**
     * Reset message bus state
     */
    reset(): void;
    /**
     * Log message (if enabled)
     */
    private log;
    private resolveTaskTimeout;
    private executeTaskWithTimeout;
    private buildFailedResponse;
    private buildRejectedResponse;
}
/**
 * Create an agent message bus
 */
export declare function createAgentMessageBus(config?: Partial<MessageBusConfig>): AgentMessageBus;
export default AgentMessageBus;
//# sourceMappingURL=agentMessageBus.d.ts.map