nexus-agents 8.54.2 → 8.54.3

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.
Files changed (26) hide show
  1. package/dist/{chunk-6V7M5GMP.js → chunk-253OM7JW.js} +154 -150
  2. package/dist/chunk-253OM7JW.js.map +1 -0
  3. package/dist/{chunk-76XZLP7W.js → chunk-3SNMZ7A2.js} +7 -7
  4. package/dist/{chunk-H2I3PY2R.js → chunk-GY5O732B.js} +2 -2
  5. package/dist/{chunk-4S43V6TV.js → chunk-GY6KBAPQ.js} +20 -16
  6. package/dist/chunk-GY6KBAPQ.js.map +1 -0
  7. package/dist/{chunk-67RGKVAW.js → chunk-HRWUTTG6.js} +3 -3
  8. package/dist/{chunk-TQPUOOUS.js → chunk-JM56BI6T.js} +2 -2
  9. package/dist/cli.d.ts +1 -1
  10. package/dist/cli.js +7 -7
  11. package/dist/{consensus-vote-F5ZGGT7X.js → consensus-vote-3555TADI.js} +4 -4
  12. package/dist/{consensus-vote-types-CXSFJkat.d.ts → consensus-vote-types-O6pIvFs5.d.ts} +26 -15
  13. package/dist/{improvement-review-JZWJEOUB.js → improvement-review-CNDSB7OU.js} +4 -4
  14. package/dist/index.d.ts +52 -7
  15. package/dist/index.js +6 -6
  16. package/dist/{setup-data-dir-CNCF2HJX.js → setup-data-dir-V3Q6OSOO.js} +3 -3
  17. package/package.json +1 -1
  18. package/dist/chunk-4S43V6TV.js.map +0 -1
  19. package/dist/chunk-6V7M5GMP.js.map +0 -1
  20. /package/dist/{chunk-76XZLP7W.js.map → chunk-3SNMZ7A2.js.map} +0 -0
  21. /package/dist/{chunk-H2I3PY2R.js.map → chunk-GY5O732B.js.map} +0 -0
  22. /package/dist/{chunk-67RGKVAW.js.map → chunk-HRWUTTG6.js.map} +0 -0
  23. /package/dist/{chunk-TQPUOOUS.js.map → chunk-JM56BI6T.js.map} +0 -0
  24. /package/dist/{consensus-vote-F5ZGGT7X.js.map → consensus-vote-3555TADI.js.map} +0 -0
  25. /package/dist/{improvement-review-JZWJEOUB.js.map → improvement-review-CNDSB7OU.js.map} +0 -0
  26. /package/dist/{setup-data-dir-CNCF2HJX.js.map → setup-data-dir-V3Q6OSOO.js.map} +0 -0
@@ -8,6 +8,7 @@ import {
8
8
  import {
9
9
  DEFAULT_CONSENSUS_CONFIG,
10
10
  DEFAULT_INCREMENTAL_QUORUM_CONFIG,
11
+ ERROR_FLOOR_FRACTION,
11
12
  NOOP_NOTIFIER,
12
13
  ProposalSchema,
13
14
  SUPERMAJORITY_THRESHOLD,
@@ -23,10 +24,10 @@ import {
23
24
  toolSuccessStructured,
24
25
  withProgressHeartbeat,
25
26
  wrapToolWithTimeout
26
- } from "./chunk-4S43V6TV.js";
27
+ } from "./chunk-GY6KBAPQ.js";
27
28
  import {
28
29
  VERSION
29
- } from "./chunk-TQPUOOUS.js";
30
+ } from "./chunk-JM56BI6T.js";
30
31
  import {
31
32
  UNRESOLVED_MODEL_ID,
32
33
  assessPanelIndependence,
@@ -102,6 +103,47 @@ function boundArtifactForReview(text, budget, label) {
102
103
  };
103
104
  }
104
105
 
