@axlsdk/axl 0.24.2 → 0.24.3
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 +43 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -111,6 +111,12 @@ function isEventStreamOverflowError(error) {
|
|
|
111
111
|
function rethrowEventStreamOverflow(error) {
|
|
112
112
|
if (isEventStreamOverflowError(error)) throw error;
|
|
113
113
|
}
|
|
114
|
+
function isUnrecoverableError(error) {
|
|
115
|
+
return isEventStreamOverflowError(error) || isAdmissionDeniedError(error);
|
|
116
|
+
}
|
|
117
|
+
function rethrowUnrecoverable(error) {
|
|
118
|
+
if (isUnrecoverableError(error)) throw error;
|
|
119
|
+
}
|
|
114
120
|
function preserveErrorCause(error, cause) {
|
|
115
121
|
if (cause === void 0 || cause === error || "cause" in error) return error;
|
|
116
122
|
Object.defineProperty(error, "cause", {
|
|
@@ -325,7 +331,7 @@ var sharedGuard = typeof installedGuard === "object" && installedGuard !== null
|
|
|
325
331
|
var buildPath = typeof __AXL_BUILD_PATH__ === "string" ? __AXL_BUILD_PATH__ : "<source>";
|
|
326
332
|
var thisCopy = {
|
|
327
333
|
path: buildPath.startsWith("file:") ? fileURLToPath(buildPath) : buildPath,
|
|
328
|
-
version: true ? "0.24.
|
|
334
|
+
version: true ? "0.24.3" : "unknown"
|
|
329
335
|
};
|
|
330
336
|
function warnCrossCopy(other, joined) {
|
|
331
337
|
if (other === thisCopy) return;
|
|
@@ -1219,8 +1225,7 @@ function tool(config) {
|
|
|
1219
1225
|
} catch (err) {
|
|
1220
1226
|
if (options?.signal?.aborted) options.signal.throwIfAborted();
|
|
1221
1227
|
if (isAbortError(err)) throw err;
|
|
1222
|
-
|
|
1223
|
-
rethrowEventStreamOverflow(err);
|
|
1228
|
+
rethrowUnrecoverable(err);
|
|
1224
1229
|
lastError = err instanceof Error ? err : new Error(String(err));
|
|
1225
1230
|
if (attempt === maxAttempts) break;
|
|
1226
1231
|
if (retryPolicy.on && !retryPolicy.on(lastError)) {
|
|
@@ -12356,8 +12361,7 @@ async function executeAcceptedTool(options) {
|
|
|
12356
12361
|
}
|
|
12357
12362
|
}
|
|
12358
12363
|
} catch (error) {
|
|
12359
|
-
|
|
12360
|
-
if (isAdmissionDeniedError(error)) throw error;
|
|
12364
|
+
rethrowUnrecoverable(error);
|
|
12361
12365
|
const abort = cancellationError(signal, error);
|
|
12362
12366
|
if (abort !== void 0) return cancellation("handler", abort);
|
|
12363
12367
|
return failed("handler", error, { attempts });
|
|
@@ -14623,7 +14627,8 @@ ${appendedSchemaText}`;
|
|
|
14623
14627
|
metadata: this.metadata
|
|
14624
14628
|
});
|
|
14625
14629
|
} catch (err) {
|
|
14626
|
-
|
|
14630
|
+
rethrowUnrecoverable(err);
|
|
14631
|
+
if (this.currentSignal?.aborted) throw err;
|
|
14627
14632
|
validateErr = err;
|
|
14628
14633
|
const reason = err instanceof Error ? err.message : String(err);
|
|
14629
14634
|
validateResult = { valid: false, reason: `Validator error: ${reason}` };
|
|
@@ -15214,15 +15219,13 @@ ${summaryResponse.content}`
|
|
|
15214
15219
|
reject(new QuorumNotMet(quorum, successCount, results));
|
|
15215
15220
|
}
|
|
15216
15221
|
}).catch((err) => {
|
|
15217
|
-
if (
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
}
|
|
15222
|
+
if (settled) return;
|
|
15223
|
+
if (isUnrecoverableError(err) || parentSignal2?.aborted) {
|
|
15224
|
+
settled = true;
|
|
15225
|
+
controller.abort();
|
|
15226
|
+
reject(err);
|
|
15223
15227
|
return;
|
|
15224
15228
|
}
|
|
15225
|
-
if (settled) return;
|
|
15226
15229
|
const isAbort = err instanceof DOMException && err.name === "AbortError";
|
|
15227
15230
|
if (isAbort) {
|
|
15228
15231
|
completedCount++;
|
|
@@ -15245,7 +15248,8 @@ ${summaryResponse.content}`
|
|
|
15245
15248
|
const parentSignal = this.currentSignal;
|
|
15246
15249
|
const promises = Array.from({ length: n }, (_, i) => {
|
|
15247
15250
|
const run = () => fn(i).then((value) => ({ ok: true, value })).catch((err) => {
|
|
15248
|
-
|
|
15251
|
+
rethrowUnrecoverable(err);
|
|
15252
|
+
if (parentSignal?.aborted) throw err;
|
|
15249
15253
|
return {
|
|
15250
15254
|
ok: false,
|
|
15251
15255
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -15369,6 +15373,7 @@ ${summaryResponse.content}`
|
|
|
15369
15373
|
async verify(fn, schema, options) {
|
|
15370
15374
|
const maxRetries = options?.retries ?? 3;
|
|
15371
15375
|
let lastRetry = void 0;
|
|
15376
|
+
const scopeSignal = this.currentSignal;
|
|
15372
15377
|
const emitVerifyOutcome = (passed, attempts, lastError) => {
|
|
15373
15378
|
this.emitEvent({
|
|
15374
15379
|
type: "verify",
|
|
@@ -15391,25 +15396,24 @@ ${summaryResponse.content}`
|
|
|
15391
15396
|
try {
|
|
15392
15397
|
validateResult = await options.validate(parsed, { metadata: this.metadata });
|
|
15393
15398
|
} catch (err) {
|
|
15394
|
-
|
|
15399
|
+
rethrowUnrecoverable(err);
|
|
15400
|
+
if (scopeSignal?.aborted) throw err;
|
|
15395
15401
|
const reason = err instanceof Error ? err.message : String(err);
|
|
15396
15402
|
validateResult = { valid: false, reason: `Validator error: ${reason}` };
|
|
15397
15403
|
}
|
|
15398
15404
|
if (!validateResult.valid) {
|
|
15405
|
+
scopeSignal?.throwIfAborted();
|
|
15399
15406
|
const errorMsg = validateResult.reason ?? "Validation failed";
|
|
15400
15407
|
lastRetry = { error: errorMsg, output: rawOutput, parsed };
|
|
15401
|
-
if (attempt === maxRetries)
|
|
15402
|
-
emitVerifyOutcome(false, attempt + 1, errorMsg);
|
|
15403
|
-
if (options?.fallback !== void 0) return options.fallback;
|
|
15404
|
-
throw new ValidationError(parsed, errorMsg, maxRetries);
|
|
15405
|
-
}
|
|
15408
|
+
if (attempt === maxRetries) throw new ValidationError(parsed, errorMsg, maxRetries);
|
|
15406
15409
|
continue;
|
|
15407
15410
|
}
|
|
15408
15411
|
}
|
|
15409
15412
|
emitVerifyOutcome(true, attempt + 1);
|
|
15410
15413
|
return parsed;
|
|
15411
15414
|
} catch (err) {
|
|
15412
|
-
|
|
15415
|
+
rethrowUnrecoverable(err);
|
|
15416
|
+
if (scopeSignal?.aborted) throw err;
|
|
15413
15417
|
if (err instanceof ValidationError) {
|
|
15414
15418
|
lastRetry = {
|
|
15415
15419
|
error: err.reason,
|
|
@@ -15476,7 +15480,8 @@ ${summaryResponse.content}`
|
|
|
15476
15480
|
const unpriced = this.budgetContext.unpriced;
|
|
15477
15481
|
return { value, budgetExceeded: exceeded, totalCost, unpriced };
|
|
15478
15482
|
} catch (err) {
|
|
15479
|
-
|
|
15483
|
+
rethrowUnrecoverable(err);
|
|
15484
|
+
if (parentSignal?.aborted) throw err;
|
|
15480
15485
|
if (this.budgetContext.exceeded) {
|
|
15481
15486
|
return {
|
|
15482
15487
|
value: null,
|
|
@@ -15485,14 +15490,6 @@ ${summaryResponse.content}`
|
|
|
15485
15490
|
unpriced: this.budgetContext.unpriced
|
|
15486
15491
|
};
|
|
15487
15492
|
}
|
|
15488
|
-
if (err instanceof DOMException && err.name === "AbortError" && controller) {
|
|
15489
|
-
return {
|
|
15490
|
-
value: null,
|
|
15491
|
-
budgetExceeded: true,
|
|
15492
|
-
totalCost: this.budgetContext.totalCost,
|
|
15493
|
-
unpriced: this.budgetContext.unpriced
|
|
15494
|
-
};
|
|
15495
|
-
}
|
|
15496
15493
|
throw err;
|
|
15497
15494
|
} finally {
|
|
15498
15495
|
if (parentBudget) {
|
|
@@ -15608,7 +15605,8 @@ ${summaryResponse.content}`
|
|
|
15608
15605
|
return;
|
|
15609
15606
|
}
|
|
15610
15607
|
} catch (err) {
|
|
15611
|
-
|
|
15608
|
+
rethrowUnrecoverable(err);
|
|
15609
|
+
if (parentSignal?.aborted) throw err;
|
|
15612
15610
|
remaining--;
|
|
15613
15611
|
lastError = err instanceof Error ? err : new Error(`Validator error: ${String(err)}`);
|
|
15614
15612
|
if (remaining === 0 && !settled) {
|
|
@@ -15628,7 +15626,7 @@ ${summaryResponse.content}`
|
|
|
15628
15626
|
controller.abort();
|
|
15629
15627
|
resolve2(value);
|
|
15630
15628
|
}).catch((err) => {
|
|
15631
|
-
if (
|
|
15629
|
+
if (isUnrecoverableError(err)) {
|
|
15632
15630
|
if (!settled) {
|
|
15633
15631
|
settled = true;
|
|
15634
15632
|
controller.abort();
|
|
@@ -15637,6 +15635,12 @@ ${summaryResponse.content}`
|
|
|
15637
15635
|
throw err;
|
|
15638
15636
|
}
|
|
15639
15637
|
if (settled) return;
|
|
15638
|
+
if (parentSignal?.aborted) {
|
|
15639
|
+
settled = true;
|
|
15640
|
+
controller.abort();
|
|
15641
|
+
reject(err);
|
|
15642
|
+
return;
|
|
15643
|
+
}
|
|
15640
15644
|
if (err instanceof DOMException && err.name === "AbortError") {
|
|
15641
15645
|
remaining--;
|
|
15642
15646
|
if (remaining === 0 && !settled) {
|
|
@@ -15695,7 +15699,7 @@ ${summaryResponse.content}`
|
|
|
15695
15699
|
results[idx] = { ok: true, value };
|
|
15696
15700
|
successCount++;
|
|
15697
15701
|
} catch (err) {
|
|
15698
|
-
if (
|
|
15702
|
+
if (isUnrecoverableError(err)) {
|
|
15699
15703
|
settled = true;
|
|
15700
15704
|
controller?.abort();
|
|
15701
15705
|
reject(err);
|
|
@@ -15704,6 +15708,12 @@ ${summaryResponse.content}`
|
|
|
15704
15708
|
if (settled) {
|
|
15705
15709
|
return;
|
|
15706
15710
|
}
|
|
15711
|
+
if (parentSignal?.aborted) {
|
|
15712
|
+
settled = true;
|
|
15713
|
+
controller?.abort();
|
|
15714
|
+
reject(err);
|
|
15715
|
+
return;
|
|
15716
|
+
}
|
|
15707
15717
|
if (err instanceof DOMException && err.name === "AbortError" && controller?.signal.aborted) {
|
|
15708
15718
|
completedCount++;
|
|
15709
15719
|
return;
|