nexus-agents 8.3.3 → 8.4.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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-OQB3XC5O.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-LV3LWVWI.js";
9
+ } from "./chunk-M5DIGZIM.js";
10
10
  import {
11
11
  capitalize
12
12
  } from "./chunk-6T3EPABN.js";
@@ -1201,7 +1201,7 @@ async function runDoctorFix(result) {
1201
1201
  writeLine2("\u2500".repeat(40));
1202
1202
  let fixCount = 0;
1203
1203
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
1204
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-NXOVPIK7.js");
1204
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-EYIPKPGP.js");
1205
1205
  const outcome = describeDataDirFix2(initDataDirectories2());
1206
1206
  writeLine2(outcome.line);
1207
1207
  if (outcome.counted) fixCount++;
@@ -1303,4 +1303,4 @@ export {
1303
1303
  startStdioServer,
1304
1304
  closeServer
1305
1305
  };
1306
- //# sourceMappingURL=chunk-5HQ64BQJ.js.map
1306
+ //# sourceMappingURL=chunk-2LQROHUE.js.map
@@ -23,7 +23,7 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-T5SLVJCK.js";
26
+ } from "./chunk-HVPF7BBS.js";
27
27
  import {
28
28
  assessPanelIndependence,
29
29
  countDistinctModels,
@@ -1015,6 +1015,7 @@ async function executeWithRetries(opts) {
1015
1015
 
1016
1016
  // src/cli/voter-agents-deadline.ts
1017
1017
  var DEADLINE_MESSAGE = "overall consensus deadline exceeded";
1018
+ var CANCELLED_MESSAGE = "cancelled before this voter was launched";
1018
1019
  function shouldRetryOnFallback(result, used, fallback) {
1019
1020
  return result.source === "error" && result.error !== DEADLINE_MESSAGE && adapterCliKey(used) !== adapterCliKey(fallback);
1020
1021
  }
@@ -1047,6 +1048,9 @@ function raceWithDeadline(p, role, deadlineMs) {
1047
1048
  if (timer !== void 0) clearTimeout(timer);
1048
1049
  });
1049
1050
  }
