nexus-agents 2.79.3 → 2.80.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.
Files changed (127) hide show
  1. package/README.md +2 -2
  2. package/dist/{child-mcp-config-CTO2MBRM.js → child-mcp-config-SM5I7USN.js} +3 -3
  3. package/dist/{chunk-YXWGEIQR.js → chunk-2DBPZQLO.js} +8 -5
  4. package/dist/chunk-2DBPZQLO.js.map +1 -0
  5. package/dist/chunk-2JQXC3CK.js +317 -0
  6. package/dist/chunk-2JQXC3CK.js.map +1 -0
  7. package/dist/{chunk-6E3NMMEY.js → chunk-3RZWLQSC.js} +2 -2
  8. package/dist/{chunk-6E3NMMEY.js.map → chunk-3RZWLQSC.js.map} +1 -1
  9. package/dist/{chunk-2UYTFLMO.js → chunk-4XGKCVJL.js} +2 -2
  10. package/dist/{chunk-SWFJU3W2.js → chunk-6CJIKX6I.js} +63 -51
  11. package/dist/chunk-6CJIKX6I.js.map +1 -0
  12. package/dist/{chunk-3NIPH6UP.js → chunk-AYZ6P7CK.js} +2 -2
  13. package/dist/{chunk-HYU4GZY6.js → chunk-BSIGP5XF.js} +2 -2
  14. package/dist/{chunk-GONMG4NM.js → chunk-CTSESEFA.js} +2 -2
  15. package/dist/{chunk-FVPYP5DD.js → chunk-EKRMWVAH.js} +4 -4
  16. package/dist/{chunk-7XCUZI4G.js → chunk-EVZ7YR7H.js} +4 -4
  17. package/dist/{chunk-L6SCKLGO.js → chunk-FAJAWO42.js} +3 -3
  18. package/dist/{chunk-5O6XLBPP.js → chunk-FJHZW7CR.js} +2 -2
  19. package/dist/{chunk-HB4MIDHJ.js → chunk-GNRANMQ3.js} +122 -72
  20. package/dist/chunk-GNRANMQ3.js.map +1 -0
  21. package/dist/{chunk-KT5FIBWS.js → chunk-HBKZ2DJK.js} +2 -2
  22. package/dist/{chunk-2YPG6PDG.js → chunk-J5XEJHIQ.js} +3 -3
  23. package/dist/{chunk-ZVCED4Z4.js → chunk-JLWKHYIU.js} +2 -2
  24. package/dist/{chunk-DLXT23AC.js → chunk-JXDDSNEK.js} +2 -2
  25. package/dist/{chunk-Q5CFPIJ5.js → chunk-OO6MTUDS.js} +4 -4
  26. package/dist/chunk-Q2U6SFN2.js +136 -0
  27. package/dist/chunk-Q2U6SFN2.js.map +1 -0
  28. package/dist/{chunk-6TFTVW77.js → chunk-QVHXEQFM.js} +3 -3
  29. package/dist/{chunk-FJWWSVWB.js → chunk-RIUUFBX4.js} +2 -2
  30. package/dist/{chunk-DNO2INX5.js → chunk-SHVGZK4A.js} +4 -4
  31. package/dist/{chunk-VIQOVK4E.js → chunk-SJUSQGKH.js} +82 -186
  32. package/dist/chunk-SJUSQGKH.js.map +1 -0
  33. package/dist/{chunk-JI7S55R3.js → chunk-UGXR4PAY.js} +35 -9
  34. package/dist/chunk-UGXR4PAY.js.map +1 -0
  35. package/dist/{chunk-SD76JZBG.js → chunk-UVALD724.js} +2 -2
  36. package/dist/{chunk-K2QILJG4.js → chunk-VS4KB3AX.js} +33 -9
  37. package/dist/chunk-VS4KB3AX.js.map +1 -0
  38. package/dist/{chunk-PLX6FCFC.js → chunk-YGKPWUJ6.js} +2 -2
  39. package/dist/{chunk-WDYCIJWN.js → chunk-YMT6H2HQ.js} +13 -14
  40. package/dist/chunk-YMT6H2HQ.js.map +1 -0
  41. package/dist/{chunk-D6TM2VHX.js → chunk-ZU2Q3DWE.js} +49 -24
  42. package/dist/chunk-ZU2Q3DWE.js.map +1 -0
  43. package/dist/{cli-circuit-breaker-I74ZQ44Q.js → cli-circuit-breaker-JGX54DAD.js} +5 -5
  44. package/dist/cli.d.ts +1 -1
  45. package/dist/cli.js +574 -531
  46. package/dist/cli.js.map +1 -1
  47. package/dist/{composite-router-V3OC57IE.js → composite-router-UYFYSMBT.js} +3 -3
  48. package/dist/{consensus-vote-ESFPGEJE.js → consensus-vote-BZ6JSN67.js} +12 -12
  49. package/dist/{context-retriever-MB3D7KS6.js → context-retriever-G23VVJ5S.js} +6 -6
  50. package/dist/{doctor-deep-KQ765XZA.js → doctor-deep-OF2LXZ6A.js} +4 -4
  51. package/dist/expert-bridge-6ZLD2NWD.js +11 -0
  52. package/dist/{factory-LHHYDVZX.js → factory-I54TX7OY.js} +5 -5
  53. package/dist/factory-UHDCLEUE.js +14 -0
  54. package/dist/index.d.ts +31 -7
  55. package/dist/index.js +31 -29
  56. package/dist/index.js.map +1 -1
  57. package/dist/{init-opencode-GXZN2W5S.js → init-opencode-FE7HVWQL.js} +6 -6
  58. package/dist/issue-triage-7NR5NQUY.js +15 -0
  59. package/dist/{learning-persistence-Q3HTOGTU.js → learning-persistence-TGOBRUUU.js} +2 -2
  60. package/dist/{pr-reviewer-helpers-XCY7HOPE.js → pr-reviewer-helpers-L4L324FQ.js} +2 -2
  61. package/dist/{registry-command-6E4YKAMT.js → registry-command-NZLX7ZFV.js} +3 -3
  62. package/dist/{repo-security-plan-AGRU72DL.js → repo-security-plan-74GJWJSV.js} +4 -4
  63. package/dist/{research-helpers-synthesize-K2UCJQQG.js → research-helpers-synthesize-LFPEXRIV.js} +4 -4
  64. package/dist/{routing-memory-3B6DDZ76.js → routing-memory-Y2LSEQVS.js} +3 -3
  65. package/dist/{session-memory-L7EQIY2O.js → session-memory-RCNQJDJR.js} +4 -4
  66. package/dist/{setup-command-QSAGFMGN.js → setup-command-ZPLPOJF2.js} +13 -10
  67. package/dist/setup-config-F7VRWXY3.js +10 -0
  68. package/dist/{setup-custom-api-IBDV654K.js → setup-custom-api-XTJ6YZM6.js} +5 -5
  69. package/dist/{tool-memory-6HCHQLAN.js → tool-memory-COZK6SR7.js} +5 -5
  70. package/dist/{weather-report-ER3WUZ7S.js → weather-report-O4XOYGPK.js} +3 -3
  71. package/package.json +4 -4
  72. package/scripts/postinstall.js +1 -1
  73. package/dist/chunk-7BMOZJYS.js +0 -83
  74. package/dist/chunk-7BMOZJYS.js.map +0 -1
  75. package/dist/chunk-D6TM2VHX.js.map +0 -1
  76. package/dist/chunk-HB4MIDHJ.js.map +0 -1
  77. package/dist/chunk-JI7S55R3.js.map +0 -1
  78. package/dist/chunk-K2QILJG4.js.map +0 -1
  79. package/dist/chunk-SWFJU3W2.js.map +0 -1
  80. package/dist/chunk-VIQOVK4E.js.map +0 -1
  81. package/dist/chunk-WDYCIJWN.js.map +0 -1
  82. package/dist/chunk-YXWGEIQR.js.map +0 -1
  83. package/dist/expert-bridge-JKLC57IC.js +0 -10
  84. package/dist/factory-BUUXNGIB.js +0 -14
  85. package/dist/issue-triage-RMXPDZ2K.js +0 -15
  86. package/dist/setup-config-EQT24DD4.js +0 -10
  87. /package/dist/{child-mcp-config-CTO2MBRM.js.map → child-mcp-config-SM5I7USN.js.map} +0 -0
  88. /package/dist/{chunk-2UYTFLMO.js.map → chunk-4XGKCVJL.js.map} +0 -0
  89. /package/dist/{chunk-3NIPH6UP.js.map → chunk-AYZ6P7CK.js.map} +0 -0
  90. /package/dist/{chunk-HYU4GZY6.js.map → chunk-BSIGP5XF.js.map} +0 -0
  91. /package/dist/{chunk-GONMG4NM.js.map → chunk-CTSESEFA.js.map} +0 -0
  92. /package/dist/{chunk-FVPYP5DD.js.map → chunk-EKRMWVAH.js.map} +0 -0
  93. /package/dist/{chunk-7XCUZI4G.js.map → chunk-EVZ7YR7H.js.map} +0 -0
  94. /package/dist/{chunk-L6SCKLGO.js.map → chunk-FAJAWO42.js.map} +0 -0
  95. /package/dist/{chunk-5O6XLBPP.js.map → chunk-FJHZW7CR.js.map} +0 -0
  96. /package/dist/{chunk-KT5FIBWS.js.map → chunk-HBKZ2DJK.js.map} +0 -0
  97. /package/dist/{chunk-2YPG6PDG.js.map → chunk-J5XEJHIQ.js.map} +0 -0
  98. /package/dist/{chunk-ZVCED4Z4.js.map → chunk-JLWKHYIU.js.map} +0 -0
  99. /package/dist/{chunk-DLXT23AC.js.map → chunk-JXDDSNEK.js.map} +0 -0
  100. /package/dist/{chunk-Q5CFPIJ5.js.map → chunk-OO6MTUDS.js.map} +0 -0
  101. /package/dist/{chunk-6TFTVW77.js.map → chunk-QVHXEQFM.js.map} +0 -0
  102. /package/dist/{chunk-FJWWSVWB.js.map → chunk-RIUUFBX4.js.map} +0 -0
  103. /package/dist/{chunk-DNO2INX5.js.map → chunk-SHVGZK4A.js.map} +0 -0
  104. /package/dist/{chunk-SD76JZBG.js.map → chunk-UVALD724.js.map} +0 -0
  105. /package/dist/{chunk-PLX6FCFC.js.map → chunk-YGKPWUJ6.js.map} +0 -0
  106. /package/dist/{cli-circuit-breaker-I74ZQ44Q.js.map → cli-circuit-breaker-JGX54DAD.js.map} +0 -0
  107. /package/dist/{composite-router-V3OC57IE.js.map → composite-router-UYFYSMBT.js.map} +0 -0
  108. /package/dist/{consensus-vote-ESFPGEJE.js.map → consensus-vote-BZ6JSN67.js.map} +0 -0
  109. /package/dist/{context-retriever-MB3D7KS6.js.map → context-retriever-G23VVJ5S.js.map} +0 -0
  110. /package/dist/{doctor-deep-KQ765XZA.js.map → doctor-deep-OF2LXZ6A.js.map} +0 -0
  111. /package/dist/{expert-bridge-JKLC57IC.js.map → expert-bridge-6ZLD2NWD.js.map} +0 -0
  112. /package/dist/{factory-BUUXNGIB.js.map → factory-I54TX7OY.js.map} +0 -0
  113. /package/dist/{factory-LHHYDVZX.js.map → factory-UHDCLEUE.js.map} +0 -0
  114. /package/dist/{init-opencode-GXZN2W5S.js.map → init-opencode-FE7HVWQL.js.map} +0 -0
  115. /package/dist/{issue-triage-RMXPDZ2K.js.map → issue-triage-7NR5NQUY.js.map} +0 -0
  116. /package/dist/{learning-persistence-Q3HTOGTU.js.map → learning-persistence-TGOBRUUU.js.map} +0 -0
  117. /package/dist/{pr-reviewer-helpers-XCY7HOPE.js.map → pr-reviewer-helpers-L4L324FQ.js.map} +0 -0
  118. /package/dist/{registry-command-6E4YKAMT.js.map → registry-command-NZLX7ZFV.js.map} +0 -0
  119. /package/dist/{repo-security-plan-AGRU72DL.js.map → repo-security-plan-74GJWJSV.js.map} +0 -0
  120. /package/dist/{research-helpers-synthesize-K2UCJQQG.js.map → research-helpers-synthesize-LFPEXRIV.js.map} +0 -0
  121. /package/dist/{routing-memory-3B6DDZ76.js.map → routing-memory-Y2LSEQVS.js.map} +0 -0
  122. /package/dist/{session-memory-L7EQIY2O.js.map → session-memory-RCNQJDJR.js.map} +0 -0
  123. /package/dist/{setup-command-QSAGFMGN.js.map → setup-command-ZPLPOJF2.js.map} +0 -0
  124. /package/dist/{setup-config-EQT24DD4.js.map → setup-config-F7VRWXY3.js.map} +0 -0
  125. /package/dist/{setup-custom-api-IBDV654K.js.map → setup-custom-api-XTJ6YZM6.js.map} +0 -0
  126. /package/dist/{tool-memory-6HCHQLAN.js.map → tool-memory-COZK6SR7.js.map} +0 -0
  127. /package/dist/{weather-report-ER3WUZ7S.js.map → weather-report-O4XOYGPK.js.map} +0 -0
