nexus-agents 2.120.1 → 2.120.3

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
  writeJobComplete,
27
27
  writeJobFailed,
28
28
  writeJobPending
29
- } from "./chunk-KQYEBRLU.js";
29
+ } from "./chunk-HCBALIWN.js";
30
30
  import {
31
31
  normalizeTopicToCanonical,
32
32
  synthesizeResearch
@@ -42,14 +42,16 @@ import {
42
42
  } from "./chunk-PN6BFDVL.js";
43
43
  import {
44
44
  withPrerequisite
45
- } from "./chunk-AEPFWQLE.js";
45
+ } from "./chunk-S7JNS4NN.js";
46
46
  import {
47
47
  NOOP_NOTIFIER,
48
48
  RateLimiter,
49
49
  abortSignalStorage,
50
+ coarsenFailureCategory,
50
51
  createDefaultRateLimiter,
51
52
  createMcpNotifier,
52
53
  createSecureHandler,
54
+ defaultRetryable,
53
55
  getMcpAnnotations,
54
56
  getToolAnnotations,
55
57
  getToolTimeout,
@@ -62,7 +64,7 @@ import {
62
64
  withAccessPolicy,
63
65
  withProgressHeartbeat,
64
66
  wrapToolWithTimeout
65
- } from "./chunk-2PQNHP5Y.js";
67
+ } from "./chunk-FUZ2LMMD.js";
66
68
  import {
67
69
  generateSecurityPlan
68
70
  } from "./chunk-5CIKBB4B.js";
@@ -115,7 +117,7 @@ import {
115
117
  DEFAULT_TASK_TTL_MS,
116
118
  DEFAULT_TOOL_RATE_LIMITS,
117
119
  clampTaskTtl
118
- } from "./chunk-NHCAY372.js";
120
+ } from "./chunk-XOQEPBSL.js";
119
121
  import {
120
122
  resolveInsideRoot
121
123
  } from "./chunk-NUBSJGQZ.js";