1051
+ function cancelled(signal) {
1052
+ return signal?.aborted === true;
1053
+ }
1050
1054
  async function launchVotesWithOverallDeadline(input) {
1051
1055
  const {
1052
1056
  roles,
@@ -1076,9 +1080,11 @@ async function launchVotesWithOverallDeadline(input) {
1076
1080
  );
1077
1081
  const wrapped = roles.map(async (role, i) => {
1078
1082
  if (i > 0 && interDelay > 0) await delay(interDelay);
1083
+ if (cancelled(input.signal)) return createErrorVoteResult(role, CANCELLED_MESSAGE, 0);
1079
1084
  const adapter = roleAdapters.get(role) ?? fallbackAdapter;
1080
1085
  const primary = await voteOnAdapter(role, adapter);
1081
1086
  if (!shouldRetryOnFallback(primary, adapter, fallbackAdapter)) return primary;
1087
+ if (cancelled(input.signal)) return primary;
1082
1088
  logger10.warn("Voter failed on diverse adapter; retrying on fallback (#3587)", {
1083
1089
  role,
1084
1090
  failedCli: adapterCliKey(adapter),
@@ -1303,7 +1309,8 @@ async function launchStaggeredVotes(input) {
1303
1309
  voteOptions,
1304
1310
  interDelay,
1305
1311
  overallDeadlineMs,
1306
- voteFn: executeAgentVote
1312
+ voteFn: executeAgentVote,
1313
+ signal: input.signal
1307
1314
  });
1308
1315
  }
1309
1316
  async function collectRealVotes(options) {
@@ -1344,7 +1351,8 @@ async function collectRealVotes(options) {
1344
1351
  fallbackAdapter: adapterResult.adapter,
1345
1352
  logger: logger10,
1346
1353
  voteOptions,
1347
- interDelay
1354
+ interDelay,
1355
+ signal: options.signal
1348
1356
  });
1349
1357
  reportPanelIndependence([...roleAdapters.values()], roles.length, "post-vote", logger10);
1350
1358
  return results;
@@ -6387,7 +6395,7 @@ async function maybeEscalateContrarian(input, outcome, ctx, logger10, opts) {
6387
6395
  return { escalated: await executeVoting({ ...input, quickMode: false }, logger10, opts) };
6388
6396
  }
6389
6397
  async function executeVoting(input, logger10, opts) {
6390
- const result = await executeVotingInner(input, logger10, opts);
6398
+ const result = await executeVotingInner(input, logger10, opts ?? {});
6391
6399
  const errorCount = result.votes.filter((v) => v.source === "error").length;
6392
6400
  applyOptionGate(input, result);
6393
6401
  result.decision = resolveVoteDecision(input, result, errorCount).decision;
@@ -6425,9 +6433,10 @@ async function executeVotingInner(input, logger10, opts) {
6425
6433
  roles,
6426
6434
  proposal: input.proposal,
6427
6435
  simulate: input.simulateVotes,
6428
- ...opts?.voteTimeoutMs !== void 0 && { timeoutMs: opts.voteTimeoutMs },
6429
- ...opts?.gatewayAdapters !== void 0 && { gatewayAdapters: opts.gatewayAdapters },
6430
- declaredOptions: input.options
6436
+ ...opts.voteTimeoutMs !== void 0 && { timeoutMs: opts.voteTimeoutMs },
6437
+ ...opts.gatewayAdapters !== void 0 && { gatewayAdapters: opts.gatewayAdapters },
6438
+ declaredOptions: input.options,
6439
+ signal: opts.signal
6431
6440
  });
6432
6441
  const policyDecision = applyErrorPolicy(votes, errorPolicy);
6433
6442
  if (policyDecision.shortCircuit) {
@@ -6539,11 +6548,12 @@ function recordVoteSideEffects(proposal, strategy, result, logger10, ratifies) {
6539
6548
  }
6540
6549
  return { costSummary, voteRecord };
6541
6550
  }
6542
- async function handleConsensusVote(deps, args) {
6551
+ async function handleConsensusVote(deps, args, signal) {
6543
6552
  const logger10 = deps.logger ?? createLogger({ tool: "consensus_vote" });
6544
6553
  try {
6545
6554
  const result = await executeVoting(args, logger10, {
6546
- ...deps.gatewayAdapters !== void 0 && { gatewayAdapters: deps.gatewayAdapters }
6555
+ ...deps.gatewayAdapters !== void 0 && { gatewayAdapters: deps.gatewayAdapters },
6556
+ signal
6547
6557
  });
6548
6558
  const strategy = args.strategy ?? "simple_majority";
6549
6559
  const errorVotes = result.votes.filter((v) => v.source === "error");
@@ -6599,7 +6609,10 @@ function dispatchAsyncConsensusVote(deps, args) {
6599
6609
  // callback RESOLVES — so a dead voter panel produced a job a caller polling
6600
6610
  // `get_job_result` read as a success. Reject instead, mirroring the sync
6601
6611
  // sibling's `toolStructuredError` on the same condition.
6602
- run: (_jobId, input) => unwrapVoteOrThrow(handleConsensusVote(deps, input)),
6612
+ // #5393: arity 3. `runAsJob` derives `signalAccepted` from `run.length`, so
6613
+ // taking the signal is what makes the job record say cancellation works —
6614
+ // the claim follows the capability instead of being asserted separately.
6615
+ run: (_jobId, input, signal) => unwrapVoteOrThrow(handleConsensusVote(deps, input, signal)),
6603
6616
  ...deps.logger !== void 0 ? { logger: deps.logger } : {}
6604
6617
  });
6605
6618
  }
@@ -6892,4 +6905,4 @@ export {
6892
6905
  CONSENSUS_VOTE_TOOL_SCHEMA,
6893
6906
  registerConsensusVoteTool
6894
6907
  };
6895
- //# sourceMappingURL=chunk-AYVIQAGJ.js.map
6908
+ //# sourceMappingURL=chunk-CFGJGRVF.js.map