/**
 * Policy Propagation System
 *
 * Real-time policy distribution to agents within 30 seconds.
 * Implements FR148 for Epic 4.
 *
 * Features:
 * - Sub-30 second propagation
 * - WebSocket-based push notifications
 * - Acknowledgment tracking
 * - Fallback polling for offline agents
 *
 * @packageDocumentation
 */
import type { ID } from '../../common/types.js';
import type { PolicyDefinition } from '../types.js';
/**
 * Policy update event
 */
export interface PolicyUpdateEvent {
    eventId: string;
    policyId: ID;
    policyName: string;
    version: number;
    action: 'created' | 'updated' | 'activated' | 'deactivated' | 'deleted';
    checksum: string;
    timestamp: string;
    /** Optional full definition for push updates */
    definition?: PolicyDefinition;
}
/**
 * Agent acknowledgment
 */
export interface PolicyAcknowledgment {
    agentId: ID;
    policyId: ID;
    version: number;
    acknowledgedAt: string;
    latencyMs: number;
    status: 'received' | 'applied' | 'error';
    errorMessage?: string;
}
/**
 * Propagation status
 */
export interface PropagationStatus {
    eventId: string;
    policyId: ID;
    startedAt: string;
    completedAt?: string;
    targetAgents: number;
    acknowledgedAgents: number;
    pendingAgents: ID[];
    failedAgents: {
        agentId: ID;
        error: string;
    }[];
    status: 'in_progress' | 'completed' | 'partial' | 'failed';
    latencyP50Ms?: number;
    latencyP95Ms?: number;
}
/**
 * Propagation options
 */
export interface PropagationOptions {
    /** Target specific agents (empty = all) */
    targetAgentIds?: ID[];
    /** Target specific namespaces */
    targetNamespaces?: string[];
    /** Include full policy definition in event */
    includeDefinition?: boolean;
    /** Timeout for acknowledgments */
    ackTimeoutMs?: number;
    /** Require minimum acknowledgment percentage to succeed */
    minAckPercentage?: number;
}
/**
 * Agent connection interface (for WebSocket management)
 */
export interface AgentConnection {
    agentId: ID;
    tenantId: ID;
    namespace?: string;
    connected: boolean;
    lastSeen: string;
    send(event: PolicyUpdateEvent): Promise<void>;
}
/**
 * Policy Propagation Service
 *
 * Manages real-time policy distribution to agents.
 */
export declare class PolicyPropagationService {
    private connections;
    private propagations;
    private acknowledgments;
    /**
     * Register an agent connection
     */
    registerConnection(connection: AgentConnection): void;
    /**
     * Remove an agent connection
     */
    removeConnection(agentId: ID): void;
    /**
     * Get connected agent count
     */
    getConnectedAgentCount(): number;
    /**
     * Propagate a policy update to agents
     */
    propagate(event: PolicyUpdateEvent, options?: PropagationOptions): Promise<PropagationStatus>;
    /**
     * Record an acknowledgment from an agent
     */
    recordAcknowledgment(ack: PolicyAcknowledgment): void;
    /**
     * Get propagation status
     */
    getStatus(eventId: string): PropagationStatus | undefined;
    /**
     * Get recent propagations
     */
    getRecentPropagations(limit?: number): PropagationStatus[];
    /**
     * Create a policy update event
     */
    createEvent(policyId: ID, policyName: string, version: number, action: PolicyUpdateEvent['action'], checksum: string, definition?: PolicyDefinition): PolicyUpdateEvent;
    /**
     * Get target agents based on options
     */
    private getTargetAgents;
    /**
     * Wait for acknowledgments with timeout
     */
    private waitForAcknowledgments;
    /**
     * Clean up old propagation records
     */
    cleanup(maxAgeMs?: number): number;
}
/**
 * Create a policy propagation service instance
 */
export declare function createPolicyPropagationService(): PolicyPropagationService;
//# sourceMappingURL=propagation.d.ts.map