nexus-agents 2.140.1 → 2.141.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.
@@ -4276,7 +4276,8 @@ function buildResponse(input, result, costSummary, voteRecord) {
4276
4276
  const proposalTruncated = input.proposal.length > 200 ? input.proposal.slice(0, 200) + "..." : input.proposal;
4277
4277
  const errorCount = result.votes.filter((v) => v.source === "error").length;
4278
4278
  const allErrors = errorCount === result.votes.length && errorCount > 0;
4279
- const decision = !result.result.quorumReached && allErrors ? "no_quorum" : mapOutcomeToDecision(result.result.outcome);
4279
+ const errorVoidedVote = result.policyReason !== void 0;
4280
+ const decision = errorVoidedVote || !result.result.quorumReached && allErrors ? "no_quorum" : mapOutcomeToDecision(result.result.outcome);
4280
4281
  const response = {
4281
4282
  proposal: proposalTruncated,
4282
4283
  strategy: result.strategy,
@@ -4498,9 +4499,11 @@ var MAX_PROPOSAL_RECORD_CHARS = 500;
4498
4499
  function voteRecordWriteFailedMessage(path) {
4499
4500
  return `Authentic vote record NOT persisted: the resolved data directory is not writable (${path}). Check filesystem permissions on the .nexus-agents data dir, or set ${VOTE_RECORDS_PATH_ENV} to a writable absolute file path. See server logs for the underlying filesystem error.`;
4500
4501
  }
4501
- function outcomeToDecision(result) {
4502
+ function outcomeToDecision(result, votes, errorVoided) {
4502
4503
  if (result.outcome === "approved") return "approved";
4503
- if (!result.quorumReached && result.outcome !== "rejected") return "no_quorum";
4504
+ const errorCount = votes.filter((v) => v.source === "error").length;
4505
+ const allErrors = errorCount === votes.length && errorCount > 0;
4506
+ if (errorVoided || !result.quorumReached && allErrors) return "no_quorum";
4504
4507
  return "rejected";
4505
4508
  }
4506
4509
  function toVoterSummaries(votes) {
@@ -4522,7 +4525,7 @@ function buildVoteRecord(input) {
4522
4525
  proposalHash: hashProposal(input.proposal),
4523
4526
  proposal: proposalTruncated,
4524
4527
  strategy: input.strategy,
4525
- decision: outcomeToDecision(input.result),
4528
+ decision: outcomeToDecision(input.result, input.votes, input.errorVoided ?? false),
4526
4529
  approvalPercentage: input.result.approvalPercentage,
4527
4530
  voteCounts: {
4528
4531
  approve: input.result.voteCounts.approve,
@@ -4818,6 +4821,7 @@ function recordAuthenticVote(args) {
4818
4821
  strategy: toRecordStrategy(args.strategy),
4819
4822
  result: args.result,
4820
4823
  votes: args.votes,
4824
+ ...args.errorVoided !== void 0 ? { errorVoided: args.errorVoided } : {},
4821
4825
  ...args.correlationId !== void 0 ? { correlationId: args.correlationId } : {},
4822
4826
  ...args.ratifies !== void 0 ? { ratifies: args.ratifies } : {},
4823
4827
  logger: logger6
@@ -5785,8 +5789,10 @@ async function executeVoting(input, logger10, opts) {
5785
5789
  logger: logger10
5786
5790
  });
5787
5791
  }
5788
- async function runConsensusForGoal(goal, logger10 = createLogger({ tool: "consensus_vote" })) {
5789
- return executeVoting(ConsensusVoteInputSchema.parse({ proposal: goal }), logger10);
5792
+ async function runConsensusForGoal(goal, logger10 = createLogger({ tool: "consensus_vote" }), gatewayAdapters) {
5793
+ return executeVoting(ConsensusVoteInputSchema.parse({ proposal: goal }), logger10, {
5794
+ ...gatewayAdapters !== void 0 && { gatewayAdapters }
5795
+ });
5790
5796
  }
5791
5797
  function finalizeVotingResult(args) {
5792
5798
  const totalTimeMs = getTimeProvider().now() - args.startTime;
@@ -5815,6 +5821,9 @@ function recordVoteSideEffects(proposal, strategy, result, logger10, ratifies) {
5815
5821
  strategy,
5816
5822
  result: result.result,
5817
5823
  votes: result.votes,
5824
+ // #4053: an error-policy short-circuit voided the vote → the PERSISTED record
5825
+ // must record `no_quorum`, matching the MCP response (not a stale `rejected`).
5826
+ errorVoided: result.policyReason !== void 0,
5818
5827
  correlationId: decisionId,
5819
5828
  ...ratifies !== void 0 ? { ratifies } : {}
5820
5829
  });
@@ -6125,4 +6134,4 @@ export {
6125
6134
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
6126
6135
  registerConsensusVoteTool
6127
6136
  };
6128
- //# sourceMappingURL=chunk-KUF5JK5A.js.map
6137
+ //# sourceMappingURL=chunk-3Z4SZVBB.js.map