import type { HTMLAttributes } from 'svelte/elements';
export type MessagePriority = 'low' | 'normal' | 'high' | 'urgent';
export type MessageStatus = 'pending' | 'delivered' | 'failed' | 'read';
export type AgentStatus = 'available' | 'busy' | 'offline' | 'error';
export type ThreadStatus = 'active' | 'paused' | 'archived' | 'closed';
export interface AgentMessage {
    id: string;
    fromAgentId: string;
    toAgentId: string;
    subject?: string;
    content: string;
    priority: MessagePriority;
    requiresResponse: boolean;
    threadId?: string;
    inReplyTo?: string;
    sentAt: Date;
    deliveredAt?: Date;
    readAt?: Date;
    deliveryStatus: MessageStatus;
    deliveryAttempts?: number;
    conversationContext?: Record<string, any>;
    messageType?: 'text' | 'structured' | 'command' | 'query' | 'response';
    format?: 'plain' | 'markdown' | 'json' | 'xml';
    attachments?: MessageAttachment[];
    references?: string[];
    encryption?: 'none' | 'tls' | 'e2e';
    routingHints?: string[];
    mentions?: string[];
    tags?: string[];
    errorDetails?: {
        code: string;
        message: string;
        retryable: boolean;
    };
}
export interface MessageAttachment {
    id: string;
    name: string;
    type: 'file' | 'data' | 'reference' | 'workflow';
    size: number;
    mimeType: string;
    url?: string;
    data?: any;
    checksum?: string;
}
export interface MessageThread {
    id: string;
    participants: string[];
    subject: string;
    createdAt: Date;
    lastActivity: Date;
    status: ThreadStatus;
    messageCount: number;
    conversationContext?: ConversationContext;
    parentThreadId?: string;
    childThreadIds?: string[];
    moderators?: string[];
    allowedParticipants?: string[];
    threadRules?: ThreadRule[];
    autoArchiveAfter?: number;
    retentionPolicy?: 'default' | 'extended' | 'permanent' | 'ephemeral';
    engagementMetrics?: {
        averageResponseTime: number;
        participationRate: number;
        messageFrequency: number;
    };
}
export interface ConversationContext {
    topic: string;
    priority: MessagePriority;
    expectedDuration: 'short' | 'medium' | 'long' | 'ongoing';
    relatedWorkflows?: string[];
    relatedTasks?: string[];
    sharedContext: Record<string, any>;
    objectives?: string[];
    successCriteria?: string[];
    constraints?: {
        timeLimit?: number;
        messageLimit?: number;
        participantLimit?: number;
    };
    preferences?: {
        responseFormat?: 'brief' | 'detailed' | 'structured';
        communicationStyle?: 'formal' | 'casual' | 'technical';
        updateFrequency?: 'realtime' | 'batched' | 'on_demand';
    };
}
export interface ThreadRule {
    id: string;
    type: 'moderation' | 'routing' | 'formatting' | 'behavior';
    condition: string;
    action: string;
    priority: number;
    enabled: boolean;
}
export interface Agent {
    id: string;
    type: string;
    status: AgentStatus;
    endpoint: string;
    capabilities: string[];
    version: string;
    lastSeen: Date;
    connectionQuality?: 'excellent' | 'good' | 'poor' | 'unknown';
    metrics?: {
        averageResponseTime: number;
        successRate: number;
        uptime: number;
        currentLoad: number;
    };
    preferences?: {
        maxConcurrentConversations: number;
        preferredMessageFormats: string[];
        workingHours?: {
            start: string;
            end: string;
            timezone: string;
        };
    };
}
export interface AgentCapability {
    agentId: string;
    agentType: string;
    capabilities: string[];
    version: string;
    endpoint: string;
    discoveredAt: Date;
    discoveryMethod?: 'broadcast' | 'registry' | 'manual' | 'peer_referral';
    status: AgentStatus;
    lastSeen: Date;
    metadata: {
        description: string;
        supportedProtocols: string[];
        maxConcurrentConnections: number;
        averageResponseTime: number;
        requiresAuthentication?: boolean;
        costModel?: 'free' | 'subscription' | 'pay_per_use';
    };
    trustScore?: number;
    reputation?: {
        totalInteractions: number;
        positiveRatings: number;
        negativeRatings: number;
        averageRating: number;
    };
    compatibility?: {
        protocolVersions: string[];
        supportedDataFormats: string[];
        securityRequirements: string[];
    };
}
export interface DeliveryStatus {
    messageId: string;
    status: MessageStatus;
    attempts: number;
    lastAttempt: Date;
    estimatedDelivery?: Date;
    deliveredAt?: Date;
    failureReason?: string;
    nextRetryAt?: Date;
    maxRetries?: number;
    routePath?: Array<{
        agentId: string;
        timestamp: Date;
        latency: number;
    }>;
    deliveryTime?: number;
    routeEfficiency?: number;
}
export interface A2ACommunicationHubProps extends HTMLAttributes<HTMLDivElement> {
    /**
     * Currently active agents in the system
     */
    activeAgents?: Agent[];
    /**
     * Message history for display
     */
    messageHistory?: AgentMessage[];
    /**
     * Active message threads
     */
    messageThreads?: MessageThread[];
    /**
     * Discovered agent capabilities
     */
    agentCapabilities?: AgentCapability[];
    /**
     * Show message threads section
     * @default true
     */
    showMessageThreads?: boolean;
    /**
     * Show agent discovery section
     * @default true
     */
    showAgentDiscovery?: boolean;
    /**
     * Show delivery status information
     * @default true
     */
    showDeliveryStatus?: boolean;
    /**
     * Enable automatic message retry on failure
     * @default true
     */
    enableMessageRetry?: boolean;
    /**
     * Messaging system configuration
     */
    messagingConfig?: {
        maxRetries: number;
        timeoutMs: number;
        enableDeliveryGuarantees: boolean;
        enableConversationContext: boolean;
        maxMessageHistory: number;
        batchSize?: number;
        compressionEnabled?: boolean;
        encryptionLevel?: 'none' | 'basic' | 'advanced';
        routingStrategy?: 'direct' | 'optimized' | 'redundant';
    };
    /**
     * Callback when message is sent
     */
    onMessageSent?: (message: AgentMessage) => void;
    /**
     * Callback when message is received
     */
    onMessageReceived?: (message: AgentMessage) => void;
    /**
     * Callback when agent is discovered
     */
    onAgentDiscovered?: (capability: AgentCapability) => void;
    /**
     * Callback when thread is created
     */
    onThreadCreated?: (thread: MessageThread) => void;
    /**
     * Callback when delivery status changes
     */
    onDeliveryStatusChanged?: (messageId: string, status: MessageStatus) => void;
    /**
     * Callback when agent status changes
     */
    onAgentStatusChanged?: (agentId: string, status: AgentStatus) => void;
    /**
     * Callback when thread is updated
     */
    onThreadUpdated?: (thread: MessageThread) => void;
}
export interface CommunicationBus {
    /**
     * Send message to specific agent
     */
    sendMessage: (message: AgentMessage) => Promise<DeliveryStatus>;
    /**
     * Broadcast message to multiple agents
     */
    broadcastMessage: (message: Omit<AgentMessage, 'toAgentId'>, recipients: string[]) => Promise<DeliveryStatus[]>;
    /**
     * Subscribe to messages for an agent
     */
    subscribeToMessages: (agentId: string, callback: (message: AgentMessage) => void) => () => void;
    /**
     * Create message thread
     */
    createThread: (participants: string[], subject: string, context?: ConversationContext) => Promise<MessageThread>;
    /**
     * Join existing thread
     */
    joinThread: (threadId: string, agentId: string) => Promise<void>;
    /**
     * Leave thread
     */
    leaveThread: (threadId: string, agentId: string) => Promise<void>;
    /**
     * Get message history for thread
     */
    getThreadHistory: (threadId: string, options?: {
        limit?: number;
        offset?: number;
        since?: Date;
    }) => Promise<AgentMessage[]>;
}
export interface AgentRegistry {
    /**
     * Register agent with capabilities
     */
    registerAgent: (agent: Agent, capabilities: string[]) => Promise<void>;
    /**
     * Unregister agent
     */
    unregisterAgent: (agentId: string) => Promise<void>;
    /**
     * Update agent status
     */
    updateAgentStatus: (agentId: string, status: AgentStatus) => Promise<void>;
    /**
     * Discover agents by capability
     */
    discoverAgents: (capabilities: string[], options?: {
        includeBusy?: boolean;
        maxResults?: number;
        minTrustScore?: number;
    }) => Promise<AgentCapability[]>;
    /**
     * Get agent details
     */
    getAgent: (agentId: string) => Promise<Agent | null>;
    /**
     * List all registered agents
     */
    listAgents: (filter?: {
        type?: string;
        status?: AgentStatus;
        capabilities?: string[];
    }) => Promise<Agent[]>;
    /**
     * Health check for agent
     */
    healthCheck: (agentId: string) => Promise<{
        status: AgentStatus;
        responseTime: number;
        lastSeen: Date;
    }>;
}
export interface MessageRouter {
    /**
     * Route message to appropriate agent(s)
     */
    routeMessage: (message: AgentMessage) => Promise<string[]>;
    /**
     * Find optimal route for message delivery
     */
    findRoute: (fromAgentId: string, toAgentId: string, options?: {
        preferredLatency?: 'low' | 'medium' | 'high';
        reliability?: 'best_effort' | 'guaranteed';
        costOptimized?: boolean;
    }) => Promise<string[]>;
    /**
     * Register routing rules
     */
    addRoutingRule: (rule: RoutingRule) => Promise<void>;
    /**
     * Remove routing rule
     */
    removeRoutingRule: (ruleId: string) => Promise<void>;
    /**
     * Get routing statistics
     */
    getRoutingStats: () => Promise<RoutingStatistics>;
}
export interface RoutingRule {
    id: string;
    name: string;
    condition: {
        sourceAgent?: string;
        targetAgent?: string;
        messageType?: string;
        priority?: MessagePriority;
        contentPattern?: string;
    };
    action: {
        type: 'route' | 'block' | 'transform' | 'duplicate';
        parameters: Record<string, any>;
    };
    priority: number;
    enabled: boolean;
    createdAt: Date;
}
export interface RoutingStatistics {
    totalMessages: number;
    successfulDeliveries: number;
    failedDeliveries: number;
    averageLatency: number;
    routeUsage: Record<string, number>;
    agentLoad: Record<string, number>;
    errorsByType: Record<string, number>;
    performanceByHour: Array<{
        hour: number;
        messageCount: number;
        averageLatency: number;
        errorRate: number;
    }>;
}
export interface ConversationManager {
    /**
     * Start structured conversation
     */
    startConversation: (participants: string[], template: ConversationTemplate) => Promise<MessageThread>;
    /**
     * Manage conversation flow
     */
    manageFlow: (threadId: string, flowControl: FlowControl) => Promise<void>;
    /**
     * Analyze conversation patterns
     */
    analyzeConversation: (threadId: string) => Promise<ConversationAnalysis>;
    /**
     * Suggest conversation optimizations
     */
    suggestOptimizations: (threadId: string) => Promise<ConversationOptimization[]>;
}
export interface ConversationTemplate {
    id: string;
    name: string;
    description: string;
    phases: Array<{
        name: string;
        objectives: string[];
        estimatedDuration: number;
        requiredParticipants: string[];
        optionalParticipants: string[];
    }>;
    rules: ThreadRule[];
    contextRequirements: string[];
    successCriteria: string[];
}
export interface FlowControl {
    action: 'pause' | 'resume' | 'redirect' | 'escalate' | 'summarize';
    parameters?: Record<string, any>;
    reason?: string;
    triggeredBy?: string;
}
export interface ConversationAnalysis {
    threadId: string;
    analyzedAt: Date;
    metrics: {
        messageCount: number;
        participantCount: number;
        averageResponseTime: number;
        longestSilence: number;
        topicDiversity: number;
    };
    patterns: Array<{
        type: 'response_time' | 'participation' | 'topic_drift' | 'escalation';
        description: string;
        confidence: number;
    }>;
    sentiment: {
        overall: 'positive' | 'neutral' | 'negative';
        byParticipant: Record<string, number>;
        trend: 'improving' | 'stable' | 'declining';
    };
    effectiveness: {
        objectiveCompletion: number;
        participantSatisfaction: number;
        timeEfficiency: number;
    };
}
export interface ConversationOptimization {
    type: 'structure' | 'timing' | 'participation' | 'tools';
    suggestion: string;
    expectedImpact: {
        efficiency: number;
        satisfaction: number;
        quality: number;
    };
    implementation: {
        difficulty: 'easy' | 'moderate' | 'complex';
        timeRequired: number;
        requiredChanges: string[];
    };
}
export interface BMSCommunicationIntegration {
    /**
     * Oracle agent communication patterns
     */
    oracleIntegration: {
        requestInsight: (query: string, context: any) => Promise<AgentMessage>;
        subscribeToInsights: (callback: (insight: any) => void) => () => void;
        provideContextUpdate: (context: any) => Promise<void>;
    };
    /**
     * Scribe agent collaboration
     */
    scribeIntegration: {
        requestDocumentation: (topic: string, requirements: any) => Promise<AgentMessage>;
        collaborativeEditing: (documentId: string) => Promise<MessageThread>;
        reviewRequest: (content: any) => Promise<AgentMessage>;
    };
    /**
     * Architect agent coordination
     */
    architectIntegration: {
        requestPlanning: (goals: string[], constraints: any) => Promise<AgentMessage>;
        workflowCoordination: (workflowId: string) => Promise<MessageThread>;
        progressUpdates: (workflowId: string, progress: any) => Promise<void>;
    };
    /**
     * Cross-agent synthesis coordination
     */
    synthesisCoordination: {
        initiateSynthesis: (participants: string[], topic: string, context: any) => Promise<MessageThread>;
        coordinateAnalysis: (analysisType: string, data: any) => Promise<AgentMessage[]>;
        aggregateInsights: (insights: any[]) => Promise<any>;
    };
}
export interface CommunicationAnalytics {
    /**
     * Get real-time communication metrics
     */
    getRealTimeMetrics: () => Promise<{
        activeConnections: number;
        messagesPerSecond: number;
        averageLatency: number;
        errorRate: number;
        topActiveAgents: Array<{
            agentId: string;
            messageCount: number;
        }>;
    }>;
    /**
     * Generate communication report
     */
    generateReport: (timeframe: {
        start: Date;
        end: Date;
    }) => Promise<CommunicationReport>;
    /**
     * Analyze communication patterns
     */
    analyzePatterns: (agentId?: string, timeframe?: {
        start: Date;
        end: Date;
    }) => Promise<CommunicationPattern[]>;
    /**
     * Get performance trends
     */
    getPerformanceTrends: (metric: 'latency' | 'throughput' | 'error_rate' | 'satisfaction', granularity: 'hour' | 'day' | 'week') => Promise<Array<{
        timestamp: Date;
        value: number;
    }>>;
}
export interface CommunicationReport {
    timeframe: {
        start: Date;
        end: Date;
    };
    overview: {
        totalMessages: number;
        uniqueAgents: number;
        activeThreads: number;
        averageResponseTime: number;
    };
    agentStatistics: Array<{
        agentId: string;
        messagesSent: number;
        messagesReceived: number;
        averageResponseTime: number;
        successRate: number;
    }>;
    threadStatistics: Array<{
        threadId: string;
        messageCount: number;
        participantCount: number;
        duration: number;
        completion: 'completed' | 'ongoing' | 'abandoned';
    }>;
    performanceMetrics: {
        deliverySuccess: number;
        averageLatency: number;
        peakThroughput: number;
        uptimePercentage: number;
    };
    insights: string[];
    recommendations: string[];
}
export interface CommunicationPattern {
    type: 'temporal' | 'agent_interaction' | 'topic_clustering' | 'workflow';
    description: string;
    confidence: number;
    details: {
        involvedAgents: string[];
        frequency: 'rare' | 'occasional' | 'regular' | 'constant';
        impact: 'low' | 'medium' | 'high';
        trend: 'increasing' | 'stable' | 'decreasing';
    };
    actionableInsights: string[];
    recommendations: string[];
}
//# sourceMappingURL=types.d.ts.map