@ls-stack/agent-eval 0.7.0 → 0.9.0
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/{app-TjV5nDMM.mjs → app-hkNNN_jn.mjs} +53 -5
- package/dist/apps/web/dist/assets/index-ChgByJbI.css +1 -0
- package/dist/apps/web/dist/assets/index-CmY0_D5Z.js +113 -0
- package/dist/apps/web/dist/index.html +2 -2
- package/dist/bin.mjs +1 -1
- package/dist/{cli-BTtgQLjB.mjs → cli-DrPk66xh.mjs} +13 -4
- package/dist/index.d.mts +466 -78
- package/dist/index.mjs +4 -4
- package/dist/runChild.mjs +3 -2
- package/dist/{runOrchestration-HaMahl6b.mjs → runOrchestration-DA4Rh5g0.mjs} +2379 -179
- package/dist/{runner-CBDZos0Z.mjs → runner-BzT3B9OF.mjs} +1 -1
- package/dist/{runner-DGVoOyJt.mjs → runner-DTP5Ui4_.mjs} +2 -2
- package/dist/src-CfprG1RW.mjs +3 -0
- package/package.json +3 -3
- package/dist/apps/web/dist/assets/index-ClE28i5w.css +0 -1
- package/dist/apps/web/dist/assets/index-gGumCEnD.js +0 -112
- package/dist/src-Bt5Fz9HS.mjs +0 -3
|
@@ -114,7 +114,8 @@ async function runInEvalScope(caseId, fn, options = {}) {
|
|
|
114
114
|
activeSpanStack: [],
|
|
115
115
|
recordingStack: [],
|
|
116
116
|
replayingDepth: 0,
|
|
117
|
-
cacheContext: options.cacheContext
|
|
117
|
+
cacheContext: options.cacheContext,
|
|
118
|
+
caseCacheRefs: []
|
|
118
119
|
};
|
|
119
120
|
activeEvalScopeCount++;
|
|
120
121
|
try {
|
|
@@ -271,16 +272,17 @@ var SerializedCacheKeyValue = class {
|
|
|
271
272
|
/**
|
|
272
273
|
* Hash the components of a cache key into a deterministic hex digest.
|
|
273
274
|
*
|
|
274
|
-
* Native `Blob` and `File` values
|
|
275
|
-
*
|
|
275
|
+
* Native `Blob` and `File` values use stable metadata by default. Pass
|
|
276
|
+
* `serializeFileBytes: true` to read them asynchronously and include their byte
|
|
277
|
+
* hash in the key.
|
|
276
278
|
*/
|
|
277
|
-
async function hashCacheKey(input) {
|
|
278
|
-
return hashCacheKeySyncMaterialized(await materializeAsyncCacheKeyValue(input));
|
|
279
|
+
async function hashCacheKey(input, options = {}) {
|
|
280
|
+
return hashCacheKeySyncMaterialized(options.serializeFileBytes === true ? await materializeAsyncCacheKeyValue(input) : input);
|
|
279
281
|
}
|
|
280
282
|
/**
|
|
281
283
|
* Synchronously hash cache key components. This supports JSON-like data and
|
|
282
284
|
* in-memory binary values such as `Buffer`, `ArrayBuffer`, and typed arrays,
|
|
283
|
-
*
|
|
285
|
+
* plus stable metadata for native `Blob` and `File` values.
|
|
284
286
|
*/
|
|
285
287
|
function hashCacheKeySync(input) {
|
|
286
288
|
return hashCacheKeySyncMaterialized(input);
|
|
@@ -360,10 +362,1795 @@ function isBlob$1(value) {
|
|
|
360
362
|
function isFile$1(value) {
|
|
361
363
|
return value instanceof File;
|
|
362
364
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region ../../node_modules/.pnpm/seroval@1.5.2/node_modules/seroval/dist/esm/production/index.mjs
|
|
367
|
+
var L$1 = ((i) => (i[i.AggregateError = 1] = "AggregateError", i[i.ArrowFunction = 2] = "ArrowFunction", i[i.ErrorPrototypeStack = 4] = "ErrorPrototypeStack", i[i.ObjectAssign = 8] = "ObjectAssign", i[i.BigIntTypedArray = 16] = "BigIntTypedArray", i[i.RegExp = 32] = "RegExp", i))(L$1 || {});
|
|
368
|
+
var v$1 = Symbol.asyncIterator, mr = Symbol.hasInstance, R = Symbol.isConcatSpreadable, C = Symbol.iterator, pr = Symbol.match, dr = Symbol.matchAll, gr = Symbol.replace, yr = Symbol.search, Nr = Symbol.species, br = Symbol.split, vr = Symbol.toPrimitive, P$1 = Symbol.toStringTag, Cr = Symbol.unscopables, ve = {
|
|
369
|
+
[v$1]: 0,
|
|
370
|
+
[mr]: 1,
|
|
371
|
+
[R]: 2,
|
|
372
|
+
[C]: 3,
|
|
373
|
+
[pr]: 4,
|
|
374
|
+
[dr]: 5,
|
|
375
|
+
[gr]: 6,
|
|
376
|
+
[yr]: 7,
|
|
377
|
+
[Nr]: 8,
|
|
378
|
+
[br]: 9,
|
|
379
|
+
[vr]: 10,
|
|
380
|
+
[P$1]: 11,
|
|
381
|
+
[Cr]: 12
|
|
382
|
+
}, tt = {
|
|
383
|
+
0: v$1,
|
|
384
|
+
1: mr,
|
|
385
|
+
2: R,
|
|
386
|
+
3: C,
|
|
387
|
+
4: pr,
|
|
388
|
+
5: dr,
|
|
389
|
+
6: gr,
|
|
390
|
+
7: yr,
|
|
391
|
+
8: Nr,
|
|
392
|
+
9: br,
|
|
393
|
+
10: vr,
|
|
394
|
+
11: P$1,
|
|
395
|
+
12: Cr
|
|
396
|
+
}, o$1 = void 0, ot = {
|
|
397
|
+
2: !0,
|
|
398
|
+
3: !1,
|
|
399
|
+
1: o$1,
|
|
400
|
+
0: null,
|
|
401
|
+
4: -0,
|
|
402
|
+
5: Number.POSITIVE_INFINITY,
|
|
403
|
+
6: Number.NEGATIVE_INFINITY,
|
|
404
|
+
7: NaN
|
|
405
|
+
};
|
|
406
|
+
var Ce = {
|
|
407
|
+
0: "Error",
|
|
408
|
+
1: "EvalError",
|
|
409
|
+
2: "RangeError",
|
|
410
|
+
3: "ReferenceError",
|
|
411
|
+
4: "SyntaxError",
|
|
412
|
+
5: "TypeError",
|
|
413
|
+
6: "URIError"
|
|
414
|
+
}, at = {
|
|
415
|
+
0: Error,
|
|
416
|
+
1: EvalError,
|
|
417
|
+
2: RangeError,
|
|
418
|
+
3: ReferenceError,
|
|
419
|
+
4: SyntaxError,
|
|
420
|
+
5: TypeError,
|
|
421
|
+
6: URIError
|
|
422
|
+
};
|
|
423
|
+
function c$1(e, r, t, n, a, s, i, u, l, g, S, d) {
|
|
424
|
+
return {
|
|
425
|
+
t: e,
|
|
426
|
+
i: r,
|
|
427
|
+
s: t,
|
|
428
|
+
c: n,
|
|
429
|
+
m: a,
|
|
430
|
+
p: s,
|
|
431
|
+
e: i,
|
|
432
|
+
a: u,
|
|
433
|
+
f: l,
|
|
434
|
+
b: g,
|
|
435
|
+
o: S,
|
|
436
|
+
l: d
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function B$1(e) {
|
|
440
|
+
return c$1(2, o$1, e, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
441
|
+
}
|
|
442
|
+
var J = B$1(2), Z = B$1(3), Ae = B$1(1), Ee = B$1(0), st = B$1(4), it = B$1(5), ut = B$1(6), lt = B$1(7);
|
|
443
|
+
function fn(e) {
|
|
444
|
+
switch (e) {
|
|
445
|
+
case "\"": return "\\\"";
|
|
446
|
+
case "\\": return "\\\\";
|
|
447
|
+
case `
|
|
448
|
+
`: return "\\n";
|
|
449
|
+
case "\r": return "\\r";
|
|
450
|
+
case "\b": return "\\b";
|
|
451
|
+
case " ": return "\\t";
|
|
452
|
+
case "\f": return "\\f";
|
|
453
|
+
case "<": return "\\x3C";
|
|
454
|
+
case "\u2028": return "\\u2028";
|
|
455
|
+
case "\u2029": return "\\u2029";
|
|
456
|
+
default: return o$1;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function y$1(e) {
|
|
460
|
+
let r = "", t = 0, n;
|
|
461
|
+
for (let a = 0, s = e.length; a < s; a++) n = fn(e[a]), n && (r += e.slice(t, a) + n, t = a + 1);
|
|
462
|
+
return t === 0 ? r = e : r += e.slice(t), r;
|
|
463
|
+
}
|
|
464
|
+
function Sn(e) {
|
|
465
|
+
switch (e) {
|
|
466
|
+
case "\\\\": return "\\";
|
|
467
|
+
case "\\\"": return "\"";
|
|
468
|
+
case "\\n": return `
|
|
469
|
+
`;
|
|
470
|
+
case "\\r": return "\r";
|
|
471
|
+
case "\\b": return "\b";
|
|
472
|
+
case "\\t": return " ";
|
|
473
|
+
case "\\f": return "\f";
|
|
474
|
+
case "\\x3C": return "<";
|
|
475
|
+
case "\\u2028": return "\u2028";
|
|
476
|
+
case "\\u2029": return "\u2029";
|
|
477
|
+
default: return e;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function D$1(e) {
|
|
481
|
+
return e.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g, Sn);
|
|
482
|
+
}
|
|
483
|
+
var U = "__SEROVAL_REFS__";
|
|
484
|
+
var Ar = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
|
|
485
|
+
function Er(e) {
|
|
486
|
+
return Ar.has(e);
|
|
487
|
+
}
|
|
488
|
+
function dn(e) {
|
|
489
|
+
return j.has(e);
|
|
490
|
+
}
|
|
491
|
+
function ct(e) {
|
|
492
|
+
if (Er(e)) return Ar.get(e);
|
|
493
|
+
throw new Re(e);
|
|
494
|
+
}
|
|
495
|
+
function ft(e) {
|
|
496
|
+
if (dn(e)) return j.get(e);
|
|
497
|
+
throw new Pe(e);
|
|
498
|
+
}
|
|
499
|
+
typeof globalThis != "undefined" ? Object.defineProperty(globalThis, U, {
|
|
500
|
+
value: j,
|
|
501
|
+
configurable: !0,
|
|
502
|
+
writable: !1,
|
|
503
|
+
enumerable: !1
|
|
504
|
+
}) : typeof window != "undefined" ? Object.defineProperty(window, U, {
|
|
505
|
+
value: j,
|
|
506
|
+
configurable: !0,
|
|
507
|
+
writable: !1,
|
|
508
|
+
enumerable: !1
|
|
509
|
+
}) : typeof self != "undefined" ? Object.defineProperty(self, U, {
|
|
510
|
+
value: j,
|
|
511
|
+
configurable: !0,
|
|
512
|
+
writable: !1,
|
|
513
|
+
enumerable: !1
|
|
514
|
+
}) : typeof global != "undefined" && Object.defineProperty(global, U, {
|
|
515
|
+
value: j,
|
|
516
|
+
configurable: !0,
|
|
517
|
+
writable: !1,
|
|
518
|
+
enumerable: !1
|
|
519
|
+
});
|
|
520
|
+
function xe(e) {
|
|
521
|
+
return e instanceof EvalError ? 1 : e instanceof RangeError ? 2 : e instanceof ReferenceError ? 3 : e instanceof SyntaxError ? 4 : e instanceof TypeError ? 5 : e instanceof URIError ? 6 : 0;
|
|
522
|
+
}
|
|
523
|
+
function gn(e) {
|
|
524
|
+
let r = Ce[xe(e)];
|
|
525
|
+
return e.name !== r ? { name: e.name } : e.constructor.name !== r ? { name: e.constructor.name } : {};
|
|
526
|
+
}
|
|
527
|
+
function $$1(e, r) {
|
|
528
|
+
let t = gn(e), n = Object.getOwnPropertyNames(e);
|
|
529
|
+
for (let a = 0, s = n.length, i; a < s; a++) i = n[a], i !== "name" && i !== "message" && (i === "stack" ? r & 4 && (t = t || {}, t[i] = e[i]) : (t = t || {}, t[i] = e[i]));
|
|
530
|
+
return t;
|
|
531
|
+
}
|
|
532
|
+
function Oe(e) {
|
|
533
|
+
return Object.isFrozen(e) ? 3 : Object.isSealed(e) ? 2 : Object.isExtensible(e) ? 0 : 1;
|
|
534
|
+
}
|
|
535
|
+
function Te(e) {
|
|
536
|
+
switch (e) {
|
|
537
|
+
case Number.POSITIVE_INFINITY: return it;
|
|
538
|
+
case Number.NEGATIVE_INFINITY: return ut;
|
|
539
|
+
}
|
|
540
|
+
return e !== e ? lt : Object.is(e, -0) ? st : c$1(0, o$1, e, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
541
|
+
}
|
|
542
|
+
function X(e) {
|
|
543
|
+
return c$1(1, o$1, y$1(e), o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
544
|
+
}
|
|
545
|
+
function we(e) {
|
|
546
|
+
return c$1(3, o$1, "" + e, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
547
|
+
}
|
|
548
|
+
function mt(e) {
|
|
549
|
+
return c$1(4, e, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
550
|
+
}
|
|
551
|
+
function he(e, r) {
|
|
552
|
+
let t = r.valueOf();
|
|
553
|
+
return c$1(5, e, t !== t ? "" : r.toISOString(), o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
554
|
+
}
|
|
555
|
+
function ze(e, r) {
|
|
556
|
+
return c$1(6, e, o$1, y$1(r.source), r.flags, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
557
|
+
}
|
|
558
|
+
function pt(e, r) {
|
|
559
|
+
return c$1(17, e, ve[r], o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
560
|
+
}
|
|
561
|
+
function dt(e, r) {
|
|
562
|
+
return c$1(18, e, y$1(ct(r)), o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
563
|
+
}
|
|
564
|
+
function fe$1(e, r, t) {
|
|
565
|
+
return c$1(25, e, t, y$1(r), o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
566
|
+
}
|
|
567
|
+
function _e(e, r, t) {
|
|
568
|
+
return c$1(9, e, o$1, o$1, o$1, o$1, o$1, t, o$1, o$1, Oe(r), o$1);
|
|
569
|
+
}
|
|
570
|
+
function ke(e, r) {
|
|
571
|
+
return c$1(21, e, o$1, o$1, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1);
|
|
572
|
+
}
|
|
573
|
+
function De(e, r, t) {
|
|
574
|
+
return c$1(15, e, o$1, r.constructor.name, o$1, o$1, o$1, o$1, t, r.byteOffset, o$1, r.length);
|
|
575
|
+
}
|
|
576
|
+
function Fe(e, r, t) {
|
|
577
|
+
return c$1(16, e, o$1, r.constructor.name, o$1, o$1, o$1, o$1, t, r.byteOffset, o$1, r.byteLength);
|
|
578
|
+
}
|
|
579
|
+
function Be(e, r, t) {
|
|
580
|
+
return c$1(20, e, o$1, o$1, o$1, o$1, o$1, o$1, t, r.byteOffset, o$1, r.byteLength);
|
|
581
|
+
}
|
|
582
|
+
function Ve(e, r, t) {
|
|
583
|
+
return c$1(13, e, xe(r), o$1, y$1(r.message), t, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
584
|
+
}
|
|
585
|
+
function Me(e, r, t) {
|
|
586
|
+
return c$1(14, e, xe(r), o$1, y$1(r.message), t, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
587
|
+
}
|
|
588
|
+
function Le(e, r) {
|
|
589
|
+
return c$1(7, e, o$1, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1, o$1);
|
|
590
|
+
}
|
|
591
|
+
function Ue(e, r) {
|
|
592
|
+
return c$1(28, o$1, o$1, o$1, o$1, o$1, o$1, [e, r], o$1, o$1, o$1, o$1);
|
|
593
|
+
}
|
|
594
|
+
function je(e, r) {
|
|
595
|
+
return c$1(30, o$1, o$1, o$1, o$1, o$1, o$1, [e, r], o$1, o$1, o$1, o$1);
|
|
596
|
+
}
|
|
597
|
+
function Ye(e, r, t) {
|
|
598
|
+
return c$1(31, e, o$1, o$1, o$1, o$1, o$1, t, r, o$1, o$1, o$1);
|
|
599
|
+
}
|
|
600
|
+
function qe(e, r) {
|
|
601
|
+
return c$1(32, e, o$1, o$1, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1);
|
|
602
|
+
}
|
|
603
|
+
function We(e, r) {
|
|
604
|
+
return c$1(33, e, o$1, o$1, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1);
|
|
605
|
+
}
|
|
606
|
+
function Ge(e, r) {
|
|
607
|
+
return c$1(34, e, o$1, o$1, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1);
|
|
608
|
+
}
|
|
609
|
+
function Ke(e, r, t, n) {
|
|
610
|
+
return c$1(35, e, t, o$1, o$1, o$1, o$1, r, o$1, o$1, o$1, n);
|
|
611
|
+
}
|
|
612
|
+
var { toString: ys } = Object.prototype;
|
|
613
|
+
var yn = {
|
|
614
|
+
parsing: 1,
|
|
615
|
+
serialization: 2,
|
|
616
|
+
deserialization: 3
|
|
617
|
+
};
|
|
618
|
+
function Nn(e) {
|
|
619
|
+
return `Seroval Error (step: ${yn[e]})`;
|
|
620
|
+
}
|
|
621
|
+
var bn = (e, r) => Nn(e), Se = class extends Error {
|
|
622
|
+
constructor(t, n) {
|
|
623
|
+
super(bn(t, n));
|
|
624
|
+
this.cause = n;
|
|
625
|
+
}
|
|
626
|
+
}, z$2 = class extends Se {
|
|
627
|
+
constructor(r) {
|
|
628
|
+
super("parsing", r);
|
|
629
|
+
}
|
|
630
|
+
}, He = class extends Se {
|
|
631
|
+
constructor(r) {
|
|
632
|
+
super("deserialization", r);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
function _(e) {
|
|
636
|
+
return `Seroval Error (specific: ${e})`;
|
|
637
|
+
}
|
|
638
|
+
var x$1 = class extends Error {
|
|
639
|
+
constructor(t) {
|
|
640
|
+
super(_(1));
|
|
641
|
+
this.value = t;
|
|
642
|
+
}
|
|
643
|
+
}, w$1 = class extends Error {
|
|
644
|
+
constructor(r) {
|
|
645
|
+
super(_(2));
|
|
646
|
+
}
|
|
647
|
+
}, Q = class extends Error {
|
|
648
|
+
constructor(r) {
|
|
649
|
+
super(_(3));
|
|
650
|
+
}
|
|
651
|
+
}, V = class extends Error {
|
|
652
|
+
constructor(r) {
|
|
653
|
+
super(_(4));
|
|
654
|
+
}
|
|
655
|
+
}, Re = class extends Error {
|
|
656
|
+
constructor(t) {
|
|
657
|
+
super(_(5));
|
|
658
|
+
this.value = t;
|
|
659
|
+
}
|
|
660
|
+
}, Pe = class extends Error {
|
|
661
|
+
constructor(r) {
|
|
662
|
+
super(_(6));
|
|
663
|
+
}
|
|
664
|
+
}, Je = class extends Error {
|
|
665
|
+
constructor(r) {
|
|
666
|
+
super(_(7));
|
|
667
|
+
}
|
|
668
|
+
}, h$1 = class extends Error {
|
|
669
|
+
constructor(r) {
|
|
670
|
+
super(_(8));
|
|
671
|
+
}
|
|
672
|
+
}, ee = class extends Error {
|
|
673
|
+
constructor(r) {
|
|
674
|
+
super(_(9));
|
|
675
|
+
}
|
|
676
|
+
}, Y$1 = class {
|
|
677
|
+
constructor(r, t) {
|
|
678
|
+
this.value = r;
|
|
679
|
+
this.replacement = t;
|
|
680
|
+
}
|
|
681
|
+
}, re = () => {
|
|
682
|
+
let e = {
|
|
683
|
+
p: 0,
|
|
684
|
+
s: 0,
|
|
685
|
+
f: 0
|
|
686
|
+
};
|
|
687
|
+
return e.p = new Promise((r, t) => {
|
|
688
|
+
e.s = r, e.f = t;
|
|
689
|
+
}), e;
|
|
690
|
+
}, vn = (e, r) => {
|
|
691
|
+
e.s(r), e.p.s = 1, e.p.v = r;
|
|
692
|
+
}, Cn = (e, r) => {
|
|
693
|
+
e.f(r), e.p.s = 2, e.p.v = r;
|
|
694
|
+
};
|
|
695
|
+
re.toString();
|
|
696
|
+
vn.toString();
|
|
697
|
+
Cn.toString();
|
|
698
|
+
var Rr = () => {
|
|
699
|
+
let e = [], r = [], t = !0, n = !1, a = 0, s = (l, g, S) => {
|
|
700
|
+
for (S = 0; S < a; S++) r[S] && r[S][g](l);
|
|
701
|
+
}, i = (l, g, S, d) => {
|
|
702
|
+
for (g = 0, S = e.length; g < S; g++) d = e[g], !t && g === S - 1 ? l[n ? "return" : "throw"](d) : l.next(d);
|
|
703
|
+
}, u = (l, g) => (t && (g = a++, r[g] = l), i(l), () => {
|
|
704
|
+
t && (r[g] = r[a], r[a--] = void 0);
|
|
705
|
+
});
|
|
706
|
+
return {
|
|
707
|
+
__SEROVAL_STREAM__: !0,
|
|
708
|
+
on: (l) => u(l),
|
|
709
|
+
next: (l) => {
|
|
710
|
+
t && (e.push(l), s(l, "next"));
|
|
711
|
+
},
|
|
712
|
+
throw: (l) => {
|
|
713
|
+
t && (e.push(l), s(l, "throw"), t = !1, n = !1, r.length = 0);
|
|
714
|
+
},
|
|
715
|
+
return: (l) => {
|
|
716
|
+
t && (e.push(l), s(l, "return"), t = !1, n = !0, r.length = 0);
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
Rr.toString();
|
|
721
|
+
var Pr = (e) => (r) => () => {
|
|
722
|
+
let t = 0, n = {
|
|
723
|
+
[e]: () => n,
|
|
724
|
+
next: () => {
|
|
725
|
+
if (t > r.d) return {
|
|
726
|
+
done: !0,
|
|
727
|
+
value: void 0
|
|
728
|
+
};
|
|
729
|
+
let a = t++, s = r.v[a];
|
|
730
|
+
if (a === r.t) throw s;
|
|
731
|
+
return {
|
|
732
|
+
done: a === r.d,
|
|
733
|
+
value: s
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
return n;
|
|
738
|
+
};
|
|
739
|
+
Pr.toString();
|
|
740
|
+
var xr = (e, r) => (t) => () => {
|
|
741
|
+
let n = 0, a = -1, s = !1, i = [], u = [], l = (S = 0, d = u.length) => {
|
|
742
|
+
for (; S < d; S++) u[S].s({
|
|
743
|
+
done: !0,
|
|
744
|
+
value: void 0
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
t.on({
|
|
748
|
+
next: (S) => {
|
|
749
|
+
let d = u.shift();
|
|
750
|
+
d && d.s({
|
|
751
|
+
done: !1,
|
|
752
|
+
value: S
|
|
753
|
+
}), i.push(S);
|
|
754
|
+
},
|
|
755
|
+
throw: (S) => {
|
|
756
|
+
let d = u.shift();
|
|
757
|
+
d && d.f(S), l(), a = i.length, s = !0, i.push(S);
|
|
758
|
+
},
|
|
759
|
+
return: (S) => {
|
|
760
|
+
let d = u.shift();
|
|
761
|
+
d && d.s({
|
|
762
|
+
done: !0,
|
|
763
|
+
value: S
|
|
764
|
+
}), l(), a = i.length, i.push(S);
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
let g = {
|
|
768
|
+
[e]: () => g,
|
|
769
|
+
next: () => {
|
|
770
|
+
if (a === -1) {
|
|
771
|
+
let K = n++;
|
|
772
|
+
if (K >= i.length) {
|
|
773
|
+
let et = r();
|
|
774
|
+
return u.push(et), et.p;
|
|
775
|
+
}
|
|
776
|
+
return {
|
|
777
|
+
done: !1,
|
|
778
|
+
value: i[K]
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
if (n > a) return {
|
|
782
|
+
done: !0,
|
|
783
|
+
value: void 0
|
|
784
|
+
};
|
|
785
|
+
let S = n++, d = i[S];
|
|
786
|
+
if (S !== a) return {
|
|
787
|
+
done: !1,
|
|
788
|
+
value: d
|
|
789
|
+
};
|
|
790
|
+
if (s) throw d;
|
|
791
|
+
return {
|
|
792
|
+
done: !0,
|
|
793
|
+
value: d
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
return g;
|
|
798
|
+
};
|
|
799
|
+
xr.toString();
|
|
800
|
+
var Or = (e) => {
|
|
801
|
+
let r = atob(e), t = r.length, n = new Uint8Array(t);
|
|
802
|
+
for (let a = 0; a < t; a++) n[a] = r.charCodeAt(a);
|
|
803
|
+
return n.buffer;
|
|
804
|
+
};
|
|
805
|
+
Or.toString();
|
|
806
|
+
function Ze(e) {
|
|
807
|
+
return "__SEROVAL_SEQUENCE__" in e;
|
|
808
|
+
}
|
|
809
|
+
function Tr(e, r, t) {
|
|
810
|
+
return {
|
|
811
|
+
__SEROVAL_SEQUENCE__: !0,
|
|
812
|
+
v: e,
|
|
813
|
+
t: r,
|
|
814
|
+
d: t
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function $e(e) {
|
|
818
|
+
let r = [], t = -1, n = -1, a = e[C]();
|
|
819
|
+
for (;;) try {
|
|
820
|
+
let s = a.next();
|
|
821
|
+
if (r.push(s.value), s.done) {
|
|
822
|
+
n = r.length - 1;
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
} catch (s) {
|
|
826
|
+
t = r.length, r.push(s);
|
|
827
|
+
}
|
|
828
|
+
return Tr(r, t, n);
|
|
829
|
+
}
|
|
830
|
+
var An = Pr(C);
|
|
831
|
+
function It(e) {
|
|
832
|
+
return An(e);
|
|
833
|
+
}
|
|
834
|
+
var Rt = {}, Pt = {}, xt = {
|
|
835
|
+
0: {},
|
|
836
|
+
1: {},
|
|
837
|
+
2: {},
|
|
838
|
+
3: {},
|
|
839
|
+
4: {},
|
|
840
|
+
5: {}
|
|
841
|
+
};
|
|
842
|
+
function M(e) {
|
|
843
|
+
return "__SEROVAL_STREAM__" in e;
|
|
844
|
+
}
|
|
845
|
+
function te$1() {
|
|
846
|
+
return Rr();
|
|
847
|
+
}
|
|
848
|
+
function Xe(e) {
|
|
849
|
+
let r = te$1(), t = e[v$1]();
|
|
850
|
+
async function n() {
|
|
851
|
+
try {
|
|
852
|
+
let a = await t.next();
|
|
853
|
+
a.done ? r.return(a.value) : (r.next(a.value), await n());
|
|
854
|
+
} catch (a) {
|
|
855
|
+
r.throw(a);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return n().catch(() => {}), r;
|
|
859
|
+
}
|
|
860
|
+
var En = xr(v$1, re);
|
|
861
|
+
function Tt(e) {
|
|
862
|
+
return En(e);
|
|
863
|
+
}
|
|
864
|
+
async function wr(e) {
|
|
865
|
+
try {
|
|
866
|
+
return [1, await e];
|
|
867
|
+
} catch (r) {
|
|
868
|
+
return [0, r];
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function pe$1(e, r) {
|
|
872
|
+
return {
|
|
873
|
+
plugins: r.plugins,
|
|
874
|
+
mode: e,
|
|
875
|
+
marked: /* @__PURE__ */ new Set(),
|
|
876
|
+
features: 63 ^ (r.disabledFeatures || 0),
|
|
877
|
+
refs: r.refs || /* @__PURE__ */ new Map(),
|
|
878
|
+
depthLimit: r.depthLimit || 1e3
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function de(e, r) {
|
|
882
|
+
e.marked.add(r);
|
|
883
|
+
}
|
|
884
|
+
function hr(e, r) {
|
|
885
|
+
let t = e.refs.size;
|
|
886
|
+
return e.refs.set(r, t), t;
|
|
887
|
+
}
|
|
888
|
+
function Qe(e, r) {
|
|
889
|
+
let t = e.refs.get(r);
|
|
890
|
+
return t != null ? (de(e, t), {
|
|
891
|
+
type: 1,
|
|
892
|
+
value: mt(t)
|
|
893
|
+
}) : {
|
|
894
|
+
type: 0,
|
|
895
|
+
value: hr(e, r)
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function q$1(e, r) {
|
|
899
|
+
let t = Qe(e, r);
|
|
900
|
+
return t.type === 1 ? t : Er(r) ? {
|
|
901
|
+
type: 2,
|
|
902
|
+
value: dt(t.value, r)
|
|
903
|
+
} : t;
|
|
904
|
+
}
|
|
905
|
+
function I(e, r) {
|
|
906
|
+
let t = q$1(e, r);
|
|
907
|
+
if (t.type !== 0) return t.value;
|
|
908
|
+
if (r in ve) return pt(t.value, r);
|
|
909
|
+
throw new x$1(r);
|
|
910
|
+
}
|
|
911
|
+
function k(e, r) {
|
|
912
|
+
let t = Qe(e, xt[r]);
|
|
913
|
+
return t.type === 1 ? t.value : c$1(26, t.value, r, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1, o$1);
|
|
914
|
+
}
|
|
915
|
+
function er(e) {
|
|
916
|
+
let r = Qe(e, Rt);
|
|
917
|
+
return r.type === 1 ? r.value : c$1(27, r.value, o$1, o$1, o$1, o$1, o$1, o$1, I(e, C), o$1, o$1, o$1);
|
|
918
|
+
}
|
|
919
|
+
function rr(e) {
|
|
920
|
+
let r = Qe(e, Pt);
|
|
921
|
+
return r.type === 1 ? r.value : c$1(29, r.value, o$1, o$1, o$1, o$1, o$1, [k(e, 1), I(e, v$1)], o$1, o$1, o$1, o$1);
|
|
922
|
+
}
|
|
923
|
+
function tr(e, r, t, n) {
|
|
924
|
+
return c$1(t ? 11 : 10, e, o$1, o$1, o$1, n, o$1, o$1, o$1, o$1, Oe(r), o$1);
|
|
925
|
+
}
|
|
926
|
+
function nr(e, r, t, n) {
|
|
927
|
+
return c$1(8, r, o$1, o$1, o$1, o$1, {
|
|
928
|
+
k: t,
|
|
929
|
+
v: n
|
|
930
|
+
}, o$1, k(e, 0), o$1, o$1, o$1);
|
|
931
|
+
}
|
|
932
|
+
function or(e, r, t) {
|
|
933
|
+
let n = new Uint8Array(t), a = "";
|
|
934
|
+
for (let s = 0, i = n.length; s < i; s++) a += String.fromCharCode(n[s]);
|
|
935
|
+
return c$1(19, r, y$1(btoa(a)), o$1, o$1, o$1, o$1, o$1, k(e, 5), o$1, o$1, o$1);
|
|
936
|
+
}
|
|
937
|
+
function ne$1(e, r) {
|
|
938
|
+
return {
|
|
939
|
+
base: pe$1(e, r),
|
|
940
|
+
child: void 0
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
var _r = class {
|
|
944
|
+
constructor(r, t) {
|
|
945
|
+
this._p = r;
|
|
946
|
+
this.depth = t;
|
|
947
|
+
}
|
|
948
|
+
parse(r) {
|
|
949
|
+
return N$1(this._p, this.depth, r);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
async function Rn(e, r, t) {
|
|
953
|
+
let n = [];
|
|
954
|
+
for (let a = 0, s = t.length; a < s; a++) a in t ? n[a] = await N$1(e, r, t[a]) : n[a] = 0;
|
|
955
|
+
return n;
|
|
956
|
+
}
|
|
957
|
+
async function Pn(e, r, t, n) {
|
|
958
|
+
return _e(t, n, await Rn(e, r, n));
|
|
959
|
+
}
|
|
960
|
+
async function kr(e, r, t) {
|
|
961
|
+
let n = Object.entries(t), a = [], s = [];
|
|
962
|
+
for (let i = 0, u = n.length; i < u; i++) a.push(y$1(n[i][0])), s.push(await N$1(e, r, n[i][1]));
|
|
963
|
+
return C in t && (a.push(I(e.base, C)), s.push(Ue(er(e.base), await N$1(e, r, $e(t))))), v$1 in t && (a.push(I(e.base, v$1)), s.push(je(rr(e.base), await N$1(e, r, Xe(t))))), P$1 in t && (a.push(I(e.base, P$1)), s.push(X(t[P$1]))), R in t && (a.push(I(e.base, R)), s.push(t[R] ? J : Z)), {
|
|
964
|
+
k: a,
|
|
965
|
+
v: s
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
async function zr(e, r, t, n, a) {
|
|
969
|
+
return tr(t, n, a, await kr(e, r, n));
|
|
970
|
+
}
|
|
971
|
+
async function xn(e, r, t, n) {
|
|
972
|
+
return ke(t, await N$1(e, r, n.valueOf()));
|
|
973
|
+
}
|
|
974
|
+
async function On(e, r, t, n) {
|
|
975
|
+
return De(t, n, await N$1(e, r, n.buffer));
|
|
976
|
+
}
|
|
977
|
+
async function Tn(e, r, t, n) {
|
|
978
|
+
return Fe(t, n, await N$1(e, r, n.buffer));
|
|
979
|
+
}
|
|
980
|
+
async function wn(e, r, t, n) {
|
|
981
|
+
return Be(t, n, await N$1(e, r, n.buffer));
|
|
982
|
+
}
|
|
983
|
+
async function zt(e, r, t, n) {
|
|
984
|
+
let a = $$1(n, e.base.features);
|
|
985
|
+
return Ve(t, n, a ? await kr(e, r, a) : o$1);
|
|
986
|
+
}
|
|
987
|
+
async function hn(e, r, t, n) {
|
|
988
|
+
let a = $$1(n, e.base.features);
|
|
989
|
+
return Me(t, n, a ? await kr(e, r, a) : o$1);
|
|
990
|
+
}
|
|
991
|
+
async function zn(e, r, t, n) {
|
|
992
|
+
let a = [], s = [];
|
|
993
|
+
for (let [i, u] of n.entries()) a.push(await N$1(e, r, i)), s.push(await N$1(e, r, u));
|
|
994
|
+
return nr(e.base, t, a, s);
|
|
995
|
+
}
|
|
996
|
+
async function _n(e, r, t, n) {
|
|
997
|
+
let a = [];
|
|
998
|
+
for (let s of n.keys()) a.push(await N$1(e, r, s));
|
|
999
|
+
return Le(t, a);
|
|
1000
|
+
}
|
|
1001
|
+
async function _t(e, r, t, n) {
|
|
1002
|
+
let a = e.base.plugins;
|
|
1003
|
+
if (a) for (let s = 0, i = a.length; s < i; s++) {
|
|
1004
|
+
let u = a[s];
|
|
1005
|
+
if (u.parse.async && u.test(n)) return fe$1(t, u.tag, await u.parse.async(n, new _r(e, r), { id: t }));
|
|
1006
|
+
}
|
|
1007
|
+
return o$1;
|
|
1008
|
+
}
|
|
1009
|
+
async function kn(e, r, t, n) {
|
|
1010
|
+
let [a, s] = await wr(n);
|
|
1011
|
+
return c$1(12, t, a, o$1, o$1, o$1, o$1, o$1, await N$1(e, r, s), o$1, o$1, o$1);
|
|
1012
|
+
}
|
|
1013
|
+
function Dn(e, r, t, n, a) {
|
|
1014
|
+
let s = [], i = t.on({
|
|
1015
|
+
next: (u) => {
|
|
1016
|
+
de(this.base, r), N$1(this, e, u).then((l) => {
|
|
1017
|
+
s.push(qe(r, l));
|
|
1018
|
+
}, (l) => {
|
|
1019
|
+
a(l), i();
|
|
1020
|
+
});
|
|
1021
|
+
},
|
|
1022
|
+
throw: (u) => {
|
|
1023
|
+
de(this.base, r), N$1(this, e, u).then((l) => {
|
|
1024
|
+
s.push(We(r, l)), n(s), i();
|
|
1025
|
+
}, (l) => {
|
|
1026
|
+
a(l), i();
|
|
1027
|
+
});
|
|
1028
|
+
},
|
|
1029
|
+
return: (u) => {
|
|
1030
|
+
de(this.base, r), N$1(this, e, u).then((l) => {
|
|
1031
|
+
s.push(Ge(r, l)), n(s), i();
|
|
1032
|
+
}, (l) => {
|
|
1033
|
+
a(l), i();
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
async function Fn(e, r, t, n) {
|
|
1039
|
+
return Ye(t, k(e.base, 4), await new Promise(Dn.bind(e, r, t, n)));
|
|
1040
|
+
}
|
|
1041
|
+
async function Bn(e, r, t, n) {
|
|
1042
|
+
let a = [];
|
|
1043
|
+
for (let s = 0, i = n.v.length; s < i; s++) a[s] = await N$1(e, r, n.v[s]);
|
|
1044
|
+
return Ke(t, a, n.t, n.d);
|
|
1045
|
+
}
|
|
1046
|
+
async function Vn(e, r, t, n) {
|
|
1047
|
+
if (Array.isArray(n)) return Pn(e, r, t, n);
|
|
1048
|
+
if (M(n)) return Fn(e, r, t, n);
|
|
1049
|
+
if (Ze(n)) return Bn(e, r, t, n);
|
|
1050
|
+
let a = n.constructor;
|
|
1051
|
+
if (a === Y$1) return N$1(e, r, n.replacement);
|
|
1052
|
+
let s = await _t(e, r, t, n);
|
|
1053
|
+
if (s) return s;
|
|
1054
|
+
switch (a) {
|
|
1055
|
+
case Object: return zr(e, r, t, n, !1);
|
|
1056
|
+
case o$1: return zr(e, r, t, n, !0);
|
|
1057
|
+
case Date: return he(t, n);
|
|
1058
|
+
case Error:
|
|
1059
|
+
case EvalError:
|
|
1060
|
+
case RangeError:
|
|
1061
|
+
case ReferenceError:
|
|
1062
|
+
case SyntaxError:
|
|
1063
|
+
case TypeError:
|
|
1064
|
+
case URIError: return zt(e, r, t, n);
|
|
1065
|
+
case Number:
|
|
1066
|
+
case Boolean:
|
|
1067
|
+
case String:
|
|
1068
|
+
case BigInt: return xn(e, r, t, n);
|
|
1069
|
+
case ArrayBuffer: return or(e.base, t, n);
|
|
1070
|
+
case Int8Array:
|
|
1071
|
+
case Int16Array:
|
|
1072
|
+
case Int32Array:
|
|
1073
|
+
case Uint8Array:
|
|
1074
|
+
case Uint16Array:
|
|
1075
|
+
case Uint32Array:
|
|
1076
|
+
case Uint8ClampedArray:
|
|
1077
|
+
case Float32Array:
|
|
1078
|
+
case Float64Array: return On(e, r, t, n);
|
|
1079
|
+
case DataView: return wn(e, r, t, n);
|
|
1080
|
+
case Map: return zn(e, r, t, n);
|
|
1081
|
+
case Set: return _n(e, r, t, n);
|
|
1082
|
+
default: break;
|
|
1083
|
+
}
|
|
1084
|
+
if (a === Promise || n instanceof Promise) return kn(e, r, t, n);
|
|
1085
|
+
let i = e.base.features;
|
|
1086
|
+
if (i & 32 && a === RegExp) return ze(t, n);
|
|
1087
|
+
if (i & 16) switch (a) {
|
|
1088
|
+
case BigInt64Array:
|
|
1089
|
+
case BigUint64Array: return Tn(e, r, t, n);
|
|
1090
|
+
default: break;
|
|
1091
|
+
}
|
|
1092
|
+
if (i & 1 && typeof AggregateError != "undefined" && (a === AggregateError || n instanceof AggregateError)) return hn(e, r, t, n);
|
|
1093
|
+
if (n instanceof Error) return zt(e, r, t, n);
|
|
1094
|
+
if (C in n || v$1 in n) return zr(e, r, t, n, !!a);
|
|
1095
|
+
throw new x$1(n);
|
|
1096
|
+
}
|
|
1097
|
+
async function Mn(e, r, t) {
|
|
1098
|
+
let n = q$1(e.base, t);
|
|
1099
|
+
if (n.type !== 0) return n.value;
|
|
1100
|
+
let a = await _t(e, r, n.value, t);
|
|
1101
|
+
if (a) return a;
|
|
1102
|
+
throw new x$1(t);
|
|
1103
|
+
}
|
|
1104
|
+
async function N$1(e, r, t) {
|
|
1105
|
+
switch (typeof t) {
|
|
1106
|
+
case "boolean": return t ? J : Z;
|
|
1107
|
+
case "undefined": return Ae;
|
|
1108
|
+
case "string": return X(t);
|
|
1109
|
+
case "number": return Te(t);
|
|
1110
|
+
case "bigint": return we(t);
|
|
1111
|
+
case "object":
|
|
1112
|
+
if (t) {
|
|
1113
|
+
let n = q$1(e.base, t);
|
|
1114
|
+
return n.type === 0 ? await Vn(e, r + 1, n.value, t) : n.value;
|
|
1115
|
+
}
|
|
1116
|
+
return Ee;
|
|
1117
|
+
case "symbol": return I(e.base, t);
|
|
1118
|
+
case "function": return Mn(e, r, t);
|
|
1119
|
+
default: throw new x$1(t);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
async function oe(e, r) {
|
|
1123
|
+
try {
|
|
1124
|
+
return await N$1(e, 0, r);
|
|
1125
|
+
} catch (t) {
|
|
1126
|
+
throw t instanceof z$2 ? t : new z$2(t);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
var ae = ((t) => (t[t.Vanilla = 1] = "Vanilla", t[t.Cross = 2] = "Cross", t))(ae || {});
|
|
1130
|
+
function ni(e) {
|
|
1131
|
+
return e;
|
|
1132
|
+
}
|
|
1133
|
+
function kt(e, r) {
|
|
1134
|
+
for (let t = 0, n = r.length; t < n; t++) {
|
|
1135
|
+
let a = r[t];
|
|
1136
|
+
e.has(a) || (e.add(a), a.extends && kt(e, a.extends));
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
function A(e) {
|
|
1140
|
+
if (e) {
|
|
1141
|
+
let r = /* @__PURE__ */ new Set();
|
|
1142
|
+
return kt(r, e), [...r];
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
function Dt(e) {
|
|
1146
|
+
switch (e) {
|
|
1147
|
+
case "Int8Array": return Int8Array;
|
|
1148
|
+
case "Int16Array": return Int16Array;
|
|
1149
|
+
case "Int32Array": return Int32Array;
|
|
1150
|
+
case "Uint8Array": return Uint8Array;
|
|
1151
|
+
case "Uint16Array": return Uint16Array;
|
|
1152
|
+
case "Uint32Array": return Uint32Array;
|
|
1153
|
+
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
1154
|
+
case "Float32Array": return Float32Array;
|
|
1155
|
+
case "Float64Array": return Float64Array;
|
|
1156
|
+
case "BigInt64Array": return BigInt64Array;
|
|
1157
|
+
case "BigUint64Array": return BigUint64Array;
|
|
1158
|
+
default: throw new Je(e);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
var Ln = 1e6, Un = 1e4, jn = 2e4;
|
|
1162
|
+
function Bt(e, r) {
|
|
1163
|
+
switch (r) {
|
|
1164
|
+
case 3: return Object.freeze(e);
|
|
1165
|
+
case 1: return Object.preventExtensions(e);
|
|
1166
|
+
case 2: return Object.seal(e);
|
|
1167
|
+
default: return e;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
var Yn = 1e3;
|
|
1171
|
+
function Vt(e, r) {
|
|
1172
|
+
var t;
|
|
1173
|
+
return {
|
|
1174
|
+
mode: e,
|
|
1175
|
+
plugins: r.plugins,
|
|
1176
|
+
refs: r.refs || /* @__PURE__ */ new Map(),
|
|
1177
|
+
features: (t = r.features) != null ? t : 63 ^ (r.disabledFeatures || 0),
|
|
1178
|
+
depthLimit: r.depthLimit || Yn
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
function Mt(e) {
|
|
1182
|
+
return {
|
|
1183
|
+
mode: 1,
|
|
1184
|
+
base: Vt(1, e),
|
|
1185
|
+
child: o$1,
|
|
1186
|
+
state: { marked: new Set(e.markedRefs) }
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
var Dr = class {
|
|
1190
|
+
constructor(r, t) {
|
|
1191
|
+
this._p = r;
|
|
1192
|
+
this.depth = t;
|
|
1193
|
+
}
|
|
1194
|
+
deserialize(r) {
|
|
1195
|
+
return p$1(this._p, this.depth, r);
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
function Ut(e, r) {
|
|
1199
|
+
if (r < 0 || !Number.isFinite(r) || !Number.isInteger(r)) throw new h$1({
|
|
1200
|
+
t: 4,
|
|
1201
|
+
i: r
|
|
1202
|
+
});
|
|
1203
|
+
if (e.refs.has(r)) throw new Error("Conflicted ref id: " + r);
|
|
1204
|
+
}
|
|
1205
|
+
function qn(e, r, t) {
|
|
1206
|
+
return Ut(e.base, r), e.state.marked.has(r) && e.base.refs.set(r, t), t;
|
|
1207
|
+
}
|
|
1208
|
+
function Wn(e, r, t) {
|
|
1209
|
+
return Ut(e.base, r), e.base.refs.set(r, t), t;
|
|
1210
|
+
}
|
|
1211
|
+
function b(e, r, t) {
|
|
1212
|
+
return e.mode === 1 ? qn(e, r, t) : Wn(e, r, t);
|
|
1213
|
+
}
|
|
1214
|
+
function Fr(e, r, t) {
|
|
1215
|
+
if (Object.hasOwn(r, t)) return r[t];
|
|
1216
|
+
throw new h$1(e);
|
|
1217
|
+
}
|
|
1218
|
+
function Gn(e, r) {
|
|
1219
|
+
return b(e, r.i, ft(D$1(r.s)));
|
|
1220
|
+
}
|
|
1221
|
+
function Kn(e, r, t) {
|
|
1222
|
+
let n = t.a, a = n.length, s = b(e, t.i, new Array(a));
|
|
1223
|
+
for (let i = 0, u; i < a; i++) u = n[i], u && (s[i] = p$1(e, r, u));
|
|
1224
|
+
return Bt(s, t.o), s;
|
|
1225
|
+
}
|
|
1226
|
+
function Hn(e) {
|
|
1227
|
+
switch (e) {
|
|
1228
|
+
case "constructor":
|
|
1229
|
+
case "__proto__":
|
|
1230
|
+
case "prototype":
|
|
1231
|
+
case "__defineGetter__":
|
|
1232
|
+
case "__defineSetter__":
|
|
1233
|
+
case "__lookupGetter__":
|
|
1234
|
+
case "__lookupSetter__": return !1;
|
|
1235
|
+
default: return !0;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function Jn(e) {
|
|
1239
|
+
switch (e) {
|
|
1240
|
+
case v$1:
|
|
1241
|
+
case R:
|
|
1242
|
+
case P$1:
|
|
1243
|
+
case C: return !0;
|
|
1244
|
+
default: return !1;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
function Ft(e, r, t) {
|
|
1248
|
+
Hn(r) ? e[r] = t : Object.defineProperty(e, r, {
|
|
1249
|
+
value: t,
|
|
1250
|
+
configurable: !0,
|
|
1251
|
+
enumerable: !0,
|
|
1252
|
+
writable: !0
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
function Zn(e, r, t, n, a) {
|
|
1256
|
+
if (typeof n == "string") Ft(t, D$1(n), p$1(e, r, a));
|
|
1257
|
+
else {
|
|
1258
|
+
let s = p$1(e, r, n);
|
|
1259
|
+
switch (typeof s) {
|
|
1260
|
+
case "string":
|
|
1261
|
+
Ft(t, s, p$1(e, r, a));
|
|
1262
|
+
break;
|
|
1263
|
+
case "symbol":
|
|
1264
|
+
Jn(s) && (t[s] = p$1(e, r, a));
|
|
1265
|
+
break;
|
|
1266
|
+
default: throw new h$1(n);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
function jt(e, r, t, n) {
|
|
1271
|
+
let a = t.k;
|
|
1272
|
+
if (a.length > 0) for (let i = 0, u = t.v, l = a.length; i < l; i++) Zn(e, r, n, a[i], u[i]);
|
|
1273
|
+
return n;
|
|
1274
|
+
}
|
|
1275
|
+
function $n(e, r, t) {
|
|
1276
|
+
let n = b(e, t.i, t.t === 10 ? {} : Object.create(null));
|
|
1277
|
+
return jt(e, r, t.p, n), Bt(n, t.o), n;
|
|
1278
|
+
}
|
|
1279
|
+
function Xn(e, r) {
|
|
1280
|
+
return b(e, r.i, new Date(r.s));
|
|
1281
|
+
}
|
|
1282
|
+
function Qn(e, r) {
|
|
1283
|
+
if (e.base.features & 32) {
|
|
1284
|
+
let t = D$1(r.c);
|
|
1285
|
+
if (t.length > jn) throw new h$1(r);
|
|
1286
|
+
return b(e, r.i, new RegExp(t, r.m));
|
|
1287
|
+
}
|
|
1288
|
+
throw new w$1(r);
|
|
1289
|
+
}
|
|
1290
|
+
function eo(e, r, t) {
|
|
1291
|
+
let n = b(e, t.i, /* @__PURE__ */ new Set());
|
|
1292
|
+
for (let a = 0, s = t.a, i = s.length; a < i; a++) n.add(p$1(e, r, s[a]));
|
|
1293
|
+
return n;
|
|
1294
|
+
}
|
|
1295
|
+
function ro(e, r, t) {
|
|
1296
|
+
let n = b(e, t.i, /* @__PURE__ */ new Map());
|
|
1297
|
+
for (let a = 0, s = t.e.k, i = t.e.v, u = s.length; a < u; a++) n.set(p$1(e, r, s[a]), p$1(e, r, i[a]));
|
|
1298
|
+
return n;
|
|
1299
|
+
}
|
|
1300
|
+
function to(e, r) {
|
|
1301
|
+
if (r.s.length > Ln) throw new h$1(r);
|
|
1302
|
+
return b(e, r.i, Or(D$1(r.s)));
|
|
1303
|
+
}
|
|
1304
|
+
function no(e, r, t) {
|
|
1305
|
+
var u;
|
|
1306
|
+
let n = Dt(t.c), a = p$1(e, r, t.f), s = (u = t.b) != null ? u : 0;
|
|
1307
|
+
if (s < 0 || s > a.byteLength) throw new h$1(t);
|
|
1308
|
+
return b(e, t.i, new n(a, s, t.l));
|
|
1309
|
+
}
|
|
1310
|
+
function oo(e, r, t) {
|
|
1311
|
+
var i;
|
|
1312
|
+
let n = p$1(e, r, t.f), a = (i = t.b) != null ? i : 0;
|
|
1313
|
+
if (a < 0 || a > n.byteLength) throw new h$1(t);
|
|
1314
|
+
return b(e, t.i, new DataView(n, a, t.l));
|
|
1315
|
+
}
|
|
1316
|
+
function Yt(e, r, t, n) {
|
|
1317
|
+
if (t.p) {
|
|
1318
|
+
let a = jt(e, r, t.p, {});
|
|
1319
|
+
Object.defineProperties(n, Object.getOwnPropertyDescriptors(a));
|
|
1320
|
+
}
|
|
1321
|
+
return n;
|
|
1322
|
+
}
|
|
1323
|
+
function ao(e, r, t) {
|
|
1324
|
+
return Yt(e, r, t, b(e, t.i, new AggregateError([], D$1(t.m))));
|
|
1325
|
+
}
|
|
1326
|
+
function so(e, r, t) {
|
|
1327
|
+
let n = Fr(t, at, t.s);
|
|
1328
|
+
return Yt(e, r, t, b(e, t.i, new n(D$1(t.m))));
|
|
1329
|
+
}
|
|
1330
|
+
function io(e, r, t) {
|
|
1331
|
+
let n = re(), a = b(e, t.i, n.p), s = p$1(e, r, t.f);
|
|
1332
|
+
return t.s ? n.s(s) : n.f(s), a;
|
|
1333
|
+
}
|
|
1334
|
+
function uo(e, r, t) {
|
|
1335
|
+
return b(e, t.i, Object(p$1(e, r, t.f)));
|
|
1336
|
+
}
|
|
1337
|
+
function lo(e, r, t) {
|
|
1338
|
+
let n = e.base.plugins;
|
|
1339
|
+
if (n) {
|
|
1340
|
+
let a = D$1(t.c);
|
|
1341
|
+
for (let s = 0, i = n.length; s < i; s++) {
|
|
1342
|
+
let u = n[s];
|
|
1343
|
+
if (u.tag === a) return b(e, t.i, u.deserialize(t.s, new Dr(e, r), { id: t.i }));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
throw new Q(t.c);
|
|
1347
|
+
}
|
|
1348
|
+
function co(e, r) {
|
|
1349
|
+
return b(e, r.i, b(e, r.s, re()).p);
|
|
1350
|
+
}
|
|
1351
|
+
function fo(e, r, t) {
|
|
1352
|
+
let n = e.base.refs.get(t.i);
|
|
1353
|
+
if (n) return n.s(p$1(e, r, t.a[1])), o$1;
|
|
1354
|
+
throw new V("Promise");
|
|
1355
|
+
}
|
|
1356
|
+
function So(e, r, t) {
|
|
1357
|
+
let n = e.base.refs.get(t.i);
|
|
1358
|
+
if (n) return n.f(p$1(e, r, t.a[1])), o$1;
|
|
1359
|
+
throw new V("Promise");
|
|
1360
|
+
}
|
|
1361
|
+
function mo(e, r, t) {
|
|
1362
|
+
p$1(e, r, t.a[0]);
|
|
1363
|
+
return It(p$1(e, r, t.a[1]));
|
|
1364
|
+
}
|
|
1365
|
+
function po(e, r, t) {
|
|
1366
|
+
p$1(e, r, t.a[0]);
|
|
1367
|
+
return Tt(p$1(e, r, t.a[1]));
|
|
1368
|
+
}
|
|
1369
|
+
function go(e, r, t) {
|
|
1370
|
+
let n = b(e, t.i, te$1()), a = t.a, s = a.length;
|
|
1371
|
+
if (s) for (let i = 0; i < s; i++) p$1(e, r, a[i]);
|
|
1372
|
+
return n;
|
|
1373
|
+
}
|
|
1374
|
+
function yo(e, r, t) {
|
|
1375
|
+
let n = e.base.refs.get(t.i);
|
|
1376
|
+
if (n && M(n)) return n.next(p$1(e, r, t.f)), o$1;
|
|
1377
|
+
throw new V("Stream");
|
|
1378
|
+
}
|
|
1379
|
+
function No(e, r, t) {
|
|
1380
|
+
let n = e.base.refs.get(t.i);
|
|
1381
|
+
if (n && M(n)) return n.throw(p$1(e, r, t.f)), o$1;
|
|
1382
|
+
throw new V("Stream");
|
|
1383
|
+
}
|
|
1384
|
+
function bo(e, r, t) {
|
|
1385
|
+
let n = e.base.refs.get(t.i);
|
|
1386
|
+
if (n && M(n)) return n.return(p$1(e, r, t.f)), o$1;
|
|
1387
|
+
throw new V("Stream");
|
|
1388
|
+
}
|
|
1389
|
+
function vo(e, r, t) {
|
|
1390
|
+
return p$1(e, r, t.f), o$1;
|
|
1391
|
+
}
|
|
1392
|
+
function Co(e, r, t) {
|
|
1393
|
+
return p$1(e, r, t.a[1]), o$1;
|
|
1394
|
+
}
|
|
1395
|
+
function Ao(e, r, t) {
|
|
1396
|
+
let n = b(e, t.i, Tr([], t.s, t.l));
|
|
1397
|
+
for (let a = 0, s = t.a.length; a < s; a++) n.v[a] = p$1(e, r, t.a[a]);
|
|
1398
|
+
return n;
|
|
1399
|
+
}
|
|
1400
|
+
function p$1(e, r, t) {
|
|
1401
|
+
if (r > e.base.depthLimit) throw new ee(e.base.depthLimit);
|
|
1402
|
+
switch (r += 1, t.t) {
|
|
1403
|
+
case 2: return Fr(t, ot, t.s);
|
|
1404
|
+
case 0: return Number(t.s);
|
|
1405
|
+
case 1: return D$1(String(t.s));
|
|
1406
|
+
case 3:
|
|
1407
|
+
if (String(t.s).length > Un) throw new h$1(t);
|
|
1408
|
+
return BigInt(t.s);
|
|
1409
|
+
case 4: return e.base.refs.get(t.i);
|
|
1410
|
+
case 18: return Gn(e, t);
|
|
1411
|
+
case 9: return Kn(e, r, t);
|
|
1412
|
+
case 10:
|
|
1413
|
+
case 11: return $n(e, r, t);
|
|
1414
|
+
case 5: return Xn(e, t);
|
|
1415
|
+
case 6: return Qn(e, t);
|
|
1416
|
+
case 7: return eo(e, r, t);
|
|
1417
|
+
case 8: return ro(e, r, t);
|
|
1418
|
+
case 19: return to(e, t);
|
|
1419
|
+
case 16:
|
|
1420
|
+
case 15: return no(e, r, t);
|
|
1421
|
+
case 20: return oo(e, r, t);
|
|
1422
|
+
case 14: return ao(e, r, t);
|
|
1423
|
+
case 13: return so(e, r, t);
|
|
1424
|
+
case 12: return io(e, r, t);
|
|
1425
|
+
case 17: return Fr(t, tt, t.s);
|
|
1426
|
+
case 21: return uo(e, r, t);
|
|
1427
|
+
case 25: return lo(e, r, t);
|
|
1428
|
+
case 22: return co(e, t);
|
|
1429
|
+
case 23: return fo(e, r, t);
|
|
1430
|
+
case 24: return So(e, r, t);
|
|
1431
|
+
case 28: return mo(e, r, t);
|
|
1432
|
+
case 30: return po(e, r, t);
|
|
1433
|
+
case 31: return go(e, r, t);
|
|
1434
|
+
case 32: return yo(e, r, t);
|
|
1435
|
+
case 33: return No(e, r, t);
|
|
1436
|
+
case 34: return bo(e, r, t);
|
|
1437
|
+
case 27: return vo(e, r, t);
|
|
1438
|
+
case 29: return Co(e, r, t);
|
|
1439
|
+
case 35: return Ao(e, r, t);
|
|
1440
|
+
default: throw new w$1(t);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
function ar(e, r) {
|
|
1444
|
+
try {
|
|
1445
|
+
return p$1(e, 0, r);
|
|
1446
|
+
} catch (t) {
|
|
1447
|
+
throw new He(t);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
var Eo = () => T, Io = Eo.toString();
|
|
1451
|
+
/=>/.test(Io);
|
|
1452
|
+
async function Au(e, r = {}) {
|
|
1453
|
+
let n = ne$1(1, {
|
|
1454
|
+
plugins: A(r.plugins),
|
|
1455
|
+
disabledFeatures: r.disabledFeatures
|
|
1456
|
+
});
|
|
1457
|
+
return {
|
|
1458
|
+
t: await oe(n, e),
|
|
1459
|
+
f: n.base.features,
|
|
1460
|
+
m: Array.from(n.base.marked)
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
function Iu(e, r = {}) {
|
|
1464
|
+
var i;
|
|
1465
|
+
let t = A(r.plugins), n = r.disabledFeatures || 0, a = (i = e.f) != null ? i : 63;
|
|
1466
|
+
return ar(Mt({
|
|
1467
|
+
plugins: t,
|
|
1468
|
+
markedRefs: e.m,
|
|
1469
|
+
features: a & ~n,
|
|
1470
|
+
disabledFeatures: n
|
|
1471
|
+
}), e.t);
|
|
1472
|
+
}
|
|
1473
|
+
//#endregion
|
|
1474
|
+
//#region ../../node_modules/.pnpm/seroval-plugins@1.5.2_seroval@1.5.2/node_modules/seroval-plugins/dist/esm/production/web.mjs
|
|
1475
|
+
var u = (e) => {
|
|
1476
|
+
let r = new AbortController(), a = r.abort.bind(r);
|
|
1477
|
+
return e.then(a, a), r;
|
|
1478
|
+
};
|
|
1479
|
+
function E(e) {
|
|
1480
|
+
e(this.reason);
|
|
1481
|
+
}
|
|
1482
|
+
function D(e) {
|
|
1483
|
+
this.addEventListener("abort", E.bind(this, e), { once: !0 });
|
|
1484
|
+
}
|
|
1485
|
+
function c(e) {
|
|
1486
|
+
return new Promise(D.bind(e));
|
|
1487
|
+
}
|
|
1488
|
+
var i = {}, O = ni({
|
|
1489
|
+
tag: "seroval-plugins/web/AbortSignal",
|
|
1490
|
+
extends: [ni({
|
|
1491
|
+
tag: "seroval-plugins/web/AbortControllerFactoryPlugin",
|
|
1492
|
+
test(e) {
|
|
1493
|
+
return e === i;
|
|
1494
|
+
},
|
|
1495
|
+
parse: {
|
|
1496
|
+
sync() {
|
|
1497
|
+
return i;
|
|
1498
|
+
},
|
|
1499
|
+
async async() {
|
|
1500
|
+
return await Promise.resolve(i);
|
|
1501
|
+
},
|
|
1502
|
+
stream() {
|
|
1503
|
+
return i;
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
serialize() {
|
|
1507
|
+
return u.toString();
|
|
1508
|
+
},
|
|
1509
|
+
deserialize() {
|
|
1510
|
+
return u;
|
|
1511
|
+
}
|
|
1512
|
+
})],
|
|
1513
|
+
test(e) {
|
|
1514
|
+
return typeof AbortSignal == "undefined" ? !1 : e instanceof AbortSignal;
|
|
1515
|
+
},
|
|
1516
|
+
parse: {
|
|
1517
|
+
sync(e, r) {
|
|
1518
|
+
return e.aborted ? { reason: r.parse(e.reason) } : {};
|
|
1519
|
+
},
|
|
1520
|
+
async async(e, r) {
|
|
1521
|
+
if (e.aborted) return { reason: await r.parse(e.reason) };
|
|
1522
|
+
let a = await c(e);
|
|
1523
|
+
return { reason: await r.parse(a) };
|
|
1524
|
+
},
|
|
1525
|
+
stream(e, r) {
|
|
1526
|
+
if (e.aborted) return { reason: r.parse(e.reason) };
|
|
1527
|
+
let a = c(e);
|
|
1528
|
+
return {
|
|
1529
|
+
factory: r.parse(i),
|
|
1530
|
+
controller: r.parse(a)
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
serialize(e, r) {
|
|
1535
|
+
return e.reason ? "AbortSignal.abort(" + r.serialize(e.reason) + ")" : e.controller && e.factory ? "(" + r.serialize(e.factory) + ")(" + r.serialize(e.controller) + ").signal" : "(new AbortController).signal";
|
|
1536
|
+
},
|
|
1537
|
+
deserialize(e, r) {
|
|
1538
|
+
return e.reason ? AbortSignal.abort(r.deserialize(e.reason)) : e.controller ? u(r.deserialize(e.controller)).signal : new AbortController().signal;
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
var B = ni({
|
|
1542
|
+
tag: "seroval-plugins/web/Blob",
|
|
1543
|
+
test(e) {
|
|
1544
|
+
return typeof Blob == "undefined" ? !1 : e instanceof Blob;
|
|
1545
|
+
},
|
|
1546
|
+
parse: { async async(e, r) {
|
|
1547
|
+
return {
|
|
1548
|
+
type: await r.parse(e.type),
|
|
1549
|
+
buffer: await r.parse(await e.arrayBuffer())
|
|
1550
|
+
};
|
|
1551
|
+
} },
|
|
1552
|
+
serialize(e, r) {
|
|
1553
|
+
return "new Blob([" + r.serialize(e.buffer) + "],{type:" + r.serialize(e.type) + "})";
|
|
1554
|
+
},
|
|
1555
|
+
deserialize(e, r) {
|
|
1556
|
+
return new Blob([r.deserialize(e.buffer)], { type: r.deserialize(e.type) });
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
function d(e) {
|
|
1560
|
+
return {
|
|
1561
|
+
detail: e.detail,
|
|
1562
|
+
bubbles: e.bubbles,
|
|
1563
|
+
cancelable: e.cancelable,
|
|
1564
|
+
composed: e.composed
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
var L = ni({
|
|
1568
|
+
tag: "seroval-plugins/web/CustomEvent",
|
|
1569
|
+
test(e) {
|
|
1570
|
+
return typeof CustomEvent == "undefined" ? !1 : e instanceof CustomEvent;
|
|
1571
|
+
},
|
|
1572
|
+
parse: {
|
|
1573
|
+
sync(e, r) {
|
|
1574
|
+
return {
|
|
1575
|
+
type: r.parse(e.type),
|
|
1576
|
+
options: r.parse(d(e))
|
|
1577
|
+
};
|
|
1578
|
+
},
|
|
1579
|
+
async async(e, r) {
|
|
1580
|
+
return {
|
|
1581
|
+
type: await r.parse(e.type),
|
|
1582
|
+
options: await r.parse(d(e))
|
|
1583
|
+
};
|
|
1584
|
+
},
|
|
1585
|
+
stream(e, r) {
|
|
1586
|
+
return {
|
|
1587
|
+
type: r.parse(e.type),
|
|
1588
|
+
options: r.parse(d(e))
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
serialize(e, r) {
|
|
1593
|
+
return "new CustomEvent(" + r.serialize(e.type) + "," + r.serialize(e.options) + ")";
|
|
1594
|
+
},
|
|
1595
|
+
deserialize(e, r) {
|
|
1596
|
+
return new CustomEvent(r.deserialize(e.type), r.deserialize(e.options));
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
var q = ni({
|
|
1600
|
+
tag: "seroval-plugins/web/DOMException",
|
|
1601
|
+
test(e) {
|
|
1602
|
+
return typeof DOMException == "undefined" ? !1 : e instanceof DOMException;
|
|
1603
|
+
},
|
|
1604
|
+
parse: {
|
|
1605
|
+
sync(e, r) {
|
|
1606
|
+
return {
|
|
1607
|
+
name: r.parse(e.name),
|
|
1608
|
+
message: r.parse(e.message)
|
|
1609
|
+
};
|
|
1610
|
+
},
|
|
1611
|
+
async async(e, r) {
|
|
1612
|
+
return {
|
|
1613
|
+
name: await r.parse(e.name),
|
|
1614
|
+
message: await r.parse(e.message)
|
|
1615
|
+
};
|
|
1616
|
+
},
|
|
1617
|
+
stream(e, r) {
|
|
1618
|
+
return {
|
|
1619
|
+
name: r.parse(e.name),
|
|
1620
|
+
message: r.parse(e.message)
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
serialize(e, r) {
|
|
1625
|
+
return "new DOMException(" + r.serialize(e.message) + "," + r.serialize(e.name) + ")";
|
|
1626
|
+
},
|
|
1627
|
+
deserialize(e, r) {
|
|
1628
|
+
return new DOMException(r.deserialize(e.message), r.deserialize(e.name));
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
function f(e) {
|
|
1632
|
+
return {
|
|
1633
|
+
bubbles: e.bubbles,
|
|
1634
|
+
cancelable: e.cancelable,
|
|
1635
|
+
composed: e.composed
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
var Y = ni({
|
|
1639
|
+
tag: "seroval-plugins/web/Event",
|
|
1640
|
+
test(e) {
|
|
1641
|
+
return typeof Event == "undefined" ? !1 : e instanceof Event;
|
|
1642
|
+
},
|
|
1643
|
+
parse: {
|
|
1644
|
+
sync(e, r) {
|
|
1645
|
+
return {
|
|
1646
|
+
type: r.parse(e.type),
|
|
1647
|
+
options: r.parse(f(e))
|
|
1648
|
+
};
|
|
1649
|
+
},
|
|
1650
|
+
async async(e, r) {
|
|
1651
|
+
return {
|
|
1652
|
+
type: await r.parse(e.type),
|
|
1653
|
+
options: await r.parse(f(e))
|
|
1654
|
+
};
|
|
1655
|
+
},
|
|
1656
|
+
stream(e, r) {
|
|
1657
|
+
return {
|
|
1658
|
+
type: r.parse(e.type),
|
|
1659
|
+
options: r.parse(f(e))
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
serialize(e, r) {
|
|
1664
|
+
return "new Event(" + r.serialize(e.type) + "," + r.serialize(e.options) + ")";
|
|
1665
|
+
},
|
|
1666
|
+
deserialize(e, r) {
|
|
1667
|
+
return new Event(r.deserialize(e.type), r.deserialize(e.options));
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
var m = ni({
|
|
1671
|
+
tag: "seroval-plugins/web/File",
|
|
1672
|
+
test(e) {
|
|
1673
|
+
return typeof File == "undefined" ? !1 : e instanceof File;
|
|
1674
|
+
},
|
|
1675
|
+
parse: { async async(e, r) {
|
|
1676
|
+
return {
|
|
1677
|
+
name: await r.parse(e.name),
|
|
1678
|
+
options: await r.parse({
|
|
1679
|
+
type: e.type,
|
|
1680
|
+
lastModified: e.lastModified
|
|
1681
|
+
}),
|
|
1682
|
+
buffer: await r.parse(await e.arrayBuffer())
|
|
1683
|
+
};
|
|
1684
|
+
} },
|
|
1685
|
+
serialize(e, r) {
|
|
1686
|
+
return "new File([" + r.serialize(e.buffer) + "]," + r.serialize(e.name) + "," + r.serialize(e.options) + ")";
|
|
1687
|
+
},
|
|
1688
|
+
deserialize(e, r) {
|
|
1689
|
+
return new File([r.deserialize(e.buffer)], r.deserialize(e.name), r.deserialize(e.options));
|
|
1690
|
+
}
|
|
1691
|
+
});
|
|
1692
|
+
function y(e) {
|
|
1693
|
+
let r = [];
|
|
1694
|
+
return e.forEach((a, t) => {
|
|
1695
|
+
r.push([t, a]);
|
|
1696
|
+
}), r;
|
|
1697
|
+
}
|
|
1698
|
+
var o = {}, v = (e, r = new FormData(), a = 0, t = e.length, s) => {
|
|
1699
|
+
for (; a < t; a++) s = e[a], r.append(s[0], s[1]);
|
|
1700
|
+
return r;
|
|
1701
|
+
}, K = ni({
|
|
1702
|
+
tag: "seroval-plugins/web/FormData",
|
|
1703
|
+
extends: [m, ni({
|
|
1704
|
+
tag: "seroval-plugins/web/FormDataFactory",
|
|
1705
|
+
test(e) {
|
|
1706
|
+
return e === o;
|
|
1707
|
+
},
|
|
1708
|
+
parse: {
|
|
1709
|
+
sync() {
|
|
1710
|
+
return o;
|
|
1711
|
+
},
|
|
1712
|
+
async async() {
|
|
1713
|
+
return await Promise.resolve(o);
|
|
1714
|
+
},
|
|
1715
|
+
stream() {
|
|
1716
|
+
return o;
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
serialize() {
|
|
1720
|
+
return v.toString();
|
|
1721
|
+
},
|
|
1722
|
+
deserialize() {
|
|
1723
|
+
return o;
|
|
1724
|
+
}
|
|
1725
|
+
})],
|
|
1726
|
+
test(e) {
|
|
1727
|
+
return typeof FormData == "undefined" ? !1 : e instanceof FormData;
|
|
1728
|
+
},
|
|
1729
|
+
parse: {
|
|
1730
|
+
sync(e, r) {
|
|
1731
|
+
return {
|
|
1732
|
+
factory: r.parse(o),
|
|
1733
|
+
entries: r.parse(y(e))
|
|
1734
|
+
};
|
|
1735
|
+
},
|
|
1736
|
+
async async(e, r) {
|
|
1737
|
+
return {
|
|
1738
|
+
factory: await r.parse(o),
|
|
1739
|
+
entries: await r.parse(y(e))
|
|
1740
|
+
};
|
|
1741
|
+
},
|
|
1742
|
+
stream(e, r) {
|
|
1743
|
+
return {
|
|
1744
|
+
factory: r.parse(o),
|
|
1745
|
+
entries: r.parse(y(e))
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
serialize(e, r) {
|
|
1750
|
+
return "(" + r.serialize(e.factory) + ")(" + r.serialize(e.entries) + ")";
|
|
1751
|
+
},
|
|
1752
|
+
deserialize(e, r) {
|
|
1753
|
+
return v(r.deserialize(e.entries));
|
|
1754
|
+
}
|
|
1755
|
+
});
|
|
1756
|
+
function g(e) {
|
|
1757
|
+
let r = [];
|
|
1758
|
+
return e.forEach((a, t) => {
|
|
1759
|
+
r.push([t, a]);
|
|
1760
|
+
}), r;
|
|
1761
|
+
}
|
|
1762
|
+
var l = ni({
|
|
1763
|
+
tag: "seroval-plugins/web/Headers",
|
|
1764
|
+
test(e) {
|
|
1765
|
+
return typeof Headers == "undefined" ? !1 : e instanceof Headers;
|
|
1766
|
+
},
|
|
1767
|
+
parse: {
|
|
1768
|
+
sync(e, r) {
|
|
1769
|
+
return { value: r.parse(g(e)) };
|
|
1770
|
+
},
|
|
1771
|
+
async async(e, r) {
|
|
1772
|
+
return { value: await r.parse(g(e)) };
|
|
1773
|
+
},
|
|
1774
|
+
stream(e, r) {
|
|
1775
|
+
return { value: r.parse(g(e)) };
|
|
1776
|
+
}
|
|
1777
|
+
},
|
|
1778
|
+
serialize(e, r) {
|
|
1779
|
+
return "new Headers(" + r.serialize(e.value) + ")";
|
|
1780
|
+
},
|
|
1781
|
+
deserialize(e, r) {
|
|
1782
|
+
return new Headers(r.deserialize(e.value));
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
var $ = ni({
|
|
1786
|
+
tag: "seroval-plugins/web/ImageData",
|
|
1787
|
+
test(e) {
|
|
1788
|
+
return typeof ImageData == "undefined" ? !1 : e instanceof ImageData;
|
|
1789
|
+
},
|
|
1790
|
+
parse: {
|
|
1791
|
+
sync(e, r) {
|
|
1792
|
+
return {
|
|
1793
|
+
data: r.parse(e.data),
|
|
1794
|
+
width: r.parse(e.width),
|
|
1795
|
+
height: r.parse(e.height),
|
|
1796
|
+
options: r.parse({ colorSpace: e.colorSpace })
|
|
1797
|
+
};
|
|
1798
|
+
},
|
|
1799
|
+
async async(e, r) {
|
|
1800
|
+
return {
|
|
1801
|
+
data: await r.parse(e.data),
|
|
1802
|
+
width: await r.parse(e.width),
|
|
1803
|
+
height: await r.parse(e.height),
|
|
1804
|
+
options: await r.parse({ colorSpace: e.colorSpace })
|
|
1805
|
+
};
|
|
1806
|
+
},
|
|
1807
|
+
stream(e, r) {
|
|
1808
|
+
return {
|
|
1809
|
+
data: r.parse(e.data),
|
|
1810
|
+
width: r.parse(e.width),
|
|
1811
|
+
height: r.parse(e.height),
|
|
1812
|
+
options: r.parse({ colorSpace: e.colorSpace })
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
},
|
|
1816
|
+
serialize(e, r) {
|
|
1817
|
+
return "new ImageData(" + r.serialize(e.data) + "," + r.serialize(e.width) + "," + r.serialize(e.height) + "," + r.serialize(e.options) + ")";
|
|
1818
|
+
},
|
|
1819
|
+
deserialize(e, r) {
|
|
1820
|
+
return new ImageData(r.deserialize(e.data), r.deserialize(e.width), r.deserialize(e.height), r.deserialize(e.options));
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
var n = {}, P = (e) => new ReadableStream({ start: (r) => {
|
|
1824
|
+
e.on({
|
|
1825
|
+
next: (a) => {
|
|
1826
|
+
try {
|
|
1827
|
+
r.enqueue(a);
|
|
1828
|
+
} catch (t) {}
|
|
1829
|
+
},
|
|
1830
|
+
throw: (a) => {
|
|
1831
|
+
r.error(a);
|
|
1832
|
+
},
|
|
1833
|
+
return: () => {
|
|
1834
|
+
try {
|
|
1835
|
+
r.close();
|
|
1836
|
+
} catch (a) {}
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
} }), x = ni({
|
|
1840
|
+
tag: "seroval-plugins/web/ReadableStreamFactory",
|
|
1841
|
+
test(e) {
|
|
1842
|
+
return e === n;
|
|
1843
|
+
},
|
|
1844
|
+
parse: {
|
|
1845
|
+
sync() {
|
|
1846
|
+
return n;
|
|
1847
|
+
},
|
|
1848
|
+
async async() {
|
|
1849
|
+
return await Promise.resolve(n);
|
|
1850
|
+
},
|
|
1851
|
+
stream() {
|
|
1852
|
+
return n;
|
|
1853
|
+
}
|
|
1854
|
+
},
|
|
1855
|
+
serialize() {
|
|
1856
|
+
return P.toString();
|
|
1857
|
+
},
|
|
1858
|
+
deserialize() {
|
|
1859
|
+
return n;
|
|
1860
|
+
}
|
|
1861
|
+
});
|
|
1862
|
+
function w(e) {
|
|
1863
|
+
let r = te$1(), a = e.getReader();
|
|
1864
|
+
async function t() {
|
|
1865
|
+
try {
|
|
1866
|
+
let s = await a.read();
|
|
1867
|
+
s.done ? r.return(s.value) : (r.next(s.value), await t());
|
|
1868
|
+
} catch (s) {
|
|
1869
|
+
r.throw(s);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
return t().catch(() => {}), r;
|
|
1873
|
+
}
|
|
1874
|
+
var p = ni({
|
|
1875
|
+
tag: "seroval/plugins/web/ReadableStream",
|
|
1876
|
+
extends: [x],
|
|
1877
|
+
test(e) {
|
|
1878
|
+
return typeof ReadableStream == "undefined" ? !1 : e instanceof ReadableStream;
|
|
1879
|
+
},
|
|
1880
|
+
parse: {
|
|
1881
|
+
sync(e, r) {
|
|
1882
|
+
return {
|
|
1883
|
+
factory: r.parse(n),
|
|
1884
|
+
stream: r.parse(te$1())
|
|
1885
|
+
};
|
|
1886
|
+
},
|
|
1887
|
+
async async(e, r) {
|
|
1888
|
+
return {
|
|
1889
|
+
factory: await r.parse(n),
|
|
1890
|
+
stream: await r.parse(w(e))
|
|
1891
|
+
};
|
|
1892
|
+
},
|
|
1893
|
+
stream(e, r) {
|
|
1894
|
+
return {
|
|
1895
|
+
factory: r.parse(n),
|
|
1896
|
+
stream: r.parse(w(e))
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
},
|
|
1900
|
+
serialize(e, r) {
|
|
1901
|
+
return "(" + r.serialize(e.factory) + ")(" + r.serialize(e.stream) + ")";
|
|
1902
|
+
},
|
|
1903
|
+
deserialize(e, r) {
|
|
1904
|
+
return P(r.deserialize(e.stream));
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
function N(e, r) {
|
|
1908
|
+
return {
|
|
1909
|
+
body: r,
|
|
1910
|
+
cache: e.cache,
|
|
1911
|
+
credentials: e.credentials,
|
|
1912
|
+
headers: e.headers,
|
|
1913
|
+
integrity: e.integrity,
|
|
1914
|
+
keepalive: e.keepalive,
|
|
1915
|
+
method: e.method,
|
|
1916
|
+
mode: e.mode,
|
|
1917
|
+
redirect: e.redirect,
|
|
1918
|
+
referrer: e.referrer,
|
|
1919
|
+
referrerPolicy: e.referrerPolicy
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
var te = ni({
|
|
1923
|
+
tag: "seroval-plugins/web/Request",
|
|
1924
|
+
extends: [p, l],
|
|
1925
|
+
test(e) {
|
|
1926
|
+
return typeof Request == "undefined" ? !1 : e instanceof Request;
|
|
1927
|
+
},
|
|
1928
|
+
parse: {
|
|
1929
|
+
async async(e, r) {
|
|
1930
|
+
return {
|
|
1931
|
+
url: await r.parse(e.url),
|
|
1932
|
+
options: await r.parse(N(e, e.body && !e.bodyUsed ? await e.clone().arrayBuffer() : null))
|
|
1933
|
+
};
|
|
1934
|
+
},
|
|
1935
|
+
stream(e, r) {
|
|
1936
|
+
return {
|
|
1937
|
+
url: r.parse(e.url),
|
|
1938
|
+
options: r.parse(N(e, e.body && !e.bodyUsed ? e.clone().body : null))
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
serialize(e, r) {
|
|
1943
|
+
return "new Request(" + r.serialize(e.url) + "," + r.serialize(e.options) + ")";
|
|
1944
|
+
},
|
|
1945
|
+
deserialize(e, r) {
|
|
1946
|
+
return new Request(r.deserialize(e.url), r.deserialize(e.options));
|
|
1947
|
+
}
|
|
1948
|
+
});
|
|
1949
|
+
function h(e) {
|
|
1950
|
+
return {
|
|
1951
|
+
headers: e.headers,
|
|
1952
|
+
status: e.status,
|
|
1953
|
+
statusText: e.statusText
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
var ne = ni({
|
|
1957
|
+
tag: "seroval-plugins/web/Response",
|
|
1958
|
+
extends: [p, l],
|
|
1959
|
+
test(e) {
|
|
1960
|
+
return typeof Response == "undefined" ? !1 : e instanceof Response;
|
|
1961
|
+
},
|
|
1962
|
+
parse: {
|
|
1963
|
+
async async(e, r) {
|
|
1964
|
+
return {
|
|
1965
|
+
body: await r.parse(e.body && !e.bodyUsed ? await e.clone().arrayBuffer() : null),
|
|
1966
|
+
options: await r.parse(h(e))
|
|
1967
|
+
};
|
|
1968
|
+
},
|
|
1969
|
+
stream(e, r) {
|
|
1970
|
+
return {
|
|
1971
|
+
body: r.parse(e.body && !e.bodyUsed ? e.clone().body : null),
|
|
1972
|
+
options: r.parse(h(e))
|
|
1973
|
+
};
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
serialize(e, r) {
|
|
1977
|
+
return "new Response(" + r.serialize(e.body) + "," + r.serialize(e.options) + ")";
|
|
1978
|
+
},
|
|
1979
|
+
deserialize(e, r) {
|
|
1980
|
+
return new Response(r.deserialize(e.body), r.deserialize(e.options));
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
var pe = ni({
|
|
1984
|
+
tag: "seroval-plugins/web/URL",
|
|
1985
|
+
test(e) {
|
|
1986
|
+
return typeof URL == "undefined" ? !1 : e instanceof URL;
|
|
1987
|
+
},
|
|
1988
|
+
parse: {
|
|
1989
|
+
sync(e, r) {
|
|
1990
|
+
return { value: r.parse(e.href) };
|
|
1991
|
+
},
|
|
1992
|
+
async async(e, r) {
|
|
1993
|
+
return { value: await r.parse(e.href) };
|
|
1994
|
+
},
|
|
1995
|
+
stream(e, r) {
|
|
1996
|
+
return { value: r.parse(e.href) };
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1999
|
+
serialize(e, r) {
|
|
2000
|
+
return "new URL(" + r.serialize(e.value) + ")";
|
|
2001
|
+
},
|
|
2002
|
+
deserialize(e, r) {
|
|
2003
|
+
return new URL(r.deserialize(e.value));
|
|
2004
|
+
}
|
|
2005
|
+
});
|
|
2006
|
+
var fe = ni({
|
|
2007
|
+
tag: "seroval-plugins/web/URLSearchParams",
|
|
2008
|
+
test(e) {
|
|
2009
|
+
return typeof URLSearchParams == "undefined" ? !1 : e instanceof URLSearchParams;
|
|
2010
|
+
},
|
|
2011
|
+
parse: {
|
|
2012
|
+
sync(e, r) {
|
|
2013
|
+
return { value: r.parse(e.toString()) };
|
|
2014
|
+
},
|
|
2015
|
+
async async(e, r) {
|
|
2016
|
+
return { value: await r.parse(e.toString()) };
|
|
2017
|
+
},
|
|
2018
|
+
stream(e, r) {
|
|
2019
|
+
return { value: r.parse(e.toString()) };
|
|
2020
|
+
}
|
|
2021
|
+
},
|
|
2022
|
+
serialize(e, r) {
|
|
2023
|
+
return "new URLSearchParams(" + r.serialize(e.value) + ")";
|
|
2024
|
+
},
|
|
2025
|
+
deserialize(e, r) {
|
|
2026
|
+
return new URLSearchParams(r.deserialize(e.value));
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
//#endregion
|
|
2030
|
+
//#region ../sdk/src/cacheSerialization.ts
|
|
2031
|
+
const serializedCacheValueMarker = "__agentEvalsCacheSerialization";
|
|
2032
|
+
const serializedCacheValueVersion = "seroval-web-v1";
|
|
2033
|
+
const serovalWebPlugins = [
|
|
2034
|
+
O,
|
|
2035
|
+
B,
|
|
2036
|
+
L,
|
|
2037
|
+
q,
|
|
2038
|
+
Y,
|
|
2039
|
+
m,
|
|
2040
|
+
K,
|
|
2041
|
+
l,
|
|
2042
|
+
$,
|
|
2043
|
+
p,
|
|
2044
|
+
te,
|
|
2045
|
+
ne,
|
|
2046
|
+
pe,
|
|
2047
|
+
fe
|
|
2048
|
+
];
|
|
2049
|
+
function isRecordLike$2(value) {
|
|
2050
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2051
|
+
}
|
|
2052
|
+
function isSerializedCacheValue(value) {
|
|
2053
|
+
return isRecordLike$2(value) && value[serializedCacheValueMarker] === serializedCacheValueVersion;
|
|
2054
|
+
}
|
|
2055
|
+
/** Serialize one cached value with Seroval plus the Web API plugin set. */
|
|
2056
|
+
async function serializeCacheValue(value) {
|
|
2057
|
+
return {
|
|
2058
|
+
[serializedCacheValueMarker]: serializedCacheValueVersion,
|
|
2059
|
+
value: await Au(value, { plugins: serovalWebPlugins })
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
/** Revive one cached value, while preserving legacy JSON-round-tripped data. */
|
|
2063
|
+
function deserializeCacheValue(value) {
|
|
2064
|
+
if (!isSerializedCacheValue(value)) return value;
|
|
2065
|
+
return Iu(value.value, { plugins: serovalWebPlugins });
|
|
2066
|
+
}
|
|
2067
|
+
/** Clone one value through the same Seroval path used for persisted cache data. */
|
|
2068
|
+
async function cloneCacheValue(value) {
|
|
2069
|
+
return deserializeCacheValue(await serializeCacheValue(value));
|
|
2070
|
+
}
|
|
2071
|
+
async function serializeRecordValues(record) {
|
|
2072
|
+
const entries = [];
|
|
2073
|
+
for (const [key, value] of Object.entries(record)) entries.push([key, await serializeCacheValue(value)]);
|
|
2074
|
+
return Object.fromEntries(entries);
|
|
2075
|
+
}
|
|
2076
|
+
function deserializeRecordValues(record) {
|
|
2077
|
+
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, deserializeCacheValue(value)]));
|
|
2078
|
+
}
|
|
2079
|
+
async function serializeCacheRecordingOp(op) {
|
|
2080
|
+
switch (op.kind) {
|
|
2081
|
+
case "setOutput":
|
|
2082
|
+
case "appendOutput": return {
|
|
2083
|
+
...op,
|
|
2084
|
+
value: await serializeCacheValue(op.value)
|
|
2085
|
+
};
|
|
2086
|
+
case "mergeOutput": return {
|
|
2087
|
+
...op,
|
|
2088
|
+
patch: await serializeRecordValues(op.patch)
|
|
2089
|
+
};
|
|
2090
|
+
case "incrementOutput": return op;
|
|
2091
|
+
case "checkpoint": return {
|
|
2092
|
+
...op,
|
|
2093
|
+
data: await serializeCacheValue(op.data)
|
|
2094
|
+
};
|
|
2095
|
+
case "subSpan": return {
|
|
2096
|
+
...op,
|
|
2097
|
+
span: await serializeCacheSpan(op.span)
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
function deserializeCacheRecordingOp(op) {
|
|
2102
|
+
switch (op.kind) {
|
|
2103
|
+
case "setOutput":
|
|
2104
|
+
case "appendOutput": return {
|
|
2105
|
+
...op,
|
|
2106
|
+
value: deserializeCacheValue(op.value)
|
|
2107
|
+
};
|
|
2108
|
+
case "mergeOutput": return {
|
|
2109
|
+
...op,
|
|
2110
|
+
patch: deserializeRecordValues(op.patch)
|
|
2111
|
+
};
|
|
2112
|
+
case "incrementOutput": return op;
|
|
2113
|
+
case "checkpoint": return {
|
|
2114
|
+
...op,
|
|
2115
|
+
data: deserializeCacheValue(op.data)
|
|
2116
|
+
};
|
|
2117
|
+
case "subSpan": return {
|
|
2118
|
+
...op,
|
|
2119
|
+
span: deserializeCacheSpan(op.span)
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
async function serializeCacheSpan(span) {
|
|
2124
|
+
return {
|
|
2125
|
+
...span,
|
|
2126
|
+
attributes: span.attributes === void 0 ? void 0 : await serializeRecordValues(span.attributes),
|
|
2127
|
+
children: await Promise.all(span.children.map(serializeCacheSpan))
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
function deserializeCacheSpan(span) {
|
|
2131
|
+
return {
|
|
2132
|
+
...span,
|
|
2133
|
+
attributes: span.attributes === void 0 ? void 0 : deserializeRecordValues(span.attributes),
|
|
2134
|
+
children: span.children.map(deserializeCacheSpan)
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
/** Serialize all rich values captured in a cache recording before persistence. */
|
|
2138
|
+
async function serializeCacheRecording(recording) {
|
|
2139
|
+
return {
|
|
2140
|
+
...recording,
|
|
2141
|
+
returnValue: await serializeCacheValue(recording.returnValue),
|
|
2142
|
+
finalAttributes: await serializeRecordValues(recording.finalAttributes),
|
|
2143
|
+
ops: await Promise.all(recording.ops.map(serializeCacheRecordingOp))
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
/** Revive all rich values captured in a cache recording after lookup. */
|
|
2147
|
+
function deserializeCacheRecording(recording) {
|
|
2148
|
+
return {
|
|
2149
|
+
...recording,
|
|
2150
|
+
returnValue: deserializeCacheValue(recording.returnValue),
|
|
2151
|
+
finalAttributes: deserializeRecordValues(recording.finalAttributes),
|
|
2152
|
+
ops: recording.ops.map(deserializeCacheRecordingOp)
|
|
2153
|
+
};
|
|
367
2154
|
}
|
|
368
2155
|
//#endregion
|
|
369
2156
|
//#region ../sdk/src/cacheRecording.ts
|
|
@@ -388,8 +2175,8 @@ function stripCacheAttributes(attributes) {
|
|
|
388
2175
|
for (const [key, value] of Object.entries(attributes)) if (!key.startsWith("cache.")) result[key] = value;
|
|
389
2176
|
return result;
|
|
390
2177
|
}
|
|
391
|
-
function snapshotNonCacheAttributes(span) {
|
|
392
|
-
const snapshot =
|
|
2178
|
+
async function snapshotNonCacheAttributes(span) {
|
|
2179
|
+
const snapshot = await cloneCacheValue(stripCacheAttributes(span?.attributes));
|
|
393
2180
|
return isRecordLike$1(snapshot) ? snapshot : {};
|
|
394
2181
|
}
|
|
395
2182
|
function diffNonCacheAttributes(before, after) {
|
|
@@ -410,6 +2197,19 @@ function appendCacheRef(span, ref) {
|
|
|
410
2197
|
const existing = span.attributes?.["cache.refs"];
|
|
411
2198
|
mergeSpanAttributes$1(span, { "cache.refs": [...Array.isArray(existing) ? copyArray(existing) : [], ref] });
|
|
412
2199
|
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Record a cache ref against the active span when present, or against the
|
|
2202
|
+
* case scope's `caseCacheRefs` bucket when the call originated from outside
|
|
2203
|
+
* any `traceSpan(...)` body. Without this, spanless refs would be silently
|
|
2204
|
+
* dropped and never surface in the trace or case detail.
|
|
2205
|
+
*/
|
|
2206
|
+
function recordCacheRef(scope, span, ref) {
|
|
2207
|
+
if (span !== void 0) {
|
|
2208
|
+
appendCacheRef(span, ref);
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
scope.caseCacheRefs.push(ref);
|
|
2212
|
+
}
|
|
413
2213
|
function serializeSubSpanTree(scope, spanId) {
|
|
414
2214
|
const original = scope.spans.find((s) => s.id === spanId);
|
|
415
2215
|
if (!original) return {
|
|
@@ -522,7 +2322,7 @@ const errorCoreFields = new Set([
|
|
|
522
2322
|
"stack",
|
|
523
2323
|
"capturedAt"
|
|
524
2324
|
]);
|
|
525
|
-
function isRecord$
|
|
2325
|
+
function isRecord$4(value) {
|
|
526
2326
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
527
2327
|
}
|
|
528
2328
|
function formatUnknownErrorMessage(error) {
|
|
@@ -550,7 +2350,7 @@ function normalizeTraceError(error, capturedAt = void 0) {
|
|
|
550
2350
|
stack: error.stack,
|
|
551
2351
|
capturedAt
|
|
552
2352
|
};
|
|
553
|
-
if (isRecord$
|
|
2353
|
+
if (isRecord$4(error)) {
|
|
554
2354
|
const extraFields = getErrorExtraFields(error);
|
|
555
2355
|
const name = typeof error.name === "string" ? error.name : void 0;
|
|
556
2356
|
const stack = typeof error.stack === "string" ? error.stack : void 0;
|
|
@@ -575,7 +2375,7 @@ function normalizeTraceWarnings(warningOrWarnings, additionalWarnings, capturedA
|
|
|
575
2375
|
return (additionalWarnings.length > 0 ? [warningOrWarnings, ...additionalWarnings] : Array.isArray(warningOrWarnings) ? warningOrWarnings : [warningOrWarnings]).map((warning) => normalizeTraceError(warning, capturedAt));
|
|
576
2376
|
}
|
|
577
2377
|
function isCaptureEvalSpanErrorOptions(value) {
|
|
578
|
-
if (!isRecord$
|
|
2378
|
+
if (!isRecord$4(value)) return false;
|
|
579
2379
|
const keys = Object.keys(value);
|
|
580
2380
|
if (keys.length === 0) return false;
|
|
581
2381
|
if (!keys.every((key) => key === "level")) return false;
|
|
@@ -630,14 +2430,14 @@ function createTraceCache(generateSpanId) {
|
|
|
630
2430
|
namespace,
|
|
631
2431
|
codeFingerprint: cacheCtx.codeFingerprint,
|
|
632
2432
|
key: info.key
|
|
633
|
-
});
|
|
2433
|
+
}, { serializeFileBytes: info.serializeFileBytes === true });
|
|
634
2434
|
const activeSpan = scope.activeSpanStack.at(-1);
|
|
635
2435
|
if (cacheCtx.mode === "use") {
|
|
636
2436
|
const hit = await cacheCtx.adapter.lookup(namespace, keyHash);
|
|
637
2437
|
if (hit) {
|
|
638
2438
|
const storedAt = hit.storedAt;
|
|
639
2439
|
const age = Date.now() - new Date(storedAt).getTime();
|
|
640
|
-
|
|
2440
|
+
recordCacheRef(scope, activeSpan, {
|
|
641
2441
|
type: "value",
|
|
642
2442
|
name: info.name,
|
|
643
2443
|
namespace,
|
|
@@ -646,31 +2446,32 @@ function createTraceCache(generateSpanId) {
|
|
|
646
2446
|
storedAt,
|
|
647
2447
|
age
|
|
648
2448
|
});
|
|
649
|
-
|
|
650
|
-
|
|
2449
|
+
const recording = deserializeCacheRecording(hit.recording);
|
|
2450
|
+
replayRecording(scope, activeSpan, recording, { generateSpanId });
|
|
2451
|
+
return recording.returnValue;
|
|
651
2452
|
}
|
|
652
|
-
|
|
2453
|
+
recordCacheRef(scope, activeSpan, {
|
|
653
2454
|
type: "value",
|
|
654
2455
|
name: info.name,
|
|
655
2456
|
namespace,
|
|
656
2457
|
key: keyHash,
|
|
657
2458
|
status: "miss"
|
|
658
2459
|
});
|
|
659
|
-
} else if (cacheCtx.mode === "refresh")
|
|
2460
|
+
} else if (cacheCtx.mode === "refresh") recordCacheRef(scope, activeSpan, {
|
|
660
2461
|
type: "value",
|
|
661
2462
|
name: info.name,
|
|
662
2463
|
namespace,
|
|
663
2464
|
key: keyHash,
|
|
664
2465
|
status: "refresh"
|
|
665
2466
|
});
|
|
666
|
-
else
|
|
2467
|
+
else recordCacheRef(scope, activeSpan, {
|
|
667
2468
|
type: "value",
|
|
668
2469
|
name: info.name,
|
|
669
2470
|
namespace,
|
|
670
2471
|
key: keyHash,
|
|
671
2472
|
status: "bypass"
|
|
672
2473
|
});
|
|
673
|
-
const beforeAttributes = snapshotNonCacheAttributes(activeSpan);
|
|
2474
|
+
const beforeAttributes = await snapshotNonCacheAttributes(activeSpan);
|
|
674
2475
|
const frame = {
|
|
675
2476
|
baseSpanIndex: scope.spans.length,
|
|
676
2477
|
replayParentSpanId: activeSpan?.id ?? null,
|
|
@@ -685,9 +2486,9 @@ function createTraceCache(generateSpanId) {
|
|
|
685
2486
|
}
|
|
686
2487
|
appendSubSpanOps(scope, frame);
|
|
687
2488
|
if (cacheCtx.mode !== "bypass") {
|
|
688
|
-
const finalAttributes = diffNonCacheAttributes(beforeAttributes, snapshotNonCacheAttributes(activeSpan));
|
|
2489
|
+
const finalAttributes = diffNonCacheAttributes(beforeAttributes, await snapshotNonCacheAttributes(activeSpan));
|
|
689
2490
|
const recording = {
|
|
690
|
-
returnValue:
|
|
2491
|
+
returnValue: bodyResult,
|
|
691
2492
|
finalAttributes,
|
|
692
2493
|
ops: frame.ops
|
|
693
2494
|
};
|
|
@@ -699,7 +2500,7 @@ function createTraceCache(generateSpanId) {
|
|
|
699
2500
|
operationName: info.name,
|
|
700
2501
|
storedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
701
2502
|
codeFingerprint: cacheCtx.codeFingerprint,
|
|
702
|
-
recording
|
|
2503
|
+
recording: await serializeCacheRecording(recording)
|
|
703
2504
|
});
|
|
704
2505
|
}
|
|
705
2506
|
return bodyResult;
|
|
@@ -1060,7 +2861,7 @@ async function traceSpan(info, fn) {
|
|
|
1060
2861
|
namespace,
|
|
1061
2862
|
codeFingerprint: ctx.codeFingerprint,
|
|
1062
2863
|
key: cacheOpts.key
|
|
1063
|
-
});
|
|
2864
|
+
}, { serializeFileBytes: cacheOpts.serializeFileBytes === true });
|
|
1064
2865
|
mergeSpanAttributes(spanRecord, {
|
|
1065
2866
|
"cache.key": keyHash,
|
|
1066
2867
|
"cache.namespace": namespace
|
|
@@ -1074,10 +2875,11 @@ async function traceSpan(info, fn) {
|
|
|
1074
2875
|
"cache.storedAt": storedAt,
|
|
1075
2876
|
"cache.age": Date.now() - new Date(storedAt).getTime()
|
|
1076
2877
|
});
|
|
1077
|
-
|
|
1078
|
-
spanRecord
|
|
2878
|
+
const recording = deserializeCacheRecording(hit.recording);
|
|
2879
|
+
replayRecording(scope, spanRecord, recording, { generateSpanId });
|
|
2880
|
+
spanRecord.status = recording.finalStatus ?? (hasSpanError(spanRecord) ? "error" : "ok");
|
|
1079
2881
|
spanRecord.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1080
|
-
return
|
|
2882
|
+
return recording.returnValue;
|
|
1081
2883
|
}
|
|
1082
2884
|
mergeSpanAttributes(spanRecord, { "cache.status": "miss" });
|
|
1083
2885
|
} else if (ctx.mode === "refresh") mergeSpanAttributes(spanRecord, { "cache.status": "refresh" });
|
|
@@ -1098,7 +2900,7 @@ async function traceSpan(info, fn) {
|
|
|
1098
2900
|
finishSpanWithoutThrownError(spanRecord);
|
|
1099
2901
|
if (ctx.mode !== "bypass") {
|
|
1100
2902
|
const recording = {
|
|
1101
|
-
returnValue:
|
|
2903
|
+
returnValue: bodyResult,
|
|
1102
2904
|
finalAttributes: stripCacheAttributes(spanRecord.attributes),
|
|
1103
2905
|
finalStatus: spanRecord.status,
|
|
1104
2906
|
finalError: spanRecord.error,
|
|
@@ -1117,7 +2919,7 @@ async function traceSpan(info, fn) {
|
|
|
1117
2919
|
spanKind: info.kind,
|
|
1118
2920
|
storedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1119
2921
|
codeFingerprint: ctx.codeFingerprint,
|
|
1120
|
-
recording
|
|
2922
|
+
recording: await serializeCacheRecording(recording)
|
|
1121
2923
|
};
|
|
1122
2924
|
await ctx.adapter.write(entry);
|
|
1123
2925
|
}
|
|
@@ -1386,12 +3188,163 @@ const traceSpanSchema = z.object({
|
|
|
1386
3188
|
"ok",
|
|
1387
3189
|
"error",
|
|
1388
3190
|
"cancelled"
|
|
1389
|
-
]),
|
|
1390
|
-
attributes: z.record(z.string(), z.unknown()).optional(),
|
|
1391
|
-
error: traceSpanErrorSchema.optional(),
|
|
1392
|
-
errors: z.array(traceSpanErrorSchema).optional(),
|
|
1393
|
-
warning: traceSpanWarningSchema.optional(),
|
|
1394
|
-
warnings: z.array(traceSpanWarningSchema).optional()
|
|
3191
|
+
]),
|
|
3192
|
+
attributes: z.record(z.string(), z.unknown()).optional(),
|
|
3193
|
+
error: traceSpanErrorSchema.optional(),
|
|
3194
|
+
errors: z.array(traceSpanErrorSchema).optional(),
|
|
3195
|
+
warning: traceSpanWarningSchema.optional(),
|
|
3196
|
+
warnings: z.array(traceSpanWarningSchema).optional()
|
|
3197
|
+
});
|
|
3198
|
+
//#endregion
|
|
3199
|
+
//#region ../shared/src/schemas/cache.ts
|
|
3200
|
+
/**
|
|
3201
|
+
* Mode that controls how the cache is consulted for a given run.
|
|
3202
|
+
*
|
|
3203
|
+
* - `use`: read cache on hit, write on miss. Default.
|
|
3204
|
+
* - `bypass`: never read, never write.
|
|
3205
|
+
* - `refresh`: never read, always write (forces re-execution and overwrites).
|
|
3206
|
+
*/
|
|
3207
|
+
const cacheModeSchema = z.enum([
|
|
3208
|
+
"use",
|
|
3209
|
+
"bypass",
|
|
3210
|
+
"refresh"
|
|
3211
|
+
]);
|
|
3212
|
+
/** Options accepted by an `evalTracer.span` call to opt the span into caching. */
|
|
3213
|
+
const spanCacheOptionsSchema = z.object({
|
|
3214
|
+
/** Arbitrary JSON-safe value used to derive the cache key. */
|
|
3215
|
+
key: z.unknown(),
|
|
3216
|
+
/** Override the default namespace (`${evalId}__${spanName}`). */
|
|
3217
|
+
namespace: z.string().optional(),
|
|
3218
|
+
/**
|
|
3219
|
+
* Include native `Blob`/`File` bytes in the cache key. By default only stable
|
|
3220
|
+
* metadata (`type`, `size`, plus `name`/`lastModified` for `File`) is used.
|
|
3221
|
+
*/
|
|
3222
|
+
serializeFileBytes: z.boolean().optional()
|
|
3223
|
+
});
|
|
3224
|
+
/** Category of operation stored in the eval cache. */
|
|
3225
|
+
const cacheOperationTypeSchema = z.enum(["span", "value"]);
|
|
3226
|
+
/** Status of a cache lookup recorded on a span or case scope. */
|
|
3227
|
+
const cacheStatusSchema = z.enum([
|
|
3228
|
+
"hit",
|
|
3229
|
+
"miss",
|
|
3230
|
+
"refresh",
|
|
3231
|
+
"bypass"
|
|
3232
|
+
]);
|
|
3233
|
+
/**
|
|
3234
|
+
* Reference to a value-cache lookup performed via `evalTracer.cache(...)`.
|
|
3235
|
+
*
|
|
3236
|
+
* Refs are appended to the active span's `cache.refs` attribute when the call
|
|
3237
|
+
* happens inside a `traceSpan(...)` body, or to the case scope's
|
|
3238
|
+
* `caseCacheRefs` bucket when the call is made directly from the case body.
|
|
3239
|
+
*/
|
|
3240
|
+
const traceCacheRefSchema = z.object({
|
|
3241
|
+
type: z.literal("value"),
|
|
3242
|
+
name: z.string(),
|
|
3243
|
+
namespace: z.string(),
|
|
3244
|
+
key: z.string(),
|
|
3245
|
+
status: cacheStatusSchema,
|
|
3246
|
+
storedAt: z.string().optional(),
|
|
3247
|
+
age: z.number().optional()
|
|
3248
|
+
});
|
|
3249
|
+
/** Summary of a single persisted cache entry, used by list/delete endpoints. */
|
|
3250
|
+
const cacheListItemSchema = z.object({
|
|
3251
|
+
key: z.string(),
|
|
3252
|
+
namespace: z.string(),
|
|
3253
|
+
operationType: cacheOperationTypeSchema,
|
|
3254
|
+
operationName: z.string(),
|
|
3255
|
+
spanName: z.string().optional(),
|
|
3256
|
+
spanKind: traceSpanKindSchema.optional(),
|
|
3257
|
+
storedAt: z.string(),
|
|
3258
|
+
codeFingerprint: z.string(),
|
|
3259
|
+
sizeBytes: z.number()
|
|
3260
|
+
});
|
|
3261
|
+
/** Zod schema for `SerializedCacheSpan`, defined lazily for recursion. */
|
|
3262
|
+
const serializedCacheSpanSchema = z.object({
|
|
3263
|
+
kind: traceSpanKindSchema,
|
|
3264
|
+
name: z.string(),
|
|
3265
|
+
attributes: z.record(z.string(), z.unknown()).optional(),
|
|
3266
|
+
status: z.enum([
|
|
3267
|
+
"running",
|
|
3268
|
+
"ok",
|
|
3269
|
+
"error",
|
|
3270
|
+
"cancelled"
|
|
3271
|
+
]),
|
|
3272
|
+
error: traceSpanErrorSchema.optional(),
|
|
3273
|
+
errors: z.array(traceSpanErrorSchema).optional(),
|
|
3274
|
+
warning: traceSpanWarningSchema.optional(),
|
|
3275
|
+
warnings: z.array(traceSpanWarningSchema).optional()
|
|
3276
|
+
}).extend({ children: z.lazy(() => z.array(serializedCacheSpanSchema)) });
|
|
3277
|
+
/**
|
|
3278
|
+
* One captured operation performed while a cached span's body executed.
|
|
3279
|
+
*
|
|
3280
|
+
* Operations are replayed in order against a fresh scope on cache hit to
|
|
3281
|
+
* reproduce the observable effects of the original run.
|
|
3282
|
+
*/
|
|
3283
|
+
const cacheRecordingOpSchema = z.discriminatedUnion("kind", [
|
|
3284
|
+
z.object({
|
|
3285
|
+
kind: z.literal("setOutput"),
|
|
3286
|
+
key: z.string(),
|
|
3287
|
+
value: z.unknown()
|
|
3288
|
+
}),
|
|
3289
|
+
z.object({
|
|
3290
|
+
kind: z.literal("appendOutput"),
|
|
3291
|
+
key: z.string(),
|
|
3292
|
+
value: z.unknown()
|
|
3293
|
+
}),
|
|
3294
|
+
z.object({
|
|
3295
|
+
kind: z.literal("mergeOutput"),
|
|
3296
|
+
key: z.string(),
|
|
3297
|
+
patch: z.record(z.string(), z.unknown())
|
|
3298
|
+
}),
|
|
3299
|
+
z.object({
|
|
3300
|
+
kind: z.literal("incrementOutput"),
|
|
3301
|
+
key: z.string(),
|
|
3302
|
+
delta: z.number()
|
|
3303
|
+
}),
|
|
3304
|
+
z.object({
|
|
3305
|
+
kind: z.literal("checkpoint"),
|
|
3306
|
+
name: z.string(),
|
|
3307
|
+
data: z.unknown()
|
|
3308
|
+
}),
|
|
3309
|
+
z.object({
|
|
3310
|
+
kind: z.literal("subSpan"),
|
|
3311
|
+
span: serializedCacheSpanSchema
|
|
3312
|
+
})
|
|
3313
|
+
]);
|
|
3314
|
+
/** Captured observable effects + return value of a cached span body. */
|
|
3315
|
+
const cacheRecordingSchema = z.object({
|
|
3316
|
+
returnValue: z.unknown(),
|
|
3317
|
+
finalAttributes: z.record(z.string(), z.unknown()),
|
|
3318
|
+
finalStatus: z.enum([
|
|
3319
|
+
"running",
|
|
3320
|
+
"ok",
|
|
3321
|
+
"error",
|
|
3322
|
+
"cancelled"
|
|
3323
|
+
]).optional(),
|
|
3324
|
+
finalError: traceSpanErrorSchema.optional(),
|
|
3325
|
+
finalErrors: z.array(traceSpanErrorSchema).optional(),
|
|
3326
|
+
finalWarning: traceSpanWarningSchema.optional(),
|
|
3327
|
+
finalWarnings: z.array(traceSpanWarningSchema).optional(),
|
|
3328
|
+
ops: z.array(cacheRecordingOpSchema)
|
|
3329
|
+
});
|
|
3330
|
+
/** Persisted cache file containing metadata and a recording. */
|
|
3331
|
+
const cacheEntrySchema = z.object({
|
|
3332
|
+
version: z.literal(1),
|
|
3333
|
+
key: z.string(),
|
|
3334
|
+
namespace: z.string(),
|
|
3335
|
+
operationType: cacheOperationTypeSchema.optional(),
|
|
3336
|
+
operationName: z.string().optional(),
|
|
3337
|
+
spanName: z.string().optional(),
|
|
3338
|
+
spanKind: traceSpanKindSchema.optional(),
|
|
3339
|
+
storedAt: z.string(),
|
|
3340
|
+
codeFingerprint: z.string(),
|
|
3341
|
+
recording: cacheRecordingSchema
|
|
3342
|
+
});
|
|
3343
|
+
/** Persisted per-owner cache file containing multiple cache entries. */
|
|
3344
|
+
const cacheFileSchema = z.object({
|
|
3345
|
+
version: z.literal(1),
|
|
3346
|
+
owner: z.string(),
|
|
3347
|
+
entries: z.record(z.string(), cacheEntrySchema)
|
|
1395
3348
|
});
|
|
1396
3349
|
//#endregion
|
|
1397
3350
|
//#region ../shared/src/schemas/chart.ts
|
|
@@ -1629,135 +3582,149 @@ const caseDetailSchema = z.object({
|
|
|
1629
3582
|
stack: z.string().optional()
|
|
1630
3583
|
}).nullable(),
|
|
1631
3584
|
/** Winning trial index for the persisted case detail. */
|
|
1632
|
-
trial: z.number()
|
|
3585
|
+
trial: z.number(),
|
|
3586
|
+
/**
|
|
3587
|
+
* Value-cache refs recorded by `evalTracer.cache(...)` calls made directly
|
|
3588
|
+
* from the case body (with no surrounding `traceSpan`). Span-bound refs are
|
|
3589
|
+
* stored on each owning span's `cache.refs` attribute instead.
|
|
3590
|
+
*/
|
|
3591
|
+
cacheRefs: z.array(traceCacheRefSchema).default([])
|
|
1633
3592
|
});
|
|
1634
3593
|
//#endregion
|
|
1635
|
-
//#region ../shared/src/schemas/
|
|
3594
|
+
//#region ../shared/src/schemas/config.ts
|
|
3595
|
+
/** Strategy used to collapse repeated trials into one stored case result. */
|
|
3596
|
+
const trialSelectionModeSchema = z.enum(["lowestScore", "median"]);
|
|
3597
|
+
/** Render formats supported by an LLM-call metric in the UI. */
|
|
3598
|
+
const llmCallMetricFormatSchema = z.enum([
|
|
3599
|
+
"string",
|
|
3600
|
+
"number",
|
|
3601
|
+
"duration",
|
|
3602
|
+
"json",
|
|
3603
|
+
"boolean"
|
|
3604
|
+
]);
|
|
3605
|
+
/** Where an LLM-call metric is rendered inside the LLM calls tab. */
|
|
3606
|
+
const llmCallMetricPlacementSchema = z.enum(["header", "body"]);
|
|
1636
3607
|
/**
|
|
1637
|
-
*
|
|
3608
|
+
* Schema for a single user-defined metric attached to LLM call rows.
|
|
1638
3609
|
*
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
3610
|
+
* Each metric reads `path` from the span's `attributes` and renders the value
|
|
3611
|
+
* with the configured `format` and `numberFormat`. `placements` controls
|
|
3612
|
+
* whether the metric appears as a chip on the collapsed row header, as a row
|
|
3613
|
+
* inside the expanded body, or both. Defaults to `['body']` when omitted.
|
|
1642
3614
|
*/
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
/**
|
|
1653
|
-
|
|
3615
|
+
const llmCallMetricSchema = z.object({
|
|
3616
|
+
/** Display label for the metric row or header chip. */
|
|
3617
|
+
label: z.string().min(1),
|
|
3618
|
+
/**
|
|
3619
|
+
* Optional hover tooltip shown on the metric. Useful when `label` is a
|
|
3620
|
+
* compact abbreviation (e.g. `'t/s'`) and the full meaning needs to be
|
|
3621
|
+
* surfaced on hover (e.g. `'Tokens per second'`).
|
|
3622
|
+
*/
|
|
3623
|
+
tooltip: z.string().min(1).optional(),
|
|
3624
|
+
/** Dot-path inside `span.attributes` used to read the value. */
|
|
3625
|
+
path: z.string().min(1),
|
|
3626
|
+
/** Render hint applied to the resolved value. Defaults to `'string'`. */
|
|
3627
|
+
format: llmCallMetricFormatSchema.optional(),
|
|
3628
|
+
/** Number presentation options applied when `format: 'number'`. */
|
|
3629
|
+
numberFormat: numberDisplayOptionsSchema.optional(),
|
|
3630
|
+
/**
|
|
3631
|
+
* Where the metric should appear in the LLM calls tab. Defaults to
|
|
3632
|
+
* `['body']` so metrics surface inside the expanded detail view only.
|
|
3633
|
+
*/
|
|
3634
|
+
placements: z.array(llmCallMetricPlacementSchema).nonempty().optional()
|
|
1654
3635
|
});
|
|
1655
|
-
/**
|
|
1656
|
-
const
|
|
1657
|
-
/**
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
3636
|
+
/** Schema for the global LLM calls config block in `agent-evals.config.ts`. */
|
|
3637
|
+
const llmCallsConfigSchema = z.object({
|
|
3638
|
+
/** Span kinds treated as LLM calls. Defaults to `['llm']`. */
|
|
3639
|
+
kinds: z.array(z.string().min(1)).optional(),
|
|
3640
|
+
/**
|
|
3641
|
+
* Attribute paths used to extract structured per-call fields. Each entry is
|
|
3642
|
+
* a dot-path inside `span.attributes`. Missing paths fall back to the
|
|
3643
|
+
* built-in defaults (e.g. `usage.inputTokens`, `costUsd`).
|
|
3644
|
+
*
|
|
3645
|
+
* Per-token-type cost paths (`inputCost`, `outputCost`, `cachedInputCost`,
|
|
3646
|
+
* `reasoningCost`) feed the cost breakdown table in the expanded row.
|
|
3647
|
+
* Record them as USD numbers alongside `costUsd` in your span attributes.
|
|
3648
|
+
*/
|
|
3649
|
+
attributes: z.object({
|
|
3650
|
+
model: z.string().optional(),
|
|
3651
|
+
provider: z.string().optional(),
|
|
3652
|
+
inputTokens: z.string().optional(),
|
|
3653
|
+
outputTokens: z.string().optional(),
|
|
3654
|
+
cachedInputTokens: z.string().optional(),
|
|
3655
|
+
cacheCreationInputTokens: z.string().optional(),
|
|
3656
|
+
reasoningTokens: z.string().optional(),
|
|
3657
|
+
totalTokens: z.string().optional(),
|
|
3658
|
+
cost: z.string().optional(),
|
|
3659
|
+
inputCost: z.string().optional(),
|
|
3660
|
+
outputCost: z.string().optional(),
|
|
3661
|
+
cachedInputCost: z.string().optional(),
|
|
3662
|
+
cacheCreationInputCost: z.string().optional(),
|
|
3663
|
+
reasoningCost: z.string().optional(),
|
|
3664
|
+
steps: z.string().optional(),
|
|
3665
|
+
finishReason: z.string().optional(),
|
|
3666
|
+
input: z.string().optional(),
|
|
3667
|
+
output: z.string().optional(),
|
|
3668
|
+
reasoning: z.string().optional(),
|
|
3669
|
+
toolCalls: z.string().optional()
|
|
3670
|
+
}).optional(),
|
|
3671
|
+
/** Custom user-defined metrics surfaced on each LLM call. */
|
|
3672
|
+
metrics: z.array(llmCallMetricSchema).optional()
|
|
1668
3673
|
});
|
|
1669
|
-
/**
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
"
|
|
1676
|
-
"
|
|
1677
|
-
"
|
|
1678
|
-
"
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
3674
|
+
/** Default LLM-calls config the UI uses before the workspace fetch resolves. */
|
|
3675
|
+
const DEFAULT_LLM_CALLS_CONFIG = {
|
|
3676
|
+
kinds: ["llm"],
|
|
3677
|
+
attributes: {
|
|
3678
|
+
model: "model",
|
|
3679
|
+
provider: "provider",
|
|
3680
|
+
inputTokens: "usage.inputTokens",
|
|
3681
|
+
outputTokens: "usage.outputTokens",
|
|
3682
|
+
cachedInputTokens: "usage.cachedInputTokens",
|
|
3683
|
+
cacheCreationInputTokens: "usage.cacheCreationInputTokens",
|
|
3684
|
+
reasoningTokens: "usage.reasoningTokens",
|
|
3685
|
+
totalTokens: "usage.totalTokens",
|
|
3686
|
+
cost: "costUsd",
|
|
3687
|
+
inputCost: "cost.inputUsd",
|
|
3688
|
+
outputCost: "cost.outputUsd",
|
|
3689
|
+
cachedInputCost: "cost.cachedInputUsd",
|
|
3690
|
+
cacheCreationInputCost: "cost.cacheCreationInputUsd",
|
|
3691
|
+
reasoningCost: "cost.reasoningUsd",
|
|
3692
|
+
steps: "steps",
|
|
3693
|
+
finishReason: "finishReason",
|
|
3694
|
+
input: "input",
|
|
3695
|
+
output: "output",
|
|
3696
|
+
reasoning: "reasoning",
|
|
3697
|
+
toolCalls: "toolCalls"
|
|
3698
|
+
},
|
|
3699
|
+
metrics: []
|
|
3700
|
+
};
|
|
1685
3701
|
/**
|
|
1686
|
-
*
|
|
3702
|
+
* Resolve the user-authored LLM-calls config to a fully-defaulted shape used
|
|
3703
|
+
* by the UI to derive the LLM calls tab.
|
|
1687
3704
|
*
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
3705
|
+
* - Missing or empty `kinds` falls back to `['llm']`.
|
|
3706
|
+
* - Missing `attributes.<field>` falls back to the corresponding default
|
|
3707
|
+
* attribute path.
|
|
3708
|
+
* - Missing `metrics[].format` defaults to `'string'`.
|
|
3709
|
+
* - Missing `metrics[].placements` defaults to `['body']`.
|
|
1690
3710
|
*/
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
kind: z.literal("incrementOutput"),
|
|
1709
|
-
key: z.string(),
|
|
1710
|
-
delta: z.number()
|
|
1711
|
-
}),
|
|
1712
|
-
z.object({
|
|
1713
|
-
kind: z.literal("checkpoint"),
|
|
1714
|
-
name: z.string(),
|
|
1715
|
-
data: z.unknown()
|
|
1716
|
-
}),
|
|
1717
|
-
z.object({
|
|
1718
|
-
kind: z.literal("subSpan"),
|
|
1719
|
-
span: serializedCacheSpanSchema
|
|
1720
|
-
})
|
|
1721
|
-
]);
|
|
1722
|
-
/** Captured observable effects + return value of a cached span body. */
|
|
1723
|
-
const cacheRecordingSchema = z.object({
|
|
1724
|
-
returnValue: z.unknown(),
|
|
1725
|
-
finalAttributes: z.record(z.string(), z.unknown()),
|
|
1726
|
-
finalStatus: z.enum([
|
|
1727
|
-
"running",
|
|
1728
|
-
"ok",
|
|
1729
|
-
"error",
|
|
1730
|
-
"cancelled"
|
|
1731
|
-
]).optional(),
|
|
1732
|
-
finalError: traceSpanErrorSchema.optional(),
|
|
1733
|
-
finalErrors: z.array(traceSpanErrorSchema).optional(),
|
|
1734
|
-
finalWarning: traceSpanWarningSchema.optional(),
|
|
1735
|
-
finalWarnings: z.array(traceSpanWarningSchema).optional(),
|
|
1736
|
-
ops: z.array(cacheRecordingOpSchema)
|
|
1737
|
-
});
|
|
1738
|
-
/** Persisted cache file containing metadata and a recording. */
|
|
1739
|
-
const cacheEntrySchema = z.object({
|
|
1740
|
-
version: z.literal(1),
|
|
1741
|
-
key: z.string(),
|
|
1742
|
-
namespace: z.string(),
|
|
1743
|
-
operationType: cacheOperationTypeSchema.optional(),
|
|
1744
|
-
operationName: z.string().optional(),
|
|
1745
|
-
spanName: z.string().optional(),
|
|
1746
|
-
spanKind: traceSpanKindSchema.optional(),
|
|
1747
|
-
storedAt: z.string(),
|
|
1748
|
-
codeFingerprint: z.string(),
|
|
1749
|
-
recording: cacheRecordingSchema
|
|
1750
|
-
});
|
|
1751
|
-
/** Persisted per-owner cache file containing multiple cache entries. */
|
|
1752
|
-
const cacheFileSchema = z.object({
|
|
1753
|
-
version: z.literal(1),
|
|
1754
|
-
owner: z.string(),
|
|
1755
|
-
entries: z.record(z.string(), cacheEntrySchema)
|
|
1756
|
-
});
|
|
1757
|
-
//#endregion
|
|
1758
|
-
//#region ../shared/src/schemas/config.ts
|
|
1759
|
-
/** Strategy used to collapse repeated trials into one stored case result. */
|
|
1760
|
-
const trialSelectionModeSchema = z.enum(["lowestScore", "median"]);
|
|
3711
|
+
function resolveLlmCallsConfig(input) {
|
|
3712
|
+
return {
|
|
3713
|
+
kinds: input?.kinds && input.kinds.length > 0 ? [...input.kinds] : [...DEFAULT_LLM_CALLS_CONFIG.kinds],
|
|
3714
|
+
attributes: {
|
|
3715
|
+
...DEFAULT_LLM_CALLS_CONFIG.attributes,
|
|
3716
|
+
...input?.attributes
|
|
3717
|
+
},
|
|
3718
|
+
metrics: (input?.metrics ?? []).map((m) => ({
|
|
3719
|
+
label: m.label,
|
|
3720
|
+
tooltip: m.tooltip,
|
|
3721
|
+
path: m.path,
|
|
3722
|
+
format: m.format ?? "string",
|
|
3723
|
+
numberFormat: m.numberFormat,
|
|
3724
|
+
placements: m.placements ? [...m.placements] : ["body"]
|
|
3725
|
+
}))
|
|
3726
|
+
};
|
|
3727
|
+
}
|
|
1761
3728
|
/** Zod schema for validating `agent-evals.config.ts` input. */
|
|
1762
3729
|
const agentEvalsConfigSchema = z.object({
|
|
1763
3730
|
workspaceRoot: z.string().optional(),
|
|
@@ -1767,9 +3734,12 @@ const agentEvalsConfigSchema = z.object({
|
|
|
1767
3734
|
concurrency: z.number().optional(),
|
|
1768
3735
|
staleAfterDays: z.number().optional(),
|
|
1769
3736
|
traceDisplay: traceDisplayInputConfigSchema.optional(),
|
|
3737
|
+
llmCalls: llmCallsConfigSchema.optional(),
|
|
1770
3738
|
cache: z.object({
|
|
1771
3739
|
enabled: z.boolean().optional(),
|
|
1772
3740
|
dir: z.string().optional(),
|
|
3741
|
+
maxEntriesPerNamespace: z.preprocess((value) => typeof value === "number" && Number.isFinite(value) ? value : void 0, z.number().optional()),
|
|
3742
|
+
maxEntriesByNamespace: z.record(z.string(), z.number()).optional(),
|
|
1773
3743
|
maxEntriesPerEval: z.preprocess((value) => typeof value === "number" && Number.isFinite(value) ? value : void 0, z.number().optional())
|
|
1774
3744
|
}).optional()
|
|
1775
3745
|
});
|
|
@@ -1966,6 +3936,240 @@ function getEvalTitle(evalLike) {
|
|
|
1966
3936
|
if (evalLike.title !== void 0) return evalLike.title;
|
|
1967
3937
|
return humanizeEvalId(evalLike.id);
|
|
1968
3938
|
}
|
|
3939
|
+
//#endregion
|
|
3940
|
+
//#region ../shared/src/utils/getNestedAttribute.ts
|
|
3941
|
+
function isRecord$3(value) {
|
|
3942
|
+
return typeof value === "object" && value !== null;
|
|
3943
|
+
}
|
|
3944
|
+
/**
|
|
3945
|
+
* Read a value from `source` by walking a dot-separated path.
|
|
3946
|
+
*
|
|
3947
|
+
* Returns `undefined` when any segment of the path is missing or when an
|
|
3948
|
+
* intermediate value is not a plain object. Used by trace-attribute display,
|
|
3949
|
+
* the LLM calls extractor, and any consumer that needs to look up nested
|
|
3950
|
+
* properties from a span's `attributes` record.
|
|
3951
|
+
*/
|
|
3952
|
+
function getNestedAttribute(value, path) {
|
|
3953
|
+
const parts = path.split(".");
|
|
3954
|
+
let current = value;
|
|
3955
|
+
for (const part of parts) {
|
|
3956
|
+
if (!isRecord$3(current) || !(part in current)) return;
|
|
3957
|
+
current = current[part];
|
|
3958
|
+
}
|
|
3959
|
+
return current;
|
|
3960
|
+
}
|
|
3961
|
+
//#endregion
|
|
3962
|
+
//#region ../shared/src/utils/extractLlmCalls.ts
|
|
3963
|
+
function readNumber$1(attributes, path) {
|
|
3964
|
+
const raw = getNestedAttribute(attributes, path);
|
|
3965
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : null;
|
|
3966
|
+
}
|
|
3967
|
+
function readString$1(attributes, path) {
|
|
3968
|
+
const raw = getNestedAttribute(attributes, path);
|
|
3969
|
+
return typeof raw === "string" && raw.length > 0 ? raw : null;
|
|
3970
|
+
}
|
|
3971
|
+
function computeLatencyMs(span) {
|
|
3972
|
+
if (span.endedAt === null) return null;
|
|
3973
|
+
const started = Date.parse(span.startedAt);
|
|
3974
|
+
const ended = Date.parse(span.endedAt);
|
|
3975
|
+
if (!Number.isFinite(started) || !Number.isFinite(ended)) return null;
|
|
3976
|
+
const delta = ended - started;
|
|
3977
|
+
return delta >= 0 ? delta : null;
|
|
3978
|
+
}
|
|
3979
|
+
function computeTotalTokens({ declared, input, output, cached, cacheCreation }) {
|
|
3980
|
+
if (declared !== null) return declared;
|
|
3981
|
+
if (input === null && output === null && cached === null && cacheCreation === null) return null;
|
|
3982
|
+
return (input ?? 0) + (output ?? 0) + (cached ?? 0) + (cacheCreation ?? 0);
|
|
3983
|
+
}
|
|
3984
|
+
function readSteps(attributes, path) {
|
|
3985
|
+
const raw = getNestedAttribute(attributes, path);
|
|
3986
|
+
if (Array.isArray(raw)) return {
|
|
3987
|
+
stepCount: raw.length,
|
|
3988
|
+
stepDetails: raw
|
|
3989
|
+
};
|
|
3990
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return {
|
|
3991
|
+
stepCount: raw,
|
|
3992
|
+
stepDetails: null
|
|
3993
|
+
};
|
|
3994
|
+
return {
|
|
3995
|
+
stepCount: null,
|
|
3996
|
+
stepDetails: null
|
|
3997
|
+
};
|
|
3998
|
+
}
|
|
3999
|
+
function collectWarnings(span) {
|
|
4000
|
+
const out = [];
|
|
4001
|
+
if (span.warning) out.push(span.warning);
|
|
4002
|
+
if (span.warnings) out.push(...span.warnings);
|
|
4003
|
+
return out;
|
|
4004
|
+
}
|
|
4005
|
+
function pickError(span) {
|
|
4006
|
+
if (span.error) return span.error;
|
|
4007
|
+
if (span.errors && span.errors.length > 0) return span.errors[0] ?? null;
|
|
4008
|
+
return null;
|
|
4009
|
+
}
|
|
4010
|
+
/**
|
|
4011
|
+
* Filter `spans` down to LLM calls and project each one to the structured
|
|
4012
|
+
* shape consumed by the LLM calls tab.
|
|
4013
|
+
*
|
|
4014
|
+
* Spans whose `kind` is not in `config.kinds` are dropped. Structured fields
|
|
4015
|
+
* (`model`, token counts, cost, etc.) are read via `getNestedAttribute` from
|
|
4016
|
+
* the configured paths, with safe coercion to `string | null` / `number |
|
|
4017
|
+
* null`. `totalTokens` falls back to a sum of input + output + cached when no
|
|
4018
|
+
* explicit total attribute is present. The `steps` attribute path may resolve
|
|
4019
|
+
* to either a number (rendered as the inference-round count) or an array of
|
|
4020
|
+
* per-step detail objects (rendered as a Steps section in the body, with
|
|
4021
|
+
* `stepCount` derived from the array length). `latencyMs` is `null` while the
|
|
4022
|
+
* span is still running. User-defined `metrics` whose path resolves to
|
|
4023
|
+
* `undefined` are dropped, but `null`, `0`, and `false` are preserved as
|
|
4024
|
+
* legitimate values worth displaying. Original span order is preserved so the
|
|
4025
|
+
* LLM calls tab matches the ordering in the Trace tab.
|
|
4026
|
+
*/
|
|
4027
|
+
function extractLlmCalls(spans, config) {
|
|
4028
|
+
const kindSet = new Set(config.kinds);
|
|
4029
|
+
const result = [];
|
|
4030
|
+
for (const span of spans) {
|
|
4031
|
+
if (!kindSet.has(span.kind)) continue;
|
|
4032
|
+
const attrs = span.attributes;
|
|
4033
|
+
const inputTokens = readNumber$1(attrs, config.attributes.inputTokens);
|
|
4034
|
+
const outputTokens = readNumber$1(attrs, config.attributes.outputTokens);
|
|
4035
|
+
const cachedInputTokens = readNumber$1(attrs, config.attributes.cachedInputTokens);
|
|
4036
|
+
const cacheCreationInputTokens = readNumber$1(attrs, config.attributes.cacheCreationInputTokens);
|
|
4037
|
+
const reasoningTokens = readNumber$1(attrs, config.attributes.reasoningTokens);
|
|
4038
|
+
const declaredTotalTokens = readNumber$1(attrs, config.attributes.totalTokens);
|
|
4039
|
+
const metrics = [];
|
|
4040
|
+
for (const metric of config.metrics) {
|
|
4041
|
+
const rawValue = getNestedAttribute(attrs, metric.path);
|
|
4042
|
+
if (rawValue === void 0) continue;
|
|
4043
|
+
metrics.push({
|
|
4044
|
+
label: metric.label,
|
|
4045
|
+
tooltip: metric.tooltip,
|
|
4046
|
+
rawValue,
|
|
4047
|
+
format: metric.format,
|
|
4048
|
+
numberFormat: metric.numberFormat,
|
|
4049
|
+
placements: metric.placements
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
result.push({
|
|
4053
|
+
id: span.id,
|
|
4054
|
+
name: span.name,
|
|
4055
|
+
kind: span.kind,
|
|
4056
|
+
status: span.status,
|
|
4057
|
+
model: readString$1(attrs, config.attributes.model),
|
|
4058
|
+
provider: readString$1(attrs, config.attributes.provider),
|
|
4059
|
+
inputTokens,
|
|
4060
|
+
outputTokens,
|
|
4061
|
+
cachedInputTokens,
|
|
4062
|
+
cacheCreationInputTokens,
|
|
4063
|
+
reasoningTokens,
|
|
4064
|
+
totalTokens: computeTotalTokens({
|
|
4065
|
+
declared: declaredTotalTokens,
|
|
4066
|
+
input: inputTokens,
|
|
4067
|
+
output: outputTokens,
|
|
4068
|
+
cached: cachedInputTokens,
|
|
4069
|
+
cacheCreation: cacheCreationInputTokens
|
|
4070
|
+
}),
|
|
4071
|
+
costUsd: readNumber$1(attrs, config.attributes.cost),
|
|
4072
|
+
inputCostUsd: readNumber$1(attrs, config.attributes.inputCost),
|
|
4073
|
+
outputCostUsd: readNumber$1(attrs, config.attributes.outputCost),
|
|
4074
|
+
cachedInputCostUsd: readNumber$1(attrs, config.attributes.cachedInputCost),
|
|
4075
|
+
cacheCreationInputCostUsd: readNumber$1(attrs, config.attributes.cacheCreationInputCost),
|
|
4076
|
+
reasoningCostUsd: readNumber$1(attrs, config.attributes.reasoningCost),
|
|
4077
|
+
...readSteps(attrs, config.attributes.steps),
|
|
4078
|
+
finishReason: readString$1(attrs, config.attributes.finishReason),
|
|
4079
|
+
latencyMs: computeLatencyMs(span),
|
|
4080
|
+
input: getNestedAttribute(attrs, config.attributes.input),
|
|
4081
|
+
output: getNestedAttribute(attrs, config.attributes.output),
|
|
4082
|
+
reasoning: getNestedAttribute(attrs, config.attributes.reasoning),
|
|
4083
|
+
toolCalls: getNestedAttribute(attrs, config.attributes.toolCalls),
|
|
4084
|
+
metrics,
|
|
4085
|
+
warnings: collectWarnings(span),
|
|
4086
|
+
error: pickError(span)
|
|
4087
|
+
});
|
|
4088
|
+
}
|
|
4089
|
+
return result;
|
|
4090
|
+
}
|
|
4091
|
+
//#endregion
|
|
4092
|
+
//#region ../shared/src/utils/extractCacheHits.ts
|
|
4093
|
+
function isRecord$2(value) {
|
|
4094
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4095
|
+
}
|
|
4096
|
+
function readString(attributes, key) {
|
|
4097
|
+
if (!isRecord$2(attributes)) return void 0;
|
|
4098
|
+
const value = attributes[key];
|
|
4099
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
4100
|
+
}
|
|
4101
|
+
function readNumber(attributes, key) {
|
|
4102
|
+
if (!isRecord$2(attributes)) return void 0;
|
|
4103
|
+
const value = attributes[key];
|
|
4104
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4105
|
+
}
|
|
4106
|
+
function readArray(attributes, key) {
|
|
4107
|
+
if (!isRecord$2(attributes)) return [];
|
|
4108
|
+
const value = attributes[key];
|
|
4109
|
+
return Array.isArray(value) ? value : [];
|
|
4110
|
+
}
|
|
4111
|
+
/**
|
|
4112
|
+
* Collect every `status === 'hit'` cache event recorded for a case run.
|
|
4113
|
+
*
|
|
4114
|
+
* Walks `spans` for span-level cache hits (`attributes['cache.status'] ===
|
|
4115
|
+
* 'hit'`) and per-span value-cache refs (`attributes['cache.refs']`), then
|
|
4116
|
+
* appends spanless value-cache refs persisted on the case scope. Non-hit
|
|
4117
|
+
* statuses (`miss`/`refresh`/`bypass`) are skipped — they remain visible
|
|
4118
|
+
* inline in the Trace tab.
|
|
4119
|
+
*/
|
|
4120
|
+
function extractCacheHits(spans, caseCacheRefs) {
|
|
4121
|
+
const entries = [];
|
|
4122
|
+
for (const span of spans) {
|
|
4123
|
+
if (readString(span.attributes, "cache.status") === "hit") {
|
|
4124
|
+
const key = readString(span.attributes, "cache.key");
|
|
4125
|
+
const namespace = readString(span.attributes, "cache.namespace");
|
|
4126
|
+
if (key !== void 0 && namespace !== void 0) entries.push({
|
|
4127
|
+
id: span.id,
|
|
4128
|
+
source: "span",
|
|
4129
|
+
origin: "span",
|
|
4130
|
+
name: span.name,
|
|
4131
|
+
namespace,
|
|
4132
|
+
key,
|
|
4133
|
+
storedAt: readString(span.attributes, "cache.storedAt"),
|
|
4134
|
+
age: readNumber(span.attributes, "cache.age"),
|
|
4135
|
+
spanId: span.id
|
|
4136
|
+
});
|
|
4137
|
+
}
|
|
4138
|
+
const rawRefs = readArray(span.attributes, "cache.refs");
|
|
4139
|
+
for (const [index, rawRef] of rawRefs.entries()) {
|
|
4140
|
+
const parsed = traceCacheRefSchema.safeParse(rawRef);
|
|
4141
|
+
if (!parsed.success) continue;
|
|
4142
|
+
const ref = parsed.data;
|
|
4143
|
+
if (ref.status !== "hit") continue;
|
|
4144
|
+
entries.push({
|
|
4145
|
+
id: `${span.id}:value:${String(index)}`,
|
|
4146
|
+
source: "value",
|
|
4147
|
+
origin: "span",
|
|
4148
|
+
name: ref.name,
|
|
4149
|
+
namespace: ref.namespace,
|
|
4150
|
+
key: ref.key,
|
|
4151
|
+
storedAt: ref.storedAt,
|
|
4152
|
+
age: ref.age,
|
|
4153
|
+
spanId: span.id
|
|
4154
|
+
});
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
4157
|
+
for (const [index, ref] of caseCacheRefs.entries()) {
|
|
4158
|
+
if (ref.status !== "hit") continue;
|
|
4159
|
+
entries.push({
|
|
4160
|
+
id: `case:value:${String(index)}`,
|
|
4161
|
+
source: "value",
|
|
4162
|
+
origin: "caseRoot",
|
|
4163
|
+
name: ref.name,
|
|
4164
|
+
namespace: ref.namespace,
|
|
4165
|
+
key: ref.key,
|
|
4166
|
+
storedAt: ref.storedAt,
|
|
4167
|
+
age: ref.age,
|
|
4168
|
+
spanId: void 0
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
return entries;
|
|
4172
|
+
}
|
|
1969
4173
|
z.enum([
|
|
1970
4174
|
"discovery.updated",
|
|
1971
4175
|
"run.started",
|
|
@@ -2009,17 +4213,17 @@ const createRunRequestSchema = z.object({
|
|
|
2009
4213
|
const updateManualScoreRequestSchema = z.object({ value: z.number().min(0).max(1).nullable() });
|
|
2010
4214
|
//#endregion
|
|
2011
4215
|
//#region ../runner/src/cacheStore.ts
|
|
2012
|
-
const
|
|
4216
|
+
const defaultMaxEntriesPerNamespace = 100;
|
|
2013
4217
|
/**
|
|
2014
4218
|
* Create a filesystem-backed cache adapter rooted at `<workspaceRoot>/<dir>`.
|
|
2015
4219
|
*
|
|
2016
|
-
* Cache entries are grouped into one inspectable JSON file per
|
|
2017
|
-
*
|
|
4220
|
+
* Cache entries are grouped into one inspectable JSON file per cache owner.
|
|
4221
|
+
* Writes use a short-lived lock directory plus `<name>.tmp` + atomic
|
|
2018
4222
|
* `rename` to avoid partial reads and lost updates under concurrent access.
|
|
2019
4223
|
*/
|
|
2020
4224
|
function createFsCacheStore(options) {
|
|
2021
4225
|
const cacheDir = resolve(options.workspaceRoot, options.dir ?? ".agent-evals/cache");
|
|
2022
|
-
const
|
|
4226
|
+
const defaultMaxEntries = normalizeMaxEntries(options.maxEntriesPerNamespace);
|
|
2023
4227
|
return {
|
|
2024
4228
|
dir() {
|
|
2025
4229
|
return cacheDir;
|
|
@@ -2038,7 +4242,7 @@ function createFsCacheStore(options) {
|
|
|
2038
4242
|
entries: pruneEntries({
|
|
2039
4243
|
...(await readCacheFile(cacheDir, owner))?.entries ?? {},
|
|
2040
4244
|
[entry.key]: entry
|
|
2041
|
-
},
|
|
4245
|
+
}, entry.namespace, maxEntriesForNamespace(entry.namespace, defaultMaxEntries, options.maxEntriesByNamespace), entry.key)
|
|
2042
4246
|
});
|
|
2043
4247
|
});
|
|
2044
4248
|
},
|
|
@@ -2142,10 +4346,14 @@ function createBufferedCacheStore(backingStore) {
|
|
|
2142
4346
|
}
|
|
2143
4347
|
};
|
|
2144
4348
|
}
|
|
2145
|
-
function normalizeMaxEntries(value) {
|
|
2146
|
-
if (value === void 0 || !Number.isFinite(value) || value <= 0) return
|
|
4349
|
+
function normalizeMaxEntries(value, fallback = defaultMaxEntriesPerNamespace) {
|
|
4350
|
+
if (value === void 0 || !Number.isFinite(value) || value <= 0) return fallback;
|
|
2147
4351
|
return Math.floor(value);
|
|
2148
4352
|
}
|
|
4353
|
+
function maxEntriesForNamespace(namespace, defaultMaxEntries, maxEntriesByNamespace) {
|
|
4354
|
+
const namespaceMaxEntries = maxEntriesByNamespace?.[namespace];
|
|
4355
|
+
return namespaceMaxEntries === void 0 ? defaultMaxEntries : normalizeMaxEntries(namespaceMaxEntries, defaultMaxEntries);
|
|
4356
|
+
}
|
|
2149
4357
|
function ownerFromNamespace(namespace) {
|
|
2150
4358
|
const [owner] = namespace.split("__");
|
|
2151
4359
|
return owner === void 0 || owner.length === 0 ? namespace : owner;
|
|
@@ -2186,16 +4394,16 @@ async function writeCacheFile(cacheDir, cacheFile) {
|
|
|
2186
4394
|
await writeFile(tmpPath, JSON.stringify(cacheFile, null, 2));
|
|
2187
4395
|
await rename(tmpPath, filePath);
|
|
2188
4396
|
}
|
|
2189
|
-
function pruneEntries(entries, maxEntries, protectedKey) {
|
|
2190
|
-
const sorted = Object.values(entries).toSorted((a, b) => a.storedAt < b.storedAt ? 1 : -1);
|
|
4397
|
+
function pruneEntries(entries, namespace, maxEntries, protectedKey) {
|
|
4398
|
+
const sorted = Object.values(entries).filter((entry) => entry.namespace === namespace).toSorted((a, b) => a.storedAt < b.storedAt ? 1 : -1);
|
|
2191
4399
|
const kept = /* @__PURE__ */ new Map();
|
|
2192
4400
|
const protectedEntry = entries[protectedKey];
|
|
2193
|
-
if (protectedEntry
|
|
4401
|
+
if (protectedEntry?.namespace === namespace) kept.set(protectedEntry.key, protectedEntry);
|
|
2194
4402
|
for (const entry of sorted) {
|
|
2195
4403
|
if (kept.size >= maxEntries) break;
|
|
2196
4404
|
kept.set(entry.key, entry);
|
|
2197
4405
|
}
|
|
2198
|
-
return Object.fromEntries(
|
|
4406
|
+
return Object.fromEntries(Object.values(entries).filter((entry) => entry.namespace !== namespace || kept.has(entry.key)).toSorted((a, b) => a.key < b.key ? -1 : 1).map((entry) => [entry.key, entry]));
|
|
2199
4407
|
}
|
|
2200
4408
|
async function withCacheFileLock(filePath, fn) {
|
|
2201
4409
|
const lockPath = `${filePath}.lock`;
|
|
@@ -2908,15 +5116,6 @@ async function runWithModuleIsolation(context, fn) {
|
|
|
2908
5116
|
function isRecord$1(value) {
|
|
2909
5117
|
return typeof value === "object" && value !== null;
|
|
2910
5118
|
}
|
|
2911
|
-
function getNestedAttribute(value, path) {
|
|
2912
|
-
const parts = path.split(".");
|
|
2913
|
-
let current = value;
|
|
2914
|
-
for (const part of parts) {
|
|
2915
|
-
if (!isRecord$1(current) || !(part in current)) return;
|
|
2916
|
-
current = current[part];
|
|
2917
|
-
}
|
|
2918
|
-
return current;
|
|
2919
|
-
}
|
|
2920
5119
|
function mergeNestedAttribute(value, path, attributeValue) {
|
|
2921
5120
|
const root = value === void 0 ? {} : { ...value };
|
|
2922
5121
|
const parts = path.split(".");
|
|
@@ -3126,7 +5325,8 @@ async function runCase(params) {
|
|
|
3126
5325
|
columns,
|
|
3127
5326
|
assertionFailures: scope.assertionFailures,
|
|
3128
5327
|
error: errorInfo,
|
|
3129
|
-
trial
|
|
5328
|
+
trial,
|
|
5329
|
+
cacheRefs: scope.caseCacheRefs
|
|
3130
5330
|
};
|
|
3131
5331
|
if (Object.keys(scoringTraces).length > 0) caseDetail.scoringTraces = scoringTraces;
|
|
3132
5332
|
return {
|
|
@@ -3514,4 +5714,4 @@ function toLastRunStatus(status) {
|
|
|
3514
5714
|
return status === "pending" ? null : status;
|
|
3515
5715
|
}
|
|
3516
5716
|
//#endregion
|
|
3517
|
-
export { evalChartAxisSchema as $,
|
|
5717
|
+
export { evalChartAxisSchema as $, setEvalOutput as $t, deriveScopedSummaryFromCases as A, columnFormatSchema as At, llmCallsConfigSchema as B, evalSpan as Bt, updateManualScoreRequestSchema as C, traceDisplayInputConfigSchema as Ct, getNestedAttribute as D, traceSpanWarningSchema as Dt, extractLlmCalls as E, traceSpanSchema as Et, DEFAULT_LLM_CALLS_CONFIG as F, repoFileRefSchema as Ft, caseRowSchema as G, appendToEvalOutput as Gt, trialSelectionModeSchema as H, hashCacheKey as Ht, agentEvalsConfigSchema as I, runArtifactRefSchema as It, evalStatItemSchema as J, getEvalCaseInput as Jt, evalFreshnessStatusSchema as K, evalAssert as Kt, llmCallMetricFormatSchema as L, z$1 as Lt, deriveStatusFromChildStatuses as M, fileRefSchema as Mt, runManifestSchema as N, jsonCellSchema as Nt, getEvalTitle as O, cellValueSchema as Ot, runSummarySchema as P, numberDisplayOptionsSchema as Pt, evalChartAggregateSchema as Q, runInEvalScope as Qt, llmCallMetricPlacementSchema as R, buildTraceTree as Rt, createRunRequestSchema as S, traceDisplayConfigSchema as St, extractCacheHits as T, traceSpanKindSchema as Tt, assertionFailureSchema as U, hashCacheKeySync as Ut, resolveLlmCallsConfig as V, evalTracer as Vt, caseDetailSchema as W, EvalAssertionError as Wt, evalSummarySchema as X, isInEvalScope as Xt, evalStatsConfigSchema as Y, incrementEvalOutput as Yt, scoreTraceSchema as Z, mergeEvalOutput as Zt, loadEvalModule as _, traceCacheRefSchema as _t, loadPersistedRunSnapshot as a, evalChartTypeSchema as at, normalizeScoreDef as b, traceAttributeDisplayPlacementSchema as bt, persistCaseDetail as c, cacheFileSchema as ct, recomputePersistedCaseStatus as d, cacheOperationTypeSchema as dt, setScopeCacheContext as en, evalChartBuiltinMetricSchema as et, runTouchesEval as f, cacheRecordingOpSchema as ft, setLatestRunInfoMap as g, spanCacheOptionsSchema as gt, getTargetEvalIds as h, serializedCacheSpanSchema as ht, getLatestRunInfos as i, evalChartTooltipExtraSchema as it, deriveStatusFromCaseRows as j, columnKindSchema as jt, getEvalDisplayStatus as k, columnDefSchema as kt, persistRunState as l, cacheListItemSchema as lt, buildEvalSummary as m, cacheStatusSchema as mt, generateRunId as n, defineEval as nn, evalChartConfigSchema as nt, loadPersistedRunSnapshots as o, evalChartsConfigSchema as ot, resolveArtifactPath as p, cacheRecordingSchema as pt, evalStatAggregateSchema as q, getCurrentScope as qt, getLastRunStatuses as r, getEvalRegistry as rn, evalChartMetricSchema as rt, nextShortIdFromSnapshots as s, cacheEntrySchema as st, executeRun as t, repoFile as tn, evalChartColorSchema as tt, recomputeEvalStatusesInRuns as u, cacheModeSchema as ut, loadConfig as v, traceAttributeDisplayFormatSchema as vt, sseEnvelopeSchema as w, traceSpanErrorSchema as wt, createFsCacheStore as x, traceAttributeDisplaySchema as xt, buildDeclaredColumnDefs as y, traceAttributeDisplayInputSchema as yt, llmCallMetricSchema as z, captureEvalSpanError as zt };
|