nexus-agents 4.33.2 → 4.34.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.
- package/dist/{chunk-DJK6AVEQ.js → chunk-L4HOCHPC.js} +6 -6
- package/dist/{chunk-HB44B3BY.js → chunk-MEB34WD2.js} +3 -3
- package/dist/{chunk-QK5ZVSEW.js → chunk-NJ64CT2S.js} +2 -2
- package/dist/{chunk-QK5ZVSEW.js.map → chunk-NJ64CT2S.js.map} +1 -1
- package/dist/{chunk-AXBQ5TZD.js → chunk-PQ467L7A.js} +2 -2
- package/dist/{chunk-AH73DVZ2.js → chunk-UNM2AHS6.js} +63 -18
- package/dist/chunk-UNM2AHS6.js.map +1 -0
- package/dist/chunk-V4II4GN4.js +7 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +7 -7
- package/dist/{consensus-vote-XRX3QXQJ.js → consensus-vote-E62RKNVK.js} +4 -4
- package/dist/{consensus-vote-types-D66OPHNc.d.ts → consensus-vote-types-Br1h5IMv.d.ts} +34 -2
- package/dist/{improvement-review-MIKGBXMO.js → improvement-review-6GHO7J26.js} +4 -4
- package/dist/index.d.ts +16 -3
- package/dist/index.js +7 -7
- package/dist/model-registry.generated.json +1402 -1402
- package/dist/{setup-data-dir-JGQNIML7.js → setup-data-dir-M3WXYKIN.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-AH73DVZ2.js.map +0 -1
- package/dist/chunk-RESSWGLL.js +0 -7
- /package/dist/{chunk-DJK6AVEQ.js.map → chunk-L4HOCHPC.js.map} +0 -0
- /package/dist/{chunk-HB44B3BY.js.map → chunk-MEB34WD2.js.map} +0 -0
- /package/dist/{chunk-AXBQ5TZD.js.map → chunk-PQ467L7A.js.map} +0 -0
- /package/dist/{chunk-RESSWGLL.js.map → chunk-V4II4GN4.js.map} +0 -0
- /package/dist/{consensus-vote-XRX3QXQJ.js.map → consensus-vote-E62RKNVK.js.map} +0 -0
- /package/dist/{improvement-review-MIKGBXMO.js.map → improvement-review-6GHO7J26.js.map} +0 -0
- /package/dist/{setup-data-dir-JGQNIML7.js.map → setup-data-dir-M3WXYKIN.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toolStructuredError,
|
|
8
8
|
toolSuccessStructured,
|
|
9
9
|
wrapToolWithTimeout
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NJ64CT2S.js";
|
|
11
11
|
import {
|
|
12
12
|
JsonlStore,
|
|
13
13
|
SECURITY_KEYWORDS,
|
|
@@ -2159,4 +2159,4 @@ export {
|
|
|
2159
2159
|
runImprovementReview,
|
|
2160
2160
|
registerImprovementReviewTool
|
|
2161
2161
|
};
|
|
2162
|
-
//# sourceMappingURL=chunk-
|
|
2162
|
+
//# sourceMappingURL=chunk-PQ467L7A.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
toolSuccessStructured,
|
|
24
24
|
withProgressHeartbeat,
|
|
25
25
|
wrapToolWithTimeout
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NJ64CT2S.js";
|
|
27
27
|
import {
|
|
28
28
|
assessPanelIndependence,
|
|
29
29
|
countDistinctModels,
|
|
@@ -1879,6 +1879,14 @@ function createHigherOrderVotingStrategy(options) {
|
|
|
1879
1879
|
}
|
|
1880
1880
|
|
|
1881
1881
|
// src/consensus/strategies.ts
|
|
1882
|
+
function deriveWeightBasis(votes, weights) {
|
|
1883
|
+
let withRecord = 0;
|
|
1884
|
+
for (const agentId of votes.keys()) {
|
|
1885
|
+
if (weights.has(agentId)) withRecord++;
|
|
1886
|
+
}
|
|
1887
|
+
if (withRecord === 0) return "unweighted";
|
|
1888
|
+
return withRecord === votes.size ? "performance" : "partial";
|
|
1889
|
+
}
|
|
1882
1890
|
function evaluateThreshold(approveCount, votingTotal, threshold, inclusive) {
|
|
1883
1891
|
const ratio = approveCount / votingTotal;
|
|
1884
1892
|
return {
|
|
@@ -2051,15 +2059,32 @@ var ProofOfLearningStrategy = class extends BaseVotingStrategy {
|
|
|
2051
2059
|
threshold,
|
|
2052
2060
|
false
|
|
2053
2061
|
);
|
|
2062
|
+
const weightBasis = deriveWeightBasis(votes, effectiveWeights);
|
|
2063
|
+
const verdict = approved ? "Approved" : "Rejected";
|
|
2054
2064
|
return {
|
|
2055
2065
|
approved,
|
|
2056
2066
|
approvalPercentage,
|
|
2057
2067
|
voteCounts: counts,
|
|
2058
2068
|
weightedCounts,
|
|
2059
|
-
|
|
2069
|
+
weightBasis,
|
|
2070
|
+
reason: `${verdict} with ${approvalPercentage.toFixed(1)}% ${describeBasis(weightBasis)}`
|
|
2060
2071
|
};
|
|
2061
2072
|
}
|
|
2062
2073
|
};
|
|
2074
|
+
function describeBasis(basis) {
|
|
2075
|
+
switch (basis) {
|
|
2076
|
+
case "performance":
|
|
2077
|
+
return "weighted approval (weights from voter performance history)";
|
|
2078
|
+
case "partial":
|
|
2079
|
+
return "partly weighted approval (some voters have no performance history; those count as 1.0)";
|
|
2080
|
+
case "unweighted":
|
|
2081
|
+
return "approval (UNWEIGHTED \u2014 no voter performance history recorded)";
|
|
2082
|
+
default: {
|
|
2083
|
+
const unreachable = basis;
|
|
2084
|
+
throw new Error(`Unhandled weight basis: ${String(unreachable)}`);
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2063
2088
|
function calculateVoteWeight(performance) {
|
|
2064
2089
|
if (performance === void 0 || performance.totalVotes === 0) {
|
|
2065
2090
|
return 1;
|
|
@@ -2115,6 +2140,7 @@ function buildPendingResult(state, proposalId, outcome, config) {
|
|
|
2115
2140
|
votes: new Map(state.votes),
|
|
2116
2141
|
voteCounts: outcome.voteCounts,
|
|
2117
2142
|
weightedCounts: outcome.weightedCounts,
|
|
2143
|
+
weightBasis: outcome.weightBasis,
|
|
2118
2144
|
approvalPercentage: outcome.approvalPercentage,
|
|
2119
2145
|
quorumReached: state.votes.size >= config.minVotersForQuorum,
|
|
2120
2146
|
startedAt: state.startedAt.toISOString(),
|
|
@@ -2133,6 +2159,7 @@ function buildFinalResult(state, proposalId, outcome, config) {
|
|
|
2133
2159
|
votes: new Map(state.votes),
|
|
2134
2160
|
voteCounts: outcome.voteCounts,
|
|
2135
2161
|
weightedCounts: outcome.weightedCounts,
|
|
2162
|
+
weightBasis: outcome.weightBasis,
|
|
2136
2163
|
approvalPercentage: outcome.approvalPercentage,
|
|
2137
2164
|
quorumReached,
|
|
2138
2165
|
startedAt: state.startedAt.toISOString(),
|
|
@@ -2149,6 +2176,7 @@ function buildTimeoutResult(state, proposalId, outcome, config) {
|
|
|
2149
2176
|
votes: new Map(state.votes),
|
|
2150
2177
|
voteCounts: outcome.voteCounts,
|
|
2151
2178
|
weightedCounts: outcome.weightedCounts,
|
|
2179
|
+
weightBasis: outcome.weightBasis,
|
|
2152
2180
|
approvalPercentage: outcome.approvalPercentage,
|
|
2153
2181
|
quorumReached: state.votes.size >= config.minVotersForQuorum,
|
|
2154
2182
|
startedAt: state.startedAt.toISOString(),
|
|
@@ -2414,7 +2442,9 @@ var ConsensusEngine = class {
|
|
|
2414
2442
|
});
|
|
2415
2443
|
if (state.proposal.algorithm === "proof_of_learning") {
|
|
2416
2444
|
const performance = this.agentPerformance.get(agentId);
|
|
2417
|
-
|
|
2445
|
+
if (performance !== void 0) {
|
|
2446
|
+
state.voteWeights.set(agentId, calculateVoteWeight(performance));
|
|
2447
|
+
}
|
|
2418
2448
|
}
|
|
2419
2449
|
this.logger.debug("Vote recorded", {
|
|
2420
2450
|
proposalId: state.proposal.id,
|
|
@@ -2692,13 +2722,15 @@ var QuorumValidator = class {
|
|
|
2692
2722
|
const { votes, agentWeights, config, requiredParticipants } = input;
|
|
2693
2723
|
const voteCounts = this.countVotes(votes);
|
|
2694
2724
|
const { totalWeight, weightedCounts } = this.calculateWeights(votes, agentWeights, config);
|
|
2695
|
-
const
|
|
2725
|
+
const anyWeightSupplied = [...votes.keys()].some((id) => agentWeights?.has(id) === true);
|
|
2726
|
+
const { threshold, actualQuorum, quorumReached, reasoning } = this.calculateQuorumStatus({
|
|
2696
2727
|
voteCounts,
|
|
2697
2728
|
weightedCounts,
|
|
2698
2729
|
totalWeight,
|
|
2699
2730
|
config,
|
|
2700
|
-
requiredParticipants ?? votes.size
|
|
2701
|
-
|
|
2731
|
+
requiredParticipants: requiredParticipants ?? votes.size,
|
|
2732
|
+
anyWeightSupplied
|
|
2733
|
+
});
|
|
2702
2734
|
return {
|
|
2703
2735
|
totalVotes: votes.size,
|
|
2704
2736
|
voteCounts,
|
|
@@ -2759,37 +2791,50 @@ var QuorumValidator = class {
|
|
|
2759
2791
|
addWeightToDecision(counts, decision, weight) {
|
|
2760
2792
|
counts[decision] += weight;
|
|
2761
2793
|
}
|
|
2762
|
-
calculateQuorumStatus(
|
|
2794
|
+
calculateQuorumStatus(opts) {
|
|
2795
|
+
const { voteCounts, weightedCounts, totalWeight, config, requiredParticipants, anyWeightSupplied } = opts;
|
|
2763
2796
|
const threshold = config.threshold;
|
|
2764
2797
|
if (weightedCounts !== void 0 && totalWeight !== void 0 && totalWeight > 0) {
|
|
2765
|
-
return this.calculateWeightedQuorum(weightedCounts, totalWeight, threshold);
|
|
2798
|
+
return this.calculateWeightedQuorum(weightedCounts, totalWeight, threshold, anyWeightSupplied);
|
|
2766
2799
|
}
|
|
2767
2800
|
return this.calculateSimpleQuorum(voteCounts, requiredParticipants, threshold, config);
|
|
2768
2801
|
}
|
|
2769
|
-
calculateWeightedQuorum(weightedCounts, totalWeight, threshold) {
|
|
2802
|
+
calculateWeightedQuorum(weightedCounts, totalWeight, threshold, anyWeightSupplied) {
|
|
2770
2803
|
const quorumReached = totalWeight >= threshold;
|
|
2771
2804
|
const approveRatio = weightedCounts.approve / totalWeight;
|
|
2772
2805
|
const rejectRatio = weightedCounts.reject / totalWeight;
|
|
2773
|
-
const reasoning = this.buildWeightedReasoning(
|
|
2806
|
+
const reasoning = this.buildWeightedReasoning({
|
|
2774
2807
|
quorumReached,
|
|
2775
2808
|
totalWeight,
|
|
2776
2809
|
threshold,
|
|
2777
2810
|
approveRatio,
|
|
2778
|
-
rejectRatio
|
|
2779
|
-
|
|
2811
|
+
rejectRatio,
|
|
2812
|
+
weighted: anyWeightSupplied
|
|
2813
|
+
});
|
|
2780
2814
|
return { threshold, actualQuorum: totalWeight, quorumReached, reasoning };
|
|
2781
2815
|
}
|
|
2782
|
-
|
|
2816
|
+
/**
|
|
2817
|
+
* Reasoning text for the weighted-quorum branch.
|
|
2818
|
+
*
|
|
2819
|
+
* `weighted` is qualified rather than asserted (#5117). `agentWeights` has no
|
|
2820
|
+
* non-test producer, so every real call reaches `getVoteWeight`'s `?? 1.0`
|
|
2821
|
+
* fallback and this branch describes a plain headcount as a weighted ratio.
|
|
2822
|
+
* The word is kept where weights genuinely varied and replaced where they
|
|
2823
|
+
* did not, so the reader can tell the two apart.
|
|
2824
|
+
*/
|
|
2825
|
+
buildWeightedReasoning(opts) {
|
|
2826
|
+
const { quorumReached, totalWeight, threshold, approveRatio, rejectRatio, weighted } = opts;
|
|
2827
|
+
const kind = weighted ? "weighted" : "unweighted (no agent weights supplied)";
|
|
2783
2828
|
if (!quorumReached) {
|
|
2784
|
-
return `
|
|
2829
|
+
return `Quorum not reached: ${totalWeight.toFixed(2)} < ${String(threshold)} (${kind})`;
|
|
2785
2830
|
}
|
|
2786
2831
|
if (approveRatio > rejectRatio) {
|
|
2787
|
-
return `Approval wins with
|
|
2832
|
+
return `Approval wins with ${kind} ratio ${formatPercentage(approveRatio, 1)}`;
|
|
2788
2833
|
}
|
|
2789
2834
|
if (rejectRatio > approveRatio) {
|
|
2790
|
-
return `Rejection wins with
|
|
2835
|
+
return `Rejection wins with ${kind} ratio ${formatPercentage(rejectRatio, 1)}`;
|
|
2791
2836
|
}
|
|
2792
|
-
return `No clear winner: approve=${formatPercentage(approveRatio, 1)}, reject=${formatPercentage(rejectRatio, 1)}`;
|
|
2837
|
+
return `No clear winner: approve=${formatPercentage(approveRatio, 1)}, reject=${formatPercentage(rejectRatio, 1)} (${kind})`;
|
|
2793
2838
|
}
|
|
2794
2839
|
calculateSimpleQuorum(voteCounts, requiredParticipants, threshold, config) {
|
|
2795
2840
|
const activeVotes = config.includeAbstentions === true ? voteCounts.total : voteCounts.approve + voteCounts.reject;
|
|
@@ -6803,4 +6848,4 @@ export {
|
|
|
6803
6848
|
CONSENSUS_VOTE_TOOL_SCHEMA,
|
|
6804
6849
|
registerConsensusVoteTool
|
|
6805
6850
|
};
|
|
6806
|
-
//# sourceMappingURL=chunk-
|
|
6851
|
+
//# sourceMappingURL=chunk-UNM2AHS6.js.map
|