nexus-agents - v2.80.0
    Preparing search index...

    Class ConsensusEngine

    Consensus engine for multi-agent decision making.

    const engine = new ConsensusEngine({ defaultTimeout: 30000 });
    const proposalResult = await engine.propose({
    title: 'Use microservices architecture',
    description: 'Proposal to adopt microservices',
    algorithm: 'supermajority',
    });
    if (proposalResult.ok) {
    await engine.vote(proposalResult.value, 'agent-1', {
    decision: 'approve',
    confidence: 0.9,
    reasoning: 'Good for scalability',
    });
    }

    Implements

    Index

    Constructors

    Methods

    • Sets the callback for incremental quorum voter expansion (Issue #1408). When ambiguous votes are detected, this callback requests additional voters.

      Parameters

      • callback: VoterExpansionCallback

      Returns void

    • Parameters

      • proposal: {
            id?: string;
            title: string;
            description: string;
            algorithm:
                | "simple_majority"
                | "supermajority"
                | "unanimous"
                | "proof_of_learning"
                | "opinion_wise"
                | "higher_order";
            timeout?: number;
            requiredVoters?: string[];
            metadata?: Record<string, unknown>;
            createdAt?: string;
        }

      Returns Promise<Result<string, ConsensusError>>

    • Parameters

      • proposalId: string
      • agentId: string
      • vote: {
            decision: "approve" | "reject" | "abstain";
            reasoning: string;
            confidence: number;
            conditions?: string[];
            rejectionCategories?: (
                | "YAGNI"
                | "DRY_VIOLATION"
                | "OVER_ENGINEERING"
                | "SCOPE_CREEP"
                | "SECURITY_RISK"
                | "MISALIGNED"
                | "INSUFFICIENT_EVIDENCE"
            )[];
            findings?: {
                summary: string;
                location: string;
                severity: "low"
                | "medium"
                | "high"
                | "critical";
                gate: {
                    reread_cited_line: "failed" | "skipped" | "passed";
                    traced_call_path: "failed" | "skipped" | "passed";
                    named_assertion: string;
                    ruled_out_language_non_issue: "failed" | "skipped" | "passed";
                };
                claim: string;
            }[];
            timestamp?: string;
        }
        • decision: "approve" | "reject" | "abstain"
        • reasoning: string
        • confidence: number
        • Optionalconditions?: string[]
        • OptionalrejectionCategories?: (
              | "YAGNI"
              | "DRY_VIOLATION"
              | "OVER_ENGINEERING"
              | "SCOPE_CREEP"
              | "SECURITY_RISK"
              | "MISALIGNED"
              | "INSUFFICIENT_EVIDENCE"
          )[]

          Structured rejection categories for reject→refine→re-vote loops (Issue #1213).

        • Optionalfindings?: {
              summary: string;
              location: string;
              severity: "low" | "medium" | "high" | "critical";
              gate: {
                  reread_cited_line: "failed" | "skipped" | "passed";
                  traced_call_path: "failed" | "skipped" | "passed";
                  named_assertion: string;
                  ruled_out_language_non_issue: "failed" | "skipped" | "passed";
              };
              claim: string;
          }[]

          Pre-verified PR-review findings (#2245 v4 follow-up). Optional; populated only when the voter emits the structured top-level array.

        • Optionaltimestamp?: string

      Returns Promise<Result<void, ConsensusError>>