@@ -185,6 +187,7 @@ import {
185
187
  WorkflowError,
186
188
  buildCapabilityProfiles,
187
189
  buildDefaultModelSources,
190
+ categorizeOutcomeError,
188
191
  categorizeOutcomeErrorMessage,
189
192
  clamp,
190
193
  clamp01,
@@ -26274,6 +26277,9 @@ async function runSinglePrecondition(config, ctx, options) {
26274
26277
 
26275
26278
  // src/orchestration/graph/graph-executor.ts
26276
26279
  var logger16 = createLogger({ component: "GraphExecutor" });
26280
+ function failureClassification(category) {
26281
+ return { errorCategory: category, isRetryable: defaultRetryable(category) };
26282
+ }
26277
26283
  var DEFAULT_MAX_STEPS = GRAPH_TIMEOUTS.maxSteps;
26278
26284
  var DEFAULT_TIMEOUT_MS3 = GRAPH_TIMEOUTS.defaultMs;
26279
26285
  var GRAPH_UNIFIED_CONTEXT_KEY = "__unifiedContext";
@@ -26637,7 +26643,9 @@ async function executeWithVerification(args) {
26637
26643
  stateUpdates: {},
26638
26644
  durationMs: getTimeProvider().now() - startTime,
26639
26645
  status: "failed",
26640
- error: `Verification failed: ${verifyResult.error ?? "unknown"}`
26646
+ error: `Verification failed: ${verifyResult.error ?? "unknown"}`,
26647
+ // Post-step verification is a domain check — re-running won't change it.
26648
+ ...failureClassification("business")
26641
26649
  };
26642
26650
  }
26643
26651
  return {
@@ -26649,6 +26657,11 @@ async function executeWithVerification(args) {
26649
26657
  };
26650
26658
  }
26651
26659
  async function executeSingleNode(graph, nodeId, state, nodeCtx, options) {
26660
+ const prior = options?.priorResults?.get(nodeId);
26661
+ if (prior?.status === "success") {
26662
+ logger16.debug("Replaying prior successful node result", { nodeId });
26663
+ return prior;
26664
+ }
26652
26665
  const node = graph.nodes.get(nodeId);
26653
26666
  if (node === void 0) {
26654
26667
  return {
@@ -26656,7 +26669,9 @@ async function executeSingleNode(graph, nodeId, state, nodeCtx, options) {
26656
26669
  stateUpdates: {},
26657
26670
  durationMs: 0,
26658
26671
  status: "failed",
26659
- error: `Node '${nodeId}' not found`
26672
+ error: `Node '${nodeId}' not found`,
26673
+ // Missing node is a graph-construction bug, not a transient failure.
26674
+ ...failureClassification("internal")
26660
26675
  };
26661
26676
  }
26662
26677
  const startTime = getTimeProvider().now();
@@ -26669,12 +26684,14 @@ async function executeSingleNode(graph, nodeId, state, nodeCtx, options) {
26669
26684
  } catch (error) {
26670
26685
  const message = getErrorMessage(error);
26671
26686
  logger16.warn("Node execution failed", { nodeId, error: message });
26687
+ const category = coarsenFailureCategory(categorizeOutcomeError(error));
26672
26688
  return {
26673
26689
  nodeId,
26674
26690
  stateUpdates: {},
26675
26691
  durationMs: getTimeProvider().now() - startTime,
26676
26692
  status: "failed",
26677
- error: message
26693
+ error: message,
26694
+ ...failureClassification(category)
26678
26695
  };
26679
26696
  }
26680
26697
  }
@@ -27673,24 +27690,46 @@ var PipelineRunner = class {
27673
27690
  }
27674
27691
  }
27675
27692
  /**
27676
- * Retries a previous run that had failed or skipped steps by re-executing the
27677
- * pipeline with `continueOnFailure` enabled, returning the combined result.
27678
- * Returns `previousResult` unchanged when it has no `stepResults` or nothing
27679
- * failed/skipped.
27693
+ * Retries a previous run's failures **selectively** (#3534): prior successful
27694
+ * nodes are replayed (not re-executed) via `priorResults`, so only the failed
27695
+ * nodes and their dependents run again.
27680
27696
  *
27681
- * NOTE: the underlying graph executor re-runs **all** nodes, not only the
27682
- * failed ones selective per-step retry is not yet modeled. The failed/skipped
27683
- * ids are used only to decide *whether* to retry, not *which* steps run.
27697
+ * Gated on retryability: retries only when at least one *failed* node is
27698
+ * `isRetryable` (transient). If every failure is permanent
27699
+ * (validation/permission/business/internal) it returns `previousResult`
27700
+ * unchanged rather than looping on errors that won't clear.
27701
+ *
27702
+ * Back-compat: a `previousResult` without `nodeResults` (e.g. an older caller)
27703
+ * falls back to the prior whole-pipeline retry gated on `stepResults`.
27704
+ *
27705
+ * NOTE: non-retryable failures that coexist with a retryable one still re-run
27706
+ * (and re-fail) under `continueOnFailure`; pinning them as terminal is a
27707
+ * future refinement.
27684
27708
  */
27685
27709
  async retryFailed(pipeline, previousResult, task, options) {
27710
+ const nodeResults = previousResult.nodeResults;
27711
+ if (nodeResults === void 0) {
27712
+ return this.retryFailedLegacy(pipeline, previousResult, task, options);
27713
+ }
27714
+ const anyRetryableFailure = nodeResults.some(
27715
+ (r) => r.status === "failed" && r.isRetryable === true
27716
+ );
27717
+ if (!anyRetryableFailure) {
27718
+ return okResult(previousResult);
27719
+ }
27720
+ const priorResults = new Map(
27721
+ nodeResults.filter((r) => r.status === "success").map((r) => [r.nodeId, r])
27722
+ );
27723
+ return this.execute(pipeline, task, { ...options, continueOnFailure: true, priorResults });
27724
+ }
27725
+ /** Pre-#3534 whole-pipeline retry, kept for results lacking `nodeResults`. */
27726
+ async retryFailedLegacy(pipeline, previousResult, task, options) {
27686
27727
  const steps = previousResult.stepResults;
27687
27728
  if (steps === void 0 || steps.length === 0) {
27688
27729
  return okResult(previousResult);
27689
27730
  }
27690
- const failedIds = new Set(
27691
- steps.filter((s) => s.status === "failed" || s.status === "skipped").map((s) => s.stepId)
27692
- );
27693
- if (failedIds.size === 0) {
27731
+ const anyFailed = steps.some((s) => s.status === "failed" || s.status === "skipped");
27732
+ if (!anyFailed) {
27694
27733
  return okResult(previousResult);
27695
27734
  }
27696
27735
  return this.execute(pipeline, task, { ...options, continueOnFailure: true });
@@ -27702,23 +27741,31 @@ function okResult(value) {
27702
27741
  function failedResult(startTime, error) {
27703
27742
  return { success: false, stepsExecuted: 0, durationMs: Date.now() - startTime, error };
27704
27743
  }
27705
- function buildGraphOptions(pipeline, options) {
27706
- const base = {
27707
- timeout: options?.timeout ?? pipeline.plan.timeoutMs
27744
+ function makeOnNodeComplete(onStage, bus, execId) {
27745
+ return (r) => {
27746
+ onStage?.(r.nodeId);
27747
+ emitStageEvent(bus, execId, r);
27708
27748
  };
27749
+ }
27750
+ function optionalGraphFields(options) {
27709
27751
  const signal = options?.signal;
27710
27752
  const maxSteps = options?.maxSteps;
27711
- const onStage = options?.onStageComplete;
27712
- const bus = options?.eventBus;
27713
- const execId = pipeline.plan.taskId;
27753
+ const priorResults = options?.priorResults;
27714
27754
  return {
27715
- ...base,
27716
27755
  ...signal !== void 0 ? { signal } : {},
27717
27756
  ...maxSteps !== void 0 ? { maxSteps } : {},
27718
- onNodeComplete: (r) => {
27719
- onStage?.(r.nodeId);
27720
- emitStageEvent(bus, execId, r);
27721
- }
27757
+ ...priorResults !== void 0 ? { priorResults } : {}
27758
+ };
27759
+ }
27760
+ function buildGraphOptions(pipeline, options) {
27761
+ return {
27762
+ timeout: options?.timeout ?? pipeline.plan.timeoutMs,
27763
+ ...optionalGraphFields(options),
27764
+ onNodeComplete: makeOnNodeComplete(
27765
+ options?.onStageComplete,
27766
+ options?.eventBus,
27767
+ pipeline.plan.taskId
27768
+ )
27722
27769
  };
27723
27770
  }
27724
27771
  function toResult(graphResult, startTime, continueOnFailure) {
@@ -27736,7 +27783,8 @@ function toResult(graphResult, startTime, continueOnFailure) {
27736
27783
  success: false,
27737
27784
  stepsExecuted: graphResult.stepsExecuted,
27738
27785
  durationMs,
27739
- error: failedNode?.error ?? "Stage execution failed"
27786
+ error: failedNode?.error ?? "Stage execution failed",
27787
+ nodeResults: graphResult.nodeResults
27740
27788
  };
27741
27789
  }
27742
27790
  const succeeded = stepResults.filter((s) => s.status === "succeeded").length;
@@ -27746,6 +27794,7 @@ function toResult(graphResult, startTime, continueOnFailure) {
27746
27794
  success: allOk,
27747
27795
  stepsExecuted: graphResult.stepsExecuted,
27748
27796
  durationMs,
27797
+ nodeResults: graphResult.nodeResults,
27749
27798
  ...continueOnFailure ? { stepResults } : {},
27750
27799
  ...!allOk && continueOnFailure ? { error: `${String(succeeded)}/${String(total)} steps succeeded` } : {}
27751
27800
  };
@@ -36532,19 +36581,24 @@ async function discoverFromExtendedSource(source, topic, maxResults, logger56, s
36532
36581
  return { items: toDiscoveredItems(result.value), failed: false };
36533
36582
  }
36534
36583
  function computeRelevanceScore(item, topic) {
36535
- const keywords = topic.toLowerCase().split(/[\s,;+\-/]+/).filter((w) => w.length >= 3);
36584
+ const keywords = [
36585
+ ...new Set(
36586
+ topic.toLowerCase().split(/[\s,;+\-/]+/).filter((w) => w.length >= 3)
36587
+ )
36588
+ ];
36536
36589
  if (keywords.length === 0) return 1;
36537
36590
  const titleLower = item.title.toLowerCase();
36538
36591
  const descLower = item.description.toLowerCase();
36539
- let titleMatches = 0;
36540
- let descMatches = 0;
36592
+ let matched = 0;
36593
+ let titleHits = 0;
36541
36594
  for (const keyword of keywords) {
36542
- if (titleLower.includes(keyword)) titleMatches++;
36543
- if (descLower.includes(keyword)) descMatches++;
36595
+ const inTitle = titleLower.includes(keyword);
36596
+ if (inTitle || descLower.includes(keyword)) matched++;
36597
+ if (inTitle) titleHits++;
36544
36598
  }
36545
- const weightedMatches = titleMatches * 2 + descMatches;
36546
- const maxPossible = keywords.length * 3;
36547
- return Math.min(1, weightedMatches / maxPossible);
36599
+ const coverage = matched / keywords.length;
36600
+ const titleFraction = titleHits / keywords.length;
36601
+ return Math.min(1, coverage * 0.8 + titleFraction * 0.2);
36548
36602
  }
36549
36603
  function filterByRelevance2(items, topic, threshold) {
36550
36604
  const scored = items.map((item) => ({
@@ -42065,7 +42119,7 @@ ${contextBlock}`;
42065
42119
  const strategy = config.votingStrategy ?? "higher_order";
42066
42120
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
42067
42121
  try {
42068
- const { executeVoting } = await import("./consensus-vote-YM4BVTDO.js");
42122
+ const { executeVoting } = await import("./consensus-vote-ALLKZH6O.js");
42069
42123
  const votingResult = await executeVoting(
42070
42124
  {
42071
42125
  proposal: buildVoteProposal(plan, research),
@@ -49080,4 +49134,4 @@ export {
49080
49134
  detectBackend,
49081
49135
  createTaskTracker
49082
49136
  };
49083
- //# sourceMappingURL=chunk-LV26EF7E.js.map
49137
+ //# sourceMappingURL=chunk-4DUL5HKB.js.map