# Interface IWeightedVoting

Interface for weighted Byzantine voting. (Source: Issue #103, arXiv:2511.10400 - CP-WBFT)

interface IWeightedVoting {
calculateWeight(agentId: string): number;
updatePerformance(
agentId: string,
outcome: "unknown" | "success" | "failure" | "partial",
): void;
weightedConsensus(
votes: ReadonlyMap<
string,
{
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;
},
>,
): WeightedConsensusResult;
registerAgent(agentId: string): void;
getAgentRecord(agentId: string): WeightedAgentRecord | undefined;
flagByzantine(agentId: string, reason: string): void;
getAllRecords(): readonly WeightedAgentRecord[];
canVote(agentId: string): boolean;
recalibrateWeights(): void;
}

#### Implemented by

- WeightedVoting

- Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:110

##### Index

### Methods

calculateWeight
updatePerformance
weightedConsensus
registerAgent
getAgentRecord
flagByzantine
getAllRecords
canVote
recalibrateWeights

## Methods

### calculateWeight

- calculateWeight(agentId: string): number

  Calculate vote weight for an agent

  #### Parameters

  - agentId: string

  #### Returns number

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:112

### updatePerformance

- updatePerformance(
  agentId: string,
  outcome: "unknown" | "success" | "failure" | "partial",
  ): void

  Update agent performance based on task outcome

  #### Parameters

  - agentId: string
  - outcome: "unknown" | "success" | "failure" | "partial"

  #### Returns void

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:115

### weightedConsensus

- weightedConsensus(
  votes: ReadonlyMap<
  string,
  {
  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;
  },
  >,
  ): WeightedConsensusResult

  Run weighted consensus on votes

  #### Parameters

  - votes: ReadonlyMap<
    string,
    {
    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;
    },
    >

  #### Returns WeightedConsensusResult

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:118

### registerAgent

- registerAgent(agentId: string): void

  Register a new agent

  #### Parameters

  - agentId: string

  #### Returns void

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:121

### getAgentRecord

- getAgentRecord(agentId: string): WeightedAgentRecord | undefined

  Get agent performance record

  #### Parameters

  - agentId: string

  #### Returns WeightedAgentRecord | undefined

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:124

### flagByzantine

- flagByzantine(agentId: string, reason: string): void

  Flag agent for Byzantine behavior

  #### Parameters

  - agentId: string
  - reason: string

  #### Returns void

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:127

### getAllRecords

- getAllRecords(): readonly WeightedAgentRecord[]

  Get all agent records

  #### Returns readonly WeightedAgentRecord[]

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:130

### canVote

- canVote(agentId: string): boolean

  Check if agent can vote

  #### Parameters

  - agentId: string

  #### Returns boolean

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:133

### recalibrateWeights

- recalibrateWeights(): void

  Recalibrate all weights based on global performance

  #### Returns void

  - Defined in packages/nexus-agents/src/consensus/types-weighted-voting.ts:136