import { AgentMessage, MessageType } from "@myycontext/core/src/types/agent-orchestration";
import { EventEmitter } from "events";
/**
 * Message handler function
 */
export type MessageHandler = (message: AgentMessage) => void | Promise<void>;
/**
 * Message Bus Statistics
 */
export interface MessageBusStats {
    totalMessages: number;
    messagesPerType: Record<MessageType, number>;
    totalSubscriptions: number;
    activeSubscriptions: number;
    averageDeliveryTimeMs: number;
    queuedMessages: number;
    failedDeliveries: number;
}
/**
 * MessageBus
 *
 * Enables inter-agent communication via pub/sub and request/response patterns.
 * The nervous system of multi-agent orchestration.
 */
export declare class MessageBus extends EventEmitter {
    private subscriptions;
    private pendingRequests;
    private messageQueue;
    private stats;
    private processingInterval?;
    private maxQueueSize;
    private defaultTimeoutMs;
    private processingIntervalMs;
    constructor();
    /**
     * Start message processing
     */
    start(): void;
    /**
     * Stop message processing
     */
    stop(): void;
    /**
     * Subscribe to a topic
     */
    subscribe(topic: string, callback: MessageHandler, options?: {
        agentInstanceId?: string;
        filter?: (message: AgentMessage) => boolean;
        priority?: number;
    }): string;
    /**
     * Unsubscribe from a topic
     */
    unsubscribe(subscriptionId: string): boolean;
    /**
     * Publish a message
     */
    publish(message: Omit<AgentMessage, "messageId" | "timestamp" | "deliveryAttempts">): Promise<void>;
    /**
     * Request/response pattern
     */
    request<T = unknown>(topic: string, payload: unknown, options?: {
        from?: string;
        to?: string;
        timeoutMs?: number;
        priority?: "critical" | "high" | "medium" | "low";
    }): Promise<T>;
    /**
     * Send a response
     */
    respond(request: AgentMessage, payload: unknown, options?: {
        from?: string;
    }): Promise<void>;
    /**
     * Broadcast to all subscribers
     */
    broadcast(topic: string, payload: unknown, options?: {
        from?: string;
        priority?: "critical" | "high" | "medium" | "low";
        ttl?: number;
    }): Promise<void>;
    /**
     * Send notification
     */
    notify(topic: string, payload: unknown, options?: {
        from?: string;
        to?: string;
        priority?: "critical" | "high" | "medium" | "low";
    }): Promise<void>;
    /**
     * Get statistics
     */
    getStats(): MessageBusStats;
    /**
     * Clear queue
     */
    clearQueue(): void;
    /**
     * Enqueue message
     */
    private enqueue;
    /**
     * Process message queue
     */
    private processQueue;
    /**
     * Deliver message to subscribers
     */
    private deliverMessage;
    /**
     * Handle response message
     */
    private handleResponse;
    /**
     * Check if topic matches pattern (supports wildcards)
     */
    private topicMatches;
    /**
     * Configure message bus
     */
    configure(options: {
        maxQueueSize?: number;
        defaultTimeoutMs?: number;
        processingIntervalMs?: number;
    }): void;
}
//# sourceMappingURL=MessageBus.d.ts.map