/**
 * Nexus Prime — Byzantine Consensus Protocol
 *
 * Implements a Byzantine Fault Tolerant consensus protocol for multi-agent
 * KV cache synchronization. Up to ⌊(N-1)/3⌋ faulty agents can be tolerated.
 *
 * Uses a simplified PBFT (Practical Byzantine Fault Tolerance) approach:
 * 1. Pre-prepare: Leader proposes a cache update
 * 2. Prepare: Agents validate and vote
 * 3. Commit: If 2f+1 agents agree, cache is updated
 *
 * Phase: 9C (AdaptiveKVMerge Bridge)
 */
export interface ConsensusProposal {
    id: string;
    proposerId: string;
    layerIndex: number;
    delta: number[];
    timestamp: number;
    phase: 'pre-prepare' | 'prepare' | 'commit' | 'decided';
    votes: Map<string, boolean>;
    committed: boolean;
}
export interface AgentNode {
    id: string;
    reliability: number;
    lastSeen: number;
    proposalCount: number;
    acceptedCount: number;
}
export interface ConsensusResult {
    proposalId: string;
    accepted: boolean;
    votes: {
        for: number;
        against: number;
        total: number;
    };
    quorum: number;
    conflicts: number;
}
export declare class ByzantineConsensus {
    private agents;
    private proposals;
    private conflictCount;
    /**
     * Register an agent node in the consensus network.
     */
    registerAgent(agentId: string): void;
    /**
     * Remove an agent from the consensus network.
     */
    deregisterAgent(agentId: string): void;
    /**
     * Maximum number of faulty agents tolerated: f = ⌊(N-1)/3⌋
     */
    get maxFaulty(): number;
    /**
     * Minimum votes needed for quorum: 2f + 1
     */
    get quorum(): number;
    /**
     * Phase 1: Pre-Prepare — Leader proposes a cache update.
     */
    propose(proposerId: string, layerIndex: number, delta: number[]): ConsensusProposal;
    /**
     * Phase 2: Prepare — Agent validates and votes on a proposal.
     *
     * Validation checks:
     * 1. Proposer reliability score
     * 2. Delta magnitude is within acceptable bounds
     * 3. No conflicting concurrent proposals for the same layer
     */
    vote(proposalId: string, agentId: string, approve: boolean): void;
    /**
     * Auto-vote: simplified version where the engine validates locally
     * and generates votes from all registered agents based on heuristics.
     */
    autoConsensus(proposerId: string, layerIndex: number, delta: number[]): ConsensusResult;
    /**
     * Get all registered agents and their reliability scores.
     */
    getAgents(): AgentNode[];
    /**
     * Get network health statistics.
     */
    getStats(): {
        agents: number;
        maxFaulty: number;
        quorum: number;
        totalProposals: number;
        totalConflicts: number;
        avgReliability: number;
    };
    private commitProposal;
    private ensureRegistered;
    /**
     * Simple heuristic to validate a delta:
     * - Reject if delta magnitude is too large (suspicious change)
     * - Use agent reliability as acceptance probability for borderline cases
     */
    private validateDelta;
}
