agentv 4.5.0 → 4.5.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.
@@ -30451,7 +30451,9 @@ async function runEvalCase(options) {
30451
30451
  });
30452
30452
  } catch (error) {
30453
30453
  lastError = error;
30454
- if (isTimeoutLike(error) && attempt + 1 < attemptBudget) {
30454
+ if (attempt + 1 < attemptBudget) {
30455
+ const delayMs = retryBackoffMs(attempt);
30456
+ await sleep3(delayMs, signal);
30455
30457
  attempt += 1;
30456
30458
  continue;
30457
30459
  }
@@ -31147,7 +31149,7 @@ async function invokeProvider(provider, options) {
31147
31149
  }
31148
31150
  }
31149
31151
  function buildErrorResult(evalCase, targetName, timestamp, error, promptInputs, provider, failureStage, failureReasonCode, verbose) {
31150
- const message = error instanceof Error ? error.message : String(error);
31152
+ const message = extractErrorMessage2(error);
31151
31153
  let agentRequest;
31152
31154
  let lmRequest;
31153
31155
  if (isAgentProvider(provider)) {
@@ -31264,20 +31266,45 @@ function aggregateEvaluatorTokenUsage(scores) {
31264
31266
  ...hasCached ? { cached } : {}
31265
31267
  };
31266
31268
  }
31267
- function isTimeoutLike(error) {
31268
- if (!error) {
31269
- return false;
31270
- }
31271
- if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
31272
- return true;
31273
- }
31269
+ function extractErrorMessage2(error) {
31274
31270
  if (error instanceof Error) {
31275
- const name21 = error.name?.toLowerCase();
31276
- const message = error.message?.toLowerCase();
31277
- return name21.includes("timeout") || message.includes("timeout");
31271
+ return error.message;
31272
+ }
31273
+ if (error !== null && typeof error === "object") {
31274
+ const obj = error;
31275
+ const parts = [];
31276
+ if (typeof obj.message === "string" && obj.message) {
31277
+ parts.push(obj.message);
31278
+ }
31279
+ if (typeof obj.code === "number") {
31280
+ parts.push(`(code ${obj.code})`);
31281
+ }
31282
+ if (parts.length > 0) {
31283
+ return parts.join(" ");
31284
+ }
31285
+ try {
31286
+ return JSON.stringify(error);
31287
+ } catch {
31288
+ }
31278
31289
  }
31279
- const value = String(error).toLowerCase();
31280
- return value.includes("timeout");
31290
+ return String(error);
31291
+ }
31292
+ function retryBackoffMs(attempt) {
31293
+ return Math.min(2 ** attempt * 1e3, 3e4);
31294
+ }
31295
+ function sleep3(ms, signal) {
31296
+ if (signal?.aborted) return Promise.resolve();
31297
+ return new Promise((resolve2) => {
31298
+ const timer = setTimeout(resolve2, ms);
31299
+ signal?.addEventListener(
31300
+ "abort",
31301
+ () => {
31302
+ clearTimeout(timer);
31303
+ resolve2();
31304
+ },
31305
+ { once: true }
31306
+ );
31307
+ });
31281
31308
  }
31282
31309
  function mapChildResults(children) {
31283
31310
  if (!children || children.length === 0) {
@@ -32744,4 +32771,4 @@ export {
32744
32771
  readTranscriptFile,
32745
32772
  createAgentKernel
32746
32773
  };
32747
- //# sourceMappingURL=chunk-TEPYEYPG.js.map
32774
+ //# sourceMappingURL=chunk-7DRAXDVC.js.map