106
+ // src/cli/voter-roles.ts
107
+ var VOTER_ROLES = {
108
+ architect: "Software Architect - evaluates technical design, scalability, and maintainability",
109
+ security: "Security Engineer - evaluates security implications, vulnerabilities, and attack vectors",
110
+ devex: "Developer Experience - evaluates usability, documentation, and developer workflow",
111
+ ai_ml: "AI/ML Engineer - evaluates AI/ML aspects, model selection, and learning capabilities",
112
+ pm: "Product Manager - evaluates business value, user impact, and resource allocation",
113
+ catfish: "Contrarian Analyst - deliberately challenges proposals to prevent agreement bias (arXiv:2505.21503)",
114
+ scope_steward: "Scope Steward - asks whether to build at all; checks existing tools, biases toward kill-the-feature (#2185)"
115
+ };
116
+ function getVoterRoles(quickMode) {
117
+ return quickMode ? ["architect", "security", "scope_steward"] : ["architect", "security", "devex", "ai_ml", "pm", "catfish", "scope_steward"];
118
+ }
119
+
120
+ // src/consensus/decision/strategy.ts
121
+ function resolveStrategy(input) {
122
+ if (input.strategy !== void 0) return input.strategy;
123
+ if (input.threshold !== void 0) {
124
+ switch (input.threshold) {
125
+ case "majority":
126
+ return "simple_majority";
127
+ case "supermajority":
128
+ return "supermajority";
129
+ case "unanimous":
130
+ return "unanimous";
131
+ }
132
+ }
133
+ return "simple_majority";
134
+ }
135
+ function strategyToAlgorithm(strategy) {
136
+ if (strategy === "higher_order") return "higher_order";
137
+ if (strategy === "opinion_wise") return "opinion_wise";
138
+ return strategy;
139
+ }
140
+ function getDefaultErrorPolicy(strategy) {
141
+ if (strategy === "unanimous") {
142
+ return "fail_closed";
143
+ }
144
+ return "reduce_denominator";
145
+ }
146
+
105
147
  // src/cli/voter-model-overrides.ts
