nexus-agents 3.13.0 → 3.13.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.
@@ -22,7 +22,7 @@ import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  DEFAULT_TOOL_RATE_LIMITS,
24
24
  clampTaskTtl
25
- } from "./chunk-ERHCCLT7.js";
25
+ } from "./chunk-YRLE2SZI.js";
26
26
  import {
27
27
  executeExpert
28
28
  } from "./chunk-TPU5DT74.js";
@@ -22474,11 +22474,22 @@ function extractErrorMessage2(error) {
22474
22474
  }
22475
22475
  return error.message;
22476
22476
  }
22477
- function isNonRetryableError(error) {
22477
+ var NON_RETRYABLE_CODES = /* @__PURE__ */ new Set([
22478
+ ErrorCode.VALIDATION_ERROR,
22479
+ ErrorCode.WORKFLOW_PARSE_ERROR,
22480
+ ErrorCode.INVALID_INPUT
22481
+ ]);
22482
+ function isNonRetryableSelf(error) {
22478
22483
  if (error.name === "ValidationError") return true;
22479
- if (error instanceof WorkflowError) {
22480
- const code = error.code;
22481
- return code === ErrorCode.VALIDATION_ERROR || code === ErrorCode.WORKFLOW_PARSE_ERROR || code === ErrorCode.INVALID_INPUT;
22484
+ return error instanceof NexusError && NON_RETRYABLE_CODES.has(error.code);
22485
+ }
22486
+ function isNonRetryableError(error) {
22487
+ const seen = /* @__PURE__ */ new Set();
22488
+ let current = error;
22489
+ while (current instanceof Error && !seen.has(current)) {
22490
+ seen.add(current);
22491
+ if (isNonRetryableSelf(current)) return true;
22492
+ current = current.cause;
22482
22493
  }
22483
22494
  return false;
22484
22495
  }
@@ -52469,6 +52480,10 @@ function createTaskOutcome(params) {
52469
52480
 
52470
52481
  // src/learning/outcome-feedback.ts
52471
52482
  var logger53 = createLogger({ component: "OutcomeFeedback" });
52483
+ function ratioBonus(target, actual, weight) {
52484
+ if (!Number.isFinite(actual) || actual <= 0) return 0;
52485
+ return Math.min(1, target / actual) * weight;
52486
+ }
52472
52487
  var OutcomeFeedbackCollector = class {
52473
52488
  config;
52474
52489
  pendingDecisions = /* @__PURE__ */ new Map();
@@ -52566,10 +52581,16 @@ var OutcomeFeedbackCollector = class {
52566
52581
  baseReward = signals.completionRatio;
52567
52582
  }
52568
52583
  const qualityBonus = outcome.qualityScore * this.config.qualityWeight;
52569
- const speedRatio = Math.min(1, this.config.targetDurationMs / outcome.durationMs);
52570
- const speedBonus = speedRatio * this.config.speedWeight;
52571
- const efficiencyRatio = Math.min(1, this.config.targetTokenUsage / outcome.tokenUsage);
52572
- const efficiencyBonus = efficiencyRatio * this.config.efficiencyWeight;
52584
+ const speedBonus = ratioBonus(
52585
+ this.config.targetDurationMs,
52586
+ outcome.durationMs,
52587
+ this.config.speedWeight
52588
+ );
52589
+ const efficiencyBonus = ratioBonus(
52590
+ this.config.targetTokenUsage,
52591
+ outcome.tokenUsage,
52592
+ this.config.efficiencyWeight
52593
+ );
52573
52594
  const retryPenalty = signals.retryCount * this.config.retryPenalty;
52574
52595
  const rawReward = baseReward + qualityBonus + speedBonus + efficiencyBonus - retryPenalty;
52575
52596
  const reward = clamp01(rawReward);
@@ -54498,4 +54519,4 @@ export {
54498
54519
  shutdownFeedbackSubscriber,
54499
54520
  createEventBusBridge
54500
54521
  };
54501
- //# sourceMappingURL=chunk-6BTRY45Y.js.map
54522
+ //# sourceMappingURL=chunk-A6VFBC4F.js.map