nexus-agents 2.173.2 → 2.173.4

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.
@@ -8,7 +8,7 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-H63X54TU.js";
11
+ } from "./chunk-YYCG236I.js";
12
12
  import {
13
13
  BUILT_IN_EXPERTS
14
14
  } from "./chunk-ZM4O442V.js";
@@ -2001,4 +2001,4 @@ export {
2001
2001
  setupCommand,
2002
2002
  setupCommandAsync
2003
2003
  };
2004
- //# sourceMappingURL=chunk-GNXQBXFI.js.map
2004
+ //# sourceMappingURL=chunk-CGIT3MVV.js.map
@@ -21,7 +21,7 @@ import {
21
21
  DEFAULT_TASK_TTL_MS,
22
22
  DEFAULT_TOOL_RATE_LIMITS,
23
23
  clampTaskTtl
24
- } from "./chunk-H63X54TU.js";
24
+ } from "./chunk-YYCG236I.js";
25
25
  import {
26
26
  executeExpert
27
27
  } from "./chunk-MBTEWGZK.js";
@@ -12438,29 +12438,33 @@ function highestConfidenceFailure(failures) {
12438
12438
  }, void 0);
12439
12439
  }
12440
12440
  function classifyExpertFailure(error, detector, taskDescription, signal) {
12441
- if (signal?.aborted === true) {
12442
- return { kind: "permanent", source: "default" };
12443
- }
12444
- if (isRetryableErrorChain(error)) {
12445
- return { kind: "transient", source: "transport" };
12446
- }
12447
- const detection = detector.detect({
12448
- messages: [{ role: "assistant", content: extractErrorMessage(error) }],
12449
- ...taskDescription !== void 0 ? { taskDescription } : {}
12450
- });
12451
- if (detection.hasFailure) {
12452
- const top = highestConfidenceFailure(detection.failures);
12453
- if (top !== void 0) {
12454
- const action = DEFAULT_RECOVERY_STRATEGIES[top.archetype].action;
12455
- return {
12456
- kind: RECOVERABLE_ACTIONS.has(action) ? "transient" : "permanent",
12457
- source: "archetype",
12458
- archetype: top.archetype,
12459
- confidence: top.confidence
12460
- };
12441
+ try {
12442
+ if (signal?.aborted === true) {
12443
+ return { kind: "permanent", source: "default" };
12444
+ }
12445
+ if (isRetryableErrorChain(error)) {
12446
+ return { kind: "transient", source: "transport" };
12447
+ }
12448
+ const detection = detector.detect({
12449
+ messages: [{ role: "assistant", content: extractErrorMessage(error) }],
12450
+ ...taskDescription !== void 0 ? { taskDescription } : {}
12451
+ });
12452
+ if (detection.hasFailure) {
12453
+ const top = highestConfidenceFailure(detection.failures);
12454
+ if (top !== void 0) {
12455
+ const action = DEFAULT_RECOVERY_STRATEGIES[top.archetype].action;
12456
+ return {
12457
+ kind: RECOVERABLE_ACTIONS.has(action) ? "transient" : "permanent",
12458
+ source: "archetype",
12459
+ archetype: top.archetype,
12460
+ confidence: top.confidence
12461
+ };
12462
+ }
12461
12463
  }
12464
+ return { kind: "permanent", source: "default" };
12465
+ } catch {
12466
+ return { kind: "permanent", source: "default" };
12462
12467
  }
12463
- return { kind: "permanent", source: "default" };
12464
12468
  }
12465
12469
  function mergeRecoveryConfig(policy) {
12466
12470
  return {
@@ -12533,27 +12537,47 @@ var RecoverableExpert = class extends Expert {
12533
12537
  return lastClassification.kind === "transient";
12534
12538
  },
12535
12539
  onRetry: (info) => {
12536
- this.recoveryLogger.info("Expert execution retry", {
12537
- expertId: this.expertConfig.id,
12538
- attempt: info.attempt,
12539
- delayMs: info.delayMs,
12540
- classification: lastClassification?.kind,
12541
- source: lastClassification?.source,
12542
- archetype: lastClassification?.archetype
12543
- });
12544
- if (lastClassification?.source === "archetype" && lastClassification.archetype !== void 0) {
12545
- currentTask = this.injectRecoveryGuidance(
12546
- currentTask,
12547
- lastClassification.archetype,
12548
- info
12549
- );
12550
- }
12540
+ currentTask = this.handleRetry(info, lastClassification, currentTask);
12551
12541
  }
12552
12542
  }
12553
12543
  );
12554
12544
  if (outcome.ok) return ok(outcome.value);
12555
12545
  return err(this.annotateExhausted(outcome.error, currentTask, signal));
12556
12546
  }
12547
+ /**
12548
+ * Per-retry callback: logs the attempt and, for a recoverable archetype,
12549
+ * injects archetype-specific guidance into the next attempt's task.
12550
+ *
12551
+ * Returns the (possibly augmented) task. onRetry runs INSIDE withRetry's catch
12552
+ * but is NOT itself try-guarded (adapters/retry.ts:352-359 — the try wraps only
12553
+ * `operation()`), so a throw here would escape withRetry and reject the Promise.
12554
+ * The guidance path re-reads the error (extractErrorMessage) and calls
12555
+ * detector.detect, so a pathological error (#4303 throwing getter) could throw —
12556
+ * guard it: on failure, skip injection and retry with the un-augmented task.
12557
+ */
12558
+ handleRetry(info, classification, currentTask) {
12559
+ this.recoveryLogger.info("Expert execution retry", {
12560
+ expertId: this.expertConfig.id,
12561
+ attempt: info.attempt,
12562
+ delayMs: info.delayMs,
12563
+ classification: classification?.kind,
12564
+ source: classification?.source,
12565
+ archetype: classification?.archetype
12566
+ });
12567
+ if (classification?.source !== "archetype" || classification.archetype === void 0) {
12568
+ return currentTask;
12569
+ }
12570
+ try {
12571
+ return this.injectRecoveryGuidance(currentTask, classification.archetype, info);
12572
+ } catch (guidanceError) {
12573
+ this.recoveryLogger.warn("Skipping recovery guidance injection (threw)", {
12574
+ expertId: this.expertConfig.id,
12575
+ archetype: classification.archetype,
12576
+ error: getErrorMessage(guidanceError)
12577
+ });
12578
+ return currentTask;
12579
+ }
12580
+ }
12557
12581
  /**
12558
12582
  * Builds the annotated failure returned when recovery is exhausted. withRetry
12559
12583
  * skips isRetryable on the final attempt, so the per-attempt `lastClassification`
@@ -54021,4 +54045,4 @@ export {
54021
54045
  shutdownFeedbackSubscriber,
54022
54046
  createEventBusBridge
54023
54047
  };
54024
- //# sourceMappingURL=chunk-5UKKGPRS.js.map
54048
+ //# sourceMappingURL=chunk-R4ZINS62.js.map