@agentforge/core 0.10.5 → 0.10.7
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 +6 -2
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1509,13 +1509,17 @@ function createToolExecutor(config = {}) {
|
|
|
1509
1509
|
return Math.min(delay, maxDelay);
|
|
1510
1510
|
}
|
|
1511
1511
|
async function executeWithRetry(tool, input, policy) {
|
|
1512
|
+
const executeFn = tool.invoke || tool.execute;
|
|
1513
|
+
if (!executeFn) {
|
|
1514
|
+
throw new Error("Tool must implement either invoke() or execute() method");
|
|
1515
|
+
}
|
|
1512
1516
|
if (!policy) {
|
|
1513
|
-
return await
|
|
1517
|
+
return await executeFn.call(tool, input);
|
|
1514
1518
|
}
|
|
1515
1519
|
let lastError;
|
|
1516
1520
|
for (let attempt = 1; attempt <= policy.maxAttempts; attempt++) {
|
|
1517
1521
|
try {
|
|
1518
|
-
return await
|
|
1522
|
+
return await executeFn.call(tool, input);
|
|
1519
1523
|
} catch (error) {
|
|
1520
1524
|
lastError = error;
|
|
1521
1525
|
if (policy.retryableErrors && policy.retryableErrors.length > 0) {
|
package/dist/index.js
CHANGED
|
@@ -1353,13 +1353,17 @@ function createToolExecutor(config = {}) {
|
|
|
1353
1353
|
return Math.min(delay, maxDelay);
|
|
1354
1354
|
}
|
|
1355
1355
|
async function executeWithRetry(tool, input, policy) {
|
|
1356
|
+
const executeFn = tool.invoke || tool.execute;
|
|
1357
|
+
if (!executeFn) {
|
|
1358
|
+
throw new Error("Tool must implement either invoke() or execute() method");
|
|
1359
|
+
}
|
|
1356
1360
|
if (!policy) {
|
|
1357
|
-
return await
|
|
1361
|
+
return await executeFn.call(tool, input);
|
|
1358
1362
|
}
|
|
1359
1363
|
let lastError;
|
|
1360
1364
|
for (let attempt = 1; attempt <= policy.maxAttempts; attempt++) {
|
|
1361
1365
|
try {
|
|
1362
|
-
return await
|
|
1366
|
+
return await executeFn.call(tool, input);
|
|
1363
1367
|
} catch (error) {
|
|
1364
1368
|
lastError = error;
|
|
1365
1369
|
if (policy.retryableErrors && policy.retryableErrors.length > 0) {
|