@@ -2,31 +2,32 @@ import {
2
2
  CUSTOM_API_BASE_URL_ENV,
3
3
  PROVIDER_ENV_KEYS,
4
4
  validateCustomApiBaseUrl
5
- } from "./chunk-ZVCED4Z4.js";
5
+ } from "./chunk-JLWKHYIU.js";
6
6
  import {
7
7
  AdapterModelError,
8
8
  BaseAdapter,
9
9
  createStream,
10
10
  requireApiKey,
11
11
  validateApiKeyPresence
12
- } from "./chunk-PLX6FCFC.js";
12
+ } from "./chunk-YGKPWUJ6.js";
13
13
  import {
14
14
  getToolMemory
15
- } from "./chunk-Q5CFPIJ5.js";
15
+ } from "./chunk-OO6MTUDS.js";
16
16
  import {
17
17
  getDefaultAvailableModelsCache
18
- } from "./chunk-KT5FIBWS.js";
18
+ } from "./chunk-HBKZ2DJK.js";
19
19
  import {
20
20
  CUSTOM_API_DEFAULT_MODEL
21
- } from "./chunk-HYU4GZY6.js";
21
+ } from "./chunk-BSIGP5XF.js";
22
22
  import {
23
23
  createCliAdapter,
24
24
  createCliDetectionCache,
25
25
  delay,
26
26
  getAvailableClis,
27
27
  isCliAvailable,
28
+ sanitizeOutput,
28
29
  withTimeout
29
- } from "./chunk-D6TM2VHX.js";
30
+ } from "./chunk-ZU2Q3DWE.js";
30
31
  import {
31
32
  AgentError,
32
33
  CACHE_TIMEOUTS,
@@ -69,13 +70,13 @@ import {
69
70
  resolveCliAlias,
70
71
  resolveVoteTimeout,
71
72
  toRateLimitError
72
- } from "./chunk-WDYCIJWN.js";
73
+ } from "./chunk-YMT6H2HQ.js";
73
74
  import {
74
75
  ensureLearningDir,
75
76
  getNexusDataDir,
76
77
  getOutcomesFile,
77
78
  nexusDataPath
78
- } from "./chunk-7BMOZJYS.js";
79
+ } from "./chunk-2JQXC3CK.js";
79
80
 
