brass-runtime 1.18.0 → 1.18.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/agent/cli/main.cjs +30 -30
- package/dist/agent/cli/main.js +2 -2
- package/dist/agent/cli/main.mjs +2 -2
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/index.mjs +2 -2
- package/dist/{chunk-PSEU65ND.js → chunk-22HZQG5F.js} +6 -6
- package/dist/{chunk-SSQJKDN3.cjs → chunk-2JHJ4YHS.cjs} +227 -117
- package/dist/{chunk-IFRBVMWJ.cjs → chunk-2OW6IFY2.cjs} +19 -19
- package/dist/{chunk-YTX2JYYP.cjs → chunk-5LC7V2OZ.cjs} +18 -18
- package/dist/{chunk-7TXQJFZX.cjs → chunk-5RZ7YITF.cjs} +13 -13
- package/dist/{chunk-OT2TESZU.mjs → chunk-6V2AWT4R.mjs} +1 -1
- package/dist/{chunk-BG5RNEA2.js → chunk-7DU7IQHK.js} +3 -3
- package/dist/{chunk-QCOLAHU3.mjs → chunk-7GBJYOX7.mjs} +5 -5
- package/dist/{chunk-ITG6I7ZS.js → chunk-7VQLEN37.js} +1 -1
- package/dist/{chunk-QZ6QFJNM.mjs → chunk-B5FKOLTB.mjs} +3 -3
- package/dist/{chunk-RREBJX2S.mjs → chunk-BC6Q6BCO.mjs} +1 -1
- package/dist/{chunk-KRYP6CAE.mjs → chunk-COOW7BJX.mjs} +2 -2
- package/dist/{chunk-ELLF55ER.mjs → chunk-EEN5OTCR.mjs} +1 -1
- package/dist/{chunk-3PFZGP23.cjs → chunk-EICAJDNX.cjs} +13 -13
- package/dist/{chunk-5XADBMSU.cjs → chunk-ELIECDYN.cjs} +5 -5
- package/dist/{chunk-2QNREG6K.mjs → chunk-H626ZTDZ.mjs} +211 -101
- package/dist/{chunk-JH4GI3DW.js → chunk-IPSMXUWA.js} +1 -1
- package/dist/{chunk-2SLT3X6G.cjs → chunk-J6DUHITE.cjs} +6 -6
- package/dist/{chunk-OI4ESUMC.mjs → chunk-JWIEMBE6.mjs} +6 -6
- package/dist/{chunk-N6QNSTWD.cjs → chunk-KNTJ7FQB.cjs} +5 -5
- package/dist/{chunk-W6WR37HN.js → chunk-LSYQ3C2M.js} +2 -2
- package/dist/{chunk-AADFFVYS.js → chunk-OW5VHAOE.js} +1 -1
- package/dist/{chunk-G5JTCFMI.mjs → chunk-RBHNOKH4.mjs} +2 -2
- package/dist/{chunk-IBRHSH5H.js → chunk-S4HXADU4.js} +1 -1
- package/dist/{chunk-XSAHV5HQ.js → chunk-TTSPIU3U.js} +211 -101
- package/dist/{chunk-S4HHFUYP.js → chunk-UAKAF32U.js} +2 -2
- package/dist/{chunk-R6WDSZA6.mjs → chunk-WCBNXPN6.mjs} +1 -1
- package/dist/{chunk-AJMKZXRB.cjs → chunk-WGE2FEZE.cjs} +2 -2
- package/dist/{chunk-LXBU5E77.cjs → chunk-WI7GZF3B.cjs} +16 -16
- package/dist/{chunk-H5GYX7RZ.js → chunk-WUDHOZIH.js} +113 -5
- package/dist/{chunk-KHACHFBQ.cjs → chunk-WVSZOPGQ.cjs} +54 -54
- package/dist/{chunk-VIFA4DPN.cjs → chunk-XPIMJQYS.cjs} +193 -85
- package/dist/{chunk-3PHU7FWS.js → chunk-YGR2IN4R.js} +5 -5
- package/dist/{chunk-ITZQ526U.mjs → chunk-YWLLH27R.mjs} +2 -2
- package/dist/{chunk-4YQHPIWJ.js → chunk-YZ5LQ32F.js} +2 -2
- package/dist/{chunk-Z3PSSXP3.mjs → chunk-Z3ZZMQUZ.mjs} +113 -5
- package/dist/core/index.cjs +13 -7
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +12 -6
- package/dist/core/index.mjs +12 -6
- package/dist/{defaultClient-DhpCQW9m.d.ts → defaultClient-Cid0JoUR.d.ts} +29 -4
- package/dist/{effect-CtUDl5M5.d.ts → effect-DnGUuhw6.d.ts} +22 -1
- package/dist/http/index.cjs +52 -48
- package/dist/http/index.d.ts +8 -8
- package/dist/http/index.js +10 -6
- package/dist/http/index.mjs +10 -6
- package/dist/http/testing.cjs +8 -8
- package/dist/http/testing.d.ts +4 -4
- package/dist/http/testing.js +4 -4
- package/dist/http/testing.mjs +4 -4
- package/dist/index.cjs +91 -85
- package/dist/index.d.ts +7 -7
- package/dist/index.js +13 -7
- package/dist/index.mjs +13 -7
- package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
- package/dist/observability/index.cjs +9 -9
- package/dist/observability/index.d.ts +7 -7
- package/dist/observability/index.js +8 -8
- package/dist/observability/index.mjs +8 -8
- package/dist/perf/cli.cjs +25 -25
- package/dist/perf/cli.js +10 -10
- package/dist/perf/cli.mjs +10 -10
- package/dist/perf/index.cjs +12 -12
- package/dist/perf/index.js +10 -10
- package/dist/perf/index.mjs +10 -10
- package/dist/{server-C1zVmqE6.d.ts → server-Bf1zNYZk.d.ts} +4 -4
- package/dist/{stream-Bb4FTejt.d.ts → stream-I7bkvF7a.d.ts} +1 -1
- package/dist/{tracer-DzfuE6um.d.ts → tracer-DF83nLn6.d.ts} +2 -2
- package/dist/{tracing-BABA5arE.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
- package/package.json +3 -2
|
@@ -2950,31 +2950,43 @@ var Runtime = class _Runtime {
|
|
|
2950
2950
|
const fiber = this.fork(effect);
|
|
2951
2951
|
fiber.join(cb);
|
|
2952
2952
|
}
|
|
2953
|
+
static exitToError(exit) {
|
|
2954
|
+
if (exit._tag === "Success") return void 0;
|
|
2955
|
+
const failure = Cause.firstFailure(exit.cause);
|
|
2956
|
+
if (failure._tag === "Some") return failure.value;
|
|
2957
|
+
const defect = Cause.firstDefect(exit.cause);
|
|
2958
|
+
if (defect._tag === "Some") {
|
|
2959
|
+
return defect.value instanceof Error ? defect.value : new Error(String(defect.value));
|
|
2960
|
+
}
|
|
2961
|
+
if (Cause.containsInterrupt(exit.cause)) return new Error("Interrupted");
|
|
2962
|
+
return Cause.toError(exit.cause);
|
|
2963
|
+
}
|
|
2953
2964
|
toPromise(effect) {
|
|
2965
|
+
let syncExit;
|
|
2966
|
+
let promiseResolve;
|
|
2967
|
+
let promiseReject;
|
|
2968
|
+
const complete = (exit) => {
|
|
2969
|
+
if (promiseResolve) {
|
|
2970
|
+
if (exit._tag === "Success") promiseResolve(exit.value);
|
|
2971
|
+
else promiseReject(_Runtime.exitToError(exit));
|
|
2972
|
+
} else {
|
|
2973
|
+
syncExit = exit;
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
if (this.tryRunNativeTopLevel(effect, complete)) {
|
|
2977
|
+
if (syncExit) {
|
|
2978
|
+
return syncExit._tag === "Success" ? Promise.resolve(syncExit.value) : Promise.reject(_Runtime.exitToError(syncExit));
|
|
2979
|
+
}
|
|
2980
|
+
return new Promise((resolve, reject) => {
|
|
2981
|
+
promiseResolve = resolve;
|
|
2982
|
+
promiseReject = reject;
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2954
2985
|
return new Promise((resolve, reject) => {
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
resolve(exit.value);
|
|
2958
|
-
return;
|
|
2959
|
-
}
|
|
2960
|
-
const failure = Cause.firstFailure(exit.cause);
|
|
2961
|
-
if (failure._tag === "Some") reject(failure.value);
|
|
2962
|
-
else {
|
|
2963
|
-
const defect = Cause.firstDefect(exit.cause);
|
|
2964
|
-
if (defect._tag === "Some") {
|
|
2965
|
-
reject(defect.value instanceof Error ? defect.value : new Error(String(defect.value)));
|
|
2966
|
-
} else if (Cause.containsInterrupt(exit.cause)) {
|
|
2967
|
-
reject(new Error("Interrupted"));
|
|
2968
|
-
} else {
|
|
2969
|
-
reject(Cause.toError(exit.cause));
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
if (this.tryRunNativeTopLevel(effect, complete)) return;
|
|
2986
|
+
promiseResolve = resolve;
|
|
2987
|
+
promiseReject = reject;
|
|
2974
2988
|
const fiber = this.fork(effect);
|
|
2975
|
-
fiber.join(
|
|
2976
|
-
complete(exit);
|
|
2977
|
-
});
|
|
2989
|
+
fiber.join(complete);
|
|
2978
2990
|
});
|
|
2979
2991
|
}
|
|
2980
2992
|
tryRunNativeTopLevel(effect, cb) {
|
|
@@ -3274,6 +3286,12 @@ var abortablePromiseTotals = {
|
|
|
3274
3286
|
lateSettlements: 0
|
|
3275
3287
|
};
|
|
3276
3288
|
var abortablePromiseLabels = /* @__PURE__ */ new Map();
|
|
3289
|
+
var perLabelTrackingEnabled = false;
|
|
3290
|
+
function setAbortablePromisePerLabelTracking(enabled) {
|
|
3291
|
+
const previous = perLabelTrackingEnabled;
|
|
3292
|
+
perLabelTrackingEnabled = enabled;
|
|
3293
|
+
return previous;
|
|
3294
|
+
}
|
|
3277
3295
|
var getAbortablePromiseLabelStats = (label) => {
|
|
3278
3296
|
const existing = abortablePromiseLabels.get(label);
|
|
3279
3297
|
if (existing) return existing;
|
|
@@ -3291,44 +3309,60 @@ var getAbortablePromiseLabelStats = (label) => {
|
|
|
3291
3309
|
return created;
|
|
3292
3310
|
};
|
|
3293
3311
|
var recordAbortablePromiseStart = (label) => {
|
|
3294
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3295
3312
|
abortablePromiseTotals.active++;
|
|
3296
3313
|
abortablePromiseTotals.started++;
|
|
3297
|
-
|
|
3298
|
-
|
|
3314
|
+
if (perLabelTrackingEnabled) {
|
|
3315
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3316
|
+
byLabel.active++;
|
|
3317
|
+
byLabel.started++;
|
|
3318
|
+
}
|
|
3299
3319
|
};
|
|
3300
3320
|
var recordAbortablePromiseFinish = (label, outcome) => {
|
|
3301
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3302
3321
|
if (abortablePromiseTotals.active > 0) abortablePromiseTotals.active--;
|
|
3303
|
-
if (byLabel.active > 0) byLabel.active--;
|
|
3304
3322
|
switch (outcome) {
|
|
3305
3323
|
case "success":
|
|
3306
3324
|
abortablePromiseTotals.succeeded++;
|
|
3307
|
-
|
|
3308
|
-
return;
|
|
3325
|
+
break;
|
|
3309
3326
|
case "failure":
|
|
3310
3327
|
abortablePromiseTotals.failed++;
|
|
3311
|
-
|
|
3312
|
-
return;
|
|
3328
|
+
break;
|
|
3313
3329
|
case "interrupt":
|
|
3314
3330
|
abortablePromiseTotals.interrupted++;
|
|
3315
|
-
|
|
3316
|
-
return;
|
|
3331
|
+
break;
|
|
3317
3332
|
case "timeout":
|
|
3318
3333
|
abortablePromiseTotals.timedOut++;
|
|
3319
|
-
|
|
3320
|
-
|
|
3334
|
+
break;
|
|
3335
|
+
}
|
|
3336
|
+
if (perLabelTrackingEnabled) {
|
|
3337
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3338
|
+
if (byLabel.active > 0) byLabel.active--;
|
|
3339
|
+
switch (outcome) {
|
|
3340
|
+
case "success":
|
|
3341
|
+
byLabel.succeeded++;
|
|
3342
|
+
return;
|
|
3343
|
+
case "failure":
|
|
3344
|
+
byLabel.failed++;
|
|
3345
|
+
return;
|
|
3346
|
+
case "interrupt":
|
|
3347
|
+
byLabel.interrupted++;
|
|
3348
|
+
return;
|
|
3349
|
+
case "timeout":
|
|
3350
|
+
byLabel.timedOut++;
|
|
3351
|
+
return;
|
|
3352
|
+
}
|
|
3321
3353
|
}
|
|
3322
3354
|
};
|
|
3323
3355
|
var recordAbortablePromiseLateSettlement = (label) => {
|
|
3324
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3325
3356
|
abortablePromiseTotals.lateSettlements++;
|
|
3326
|
-
|
|
3357
|
+
if (perLabelTrackingEnabled) {
|
|
3358
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3359
|
+
byLabel.lateSettlements++;
|
|
3360
|
+
}
|
|
3327
3361
|
};
|
|
3328
3362
|
function abortablePromiseStats() {
|
|
3329
3363
|
return {
|
|
3330
3364
|
...abortablePromiseTotals,
|
|
3331
|
-
byLabel: Array.from(abortablePromiseLabels.values()).map((x) => ({ ...x })).sort((a, b) => b.active - a.active || b.started - a.started || a.label.localeCompare(b.label))
|
|
3365
|
+
byLabel: perLabelTrackingEnabled ? Array.from(abortablePromiseLabels.values()).map((x) => ({ ...x })).sort((a, b) => b.active - a.active || b.started - a.started || a.label.localeCompare(b.label)) : []
|
|
3332
3366
|
};
|
|
3333
3367
|
}
|
|
3334
3368
|
function resetAbortablePromiseStats() {
|
|
@@ -3350,76 +3384,149 @@ var makeTimeoutReason = (timeoutMs, label) => ({
|
|
|
3350
3384
|
timeoutMs,
|
|
3351
3385
|
message: `Abortable promise '${label}' timed out after ${timeoutMs}ms`
|
|
3352
3386
|
});
|
|
3387
|
+
function registerWithTimeout(make, onReject, options, env, cb, timeoutMs) {
|
|
3388
|
+
const controller = new AbortController();
|
|
3389
|
+
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3390
|
+
const startedAt = performance.now();
|
|
3391
|
+
let done = false;
|
|
3392
|
+
let cleanup;
|
|
3393
|
+
const hasHooks = options.onStart !== void 0 || options.onFinish !== void 0;
|
|
3394
|
+
const finish = hasHooks ? (outcome, exit, error) => {
|
|
3395
|
+
if (done) return;
|
|
3396
|
+
done = true;
|
|
3397
|
+
cleanup();
|
|
3398
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3399
|
+
options.onFinish?.({
|
|
3400
|
+
label,
|
|
3401
|
+
outcome,
|
|
3402
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
3403
|
+
error
|
|
3404
|
+
});
|
|
3405
|
+
cb(exit);
|
|
3406
|
+
} : (outcome, exit, _error) => {
|
|
3407
|
+
if (done) return;
|
|
3408
|
+
done = true;
|
|
3409
|
+
cleanup();
|
|
3410
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3411
|
+
cb(exit);
|
|
3412
|
+
};
|
|
3413
|
+
recordAbortablePromiseStart(label);
|
|
3414
|
+
if (hasHooks) options.onStart?.(label);
|
|
3415
|
+
const onTimeout = () => {
|
|
3416
|
+
const reason = options.timeoutReason?.() ?? makeTimeoutReason(timeoutMs, label);
|
|
3417
|
+
try {
|
|
3418
|
+
controller.abort(reason);
|
|
3419
|
+
} catch {
|
|
3420
|
+
controller.abort();
|
|
3421
|
+
}
|
|
3422
|
+
finish("timeout", Exit.failCause(Cause.fail(onReject(reason))), reason);
|
|
3423
|
+
};
|
|
3424
|
+
if (options.timerWheel) {
|
|
3425
|
+
const handle = options.timerWheel.schedule(timeoutMs, onTimeout);
|
|
3426
|
+
cleanup = () => {
|
|
3427
|
+
handle.cancel();
|
|
3428
|
+
};
|
|
3429
|
+
} else {
|
|
3430
|
+
let timeoutHandle = setTimeout(onTimeout, timeoutMs);
|
|
3431
|
+
cleanup = () => {
|
|
3432
|
+
if (timeoutHandle !== void 0) {
|
|
3433
|
+
clearTimeout(timeoutHandle);
|
|
3434
|
+
timeoutHandle = void 0;
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
}
|
|
3438
|
+
let promise;
|
|
3439
|
+
try {
|
|
3440
|
+
promise = make(controller.signal, env);
|
|
3441
|
+
} catch (err) {
|
|
3442
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3443
|
+
return () => void 0;
|
|
3444
|
+
}
|
|
3445
|
+
promise.then((value) => {
|
|
3446
|
+
if (done) {
|
|
3447
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3448
|
+
return;
|
|
3449
|
+
}
|
|
3450
|
+
finish("success", Exit.succeed(value));
|
|
3451
|
+
}).catch((err) => {
|
|
3452
|
+
if (done) {
|
|
3453
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3454
|
+
return;
|
|
3455
|
+
}
|
|
3456
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3457
|
+
});
|
|
3458
|
+
return () => {
|
|
3459
|
+
if (done) return;
|
|
3460
|
+
try {
|
|
3461
|
+
controller.abort();
|
|
3462
|
+
} catch {
|
|
3463
|
+
}
|
|
3464
|
+
finish("interrupt", Exit.failCause(Cause.interrupt()));
|
|
3465
|
+
};
|
|
3466
|
+
}
|
|
3467
|
+
function registerWithoutTimeout(make, onReject, options, env, cb) {
|
|
3468
|
+
const controller = new AbortController();
|
|
3469
|
+
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3470
|
+
const startedAt = performance.now();
|
|
3471
|
+
let done = false;
|
|
3472
|
+
const hasHooks = options.onStart !== void 0 || options.onFinish !== void 0;
|
|
3473
|
+
const finish = hasHooks ? (outcome, exit, error) => {
|
|
3474
|
+
if (done) return;
|
|
3475
|
+
done = true;
|
|
3476
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3477
|
+
options.onFinish?.({
|
|
3478
|
+
label,
|
|
3479
|
+
outcome,
|
|
3480
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
3481
|
+
error
|
|
3482
|
+
});
|
|
3483
|
+
cb(exit);
|
|
3484
|
+
} : (outcome, exit, _error) => {
|
|
3485
|
+
if (done) return;
|
|
3486
|
+
done = true;
|
|
3487
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3488
|
+
cb(exit);
|
|
3489
|
+
};
|
|
3490
|
+
recordAbortablePromiseStart(label);
|
|
3491
|
+
if (hasHooks) options.onStart?.(label);
|
|
3492
|
+
let promise;
|
|
3493
|
+
try {
|
|
3494
|
+
promise = make(controller.signal, env);
|
|
3495
|
+
} catch (err) {
|
|
3496
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3497
|
+
return () => void 0;
|
|
3498
|
+
}
|
|
3499
|
+
promise.then((value) => {
|
|
3500
|
+
if (done) {
|
|
3501
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
finish("success", Exit.succeed(value));
|
|
3505
|
+
}).catch((err) => {
|
|
3506
|
+
if (done) {
|
|
3507
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3511
|
+
});
|
|
3512
|
+
return () => {
|
|
3513
|
+
if (done) return;
|
|
3514
|
+
try {
|
|
3515
|
+
controller.abort();
|
|
3516
|
+
} catch {
|
|
3517
|
+
}
|
|
3518
|
+
finish("interrupt", Exit.failCause(Cause.interrupt()));
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3353
3521
|
function fromPromiseAbortable(make, onReject, options = {}) {
|
|
3354
3522
|
return {
|
|
3355
3523
|
_tag: "Async",
|
|
3356
3524
|
register: (env, cb) => {
|
|
3357
|
-
const controller = new AbortController();
|
|
3358
|
-
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3359
3525
|
const timeoutMs = options.timeoutMs !== void 0 && Number.isFinite(options.timeoutMs) ? Math.max(0, Math.floor(options.timeoutMs)) : void 0;
|
|
3360
|
-
const startedAt = performance.now();
|
|
3361
|
-
let done = false;
|
|
3362
|
-
let timeoutHandle;
|
|
3363
|
-
const cleanup = () => {
|
|
3364
|
-
if (timeoutHandle !== void 0) {
|
|
3365
|
-
clearTimeout(timeoutHandle);
|
|
3366
|
-
timeoutHandle = void 0;
|
|
3367
|
-
}
|
|
3368
|
-
};
|
|
3369
|
-
const finish = (outcome, exit, error) => {
|
|
3370
|
-
if (done) return;
|
|
3371
|
-
done = true;
|
|
3372
|
-
cleanup();
|
|
3373
|
-
recordAbortablePromiseFinish(label, outcome);
|
|
3374
|
-
options.onFinish?.({
|
|
3375
|
-
label,
|
|
3376
|
-
outcome,
|
|
3377
|
-
durationMs: Math.round(performance.now() - startedAt),
|
|
3378
|
-
error
|
|
3379
|
-
});
|
|
3380
|
-
cb(exit);
|
|
3381
|
-
};
|
|
3382
|
-
recordAbortablePromiseStart(label);
|
|
3383
|
-
options.onStart?.(label);
|
|
3384
3526
|
if (timeoutMs !== void 0 && timeoutMs > 0) {
|
|
3385
|
-
|
|
3386
|
-
const reason = options.timeoutReason?.() ?? makeTimeoutReason(timeoutMs, label);
|
|
3387
|
-
try {
|
|
3388
|
-
controller.abort(reason);
|
|
3389
|
-
} catch {
|
|
3390
|
-
controller.abort();
|
|
3391
|
-
}
|
|
3392
|
-
finish("timeout", Exit.failCause(Cause.fail(onReject(reason))), reason);
|
|
3393
|
-
}, timeoutMs);
|
|
3394
|
-
}
|
|
3395
|
-
let promise;
|
|
3396
|
-
try {
|
|
3397
|
-
promise = make(controller.signal, env);
|
|
3398
|
-
} catch (err) {
|
|
3399
|
-
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3400
|
-
return () => void 0;
|
|
3527
|
+
return registerWithTimeout(make, onReject, options, env, cb, timeoutMs);
|
|
3401
3528
|
}
|
|
3402
|
-
|
|
3403
|
-
if (done) {
|
|
3404
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3405
|
-
return;
|
|
3406
|
-
}
|
|
3407
|
-
finish("success", Exit.succeed(value));
|
|
3408
|
-
}).catch((err) => {
|
|
3409
|
-
if (done) {
|
|
3410
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3414
|
-
});
|
|
3415
|
-
return () => {
|
|
3416
|
-
if (done) return;
|
|
3417
|
-
try {
|
|
3418
|
-
controller.abort();
|
|
3419
|
-
} catch {
|
|
3420
|
-
}
|
|
3421
|
-
finish("interrupt", Exit.failCause(Cause.interrupt()));
|
|
3422
|
-
};
|
|
3529
|
+
return registerWithoutTimeout(make, onReject, options, env, cb);
|
|
3423
3530
|
}
|
|
3424
3531
|
};
|
|
3425
3532
|
}
|
|
@@ -4256,6 +4363,9 @@ export {
|
|
|
4256
4363
|
toPromiseByCaller,
|
|
4257
4364
|
unsafeRunAsync,
|
|
4258
4365
|
toPromise,
|
|
4366
|
+
setAbortablePromisePerLabelTracking,
|
|
4367
|
+
recordAbortablePromiseStart,
|
|
4368
|
+
recordAbortablePromiseFinish,
|
|
4259
4369
|
abortablePromiseStats,
|
|
4260
4370
|
resetAbortablePromiseStats,
|
|
4261
4371
|
fromPromiseAbortable,
|
|
@@ -4,7 +4,7 @@ var _chunkSA6HUJVIcjs = require('./chunk-SA6HUJVI.cjs');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1914,7 +1914,7 @@ var runLoop = (state, scope, runStartedAt) => {
|
|
|
1914
1914
|
})
|
|
1915
1915
|
);
|
|
1916
1916
|
};
|
|
1917
|
-
var runAgent = (runtime, goal) =>
|
|
1917
|
+
var runAgent = (runtime, goal) => _chunk2JHJ4YHScjs.withScopeAsync.call(void 0,
|
|
1918
1918
|
runtime,
|
|
1919
1919
|
(scope) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
1920
1920
|
nowMillis(),
|
|
@@ -2219,14 +2219,14 @@ var parseRipgrep = (stdout) => stdout.split("\n").filter(Boolean).map((line) =>
|
|
|
2219
2219
|
return { path, line: Number(lineNo), text: rest.join(":") };
|
|
2220
2220
|
});
|
|
2221
2221
|
var makeNodeFileSystem = (shell) => ({
|
|
2222
|
-
readFile: (path) =>
|
|
2222
|
+
readFile: (path) => _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
2223
2223
|
async (signal) => {
|
|
2224
2224
|
const { readFile } = await dynamicImport2("node:fs/promises");
|
|
2225
2225
|
return readFile(path, { encoding: "utf8", signal });
|
|
2226
2226
|
},
|
|
2227
2227
|
(cause) => ({ _tag: "FsError", operation: "readFile", cause })
|
|
2228
2228
|
),
|
|
2229
|
-
exists: (path) =>
|
|
2229
|
+
exists: (path) => _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
2230
2230
|
async (signal) => {
|
|
2231
2231
|
if (signal.aborted) return false;
|
|
2232
2232
|
const { stat } = await dynamicImport2("node:fs/promises");
|
|
@@ -2607,7 +2607,7 @@ var loadNodeAgentConfig = async (options) => {
|
|
|
2607
2607
|
// src/agent/llm/openAICompatible.ts
|
|
2608
2608
|
var extractText = (json) => _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([json, 'optionalAccess', _150 => _150.choices, 'optionalAccess', _151 => _151[0], 'optionalAccess', _152 => _152.message, 'optionalAccess', _153 => _153.content]), () => ( _optionalChain([json, 'optionalAccess', _154 => _154.output_text]))), () => ( _optionalChain([json, 'optionalAccess', _155 => _155.content, 'optionalAccess', _156 => _156[0], 'optionalAccess', _157 => _157.text]))), () => ( JSON.stringify(json)));
|
|
2609
2609
|
var makeOpenAICompatibleLLM = (config) => ({
|
|
2610
|
-
complete: (request) =>
|
|
2610
|
+
complete: (request) => _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
2611
2611
|
async (signal) => {
|
|
2612
2612
|
const res = await fetch(config.endpoint, {
|
|
2613
2613
|
method: "POST",
|
|
@@ -2699,7 +2699,7 @@ var responseErrorMessage = async (res) => {
|
|
|
2699
2699
|
}
|
|
2700
2700
|
};
|
|
2701
2701
|
var makeGoogleGenerativeAILLM = (config) => ({
|
|
2702
|
-
complete: (request) =>
|
|
2702
|
+
complete: (request) => _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
2703
2703
|
async (signal) => {
|
|
2704
2704
|
const res = await fetch(makeGenerateContentEndpoint(config), {
|
|
2705
2705
|
method: "POST",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeFiberRef,
|
|
3
3
|
makeRuntimeRecorder
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RBHNOKH4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
withHttpObservability
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7GBJYOX7.mjs";
|
|
8
8
|
import {
|
|
9
9
|
makeObservability
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-COOW7BJX.mjs";
|
|
11
11
|
import {
|
|
12
12
|
EventBus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6V2AWT4R.mjs";
|
|
14
14
|
import {
|
|
15
15
|
makeDefaultHttpClient,
|
|
16
16
|
makeHttp
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z3ZZMQUZ.mjs";
|
|
18
18
|
import {
|
|
19
19
|
Runtime,
|
|
20
20
|
Scheduler
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-H626ZTDZ.mjs";
|
|
22
22
|
import {
|
|
23
23
|
asyncFlatMap,
|
|
24
24
|
asyncSucceed,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWGE2FEZEcjs = require('./chunk-WGE2FEZE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -73,9 +73,9 @@ function fiberRefSnapshot() {
|
|
|
73
73
|
return new Map(currentFiberRefs(false));
|
|
74
74
|
}
|
|
75
75
|
function currentFiberRefs(create) {
|
|
76
|
-
const fiber =
|
|
76
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
77
77
|
if (!fiber) return void 0;
|
|
78
|
-
fiber.fiberContext ??= { log:
|
|
78
|
+
fiber.fiberContext ??= { log: _chunk2JHJ4YHScjs.emptyContext, trace: null };
|
|
79
79
|
if (!fiber.fiberContext.fiberRefs && create) fiber.fiberContext.fiberRefs = /* @__PURE__ */ new Map();
|
|
80
80
|
return fiber.fiberContext.fiberRefs;
|
|
81
81
|
}
|
|
@@ -98,7 +98,7 @@ function makeRuntimeRecorder(options = {}) {
|
|
|
98
98
|
return out;
|
|
99
99
|
};
|
|
100
100
|
const emit = (ev, ctx) => {
|
|
101
|
-
records[next] =
|
|
101
|
+
records[next] = _chunkWGE2FEZEcjs.makeRuntimeEventRecord.call(void 0, ev, ctx, seq++);
|
|
102
102
|
next = (next + 1) % capacity;
|
|
103
103
|
if (size < capacity) size++;
|
|
104
104
|
else dropped++;
|