@agentv/core 4.5.0 → 4.5.1
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.
- package/dist/index.cjs +41 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19842,7 +19842,9 @@ async function runEvalCase(options) {
|
|
|
19842
19842
|
});
|
|
19843
19843
|
} catch (error) {
|
|
19844
19844
|
lastError = error;
|
|
19845
|
-
if (
|
|
19845
|
+
if (attempt + 1 < attemptBudget) {
|
|
19846
|
+
const delayMs = retryBackoffMs(attempt);
|
|
19847
|
+
await sleep3(delayMs, signal);
|
|
19846
19848
|
attempt += 1;
|
|
19847
19849
|
continue;
|
|
19848
19850
|
}
|
|
@@ -20538,7 +20540,7 @@ async function invokeProvider(provider, options) {
|
|
|
20538
20540
|
}
|
|
20539
20541
|
}
|
|
20540
20542
|
function buildErrorResult(evalCase, targetName, timestamp, error, promptInputs, provider, failureStage, failureReasonCode, verbose) {
|
|
20541
|
-
const message =
|
|
20543
|
+
const message = extractErrorMessage(error);
|
|
20542
20544
|
let agentRequest;
|
|
20543
20545
|
let lmRequest;
|
|
20544
20546
|
if (isAgentProvider(provider)) {
|
|
@@ -20655,20 +20657,45 @@ function aggregateEvaluatorTokenUsage(scores) {
|
|
|
20655
20657
|
...hasCached ? { cached } : {}
|
|
20656
20658
|
};
|
|
20657
20659
|
}
|
|
20658
|
-
function
|
|
20659
|
-
if (!error) {
|
|
20660
|
-
return false;
|
|
20661
|
-
}
|
|
20662
|
-
if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
|
|
20663
|
-
return true;
|
|
20664
|
-
}
|
|
20660
|
+
function extractErrorMessage(error) {
|
|
20665
20661
|
if (error instanceof Error) {
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20662
|
+
return error.message;
|
|
20663
|
+
}
|
|
20664
|
+
if (error !== null && typeof error === "object") {
|
|
20665
|
+
const obj = error;
|
|
20666
|
+
const parts = [];
|
|
20667
|
+
if (typeof obj.message === "string" && obj.message) {
|
|
20668
|
+
parts.push(obj.message);
|
|
20669
|
+
}
|
|
20670
|
+
if (typeof obj.code === "number") {
|
|
20671
|
+
parts.push(`(code ${obj.code})`);
|
|
20672
|
+
}
|
|
20673
|
+
if (parts.length > 0) {
|
|
20674
|
+
return parts.join(" ");
|
|
20675
|
+
}
|
|
20676
|
+
try {
|
|
20677
|
+
return JSON.stringify(error);
|
|
20678
|
+
} catch {
|
|
20679
|
+
}
|
|
20669
20680
|
}
|
|
20670
|
-
|
|
20671
|
-
|
|
20681
|
+
return String(error);
|
|
20682
|
+
}
|
|
20683
|
+
function retryBackoffMs(attempt) {
|
|
20684
|
+
return Math.min(2 ** attempt * 1e3, 3e4);
|
|
20685
|
+
}
|
|
20686
|
+
function sleep3(ms, signal) {
|
|
20687
|
+
if (signal?.aborted) return Promise.resolve();
|
|
20688
|
+
return new Promise((resolve) => {
|
|
20689
|
+
const timer = setTimeout(resolve, ms);
|
|
20690
|
+
signal?.addEventListener(
|
|
20691
|
+
"abort",
|
|
20692
|
+
() => {
|
|
20693
|
+
clearTimeout(timer);
|
|
20694
|
+
resolve();
|
|
20695
|
+
},
|
|
20696
|
+
{ once: true }
|
|
20697
|
+
);
|
|
20698
|
+
});
|
|
20672
20699
|
}
|
|
20673
20700
|
function mapChildResults(children) {
|
|
20674
20701
|
if (!children || children.length === 0) {
|