nexus-agents 4.28.0 → 4.29.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,7 +23,7 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-7V5V6H5C.js";
26
+ } from "./chunk-GS4XDYMP.js";
27
27
  import {
28
28
  assessPanelIndependence,
29
29
  countDistinctModels,
@@ -4517,6 +4517,18 @@ var VoteDecisionStatusSchema = z6.enum([
4517
4517
  "timeout",
4518
4518
  "no_quorum"
4519
4519
  ]);
4520
+ function toRecordDecision(status) {
4521
+ switch (status) {
4522
+ case "approved":
4523
+ case "rejected":
4524
+ case "no_quorum":
4525
+ return status;
4526
+ case "timeout":
4527
+ return "no_quorum";
4528
+ default:
4529
+ return void 0;
4530
+ }
4531
+ }
4520
4532
  function toAgentVoteSummary(result) {
4521
4533
  const roleName = VOTER_ROLES[result.role].split(" - ")[0] ?? result.role;
4522
4534
  return {
@@ -4901,11 +4913,12 @@ function voteRecordWriteFailedMessage(path) {
4901
4913
  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.`;
4902
4914
  }
4903
4915
  function outcomeToDecision(result, votes, errorVoided) {
4904
- if (result.outcome === "approved") return "approved";
4905
4916
  const errorCount = votes.filter((v) => v.source === "error").length;
4906
4917
  const allErrors = errorCount === votes.length && errorCount > 0;
4907
4918
  if (errorVoided || !result.quorumReached && allErrors) return "no_quorum";
4908
- return "rejected";
4919
+ if (result.outcome === "approved") return "approved";
4920
+ if (result.outcome === "rejected") return "rejected";
4921
+ return "no_quorum";
4909
4922
  }
4910
4923
  function toVoterSummaries(votes) {
4911
4924
  const summaries = [];
@@ -4916,6 +4929,9 @@ function toVoterSummaries(votes) {
4916
4929
  }
4917
4930
  return summaries;
4918
4931
  }
4932
+ function recordDecisionFor(input) {
4933
+ return input.resolvedDecision ?? outcomeToDecision(input.result, input.votes, input.errorVoided ?? false);
4934
+ }
4919
4935
  function deriveOptionFields(votes) {
4920
4936
  const optionTally = tallySelectedOptions(votes);
4921
4937
  return {
@@ -4957,7 +4973,7 @@ function buildVoteRecord(input) {
4957
4973
  proposalHash: hashProposal(input.proposal),
4958
4974
  proposal: proposalTruncated,
4959
4975
  strategy: input.strategy,
4960
- decision: outcomeToDecision(input.result, input.votes, input.errorVoided ?? false),
4976
+ decision: recordDecisionFor(input),
4961
4977
  approvalPercentage: input.result.approvalPercentage,
4962
4978
  voteCounts: {
4963
4979
  approve: input.result.voteCounts.approve,
@@ -5255,6 +5271,7 @@ function recordAuthenticVote(args) {
5255
5271
  strategy: toRecordStrategy(args.strategy),
5256
5272
  result: args.result,
5257
5273
  votes: args.votes,
5274
+ resolvedDecision: args.resolvedDecision,
5258
5275
  ...args.errorVoided !== void 0 ? { errorVoided: args.errorVoided } : {},
5259
5276
  ...args.correlationId !== void 0 ? { correlationId: args.correlationId } : {},
5260
5277
  ...args.ratifies !== void 0 ? { ratifies: args.ratifies } : {},
@@ -6413,6 +6430,12 @@ function recordVoteSideEffects(proposal, strategy, result, logger10, ratifies) {
6413
6430
  // #4053: an error-policy short-circuit voided the vote → the PERSISTED record
6414
6431
  // must record `no_quorum`, matching the MCP response (not a stale `rejected`).
6415
6432
  errorVoided: result.policyReason !== void 0,
6433
+ // #4986: hand over the decision `resolveVoteDecision` already produced
6434
+ // (stamped on the result by `executeVoting`). `errorVoided` alone cannot
6435
+ // express an absolute_quorum void, whose reason is stamped on the response
6436
+ // and never on the result — so the record used to say `approved` for a vote
6437
+ // this tool reports as `no_quorum`.
6438
+ resolvedDecision: toRecordDecision(result.decision),
6416
6439
  correlationId: decisionId,
6417
6440
  ...ratifies !== void 0 ? { ratifies } : {}
6418
6441
  });
@@ -6763,6 +6786,7 @@ export {
6763
6786
  ErrorPolicySchema,
6764
6787
  VoteThresholdSchema,
6765
6788
  ConsensusVoteInputSchema,
6789
+ toRecordDecision,
6766
6790
  mapOutcomeToDecision,
6767
6791
  recordAuthenticVote,
6768
6792
  recordDecisionCost,
@@ -6779,4 +6803,4 @@ export {
6779
6803
  CONSENSUS_VOTE_TOOL_SCHEMA,
6780
6804
  registerConsensusVoteTool
6781
6805
  };
6782
- //# sourceMappingURL=chunk-6OAWETHW.js.map
6806
+ //# sourceMappingURL=chunk-5DWZM7IZ.js.map