/** * consensus/queen.ts — Proposer election (QueenCoordinator). * * F-039 — thin port of ruflo's capability-scored QueenCoordinator * (v3/@claude-flow/swarm/src/coordination/queen-coordinator.ts) for * the consensus layer's proposer selection. Bizar needs a deterministic, * fault-aware round-robin; we don't port the full ReasoningBank pattern * matching because Bizar's review steps don't have agent capability * vectors — they have peer rosters + a fault log. * * Algorithm: round-robin weighted by recent fault count. A peer with * N faults is skipped N times before becoming proposer again. With * `proposerSeed`, the initial head is computed deterministically so * tests can pin it. */ export interface QueenCoordinatorOpts { /** Full peer roster, in the order round-robin walks them. Required. */ peers: string[]; /** Maximum Byzantine faults the cluster can tolerate (used as the * skip-multiplier floor). Defaults to 1. */ maxFaults?: number; /** Optional seed — when set, the initial head is `peers[seedHash % peers.length]`. */ seed?: string; } /** * Tracks per-peer fault counts and walks the peer list in * round-robin order, skipping any peer whose `faultCount` is greater * than the candidate's expected count at that position. * * Concretely: if peer X has faultCount 2, the next 2 round-robin * positions that would land on X skip it instead and the proposer * becomes the peer at the next non-skipped position. After 2 * `advance()` calls (or `selectProposer` calls that consumed a skip), * X is eligible again. * * The fault penalty decays as the round-robin walks — this keeps * the cluster moving even when one peer has accumulated many faults. */ export declare class QueenCoordinator { private readonly peers; /** Maximum Byzantine faults the cluster is sized for (used as the * skip-multiplier floor — `recordFault` adds a skip of size * `maxFaults` so the worst peer is skipped `maxFaults` rounds). */ private readonly maxFaults; /** Per-peer cumulative fault count. */ private readonly faults; /** Per-peer remaining-skip count (decremented on every advance). */ private readonly skips; /** Current head of the round-robin walk. */ private cursor; constructor(opts: QueenCoordinatorOpts); /** Current proposer (head of the round-robin walk). */ currentProposer(): string; /** Record a fault against a peer (the proposer just voted `no`, or * missed its pre-prepare window). Increments both the cumulative * fault log and the per-peer skip counter — the peer is then * skipped for `maxFaults` round-robin steps before becoming * proposer-eligible again. With `maxFaults = 1` (the F-039 * default), one fault skips the peer for one round. */ recordFault(peerId: string): void; /** * Walk one step forward. Skips any peer whose remaining-skip count * is > 0 (decrementing the counter as it skips). Returns the new * proposer. */ advance(): string; /** * Equivalent to `selectProposer(peers, recentFaults)` from the F-039 * spec — but stateful, because we own the fault log. Returns the * current proposer without advancing. */ selectProposer(): string; /** Cumulative fault counts (read-only snapshot). */ faultCounts(): Record; /** Number of peers currently under a skip penalty. */ pendingSkipCount(): number; /** Test/dev helper: drop the cursor and fault counts. */ reset(): void; /** * Stable hash of an optional seed string → integer cursor in * `[0, peers.length)`. Lets a test caller pin the initial proposer * for replay safety (F-039 determinism rule). */ private seedCursor; } //# sourceMappingURL=queen.d.ts.map