nexus-agents 8.38.4 → 8.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,10 +23,10 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-7AIHIPH5.js";
26
+ } from "./chunk-C6QQ4IGS.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-TPDDQOF6.js";
29
+ } from "./chunk-OUDYNDHQ.js";
30
30
  import {
31
31
  assessPanelIndependence,
32
32
  countDistinctModels,
@@ -1557,6 +1557,10 @@ var IndependentSubsetSchema = z4.object({
1557
1557
  id: z4.string(),
1558
1558
  agentIds: z4.array(z4.string()),
1559
1559
  independenceScore: z4.number().min(0).max(1),
1560
+ pairCoverage: z4.object({
1561
+ observed: z4.number().int().nonnegative(),
1562
+ total: z4.number().int().nonnegative()
1563
+ }),
1560
1564
  observationCount: z4.number().int().nonnegative()
1561
1565
  });
1562
1566
  var VotingObservationSchema = z4.object({
@@ -1706,7 +1710,7 @@ function aggregateSubsets(votes, independentSubsets) {
1706
1710
  const { approval, rejection } = countSubsetVotes(subsetVotes);
1707
1711
  const weight = subsetVotes.size * (1 - subset.independenceScore);
1708
1712
  subsetResults.push({ approval, rejection, weight });
1709
- if (subset.agentIds.length === 1) downweightedAgents.push(...subset.agentIds);
1713
+ if (weight < subsetVotes.size) downweightedAgents.push(...subset.agentIds);
1710
1714
  }
1711
1715
  return { subsetResults, downweightedAgents };
1712
1716
  }
@@ -2896,10 +2900,22 @@ var QuorumValidator = class {
2896
2900
  counts[decision] += weight;
2897
2901
  }
2898
2902
  calculateQuorumStatus(opts) {
2899
- const { voteCounts, weightedCounts, totalWeight, config, requiredParticipants, anyWeightSupplied } = opts;
2903
+ const {
2904
+ voteCounts,
2905
+ weightedCounts,
2906
+ totalWeight,
2907
+ config,
2908
+ requiredParticipants,
2909
+ anyWeightSupplied
2910
+ } = opts;
2900
2911
  const threshold = config.threshold;
2901
2912
  if (weightedCounts !== void 0 && totalWeight !== void 0 && totalWeight > 0) {
2902
- return this.calculateWeightedQuorum(weightedCounts, totalWeight, threshold, anyWeightSupplied);
2913
+ return this.calculateWeightedQuorum(
2914
+ weightedCounts,
2915
+ totalWeight,
2916
+ threshold,
2917
+ anyWeightSupplied
2918
+ );
2903
2919
  }
2904
2920
  return this.calculateSimpleQuorum(voteCounts, requiredParticipants, threshold, config);
2905
2921
  }
@@ -3977,6 +3993,33 @@ function createWeightedVoting(options) {
3977
3993
  return new WeightedVoting(options);
3978
3994
  }
3979
3995
 
3996
+ // src/consensus/subset-independence.ts
3997
+ function computeSubsetIndependence(subset, correlationMatrix) {
3998
+ const totalPairs = subset.length * (subset.length - 1) / 2;
3999
+ if (subset.length < 2) return { score: 0, observedPairs: 0, totalPairs };
4000
+ let totalCorrelation = 0;
4001
+ let pairs = 0;
4002
+ for (let i = 0; i < subset.length; i++) {
4003
+ for (let j = i + 1; j < subset.length; j++) {
4004
+ const agentA = subset[i];
4005
+ const agentB = subset[j];
4006
+ if (agentA !== void 0 && agentB !== void 0) {
4007
+ const pairKey = createAgentPairKey(agentA, agentB);
4008
+ const correlation = correlationMatrix.get(pairKey);
4009
+ if (correlation !== void 0) {
4010
+ totalCorrelation += Math.abs(correlation);
4011
+ pairs++;
4012
+ }
4013
+ }
4014
+ }
4015
+ }
4016
+ return {
4017
+ score: pairs > 0 ? totalCorrelation / pairs : 0,
4018
+ observedPairs: pairs,
4019
+ totalPairs
4020
+ };
4021
+ }
4022
+
3980
4023
  // src/consensus/correlation-helpers.ts
3981
4024
  function isComparable(obsA, obsB) {
3982
4025
  return obsA.decision !== "abstain" && obsB.decision !== "abstain";
@@ -4009,26 +4052,6 @@ function isIndependentFromSubset(agent, subset, correlationMatrix, independenceT
4009
4052
  }
4010
4053
  return true;
4011
4054
  }
4012
- function computeSubsetIndependenceScore(subset, correlationMatrix) {
4013
- if (subset.length < 2) return 0;
4014
- let totalCorrelation = 0;
4015
- let pairs = 0;
4016
- for (let i = 0; i < subset.length; i++) {
4017
- for (let j = i + 1; j < subset.length; j++) {
4018
- const agentA = subset[i];
4019
- const agentB = subset[j];
4020
- if (agentA !== void 0 && agentB !== void 0) {
4021
- const pairKey = createAgentPairKey(agentA, agentB);
4022
- const correlation = correlationMatrix.get(pairKey);
4023
- if (correlation !== void 0) {
4024
- totalCorrelation += Math.abs(correlation);
4025
- pairs++;
4026
- }
4027
- }
4028
- }
4029
- }
4030
- return pairs > 0 ? totalCorrelation / pairs : 0;
4031
- }
4032
4055
  function computeSubsetObservationCount(subset, pairwiseHistory) {
4033
4056
  let minObservations = Infinity;
4034
4057
  for (let i = 0; i < subset.length; i++) {
@@ -4064,12 +4087,13 @@ function partitionIntoIndependentGroups(agents, correlationMatrix, pairwiseHisto
4064
4087
  assigned.add(other);
4065
4088
  }
4066
4089
  }
4067
- const independenceScore = computeSubsetIndependenceScore(subset, correlationMatrix);
4090
+ const independence = computeSubsetIndependence(subset, correlationMatrix);
4068
4091
  const observationCount = computeSubsetObservationCount(subset, pairwiseHistory);
4069
4092
  subsets.push({
4070
4093
  id: `subset-${String(subsetId++)}`,
4071
4094
  agentIds: subset,
4072
- independenceScore,
4095
+ independenceScore: independence.score,
4096
+ pairCoverage: { observed: independence.observedPairs, total: independence.totalPairs },
4073
4097
  observationCount
4074
4098
  });
4075
4099
  }
@@ -7806,4 +7830,4 @@ export {
7806
7830
  CONSENSUS_VOTE_TOOL_SCHEMA,
7807
7831
  registerConsensusVoteTool
7808
7832
  };
7809
- //# sourceMappingURL=chunk-X2QKPZ32.js.map
7833
+ //# sourceMappingURL=chunk-2TVB7UEJ.js.map