/**
 * Inter-Agent Announcements Module
 *
 * Provides a structured communication mechanism between agents
 * using a queue-based announcement system.
 */
import { EventEmitter } from 'events';
/**
 * Announcement types
 */
export type AnnouncementType = 'result' | 'error' | 'progress' | 'request' | 'info' | 'warning';
/**
 * Announcement priority
 */
export type AnnouncementPriority = 'low' | 'normal' | 'high' | 'urgent';
/**
 * An announcement between agents
 */
export interface Announcement<T = unknown> {
    /** Unique announcement ID */
    id: string;
    /** Source agent ID */
    source: string;
    /** Target agent ID */
    target: string;
    /** Announcement type */
    type: AnnouncementType;
    /** Priority level */
    priority: AnnouncementPriority;
    /** Payload data */
    payload: T;
    /** Creation timestamp */
    createdAt: number;
    /** Whether the announcement has been consumed */
    consumed: boolean;
    /** Consumption timestamp */
    consumedAt?: number;
    /** Optional correlation ID for request/response tracking */
    correlationId?: string;
    /** Optional metadata */
    metadata?: Record<string, unknown>;
}
/**
 * Announcement filter
 */
export interface AnnouncementFilter {
    /** Filter by source agent */
    source?: string;
    /** Filter by announcement type */
    type?: AnnouncementType | AnnouncementType[];
    /** Filter by priority */
    priority?: AnnouncementPriority | AnnouncementPriority[];
    /** Filter by correlation ID */
    correlationId?: string;
    /** Whether to include consumed announcements */
    includeConsumed?: boolean;
}
/**
 * Announcement queue events
 */
export interface AnnouncementEvents {
    'announce': (announcement: Announcement) => void;
    'consume': (announcement: Announcement) => void;
    'expire': (announcement: Announcement) => void;
}
/**
 * Announcement queue configuration
 */
export interface AnnouncementQueueConfig {
    /** Maximum announcements per target (0 = unlimited) */
    maxPerTarget: number;
    /** Announcement TTL in ms (0 = no expiry) */
    ttlMs: number;
    /** Cleanup interval in ms */
    cleanupIntervalMs: number;
}
/**
 * Default configuration
 */
export declare const DEFAULT_ANNOUNCEMENT_CONFIG: AnnouncementQueueConfig;
/**
 * Announcement queue for inter-agent communication
 */
export declare class AnnouncementQueue extends EventEmitter {
    private config;
    private queues;
    private idCounter;
    private cleanupTimer;
    constructor(config?: Partial<AnnouncementQueueConfig>);
    /**
     * Create and enqueue an announcement
     */
    announce<T = unknown>(source: string, target: string, type: AnnouncementType, payload: T, options?: {
        priority?: AnnouncementPriority;
        correlationId?: string;
        metadata?: Record<string, unknown>;
    }): Announcement<T>;
    /**
     * Find insertion index based on priority
     */
    private findInsertIndex;
    /**
     * Notify a target agent of pending announcements
     */
    private notifyTarget;
    /**
     * Consume announcements for a target
     */
    consume(target: string, filter?: AnnouncementFilter): Announcement[];
    /**
     * Peek at announcements without consuming
     */
    peek(target: string, filter?: AnnouncementFilter): Announcement[];
    /**
     * Check if announcement matches filter
     */
    private matchesFilter;
    /**
     * Get pending count for a target
     */
    getPendingCount(target: string): number;
    /**
     * Check if target has pending announcements
     */
    hasPending(target: string, filter?: AnnouncementFilter): boolean;
    /**
     * Wait for an announcement (with timeout)
     */
    waitFor(target: string, filter?: AnnouncementFilter, timeoutMs?: number): Promise<Announcement | null>;
    /**
     * Start cleanup timer
     */
    private startCleanup;
    /**
     * Cleanup expired announcements
     */
    cleanup(): void;
    /**
     * Stop the queue
     */
    stop(): void;
    /**
     * Clear all announcements
     */
    clear(): void;
    /**
     * Get statistics
     */
    getStats(): {
        totalTargets: number;
        totalPending: number;
        totalConsumed: number;
        byTarget: Record<string, {
            pending: number;
            consumed: number;
        }>;
    };
}
/**
 * Get the singleton announcement queue
 */
export declare function getAnnouncementQueue(config?: Partial<AnnouncementQueueConfig>): AnnouncementQueue;
/**
 * Reset the singleton announcement queue
 */
export declare function resetAnnouncementQueue(): void;
/**
 * Send a result announcement
 */
export declare function announceResult<T>(source: string, target: string, result: T, correlationId?: string): Announcement<T>;
/**
 * Send an error announcement
 */
export declare function announceError(source: string, target: string, error: string | Error, correlationId?: string): Announcement<{
    message: string;
    stack?: string;
}>;
/**
 * Send a progress announcement
 */
export declare function announceProgress(source: string, target: string, progress: {
    percent: number;
    message?: string;
}, correlationId?: string): Announcement<{
    percent: number;
    message?: string;
}>;
/**
 * Send a request announcement
 */
export declare function announceRequest<T>(source: string, target: string, request: T, correlationId?: string): Announcement<T>;
/**
 * Wait for a response to a request
 */
export declare function requestAndWait<TReq, TRes>(source: string, target: string, request: TReq, timeoutMs?: number): Promise<TRes | null>;