80
81
  // src/mcp/tools/consensus-vote.ts
81
82
  import { z as z10 } from "zod";
@@ -1596,7 +1597,7 @@ var SECRET_PATTERNS = [
1596
1597
  // password= or token= in output
1597
1598
  /(?:password|token|secret|apikey|api_key)\s*[=:]\s*\S{8,}/i
1598
1599
  ];
1599
- function sanitizeOutput(text, logger8) {
1600
+ function sanitizeOutput2(text, logger8) {
1600
1601
  let sanitized = text;
1601
1602
  for (const pattern of SECRET_PATTERNS) {
1602
1603
  if (pattern.test(sanitized)) {
@@ -1610,7 +1611,7 @@ function sanitizeOutput(text, logger8) {
1610
1611
  }
1611
1612
  function sanitizeToolResult(result, logger8) {
1612
1613
  for (const item of result.content) {
1613
- item.text = sanitizeOutput(item.text, logger8);
1614
+ item.text = sanitizeOutput2(item.text, logger8);
1614
1615
  }
1615
1616
  }
1616
1617
  function checkInputSize(args, logger8, requestId) {
@@ -2631,9 +2632,10 @@ var SdkAdapter = class extends BaseAdapter {
2631
2632
  */
2632
2633
  toErrorResult(error, code) {
2633
2634
  const message = getErrorMessage(error);
2634
- const errorObj = error instanceof Error ? error : new Error(message);
2635
+ const safeMessage = sanitizeOutput(message);
2636
+ const errorObj = error instanceof Error ? error : new Error(safeMessage);
2635
2637
  this.logger.error(`SDK adapter error (${this.sdkProviderId})`, errorObj);
2636
- const modelError = new AdapterModelError(`${this.sdkProviderId} SDK error: ${message}`, {
2638
+ const modelError = new AdapterModelError(`${this.sdkProviderId} SDK error: ${safeMessage}`, {
2637
2639
  code
2638
2640
  });
2639
2641
  return { ok: false, error: modelError };
@@ -5576,6 +5578,16 @@ var ConsensusError = class extends AgentError {
5576
5578
  this.name = "ConsensusError";
5577
5579
  }
5578
5580
  };
5581
+ var HYPOTHETICAL_APPROVE = {
5582
+ decision: "approve",
5583
+ confidence: 0.5,
5584
+ reasoning: "hypothetical-cascade-probe"
5585
+ };
5586
+ var HYPOTHETICAL_REJECT = {
5587
+ decision: "reject",
5588
+ confidence: 0.5,
5589
+ reasoning: "hypothetical-cascade-probe"
5590
+ };
5579
5591
  var DEFAULT_PROPOSAL_CACHE_CONFIG = {
5580
5592
  enabled: true,
5581
5593
  ttlMs: 36e5,
@@ -5849,47 +5861,47 @@ var ConsensusEngine = class {
5849
5861
  }
5850
5862
  /**
5851
5863
  * Agreement-based cascading: close early when outcome is mathematically determined.
5852
- * If approvals already exceed the threshold even if all remaining voters reject,
5853
- * or rejections make approval impossible, the proposal can be decided early.
5864
+ *
5865
+ * #2822: the prior implementation computed approval rates against
5866
+ * `totalExpected = requiredVoters.length` and compared against
5867
+ * `VOTING_THRESHOLDS[algorithm]` directly. Every voting strategy
5868
+ * (`SimpleMajorityStrategy`, `SupermajorityStrategy`, `UnanimousStrategy`,
5869
+ * `ProofOfLearningStrategy`) uses `approve + reject` as its denominator —
5870
+ * abstains are explicitly excluded. The two diverged whenever abstains
5871
+ * were present, producing wrong-winner cascades (e.g. 5-voter supermajority
5872
+ * with [approve, abstain, abstain, abstain, pending] cascade-rejected even
5873
+ * though the strategy would approve at close).
5874
+ *
5875
+ * The fix delegates to the strategy itself: build a best-case (all pending
5876
+ * voters approve) and worst-case (all pending voters reject) hypothetical
5877
+ * vote map, call `strategy.calculateOutcome` on each, and cascade only
5878
+ * when both extremes yield the same outcome. This guarantees parity with
5879
+ * the strategy's denominator semantics by construction.
5854
5880
  */
5855
5881
  canCascadeEarly(state) {
5856
5882
  const required = state.proposal.requiredVoters;
5857
5883
  if (required === void 0 || required.length === 0) return false;
5858
- const totalExpected = required.length;
5859
- const votesCast = state.votes.size;
5860
- const remaining = totalExpected - votesCast;
5861
- if (remaining <= 0) return false;
5862
- const threshold = VOTING_THRESHOLDS[state.proposal.algorithm];
5863
- let approvals = 0;
5864
- let rejections = 0;
5865
- for (const vote of state.votes.values()) {
5866
- if (vote.decision === "approve") approvals++;
5867
- else if (vote.decision === "reject") rejections++;
5868
- }
5869
- const minApprovalRate = approvals / totalExpected;
5870
- if (minApprovalRate > threshold) {
5871
- this.logger.info("Agreement cascade: early approval", {
5872
- proposalId: state.proposal.id,
5873
- approvals,
5874
- totalExpected,
5875
- threshold,
5876
- remaining
5877
- });
5878
- return true;
5879
- }
5880
- const maxPossibleApprovals = approvals + remaining;
5881
- const maxApprovalRate = maxPossibleApprovals / totalExpected;
5882
- if (maxApprovalRate < threshold) {
5883
- this.logger.info("Agreement cascade: early rejection", {
5884
- proposalId: state.proposal.id,
5885
- rejections,
5886
- totalExpected,
5887
- threshold,
5888
- remaining
5889
- });
5890
- return true;
5891
- }
5892
- return false;
5884
+ if (state.votes.size === 0) return false;
5885
+ const pending = required.filter((voter) => !state.votes.has(voter));
5886
+ if (pending.length === 0) return false;
5887
+ const strategy = this.strategyFactory.getStrategy(state.proposal.algorithm);
5888
+ const bestCase = new Map(state.votes);
5889
+ const worstCase = new Map(state.votes);
5890
+ for (const voter of pending) {
5891
+ bestCase.set(voter, HYPOTHETICAL_APPROVE);
5892
+ worstCase.set(voter, HYPOTHETICAL_REJECT);
5893
+ }
5894
+ const bestOutcome = strategy.calculateOutcome(bestCase, state.voteWeights);
5895
+ const worstOutcome = strategy.calculateOutcome(worstCase, state.voteWeights);
5896
+ if (bestOutcome.approved !== worstOutcome.approved) return false;
5897
+ this.logger.info("Agreement cascade: outcome determined", {
5898
+ proposalId: state.proposal.id,
5899
+ outcome: bestOutcome.approved ? "approve" : "reject",
5900
+ votesCast: state.votes.size,
5901
+ pending: pending.length,
5902
+ algorithm: state.proposal.algorithm
5903
+ });
5904
+ return true;
5893
5905
  }
5894
5906
  allRequiredVotersVoted(state) {
5895
5907
  const required = state.proposal.requiredVoters;
@@ -8638,7 +8650,7 @@ async function processVotesWithCascade(engineVotes, opts) {
8638
8650
  var CONTRARIAN_ESCALATION_THRESHOLD = 0.8;
8639
8651
  async function runContrarianCheck(proposal, log) {
8640
8652
  try {
8641
- const { executeExpert } = await import("./expert-bridge-JKLC57IC.js");
8653
+ const { executeExpert } = await import("./expert-bridge-6ZLD2NWD.js");
8642
8654
  const prompt = [
8643
8655
  "You are a contrarian analyst. Your job is to find reasons this proposal should be REJECTED.",
8644
8656
  "Look for: YAGNI (not needed), MISALIGNED (wrong tech/architecture), SECURITY_RISK, SCOPE_CREEP.",
@@ -9055,4 +9067,4 @@ export {
9055
9067
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
9056
9068
  registerConsensusVoteTool
9057
9069
  };
9058
- //# sourceMappingURL=chunk-SWFJU3W2.js.map
9070
+ //# sourceMappingURL=chunk-6CJIKX6I.js.map