106
148
  function voterModelOverrideEnvKey(role) {
107
149
  return `NEXUS_VOTER_MODEL_${role.toUpperCase()}`;
@@ -134,17 +176,6 @@ function resolveVoterModelOverrides(roles, gatewayAdapters, logger11) {
134
176
  return overrides;
135
177
  }
136
178
 
137
- // src/cli/vote-types.ts
138
- var VOTER_ROLES = {
139
- architect: "Software Architect - evaluates technical design, scalability, and maintainability",
140
- security: "Security Engineer - evaluates security implications, vulnerabilities, and attack vectors",
141
- devex: "Developer Experience - evaluates usability, documentation, and developer workflow",
142
- ai_ml: "AI/ML Engineer - evaluates AI/ML aspects, model selection, and learning capabilities",
143
- pm: "Product Manager - evaluates business value, user impact, and resource allocation",
144
- catfish: "Contrarian Analyst - deliberately challenges proposals to prevent agreement bias (arXiv:2505.21503)",
145
- scope_steward: "Scope Steward - asks whether to build at all; checks existing tools, biases toward kill-the-feature (#2185)"
146
- };
147
-
148
179
  // src/cli/panel-independence.ts
149
180
  function reportPanelIndependence(adapters, roleCount, phase, logger11) {
150
181
  reportPanelModelIndependence(
@@ -2260,6 +2291,113 @@ function createHigherOrderVotingStrategy(options) {
2260
2291
  return new HigherOrderVotingStrategy(options);
2261
2292
  }
2262
2293
 
2294
+ // src/consensus/decision/verdict.ts
2295
+ function evaluateThreshold(approveCount, votingTotal, threshold, inclusive) {
2296
+ const ratio = approveCount / votingTotal;
2297
+ return {
2298
+ approved: inclusive ? ratio >= threshold : ratio > threshold,
2299
+ approvalPercentage: ratio * 100
2300
+ };
2301
+ }
2302
+ function determineFinalStatus(quorumReached, approved) {
2303
+ if (!quorumReached || !approved) return "rejected";
2304
+ return "approved";
2305
+ }
2306
+ function mapOutcomeToDecision(outcome) {
2307
+ switch (outcome) {
2308
+ case "approved":
2309
+ return "approved";
2310
+ case "rejected":
2311
+ return "rejected";
2312
+ case "timeout":
2313
+ return "timeout";
2314
+ default:
2315
+ return "pending";
2316
+ }
2317
+ }
2318
+ function absoluteQuorumFraction(strategy) {
2319
+ switch (strategy) {
2320
+ case "supermajority":
2321
+ return 2 / 3;
2322
+ case "unanimous":
2323
+ return 1;
2324
+ default:
2325
+ return 0.5;
2326
+ }
2327
+ }
2328
+ function minimumRespondents(panelSize) {
2329
+ if (panelSize <= 0) return 0;
2330
+ return Math.min(panelSize, Math.max(Math.ceil(panelSize * 2 / 3), 3));
2331
+ }
2332
+ function absoluteQuorumDegradeReason(result, errorCount) {
2333
+ const contrarianVote = result.votes.find((v) => v.role === "catfish");
2334
+ const contrarianOk = contrarianVote !== void 0 && !isAbsentSeat(contrarianVote);
2335
+ const contrarianDegraded = result.contrarianRequested === true && !contrarianOk;
2336
+ const unverifiableRoles = result.votes.filter((v) => v.source === "unverifiable").map((v) => v.role);
2337
+ if (errorCount === 0 && unverifiableRoles.length === 0 && !contrarianDegraded) return void 0;
2338
+ const erroredRoles = result.votes.filter((v) => v.source === "error").map((v) => v.role);
2339
+ const missingContrarian = contrarianDegraded && contrarianVote === void 0;
2340
+ const named = missingContrarian ? [...erroredRoles, "catfish"] : erroredRoles;
2341
+ return `no_quorum: re-run \u2014 ${absentSeatClauses(named, unverifiableRoles).join("; ")} (absolute_quorum)`;
2342
+ }
2343
+ function absentSeatClauses(erroredNames, unverifiable) {
2344
+ const clauses = [];
2345
+ if (erroredNames.length > 0 || unverifiable.length === 0) {
2346
+ const list = erroredNames.length > 0 ? erroredNames.join(", ") : "contrarian";
2347
+ clauses.push(`voter(s) [${list}] errored`);
2348
+ }
2349
+ if (unverifiable.length > 0) {
2350
+ clauses.push(
2351
+ `voter(s) [${unverifiable.join(", ")}] unverifiable \u2014 could not read the artifact`
2352
+ );
2353
+ }
2354
+ return clauses;
2355
+ }
2356
+ function computeAbsoluteQuorumDecision(result, errorCount, allErrors) {
2357
+ const degradeReason = absoluteQuorumDegradeReason(result, errorCount);
2358
+ if (degradeReason !== void 0) return { decision: "no_quorum", degradeReason };
2359
+ const panel = result.panelSize ?? result.votes.length;
2360
+ const needed = Math.ceil(absoluteQuorumFraction(result.strategy) * panel);
2361
+ const approveCount = result.votes.filter(
2362
+ (v) => v.source !== "error" && v.vote.decision === "approve"
2363
+ ).length;
2364
+ if (result.result.outcome === "approved" && approveCount >= needed) {
2365
+ return { decision: "approved" };
2366
+ }
2367
+ if (result.result.outcome === "rejected" && !allErrors) {
2368
+ return { decision: "rejected" };
2369
+ }
2370
+ return {
2371
+ decision: "no_quorum",
2372
+ degradeReason: `no_quorum: absolute quorum not met (${String(approveCount)}/${String(needed)} approvals over ${String(panel)}-voter panel, absolute_quorum)`
2373
+ };
2374
+ }
2375
+ function respondentFloorOutcome(result) {
2376
+ if (result.result.outcome !== "approved") return void 0;
2377
+ const panel = result.panelSize ?? result.votes.length;
2378
+ const floor = minimumRespondents(panel);
2379
+ const respondents = result.votes.filter(
2380
+ (v) => v.source !== "error" && (v.vote.decision === "approve" || v.vote.decision === "reject")
2381
+ ).length;
2382
+ if (respondents >= floor) return void 0;
2383
+ return {
2384
+ decision: "no_quorum",
2385
+ degradeReason: `no_quorum: ${String(respondents)} of ${String(panel)} voters decided; ${String(floor)} required before a ratio is applied (#5780)`
2386
+ };
2387
+ }
2388
+ function resolveVoteDecision(input, result, errorCount) {
2389
+ const allErrors = errorCount === result.votes.length && errorCount > 0;
2390
+ if (result.policyReason !== void 0 || !result.result.quorumReached && allErrors) {
2391
+ return { decision: "no_quorum" };
2392
+ }
2393
+ if (input.errorPolicy === "absolute_quorum") {
2394
+ const quorumOutcome = computeAbsoluteQuorumDecision(result, errorCount, allErrors);
2395
+ if (quorumOutcome.decision !== "approved") return quorumOutcome;
2396
+ return respondentFloorOutcome(result) ?? quorumOutcome;
2397
+ }
2398
+ return respondentFloorOutcome(result) ?? { decision: mapOutcomeToDecision(result.result.outcome) };
2399
+ }
2400
+
2263
2401
  // src/consensus/strategies.ts
2264
2402
  function deriveWeightBasis(votes, weights) {
2265
2403
  let withRecord = 0;
@@ -2269,13 +2407,6 @@ function deriveWeightBasis(votes, weights) {
2269
2407
  if (withRecord === 0) return "unweighted";
2270
2408
  return withRecord === votes.size ? "performance" : "partial";
2271
2409
  }
2272
- function evaluateThreshold(approveCount, votingTotal, threshold, inclusive) {
2273
- const ratio = approveCount / votingTotal;
2274
- return {
2275
- approved: inclusive ? ratio >= threshold : ratio > threshold,
2276
- approvalPercentage: ratio * 100
2277
- };
2278
- }
2279
2410
  var BaseVotingStrategy = class {
2280
2411
  /**
2281
2412
  * Count votes by decision type.
@@ -2567,10 +2698,6 @@ function buildTimeoutResult(state, proposalId, outcome, config) {
2567
2698
  durationMs: now.getTime() - state.startedAt.getTime()
2568
2699
  };
2569
2700
  }
2570
- function determineFinalStatus(quorumReached, approved) {
2571
- if (!quorumReached || !approved) return "rejected";
2572
- return "approved";
2573
- }
2574
2701
 
2575
2702
  // src/consensus/helpers.ts
2576
2703
  function generateProposalId() {
@@ -5168,13 +5295,6 @@ var ErrorPolicySchema = z7.enum([
5168
5295
  "absolute_quorum"
5169
5296
  ]);
5170
5297
  var VoteThresholdSchema = z7.enum(["majority", "supermajority", "unanimous"]);
5171
- var ERROR_FLOOR_FRACTION = 0.5;
5172
- function getDefaultErrorPolicy(strategy) {
5173
- if (strategy === "unanimous") {
5174
- return "fail_closed";
5175
- }
5176
- return "reduce_denominator";
5177
- }
5178
5298
  var ConsensusVoteInputSchema = z7.object({
5179
5299
  proposal: z7.string().min(1).max(MAX_PROPOSAL_LENGTH).describe(
5180
5300
  'Proposal text to vote on. If the proposal asks voters to choose among named alternatives, declare them in `options` (#4472) \u2014 otherwise the tally records approve/reject/abstain only, so every voter who engages returns `approve` and a 6-1 split on WHICH option persists as 7-0, 100% (#4452). This is ENFORCED AS A WARNING, not a refusal: a heuristic over the proposal text flags an apparent multi-option proposal with no `options` and says so on `panelWarning` (#5360). The wording says "declare", not "MUST", because the warning is what the code actually holds \u2014 it is tightened back only in the same change that promotes the warning to a refusal.'
@@ -5277,18 +5397,6 @@ function toAgentVoteSummary(result) {
5277
5397
  ...result.fallback !== void 0 ? { fallback: result.fallback } : {}
5278
5398
  };
5279
5399
  }
5280
- function mapOutcomeToDecision(outcome) {
5281
- switch (outcome) {
5282
- case "approved":
5283
- return "approved";
5284
- case "rejected":
5285
- return "rejected";
5286
- case "timeout":
5287
- return "timeout";
5288
- default:
5289
- return "pending";
5290
- }
5291
- }
5292
5400
  function panelDegradationWarning(errorCount, total) {
5293
5401
  if (errorCount <= 0 || errorCount >= total) return void 0;
5294
5402
  return `Panel degraded: ${String(errorCount)} of ${String(total)} voters errored; decision rests on ${String(total - errorCount)} voter(s).`;
@@ -5302,88 +5410,6 @@ function unverifiableSeatsWarning(unverifiableCount, total) {
5302
5410
  return `${String(unverifiableCount)} of ${String(total)} seat(s) could not read the artifact and are recorded as unverifiable (counted as abstain in voteCounts; any decision they returned was discarded).`;
5303
5411
  }
5304
5412
  var degradedPanelCount = 0;
5305
- function absoluteQuorumFraction(strategy) {
5306
- switch (strategy) {
5307
- case "supermajority":
5308
- return 2 / 3;
5309
- case "unanimous":
5310
- return 1;
5311
- default:
5312
- return 0.5;
5313
- }
5314
- }
5315
- function minimumRespondents(panelSize) {
5316
- if (panelSize <= 0) return 0;
5317
- return Math.min(panelSize, Math.max(Math.ceil(panelSize * 2 / 3), 3));
5318
- }
5319
- function absoluteQuorumDegradeReason(result, errorCount) {
5320
- const contrarianVote = result.votes.find((v) => v.role === "catfish");
5321
- const contrarianOk = contrarianVote !== void 0 && !isAbsentSeat(contrarianVote);
5322
- const contrarianDegraded = result.contrarianRequested === true && !contrarianOk;
5323
- const unverifiableRoles = result.votes.filter((v) => v.source === "unverifiable").map((v) => v.role);
5324
- if (errorCount === 0 && unverifiableRoles.length === 0 && !contrarianDegraded) return void 0;
5325
- const erroredRoles = result.votes.filter((v) => v.source === "error").map((v) => v.role);
5326
- const missingContrarian = contrarianDegraded && contrarianVote === void 0;
5327
- const named = missingContrarian ? [...erroredRoles, "catfish"] : erroredRoles;
5328
- return `no_quorum: re-run \u2014 ${absentSeatClauses(named, unverifiableRoles).join("; ")} (absolute_quorum)`;
5329
- }
5330
- function absentSeatClauses(erroredNames, unverifiable) {
5331
- const clauses = [];
5332
- if (erroredNames.length > 0 || unverifiable.length === 0) {
5333
- const list = erroredNames.length > 0 ? erroredNames.join(", ") : "contrarian";
5334
- clauses.push(`voter(s) [${list}] errored`);
5335
- }
5336
- if (unverifiable.length > 0) {
5337
- clauses.push(
5338
- `voter(s) [${unverifiable.join(", ")}] unverifiable \u2014 could not read the artifact`
5339
- );
5340
- }
5341
- return clauses;
5342
- }
5343
- function computeAbsoluteQuorumDecision(result, errorCount, allErrors) {
5344
- const degradeReason = absoluteQuorumDegradeReason(result, errorCount);
5345
- if (degradeReason !== void 0) return { decision: "no_quorum", degradeReason };
5346
- const panel = result.panelSize ?? result.votes.length;
5347
- const needed = Math.ceil(absoluteQuorumFraction(result.strategy) * panel);
5348
- const approveCount = result.votes.filter(
5349
- (v) => v.source !== "error" && v.vote.decision === "approve"
5350
- ).length;
5351
- if (result.result.outcome === "approved" && approveCount >= needed) {
5352
- return { decision: "approved" };
5353
- }
5354
- if (result.result.outcome === "rejected" && !allErrors) {
5355
- return { decision: "rejected" };
5356
- }
5357
- return {
5358
- decision: "no_quorum",
5359
- degradeReason: `no_quorum: absolute quorum not met (${String(approveCount)}/${String(needed)} approvals over ${String(panel)}-voter panel, absolute_quorum)`
5360
- };
5361
- }
5362
- function respondentFloorOutcome(result) {
5363
- if (result.result.outcome !== "approved") return void 0;
5364
- const panel = result.panelSize ?? result.votes.length;
5365
- const floor = minimumRespondents(panel);
5366
- const respondents = result.votes.filter(
5367
- (v) => v.source !== "error" && (v.vote.decision === "approve" || v.vote.decision === "reject")
5368
- ).length;
5369
- if (respondents >= floor) return void 0;
5370
- return {
5371
- decision: "no_quorum",
5372
- degradeReason: `no_quorum: ${String(respondents)} of ${String(panel)} voters decided; ${String(floor)} required before a ratio is applied (#5780)`
5373
- };
5374
- }
5375
- function resolveVoteDecision(input, result, errorCount) {
5376
- const allErrors = errorCount === result.votes.length && errorCount > 0;
5377
- if (result.policyReason !== void 0 || !result.result.quorumReached && allErrors) {
5378
- return { decision: "no_quorum" };
5379
- }
5380
- if (input.errorPolicy === "absolute_quorum") {
5381
- const quorumOutcome = computeAbsoluteQuorumDecision(result, errorCount, allErrors);
5382
- if (quorumOutcome.decision !== "approved") return quorumOutcome;
5383
- return respondentFloorOutcome(result) ?? quorumOutcome;
5384
- }
5385
- return respondentFloorOutcome(result) ?? { decision: mapOutcomeToDecision(result.result.outcome) };
5386
- }
5387
5413
  function applyAbsoluteQuorumTelemetry(response, input, decision, degradeReason) {
5388
5414
  if (input.errorPolicy === "absolute_quorum" && decision === "no_quorum") {
5389
5415
  degradedPanelCount++;
@@ -7581,28 +7607,6 @@ function getOrCreateCorrelationTracker() {
7581
7607
  function resetCorrelationTracker() {
7582
7608
  persistentCorrelationTracker = void 0;
7583
7609
  }
7584
- function resolveStrategy(input) {
7585
- if (input.strategy !== void 0) return input.strategy;
7586
- if (input.threshold !== void 0) {
7587
- switch (input.threshold) {
7588
- case "majority":
7589
- return "simple_majority";
7590
- case "supermajority":
7591
- return "supermajority";
7592
- case "unanimous":
7593
- return "unanimous";
7594
- }
7595
- }
7596
- return "simple_majority";
7597
- }
7598
- function strategyToAlgorithm(strategy) {
7599
- if (strategy === "higher_order") return "higher_order";
7600
- if (strategy === "opinion_wise") return "opinion_wise";
7601
- return strategy;
7602
- }
7603
- function getVoterRoles(quickMode) {
7604
- return quickMode ? ["architect", "security", "scope_steward"] : ["architect", "security", "devex", "ai_ml", "pm", "catfish", "scope_steward"];
7605
- }
7606
7610
  function createEmptyConsensusResult(proposal, algorithm) {
7607
7611
  const now = (/* @__PURE__ */ new Date()).toISOString();
7608
7612
  return {
@@ -8395,6 +8399,8 @@ export {
8395
8399
  createOWVoting,
8396
8400
  HigherOrderVotingStrategy,
8397
8401
  createHigherOrderVotingStrategy,
8402
+ determineFinalStatus,
8403
+ mapOutcomeToDecision,
8398
8404
  SimpleMajorityStrategy,
8399
8405
  SupermajorityStrategy,
8400
8406
  UnanimousStrategy,
@@ -8405,7 +8411,6 @@ export {
8405
8411
  buildPendingResult,
8406
8412
  buildFinalResult,
8407
8413
  buildTimeoutResult,
8408
- determineFinalStatus,
8409
8414
  generateProposalId,
8410
8415
  ConsensusError,
8411
8416
  ConsensusEngine,
@@ -8423,7 +8428,6 @@ export {
8423
8428
  VoteThresholdSchema,
8424
8429
  ConsensusVoteInputSchema,
8425
8430
  toRecordDecision,
8426
- mapOutcomeToDecision,
8427
8431
  serializeValidatedRecord,
8428
8432
  assertNotSourceCheckoutWrite,
8429
8433
  recordAuthenticVote,
@@ -8441,4 +8445,4 @@ export {
8441
8445
  CONSENSUS_VOTE_TOOL_SCHEMA,
8442
8446
  registerConsensusVoteTool
8443
8447
  };
8444
- //# sourceMappingURL=chunk-6V7M5GMP.js.map
8448
+ //# sourceMappingURL=chunk-253OM7JW.js.map