@remnic/bench 9.69.38 → 9.69.40
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.
|
@@ -2635,6 +2635,576 @@ ${renderProvenance(result, provenance)}
|
|
|
2635
2635
|
`;
|
|
2636
2636
|
}
|
|
2637
2637
|
|
|
2638
|
+
// src/provider-config.ts
|
|
2639
|
+
var BUILT_IN_PROVIDERS = [
|
|
2640
|
+
"openai",
|
|
2641
|
+
"anthropic",
|
|
2642
|
+
"ollama",
|
|
2643
|
+
"litellm",
|
|
2644
|
+
"local-llm",
|
|
2645
|
+
"codex-cli",
|
|
2646
|
+
"claude-cli"
|
|
2647
|
+
];
|
|
2648
|
+
var BENCH_REASONING_EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
2649
|
+
function quotedList(values) {
|
|
2650
|
+
const quoted = values.map((value) => `"${value}"`);
|
|
2651
|
+
return quoted.length <= 1 ? quoted.join("") : `${quoted.slice(0, -1).join(", ")}, or ${quoted[quoted.length - 1]}`;
|
|
2652
|
+
}
|
|
2653
|
+
var PROVIDER_ENUM_LIST = quotedList(BUILT_IN_PROVIDERS);
|
|
2654
|
+
var REASONING_EFFORT_LIST = quotedList(BENCH_REASONING_EFFORTS);
|
|
2655
|
+
var PROVIDER_CONFIG_FIELD_MARKERS = {
|
|
2656
|
+
provider: true,
|
|
2657
|
+
model: true,
|
|
2658
|
+
rubricVersion: true,
|
|
2659
|
+
baseUrl: true,
|
|
2660
|
+
apiKey: true,
|
|
2661
|
+
retryOptions: true,
|
|
2662
|
+
providerRequestTimeoutMs: true,
|
|
2663
|
+
disableThinking: true,
|
|
2664
|
+
reasoningEffort: true,
|
|
2665
|
+
responderContextBudgetChars: true,
|
|
2666
|
+
responderPromptBudgetChars: true,
|
|
2667
|
+
temperature: true,
|
|
2668
|
+
seed: true
|
|
2669
|
+
};
|
|
2670
|
+
var PROVIDER_CONFIG_VALIDATED_FIELDS = Object.keys(PROVIDER_CONFIG_FIELD_MARKERS);
|
|
2671
|
+
function isPositiveInteger(value) {
|
|
2672
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
2673
|
+
}
|
|
2674
|
+
function isNonNegativeFinite2(value) {
|
|
2675
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
2676
|
+
}
|
|
2677
|
+
function isNonNegativeInteger(value) {
|
|
2678
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
2679
|
+
}
|
|
2680
|
+
function checkOptional(container, key, accept, reason) {
|
|
2681
|
+
if (!(key in container)) {
|
|
2682
|
+
return null;
|
|
2683
|
+
}
|
|
2684
|
+
return accept(container[key]) ? null : { fieldPath: key, reason };
|
|
2685
|
+
}
|
|
2686
|
+
function firstIssue(...issues) {
|
|
2687
|
+
for (const issue of issues) {
|
|
2688
|
+
if (issue !== null) {
|
|
2689
|
+
return issue;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
return null;
|
|
2693
|
+
}
|
|
2694
|
+
function validateProviderConfigShape(value) {
|
|
2695
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2696
|
+
return { fieldPath: "", reason: "must be a provider config ({ provider, model })" };
|
|
2697
|
+
}
|
|
2698
|
+
const config = value;
|
|
2699
|
+
if (!BUILT_IN_PROVIDERS.includes(config.provider)) {
|
|
2700
|
+
return { fieldPath: "provider", reason: `must be one of ${PROVIDER_ENUM_LIST}` };
|
|
2701
|
+
}
|
|
2702
|
+
if (typeof config.model !== "string") {
|
|
2703
|
+
return { fieldPath: "model", reason: "must be a string" };
|
|
2704
|
+
}
|
|
2705
|
+
const rootIssue = firstIssue(
|
|
2706
|
+
checkOptional(config, "rubricVersion", (v) => typeof v === "string", "must be a string when present"),
|
|
2707
|
+
checkOptional(config, "baseUrl", (v) => typeof v === "string", "must be a string when present"),
|
|
2708
|
+
checkOptional(config, "apiKey", (v) => typeof v === "string", "must be a string when present"),
|
|
2709
|
+
checkOptional(config, "providerRequestTimeoutMs", isPositiveInteger, "must be a positive integer when present"),
|
|
2710
|
+
checkOptional(config, "disableThinking", (v) => typeof v === "boolean", "must be a boolean when present"),
|
|
2711
|
+
checkOptional(
|
|
2712
|
+
config,
|
|
2713
|
+
"reasoningEffort",
|
|
2714
|
+
(v) => BENCH_REASONING_EFFORTS.includes(v),
|
|
2715
|
+
`must be one of ${REASONING_EFFORT_LIST} when present`
|
|
2716
|
+
),
|
|
2717
|
+
checkOptional(config, "responderContextBudgetChars", isPositiveInteger, "must be a positive integer when present"),
|
|
2718
|
+
checkOptional(config, "responderPromptBudgetChars", isPositiveInteger, "must be a positive integer when present"),
|
|
2719
|
+
checkOptional(config, "temperature", isNonNegativeFinite2, "must be a finite non-negative number when present"),
|
|
2720
|
+
checkOptional(config, "seed", isNonNegativeInteger, "must be a non-negative integer when present")
|
|
2721
|
+
);
|
|
2722
|
+
if (rootIssue) {
|
|
2723
|
+
return rootIssue;
|
|
2724
|
+
}
|
|
2725
|
+
if (!("retryOptions" in config)) {
|
|
2726
|
+
return null;
|
|
2727
|
+
}
|
|
2728
|
+
const retry = config.retryOptions;
|
|
2729
|
+
if (typeof retry !== "object" || retry === null || Array.isArray(retry)) {
|
|
2730
|
+
return { fieldPath: "retryOptions", reason: "must be an object when present" };
|
|
2731
|
+
}
|
|
2732
|
+
const retryOptions = retry;
|
|
2733
|
+
const retryIssue = firstIssue(
|
|
2734
|
+
checkOptional(retryOptions, "maxAttempts", isPositiveInteger, "must be a positive integer when present"),
|
|
2735
|
+
checkOptional(retryOptions, "baseBackoffMs", isNonNegativeFinite2, "must be a finite non-negative number when present"),
|
|
2736
|
+
checkOptional(retryOptions, "timeoutMs", isNonNegativeFinite2, "must be a finite non-negative number when present"),
|
|
2737
|
+
checkOptional(retryOptions, "retryOnTimeout", (v) => typeof v === "boolean", "must be a boolean when present"),
|
|
2738
|
+
checkOptional(retryOptions, "max429WaitMs", isNonNegativeFinite2, "must be a finite non-negative number when present")
|
|
2739
|
+
);
|
|
2740
|
+
return retryIssue ? { fieldPath: `retryOptions.${retryIssue.fieldPath}`, reason: retryIssue.reason } : null;
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
// src/legacy-artifact.ts
|
|
2744
|
+
var LEGACY_ARTIFACT_SHAPE_VERSION = 1;
|
|
2745
|
+
function isRecord2(value) {
|
|
2746
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2747
|
+
}
|
|
2748
|
+
function isFiniteNumber(value) {
|
|
2749
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
2750
|
+
}
|
|
2751
|
+
var ArtifactRejected = class extends Error {
|
|
2752
|
+
constructor(reason) {
|
|
2753
|
+
super(reason);
|
|
2754
|
+
this.reason = reason;
|
|
2755
|
+
}
|
|
2756
|
+
reason;
|
|
2757
|
+
};
|
|
2758
|
+
function reject(reason) {
|
|
2759
|
+
throw new ArtifactRejected(reason);
|
|
2760
|
+
}
|
|
2761
|
+
function optionalString(where, container, key) {
|
|
2762
|
+
if (!(key in container)) {
|
|
2763
|
+
return void 0;
|
|
2764
|
+
}
|
|
2765
|
+
if (typeof container[key] !== "string") {
|
|
2766
|
+
reject(`${where} must be a string when present`);
|
|
2767
|
+
}
|
|
2768
|
+
return container[key];
|
|
2769
|
+
}
|
|
2770
|
+
function optionalFiniteNumber(where, container, key) {
|
|
2771
|
+
if (!(key in container)) {
|
|
2772
|
+
return void 0;
|
|
2773
|
+
}
|
|
2774
|
+
if (!isFiniteNumber(container[key])) {
|
|
2775
|
+
reject(`${where} must be a finite number when present`);
|
|
2776
|
+
}
|
|
2777
|
+
return container[key];
|
|
2778
|
+
}
|
|
2779
|
+
function optionalMode(where, container) {
|
|
2780
|
+
if (!("mode" in container)) {
|
|
2781
|
+
return void 0;
|
|
2782
|
+
}
|
|
2783
|
+
if (container.mode !== "quick" && container.mode !== "full") {
|
|
2784
|
+
reject(`${where} must be "quick" or "full" when present`);
|
|
2785
|
+
}
|
|
2786
|
+
return container.mode;
|
|
2787
|
+
}
|
|
2788
|
+
function optionalTier(where, container) {
|
|
2789
|
+
if (!("benchmarkTier" in container)) {
|
|
2790
|
+
return void 0;
|
|
2791
|
+
}
|
|
2792
|
+
const value = container.benchmarkTier;
|
|
2793
|
+
if (value !== "published" && value !== "remnic" && value !== "custom") {
|
|
2794
|
+
reject(`${where} must be "published", "remnic", or "custom" when present`);
|
|
2795
|
+
}
|
|
2796
|
+
return value;
|
|
2797
|
+
}
|
|
2798
|
+
function optionalProviderConfig(where, value) {
|
|
2799
|
+
if (value === void 0 || value === null) {
|
|
2800
|
+
return null;
|
|
2801
|
+
}
|
|
2802
|
+
const issue = validateProviderConfigShape(value);
|
|
2803
|
+
if (issue) {
|
|
2804
|
+
reject(
|
|
2805
|
+
issue.fieldPath ? `${where}.${issue.fieldPath} ${issue.reason}` : `${where} ${issue.reason} or null when present`
|
|
2806
|
+
);
|
|
2807
|
+
}
|
|
2808
|
+
return value;
|
|
2809
|
+
}
|
|
2810
|
+
function optionalSeeds(where, value) {
|
|
2811
|
+
if (value === void 0) {
|
|
2812
|
+
return void 0;
|
|
2813
|
+
}
|
|
2814
|
+
if (!Array.isArray(value) || !value.every(isFiniteNumber)) {
|
|
2815
|
+
reject(`${where} must be an array of finite numbers when present`);
|
|
2816
|
+
}
|
|
2817
|
+
return value;
|
|
2818
|
+
}
|
|
2819
|
+
function isBenchRuntimeProfile(value) {
|
|
2820
|
+
return value === "baseline" || value === "real" || value === "openclaw-chain" || value === "local-lab";
|
|
2821
|
+
}
|
|
2822
|
+
function normalizeMetricAggregate(where, raw, taskCount) {
|
|
2823
|
+
if (isRecord2(raw) && isFiniteNumber(raw.mean) && isFiniteNumber(raw.median) && isFiniteNumber(raw.stdDev) && isFiniteNumber(raw.min) && isFiniteNumber(raw.max)) {
|
|
2824
|
+
return raw;
|
|
2825
|
+
}
|
|
2826
|
+
let mean2;
|
|
2827
|
+
let rawMedian;
|
|
2828
|
+
let rawStdDev;
|
|
2829
|
+
let rawMin;
|
|
2830
|
+
let rawMax;
|
|
2831
|
+
if (isFiniteNumber(raw)) {
|
|
2832
|
+
mean2 = raw;
|
|
2833
|
+
} else if (isRecord2(raw)) {
|
|
2834
|
+
for (const field of ["mean", "median", "stdDev", "min", "max"]) {
|
|
2835
|
+
if (field in raw && !isFiniteNumber(raw[field])) {
|
|
2836
|
+
reject(`${where}.${field} must be a finite number when present`);
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
if (isFiniteNumber(raw.mean)) {
|
|
2840
|
+
mean2 = raw.mean;
|
|
2841
|
+
}
|
|
2842
|
+
if (isFiniteNumber(raw.median)) {
|
|
2843
|
+
rawMedian = raw.median;
|
|
2844
|
+
}
|
|
2845
|
+
if (isFiniteNumber(raw.stdDev)) {
|
|
2846
|
+
rawStdDev = raw.stdDev;
|
|
2847
|
+
}
|
|
2848
|
+
if (isFiniteNumber(raw.min)) {
|
|
2849
|
+
rawMin = raw.min;
|
|
2850
|
+
}
|
|
2851
|
+
if (isFiniteNumber(raw.max)) {
|
|
2852
|
+
rawMax = raw.max;
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
if (mean2 === void 0) {
|
|
2856
|
+
reject(`${where} must be a finite number or an object with a finite mean number`);
|
|
2857
|
+
}
|
|
2858
|
+
if (rawMedian !== void 0 && rawStdDev !== void 0 && rawMin !== void 0 && rawMax !== void 0) {
|
|
2859
|
+
return {
|
|
2860
|
+
mean: mean2,
|
|
2861
|
+
median: rawMedian,
|
|
2862
|
+
stdDev: rawStdDev,
|
|
2863
|
+
min: rawMin,
|
|
2864
|
+
max: rawMax
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
if (taskCount === 1) {
|
|
2868
|
+
return {
|
|
2869
|
+
mean: mean2,
|
|
2870
|
+
median: rawMedian ?? mean2,
|
|
2871
|
+
stdDev: rawStdDev ?? 0,
|
|
2872
|
+
min: rawMin ?? mean2,
|
|
2873
|
+
max: rawMax ?? mean2
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2876
|
+
if (taskCount === 0) {
|
|
2877
|
+
reject(
|
|
2878
|
+
`${where} missing required fields (median, stdDev, min, max); mean-only upgrade requires exactly one recognized task`
|
|
2879
|
+
);
|
|
2880
|
+
}
|
|
2881
|
+
reject(
|
|
2882
|
+
`${where} missing required multi-sample fields (median, stdDev, min, max) for multi-task run (taskCount=${taskCount})`
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2885
|
+
function upgradeMeta(legacy, recognizedTaskCount) {
|
|
2886
|
+
if (!isRecord2(legacy.meta)) {
|
|
2887
|
+
reject("meta with non-empty id, benchmark, and timestamp strings is required");
|
|
2888
|
+
}
|
|
2889
|
+
const meta = legacy.meta;
|
|
2890
|
+
for (const key of ["id", "benchmark", "timestamp"]) {
|
|
2891
|
+
const value = meta[key];
|
|
2892
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2893
|
+
reject(`meta.${key} must be a non-empty string`);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
const taskCount = recognizedTaskCount;
|
|
2897
|
+
const upgraded = {
|
|
2898
|
+
id: meta.id,
|
|
2899
|
+
benchmark: meta.benchmark,
|
|
2900
|
+
timestamp: meta.timestamp,
|
|
2901
|
+
// Old UI display default for an absent tier.
|
|
2902
|
+
benchmarkTier: optionalTier("meta.benchmarkTier", meta) ?? "custom",
|
|
2903
|
+
// Provenance is not knowable from a legacy artifact: recognition
|
|
2904
|
+
// rejects any payload with a present provenance key, so the only
|
|
2905
|
+
// honest value here is the explicit "unknown" marker.
|
|
2906
|
+
version: "unknown",
|
|
2907
|
+
remnicVersion: "unknown",
|
|
2908
|
+
gitSha: "unknown",
|
|
2909
|
+
// Old UI display default for an absent mode.
|
|
2910
|
+
mode: optionalMode("meta.mode", meta) ?? "quick",
|
|
2911
|
+
// Old UI fell back to the task count when runCount was absent.
|
|
2912
|
+
runCount: optionalFiniteNumber("meta.runCount", meta, "runCount") ?? taskCount,
|
|
2913
|
+
seeds: optionalSeeds("meta.seeds", meta.seeds) ?? []
|
|
2914
|
+
};
|
|
2915
|
+
const metaExtras = upgraded;
|
|
2916
|
+
for (const key of [
|
|
2917
|
+
"runId",
|
|
2918
|
+
"gitDirty",
|
|
2919
|
+
"gitDirtyEntryCount",
|
|
2920
|
+
"splitType",
|
|
2921
|
+
"qrelsSealedHash",
|
|
2922
|
+
"judgePromptHash",
|
|
2923
|
+
"datasetHash",
|
|
2924
|
+
"canaryScore",
|
|
2925
|
+
"canaryFloor",
|
|
2926
|
+
"status",
|
|
2927
|
+
"failureReason"
|
|
2928
|
+
]) {
|
|
2929
|
+
if (!(key in meta)) {
|
|
2930
|
+
continue;
|
|
2931
|
+
}
|
|
2932
|
+
if (key === "canaryFloor") {
|
|
2933
|
+
const floorVal = optionalFiniteNumber("meta.canaryFloor", meta, "canaryFloor");
|
|
2934
|
+
if (floorVal !== void 0) {
|
|
2935
|
+
if (floorVal < 0) {
|
|
2936
|
+
reject("meta.canaryFloor must be a non-negative number when present");
|
|
2937
|
+
}
|
|
2938
|
+
metaExtras[key] = floorVal;
|
|
2939
|
+
}
|
|
2940
|
+
continue;
|
|
2941
|
+
}
|
|
2942
|
+
if (key === "canaryScore" || key === "gitDirtyEntryCount") {
|
|
2943
|
+
const numeric = optionalFiniteNumber(`meta.${key}`, meta, key);
|
|
2944
|
+
if (numeric !== void 0) {
|
|
2945
|
+
metaExtras[key] = numeric;
|
|
2946
|
+
}
|
|
2947
|
+
continue;
|
|
2948
|
+
}
|
|
2949
|
+
if (key === "runId" || key === "qrelsSealedHash" || key === "judgePromptHash" || key === "datasetHash" || key === "failureReason") {
|
|
2950
|
+
const text = optionalString(`meta.${key}`, meta, key);
|
|
2951
|
+
if (text !== void 0) {
|
|
2952
|
+
metaExtras[key] = text;
|
|
2953
|
+
}
|
|
2954
|
+
continue;
|
|
2955
|
+
}
|
|
2956
|
+
if (key === "gitDirty") {
|
|
2957
|
+
if (typeof meta.gitDirty !== "boolean") {
|
|
2958
|
+
reject("meta.gitDirty must be a boolean when present");
|
|
2959
|
+
}
|
|
2960
|
+
metaExtras.gitDirty = meta.gitDirty;
|
|
2961
|
+
continue;
|
|
2962
|
+
}
|
|
2963
|
+
if (key === "status") {
|
|
2964
|
+
if (meta.status !== "complete" && meta.status !== "partial") {
|
|
2965
|
+
reject('meta.status must be "complete" or "partial" when present');
|
|
2966
|
+
}
|
|
2967
|
+
metaExtras.status = meta.status;
|
|
2968
|
+
continue;
|
|
2969
|
+
}
|
|
2970
|
+
if (meta.splitType !== "public" && meta.splitType !== "holdout") {
|
|
2971
|
+
reject('meta.splitType must be "public" or "holdout" when present');
|
|
2972
|
+
}
|
|
2973
|
+
metaExtras.splitType = meta.splitType;
|
|
2974
|
+
}
|
|
2975
|
+
return upgraded;
|
|
2976
|
+
}
|
|
2977
|
+
function upgradeConfig(legacy) {
|
|
2978
|
+
if (!("config" in legacy)) {
|
|
2979
|
+
return {
|
|
2980
|
+
systemProvider: null,
|
|
2981
|
+
judgeProvider: null,
|
|
2982
|
+
adapterMode: "unknown",
|
|
2983
|
+
remnicConfig: {}
|
|
2984
|
+
};
|
|
2985
|
+
}
|
|
2986
|
+
if (!isRecord2(legacy.config)) {
|
|
2987
|
+
reject("config must be an object when present");
|
|
2988
|
+
}
|
|
2989
|
+
const config = legacy.config;
|
|
2990
|
+
const upgraded = {
|
|
2991
|
+
systemProvider: optionalProviderConfig("config.systemProvider", config.systemProvider),
|
|
2992
|
+
judgeProvider: optionalProviderConfig("config.judgeProvider", config.judgeProvider),
|
|
2993
|
+
// Old UI display default for an absent adapter mode.
|
|
2994
|
+
adapterMode: optionalString("config.adapterMode", config, "adapterMode") ?? "unknown",
|
|
2995
|
+
remnicConfig: {}
|
|
2996
|
+
};
|
|
2997
|
+
if ("remnicConfig" in config) {
|
|
2998
|
+
if (!isRecord2(config.remnicConfig)) {
|
|
2999
|
+
reject("config.remnicConfig must be an object when present");
|
|
3000
|
+
}
|
|
3001
|
+
upgraded.remnicConfig = config.remnicConfig;
|
|
3002
|
+
}
|
|
3003
|
+
if ("internalProvider" in config && config.internalProvider !== void 0) {
|
|
3004
|
+
upgraded.internalProvider = optionalProviderConfig("config.internalProvider", config.internalProvider);
|
|
3005
|
+
}
|
|
3006
|
+
if ("runtimeProfile" in config && config.runtimeProfile !== void 0) {
|
|
3007
|
+
const profile = config.runtimeProfile;
|
|
3008
|
+
if (profile !== null && !isBenchRuntimeProfile(profile)) {
|
|
3009
|
+
reject(
|
|
3010
|
+
'config.runtimeProfile must be "baseline", "real", "openclaw-chain", "local-lab", or null when present'
|
|
3011
|
+
);
|
|
3012
|
+
}
|
|
3013
|
+
upgraded.runtimeProfile = profile;
|
|
3014
|
+
}
|
|
3015
|
+
if ("benchmarkOptions" in config && config.benchmarkOptions !== void 0) {
|
|
3016
|
+
if (!isRecord2(config.benchmarkOptions)) {
|
|
3017
|
+
reject("config.benchmarkOptions must be an object when present");
|
|
3018
|
+
}
|
|
3019
|
+
upgraded.benchmarkOptions = config.benchmarkOptions;
|
|
3020
|
+
}
|
|
3021
|
+
return upgraded;
|
|
3022
|
+
}
|
|
3023
|
+
function upgradeCost(legacy) {
|
|
3024
|
+
if (!("cost" in legacy)) {
|
|
3025
|
+
return {
|
|
3026
|
+
totalTokens: 0,
|
|
3027
|
+
inputTokens: 0,
|
|
3028
|
+
outputTokens: 0,
|
|
3029
|
+
estimatedCostUsd: 0,
|
|
3030
|
+
totalLatencyMs: 0,
|
|
3031
|
+
meanQueryLatencyMs: 0
|
|
3032
|
+
};
|
|
3033
|
+
}
|
|
3034
|
+
if (!isRecord2(legacy.cost)) {
|
|
3035
|
+
reject("cost must be an object when present");
|
|
3036
|
+
}
|
|
3037
|
+
const cost = legacy.cost;
|
|
3038
|
+
const upgraded = {
|
|
3039
|
+
totalTokens: optionalFiniteNumber("cost.totalTokens", cost, "totalTokens") ?? 0,
|
|
3040
|
+
inputTokens: optionalFiniteNumber("cost.inputTokens", cost, "inputTokens") ?? 0,
|
|
3041
|
+
outputTokens: optionalFiniteNumber("cost.outputTokens", cost, "outputTokens") ?? 0,
|
|
3042
|
+
estimatedCostUsd: optionalFiniteNumber("cost.estimatedCostUsd", cost, "estimatedCostUsd") ?? 0,
|
|
3043
|
+
totalLatencyMs: optionalFiniteNumber("cost.totalLatencyMs", cost, "totalLatencyMs") ?? 0,
|
|
3044
|
+
meanQueryLatencyMs: optionalFiniteNumber("cost.meanQueryLatencyMs", cost, "meanQueryLatencyMs") ?? 0
|
|
3045
|
+
};
|
|
3046
|
+
if ("judgeModelCalls" in cost) {
|
|
3047
|
+
upgraded.judgeModelCalls = optionalFiniteNumber("cost.judgeModelCalls", cost, "judgeModelCalls");
|
|
3048
|
+
}
|
|
3049
|
+
return upgraded;
|
|
3050
|
+
}
|
|
3051
|
+
function upgradeTask(where, task) {
|
|
3052
|
+
if (!isRecord2(task) || typeof task.taskId !== "string" || task.taskId.trim().length === 0) {
|
|
3053
|
+
return null;
|
|
3054
|
+
}
|
|
3055
|
+
if ("scores" in task && (!isRecord2(task.scores) || !Object.values(task.scores).every(isFiniteNumber))) {
|
|
3056
|
+
reject(`${where}.scores must map metric names to finite numbers when present`);
|
|
3057
|
+
}
|
|
3058
|
+
if ("tokens" in task && !isRecord2(task.tokens)) {
|
|
3059
|
+
reject(`${where}.tokens must be an object when present`);
|
|
3060
|
+
}
|
|
3061
|
+
const tokensSource = isRecord2(task.tokens) ? task.tokens : {};
|
|
3062
|
+
const upgraded = {
|
|
3063
|
+
taskId: task.taskId,
|
|
3064
|
+
// Old UI display defaults for absent task text fields.
|
|
3065
|
+
question: optionalString(`${where}.question`, task, "question") ?? "",
|
|
3066
|
+
expected: optionalString(`${where}.expected`, task, "expected") ?? "",
|
|
3067
|
+
actual: optionalString(`${where}.actual`, task, "actual") ?? "",
|
|
3068
|
+
scores: isRecord2(task.scores) ? task.scores : {},
|
|
3069
|
+
latencyMs: optionalFiniteNumber(`${where}.latencyMs`, task, "latencyMs") ?? 0,
|
|
3070
|
+
tokens: {
|
|
3071
|
+
input: optionalFiniteNumber(`${where}.tokens.input`, tokensSource, "input") ?? 0,
|
|
3072
|
+
output: optionalFiniteNumber(`${where}.tokens.output`, tokensSource, "output") ?? 0
|
|
3073
|
+
}
|
|
3074
|
+
};
|
|
3075
|
+
const taskExtras = upgraded;
|
|
3076
|
+
for (const key of ["goldMemories", "attributionWitness", "details"]) {
|
|
3077
|
+
if (key in task) {
|
|
3078
|
+
taskExtras[key] = task[key];
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
return upgraded;
|
|
3082
|
+
}
|
|
3083
|
+
function upgradeResults(legacy) {
|
|
3084
|
+
const upgraded = { tasks: [], aggregates: {} };
|
|
3085
|
+
if (!("results" in legacy)) {
|
|
3086
|
+
return upgraded;
|
|
3087
|
+
}
|
|
3088
|
+
if (!isRecord2(legacy.results)) {
|
|
3089
|
+
reject("results must be an object when present");
|
|
3090
|
+
}
|
|
3091
|
+
const results = legacy.results;
|
|
3092
|
+
if ("tasks" in results) {
|
|
3093
|
+
if (!Array.isArray(results.tasks)) {
|
|
3094
|
+
reject("results.tasks must be an array when present");
|
|
3095
|
+
}
|
|
3096
|
+
upgraded.tasks = results.tasks.map((task, index) => upgradeTask(`results.tasks[${index}]`, task)).filter((task) => task !== null);
|
|
3097
|
+
}
|
|
3098
|
+
if ("aggregates" in results) {
|
|
3099
|
+
if (!isRecord2(results.aggregates)) {
|
|
3100
|
+
reject("results.aggregates must be an object when present");
|
|
3101
|
+
}
|
|
3102
|
+
const normalizedAggregates = {};
|
|
3103
|
+
for (const [metricName, rawValue] of Object.entries(results.aggregates)) {
|
|
3104
|
+
normalizedAggregates[metricName] = normalizeMetricAggregate(
|
|
3105
|
+
`results.aggregates.${metricName}`,
|
|
3106
|
+
rawValue,
|
|
3107
|
+
upgraded.tasks.length
|
|
3108
|
+
);
|
|
3109
|
+
}
|
|
3110
|
+
upgraded.aggregates = normalizedAggregates;
|
|
3111
|
+
}
|
|
3112
|
+
const resultsExtras = upgraded;
|
|
3113
|
+
if ("categoryAggregates" in results && results.categoryAggregates !== void 0) {
|
|
3114
|
+
if (!isRecord2(results.categoryAggregates)) {
|
|
3115
|
+
reject("results.categoryAggregates must be an object when present");
|
|
3116
|
+
}
|
|
3117
|
+
const normalizedCategoryAggregates = {};
|
|
3118
|
+
for (const [catName, catAggs] of Object.entries(results.categoryAggregates)) {
|
|
3119
|
+
if (!isRecord2(catAggs)) {
|
|
3120
|
+
reject(`results.categoryAggregates.${catName} must be an object`);
|
|
3121
|
+
}
|
|
3122
|
+
const catNormalized = {};
|
|
3123
|
+
for (const [metricName, rawVal] of Object.entries(catAggs)) {
|
|
3124
|
+
catNormalized[metricName] = normalizeMetricAggregate(
|
|
3125
|
+
`results.categoryAggregates.${catName}.${metricName}`,
|
|
3126
|
+
rawVal,
|
|
3127
|
+
upgraded.tasks.length
|
|
3128
|
+
);
|
|
3129
|
+
}
|
|
3130
|
+
normalizedCategoryAggregates[catName] = catNormalized;
|
|
3131
|
+
}
|
|
3132
|
+
resultsExtras.categoryAggregates = normalizedCategoryAggregates;
|
|
3133
|
+
}
|
|
3134
|
+
if ("statistics" in results) {
|
|
3135
|
+
resultsExtras.statistics = results.statistics;
|
|
3136
|
+
}
|
|
3137
|
+
const hasCategoryAggregate = isRecord2(resultsExtras.categoryAggregates) && Object.values(resultsExtras.categoryAggregates).some(
|
|
3138
|
+
(category) => isRecord2(category) && Object.keys(category).length > 0
|
|
3139
|
+
);
|
|
3140
|
+
if (upgraded.tasks.length === 0 && Object.keys(upgraded.aggregates).length === 0 && !hasCategoryAggregate) {
|
|
3141
|
+
reject("results must contain at least one recognized task or aggregate");
|
|
3142
|
+
}
|
|
3143
|
+
return upgraded;
|
|
3144
|
+
}
|
|
3145
|
+
function upgradeEnvironment(legacy) {
|
|
3146
|
+
if (!("environment" in legacy)) {
|
|
3147
|
+
return { os: "unknown", nodeVersion: "unknown" };
|
|
3148
|
+
}
|
|
3149
|
+
if (!isRecord2(legacy.environment)) {
|
|
3150
|
+
reject("environment must be an object when present");
|
|
3151
|
+
}
|
|
3152
|
+
const environment = legacy.environment;
|
|
3153
|
+
const upgraded = {
|
|
3154
|
+
os: optionalString("environment.os", environment, "os") ?? "unknown",
|
|
3155
|
+
nodeVersion: optionalString("environment.nodeVersion", environment, "nodeVersion") ?? "unknown"
|
|
3156
|
+
};
|
|
3157
|
+
if ("hardware" in environment) {
|
|
3158
|
+
upgraded.hardware = environment.hardware;
|
|
3159
|
+
}
|
|
3160
|
+
return upgraded;
|
|
3161
|
+
}
|
|
3162
|
+
function recognizeLegacyBenchmarkArtifact(value) {
|
|
3163
|
+
if (!isRecord2(value)) {
|
|
3164
|
+
return { ok: false, reason: "artifact is not a JSON object" };
|
|
3165
|
+
}
|
|
3166
|
+
if (isRecord2(value.meta)) {
|
|
3167
|
+
const meta = value.meta;
|
|
3168
|
+
const modernProvenance = "version" in meta || "remnicVersion" in meta || "gitSha" in meta;
|
|
3169
|
+
const modernTier = meta.benchmarkTier === "published" || meta.benchmarkTier === "remnic";
|
|
3170
|
+
const modernIntegrity = INTEGRITY_META_FIELDS.some((key) => key in meta);
|
|
3171
|
+
if (modernProvenance || modernTier || modernIntegrity) {
|
|
3172
|
+
return {
|
|
3173
|
+
ok: false,
|
|
3174
|
+
reason: !("results" in value) ? "modern provenance/integrity markers present; missing results is not a legacy artifact" : "modern provenance/integrity markers present; not a legacy artifact"
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
try {
|
|
3179
|
+
return {
|
|
3180
|
+
ok: true,
|
|
3181
|
+
shapeVersion: LEGACY_ARTIFACT_SHAPE_VERSION,
|
|
3182
|
+
result: (() => {
|
|
3183
|
+
const results = upgradeResults(value);
|
|
3184
|
+
const upgraded = {
|
|
3185
|
+
meta: upgradeMeta(value, results.tasks.length),
|
|
3186
|
+
config: upgradeConfig(value),
|
|
3187
|
+
cost: upgradeCost(value),
|
|
3188
|
+
results,
|
|
3189
|
+
environment: upgradeEnvironment(value)
|
|
3190
|
+
};
|
|
3191
|
+
if (!("results" in value)) {
|
|
3192
|
+
reject("results must contain at least one recognized task or aggregate");
|
|
3193
|
+
}
|
|
3194
|
+
return upgraded;
|
|
3195
|
+
})()
|
|
3196
|
+
};
|
|
3197
|
+
} catch (error) {
|
|
3198
|
+
if (error instanceof ArtifactRejected) {
|
|
3199
|
+
return { ok: false, reason: error.reason };
|
|
3200
|
+
}
|
|
3201
|
+
return {
|
|
3202
|
+
ok: false,
|
|
3203
|
+
reason: error instanceof Error ? error.message : "legacy artifact upgrade failed"
|
|
3204
|
+
};
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
|
|
2638
3208
|
// src/results-store.ts
|
|
2639
3209
|
var BASELINE_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
2640
3210
|
var REPRO_MANIFEST_FILENAME = "MANIFEST.json";
|
|
@@ -2667,7 +3237,7 @@ function isBenchmarkMode(value) {
|
|
|
2667
3237
|
function isObjectRecord(value) {
|
|
2668
3238
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
2669
3239
|
}
|
|
2670
|
-
function
|
|
3240
|
+
function isFiniteNumber2(value) {
|
|
2671
3241
|
return typeof value === "number" && Number.isFinite(value);
|
|
2672
3242
|
}
|
|
2673
3243
|
async function loadBenchmarkReportCardProvenance(outputDir, resultId) {
|
|
@@ -2693,12 +3263,12 @@ function isProviderConfigLike(value) {
|
|
|
2693
3263
|
if (value === null) {
|
|
2694
3264
|
return true;
|
|
2695
3265
|
}
|
|
2696
|
-
return
|
|
3266
|
+
return validateProviderConfigShape(value) === null;
|
|
2697
3267
|
}
|
|
2698
3268
|
function isNonEmptyString(value) {
|
|
2699
3269
|
return typeof value === "string" && value.trim().length > 0;
|
|
2700
3270
|
}
|
|
2701
|
-
function
|
|
3271
|
+
function isNonNegativeInteger2(value) {
|
|
2702
3272
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
2703
3273
|
}
|
|
2704
3274
|
function isUniqueMemoryIdList(value) {
|
|
@@ -2716,7 +3286,7 @@ function isTaskAttributionWitnessLike(value, goldMemories) {
|
|
|
2716
3286
|
return false;
|
|
2717
3287
|
}
|
|
2718
3288
|
const runtime = value.runtime;
|
|
2719
|
-
if (!isObjectRecord(runtime) || !isNonEmptyString(runtime.qmdCollection) || !isNonEmptyString(runtime.qmdIndex) || !
|
|
3289
|
+
if (!isObjectRecord(runtime) || !isNonEmptyString(runtime.qmdCollection) || !isNonEmptyString(runtime.qmdIndex) || !isNonNegativeInteger2(runtime.qmdMaxResults) || typeof runtime.attributionThreshold !== "number" || !Number.isFinite(runtime.attributionThreshold) || runtime.attributionThreshold < 0 || runtime.attributionThreshold > 1) {
|
|
2720
3290
|
return false;
|
|
2721
3291
|
}
|
|
2722
3292
|
if (!Array.isArray(value.golds) || goldMemories !== void 0 && value.golds.length !== goldMemories.length) {
|
|
@@ -2733,7 +3303,7 @@ function isTaskAttributionWitnessLike(value, goldMemories) {
|
|
|
2733
3303
|
}
|
|
2734
3304
|
const sessionIds = /* @__PURE__ */ new Set();
|
|
2735
3305
|
for (const retrieval of value.retrievals) {
|
|
2736
|
-
if (!isObjectRecord(retrieval) || !isNonEmptyString(retrieval.sessionId) || sessionIds.has(retrieval.sessionId) || !(retrieval.appliedCap === null ||
|
|
3306
|
+
if (!isObjectRecord(retrieval) || !isNonEmptyString(retrieval.sessionId) || sessionIds.has(retrieval.sessionId) || !(retrieval.appliedCap === null || isNonNegativeInteger2(retrieval.appliedCap)) || !isUniqueMemoryIdList(retrieval.atCapMemoryIds) || !isUniqueMemoryIdList(retrieval.headroomMemoryIds)) {
|
|
2737
3307
|
return false;
|
|
2738
3308
|
}
|
|
2739
3309
|
sessionIds.add(retrieval.sessionId);
|
|
@@ -2752,6 +3322,9 @@ function isTaskAttributionWitnessLike(value, goldMemories) {
|
|
|
2752
3322
|
}
|
|
2753
3323
|
return true;
|
|
2754
3324
|
}
|
|
3325
|
+
function isMetricAggregate(value) {
|
|
3326
|
+
return isObjectRecord(value) && isFiniteNumber2(value.mean) && isFiniteNumber2(value.median) && isFiniteNumber2(value.stdDev) && isFiniteNumber2(value.min) && isFiniteNumber2(value.max);
|
|
3327
|
+
}
|
|
2755
3328
|
function isBenchmarkResult(value) {
|
|
2756
3329
|
if (!isObjectRecord(value)) {
|
|
2757
3330
|
return false;
|
|
@@ -2760,7 +3333,7 @@ function isBenchmarkResult(value) {
|
|
|
2760
3333
|
if (!isObjectRecord(meta)) {
|
|
2761
3334
|
return false;
|
|
2762
3335
|
}
|
|
2763
|
-
const hasValidMeta = typeof meta.id === "string" && typeof meta.benchmark === "string" && (meta.benchmarkTier === "published" || meta.benchmarkTier === "remnic" || meta.benchmarkTier === "custom") && typeof meta.version === "string" && typeof meta.remnicVersion === "string" && typeof meta.gitSha === "string" && typeof meta.timestamp === "string" && isBenchmarkMode(meta.mode) &&
|
|
3336
|
+
const hasValidMeta = typeof meta.id === "string" && typeof meta.benchmark === "string" && (meta.benchmarkTier === "published" || meta.benchmarkTier === "remnic" || meta.benchmarkTier === "custom") && typeof meta.version === "string" && typeof meta.remnicVersion === "string" && typeof meta.gitSha === "string" && typeof meta.timestamp === "string" && isBenchmarkMode(meta.mode) && isFiniteNumber2(meta.runCount) && Array.isArray(meta.seeds) && meta.seeds.every(isFiniteNumber2) && (meta.canaryFloor === void 0 || isFiniteNumber2(meta.canaryFloor) && meta.canaryFloor >= 0) && (meta.canaryScore === void 0 || isFiniteNumber2(meta.canaryScore)) && (meta.failureReason === void 0 || typeof meta.failureReason === "string") && (meta.runId === void 0 || typeof meta.runId === "string") && (meta.gitDirty === void 0 || typeof meta.gitDirty === "boolean") && (meta.gitDirtyEntryCount === void 0 || isFiniteNumber2(meta.gitDirtyEntryCount)) && (meta.splitType === void 0 || meta.splitType === "public" || meta.splitType === "holdout") && (meta.qrelsSealedHash === void 0 || typeof meta.qrelsSealedHash === "string") && (meta.judgePromptHash === void 0 || typeof meta.judgePromptHash === "string") && (meta.datasetHash === void 0 || typeof meta.datasetHash === "string") && (meta.status === void 0 || meta.status === "complete" || meta.status === "partial");
|
|
2764
3337
|
if (!hasValidMeta) {
|
|
2765
3338
|
return false;
|
|
2766
3339
|
}
|
|
@@ -2769,13 +3342,23 @@ function isBenchmarkResult(value) {
|
|
|
2769
3342
|
return false;
|
|
2770
3343
|
}
|
|
2771
3344
|
const cost = value.cost;
|
|
2772
|
-
if (!isObjectRecord(cost) || !
|
|
3345
|
+
if (!isObjectRecord(cost) || !isFiniteNumber2(cost.totalTokens) || !isFiniteNumber2(cost.inputTokens) || !isFiniteNumber2(cost.outputTokens) || !isFiniteNumber2(cost.estimatedCostUsd) || !isFiniteNumber2(cost.totalLatencyMs) || !isFiniteNumber2(cost.meanQueryLatencyMs)) {
|
|
2773
3346
|
return false;
|
|
2774
3347
|
}
|
|
2775
3348
|
const results = value.results;
|
|
2776
|
-
if (!isObjectRecord(results) || !Array.isArray(results.tasks) || !results.tasks.every(isTaskResultLike) || !isObjectRecord(results.aggregates)) {
|
|
3349
|
+
if (!isObjectRecord(results) || !Array.isArray(results.tasks) || !results.tasks.every(isTaskResultLike) || !isObjectRecord(results.aggregates) || !Object.values(results.aggregates).every(isMetricAggregate)) {
|
|
2777
3350
|
return false;
|
|
2778
3351
|
}
|
|
3352
|
+
if (results.categoryAggregates !== void 0) {
|
|
3353
|
+
if (!isObjectRecord(results.categoryAggregates)) {
|
|
3354
|
+
return false;
|
|
3355
|
+
}
|
|
3356
|
+
for (const catAgg of Object.values(results.categoryAggregates)) {
|
|
3357
|
+
if (!isObjectRecord(catAgg) || !Object.values(catAgg).every(isMetricAggregate)) {
|
|
3358
|
+
return false;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
2779
3362
|
const environment = value.environment;
|
|
2780
3363
|
return isObjectRecord(environment) && typeof environment.os === "string" && typeof environment.nodeVersion === "string" && (environment.hardware === void 0 || typeof environment.hardware === "string");
|
|
2781
3364
|
}
|
|
@@ -2791,7 +3374,7 @@ function isTaskResultLike(value) {
|
|
|
2791
3374
|
if (value.attributionWitness !== void 0 && !isTaskAttributionWitnessLike(value.attributionWitness, goldMemories)) {
|
|
2792
3375
|
return false;
|
|
2793
3376
|
}
|
|
2794
|
-
return typeof value.taskId === "string" && typeof value.question === "string" && typeof value.expected === "string" && typeof value.actual === "string" && isObjectRecord(value.scores) && Object.values(value.scores).every(
|
|
3377
|
+
return typeof value.taskId === "string" && typeof value.question === "string" && typeof value.expected === "string" && typeof value.actual === "string" && isObjectRecord(value.scores) && Object.values(value.scores).every(isFiniteNumber2) && isFiniteNumber2(value.latencyMs) && isObjectRecord(tokens) && isFiniteNumber2(tokens.input) && isFiniteNumber2(tokens.output);
|
|
2795
3378
|
}
|
|
2796
3379
|
function isStoredBenchmarkBaseline(value) {
|
|
2797
3380
|
if (!value || typeof value !== "object") {
|
|
@@ -2847,10 +3430,16 @@ function toBaselineSummary(baseline, filePath) {
|
|
|
2847
3430
|
async function loadBenchmarkResult(filePath) {
|
|
2848
3431
|
const content = await readFile3(filePath, "utf8");
|
|
2849
3432
|
const parsed = JSON.parse(content);
|
|
2850
|
-
if (
|
|
2851
|
-
|
|
3433
|
+
if (isBenchmarkResult(parsed)) {
|
|
3434
|
+
return parsed;
|
|
2852
3435
|
}
|
|
2853
|
-
|
|
3436
|
+
const legacy = recognizeLegacyBenchmarkArtifact(parsed);
|
|
3437
|
+
if (legacy.ok && isBenchmarkResult(legacy.result)) {
|
|
3438
|
+
return legacy.result;
|
|
3439
|
+
}
|
|
3440
|
+
throw new Error(
|
|
3441
|
+
`Invalid benchmark result file: ${filePath}${legacy.ok ? " (legacy artifact failed canonical re-validation)" : ` (${legacy.reason})`}`
|
|
3442
|
+
);
|
|
2854
3443
|
}
|
|
2855
3444
|
async function listBenchmarkResults(outputDir) {
|
|
2856
3445
|
if (!fs.existsSync(outputDir)) {
|
|
@@ -3372,10 +3961,10 @@ function sha256Buffer(value) {
|
|
|
3372
3961
|
}
|
|
3373
3962
|
async function sha256File(filePath) {
|
|
3374
3963
|
const hash = createHash3("sha256");
|
|
3375
|
-
await new Promise((resolve2,
|
|
3964
|
+
await new Promise((resolve2, reject2) => {
|
|
3376
3965
|
const stream = createReadStream(filePath);
|
|
3377
3966
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
3378
|
-
stream.on("error",
|
|
3967
|
+
stream.on("error", reject2);
|
|
3379
3968
|
stream.on("end", resolve2);
|
|
3380
3969
|
});
|
|
3381
3970
|
return hash.digest("hex");
|
|
@@ -13257,8 +13846,8 @@ function finalizeResult(state, status, invalidReason) {
|
|
|
13257
13846
|
}
|
|
13258
13847
|
function raceAbort(operation, signal) {
|
|
13259
13848
|
if (signal.aborted) return Promise.reject(new DOMException("aborted", "AbortError"));
|
|
13260
|
-
return new Promise((resolve2,
|
|
13261
|
-
const onAbort = () =>
|
|
13849
|
+
return new Promise((resolve2, reject2) => {
|
|
13850
|
+
const onAbort = () => reject2(new DOMException("aborted", "AbortError"));
|
|
13262
13851
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
13263
13852
|
operation.then(
|
|
13264
13853
|
(value) => {
|
|
@@ -13267,7 +13856,7 @@ function raceAbort(operation, signal) {
|
|
|
13267
13856
|
},
|
|
13268
13857
|
(error) => {
|
|
13269
13858
|
signal.removeEventListener("abort", onAbort);
|
|
13270
|
-
|
|
13859
|
+
reject2(error);
|
|
13271
13860
|
}
|
|
13272
13861
|
);
|
|
13273
13862
|
});
|
|
@@ -14049,8 +14638,8 @@ function finalizeResult2(state, status, invalidReason, evidence) {
|
|
|
14049
14638
|
}
|
|
14050
14639
|
async function raceSignal(operation, signal) {
|
|
14051
14640
|
if (signal.aborted) throw new DOMException("aborted", "AbortError");
|
|
14052
|
-
const { promise: aborted, reject } = Promise.withResolvers();
|
|
14053
|
-
const onAbort = () =>
|
|
14641
|
+
const { promise: aborted, reject: reject2 } = Promise.withResolvers();
|
|
14642
|
+
const onAbort = () => reject2(new DOMException("aborted", "AbortError"));
|
|
14054
14643
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
14055
14644
|
try {
|
|
14056
14645
|
return await Promise.race([operation, aborted]);
|