nexus-agents 11.6.1 → 11.6.2

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.
@@ -26,7 +26,7 @@ import {
26
26
  toolSuccess,
27
27
  withProgressHeartbeat,
28
28
  wrapToolWithTimeout
29
- } from "./chunk-SYLXKCXM.js";
29
+ } from "./chunk-7GTIW25A.js";
30
30
  import {
31
31
  getToolMemory
32
32
  } from "./chunk-UMG4PRKT.js";
@@ -2369,14 +2369,18 @@ async function readBoundedArtifact(artifactPath) {
2369
2369
  await file.close();
2370
2370
  }
2371
2371
  }
2372
- async function inlineVoteArtifact(proposal, artifactPath, displayName) {
2373
- if (artifactPath === void 0) return proposal;
2374
- const bytes = await readBoundedArtifact(artifactPath);
2372
+ function inlineVoteArtifactText(proposal, source, displayName) {
2373
+ if (typeof source === "string" && !source.isWellFormed()) {
2374
+ throw new Error("Vote artifact contains a lone surrogate and cannot encode exact UTF-8");
2375
+ }
2376
+ const size = typeof source === "string" ? Buffer.byteLength(source, "utf8") : source.byteLength;
2377
+ if (size > MAX_VOTE_ARTIFACT_BYTES) throw oversizedArtifact(size);
2378
+ const bytes = Buffer.from(source);
2375
2379
  if (bytes.length === 0) throw new Error("Vote artifact is empty; an artifact must have content");
2376
2380
  if (bytes.includes(0)) throw new Error("Vote artifact is binary (contains a NUL byte)");
2377
2381
  const content = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
2378
2382
  const digest = createHash("sha256").update(bytes).digest("hex");
2379
- const header = `Artifact: ${displayName ?? basename(artifactPath)} sha256:${digest} ${String(bytes.length)} bytes`;
2383
+ const header = `Artifact: ${displayName} sha256:${digest} ${String(bytes.length)} bytes`;
2380
2384
  return `${proposal}
2381
2385
 
2382
2386
  ${header}
@@ -2384,6 +2388,14 @@ ${header}
2384
2388
  ${content}
2385
2389
  ===== END ARTIFACT =====`;
2386
2390
  }
2391
+ async function inlineVoteArtifact(proposal, artifactPath, displayName) {
2392
+ if (artifactPath === void 0) return proposal;
2393
+ return inlineVoteArtifactText(
2394
+ proposal,
2395
+ await readBoundedArtifact(artifactPath),
2396
+ displayName ?? basename(artifactPath)
2397
+ );
2398
+ }
2387
2399
 
2388
2400
  // src/cli/voter-project.ts
2389
2401
  import { readFileSync, statSync } from "node:fs";
@@ -7830,9 +7842,9 @@ async function recordVoteSideEffects(proposal, result, logger12, declared) {
7830
7842
  errorVoided: result.policyReason !== void 0,
7831
7843
  // #4986: hand over the decision `resolveVoteDecision` already produced
7832
7844
  // (stamped on the result by `executeVoting`). `errorVoided` alone cannot
7833
- // express an absolute_quorum void, whose reason is stamped on the response
7834
- // and never on the result — so the record used to say `approved` for a vote
7835
- // this tool reports as `no_quorum`.
7845
+ // express an absolute_quorum void, whose separate decisionReason is diagnostic
7846
+ // only — so the record used to say `approved` for a vote this tool reports
7847
+ // as `no_quorum`. Keep policyReason's error-void semantics unchanged (#7412).
7836
7848
  resolvedDecision: toRecordDecision(result.decision),
7837
7849
  // #6211: the EFFECTIVE policy `executeVoting` stamped, so a caller that
7838
7850
  // took the per-strategy default still gets `reduce_denominator` on the
@@ -8969,7 +8981,9 @@ async function executeVoting(input, logger12, opts) {
8969
8981
  const correlationAlreadyRecorded = result.decision !== void 0;
8970
8982
  const errorCount = result.votes.filter((v) => v.source === "error").length;
8971
8983
  applyOptionGate(input, result);
8972
- result.decision = resolveVoteDecision(input, result, errorCount).decision;
8984
+ const resolved = resolveVoteDecision(input, result, errorCount);
8985
+ result.decision = resolved.decision;
8986
+ stampDecisionReason(result, resolved.degradeReason);
8973
8987
  if (!correlationAlreadyRecorded && (result.decision === "approved" || result.decision === "rejected")) {
8974
8988
  recordVotesToTracker(result.votes, result.decision, logger12);
8975
8989
  }
@@ -9009,6 +9023,7 @@ async function executeVotingInner(input, logger12, opts) {
9009
9023
  simulate: input.simulateVotes,
9010
9024
  ...opts.voteTimeoutMs !== void 0 && { timeoutMs: opts.voteTimeoutMs },
9011
9025
  ...opts.gatewayAdapters !== void 0 && { gatewayAdapters: opts.gatewayAdapters },
9026
+ roleAdapters: opts.roleAdapters,
9012
9027
  declaredOptions: input.options,
9013
9028
  // #6110: every seat's system prompt names the caller's project.
9014
9029
  project: opts.project.name,
@@ -9071,6 +9086,11 @@ async function executeVotingInner(input, logger12, opts) {
9071
9086
  escalation.degradeReason
9072
9087
  );
9073
9088
  }
9089
+ function stampDecisionReason(result, degradeReason) {
9090
+ const reason = degradeReason ?? result.policyReason;
9091
+ if (reason !== void 0) result.decisionReason = reason;
9092
+ else delete result.decisionReason;
9093
+ }
9074
9094
  function applyContrarianDegrade(result, degradeReason) {
9075
9095
  if (degradeReason === void 0 || result.policyReason !== void 0) return result;
9076
9096
  return { ...result, policyReason: degradeReason };
@@ -9468,6 +9488,7 @@ function registerConsensusVoteTool(server, deps) {
9468
9488
 
9469
9489
  export {
9470
9490
  VOTER_ROLES,
9491
+ getVoterRoles,
9471
9492
  dispatchFieldDefaultSync,
9472
9493
  asyncDispatchInput,
9473
9494
  asyncDispatchInputDefaultSync,
@@ -9510,6 +9531,8 @@ export {
9510
9531
  resolveAdapter,
9511
9532
  assignPanelSeats,
9512
9533
  collectRealVotes,
9534
+ MAX_VOTE_ARTIFACT_BYTES,
9535
+ inlineVoteArtifactText,
9513
9536
  inlineVoteArtifact,
9514
9537
  VoterProjectInputSchema,
9515
9538
  resolveAndLogVoterProject,
@@ -9555,11 +9578,13 @@ export {
9555
9578
  createWeightedVoting,
9556
9579
  CorrelationTracker,
9557
9580
  createCorrelationTracker,
9581
+ MAX_PROPOSAL_LENGTH,
9558
9582
  VotingStrategySchema,
9559
9583
  ErrorPolicySchema,
9560
9584
  VoteThresholdSchema,
9561
9585
  ConsensusVoteInputSchema,
9562
9586
  toRecordDecision,
9587
+ CONTRARIAN_PROPOSAL_BUDGET,
9563
9588
  withFileLock,
9564
9589
  throwIfVoteCancelled,
9565
9590
  attachPartialsOnCancel,
@@ -9579,4 +9604,4 @@ export {
9579
9604
  CONSENSUS_VOTE_TOOL_SCHEMA,
9580
9605
  registerConsensusVoteTool
9581
9606
  };
9582
- //# sourceMappingURL=chunk-O6Z4MSLB.js.map
9607
+ //# sourceMappingURL=chunk-3QBKZZKE.js.map