pullfrog 0.1.93 → 0.1.95
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/cli.mjs +1162 -1334
- package/dist/index.js +1159 -1331
- package/dist/internal.js +24 -19
- package/dist/utils/codexHome.d.ts +2 -0
- package/dist/utils/github.d.ts +1 -1
- package/package.json +2 -10
- package/dist/yes/index.d.ts +0 -59
- package/dist/yes/standard-schema.d.ts +0 -117
- package/dist/yes.js +0 -1290
package/dist/index.js
CHANGED
|
@@ -3682,7 +3682,7 @@ var require_util2 = __commonJS({
|
|
|
3682
3682
|
"use strict";
|
|
3683
3683
|
var { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = require_constants2();
|
|
3684
3684
|
var { getGlobalOrigin } = require_global();
|
|
3685
|
-
var { performance:
|
|
3685
|
+
var { performance: performance9 } = __require("perf_hooks");
|
|
3686
3686
|
var { isBlobLike, toUSVString, ReadableStreamFrom } = require_util();
|
|
3687
3687
|
var assert3 = __require("assert");
|
|
3688
3688
|
var { isUint8Array } = __require("util/types");
|
|
@@ -3845,7 +3845,7 @@ var require_util2 = __commonJS({
|
|
|
3845
3845
|
}
|
|
3846
3846
|
}
|
|
3847
3847
|
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
|
|
3848
|
-
return
|
|
3848
|
+
return performance9.now();
|
|
3849
3849
|
}
|
|
3850
3850
|
function createOpaqueTimingInfo(timingInfo) {
|
|
3851
3851
|
return {
|
|
@@ -45129,7 +45129,7 @@ var require_util9 = __commonJS({
|
|
|
45129
45129
|
var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants9();
|
|
45130
45130
|
var { getGlobalOrigin } = require_global3();
|
|
45131
45131
|
var { collectAnHTTPQuotedString, parseMIMEType } = require_data_url();
|
|
45132
|
-
var { performance:
|
|
45132
|
+
var { performance: performance9 } = __require("node:perf_hooks");
|
|
45133
45133
|
var { ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util8();
|
|
45134
45134
|
var assert3 = __require("node:assert");
|
|
45135
45135
|
var { isUint8Array } = __require("node:util/types");
|
|
@@ -45284,7 +45284,7 @@ var require_util9 = __commonJS({
|
|
|
45284
45284
|
};
|
|
45285
45285
|
}
|
|
45286
45286
|
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
|
|
45287
|
-
return coarsenTime(
|
|
45287
|
+
return coarsenTime(performance9.now(), crossOriginIsolatedCapability);
|
|
45288
45288
|
}
|
|
45289
45289
|
function createOpaqueTimingInfo(timingInfo) {
|
|
45290
45290
|
return {
|
|
@@ -74206,9 +74206,9 @@ var require_validate = __commonJS({
|
|
|
74206
74206
|
}
|
|
74207
74207
|
}
|
|
74208
74208
|
function returnResults(it) {
|
|
74209
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
74209
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
74210
74210
|
if (schemaEnv.$async) {
|
|
74211
|
-
gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${
|
|
74211
|
+
gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError2}(${names_1.default.vErrors})`));
|
|
74212
74212
|
} else {
|
|
74213
74213
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
74214
74214
|
if (opts.unevaluated)
|
|
@@ -74560,14 +74560,14 @@ var require_validation_error = __commonJS({
|
|
|
74560
74560
|
"node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js"(exports) {
|
|
74561
74561
|
"use strict";
|
|
74562
74562
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74563
|
-
var
|
|
74563
|
+
var ValidationError2 = class extends Error {
|
|
74564
74564
|
constructor(errors) {
|
|
74565
74565
|
super("validation failed");
|
|
74566
74566
|
this.errors = errors;
|
|
74567
74567
|
this.ajv = this.validation = true;
|
|
74568
74568
|
}
|
|
74569
74569
|
};
|
|
74570
|
-
exports.default =
|
|
74570
|
+
exports.default = ValidationError2;
|
|
74571
74571
|
}
|
|
74572
74572
|
});
|
|
74573
74573
|
|
|
@@ -75565,7 +75565,7 @@ var require_fast_uri = __commonJS({
|
|
|
75565
75565
|
normalizeString(uri, options);
|
|
75566
75566
|
} else if (typeof uri === "object") {
|
|
75567
75567
|
uri = /** @type {T} */
|
|
75568
|
-
parse6(
|
|
75568
|
+
parse6(serialize2(uri, options), options);
|
|
75569
75569
|
}
|
|
75570
75570
|
return uri;
|
|
75571
75571
|
}
|
|
@@ -75600,13 +75600,13 @@ var require_fast_uri = __commonJS({
|
|
|
75600
75600
|
throw new Error(resolved.error);
|
|
75601
75601
|
}
|
|
75602
75602
|
schemelessOptions.skipEscape = true;
|
|
75603
|
-
return
|
|
75603
|
+
return serialize2(resolved, schemelessOptions);
|
|
75604
75604
|
}
|
|
75605
75605
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
75606
75606
|
const target = {};
|
|
75607
75607
|
if (!skipNormalization) {
|
|
75608
|
-
base = parse6(
|
|
75609
|
-
relative = parse6(
|
|
75608
|
+
base = parse6(serialize2(base, options), options);
|
|
75609
|
+
relative = parse6(serialize2(relative, options), options);
|
|
75610
75610
|
}
|
|
75611
75611
|
options = options || {};
|
|
75612
75612
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -75660,7 +75660,7 @@ var require_fast_uri = __commonJS({
|
|
|
75660
75660
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
75661
75661
|
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
75662
75662
|
}
|
|
75663
|
-
function
|
|
75663
|
+
function serialize2(cmpts, opts) {
|
|
75664
75664
|
const component = {
|
|
75665
75665
|
host: cmpts.host,
|
|
75666
75666
|
scheme: cmpts.scheme,
|
|
@@ -75914,7 +75914,7 @@ var require_fast_uri = __commonJS({
|
|
|
75914
75914
|
function normalizeStringWithStatus(uri, opts) {
|
|
75915
75915
|
const { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
75916
75916
|
return {
|
|
75917
|
-
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri :
|
|
75917
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize2(parsed2, opts),
|
|
75918
75918
|
malformedAuthorityOrPort,
|
|
75919
75919
|
malformedPercentEncoding,
|
|
75920
75920
|
malformedSchemeSpecific,
|
|
@@ -75928,7 +75928,7 @@ var require_fast_uri = __commonJS({
|
|
|
75928
75928
|
}
|
|
75929
75929
|
let value2;
|
|
75930
75930
|
try {
|
|
75931
|
-
value2 = typeof uri === "string" ? uri :
|
|
75931
|
+
value2 = typeof uri === "string" ? uri : serialize2(uri, opts);
|
|
75932
75932
|
} catch {
|
|
75933
75933
|
return void 0;
|
|
75934
75934
|
}
|
|
@@ -75941,7 +75941,7 @@ var require_fast_uri = __commonJS({
|
|
|
75941
75941
|
resolve: resolve3,
|
|
75942
75942
|
resolveComponent,
|
|
75943
75943
|
equal,
|
|
75944
|
-
serialize,
|
|
75944
|
+
serialize: serialize2,
|
|
75945
75945
|
parse: parse6
|
|
75946
75946
|
};
|
|
75947
75947
|
module.exports = fastUri;
|
|
@@ -76388,7 +76388,7 @@ var require_core2 = __commonJS({
|
|
|
76388
76388
|
}
|
|
76389
76389
|
}
|
|
76390
76390
|
}
|
|
76391
|
-
_addSchema(schema2, meta3, baseId,
|
|
76391
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
76392
76392
|
let id;
|
|
76393
76393
|
const { schemaId } = this.opts;
|
|
76394
76394
|
if (typeof schema2 == "object") {
|
|
@@ -76411,7 +76411,7 @@ var require_core2 = __commonJS({
|
|
|
76411
76411
|
this._checkUnique(baseId);
|
|
76412
76412
|
this.refs[baseId] = sch;
|
|
76413
76413
|
}
|
|
76414
|
-
if (
|
|
76414
|
+
if (validateSchema)
|
|
76415
76415
|
this.validateSchema(schema2, true);
|
|
76416
76416
|
return sch;
|
|
76417
76417
|
}
|
|
@@ -79498,384 +79498,6 @@ var init_index_DoHiaFQM = __esm({
|
|
|
79498
79498
|
}
|
|
79499
79499
|
});
|
|
79500
79500
|
|
|
79501
|
-
// node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js
|
|
79502
|
-
var require_object_hash = __commonJS({
|
|
79503
|
-
"node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js"(exports, module) {
|
|
79504
|
-
"use strict";
|
|
79505
|
-
var crypto5 = __require("crypto");
|
|
79506
|
-
exports = module.exports = objectHash;
|
|
79507
|
-
function objectHash(object5, options) {
|
|
79508
|
-
options = applyDefaults(object5, options);
|
|
79509
|
-
return hash3(object5, options);
|
|
79510
|
-
}
|
|
79511
|
-
exports.sha1 = function(object5) {
|
|
79512
|
-
return objectHash(object5);
|
|
79513
|
-
};
|
|
79514
|
-
exports.keys = function(object5) {
|
|
79515
|
-
return objectHash(object5, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
|
|
79516
|
-
};
|
|
79517
|
-
exports.MD5 = function(object5) {
|
|
79518
|
-
return objectHash(object5, { algorithm: "md5", encoding: "hex" });
|
|
79519
|
-
};
|
|
79520
|
-
exports.keysMD5 = function(object5) {
|
|
79521
|
-
return objectHash(object5, { algorithm: "md5", encoding: "hex", excludeValues: true });
|
|
79522
|
-
};
|
|
79523
|
-
var hashes = crypto5.getHashes ? crypto5.getHashes().slice() : ["sha1", "md5"];
|
|
79524
|
-
hashes.push("passthrough");
|
|
79525
|
-
var encodings = ["buffer", "hex", "binary", "base64"];
|
|
79526
|
-
function applyDefaults(object5, sourceOptions) {
|
|
79527
|
-
sourceOptions = sourceOptions || {};
|
|
79528
|
-
var options = {};
|
|
79529
|
-
options.algorithm = sourceOptions.algorithm || "sha1";
|
|
79530
|
-
options.encoding = sourceOptions.encoding || "hex";
|
|
79531
|
-
options.excludeValues = sourceOptions.excludeValues ? true : false;
|
|
79532
|
-
options.algorithm = options.algorithm.toLowerCase();
|
|
79533
|
-
options.encoding = options.encoding.toLowerCase();
|
|
79534
|
-
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
|
|
79535
|
-
options.respectType = sourceOptions.respectType === false ? false : true;
|
|
79536
|
-
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
|
|
79537
|
-
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
|
|
79538
|
-
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
|
|
79539
|
-
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
|
|
79540
|
-
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
|
|
79541
|
-
options.replacer = sourceOptions.replacer || void 0;
|
|
79542
|
-
options.excludeKeys = sourceOptions.excludeKeys || void 0;
|
|
79543
|
-
if (typeof object5 === "undefined") {
|
|
79544
|
-
throw new Error("Object argument required.");
|
|
79545
|
-
}
|
|
79546
|
-
for (var i = 0; i < hashes.length; ++i) {
|
|
79547
|
-
if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
79548
|
-
options.algorithm = hashes[i];
|
|
79549
|
-
}
|
|
79550
|
-
}
|
|
79551
|
-
if (hashes.indexOf(options.algorithm) === -1) {
|
|
79552
|
-
throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
|
|
79553
|
-
}
|
|
79554
|
-
if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
|
|
79555
|
-
throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
|
|
79556
|
-
}
|
|
79557
|
-
return options;
|
|
79558
|
-
}
|
|
79559
|
-
function isNativeFunction(f) {
|
|
79560
|
-
if (typeof f !== "function") {
|
|
79561
|
-
return false;
|
|
79562
|
-
}
|
|
79563
|
-
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
79564
|
-
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
79565
|
-
}
|
|
79566
|
-
function hash3(object5, options) {
|
|
79567
|
-
var hashingStream;
|
|
79568
|
-
if (options.algorithm !== "passthrough") {
|
|
79569
|
-
hashingStream = crypto5.createHash(options.algorithm);
|
|
79570
|
-
} else {
|
|
79571
|
-
hashingStream = new PassThrough();
|
|
79572
|
-
}
|
|
79573
|
-
if (typeof hashingStream.write === "undefined") {
|
|
79574
|
-
hashingStream.write = hashingStream.update;
|
|
79575
|
-
hashingStream.end = hashingStream.update;
|
|
79576
|
-
}
|
|
79577
|
-
var hasher = typeHasher(options, hashingStream);
|
|
79578
|
-
hasher.dispatch(object5);
|
|
79579
|
-
if (!hashingStream.update) {
|
|
79580
|
-
hashingStream.end("");
|
|
79581
|
-
}
|
|
79582
|
-
if (hashingStream.digest) {
|
|
79583
|
-
return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
|
|
79584
|
-
}
|
|
79585
|
-
var buf = hashingStream.read();
|
|
79586
|
-
if (options.encoding === "buffer") {
|
|
79587
|
-
return buf;
|
|
79588
|
-
}
|
|
79589
|
-
return buf.toString(options.encoding);
|
|
79590
|
-
}
|
|
79591
|
-
exports.writeToStream = function(object5, options, stream) {
|
|
79592
|
-
if (typeof stream === "undefined") {
|
|
79593
|
-
stream = options;
|
|
79594
|
-
options = {};
|
|
79595
|
-
}
|
|
79596
|
-
options = applyDefaults(object5, options);
|
|
79597
|
-
return typeHasher(options, stream).dispatch(object5);
|
|
79598
|
-
};
|
|
79599
|
-
function typeHasher(options, writeTo, context) {
|
|
79600
|
-
context = context || [];
|
|
79601
|
-
var write2 = function(str) {
|
|
79602
|
-
if (writeTo.update) {
|
|
79603
|
-
return writeTo.update(str, "utf8");
|
|
79604
|
-
} else {
|
|
79605
|
-
return writeTo.write(str, "utf8");
|
|
79606
|
-
}
|
|
79607
|
-
};
|
|
79608
|
-
return {
|
|
79609
|
-
dispatch: function(value2) {
|
|
79610
|
-
if (options.replacer) {
|
|
79611
|
-
value2 = options.replacer(value2);
|
|
79612
|
-
}
|
|
79613
|
-
var type2 = typeof value2;
|
|
79614
|
-
if (value2 === null) {
|
|
79615
|
-
type2 = "null";
|
|
79616
|
-
}
|
|
79617
|
-
return this["_" + type2](value2);
|
|
79618
|
-
},
|
|
79619
|
-
_object: function(object5) {
|
|
79620
|
-
var pattern = /\[object (.*)\]/i;
|
|
79621
|
-
var objString = Object.prototype.toString.call(object5);
|
|
79622
|
-
var objType = pattern.exec(objString);
|
|
79623
|
-
if (!objType) {
|
|
79624
|
-
objType = "unknown:[" + objString + "]";
|
|
79625
|
-
} else {
|
|
79626
|
-
objType = objType[1];
|
|
79627
|
-
}
|
|
79628
|
-
objType = objType.toLowerCase();
|
|
79629
|
-
var objectNumber = null;
|
|
79630
|
-
if ((objectNumber = context.indexOf(object5)) >= 0) {
|
|
79631
|
-
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
|
|
79632
|
-
} else {
|
|
79633
|
-
context.push(object5);
|
|
79634
|
-
}
|
|
79635
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object5)) {
|
|
79636
|
-
write2("buffer:");
|
|
79637
|
-
return write2(object5);
|
|
79638
|
-
}
|
|
79639
|
-
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
|
|
79640
|
-
if (this["_" + objType]) {
|
|
79641
|
-
this["_" + objType](object5);
|
|
79642
|
-
} else if (options.ignoreUnknown) {
|
|
79643
|
-
return write2("[" + objType + "]");
|
|
79644
|
-
} else {
|
|
79645
|
-
throw new Error('Unknown object type "' + objType + '"');
|
|
79646
|
-
}
|
|
79647
|
-
} else {
|
|
79648
|
-
var keys = Object.keys(object5);
|
|
79649
|
-
if (options.unorderedObjects) {
|
|
79650
|
-
keys = keys.sort();
|
|
79651
|
-
}
|
|
79652
|
-
if (options.respectType !== false && !isNativeFunction(object5)) {
|
|
79653
|
-
keys.splice(0, 0, "prototype", "__proto__", "constructor");
|
|
79654
|
-
}
|
|
79655
|
-
if (options.excludeKeys) {
|
|
79656
|
-
keys = keys.filter(function(key) {
|
|
79657
|
-
return !options.excludeKeys(key);
|
|
79658
|
-
});
|
|
79659
|
-
}
|
|
79660
|
-
write2("object:" + keys.length + ":");
|
|
79661
|
-
var self2 = this;
|
|
79662
|
-
return keys.forEach(function(key) {
|
|
79663
|
-
self2.dispatch(key);
|
|
79664
|
-
write2(":");
|
|
79665
|
-
if (!options.excludeValues) {
|
|
79666
|
-
self2.dispatch(object5[key]);
|
|
79667
|
-
}
|
|
79668
|
-
write2(",");
|
|
79669
|
-
});
|
|
79670
|
-
}
|
|
79671
|
-
},
|
|
79672
|
-
_array: function(arr, unordered) {
|
|
79673
|
-
unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
|
|
79674
|
-
var self2 = this;
|
|
79675
|
-
write2("array:" + arr.length + ":");
|
|
79676
|
-
if (!unordered || arr.length <= 1) {
|
|
79677
|
-
return arr.forEach(function(entry) {
|
|
79678
|
-
return self2.dispatch(entry);
|
|
79679
|
-
});
|
|
79680
|
-
}
|
|
79681
|
-
var contextAdditions = [];
|
|
79682
|
-
var entries = arr.map(function(entry) {
|
|
79683
|
-
var strm = new PassThrough();
|
|
79684
|
-
var localContext = context.slice();
|
|
79685
|
-
var hasher = typeHasher(options, strm, localContext);
|
|
79686
|
-
hasher.dispatch(entry);
|
|
79687
|
-
contextAdditions = contextAdditions.concat(localContext.slice(context.length));
|
|
79688
|
-
return strm.read().toString();
|
|
79689
|
-
});
|
|
79690
|
-
context = context.concat(contextAdditions);
|
|
79691
|
-
entries.sort();
|
|
79692
|
-
return this._array(entries, false);
|
|
79693
|
-
},
|
|
79694
|
-
_date: function(date6) {
|
|
79695
|
-
return write2("date:" + date6.toJSON());
|
|
79696
|
-
},
|
|
79697
|
-
_symbol: function(sym) {
|
|
79698
|
-
return write2("symbol:" + sym.toString());
|
|
79699
|
-
},
|
|
79700
|
-
_error: function(err) {
|
|
79701
|
-
return write2("error:" + err.toString());
|
|
79702
|
-
},
|
|
79703
|
-
_boolean: function(bool) {
|
|
79704
|
-
return write2("bool:" + bool.toString());
|
|
79705
|
-
},
|
|
79706
|
-
_string: function(string6) {
|
|
79707
|
-
write2("string:" + string6.length + ":");
|
|
79708
|
-
write2(string6.toString());
|
|
79709
|
-
},
|
|
79710
|
-
_function: function(fn2) {
|
|
79711
|
-
write2("fn:");
|
|
79712
|
-
if (isNativeFunction(fn2)) {
|
|
79713
|
-
this.dispatch("[native]");
|
|
79714
|
-
} else {
|
|
79715
|
-
this.dispatch(fn2.toString());
|
|
79716
|
-
}
|
|
79717
|
-
if (options.respectFunctionNames !== false) {
|
|
79718
|
-
this.dispatch("function-name:" + String(fn2.name));
|
|
79719
|
-
}
|
|
79720
|
-
if (options.respectFunctionProperties) {
|
|
79721
|
-
this._object(fn2);
|
|
79722
|
-
}
|
|
79723
|
-
},
|
|
79724
|
-
_number: function(number6) {
|
|
79725
|
-
return write2("number:" + number6.toString());
|
|
79726
|
-
},
|
|
79727
|
-
_xml: function(xml) {
|
|
79728
|
-
return write2("xml:" + xml.toString());
|
|
79729
|
-
},
|
|
79730
|
-
_null: function() {
|
|
79731
|
-
return write2("Null");
|
|
79732
|
-
},
|
|
79733
|
-
_undefined: function() {
|
|
79734
|
-
return write2("Undefined");
|
|
79735
|
-
},
|
|
79736
|
-
_regexp: function(regex4) {
|
|
79737
|
-
return write2("regex:" + regex4.toString());
|
|
79738
|
-
},
|
|
79739
|
-
_uint8array: function(arr) {
|
|
79740
|
-
write2("uint8array:");
|
|
79741
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79742
|
-
},
|
|
79743
|
-
_uint8clampedarray: function(arr) {
|
|
79744
|
-
write2("uint8clampedarray:");
|
|
79745
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79746
|
-
},
|
|
79747
|
-
_int8array: function(arr) {
|
|
79748
|
-
write2("int8array:");
|
|
79749
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79750
|
-
},
|
|
79751
|
-
_uint16array: function(arr) {
|
|
79752
|
-
write2("uint16array:");
|
|
79753
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79754
|
-
},
|
|
79755
|
-
_int16array: function(arr) {
|
|
79756
|
-
write2("int16array:");
|
|
79757
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79758
|
-
},
|
|
79759
|
-
_uint32array: function(arr) {
|
|
79760
|
-
write2("uint32array:");
|
|
79761
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79762
|
-
},
|
|
79763
|
-
_int32array: function(arr) {
|
|
79764
|
-
write2("int32array:");
|
|
79765
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79766
|
-
},
|
|
79767
|
-
_float32array: function(arr) {
|
|
79768
|
-
write2("float32array:");
|
|
79769
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79770
|
-
},
|
|
79771
|
-
_float64array: function(arr) {
|
|
79772
|
-
write2("float64array:");
|
|
79773
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
79774
|
-
},
|
|
79775
|
-
_arraybuffer: function(arr) {
|
|
79776
|
-
write2("arraybuffer:");
|
|
79777
|
-
return this.dispatch(new Uint8Array(arr));
|
|
79778
|
-
},
|
|
79779
|
-
_url: function(url4) {
|
|
79780
|
-
return write2("url:" + url4.toString(), "utf8");
|
|
79781
|
-
},
|
|
79782
|
-
_map: function(map2) {
|
|
79783
|
-
write2("map:");
|
|
79784
|
-
var arr = Array.from(map2);
|
|
79785
|
-
return this._array(arr, options.unorderedSets !== false);
|
|
79786
|
-
},
|
|
79787
|
-
_set: function(set2) {
|
|
79788
|
-
write2("set:");
|
|
79789
|
-
var arr = Array.from(set2);
|
|
79790
|
-
return this._array(arr, options.unorderedSets !== false);
|
|
79791
|
-
},
|
|
79792
|
-
_file: function(file2) {
|
|
79793
|
-
write2("file:");
|
|
79794
|
-
return this.dispatch([file2.name, file2.size, file2.type, file2.lastModfied]);
|
|
79795
|
-
},
|
|
79796
|
-
_blob: function() {
|
|
79797
|
-
if (options.ignoreUnknown) {
|
|
79798
|
-
return write2("[blob]");
|
|
79799
|
-
}
|
|
79800
|
-
throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
|
|
79801
|
-
},
|
|
79802
|
-
_domwindow: function() {
|
|
79803
|
-
return write2("domwindow");
|
|
79804
|
-
},
|
|
79805
|
-
_bigint: function(number6) {
|
|
79806
|
-
return write2("bigint:" + number6.toString());
|
|
79807
|
-
},
|
|
79808
|
-
/* Node.js standard native objects */
|
|
79809
|
-
_process: function() {
|
|
79810
|
-
return write2("process");
|
|
79811
|
-
},
|
|
79812
|
-
_timer: function() {
|
|
79813
|
-
return write2("timer");
|
|
79814
|
-
},
|
|
79815
|
-
_pipe: function() {
|
|
79816
|
-
return write2("pipe");
|
|
79817
|
-
},
|
|
79818
|
-
_tcp: function() {
|
|
79819
|
-
return write2("tcp");
|
|
79820
|
-
},
|
|
79821
|
-
_udp: function() {
|
|
79822
|
-
return write2("udp");
|
|
79823
|
-
},
|
|
79824
|
-
_tty: function() {
|
|
79825
|
-
return write2("tty");
|
|
79826
|
-
},
|
|
79827
|
-
_statwatcher: function() {
|
|
79828
|
-
return write2("statwatcher");
|
|
79829
|
-
},
|
|
79830
|
-
_securecontext: function() {
|
|
79831
|
-
return write2("securecontext");
|
|
79832
|
-
},
|
|
79833
|
-
_connection: function() {
|
|
79834
|
-
return write2("connection");
|
|
79835
|
-
},
|
|
79836
|
-
_zlib: function() {
|
|
79837
|
-
return write2("zlib");
|
|
79838
|
-
},
|
|
79839
|
-
_context: function() {
|
|
79840
|
-
return write2("context");
|
|
79841
|
-
},
|
|
79842
|
-
_nodescript: function() {
|
|
79843
|
-
return write2("nodescript");
|
|
79844
|
-
},
|
|
79845
|
-
_httpparser: function() {
|
|
79846
|
-
return write2("httpparser");
|
|
79847
|
-
},
|
|
79848
|
-
_dataview: function() {
|
|
79849
|
-
return write2("dataview");
|
|
79850
|
-
},
|
|
79851
|
-
_signal: function() {
|
|
79852
|
-
return write2("signal");
|
|
79853
|
-
},
|
|
79854
|
-
_fsevent: function() {
|
|
79855
|
-
return write2("fsevent");
|
|
79856
|
-
},
|
|
79857
|
-
_tlswrap: function() {
|
|
79858
|
-
return write2("tlswrap");
|
|
79859
|
-
}
|
|
79860
|
-
};
|
|
79861
|
-
}
|
|
79862
|
-
function PassThrough() {
|
|
79863
|
-
return {
|
|
79864
|
-
buf: "",
|
|
79865
|
-
write: function(b) {
|
|
79866
|
-
this.buf += b;
|
|
79867
|
-
},
|
|
79868
|
-
end: function(b) {
|
|
79869
|
-
this.buf += b;
|
|
79870
|
-
},
|
|
79871
|
-
read: function() {
|
|
79872
|
-
return this.buf;
|
|
79873
|
-
}
|
|
79874
|
-
};
|
|
79875
|
-
}
|
|
79876
|
-
}
|
|
79877
|
-
});
|
|
79878
|
-
|
|
79879
79501
|
// node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js
|
|
79880
79502
|
var require_light = __commonJS({
|
|
79881
79503
|
"node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js"(exports, module) {
|
|
@@ -104358,6 +103980,17 @@ var providers = {
|
|
|
104358
103980
|
// see the big-pickle note above (#1077).
|
|
104359
103981
|
isFree: true
|
|
104360
103982
|
},
|
|
103983
|
+
// Zen's FREE stealth preview (listed 2026-10-01), the fifth promo. Zen
|
|
103984
|
+
// has not published its data terms yet, so the description claims none.
|
|
103985
|
+
"fledge-alpha": {
|
|
103986
|
+
displayName: "Fledge Alpha",
|
|
103987
|
+
description: "Stealth preview, free for a limited time",
|
|
103988
|
+
resolve: "opencode/fledge-alpha-free",
|
|
103989
|
+
effort: ["low", "high", "max"],
|
|
103990
|
+
// free to run, still gated on the provider's own OPENCODE_API_KEY —
|
|
103991
|
+
// see the big-pickle note above (#1077).
|
|
103992
|
+
isFree: true
|
|
103993
|
+
},
|
|
104361
103994
|
// Zen's live free MiMo, and the second free row in a menu that big-pickle
|
|
104362
103995
|
// was alone in since `mimo-v2-pro-free` lost its model.
|
|
104363
103996
|
mimo: {
|
|
@@ -105972,7 +105605,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
105972
105605
|
// package.json
|
|
105973
105606
|
var package_default = {
|
|
105974
105607
|
name: "pullfrog",
|
|
105975
|
-
version: "0.1.
|
|
105608
|
+
version: "0.1.95",
|
|
105976
105609
|
cliContractVersion: "1",
|
|
105977
105610
|
type: "module",
|
|
105978
105611
|
bin: {
|
|
@@ -106014,7 +105647,6 @@ var package_default = {
|
|
|
106014
105647
|
"@standard-schema/spec": "1.1.0",
|
|
106015
105648
|
"@toon-format/toon": "^1.0.0",
|
|
106016
105649
|
"@types/node": "^24.7.2",
|
|
106017
|
-
"@types/object-hash": "^3.0.6",
|
|
106018
105650
|
"@types/semver": "^7.7.1",
|
|
106019
105651
|
"@types/turndown": "^5.0.5",
|
|
106020
105652
|
"agent-browser": "0.25.4",
|
|
@@ -106028,8 +105660,6 @@ var package_default = {
|
|
|
106028
105660
|
fastmcp: "^3.34.0",
|
|
106029
105661
|
"file-type": "^21.3.0",
|
|
106030
105662
|
husky: "^9.0.0",
|
|
106031
|
-
"lru-cache": "^11.0.0",
|
|
106032
|
-
"object-hash": "^3.0.0",
|
|
106033
105663
|
"opencode-ai": "1.18.29",
|
|
106034
105664
|
"package-manager-detector": "^1.6.0",
|
|
106035
105665
|
picocolors: "^1.1.1",
|
|
@@ -106041,6 +105671,7 @@ var package_default = {
|
|
|
106041
105671
|
undici: "^7.22.0",
|
|
106042
105672
|
vitest: "^4.0.17",
|
|
106043
105673
|
yaml: "^2.8.2",
|
|
105674
|
+
yes: "0.1.0",
|
|
106044
105675
|
zod: "4.3.6"
|
|
106045
105676
|
},
|
|
106046
105677
|
repository: {
|
|
@@ -106074,12 +105705,6 @@ var package_default = {
|
|
|
106074
105705
|
import: "./dist/internal.js",
|
|
106075
105706
|
default: "./dist/internal.js"
|
|
106076
105707
|
},
|
|
106077
|
-
"./yes": {
|
|
106078
|
-
"@pullfrog/source": "./yes/index.ts",
|
|
106079
|
-
types: "./dist/yes/index.d.ts",
|
|
106080
|
-
import: "./dist/yes.js",
|
|
106081
|
-
default: "./dist/yes.js"
|
|
106082
|
-
},
|
|
106083
105708
|
"./package.json": "./package.json"
|
|
106084
105709
|
},
|
|
106085
105710
|
packageManager: "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a"
|
|
@@ -106666,12 +106291,14 @@ The body has at most three parts, in this order:
|
|
|
106666
106291
|
|
|
106667
106292
|
1. **Reviewed changes preamble** \u2014 a bolded \`**Reviewed changes**\` lead-in with one sentence on what was reviewed in this run (for \`IncrementalReview\`: what changed since the prior pullfrog review), then a bullet list of the substantive changes \u2014 short bolded title, one sentence each. A reviewer should understand the full reviewed scope from this list alone. Close the preamble with the metadata comment below.
|
|
106668
106293
|
2. **Cross-cutting issue sections** (zero or more) \u2014 one \`### {emoji} {what's wrong, not what to do}\` heading per concern.
|
|
106669
|
-
3. **\`### \u2139\uFE0F Nitpicks\`** at the very bottom, if any \u2014 a flat bullet list, no technical-details block.
|
|
106294
|
+
3. **\`### \u2139\uFE0F Nitpicks\`** at the very bottom, if any \u2014 a flat bullet list, no technical-details block. Only for what has no runtime effect: a stale or wrong comment or doc, a misleading name, a typo, dead code, a missing test. Never formatting or whitespace.
|
|
106670
106295
|
|
|
106671
106296
|
**Inline vs. body.** Concerns that anchor to a specific line go inline (the \`comments\` parameter), even when their implications are broad. Body \`### \` sections are reserved for concerns that have **no line to anchor to** \u2014 *absence* (something the diff should have done but didn't), *sequencing* (rollout / deletion / migration order), *design decisions only the human can make*, or *scope questions the diff raises but doesn't address*. With no non-anchorable concerns, the body is just the preamble + metadata.
|
|
106672
106297
|
|
|
106673
106298
|
**Severity emoji** on every \`### \` heading, and nowhere else: \u{1F6A8} critical (blocks merge \u2014 data loss, security, broken core flow) \xB7 \u26A0\uFE0F important (must address before merging) \xB7 \u2139\uFE0F informational (mergeable as-is).
|
|
106674
106299
|
|
|
106300
|
+
**Behavior decides placement, not fix size.** A finding that changes what the code does \u2014 a wrong value or message, a crash, a race, a leak, a missed cleanup, a slow path \u2014 gets its own inline comment (or a \`### \` section if no line anchors it) at its real severity, however small the fix. Never put it in Nitpicks: before submitting, re-read each Nitpicks bullet and move any that fails this test inline.
|
|
106301
|
+
|
|
106675
106302
|
**Blank line between every block-level element.** GitHub's markdown parser requires one before and after HTML tags (\`<details>\`, \`<summary>\`, \`<sub>\`, \`<br/>\`) \u2014 without it GitHub treats what follows as a continuation of the HTML block and renders your markdown as literal text. This is a parser quirk, not a style preference, and it permanently breaks the posted review.
|
|
106676
106303
|
|
|
106677
106304
|
## Metadata comment
|
|
@@ -106844,9 +106471,9 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
|
|
|
106844
106471
|
|
|
106845
106472
|
6. **aggregate & draft**: when specialist results land, merge findings; de-dup overlaps (two specialists catching the same issue = higher-confidence signal); trace each finding yourself before accepting it. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the PR (heuristic: if the finding's root cause lives in lines this PR added or modified, it's in scope; otherwise drop unless the PR plausibly introduced or amplified the regression), and anything not actionable. also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or worse, degrades elegance to nominally improve correctness) makes the codebase worse, not better.
|
|
106846
106473
|
|
|
106847
|
-
**Hunt for non-anchored concerns before drafting.** After collecting your anchored findings, deliberately scan for concerns that have no specific line to point at \u2014 typically: deletion / cleanup plans for code the diff replaces or shadows; rollout sequencing (what happens to in-flight state during deploy / revert?);
|
|
106474
|
+
**Hunt for non-anchored concerns before drafting.** After collecting your anchored findings, deliberately scan for concerns that have no specific line to point at \u2014 typically: deletion / cleanup plans for code the diff replaces or shadows; rollout sequencing (what happens to in-flight state during deploy / revert?); scope questions that only the human can answer (e.g. is the legacy path going away or is this a long-term dual track?); architectural risks the diff opens up that aren't a single-line bug.
|
|
106848
106475
|
|
|
106849
|
-
for surviving findings, draft inline comments with NEW line numbers from the diff \u2014 attach a \`<details>Technical details</details>\` block to any inline comment whose fix is non-trivial or has cross-file implications (see Inline technical details in the format below). every comment must be actionable, 2-3 sentences max in the visible part. use GitHub permalink format for code references. for impact-analysis findings (stale references after rename/remove), report them in the review body ordered by severity (runtime breakage > incorrect docs > stale comments) rather than as inline comments unless they're anchored to a specific line.
|
|
106476
|
+
for surviving findings, draft inline comments with NEW line numbers from the diff \u2014 attach a \`<details>Technical details</details>\` block to any inline comment whose fix is non-trivial or has cross-file implications (see Inline technical details in the format below). every comment must be actionable, 2-3 sentences max in the visible part, one per root cause \u2014 name its other sites in that comment rather than repeating it. use GitHub permalink format for code references. for impact-analysis findings (stale references after rename/remove), report them in the review body ordered by severity (runtime breakage > incorrect docs > stale comments) rather than as inline comments unless they're anchored to a specific line.
|
|
106850
106477
|
|
|
106851
106478
|
7. **submit**: ALWAYS submit exactly one review via \`${t("create_pull_request_review")}\`. Do NOT call \`report_progress\` \u2014 the review is the final record and the progress comment will be cleaned up automatically.
|
|
106852
106479
|
|
|
@@ -106867,9 +106494,9 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
|
|
|
106867
106494
|
\`approved: false\`. Body opens with \`> [!CAUTION]\\n> This PR introduces ...\`, followed by the PR summary. Include all inline comments via \`comments\`.
|
|
106868
106495
|
- **must-address non-critical findings** (real consequences if shipped \u2014 incorrect behavior in non-critical paths, missing validation on user input, regressions the author should fix before merge):
|
|
106869
106496
|
\`approved: false\`. Body opens with \`> [!IMPORTANT]\\n> ...\`, followed by the PR summary. Reserve this tier for findings with concrete fallout \u2014 do NOT use \`[!IMPORTANT]\` for nits, style preferences, or "consider also" suggestions. Include all inline comments via \`comments\`.
|
|
106870
|
-
- **minor suggestions only** (
|
|
106497
|
+
- **minor suggestions only** (low-stakes findings, or Nitpicks only):
|
|
106871
106498
|
\`approved: false\`. Body opens with \`> \u2139\uFE0F No critical issues \u2014 minor suggestions inline.\\n\\n\` followed by the PR summary. Include all inline comments via \`comments\`. Vary the wording after the emoji to fit the review (e.g. "Minor suggestions only.", "Two rough edges worth a look."), but always keep the \u2139\uFE0F prefix and keep it short.
|
|
106872
|
-
- **informational observations** (mergeable as-is, nothing actionable \u2014 e.g. prior feedback addressed cleanly,
|
|
106499
|
+
- **informational observations** (mergeable as-is, nothing actionable \u2014 e.g. prior feedback addressed cleanly, calling out something noteworthy without recommending a change):
|
|
106873
106500
|
\`approved: true\`. Body opens with \`> \u2705 No new issues found.\\n\\n\` followed by the PR summary. Do NOT include inline \`comments\` \u2014 the \u2705 signals "no action needed", which contradicts an actionable anchor; if a point is concrete enough to anchor to a line, downgrade the whole review to "minor suggestions only" (\`approved: false\`) instead.
|
|
106874
106501
|
- **no actionable issues**:
|
|
106875
106502
|
\`approved: true\`. Body opens with \`> \u2705 No new issues found.\\n\\n\` followed by the PR summary.
|
|
@@ -106935,9 +106562,9 @@ ${PR_SUMMARY_FORMAT}`
|
|
|
106935
106562
|
|
|
106936
106563
|
8. **aggregate, draft, self-critique**: merge findings (yours + output from every specialist you dispatched); de-dup overlaps; trace each finding yourself. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the new commits, anything not actionable, and anything that re-states prior review feedback (heuristic: if the finding's root cause lives in lines the *new commits* added or modified, it's in scope; otherwise drop). also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or degrades elegance to nominally improve correctness) makes the codebase worse, not better. To compute "lines the new commits added or modified": if \`incrementalDiffPath\` from step 2 is present, use it directly. Otherwise, take the prior Pullfrog review's \`commit_id\` (returned alongside each entry from \`${t("list_pull_request_reviews")}\` in step 4) and run \`git diff <prior-review-sha>..HEAD\` to isolate the lines added since that review.
|
|
106937
106564
|
|
|
106938
|
-
**Hunt for non-anchored concerns before drafting.** After collecting your anchored findings, deliberately scan for concerns that have no specific line to point at \u2014 typically: deletion / cleanup plans for code the new commits replace or shadow; rollout sequencing (what happens to in-flight state during deploy / revert?);
|
|
106565
|
+
**Hunt for non-anchored concerns before drafting.** After collecting your anchored findings, deliberately scan for concerns that have no specific line to point at \u2014 typically: deletion / cleanup plans for code the new commits replace or shadow; rollout sequencing (what happens to in-flight state during deploy / revert?); scope questions that only the human can answer (e.g. is the legacy path going away or is this a long-term dual track?); architectural risks the new commits open up that aren't a single-line bug.
|
|
106939
106566
|
|
|
106940
|
-
draft inline comments with NEW line numbers from the full PR diff \u2014 attach a \`<details>Technical details</details>\` block to any inline comment whose fix is non-trivial or has cross-file implications (see Inline technical details in the format below). every comment must be actionable, 2-3 sentences max in the visible part.
|
|
106567
|
+
draft inline comments with NEW line numbers from the full PR diff \u2014 attach a \`<details>Technical details</details>\` block to any inline comment whose fix is non-trivial or has cross-file implications (see Inline technical details in the format below). every comment must be actionable, 2-3 sentences max in the visible part, one per root cause \u2014 name its other sites in that comment rather than repeating it.
|
|
106941
106568
|
|
|
106942
106569
|
9. **build the review body**: use the same default format as Review mode (preamble + optional cross-cutting \`### \` sections + optional \`### \u2139\uFE0F Nitpicks\`) \u2014 scoped to the **incremental delta**, not the full PR. The "Reviewed changes" bullets describe what changed since the prior pullfrog review (each bullet starts with a past-tense verb, e.g. \`- Extracted shared CLI runtime into a single module\`). Do NOT include a separate "Prior review feedback" checklist \u2014 that's tracked in the rolling PR summary snapshot for the next agent run, and surfacing it in the user-facing body is noise (changes that addressed prior feedback are already covered by the Reviewed-changes bullets). In some cases you may receive a complete diff for the whole PR instead of an incremental one; when this happens, determine what changed since Pullfrog's most recent review yourself before drafting bullets.
|
|
106943
106570
|
|
|
@@ -106950,8 +106577,8 @@ ${PR_SUMMARY_FORMAT}`
|
|
|
106950
106577
|
- IF NO NEW ISSUES, NON-SUBSTANTIVE CHANGES ONLY (trivial formatting, import reordering, comment tweaks): do NOT submit a review. Instead call \`${t("report_progress")}\` with a 1-2 sentence note explaining no review was warranted (e.g. "No new issues. Changes since last review are formatting-only."). this leaves a visible signal that the run completed.
|
|
106951
106578
|
- ELSE IF NEW CRITICAL ISSUES (blocks merge \u2014 bugs, security, data loss, broken core flows): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> [!CAUTION]\\n> This PR introduces ...\`, followed by the PR summary using the default format below.
|
|
106952
106579
|
- ELSE IF NEW MUST-ADDRESS NON-CRITICAL FINDINGS (real consequences if shipped \u2014 incorrect behavior, missing validation, regressions the author should fix before merge): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> [!IMPORTANT]\\n> ...\`, followed by the PR summary using the default format below. Do NOT use this tier for nits, style preferences, or "consider also" suggestions.
|
|
106953
|
-
- ELSE IF NEW MINOR SUGGESTIONS ONLY (
|
|
106954
|
-
- ELSE IF INFORMATIONAL OBSERVATIONS (mergeable as-is, but worth surfacing \u2014 e.g. prior feedback addressed cleanly
|
|
106580
|
+
- ELSE IF NEW MINOR SUGGESTIONS ONLY (low-stakes findings, or Nitpicks only): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> \u2139\uFE0F No critical issues \u2014 minor suggestions inline.\\n\\n\` (vary the wording after \u2139\uFE0F to fit the review), followed by the PR summary using the default format below.
|
|
106581
|
+
- ELSE IF INFORMATIONAL OBSERVATIONS (mergeable as-is, but worth surfacing \u2014 e.g. prior feedback addressed cleanly, or a noteworthy positive observation): call \`${t("create_pull_request_review")}\` with \`approved: true\`, NO inline comments, and the review body. body opens with \`> \u2705 No new issues found.\\n\\n\` (or similar friendly green opener), followed by the PR summary using the default format below. If a point is concrete enough to anchor to a line, downgrade the whole review to "minor suggestions only" (\`approved: false\`) instead \u2014 the \u2705 signals "no action needed", which contradicts an actionable anchor.
|
|
106955
106582
|
- ELSE IF NO NEW ISSUES, SUBSTANTIVE CHANGES (new functionality, behavior changes, or fixes to prior review feedback): call \`${t("create_pull_request_review")}\` to create a PR review. If all previous reviews have been properly addressed and no new issues were discovered, set \`approved: true\`. body opens with \`> \u2705 No new issues found.\\n\\n\`, followed by the PR summary using the default format below.
|
|
106956
106583
|
|
|
106957
106584
|
${PR_SUMMARY_FORMAT}`
|
|
@@ -108379,6 +108006,7 @@ function installCodexHome() {
|
|
|
108379
108006
|
return { codexHome, authPath, originalRefresh: body.tokens.refresh_token };
|
|
108380
108007
|
}
|
|
108381
108008
|
var dataHome;
|
|
108009
|
+
var unhostedSubscriptions = /* @__PURE__ */ new Set();
|
|
108382
108010
|
function canInstallSubscription(name) {
|
|
108383
108011
|
return name !== CODEX_AUTH_ENV && name !== XAI_AUTH_ENV || resolveDataHome() !== null;
|
|
108384
108012
|
}
|
|
@@ -108405,8 +108033,10 @@ function bootstrapPullfrogDataDir() {
|
|
|
108405
108033
|
log.warning(
|
|
108406
108034
|
`\xBB subscription auth skipped: could not create ${PULLFROG_DATA_DIR} (${err instanceof Error ? err.message : String(err)}). it must live outside the agent sandbox's reach, which needs passwordless sudo on this runner; runs on a model that needs the subscription will report no key.`
|
|
108407
108035
|
);
|
|
108408
|
-
|
|
108409
|
-
|
|
108036
|
+
for (const name of [CODEX_AUTH_ENV, XAI_AUTH_ENV]) {
|
|
108037
|
+
if (process.env[name]) unhostedSubscriptions.add(name);
|
|
108038
|
+
delete process.env[name];
|
|
108039
|
+
}
|
|
108410
108040
|
return null;
|
|
108411
108041
|
}
|
|
108412
108042
|
return PULLFROG_DATA_DIR;
|
|
@@ -133871,8 +133501,8 @@ var require_validate2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
133871
133501
|
}
|
|
133872
133502
|
}
|
|
133873
133503
|
function returnResults(it) {
|
|
133874
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
133875
|
-
if (schemaEnv.$async) gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${
|
|
133504
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
133505
|
+
if (schemaEnv.$async) gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError2}(${names_1.default.vErrors})`));
|
|
133876
133506
|
else {
|
|
133877
133507
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
133878
133508
|
if (opts.unevaluated) assignEvaluated(it);
|
|
@@ -134154,14 +133784,14 @@ var require_validate2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
134154
133784
|
}));
|
|
134155
133785
|
var require_validation_error2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
134156
133786
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
134157
|
-
var
|
|
133787
|
+
var ValidationError2 = class extends Error {
|
|
134158
133788
|
constructor(errors) {
|
|
134159
133789
|
super("validation failed");
|
|
134160
133790
|
this.errors = errors;
|
|
134161
133791
|
this.ajv = this.validation = true;
|
|
134162
133792
|
}
|
|
134163
133793
|
};
|
|
134164
|
-
exports.default =
|
|
133794
|
+
exports.default = ValidationError2;
|
|
134165
133795
|
}));
|
|
134166
133796
|
var require_ref_error2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
134167
133797
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -134766,21 +134396,21 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
134766
134396
|
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils6();
|
|
134767
134397
|
const { SCHEMES, getSchemeHandler } = require_schemes2();
|
|
134768
134398
|
function normalize3(uri, options) {
|
|
134769
|
-
if (typeof uri === "string") uri =
|
|
134770
|
-
else if (typeof uri === "object") uri = parse6(
|
|
134399
|
+
if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
|
|
134400
|
+
else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
|
|
134771
134401
|
return uri;
|
|
134772
134402
|
}
|
|
134773
134403
|
function resolve3(baseURI, relativeURI, options) {
|
|
134774
134404
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
134775
134405
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
134776
134406
|
schemelessOptions.skipEscape = true;
|
|
134777
|
-
return
|
|
134407
|
+
return serialize2(resolved, schemelessOptions);
|
|
134778
134408
|
}
|
|
134779
134409
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
134780
134410
|
const target = {};
|
|
134781
134411
|
if (!skipNormalization) {
|
|
134782
|
-
base = parse6(
|
|
134783
|
-
relative = parse6(
|
|
134412
|
+
base = parse6(serialize2(base, options), options);
|
|
134413
|
+
relative = parse6(serialize2(relative, options), options);
|
|
134784
134414
|
}
|
|
134785
134415
|
options = options || {};
|
|
134786
134416
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -134824,27 +134454,27 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
134824
134454
|
function equal(uriA, uriB, options) {
|
|
134825
134455
|
if (typeof uriA === "string") {
|
|
134826
134456
|
uriA = unescape(uriA);
|
|
134827
|
-
uriA =
|
|
134457
|
+
uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
|
|
134828
134458
|
...options,
|
|
134829
134459
|
skipEscape: true
|
|
134830
134460
|
});
|
|
134831
|
-
} else if (typeof uriA === "object") uriA =
|
|
134461
|
+
} else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
|
|
134832
134462
|
...options,
|
|
134833
134463
|
skipEscape: true
|
|
134834
134464
|
});
|
|
134835
134465
|
if (typeof uriB === "string") {
|
|
134836
134466
|
uriB = unescape(uriB);
|
|
134837
|
-
uriB =
|
|
134467
|
+
uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
|
|
134838
134468
|
...options,
|
|
134839
134469
|
skipEscape: true
|
|
134840
134470
|
});
|
|
134841
|
-
} else if (typeof uriB === "object") uriB =
|
|
134471
|
+
} else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
|
|
134842
134472
|
...options,
|
|
134843
134473
|
skipEscape: true
|
|
134844
134474
|
});
|
|
134845
134475
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
134846
134476
|
}
|
|
134847
|
-
function
|
|
134477
|
+
function serialize2(cmpts, opts) {
|
|
134848
134478
|
const component = {
|
|
134849
134479
|
host: cmpts.host,
|
|
134850
134480
|
scheme: cmpts.scheme,
|
|
@@ -134947,7 +134577,7 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
134947
134577
|
resolve: resolve3,
|
|
134948
134578
|
resolveComponent,
|
|
134949
134579
|
equal,
|
|
134950
|
-
serialize,
|
|
134580
|
+
serialize: serialize2,
|
|
134951
134581
|
parse: parse6
|
|
134952
134582
|
};
|
|
134953
134583
|
module.exports = fastUri;
|
|
@@ -135373,7 +135003,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
135373
135003
|
}
|
|
135374
135004
|
}
|
|
135375
135005
|
}
|
|
135376
|
-
_addSchema(schema2, meta3, baseId,
|
|
135006
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
135377
135007
|
let id;
|
|
135378
135008
|
const { schemaId } = this.opts;
|
|
135379
135009
|
if (typeof schema2 == "object") id = schema2[schemaId];
|
|
@@ -135395,7 +135025,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
135395
135025
|
if (baseId) this._checkUnique(baseId);
|
|
135396
135026
|
this.refs[baseId] = sch;
|
|
135397
135027
|
}
|
|
135398
|
-
if (
|
|
135028
|
+
if (validateSchema) this.validateSchema(schema2, true);
|
|
135399
135029
|
return sch;
|
|
135400
135030
|
}
|
|
135401
135031
|
_checkUnique(id) {
|
|
@@ -148156,8 +147786,8 @@ var require_validate3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
148156
147786
|
}
|
|
148157
147787
|
}
|
|
148158
147788
|
function returnResults(it) {
|
|
148159
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
148160
|
-
if (schemaEnv.$async) gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${
|
|
147789
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
147790
|
+
if (schemaEnv.$async) gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError2}(${names_1.default.vErrors})`));
|
|
148161
147791
|
else {
|
|
148162
147792
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
148163
147793
|
if (opts.unevaluated) assignEvaluated(it);
|
|
@@ -148439,14 +148069,14 @@ var require_validate3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
148439
148069
|
}));
|
|
148440
148070
|
var require_validation_error3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
148441
148071
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
148442
|
-
var
|
|
148072
|
+
var ValidationError2 = class extends Error {
|
|
148443
148073
|
constructor(errors) {
|
|
148444
148074
|
super("validation failed");
|
|
148445
148075
|
this.errors = errors;
|
|
148446
148076
|
this.ajv = this.validation = true;
|
|
148447
148077
|
}
|
|
148448
148078
|
};
|
|
148449
|
-
exports.default =
|
|
148079
|
+
exports.default = ValidationError2;
|
|
148450
148080
|
}));
|
|
148451
148081
|
var require_ref_error3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
148452
148082
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -149051,21 +148681,21 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
149051
148681
|
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils7();
|
|
149052
148682
|
const { SCHEMES, getSchemeHandler } = require_schemes3();
|
|
149053
148683
|
function normalize3(uri, options) {
|
|
149054
|
-
if (typeof uri === "string") uri =
|
|
149055
|
-
else if (typeof uri === "object") uri = parse6(
|
|
148684
|
+
if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
|
|
148685
|
+
else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
|
|
149056
148686
|
return uri;
|
|
149057
148687
|
}
|
|
149058
148688
|
function resolve3(baseURI, relativeURI, options) {
|
|
149059
148689
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
149060
148690
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
149061
148691
|
schemelessOptions.skipEscape = true;
|
|
149062
|
-
return
|
|
148692
|
+
return serialize2(resolved, schemelessOptions);
|
|
149063
148693
|
}
|
|
149064
148694
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
149065
148695
|
const target = {};
|
|
149066
148696
|
if (!skipNormalization) {
|
|
149067
|
-
base = parse6(
|
|
149068
|
-
relative = parse6(
|
|
148697
|
+
base = parse6(serialize2(base, options), options);
|
|
148698
|
+
relative = parse6(serialize2(relative, options), options);
|
|
149069
148699
|
}
|
|
149070
148700
|
options = options || {};
|
|
149071
148701
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -149109,27 +148739,27 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
149109
148739
|
function equal(uriA, uriB, options) {
|
|
149110
148740
|
if (typeof uriA === "string") {
|
|
149111
148741
|
uriA = unescape(uriA);
|
|
149112
|
-
uriA =
|
|
148742
|
+
uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
|
|
149113
148743
|
...options,
|
|
149114
148744
|
skipEscape: true
|
|
149115
148745
|
});
|
|
149116
|
-
} else if (typeof uriA === "object") uriA =
|
|
148746
|
+
} else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
|
|
149117
148747
|
...options,
|
|
149118
148748
|
skipEscape: true
|
|
149119
148749
|
});
|
|
149120
148750
|
if (typeof uriB === "string") {
|
|
149121
148751
|
uriB = unescape(uriB);
|
|
149122
|
-
uriB =
|
|
148752
|
+
uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
|
|
149123
148753
|
...options,
|
|
149124
148754
|
skipEscape: true
|
|
149125
148755
|
});
|
|
149126
|
-
} else if (typeof uriB === "object") uriB =
|
|
148756
|
+
} else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
|
|
149127
148757
|
...options,
|
|
149128
148758
|
skipEscape: true
|
|
149129
148759
|
});
|
|
149130
148760
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
149131
148761
|
}
|
|
149132
|
-
function
|
|
148762
|
+
function serialize2(cmpts, opts) {
|
|
149133
148763
|
const component = {
|
|
149134
148764
|
host: cmpts.host,
|
|
149135
148765
|
scheme: cmpts.scheme,
|
|
@@ -149232,7 +148862,7 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
149232
148862
|
resolve: resolve3,
|
|
149233
148863
|
resolveComponent,
|
|
149234
148864
|
equal,
|
|
149235
|
-
serialize,
|
|
148865
|
+
serialize: serialize2,
|
|
149236
148866
|
parse: parse6
|
|
149237
148867
|
};
|
|
149238
148868
|
module.exports = fastUri;
|
|
@@ -149658,7 +149288,7 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
149658
149288
|
}
|
|
149659
149289
|
}
|
|
149660
149290
|
}
|
|
149661
|
-
_addSchema(schema2, meta3, baseId,
|
|
149291
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
149662
149292
|
let id;
|
|
149663
149293
|
const { schemaId } = this.opts;
|
|
149664
149294
|
if (typeof schema2 == "object") id = schema2[schemaId];
|
|
@@ -149680,7 +149310,7 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
149680
149310
|
if (baseId) this._checkUnique(baseId);
|
|
149681
149311
|
this.refs[baseId] = sch;
|
|
149682
149312
|
}
|
|
149683
|
-
if (
|
|
149313
|
+
if (validateSchema) this.validateSchema(schema2, true);
|
|
149684
149314
|
return sch;
|
|
149685
149315
|
}
|
|
149686
149316
|
_checkUnique(id) {
|
|
@@ -174525,8 +174155,8 @@ var createNode = ({ id, kind, inner, meta: meta3, $: $2, ignoreCache }) => {
|
|
|
174525
174155
|
let innerJson = {};
|
|
174526
174156
|
for (const [k2, v] of innerEntries) {
|
|
174527
174157
|
const keyImpl = impl.keys[k2];
|
|
174528
|
-
const
|
|
174529
|
-
innerJson[k2] =
|
|
174158
|
+
const serialize2 = keyImpl.serialize ?? (keyImpl.child ? serializeListableChild : defaultValueSerializer);
|
|
174159
|
+
innerJson[k2] = serialize2(v);
|
|
174530
174160
|
if (keyImpl.child === true) {
|
|
174531
174161
|
const listableNode = v;
|
|
174532
174162
|
if (isArray(listableNode))
|
|
@@ -180075,6 +179705,1064 @@ var schema = ark.schema;
|
|
|
180075
179705
|
var define2 = ark.define;
|
|
180076
179706
|
var declare = ark.declare;
|
|
180077
179707
|
|
|
179708
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
|
|
179709
|
+
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
179710
|
+
|
|
179711
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/adapter.js
|
|
179712
|
+
var AdapterError = class extends Error {
|
|
179713
|
+
method;
|
|
179714
|
+
/** the full store key, or the op's prefix when the call covered many keys. never the raw input. */
|
|
179715
|
+
key;
|
|
179716
|
+
constructor(method, key, cause) {
|
|
179717
|
+
super(`cache ${method} failed for ${key}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
179718
|
+
this.name = "AdapterError";
|
|
179719
|
+
this.method = method;
|
|
179720
|
+
this.key = key;
|
|
179721
|
+
}
|
|
179722
|
+
};
|
|
179723
|
+
|
|
179724
|
+
// node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
179725
|
+
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
179726
|
+
var S = P("lru-cache:metrics");
|
|
179727
|
+
var W = G("lru-cache");
|
|
179728
|
+
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
179729
|
+
var R = () => S.hasSubscribers || W.hasSubscribers;
|
|
179730
|
+
var U = /* @__PURE__ */ new Set();
|
|
179731
|
+
var M = typeof process == "object" && process ? process : {};
|
|
179732
|
+
var k = (d3, e, t, i) => {
|
|
179733
|
+
typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t, i) : console.error(`[${t}] ${e}: ${d3}`);
|
|
179734
|
+
};
|
|
179735
|
+
var H = (d3) => !U.has(d3);
|
|
179736
|
+
var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
|
|
179737
|
+
var j = (d3) => T(d3) ? d3 <= Math.pow(2, 8) ? Uint8Array : d3 <= Math.pow(2, 16) ? Uint16Array : d3 <= Math.pow(2, 32) ? Uint32Array : d3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
|
|
179738
|
+
var O = class extends Array {
|
|
179739
|
+
constructor(e) {
|
|
179740
|
+
super(e), this.fill(0);
|
|
179741
|
+
}
|
|
179742
|
+
};
|
|
179743
|
+
var x = class d {
|
|
179744
|
+
heap;
|
|
179745
|
+
length;
|
|
179746
|
+
static #o = false;
|
|
179747
|
+
static create(e) {
|
|
179748
|
+
let t = j(e);
|
|
179749
|
+
if (!t) return [];
|
|
179750
|
+
d.#o = true;
|
|
179751
|
+
let i = new d(e, t);
|
|
179752
|
+
return d.#o = false, i;
|
|
179753
|
+
}
|
|
179754
|
+
constructor(e, t) {
|
|
179755
|
+
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
179756
|
+
this.heap = new t(e), this.length = 0;
|
|
179757
|
+
}
|
|
179758
|
+
push(e) {
|
|
179759
|
+
this.heap[this.length++] = e;
|
|
179760
|
+
}
|
|
179761
|
+
pop() {
|
|
179762
|
+
return this.heap[--this.length];
|
|
179763
|
+
}
|
|
179764
|
+
};
|
|
179765
|
+
var I = class d2 {
|
|
179766
|
+
#o;
|
|
179767
|
+
#c;
|
|
179768
|
+
#S;
|
|
179769
|
+
#O;
|
|
179770
|
+
#w;
|
|
179771
|
+
#M;
|
|
179772
|
+
#I;
|
|
179773
|
+
#m;
|
|
179774
|
+
get perf() {
|
|
179775
|
+
return this.#m;
|
|
179776
|
+
}
|
|
179777
|
+
ttl;
|
|
179778
|
+
ttlResolution;
|
|
179779
|
+
ttlAutopurge;
|
|
179780
|
+
updateAgeOnGet;
|
|
179781
|
+
updateAgeOnHas;
|
|
179782
|
+
allowStale;
|
|
179783
|
+
noDisposeOnSet;
|
|
179784
|
+
noUpdateTTL;
|
|
179785
|
+
maxEntrySize;
|
|
179786
|
+
sizeCalculation;
|
|
179787
|
+
noDeleteOnFetchRejection;
|
|
179788
|
+
noDeleteOnStaleGet;
|
|
179789
|
+
allowStaleOnFetchAbort;
|
|
179790
|
+
allowStaleOnFetchRejection;
|
|
179791
|
+
ignoreFetchAbort;
|
|
179792
|
+
backgroundFetchSize;
|
|
179793
|
+
#n;
|
|
179794
|
+
#b;
|
|
179795
|
+
#s;
|
|
179796
|
+
#i;
|
|
179797
|
+
#t;
|
|
179798
|
+
#l;
|
|
179799
|
+
#u;
|
|
179800
|
+
#a;
|
|
179801
|
+
#h;
|
|
179802
|
+
#y;
|
|
179803
|
+
#r;
|
|
179804
|
+
#_;
|
|
179805
|
+
#F;
|
|
179806
|
+
#d;
|
|
179807
|
+
#g;
|
|
179808
|
+
#T;
|
|
179809
|
+
#U;
|
|
179810
|
+
#f;
|
|
179811
|
+
#D;
|
|
179812
|
+
static unsafeExposeInternals(e) {
|
|
179813
|
+
return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#l, prev: e.#u, get head() {
|
|
179814
|
+
return e.#a;
|
|
179815
|
+
}, get tail() {
|
|
179816
|
+
return e.#h;
|
|
179817
|
+
}, free: e.#y, isBackgroundFetch: (t) => e.#e(t), backgroundFetch: (t, i, s, n) => e.#P(t, i, s, n), moveToTail: (t) => e.#L(t), indexes: (t) => e.#A(t), rindexes: (t) => e.#z(t), isStale: (t) => e.#p(t) };
|
|
179818
|
+
}
|
|
179819
|
+
get max() {
|
|
179820
|
+
return this.#o;
|
|
179821
|
+
}
|
|
179822
|
+
get maxSize() {
|
|
179823
|
+
return this.#c;
|
|
179824
|
+
}
|
|
179825
|
+
get calculatedSize() {
|
|
179826
|
+
return this.#b;
|
|
179827
|
+
}
|
|
179828
|
+
get size() {
|
|
179829
|
+
return this.#n;
|
|
179830
|
+
}
|
|
179831
|
+
get fetchMethod() {
|
|
179832
|
+
return this.#M;
|
|
179833
|
+
}
|
|
179834
|
+
get memoMethod() {
|
|
179835
|
+
return this.#I;
|
|
179836
|
+
}
|
|
179837
|
+
get dispose() {
|
|
179838
|
+
return this.#S;
|
|
179839
|
+
}
|
|
179840
|
+
get onInsert() {
|
|
179841
|
+
return this.#O;
|
|
179842
|
+
}
|
|
179843
|
+
get disposeAfter() {
|
|
179844
|
+
return this.#w;
|
|
179845
|
+
}
|
|
179846
|
+
constructor(e) {
|
|
179847
|
+
let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y, fetchMethod: a, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z2, backgroundFetchSize: C = 1, perf: E } = e;
|
|
179848
|
+
if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
179849
|
+
if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
|
|
179850
|
+
let v = t ? j(t) : Array;
|
|
179851
|
+
if (!v) throw new Error("invalid max value: " + t);
|
|
179852
|
+
if (this.#o = t, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y, this.sizeCalculation) {
|
|
179853
|
+
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
179854
|
+
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
179855
|
+
}
|
|
179856
|
+
if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
179857
|
+
if (this.#I = w, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
179858
|
+
if (this.#M = a, this.#U = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v(t), this.#u = new v(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m == "function" ? (this.#w = m, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z2, this.maxEntrySize !== 0) {
|
|
179859
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
179860
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
179861
|
+
this.#X();
|
|
179862
|
+
}
|
|
179863
|
+
if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
179864
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
179865
|
+
this.#k();
|
|
179866
|
+
}
|
|
179867
|
+
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
179868
|
+
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
179869
|
+
let D = "LRU_CACHE_UNBOUNDED";
|
|
179870
|
+
H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
179871
|
+
}
|
|
179872
|
+
}
|
|
179873
|
+
getRemainingTTL(e) {
|
|
179874
|
+
return this.#s.has(e) ? 1 / 0 : 0;
|
|
179875
|
+
}
|
|
179876
|
+
#k() {
|
|
179877
|
+
let e = new O(this.#o), t = new O(this.#o);
|
|
179878
|
+
this.#d = e, this.#F = t;
|
|
179879
|
+
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
179880
|
+
this.#g = i, this.#H = (h, r, c = this.#m.now()) => {
|
|
179881
|
+
t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
|
|
179882
|
+
}, this.#R = (h) => {
|
|
179883
|
+
t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
|
|
179884
|
+
};
|
|
179885
|
+
let s = this.ttlAutopurge ? (h, r) => {
|
|
179886
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
|
|
179887
|
+
let c = setTimeout(() => {
|
|
179888
|
+
this.#p(h) ? (this.#E(this.#i[h], "expire"), i[h] = void 0) : s(h, l(h));
|
|
179889
|
+
}, r + 1);
|
|
179890
|
+
c.unref && c.unref(), i[h] = c;
|
|
179891
|
+
}
|
|
179892
|
+
} : () => {
|
|
179893
|
+
};
|
|
179894
|
+
this.#v = (h, r) => {
|
|
179895
|
+
if (e[r]) {
|
|
179896
|
+
let c = e[r], m = t[r];
|
|
179897
|
+
if (!c || !m) return;
|
|
179898
|
+
h.ttl = c, h.start = m, h.now = n || o();
|
|
179899
|
+
let _ = h.now - m;
|
|
179900
|
+
h.remainingTTL = c - _;
|
|
179901
|
+
}
|
|
179902
|
+
};
|
|
179903
|
+
let n = 0, o = () => {
|
|
179904
|
+
let h = this.#m.now();
|
|
179905
|
+
if (this.ttlResolution > 0) {
|
|
179906
|
+
n = h;
|
|
179907
|
+
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
179908
|
+
r.unref && r.unref();
|
|
179909
|
+
}
|
|
179910
|
+
return h;
|
|
179911
|
+
};
|
|
179912
|
+
this.getRemainingTTL = (h) => {
|
|
179913
|
+
let r = this.#s.get(h);
|
|
179914
|
+
return r === void 0 ? 0 : l(r);
|
|
179915
|
+
};
|
|
179916
|
+
let l = (h) => {
|
|
179917
|
+
let r = e[h], c = t[h];
|
|
179918
|
+
if (!r || !c) return 1 / 0;
|
|
179919
|
+
let m = (n || o()) - c;
|
|
179920
|
+
return r - m;
|
|
179921
|
+
};
|
|
179922
|
+
this.#p = (h) => {
|
|
179923
|
+
let r = t[h], c = e[h];
|
|
179924
|
+
return !!c && !!r && (n || o()) - r > c;
|
|
179925
|
+
};
|
|
179926
|
+
}
|
|
179927
|
+
#R = () => {
|
|
179928
|
+
};
|
|
179929
|
+
#v = () => {
|
|
179930
|
+
};
|
|
179931
|
+
#H = () => {
|
|
179932
|
+
};
|
|
179933
|
+
#p = () => false;
|
|
179934
|
+
#X() {
|
|
179935
|
+
let e = new O(this.#o);
|
|
179936
|
+
this.#b = 0, this.#_ = e, this.#x = (t) => {
|
|
179937
|
+
this.#b -= e[t], e[t] = 0;
|
|
179938
|
+
}, this.#N = (t, i, s, n) => {
|
|
179939
|
+
if (!T(s)) {
|
|
179940
|
+
if (this.#e(i)) return this.backgroundFetchSize;
|
|
179941
|
+
if (n) {
|
|
179942
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
179943
|
+
if (s = n(i, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
179944
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
179945
|
+
}
|
|
179946
|
+
return s;
|
|
179947
|
+
}, this.#j = (t, i, s) => {
|
|
179948
|
+
if (e[t] = i, this.#c) {
|
|
179949
|
+
let n = this.#c - e[t];
|
|
179950
|
+
for (; this.#b > n; ) this.#G(true);
|
|
179951
|
+
}
|
|
179952
|
+
this.#b += e[t], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
|
|
179953
|
+
};
|
|
179954
|
+
}
|
|
179955
|
+
#x = (e) => {
|
|
179956
|
+
};
|
|
179957
|
+
#j = (e, t, i) => {
|
|
179958
|
+
};
|
|
179959
|
+
#N = (e, t, i, s) => {
|
|
179960
|
+
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
179961
|
+
return 0;
|
|
179962
|
+
};
|
|
179963
|
+
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
179964
|
+
if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
|
|
179965
|
+
}
|
|
179966
|
+
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
179967
|
+
if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
|
|
179968
|
+
}
|
|
179969
|
+
#V(e) {
|
|
179970
|
+
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
179971
|
+
}
|
|
179972
|
+
*entries() {
|
|
179973
|
+
for (let e of this.#A()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
|
|
179974
|
+
}
|
|
179975
|
+
*rentries() {
|
|
179976
|
+
for (let e of this.#z()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
|
|
179977
|
+
}
|
|
179978
|
+
*keys() {
|
|
179979
|
+
for (let e of this.#A()) {
|
|
179980
|
+
let t = this.#i[e];
|
|
179981
|
+
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
179982
|
+
}
|
|
179983
|
+
}
|
|
179984
|
+
*rkeys() {
|
|
179985
|
+
for (let e of this.#z()) {
|
|
179986
|
+
let t = this.#i[e];
|
|
179987
|
+
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
179988
|
+
}
|
|
179989
|
+
}
|
|
179990
|
+
*values() {
|
|
179991
|
+
for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
179992
|
+
}
|
|
179993
|
+
*rvalues() {
|
|
179994
|
+
for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
179995
|
+
}
|
|
179996
|
+
[Symbol.iterator]() {
|
|
179997
|
+
return this.entries();
|
|
179998
|
+
}
|
|
179999
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
180000
|
+
find(e, t = {}) {
|
|
180001
|
+
for (let i of this.#A()) {
|
|
180002
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
180003
|
+
if (n !== void 0 && e(n, this.#i[i], this)) return this.#C(this.#i[i], t);
|
|
180004
|
+
}
|
|
180005
|
+
}
|
|
180006
|
+
forEach(e, t = this) {
|
|
180007
|
+
for (let i of this.#A()) {
|
|
180008
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
180009
|
+
n !== void 0 && e.call(t, n, this.#i[i], this);
|
|
180010
|
+
}
|
|
180011
|
+
}
|
|
180012
|
+
rforEach(e, t = this) {
|
|
180013
|
+
for (let i of this.#z()) {
|
|
180014
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
180015
|
+
n !== void 0 && e.call(t, n, this.#i[i], this);
|
|
180016
|
+
}
|
|
180017
|
+
}
|
|
180018
|
+
purgeStale() {
|
|
180019
|
+
let e = false;
|
|
180020
|
+
for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
|
|
180021
|
+
return e;
|
|
180022
|
+
}
|
|
180023
|
+
info(e) {
|
|
180024
|
+
let t = this.#s.get(e);
|
|
180025
|
+
if (t === void 0) return;
|
|
180026
|
+
let i = this.#t[t], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
180027
|
+
if (s === void 0) return;
|
|
180028
|
+
let n = { value: s };
|
|
180029
|
+
if (this.#d && this.#F) {
|
|
180030
|
+
let o = this.#d[t], l = this.#F[t];
|
|
180031
|
+
if (o && l) {
|
|
180032
|
+
let h = o - (this.#m.now() - l);
|
|
180033
|
+
n.ttl = h, n.start = Date.now();
|
|
180034
|
+
}
|
|
180035
|
+
}
|
|
180036
|
+
return this.#_ && (n.size = this.#_[t]), n;
|
|
180037
|
+
}
|
|
180038
|
+
dump() {
|
|
180039
|
+
let e = [];
|
|
180040
|
+
for (let t of this.#A({ allowStale: true })) {
|
|
180041
|
+
let i = this.#i[t], s = this.#t[t], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
180042
|
+
if (n === void 0 || i === void 0) continue;
|
|
180043
|
+
let o = { value: n };
|
|
180044
|
+
if (this.#d && this.#F) {
|
|
180045
|
+
o.ttl = this.#d[t];
|
|
180046
|
+
let l = this.#m.now() - this.#F[t];
|
|
180047
|
+
o.start = Math.floor(Date.now() - l);
|
|
180048
|
+
}
|
|
180049
|
+
this.#_ && (o.size = this.#_[t]), e.unshift([i, o]);
|
|
180050
|
+
}
|
|
180051
|
+
return e;
|
|
180052
|
+
}
|
|
180053
|
+
load(e) {
|
|
180054
|
+
this.clear();
|
|
180055
|
+
for (let [t, i] of e) {
|
|
180056
|
+
if (i.start) {
|
|
180057
|
+
let s = Date.now() - i.start;
|
|
180058
|
+
i.start = this.#m.now() - s;
|
|
180059
|
+
}
|
|
180060
|
+
this.#W(t, i.value, i);
|
|
180061
|
+
}
|
|
180062
|
+
}
|
|
180063
|
+
set(e, t, i = {}) {
|
|
180064
|
+
let { status: s = S.hasSubscribers ? {} : void 0 } = i;
|
|
180065
|
+
i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
|
|
180066
|
+
let n = this.#W(e, t, i);
|
|
180067
|
+
return s && S.hasSubscribers && S.publish(s), n;
|
|
180068
|
+
}
|
|
180069
|
+
#W(e, t, i, s) {
|
|
180070
|
+
let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(t);
|
|
180071
|
+
if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
|
|
180072
|
+
let { noUpdateTTL: m = this.noUpdateTTL } = i;
|
|
180073
|
+
r && !c && (r.value = t);
|
|
180074
|
+
let _ = this.#N(e, t, i.size || 0, h, r);
|
|
180075
|
+
if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
|
|
180076
|
+
let u = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
180077
|
+
if (u === void 0) u = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u] = e, this.#t[u] = t, this.#s.set(e, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#j(u, _, r), r && (r.set = "add"), m = false, this.#D && !c && this.#O?.(t, e, "add");
|
|
180078
|
+
else {
|
|
180079
|
+
this.#L(u);
|
|
180080
|
+
let g = this.#t[u];
|
|
180081
|
+
if (t !== g) {
|
|
180082
|
+
if (!l) if (this.#e(g)) {
|
|
180083
|
+
g !== s && g.__abortController.abort(new Error("replaced"));
|
|
180084
|
+
let { __staleWhileFetching: f } = g;
|
|
180085
|
+
f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
180086
|
+
} else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
|
|
180087
|
+
if (this.#x(u), this.#j(u, _, r), this.#t[u] = t, !c) {
|
|
180088
|
+
let f = g && this.#e(g) ? g.__staleWhileFetching : g, y = f === void 0 ? "add" : t !== f ? "replace" : "update";
|
|
180089
|
+
r && (r.set = y, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y);
|
|
180090
|
+
}
|
|
180091
|
+
} else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
|
|
180092
|
+
}
|
|
180093
|
+
if (n !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u, n, o), r && this.#v(r, u)), !l && this.#f && this.#r) {
|
|
180094
|
+
let g = this.#r, f;
|
|
180095
|
+
for (; f = g?.shift(); ) this.#w?.(...f);
|
|
180096
|
+
}
|
|
180097
|
+
return this;
|
|
180098
|
+
}
|
|
180099
|
+
pop() {
|
|
180100
|
+
try {
|
|
180101
|
+
for (; this.#n; ) {
|
|
180102
|
+
let e = this.#t[this.#a];
|
|
180103
|
+
if (this.#G(true), this.#e(e)) {
|
|
180104
|
+
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
180105
|
+
} else if (e !== void 0) return e;
|
|
180106
|
+
}
|
|
180107
|
+
} finally {
|
|
180108
|
+
if (this.#f && this.#r) {
|
|
180109
|
+
let e = this.#r, t;
|
|
180110
|
+
for (; t = e?.shift(); ) this.#w?.(...t);
|
|
180111
|
+
}
|
|
180112
|
+
}
|
|
180113
|
+
}
|
|
180114
|
+
#G(e) {
|
|
180115
|
+
let t = this.#a, i = this.#i[t], s = this.#t[t], n = this.#e(s);
|
|
180116
|
+
n && s.__abortController.abort(new Error("evicted"));
|
|
180117
|
+
let o = n ? s.__staleWhileFetching : s;
|
|
180118
|
+
return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i, "evict"), this.#f && this.#r?.push([o, i, "evict"])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i), this.#n--, t;
|
|
180119
|
+
}
|
|
180120
|
+
has(e, t = {}) {
|
|
180121
|
+
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
180122
|
+
t.status = i, i && (i.op = "has", i.key = e, i.cache = this);
|
|
180123
|
+
let s = this.#Y(e, t);
|
|
180124
|
+
return S.hasSubscribers && S.publish(i), s;
|
|
180125
|
+
}
|
|
180126
|
+
#Y(e, t = {}) {
|
|
180127
|
+
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = t, n = this.#s.get(e);
|
|
180128
|
+
if (n !== void 0) {
|
|
180129
|
+
let o = this.#t[n];
|
|
180130
|
+
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
180131
|
+
if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
|
|
180132
|
+
else return i && this.#R(n), s && (s.has = "hit", this.#v(s, n)), true;
|
|
180133
|
+
} else s && (s.has = "miss");
|
|
180134
|
+
return false;
|
|
180135
|
+
}
|
|
180136
|
+
peek(e, t = {}) {
|
|
180137
|
+
let { status: i = R() ? {} : void 0 } = t;
|
|
180138
|
+
i && (i.op = "peek", i.key = e, i.cache = this), t.status = i;
|
|
180139
|
+
let s = this.#J(e, t);
|
|
180140
|
+
return S.hasSubscribers && S.publish(i), s;
|
|
180141
|
+
}
|
|
180142
|
+
#J(e, t) {
|
|
180143
|
+
let { status: i, allowStale: s = this.allowStale } = t, n = this.#s.get(e);
|
|
180144
|
+
if (n === void 0 || !s && this.#p(n)) {
|
|
180145
|
+
i && (i.peek = n === void 0 ? "miss" : "stale");
|
|
180146
|
+
return;
|
|
180147
|
+
}
|
|
180148
|
+
let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
|
|
180149
|
+
return i && (l !== void 0 ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l;
|
|
180150
|
+
}
|
|
180151
|
+
#P(e, t, i, s) {
|
|
180152
|
+
let n = t === void 0 ? void 0 : this.#t[t];
|
|
180153
|
+
if (this.#e(n)) return n;
|
|
180154
|
+
let o = new AbortController(), { signal: l } = i;
|
|
180155
|
+
l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
|
|
180156
|
+
let h = { signal: o.signal, options: i, context: s }, r = (f, y = false) => {
|
|
180157
|
+
let { aborted: a } = o.signal, w = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
|
|
180158
|
+
if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, w && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !w && !y) return m(o.signal.reason, F);
|
|
180159
|
+
let b = u, p = this.#t[t];
|
|
180160
|
+
return (p === u || p === void 0 && w && y) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#W(e, f, h.options, b))), f;
|
|
180161
|
+
}, c = (f) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = f), m(f, false)), m = (f, y) => {
|
|
180162
|
+
let { aborted: a } = o.signal, w = a && i.allowStaleOnFetchAbort, F = w || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, p = u;
|
|
180163
|
+
if (this.#t[t] === u && (!b || !y && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t] = p.__staleWhileFetching)), F) return i.status && p.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), p.__staleWhileFetching;
|
|
180164
|
+
if (p.__returned === p) throw f;
|
|
180165
|
+
}, _ = (f, y) => {
|
|
180166
|
+
let a = this.#M?.(e, n, h);
|
|
180167
|
+
o.signal.addEventListener("abort", () => {
|
|
180168
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (w) => r(w, true)));
|
|
180169
|
+
}), a && a instanceof Promise ? a.then((w) => f(w === void 0 ? void 0 : w), y) : a !== void 0 && f(a);
|
|
180170
|
+
};
|
|
180171
|
+
i.status && (i.status.fetchDispatched = true);
|
|
180172
|
+
let u = new Promise(_).then(r, c), g = Object.assign(u, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
|
|
180173
|
+
return t === void 0 ? (this.#W(e, g, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g, g;
|
|
180174
|
+
}
|
|
180175
|
+
#e(e) {
|
|
180176
|
+
if (!this.#U) return false;
|
|
180177
|
+
let t = e;
|
|
180178
|
+
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
180179
|
+
}
|
|
180180
|
+
fetch(e, t = {}) {
|
|
180181
|
+
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
180182
|
+
t.status = s, s && t.context && (s.context = t.context);
|
|
180183
|
+
let n = this.#B(e, t);
|
|
180184
|
+
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
180185
|
+
})), n;
|
|
180186
|
+
}
|
|
180187
|
+
async #B(e, t = {}) {
|
|
180188
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y = false, status: a, signal: w } = t;
|
|
180189
|
+
if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true), a.cache = this), !this.#U) return a && (a.fetch = "get"), this.#C(e, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a });
|
|
180190
|
+
let F = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u, status: a, signal: w }, b = this.#s.get(e);
|
|
180191
|
+
if (b === void 0) {
|
|
180192
|
+
a && (a.fetch = "miss");
|
|
180193
|
+
let p = this.#P(e, b, F, f);
|
|
180194
|
+
return p.__returned = p;
|
|
180195
|
+
} else {
|
|
180196
|
+
let p = this.#t[b];
|
|
180197
|
+
if (this.#e(p)) {
|
|
180198
|
+
let v = i && p.__staleWhileFetching !== void 0;
|
|
180199
|
+
return a && (a.fetch = "inflight", v && (a.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
|
|
180200
|
+
}
|
|
180201
|
+
let A = this.#p(b);
|
|
180202
|
+
if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#R(b), a && this.#v(a, b), p;
|
|
180203
|
+
let z2 = this.#P(e, b, F, f), E = z2.__staleWhileFetching !== void 0 && i;
|
|
180204
|
+
return a && (a.fetch = A ? "stale" : "refresh", E && A && (a.returnedStale = true)), E ? z2.__staleWhileFetching : z2.__returned = z2;
|
|
180205
|
+
}
|
|
180206
|
+
}
|
|
180207
|
+
forceFetch(e, t = {}) {
|
|
180208
|
+
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
180209
|
+
t.status = s, s && t.context && (s.context = t.context);
|
|
180210
|
+
let n = this.#K(e, t);
|
|
180211
|
+
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
180212
|
+
})), n;
|
|
180213
|
+
}
|
|
180214
|
+
async #K(e, t = {}) {
|
|
180215
|
+
let i = await this.#B(e, t);
|
|
180216
|
+
if (i === void 0) throw new Error("fetch() returned undefined");
|
|
180217
|
+
return i;
|
|
180218
|
+
}
|
|
180219
|
+
memo(e, t = {}) {
|
|
180220
|
+
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
180221
|
+
t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context), i.cache = this);
|
|
180222
|
+
let s = this.#Q(e, t);
|
|
180223
|
+
return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
|
|
180224
|
+
}
|
|
180225
|
+
#Q(e, t = {}) {
|
|
180226
|
+
let i = this.#I;
|
|
180227
|
+
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
180228
|
+
let { context: s, status: n, forceRefresh: o, ...l } = t;
|
|
180229
|
+
n && o && (n.forceRefresh = true);
|
|
180230
|
+
let h = this.#C(e, l), r = o || h === void 0;
|
|
180231
|
+
if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
|
|
180232
|
+
let c = i(e, h, { options: l, context: s });
|
|
180233
|
+
return n && (n.value = c), this.#W(e, c, l), c;
|
|
180234
|
+
}
|
|
180235
|
+
get(e, t = {}) {
|
|
180236
|
+
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
180237
|
+
t.status = i, i && (i.op = "get", i.key = e, i.cache = this);
|
|
180238
|
+
let s = this.#C(e, t);
|
|
180239
|
+
return i && (s !== void 0 && (i.value = s), S.hasSubscribers && S.publish(i)), s;
|
|
180240
|
+
}
|
|
180241
|
+
#C(e, t = {}) {
|
|
180242
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
|
|
180243
|
+
if (l === void 0) {
|
|
180244
|
+
o && (o.get = "miss");
|
|
180245
|
+
return;
|
|
180246
|
+
}
|
|
180247
|
+
let h = this.#t[l], r = this.#e(h);
|
|
180248
|
+
return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n || this.#E(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
|
|
180249
|
+
}
|
|
180250
|
+
#$(e, t) {
|
|
180251
|
+
this.#u[t] = e, this.#l[e] = t;
|
|
180252
|
+
}
|
|
180253
|
+
#L(e) {
|
|
180254
|
+
e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
|
|
180255
|
+
}
|
|
180256
|
+
delete(e) {
|
|
180257
|
+
return this.#E(e, "delete");
|
|
180258
|
+
}
|
|
180259
|
+
#E(e, t) {
|
|
180260
|
+
S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
|
|
180261
|
+
let i = false;
|
|
180262
|
+
if (this.#n !== 0) {
|
|
180263
|
+
let s = this.#s.get(e);
|
|
180264
|
+
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i = true, this.#n === 1) this.#q(t);
|
|
180265
|
+
else {
|
|
180266
|
+
this.#x(s);
|
|
180267
|
+
let n = this.#t[s];
|
|
180268
|
+
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([n, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
180269
|
+
else if (s === this.#a) this.#a = this.#l[s];
|
|
180270
|
+
else {
|
|
180271
|
+
let o = this.#u[s];
|
|
180272
|
+
this.#l[o] = this.#l[s];
|
|
180273
|
+
let l = this.#l[s];
|
|
180274
|
+
this.#u[l] = this.#u[s];
|
|
180275
|
+
}
|
|
180276
|
+
this.#n--, this.#y.push(s);
|
|
180277
|
+
}
|
|
180278
|
+
}
|
|
180279
|
+
if (this.#f && this.#r?.length) {
|
|
180280
|
+
let s = this.#r, n;
|
|
180281
|
+
for (; n = s?.shift(); ) this.#w?.(...n);
|
|
180282
|
+
}
|
|
180283
|
+
return i;
|
|
180284
|
+
}
|
|
180285
|
+
clear() {
|
|
180286
|
+
return this.#q("delete");
|
|
180287
|
+
}
|
|
180288
|
+
#q(e) {
|
|
180289
|
+
for (let t of this.#z({ allowStale: true })) {
|
|
180290
|
+
let i = this.#t[t];
|
|
180291
|
+
if (this.#e(i)) i.__abortController.abort(new Error("deleted"));
|
|
180292
|
+
else {
|
|
180293
|
+
let s = this.#i[t];
|
|
180294
|
+
this.#T && this.#S?.(i, s, e), this.#f && this.#r?.push([i, s, e]);
|
|
180295
|
+
}
|
|
180296
|
+
}
|
|
180297
|
+
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
180298
|
+
this.#d.fill(0), this.#F.fill(0);
|
|
180299
|
+
for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
|
|
180300
|
+
this.#g?.fill(void 0);
|
|
180301
|
+
}
|
|
180302
|
+
if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
180303
|
+
let t = this.#r, i;
|
|
180304
|
+
for (; i = t?.shift(); ) this.#w?.(...i);
|
|
180305
|
+
}
|
|
180306
|
+
}
|
|
180307
|
+
};
|
|
180308
|
+
|
|
180309
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/memory.js
|
|
180310
|
+
function memory(options = {}) {
|
|
180311
|
+
const store = new I({ max: options.maxItems ?? 1e3 });
|
|
180312
|
+
return {
|
|
180313
|
+
get: (key) => store.get(key),
|
|
180314
|
+
peek: (key) => store.peek(key),
|
|
180315
|
+
// the TTL rides on each entry rather than the whole cache, so ops with
|
|
180316
|
+
// different lifetimes can share one store
|
|
180317
|
+
set: (key, entry, ttlMs) => {
|
|
180318
|
+
store.set(key, entry, { ttl: ttlMs });
|
|
180319
|
+
},
|
|
180320
|
+
delete: (keys) => {
|
|
180321
|
+
for (const key of keys)
|
|
180322
|
+
store.delete(key);
|
|
180323
|
+
},
|
|
180324
|
+
// a snapshot, so deleting while iterating is safe. lru-cache skips expired
|
|
180325
|
+
// entries itself.
|
|
180326
|
+
list: (prefix) => [...store.entries()].filter(([key]) => key.startsWith(prefix))
|
|
180327
|
+
};
|
|
180328
|
+
}
|
|
180329
|
+
|
|
180330
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/key.js
|
|
180331
|
+
import { hash as hash2 } from "node:crypto";
|
|
180332
|
+
function hashKey(value2) {
|
|
180333
|
+
return hash2("sha1", serialize(value2, 0));
|
|
180334
|
+
}
|
|
180335
|
+
var MAX_DEPTH = 64;
|
|
180336
|
+
function serialize(value2, depth) {
|
|
180337
|
+
switch (typeof value2) {
|
|
180338
|
+
case "string":
|
|
180339
|
+
return JSON.stringify(value2);
|
|
180340
|
+
case "number":
|
|
180341
|
+
if (!Number.isFinite(value2))
|
|
180342
|
+
throw new Error(`${value2} cannot be part of a cache key`);
|
|
180343
|
+
return String(value2);
|
|
180344
|
+
case "boolean":
|
|
180345
|
+
return value2 ? "true" : "false";
|
|
180346
|
+
case "undefined":
|
|
180347
|
+
throw new Error("undefined cannot be part of a cache key, except as an object property");
|
|
180348
|
+
case "object":
|
|
180349
|
+
break;
|
|
180350
|
+
default:
|
|
180351
|
+
throw new Error(`a ${typeof value2} cannot be part of a cache key`);
|
|
180352
|
+
}
|
|
180353
|
+
if (value2 === null)
|
|
180354
|
+
return "null";
|
|
180355
|
+
if (depth === MAX_DEPTH)
|
|
180356
|
+
throw new Error(`an input nested more than ${MAX_DEPTH} levels deep, or circular`);
|
|
180357
|
+
depth++;
|
|
180358
|
+
if (Array.isArray(value2)) {
|
|
180359
|
+
let out2 = "[";
|
|
180360
|
+
for (let i = 0; i < value2.length; i++)
|
|
180361
|
+
out2 += `${i ? "," : ""}${serialize(value2[i], depth)}`;
|
|
180362
|
+
return `${out2}]`;
|
|
180363
|
+
}
|
|
180364
|
+
const proto = Object.getPrototypeOf(value2);
|
|
180365
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
180366
|
+
const name = proto.constructor?.name || "class instance";
|
|
180367
|
+
throw new Error(`a ${name} cannot be part of a cache key: only JSON data can`);
|
|
180368
|
+
}
|
|
180369
|
+
const record3 = value2;
|
|
180370
|
+
const keys = Object.keys(record3).sort();
|
|
180371
|
+
let out = "";
|
|
180372
|
+
for (const key of keys) {
|
|
180373
|
+
const v = record3[key];
|
|
180374
|
+
if (v !== void 0)
|
|
180375
|
+
out += `${out ? "," : ""}${JSON.stringify(key)}:${serialize(v, depth)}`;
|
|
180376
|
+
}
|
|
180377
|
+
return `{${out}}`;
|
|
180378
|
+
}
|
|
180379
|
+
|
|
180380
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
|
|
180381
|
+
var VOID_KEY = "~void";
|
|
180382
|
+
function getCacheKeyString(value2) {
|
|
180383
|
+
if (value2 === void 0)
|
|
180384
|
+
return VOID_KEY;
|
|
180385
|
+
if (value2 === null) {
|
|
180386
|
+
throw new Error("cache key cannot be null");
|
|
180387
|
+
}
|
|
180388
|
+
try {
|
|
180389
|
+
return hashKey(value2);
|
|
180390
|
+
} catch (error49) {
|
|
180391
|
+
throw new Error(`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`);
|
|
180392
|
+
}
|
|
180393
|
+
}
|
|
180394
|
+
function jitter(delayMs) {
|
|
180395
|
+
const half = delayMs / 2;
|
|
180396
|
+
return Math.round(half + Math.random() * half);
|
|
180397
|
+
}
|
|
180398
|
+
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
180399
|
+
function getErrorResponseHeaders(error49) {
|
|
180400
|
+
if (error49 === null || typeof error49 !== "object")
|
|
180401
|
+
return void 0;
|
|
180402
|
+
const source = error49;
|
|
180403
|
+
const headers = source.response?.headers ?? source.headers;
|
|
180404
|
+
if (headers === null || typeof headers !== "object")
|
|
180405
|
+
return void 0;
|
|
180406
|
+
return headers;
|
|
180407
|
+
}
|
|
180408
|
+
function retryAfterMs(error49) {
|
|
180409
|
+
const headers = getErrorResponseHeaders(error49);
|
|
180410
|
+
if (!headers)
|
|
180411
|
+
return void 0;
|
|
180412
|
+
const retryAfter = headers["retry-after"];
|
|
180413
|
+
if (typeof retryAfter === "string" && retryAfter.trim() !== "") {
|
|
180414
|
+
const seconds = Number(retryAfter);
|
|
180415
|
+
if (Number.isFinite(seconds))
|
|
180416
|
+
return Math.max(0, seconds * 1e3);
|
|
180417
|
+
const dateMs = Date.parse(retryAfter);
|
|
180418
|
+
if (!Number.isNaN(dateMs))
|
|
180419
|
+
return Math.max(0, dateMs - Date.now());
|
|
180420
|
+
}
|
|
180421
|
+
if (headers["x-ratelimit-remaining"] === "0") {
|
|
180422
|
+
const reset = headers["x-ratelimit-reset"];
|
|
180423
|
+
if (typeof reset === "string" && reset.trim() !== "") {
|
|
180424
|
+
const resetEpoch = Number(reset);
|
|
180425
|
+
if (Number.isFinite(resetEpoch))
|
|
180426
|
+
return Math.max(0, resetEpoch * 1e3 - Date.now());
|
|
180427
|
+
}
|
|
180428
|
+
}
|
|
180429
|
+
return void 0;
|
|
180430
|
+
}
|
|
180431
|
+
var ValidationError = class extends Error {
|
|
180432
|
+
result;
|
|
180433
|
+
issues;
|
|
180434
|
+
constructor(result) {
|
|
180435
|
+
const message = "message" in result && typeof result.message === "string" ? result.message : `validation failed: ${result.issues.map((i) => i.message).join(", ")}`;
|
|
180436
|
+
super(message);
|
|
180437
|
+
this.name = "ValidationError";
|
|
180438
|
+
this.result = result;
|
|
180439
|
+
this.issues = result.issues;
|
|
180440
|
+
}
|
|
180441
|
+
};
|
|
180442
|
+
async function assertSchema(schema2, value2) {
|
|
180443
|
+
const result = await schema2["~standard"].validate(value2);
|
|
180444
|
+
if (result.issues)
|
|
180445
|
+
throw new ValidationError(result);
|
|
180446
|
+
return result.value;
|
|
180447
|
+
}
|
|
180448
|
+
var log2 = {
|
|
180449
|
+
info: (...args2) => console.log(...args2),
|
|
180450
|
+
error: (...args2) => console.error(...args2),
|
|
180451
|
+
prod: (...args2) => {
|
|
180452
|
+
if (process.env.NODE_ENV === "production")
|
|
180453
|
+
console.log(...args2);
|
|
180454
|
+
}
|
|
180455
|
+
};
|
|
180456
|
+
function debugTrace(namePrefix, key) {
|
|
180457
|
+
if (process.env.LOG_LEVEL !== "debug")
|
|
180458
|
+
return void 0;
|
|
180459
|
+
const prefix = `${namePrefix}[${(/* @__PURE__ */ new Date()).toISOString()}]`;
|
|
180460
|
+
return {
|
|
180461
|
+
start: performance.now(),
|
|
180462
|
+
log: (message, data) => console.log(`${prefix} ${message}`, { key, ...data }),
|
|
180463
|
+
since: (start) => `${Math.round(performance.now() - start)}ms`
|
|
180464
|
+
};
|
|
180465
|
+
}
|
|
180466
|
+
function op(fnOrOptions, options) {
|
|
180467
|
+
if (typeof fnOrOptions === "function") {
|
|
180468
|
+
return _op(fnOrOptions, options ?? {});
|
|
180469
|
+
}
|
|
180470
|
+
const { input: inputSchema, output: outputSchema, run, ...opOptions } = fnOrOptions;
|
|
180471
|
+
return _op(run, opOptions, { input: inputSchema, output: outputSchema });
|
|
180472
|
+
}
|
|
180473
|
+
var isThenable = (value2) => typeof value2?.then === "function";
|
|
180474
|
+
function freshEntry(value2) {
|
|
180475
|
+
if (value2 === null || typeof value2 !== "object" || !("value" in value2))
|
|
180476
|
+
return void 0;
|
|
180477
|
+
const expires = value2.expires;
|
|
180478
|
+
return typeof expires === "number" && expires > Date.now() ? value2 : void 0;
|
|
180479
|
+
}
|
|
180480
|
+
var adapterMethods = ["get", "set", "delete", "list"];
|
|
180481
|
+
function callAdapter(method, key, run) {
|
|
180482
|
+
let result;
|
|
180483
|
+
try {
|
|
180484
|
+
result = run();
|
|
180485
|
+
} catch (error49) {
|
|
180486
|
+
throw new AdapterError(method, key, error49);
|
|
180487
|
+
}
|
|
180488
|
+
if (!isThenable(result))
|
|
180489
|
+
return result;
|
|
180490
|
+
return result.then(void 0, (error49) => {
|
|
180491
|
+
throw new AdapterError(method, key, error49);
|
|
180492
|
+
});
|
|
180493
|
+
}
|
|
180494
|
+
var DELETE_BATCH = 1e3;
|
|
180495
|
+
function sweep(store, prefix, match3) {
|
|
180496
|
+
const now = Date.now();
|
|
180497
|
+
const keys = [];
|
|
180498
|
+
let count = 0;
|
|
180499
|
+
let matchError;
|
|
180500
|
+
const take = ([key, entry]) => {
|
|
180501
|
+
if (!(entry.expires > now))
|
|
180502
|
+
return void keys.push(key);
|
|
180503
|
+
let matched;
|
|
180504
|
+
try {
|
|
180505
|
+
matched = match3(entry.input);
|
|
180506
|
+
} catch (error49) {
|
|
180507
|
+
matchError = { error: error49 };
|
|
180508
|
+
throw error49;
|
|
180509
|
+
}
|
|
180510
|
+
if (matched) {
|
|
180511
|
+
keys.push(key);
|
|
180512
|
+
count++;
|
|
180513
|
+
}
|
|
180514
|
+
};
|
|
180515
|
+
const fail = (error49) => {
|
|
180516
|
+
throw matchError ? matchError.error : new AdapterError("list", prefix, error49);
|
|
180517
|
+
};
|
|
180518
|
+
const deleteFrom = (from) => {
|
|
180519
|
+
for (let i = from; i < keys.length; i += DELETE_BATCH) {
|
|
180520
|
+
const batch = keys.slice(i, i + DELETE_BATCH);
|
|
180521
|
+
const deleted = callAdapter("delete", prefix, () => store.delete(batch));
|
|
180522
|
+
if (isThenable(deleted))
|
|
180523
|
+
return Promise.resolve(deleted).then(() => deleteFrom(i + DELETE_BATCH));
|
|
180524
|
+
}
|
|
180525
|
+
return count;
|
|
180526
|
+
};
|
|
180527
|
+
let listed;
|
|
180528
|
+
try {
|
|
180529
|
+
listed = store.list(prefix);
|
|
180530
|
+
} catch (error49) {
|
|
180531
|
+
return fail(error49);
|
|
180532
|
+
}
|
|
180533
|
+
if (!isThenable(listed) && Symbol.iterator in Object(listed)) {
|
|
180534
|
+
try {
|
|
180535
|
+
for (const item of listed)
|
|
180536
|
+
take(item);
|
|
180537
|
+
} catch (error49) {
|
|
180538
|
+
fail(error49);
|
|
180539
|
+
}
|
|
180540
|
+
return deleteFrom(0);
|
|
180541
|
+
}
|
|
180542
|
+
return (async () => {
|
|
180543
|
+
try {
|
|
180544
|
+
for await (const item of await listed)
|
|
180545
|
+
take(item);
|
|
180546
|
+
} catch (error49) {
|
|
180547
|
+
fail(error49);
|
|
180548
|
+
}
|
|
180549
|
+
return deleteFrom(0);
|
|
180550
|
+
})();
|
|
180551
|
+
}
|
|
180552
|
+
function _op(fn2, options, schemas = {}) {
|
|
180553
|
+
const { ttl, cache: adapter } = options;
|
|
180554
|
+
const shouldCache = ttl !== void 0;
|
|
180555
|
+
if (shouldCache && !(ttl > 0 && Number.isFinite(ttl))) {
|
|
180556
|
+
throw new Error(`ttl must be a positive number of milliseconds, got ${ttl}`);
|
|
180557
|
+
}
|
|
180558
|
+
if (adapter) {
|
|
180559
|
+
if (!options.name)
|
|
180560
|
+
throw new Error(`an op with a cache adapter needs a name: its keys are "yes:<name>:<hash>"`);
|
|
180561
|
+
if (options.name.includes(":")) {
|
|
180562
|
+
throw new Error(`op name "${options.name}" cannot contain ":" with a cache adapter: its keys would overlap another op's`);
|
|
180563
|
+
}
|
|
180564
|
+
if (!shouldCache)
|
|
180565
|
+
throw new Error(`${options.name}: a cache adapter does nothing without a ttl`);
|
|
180566
|
+
if (options.maxItems !== void 0) {
|
|
180567
|
+
throw new Error(`${options.name}: maxItems sizes the default memory store; size the adapter instead`);
|
|
180568
|
+
}
|
|
180569
|
+
const missing = adapterMethods.filter((method) => typeof adapter[method] !== "function");
|
|
180570
|
+
if (missing.length) {
|
|
180571
|
+
throw new Error(`${options.name}: cache is missing ${missing.join(", ")}; an adapter has get, set, delete and list (a Map or a Keyv is not one)`);
|
|
180572
|
+
}
|
|
180573
|
+
}
|
|
180574
|
+
const defaultStore = shouldCache && !adapter ? memory({ maxItems: options.maxItems }) : void 0;
|
|
180575
|
+
const store = adapter ?? defaultStore;
|
|
180576
|
+
const prefix = adapter ? `yes:${options.name}:` : "";
|
|
180577
|
+
const inFlightPromises = /* @__PURE__ */ new Map();
|
|
180578
|
+
const namePrefix = options.name ? `[${options.name}] ` : "";
|
|
180579
|
+
const defaultCacheHit = options.cacheHit === null ? () => {
|
|
180580
|
+
} : options.cacheHit ?? (() => {
|
|
180581
|
+
if (options.name && shouldCache)
|
|
180582
|
+
log2.prod(`${namePrefix}cache hit`);
|
|
180583
|
+
});
|
|
180584
|
+
const defaultCacheMiss = options.cacheMiss === null ? () => {
|
|
180585
|
+
} : options.cacheMiss ?? (() => {
|
|
180586
|
+
if (options.name && shouldCache)
|
|
180587
|
+
log2.prod(`${namePrefix}cache miss`);
|
|
180588
|
+
});
|
|
180589
|
+
const methodKey = (value2, method) => {
|
|
180590
|
+
const toKey = (input) => {
|
|
180591
|
+
try {
|
|
180592
|
+
return prefix + getCacheKeyString(input);
|
|
180593
|
+
} catch (error49) {
|
|
180594
|
+
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
180595
|
+
throw new Error(`failed to hash cache key for ${method}()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`);
|
|
180596
|
+
}
|
|
180597
|
+
};
|
|
180598
|
+
if (!schemas.input)
|
|
180599
|
+
return toKey(value2);
|
|
180600
|
+
const result = schemas.input["~standard"].validate(value2);
|
|
180601
|
+
if (result instanceof Promise)
|
|
180602
|
+
return result.then((r) => toKey(r.issues ? value2 : r.value));
|
|
180603
|
+
return toKey(result.issues ? value2 : result.value);
|
|
180604
|
+
};
|
|
180605
|
+
const cachedFn = async (rawInput, ctx) => {
|
|
180606
|
+
const input = schemas.input ? await assertSchema(schemas.input, rawInput) : rawInput;
|
|
180607
|
+
let key;
|
|
180608
|
+
try {
|
|
180609
|
+
key = getCacheKeyString(input);
|
|
180610
|
+
} catch (error49) {
|
|
180611
|
+
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
180612
|
+
throw new Error(`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`);
|
|
180613
|
+
}
|
|
180614
|
+
const trace = debugTrace(namePrefix, key);
|
|
180615
|
+
trace?.log("cache lookup started");
|
|
180616
|
+
const inFlight = inFlightPromises.get(key);
|
|
180617
|
+
if (inFlight) {
|
|
180618
|
+
trace?.log("cache hit (in-flight)");
|
|
180619
|
+
defaultCacheHit(key);
|
|
180620
|
+
return inFlight;
|
|
180621
|
+
}
|
|
180622
|
+
const fullKey = store ? prefix + key : "";
|
|
180623
|
+
let pendingRead;
|
|
180624
|
+
if (store) {
|
|
180625
|
+
let read2;
|
|
180626
|
+
try {
|
|
180627
|
+
read2 = store.get(fullKey);
|
|
180628
|
+
} catch (error49) {
|
|
180629
|
+
throw new AdapterError("get", fullKey, error49);
|
|
180630
|
+
}
|
|
180631
|
+
if (isThenable(read2)) {
|
|
180632
|
+
pendingRead = read2.then(void 0, (error49) => {
|
|
180633
|
+
throw new AdapterError("get", fullKey, error49);
|
|
180634
|
+
});
|
|
180635
|
+
} else {
|
|
180636
|
+
const entry = store === defaultStore ? read2 : freshEntry(read2);
|
|
180637
|
+
if (entry) {
|
|
180638
|
+
trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
|
|
180639
|
+
defaultCacheHit(key);
|
|
180640
|
+
return entry.value;
|
|
180641
|
+
}
|
|
180642
|
+
}
|
|
180643
|
+
}
|
|
180644
|
+
const retries = options.retries ?? [];
|
|
180645
|
+
const execStart = trace ? performance.now() : 0;
|
|
180646
|
+
const promise2 = (async () => {
|
|
180647
|
+
if (pendingRead) {
|
|
180648
|
+
const entry = freshEntry(await pendingRead);
|
|
180649
|
+
if (entry) {
|
|
180650
|
+
trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
|
|
180651
|
+
defaultCacheHit(key);
|
|
180652
|
+
return entry.value;
|
|
180653
|
+
}
|
|
180654
|
+
}
|
|
180655
|
+
trace?.log("cache miss, executing function");
|
|
180656
|
+
defaultCacheMiss(key);
|
|
180657
|
+
let result;
|
|
180658
|
+
let lastError;
|
|
180659
|
+
let attempt = 0;
|
|
180660
|
+
for (; attempt <= retries.length; attempt++) {
|
|
180661
|
+
try {
|
|
180662
|
+
const returned = await fn2(input, ctx);
|
|
180663
|
+
result = schemas.output ? await assertSchema(schemas.output, returned) : returned;
|
|
180664
|
+
break;
|
|
180665
|
+
} catch (error49) {
|
|
180666
|
+
if (error49 instanceof ValidationError || options.rethrow?.(error49))
|
|
180667
|
+
throw error49;
|
|
180668
|
+
lastError = error49;
|
|
180669
|
+
const isLastAttempt = attempt >= retries.length;
|
|
180670
|
+
if (isLastAttempt) {
|
|
180671
|
+
if (namePrefix) {
|
|
180672
|
+
log2.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
180673
|
+
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
180674
|
+
} else {
|
|
180675
|
+
log2.info(`attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
180676
|
+
log2.info({ key, error: error49, attempt });
|
|
180677
|
+
}
|
|
180678
|
+
} else {
|
|
180679
|
+
let delay2 = retries[attempt];
|
|
180680
|
+
if (options.retryAfter) {
|
|
180681
|
+
const extract = options.retryAfter === true ? retryAfterMs : options.retryAfter;
|
|
180682
|
+
const hint = extract(error49);
|
|
180683
|
+
if (hint !== void 0) {
|
|
180684
|
+
const cap = options.retryAfterCap ?? DEFAULT_RETRY_AFTER_CAP_MS;
|
|
180685
|
+
delay2 = Math.max(delay2, Math.min(cap, hint));
|
|
180686
|
+
}
|
|
180687
|
+
}
|
|
180688
|
+
delay2 = jitter(delay2);
|
|
180689
|
+
if (namePrefix) {
|
|
180690
|
+
log2.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
180691
|
+
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
180692
|
+
} else {
|
|
180693
|
+
log2.info(`attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
180694
|
+
log2.info({ key, error: error49, attempt });
|
|
180695
|
+
}
|
|
180696
|
+
await sleep2(delay2);
|
|
180697
|
+
}
|
|
180698
|
+
}
|
|
180699
|
+
}
|
|
180700
|
+
if (attempt > retries.length) {
|
|
180701
|
+
trace?.log("function failed after all retries", {
|
|
180702
|
+
runtime: trace.since(execStart),
|
|
180703
|
+
attempts: retries.length + 1,
|
|
180704
|
+
error: lastError instanceof Error ? lastError.message : lastError
|
|
180705
|
+
});
|
|
180706
|
+
throw lastError;
|
|
180707
|
+
}
|
|
180708
|
+
const skip = options.skipCache ? options.skipCache(result) : false;
|
|
180709
|
+
const storable = store !== void 0 && result !== null && result !== void 0 && !(result instanceof Error) && !skip;
|
|
180710
|
+
let cached4 = false;
|
|
180711
|
+
if (storable) {
|
|
180712
|
+
const created = Date.now();
|
|
180713
|
+
const entry = { value: result, created, expires: created + ttl, input };
|
|
180714
|
+
try {
|
|
180715
|
+
const written = callAdapter("set", fullKey, () => store.set(fullKey, entry, ttl));
|
|
180716
|
+
if (isThenable(written))
|
|
180717
|
+
await written;
|
|
180718
|
+
cached4 = true;
|
|
180719
|
+
} catch (error49) {
|
|
180720
|
+
log2.error(`${namePrefix}cache write failed, returning the result uncached`, error49);
|
|
180721
|
+
}
|
|
180722
|
+
}
|
|
180723
|
+
trace?.log("function executed successfully", { runtime: trace.since(execStart), attempt: attempt + 1, cached: cached4 });
|
|
180724
|
+
return result;
|
|
180725
|
+
})();
|
|
180726
|
+
inFlightPromises.set(key, promise2);
|
|
180727
|
+
try {
|
|
180728
|
+
return await promise2;
|
|
180729
|
+
} finally {
|
|
180730
|
+
inFlightPromises.delete(key);
|
|
180731
|
+
}
|
|
180732
|
+
};
|
|
180733
|
+
cachedFn.clear = async (key) => {
|
|
180734
|
+
if (!store)
|
|
180735
|
+
return;
|
|
180736
|
+
if (key === void 0) {
|
|
180737
|
+
await sweep(store, prefix, () => true);
|
|
180738
|
+
return;
|
|
180739
|
+
}
|
|
180740
|
+
let fullKey = methodKey(key, "clear");
|
|
180741
|
+
if (typeof fullKey !== "string")
|
|
180742
|
+
fullKey = await fullKey;
|
|
180743
|
+
const target = fullKey;
|
|
180744
|
+
await callAdapter("delete", target, () => store.delete([target]));
|
|
180745
|
+
};
|
|
180746
|
+
cachedFn.has = async (key) => {
|
|
180747
|
+
if (!store)
|
|
180748
|
+
return false;
|
|
180749
|
+
let fullKey = methodKey(key, "has");
|
|
180750
|
+
if (typeof fullKey !== "string")
|
|
180751
|
+
fullKey = await fullKey;
|
|
180752
|
+
const target = fullKey;
|
|
180753
|
+
const memoryStore = store;
|
|
180754
|
+
const read2 = callAdapter("get", target, () => memoryStore.peek ? memoryStore.peek(target) : store.get(target));
|
|
180755
|
+
return freshEntry(await read2) !== void 0;
|
|
180756
|
+
};
|
|
180757
|
+
cachedFn.invalidate = (predicate) => {
|
|
180758
|
+
if (!store)
|
|
180759
|
+
return Promise.resolve(0);
|
|
180760
|
+
const count = sweep(store, prefix, predicate);
|
|
180761
|
+
return typeof count === "number" ? Promise.resolve(count) : count;
|
|
180762
|
+
};
|
|
180763
|
+
return cachedFn;
|
|
180764
|
+
}
|
|
180765
|
+
|
|
180078
180766
|
// utils/progressComment.ts
|
|
180079
180767
|
function parseProgressComment(raw2) {
|
|
180080
180768
|
if (!raw2?.id) return void 0;
|
|
@@ -181028,7 +181716,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
|
|
|
181028
181716
|
import { closeSync, openSync, writeFileSync as writeFileSync8 } from "node:fs";
|
|
181029
181717
|
import { userInfo as userInfo2 } from "node:os";
|
|
181030
181718
|
import { join as join10 } from "node:path";
|
|
181031
|
-
import { setTimeout as
|
|
181719
|
+
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
181032
181720
|
|
|
181033
181721
|
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
|
181034
181722
|
var LIST_ITEM_MARKER = "-";
|
|
@@ -181959,7 +182647,7 @@ function KillBackgroundTool(ctx) {
|
|
|
181959
182647
|
process.kill(-proc.pid, "SIGTERM");
|
|
181960
182648
|
} catch {
|
|
181961
182649
|
}
|
|
181962
|
-
await
|
|
182650
|
+
await sleep3(200);
|
|
181963
182651
|
try {
|
|
181964
182652
|
process.kill(-proc.pid, "SIGKILL");
|
|
181965
182653
|
} catch {
|
|
@@ -182186,868 +182874,6 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
182186
182874
|
return hasChanges ? out : null;
|
|
182187
182875
|
}
|
|
182188
182876
|
|
|
182189
|
-
// yes/index.ts
|
|
182190
|
-
import { performance as performance8 } from "node:perf_hooks";
|
|
182191
|
-
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
182192
|
-
|
|
182193
|
-
// node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
182194
|
-
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
182195
|
-
var S = P("lru-cache:metrics");
|
|
182196
|
-
var W = G("lru-cache");
|
|
182197
|
-
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
182198
|
-
var R = () => S.hasSubscribers || W.hasSubscribers;
|
|
182199
|
-
var U = /* @__PURE__ */ new Set();
|
|
182200
|
-
var M = typeof process == "object" && process ? process : {};
|
|
182201
|
-
var k = (d3, e, t, i) => {
|
|
182202
|
-
typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t, i) : console.error(`[${t}] ${e}: ${d3}`);
|
|
182203
|
-
};
|
|
182204
|
-
var H = (d3) => !U.has(d3);
|
|
182205
|
-
var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
|
|
182206
|
-
var j = (d3) => T(d3) ? d3 <= Math.pow(2, 8) ? Uint8Array : d3 <= Math.pow(2, 16) ? Uint16Array : d3 <= Math.pow(2, 32) ? Uint32Array : d3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
|
|
182207
|
-
var O = class extends Array {
|
|
182208
|
-
constructor(e) {
|
|
182209
|
-
super(e), this.fill(0);
|
|
182210
|
-
}
|
|
182211
|
-
};
|
|
182212
|
-
var x = class d {
|
|
182213
|
-
heap;
|
|
182214
|
-
length;
|
|
182215
|
-
static #o = false;
|
|
182216
|
-
static create(e) {
|
|
182217
|
-
let t = j(e);
|
|
182218
|
-
if (!t) return [];
|
|
182219
|
-
d.#o = true;
|
|
182220
|
-
let i = new d(e, t);
|
|
182221
|
-
return d.#o = false, i;
|
|
182222
|
-
}
|
|
182223
|
-
constructor(e, t) {
|
|
182224
|
-
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
182225
|
-
this.heap = new t(e), this.length = 0;
|
|
182226
|
-
}
|
|
182227
|
-
push(e) {
|
|
182228
|
-
this.heap[this.length++] = e;
|
|
182229
|
-
}
|
|
182230
|
-
pop() {
|
|
182231
|
-
return this.heap[--this.length];
|
|
182232
|
-
}
|
|
182233
|
-
};
|
|
182234
|
-
var I = class d2 {
|
|
182235
|
-
#o;
|
|
182236
|
-
#c;
|
|
182237
|
-
#S;
|
|
182238
|
-
#O;
|
|
182239
|
-
#w;
|
|
182240
|
-
#M;
|
|
182241
|
-
#I;
|
|
182242
|
-
#m;
|
|
182243
|
-
get perf() {
|
|
182244
|
-
return this.#m;
|
|
182245
|
-
}
|
|
182246
|
-
ttl;
|
|
182247
|
-
ttlResolution;
|
|
182248
|
-
ttlAutopurge;
|
|
182249
|
-
updateAgeOnGet;
|
|
182250
|
-
updateAgeOnHas;
|
|
182251
|
-
allowStale;
|
|
182252
|
-
noDisposeOnSet;
|
|
182253
|
-
noUpdateTTL;
|
|
182254
|
-
maxEntrySize;
|
|
182255
|
-
sizeCalculation;
|
|
182256
|
-
noDeleteOnFetchRejection;
|
|
182257
|
-
noDeleteOnStaleGet;
|
|
182258
|
-
allowStaleOnFetchAbort;
|
|
182259
|
-
allowStaleOnFetchRejection;
|
|
182260
|
-
ignoreFetchAbort;
|
|
182261
|
-
backgroundFetchSize;
|
|
182262
|
-
#n;
|
|
182263
|
-
#b;
|
|
182264
|
-
#s;
|
|
182265
|
-
#i;
|
|
182266
|
-
#t;
|
|
182267
|
-
#l;
|
|
182268
|
-
#u;
|
|
182269
|
-
#a;
|
|
182270
|
-
#h;
|
|
182271
|
-
#y;
|
|
182272
|
-
#r;
|
|
182273
|
-
#_;
|
|
182274
|
-
#F;
|
|
182275
|
-
#d;
|
|
182276
|
-
#g;
|
|
182277
|
-
#T;
|
|
182278
|
-
#U;
|
|
182279
|
-
#f;
|
|
182280
|
-
#D;
|
|
182281
|
-
static unsafeExposeInternals(e) {
|
|
182282
|
-
return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#l, prev: e.#u, get head() {
|
|
182283
|
-
return e.#a;
|
|
182284
|
-
}, get tail() {
|
|
182285
|
-
return e.#h;
|
|
182286
|
-
}, free: e.#y, isBackgroundFetch: (t) => e.#e(t), backgroundFetch: (t, i, s, n) => e.#P(t, i, s, n), moveToTail: (t) => e.#L(t), indexes: (t) => e.#A(t), rindexes: (t) => e.#z(t), isStale: (t) => e.#p(t) };
|
|
182287
|
-
}
|
|
182288
|
-
get max() {
|
|
182289
|
-
return this.#o;
|
|
182290
|
-
}
|
|
182291
|
-
get maxSize() {
|
|
182292
|
-
return this.#c;
|
|
182293
|
-
}
|
|
182294
|
-
get calculatedSize() {
|
|
182295
|
-
return this.#b;
|
|
182296
|
-
}
|
|
182297
|
-
get size() {
|
|
182298
|
-
return this.#n;
|
|
182299
|
-
}
|
|
182300
|
-
get fetchMethod() {
|
|
182301
|
-
return this.#M;
|
|
182302
|
-
}
|
|
182303
|
-
get memoMethod() {
|
|
182304
|
-
return this.#I;
|
|
182305
|
-
}
|
|
182306
|
-
get dispose() {
|
|
182307
|
-
return this.#S;
|
|
182308
|
-
}
|
|
182309
|
-
get onInsert() {
|
|
182310
|
-
return this.#O;
|
|
182311
|
-
}
|
|
182312
|
-
get disposeAfter() {
|
|
182313
|
-
return this.#w;
|
|
182314
|
-
}
|
|
182315
|
-
constructor(e) {
|
|
182316
|
-
let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y, fetchMethod: a, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z2, backgroundFetchSize: C = 1, perf: E } = e;
|
|
182317
|
-
if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
182318
|
-
if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
|
|
182319
|
-
let v = t ? j(t) : Array;
|
|
182320
|
-
if (!v) throw new Error("invalid max value: " + t);
|
|
182321
|
-
if (this.#o = t, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y, this.sizeCalculation) {
|
|
182322
|
-
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
182323
|
-
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
182324
|
-
}
|
|
182325
|
-
if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
182326
|
-
if (this.#I = w, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
182327
|
-
if (this.#M = a, this.#U = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v(t), this.#u = new v(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m == "function" ? (this.#w = m, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z2, this.maxEntrySize !== 0) {
|
|
182328
|
-
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
182329
|
-
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
182330
|
-
this.#X();
|
|
182331
|
-
}
|
|
182332
|
-
if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
182333
|
-
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
182334
|
-
this.#k();
|
|
182335
|
-
}
|
|
182336
|
-
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
182337
|
-
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
182338
|
-
let D = "LRU_CACHE_UNBOUNDED";
|
|
182339
|
-
H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
182340
|
-
}
|
|
182341
|
-
}
|
|
182342
|
-
getRemainingTTL(e) {
|
|
182343
|
-
return this.#s.has(e) ? 1 / 0 : 0;
|
|
182344
|
-
}
|
|
182345
|
-
#k() {
|
|
182346
|
-
let e = new O(this.#o), t = new O(this.#o);
|
|
182347
|
-
this.#d = e, this.#F = t;
|
|
182348
|
-
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
182349
|
-
this.#g = i, this.#H = (h, r, c = this.#m.now()) => {
|
|
182350
|
-
t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
|
|
182351
|
-
}, this.#R = (h) => {
|
|
182352
|
-
t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
|
|
182353
|
-
};
|
|
182354
|
-
let s = this.ttlAutopurge ? (h, r) => {
|
|
182355
|
-
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
|
|
182356
|
-
let c = setTimeout(() => {
|
|
182357
|
-
this.#p(h) ? (this.#E(this.#i[h], "expire"), i[h] = void 0) : s(h, l(h));
|
|
182358
|
-
}, r + 1);
|
|
182359
|
-
c.unref && c.unref(), i[h] = c;
|
|
182360
|
-
}
|
|
182361
|
-
} : () => {
|
|
182362
|
-
};
|
|
182363
|
-
this.#v = (h, r) => {
|
|
182364
|
-
if (e[r]) {
|
|
182365
|
-
let c = e[r], m = t[r];
|
|
182366
|
-
if (!c || !m) return;
|
|
182367
|
-
h.ttl = c, h.start = m, h.now = n || o();
|
|
182368
|
-
let _ = h.now - m;
|
|
182369
|
-
h.remainingTTL = c - _;
|
|
182370
|
-
}
|
|
182371
|
-
};
|
|
182372
|
-
let n = 0, o = () => {
|
|
182373
|
-
let h = this.#m.now();
|
|
182374
|
-
if (this.ttlResolution > 0) {
|
|
182375
|
-
n = h;
|
|
182376
|
-
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
182377
|
-
r.unref && r.unref();
|
|
182378
|
-
}
|
|
182379
|
-
return h;
|
|
182380
|
-
};
|
|
182381
|
-
this.getRemainingTTL = (h) => {
|
|
182382
|
-
let r = this.#s.get(h);
|
|
182383
|
-
return r === void 0 ? 0 : l(r);
|
|
182384
|
-
};
|
|
182385
|
-
let l = (h) => {
|
|
182386
|
-
let r = e[h], c = t[h];
|
|
182387
|
-
if (!r || !c) return 1 / 0;
|
|
182388
|
-
let m = (n || o()) - c;
|
|
182389
|
-
return r - m;
|
|
182390
|
-
};
|
|
182391
|
-
this.#p = (h) => {
|
|
182392
|
-
let r = t[h], c = e[h];
|
|
182393
|
-
return !!c && !!r && (n || o()) - r > c;
|
|
182394
|
-
};
|
|
182395
|
-
}
|
|
182396
|
-
#R = () => {
|
|
182397
|
-
};
|
|
182398
|
-
#v = () => {
|
|
182399
|
-
};
|
|
182400
|
-
#H = () => {
|
|
182401
|
-
};
|
|
182402
|
-
#p = () => false;
|
|
182403
|
-
#X() {
|
|
182404
|
-
let e = new O(this.#o);
|
|
182405
|
-
this.#b = 0, this.#_ = e, this.#x = (t) => {
|
|
182406
|
-
this.#b -= e[t], e[t] = 0;
|
|
182407
|
-
}, this.#N = (t, i, s, n) => {
|
|
182408
|
-
if (!T(s)) {
|
|
182409
|
-
if (this.#e(i)) return this.backgroundFetchSize;
|
|
182410
|
-
if (n) {
|
|
182411
|
-
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
182412
|
-
if (s = n(i, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
182413
|
-
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
182414
|
-
}
|
|
182415
|
-
return s;
|
|
182416
|
-
}, this.#j = (t, i, s) => {
|
|
182417
|
-
if (e[t] = i, this.#c) {
|
|
182418
|
-
let n = this.#c - e[t];
|
|
182419
|
-
for (; this.#b > n; ) this.#G(true);
|
|
182420
|
-
}
|
|
182421
|
-
this.#b += e[t], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
|
|
182422
|
-
};
|
|
182423
|
-
}
|
|
182424
|
-
#x = (e) => {
|
|
182425
|
-
};
|
|
182426
|
-
#j = (e, t, i) => {
|
|
182427
|
-
};
|
|
182428
|
-
#N = (e, t, i, s) => {
|
|
182429
|
-
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
182430
|
-
return 0;
|
|
182431
|
-
};
|
|
182432
|
-
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
182433
|
-
if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
|
|
182434
|
-
}
|
|
182435
|
-
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
182436
|
-
if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
|
|
182437
|
-
}
|
|
182438
|
-
#V(e) {
|
|
182439
|
-
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
182440
|
-
}
|
|
182441
|
-
*entries() {
|
|
182442
|
-
for (let e of this.#A()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
|
|
182443
|
-
}
|
|
182444
|
-
*rentries() {
|
|
182445
|
-
for (let e of this.#z()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
|
|
182446
|
-
}
|
|
182447
|
-
*keys() {
|
|
182448
|
-
for (let e of this.#A()) {
|
|
182449
|
-
let t = this.#i[e];
|
|
182450
|
-
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
182451
|
-
}
|
|
182452
|
-
}
|
|
182453
|
-
*rkeys() {
|
|
182454
|
-
for (let e of this.#z()) {
|
|
182455
|
-
let t = this.#i[e];
|
|
182456
|
-
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
182457
|
-
}
|
|
182458
|
-
}
|
|
182459
|
-
*values() {
|
|
182460
|
-
for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
182461
|
-
}
|
|
182462
|
-
*rvalues() {
|
|
182463
|
-
for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
182464
|
-
}
|
|
182465
|
-
[Symbol.iterator]() {
|
|
182466
|
-
return this.entries();
|
|
182467
|
-
}
|
|
182468
|
-
[Symbol.toStringTag] = "LRUCache";
|
|
182469
|
-
find(e, t = {}) {
|
|
182470
|
-
for (let i of this.#A()) {
|
|
182471
|
-
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
182472
|
-
if (n !== void 0 && e(n, this.#i[i], this)) return this.#C(this.#i[i], t);
|
|
182473
|
-
}
|
|
182474
|
-
}
|
|
182475
|
-
forEach(e, t = this) {
|
|
182476
|
-
for (let i of this.#A()) {
|
|
182477
|
-
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
182478
|
-
n !== void 0 && e.call(t, n, this.#i[i], this);
|
|
182479
|
-
}
|
|
182480
|
-
}
|
|
182481
|
-
rforEach(e, t = this) {
|
|
182482
|
-
for (let i of this.#z()) {
|
|
182483
|
-
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
182484
|
-
n !== void 0 && e.call(t, n, this.#i[i], this);
|
|
182485
|
-
}
|
|
182486
|
-
}
|
|
182487
|
-
purgeStale() {
|
|
182488
|
-
let e = false;
|
|
182489
|
-
for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
|
|
182490
|
-
return e;
|
|
182491
|
-
}
|
|
182492
|
-
info(e) {
|
|
182493
|
-
let t = this.#s.get(e);
|
|
182494
|
-
if (t === void 0) return;
|
|
182495
|
-
let i = this.#t[t], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
182496
|
-
if (s === void 0) return;
|
|
182497
|
-
let n = { value: s };
|
|
182498
|
-
if (this.#d && this.#F) {
|
|
182499
|
-
let o = this.#d[t], l = this.#F[t];
|
|
182500
|
-
if (o && l) {
|
|
182501
|
-
let h = o - (this.#m.now() - l);
|
|
182502
|
-
n.ttl = h, n.start = Date.now();
|
|
182503
|
-
}
|
|
182504
|
-
}
|
|
182505
|
-
return this.#_ && (n.size = this.#_[t]), n;
|
|
182506
|
-
}
|
|
182507
|
-
dump() {
|
|
182508
|
-
let e = [];
|
|
182509
|
-
for (let t of this.#A({ allowStale: true })) {
|
|
182510
|
-
let i = this.#i[t], s = this.#t[t], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
182511
|
-
if (n === void 0 || i === void 0) continue;
|
|
182512
|
-
let o = { value: n };
|
|
182513
|
-
if (this.#d && this.#F) {
|
|
182514
|
-
o.ttl = this.#d[t];
|
|
182515
|
-
let l = this.#m.now() - this.#F[t];
|
|
182516
|
-
o.start = Math.floor(Date.now() - l);
|
|
182517
|
-
}
|
|
182518
|
-
this.#_ && (o.size = this.#_[t]), e.unshift([i, o]);
|
|
182519
|
-
}
|
|
182520
|
-
return e;
|
|
182521
|
-
}
|
|
182522
|
-
load(e) {
|
|
182523
|
-
this.clear();
|
|
182524
|
-
for (let [t, i] of e) {
|
|
182525
|
-
if (i.start) {
|
|
182526
|
-
let s = Date.now() - i.start;
|
|
182527
|
-
i.start = this.#m.now() - s;
|
|
182528
|
-
}
|
|
182529
|
-
this.#W(t, i.value, i);
|
|
182530
|
-
}
|
|
182531
|
-
}
|
|
182532
|
-
set(e, t, i = {}) {
|
|
182533
|
-
let { status: s = S.hasSubscribers ? {} : void 0 } = i;
|
|
182534
|
-
i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
|
|
182535
|
-
let n = this.#W(e, t, i);
|
|
182536
|
-
return s && S.hasSubscribers && S.publish(s), n;
|
|
182537
|
-
}
|
|
182538
|
-
#W(e, t, i, s) {
|
|
182539
|
-
let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(t);
|
|
182540
|
-
if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
|
|
182541
|
-
let { noUpdateTTL: m = this.noUpdateTTL } = i;
|
|
182542
|
-
r && !c && (r.value = t);
|
|
182543
|
-
let _ = this.#N(e, t, i.size || 0, h, r);
|
|
182544
|
-
if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
|
|
182545
|
-
let u = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
182546
|
-
if (u === void 0) u = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u] = e, this.#t[u] = t, this.#s.set(e, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#j(u, _, r), r && (r.set = "add"), m = false, this.#D && !c && this.#O?.(t, e, "add");
|
|
182547
|
-
else {
|
|
182548
|
-
this.#L(u);
|
|
182549
|
-
let g = this.#t[u];
|
|
182550
|
-
if (t !== g) {
|
|
182551
|
-
if (!l) if (this.#e(g)) {
|
|
182552
|
-
g !== s && g.__abortController.abort(new Error("replaced"));
|
|
182553
|
-
let { __staleWhileFetching: f } = g;
|
|
182554
|
-
f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
182555
|
-
} else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
|
|
182556
|
-
if (this.#x(u), this.#j(u, _, r), this.#t[u] = t, !c) {
|
|
182557
|
-
let f = g && this.#e(g) ? g.__staleWhileFetching : g, y = f === void 0 ? "add" : t !== f ? "replace" : "update";
|
|
182558
|
-
r && (r.set = y, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y);
|
|
182559
|
-
}
|
|
182560
|
-
} else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
|
|
182561
|
-
}
|
|
182562
|
-
if (n !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u, n, o), r && this.#v(r, u)), !l && this.#f && this.#r) {
|
|
182563
|
-
let g = this.#r, f;
|
|
182564
|
-
for (; f = g?.shift(); ) this.#w?.(...f);
|
|
182565
|
-
}
|
|
182566
|
-
return this;
|
|
182567
|
-
}
|
|
182568
|
-
pop() {
|
|
182569
|
-
try {
|
|
182570
|
-
for (; this.#n; ) {
|
|
182571
|
-
let e = this.#t[this.#a];
|
|
182572
|
-
if (this.#G(true), this.#e(e)) {
|
|
182573
|
-
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
182574
|
-
} else if (e !== void 0) return e;
|
|
182575
|
-
}
|
|
182576
|
-
} finally {
|
|
182577
|
-
if (this.#f && this.#r) {
|
|
182578
|
-
let e = this.#r, t;
|
|
182579
|
-
for (; t = e?.shift(); ) this.#w?.(...t);
|
|
182580
|
-
}
|
|
182581
|
-
}
|
|
182582
|
-
}
|
|
182583
|
-
#G(e) {
|
|
182584
|
-
let t = this.#a, i = this.#i[t], s = this.#t[t], n = this.#e(s);
|
|
182585
|
-
n && s.__abortController.abort(new Error("evicted"));
|
|
182586
|
-
let o = n ? s.__staleWhileFetching : s;
|
|
182587
|
-
return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i, "evict"), this.#f && this.#r?.push([o, i, "evict"])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i), this.#n--, t;
|
|
182588
|
-
}
|
|
182589
|
-
has(e, t = {}) {
|
|
182590
|
-
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
182591
|
-
t.status = i, i && (i.op = "has", i.key = e, i.cache = this);
|
|
182592
|
-
let s = this.#Y(e, t);
|
|
182593
|
-
return S.hasSubscribers && S.publish(i), s;
|
|
182594
|
-
}
|
|
182595
|
-
#Y(e, t = {}) {
|
|
182596
|
-
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = t, n = this.#s.get(e);
|
|
182597
|
-
if (n !== void 0) {
|
|
182598
|
-
let o = this.#t[n];
|
|
182599
|
-
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
182600
|
-
if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
|
|
182601
|
-
else return i && this.#R(n), s && (s.has = "hit", this.#v(s, n)), true;
|
|
182602
|
-
} else s && (s.has = "miss");
|
|
182603
|
-
return false;
|
|
182604
|
-
}
|
|
182605
|
-
peek(e, t = {}) {
|
|
182606
|
-
let { status: i = R() ? {} : void 0 } = t;
|
|
182607
|
-
i && (i.op = "peek", i.key = e, i.cache = this), t.status = i;
|
|
182608
|
-
let s = this.#J(e, t);
|
|
182609
|
-
return S.hasSubscribers && S.publish(i), s;
|
|
182610
|
-
}
|
|
182611
|
-
#J(e, t) {
|
|
182612
|
-
let { status: i, allowStale: s = this.allowStale } = t, n = this.#s.get(e);
|
|
182613
|
-
if (n === void 0 || !s && this.#p(n)) {
|
|
182614
|
-
i && (i.peek = n === void 0 ? "miss" : "stale");
|
|
182615
|
-
return;
|
|
182616
|
-
}
|
|
182617
|
-
let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
|
|
182618
|
-
return i && (l !== void 0 ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l;
|
|
182619
|
-
}
|
|
182620
|
-
#P(e, t, i, s) {
|
|
182621
|
-
let n = t === void 0 ? void 0 : this.#t[t];
|
|
182622
|
-
if (this.#e(n)) return n;
|
|
182623
|
-
let o = new AbortController(), { signal: l } = i;
|
|
182624
|
-
l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
|
|
182625
|
-
let h = { signal: o.signal, options: i, context: s }, r = (f, y = false) => {
|
|
182626
|
-
let { aborted: a } = o.signal, w = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
|
|
182627
|
-
if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, w && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !w && !y) return m(o.signal.reason, F);
|
|
182628
|
-
let b = u, p = this.#t[t];
|
|
182629
|
-
return (p === u || p === void 0 && w && y) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#W(e, f, h.options, b))), f;
|
|
182630
|
-
}, c = (f) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = f), m(f, false)), m = (f, y) => {
|
|
182631
|
-
let { aborted: a } = o.signal, w = a && i.allowStaleOnFetchAbort, F = w || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, p = u;
|
|
182632
|
-
if (this.#t[t] === u && (!b || !y && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t] = p.__staleWhileFetching)), F) return i.status && p.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), p.__staleWhileFetching;
|
|
182633
|
-
if (p.__returned === p) throw f;
|
|
182634
|
-
}, _ = (f, y) => {
|
|
182635
|
-
let a = this.#M?.(e, n, h);
|
|
182636
|
-
o.signal.addEventListener("abort", () => {
|
|
182637
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (w) => r(w, true)));
|
|
182638
|
-
}), a && a instanceof Promise ? a.then((w) => f(w === void 0 ? void 0 : w), y) : a !== void 0 && f(a);
|
|
182639
|
-
};
|
|
182640
|
-
i.status && (i.status.fetchDispatched = true);
|
|
182641
|
-
let u = new Promise(_).then(r, c), g = Object.assign(u, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
|
|
182642
|
-
return t === void 0 ? (this.#W(e, g, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g, g;
|
|
182643
|
-
}
|
|
182644
|
-
#e(e) {
|
|
182645
|
-
if (!this.#U) return false;
|
|
182646
|
-
let t = e;
|
|
182647
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
182648
|
-
}
|
|
182649
|
-
fetch(e, t = {}) {
|
|
182650
|
-
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
182651
|
-
t.status = s, s && t.context && (s.context = t.context);
|
|
182652
|
-
let n = this.#B(e, t);
|
|
182653
|
-
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
182654
|
-
})), n;
|
|
182655
|
-
}
|
|
182656
|
-
async #B(e, t = {}) {
|
|
182657
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y = false, status: a, signal: w } = t;
|
|
182658
|
-
if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true), a.cache = this), !this.#U) return a && (a.fetch = "get"), this.#C(e, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a });
|
|
182659
|
-
let F = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u, status: a, signal: w }, b = this.#s.get(e);
|
|
182660
|
-
if (b === void 0) {
|
|
182661
|
-
a && (a.fetch = "miss");
|
|
182662
|
-
let p = this.#P(e, b, F, f);
|
|
182663
|
-
return p.__returned = p;
|
|
182664
|
-
} else {
|
|
182665
|
-
let p = this.#t[b];
|
|
182666
|
-
if (this.#e(p)) {
|
|
182667
|
-
let v = i && p.__staleWhileFetching !== void 0;
|
|
182668
|
-
return a && (a.fetch = "inflight", v && (a.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
|
|
182669
|
-
}
|
|
182670
|
-
let A = this.#p(b);
|
|
182671
|
-
if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#R(b), a && this.#v(a, b), p;
|
|
182672
|
-
let z2 = this.#P(e, b, F, f), E = z2.__staleWhileFetching !== void 0 && i;
|
|
182673
|
-
return a && (a.fetch = A ? "stale" : "refresh", E && A && (a.returnedStale = true)), E ? z2.__staleWhileFetching : z2.__returned = z2;
|
|
182674
|
-
}
|
|
182675
|
-
}
|
|
182676
|
-
forceFetch(e, t = {}) {
|
|
182677
|
-
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
182678
|
-
t.status = s, s && t.context && (s.context = t.context);
|
|
182679
|
-
let n = this.#K(e, t);
|
|
182680
|
-
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
182681
|
-
})), n;
|
|
182682
|
-
}
|
|
182683
|
-
async #K(e, t = {}) {
|
|
182684
|
-
let i = await this.#B(e, t);
|
|
182685
|
-
if (i === void 0) throw new Error("fetch() returned undefined");
|
|
182686
|
-
return i;
|
|
182687
|
-
}
|
|
182688
|
-
memo(e, t = {}) {
|
|
182689
|
-
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
182690
|
-
t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context), i.cache = this);
|
|
182691
|
-
let s = this.#Q(e, t);
|
|
182692
|
-
return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
|
|
182693
|
-
}
|
|
182694
|
-
#Q(e, t = {}) {
|
|
182695
|
-
let i = this.#I;
|
|
182696
|
-
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
182697
|
-
let { context: s, status: n, forceRefresh: o, ...l } = t;
|
|
182698
|
-
n && o && (n.forceRefresh = true);
|
|
182699
|
-
let h = this.#C(e, l), r = o || h === void 0;
|
|
182700
|
-
if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
|
|
182701
|
-
let c = i(e, h, { options: l, context: s });
|
|
182702
|
-
return n && (n.value = c), this.#W(e, c, l), c;
|
|
182703
|
-
}
|
|
182704
|
-
get(e, t = {}) {
|
|
182705
|
-
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
182706
|
-
t.status = i, i && (i.op = "get", i.key = e, i.cache = this);
|
|
182707
|
-
let s = this.#C(e, t);
|
|
182708
|
-
return i && (s !== void 0 && (i.value = s), S.hasSubscribers && S.publish(i)), s;
|
|
182709
|
-
}
|
|
182710
|
-
#C(e, t = {}) {
|
|
182711
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
|
|
182712
|
-
if (l === void 0) {
|
|
182713
|
-
o && (o.get = "miss");
|
|
182714
|
-
return;
|
|
182715
|
-
}
|
|
182716
|
-
let h = this.#t[l], r = this.#e(h);
|
|
182717
|
-
return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n || this.#E(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
|
|
182718
|
-
}
|
|
182719
|
-
#$(e, t) {
|
|
182720
|
-
this.#u[t] = e, this.#l[e] = t;
|
|
182721
|
-
}
|
|
182722
|
-
#L(e) {
|
|
182723
|
-
e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
|
|
182724
|
-
}
|
|
182725
|
-
delete(e) {
|
|
182726
|
-
return this.#E(e, "delete");
|
|
182727
|
-
}
|
|
182728
|
-
#E(e, t) {
|
|
182729
|
-
S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
|
|
182730
|
-
let i = false;
|
|
182731
|
-
if (this.#n !== 0) {
|
|
182732
|
-
let s = this.#s.get(e);
|
|
182733
|
-
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i = true, this.#n === 1) this.#q(t);
|
|
182734
|
-
else {
|
|
182735
|
-
this.#x(s);
|
|
182736
|
-
let n = this.#t[s];
|
|
182737
|
-
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([n, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
182738
|
-
else if (s === this.#a) this.#a = this.#l[s];
|
|
182739
|
-
else {
|
|
182740
|
-
let o = this.#u[s];
|
|
182741
|
-
this.#l[o] = this.#l[s];
|
|
182742
|
-
let l = this.#l[s];
|
|
182743
|
-
this.#u[l] = this.#u[s];
|
|
182744
|
-
}
|
|
182745
|
-
this.#n--, this.#y.push(s);
|
|
182746
|
-
}
|
|
182747
|
-
}
|
|
182748
|
-
if (this.#f && this.#r?.length) {
|
|
182749
|
-
let s = this.#r, n;
|
|
182750
|
-
for (; n = s?.shift(); ) this.#w?.(...n);
|
|
182751
|
-
}
|
|
182752
|
-
return i;
|
|
182753
|
-
}
|
|
182754
|
-
clear() {
|
|
182755
|
-
return this.#q("delete");
|
|
182756
|
-
}
|
|
182757
|
-
#q(e) {
|
|
182758
|
-
for (let t of this.#z({ allowStale: true })) {
|
|
182759
|
-
let i = this.#t[t];
|
|
182760
|
-
if (this.#e(i)) i.__abortController.abort(new Error("deleted"));
|
|
182761
|
-
else {
|
|
182762
|
-
let s = this.#i[t];
|
|
182763
|
-
this.#T && this.#S?.(i, s, e), this.#f && this.#r?.push([i, s, e]);
|
|
182764
|
-
}
|
|
182765
|
-
}
|
|
182766
|
-
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
182767
|
-
this.#d.fill(0), this.#F.fill(0);
|
|
182768
|
-
for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
|
|
182769
|
-
this.#g?.fill(void 0);
|
|
182770
|
-
}
|
|
182771
|
-
if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
182772
|
-
let t = this.#r, i;
|
|
182773
|
-
for (; i = t?.shift(); ) this.#w?.(...i);
|
|
182774
|
-
}
|
|
182775
|
-
}
|
|
182776
|
-
};
|
|
182777
|
-
|
|
182778
|
-
// yes/index.ts
|
|
182779
|
-
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
182780
|
-
var VOID_KEY = "~void";
|
|
182781
|
-
function getCacheKeyString(value2) {
|
|
182782
|
-
if (value2 === void 0) return VOID_KEY;
|
|
182783
|
-
if (value2 === null) {
|
|
182784
|
-
throw new Error("cache key cannot be null");
|
|
182785
|
-
}
|
|
182786
|
-
try {
|
|
182787
|
-
if (typeof value2 === "string") return value2;
|
|
182788
|
-
return (0, import_object_hash.default)(value2, { unorderedObjects: true, unorderedArrays: true });
|
|
182789
|
-
} catch (error49) {
|
|
182790
|
-
throw new Error(
|
|
182791
|
-
`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`
|
|
182792
|
-
);
|
|
182793
|
-
}
|
|
182794
|
-
}
|
|
182795
|
-
function jitter(delayMs) {
|
|
182796
|
-
const half = delayMs / 2;
|
|
182797
|
-
return Math.round(half + Math.random() * half);
|
|
182798
|
-
}
|
|
182799
|
-
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
182800
|
-
function getErrorResponseHeaders(error49) {
|
|
182801
|
-
if (error49 === null || typeof error49 !== "object") return void 0;
|
|
182802
|
-
const source = error49;
|
|
182803
|
-
const headers = source.response?.headers ?? source.headers;
|
|
182804
|
-
if (headers === null || typeof headers !== "object") return void 0;
|
|
182805
|
-
return headers;
|
|
182806
|
-
}
|
|
182807
|
-
function retryAfterMs(error49) {
|
|
182808
|
-
const headers = getErrorResponseHeaders(error49);
|
|
182809
|
-
if (!headers) return void 0;
|
|
182810
|
-
const retryAfter = headers["retry-after"];
|
|
182811
|
-
if (typeof retryAfter === "string" && retryAfter.trim() !== "") {
|
|
182812
|
-
const seconds = Number(retryAfter);
|
|
182813
|
-
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
182814
|
-
const dateMs = Date.parse(retryAfter);
|
|
182815
|
-
if (!Number.isNaN(dateMs)) return Math.max(0, dateMs - Date.now());
|
|
182816
|
-
}
|
|
182817
|
-
if (headers["x-ratelimit-remaining"] === "0") {
|
|
182818
|
-
const reset = headers["x-ratelimit-reset"];
|
|
182819
|
-
if (typeof reset === "string" && reset.trim() !== "") {
|
|
182820
|
-
const resetEpoch = Number(reset);
|
|
182821
|
-
if (Number.isFinite(resetEpoch)) return Math.max(0, resetEpoch * 1e3 - Date.now());
|
|
182822
|
-
}
|
|
182823
|
-
}
|
|
182824
|
-
return void 0;
|
|
182825
|
-
}
|
|
182826
|
-
function validateSchema(schema2, value2) {
|
|
182827
|
-
const result = schema2["~standard"].validate(value2);
|
|
182828
|
-
if (result instanceof Promise) {
|
|
182829
|
-
return result.then((res) => {
|
|
182830
|
-
if (res.issues) {
|
|
182831
|
-
const messages = res.issues.map((i) => i.message).join(", ");
|
|
182832
|
-
throw new Error(`validation failed: ${messages}`);
|
|
182833
|
-
}
|
|
182834
|
-
return res.value;
|
|
182835
|
-
});
|
|
182836
|
-
}
|
|
182837
|
-
if (result.issues) {
|
|
182838
|
-
const messages = result.issues.map((i) => i.message).join(", ");
|
|
182839
|
-
throw new Error(`validation failed: ${messages}`);
|
|
182840
|
-
}
|
|
182841
|
-
return result.value;
|
|
182842
|
-
}
|
|
182843
|
-
var log2 = {
|
|
182844
|
-
info: (...args2) => console.log(...args2),
|
|
182845
|
-
error: (...args2) => console.error(...args2),
|
|
182846
|
-
debug: (...args2) => {
|
|
182847
|
-
if (process.env.LOG_LEVEL === "debug") console.log(...args2);
|
|
182848
|
-
},
|
|
182849
|
-
prod: (...args2) => {
|
|
182850
|
-
if (process.env.NODE_ENV === "production") console.log(...args2);
|
|
182851
|
-
}
|
|
182852
|
-
};
|
|
182853
|
-
function op(fnOrOptions, options) {
|
|
182854
|
-
if (typeof fnOrOptions === "function") {
|
|
182855
|
-
return _op(fnOrOptions, options ?? {});
|
|
182856
|
-
}
|
|
182857
|
-
const { input: inputSchema, output: outputSchema, run, ...opOptions } = fnOrOptions;
|
|
182858
|
-
const wrappedFn = async (rawInput, ctx) => {
|
|
182859
|
-
let input = rawInput;
|
|
182860
|
-
if (inputSchema) {
|
|
182861
|
-
const validated = validateSchema(inputSchema, rawInput);
|
|
182862
|
-
input = validated instanceof Promise ? await validated : validated;
|
|
182863
|
-
}
|
|
182864
|
-
const result = await run(input, ctx);
|
|
182865
|
-
if (outputSchema) {
|
|
182866
|
-
const validated = validateSchema(outputSchema, result);
|
|
182867
|
-
return validated instanceof Promise ? await validated : validated;
|
|
182868
|
-
}
|
|
182869
|
-
return result;
|
|
182870
|
-
};
|
|
182871
|
-
return _op(wrappedFn, opOptions);
|
|
182872
|
-
}
|
|
182873
|
-
function _op(fn2, options) {
|
|
182874
|
-
const shouldCache = options.ttl !== void 0;
|
|
182875
|
-
const lruCache = shouldCache ? new I({
|
|
182876
|
-
max: options.maxItems ?? 1e3,
|
|
182877
|
-
ttl: options.ttl
|
|
182878
|
-
}) : null;
|
|
182879
|
-
const keyMap = shouldCache ? new I({
|
|
182880
|
-
max: options.maxItems ?? 1e3,
|
|
182881
|
-
ttl: options.ttl
|
|
182882
|
-
}) : null;
|
|
182883
|
-
const inFlightPromises = /* @__PURE__ */ new Map();
|
|
182884
|
-
const namePrefix = options.name ? `[${options.name}] ` : "";
|
|
182885
|
-
const defaultCacheHit = options.cacheHit === null ? () => {
|
|
182886
|
-
} : options.cacheHit ?? (() => {
|
|
182887
|
-
if (options.name && shouldCache) log2.prod(`${namePrefix}cache hit`);
|
|
182888
|
-
});
|
|
182889
|
-
const defaultCacheMiss = options.cacheMiss === null ? () => {
|
|
182890
|
-
} : options.cacheMiss ?? (() => {
|
|
182891
|
-
if (options.name && shouldCache) log2.prod(`${namePrefix}cache miss`);
|
|
182892
|
-
});
|
|
182893
|
-
const acceptsCtx = fn2.length === 2;
|
|
182894
|
-
const cachedFn = async (input, ctx) => {
|
|
182895
|
-
let key;
|
|
182896
|
-
try {
|
|
182897
|
-
key = getCacheKeyString(input);
|
|
182898
|
-
} catch (error49) {
|
|
182899
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
182900
|
-
throw new Error(
|
|
182901
|
-
`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`
|
|
182902
|
-
);
|
|
182903
|
-
}
|
|
182904
|
-
const startTime = performance8.now();
|
|
182905
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
182906
|
-
log2.debug(`${namePrefix}[${timestamp}] cache lookup started`, { key });
|
|
182907
|
-
if (shouldCache && lruCache) {
|
|
182908
|
-
const cached4 = lruCache.get(key);
|
|
182909
|
-
if (cached4 !== void 0) {
|
|
182910
|
-
if (keyMap?.get(key) === void 0) keyMap?.set(key, input);
|
|
182911
|
-
const runtime = performance8.now() - startTime;
|
|
182912
|
-
log2.debug(`${namePrefix}[${timestamp}] cache hit (from lru)`, {
|
|
182913
|
-
key,
|
|
182914
|
-
runtime: `${Math.round(runtime)}ms`
|
|
182915
|
-
});
|
|
182916
|
-
defaultCacheHit(key);
|
|
182917
|
-
return cached4;
|
|
182918
|
-
}
|
|
182919
|
-
}
|
|
182920
|
-
const inFlight = inFlightPromises.get(key);
|
|
182921
|
-
if (inFlight) {
|
|
182922
|
-
log2.debug(`${namePrefix}[${timestamp}] cache hit (in-flight)`, { key });
|
|
182923
|
-
defaultCacheHit(key);
|
|
182924
|
-
return inFlight;
|
|
182925
|
-
}
|
|
182926
|
-
log2.debug(`${namePrefix}[${timestamp}] cache miss, executing function`, { key });
|
|
182927
|
-
defaultCacheMiss(key);
|
|
182928
|
-
const retries = options.retries ?? [];
|
|
182929
|
-
let lastError;
|
|
182930
|
-
const execStartTime = performance8.now();
|
|
182931
|
-
const promise2 = (async () => {
|
|
182932
|
-
for (let attempt = 0; attempt <= retries.length; attempt++) {
|
|
182933
|
-
try {
|
|
182934
|
-
const result = acceptsCtx ? await fn2(input, ctx) : await fn2(input);
|
|
182935
|
-
const execRuntime2 = performance8.now() - execStartTime;
|
|
182936
|
-
const skip = options.skipCache ? options.skipCache(result) : false;
|
|
182937
|
-
if (shouldCache && lruCache && result !== null && result !== void 0 && !skip) {
|
|
182938
|
-
lruCache.set(key, result);
|
|
182939
|
-
keyMap?.set(key, input);
|
|
182940
|
-
}
|
|
182941
|
-
log2.debug(`${namePrefix}[${timestamp}] function executed successfully`, {
|
|
182942
|
-
key,
|
|
182943
|
-
runtime: `${Math.round(execRuntime2)}ms`,
|
|
182944
|
-
attempt: attempt + 1,
|
|
182945
|
-
cached: shouldCache && result !== null && result !== void 0 && !skip
|
|
182946
|
-
});
|
|
182947
|
-
return result;
|
|
182948
|
-
} catch (error49) {
|
|
182949
|
-
if (options.bail?.(error49)) throw error49;
|
|
182950
|
-
lastError = error49;
|
|
182951
|
-
const isLastAttempt = attempt >= retries.length;
|
|
182952
|
-
if (isLastAttempt) {
|
|
182953
|
-
if (namePrefix) {
|
|
182954
|
-
log2.info(
|
|
182955
|
-
`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`
|
|
182956
|
-
);
|
|
182957
|
-
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
182958
|
-
} else {
|
|
182959
|
-
log2.info(`attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
182960
|
-
log2.info({ key, error: error49, attempt });
|
|
182961
|
-
}
|
|
182962
|
-
} else {
|
|
182963
|
-
let delay2 = retries[attempt];
|
|
182964
|
-
if (options.retryAfter) {
|
|
182965
|
-
const extract = options.retryAfter === true ? retryAfterMs : options.retryAfter;
|
|
182966
|
-
const hint = extract(error49);
|
|
182967
|
-
if (hint !== void 0) {
|
|
182968
|
-
const cap = options.retryAfterCap ?? DEFAULT_RETRY_AFTER_CAP_MS;
|
|
182969
|
-
delay2 = Math.max(delay2, Math.min(cap, hint));
|
|
182970
|
-
}
|
|
182971
|
-
}
|
|
182972
|
-
delay2 = jitter(delay2);
|
|
182973
|
-
if (namePrefix) {
|
|
182974
|
-
log2.info(
|
|
182975
|
-
`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`
|
|
182976
|
-
);
|
|
182977
|
-
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
182978
|
-
} else {
|
|
182979
|
-
log2.info(
|
|
182980
|
-
`attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`
|
|
182981
|
-
);
|
|
182982
|
-
log2.info({ key, error: error49, attempt });
|
|
182983
|
-
}
|
|
182984
|
-
await sleep3(delay2);
|
|
182985
|
-
}
|
|
182986
|
-
}
|
|
182987
|
-
}
|
|
182988
|
-
const execRuntime = performance8.now() - execStartTime;
|
|
182989
|
-
log2.debug(`${namePrefix}[${timestamp}] function failed after all retries`, {
|
|
182990
|
-
key,
|
|
182991
|
-
runtime: `${Math.round(execRuntime)}ms`,
|
|
182992
|
-
attempts: retries.length + 1,
|
|
182993
|
-
error: lastError instanceof Error ? lastError.message : lastError
|
|
182994
|
-
});
|
|
182995
|
-
throw lastError;
|
|
182996
|
-
})();
|
|
182997
|
-
inFlightPromises.set(key, promise2);
|
|
182998
|
-
try {
|
|
182999
|
-
return await promise2;
|
|
183000
|
-
} finally {
|
|
183001
|
-
inFlightPromises.delete(key);
|
|
183002
|
-
}
|
|
183003
|
-
};
|
|
183004
|
-
cachedFn.clear = (key) => {
|
|
183005
|
-
if (shouldCache && lruCache) {
|
|
183006
|
-
if (key !== void 0) {
|
|
183007
|
-
let stringKey;
|
|
183008
|
-
try {
|
|
183009
|
-
stringKey = getCacheKeyString(key);
|
|
183010
|
-
} catch (error49) {
|
|
183011
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
183012
|
-
throw new Error(
|
|
183013
|
-
`failed to hash cache key for clear()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`
|
|
183014
|
-
);
|
|
183015
|
-
}
|
|
183016
|
-
lruCache.delete(stringKey);
|
|
183017
|
-
keyMap.delete(stringKey);
|
|
183018
|
-
} else {
|
|
183019
|
-
lruCache.clear();
|
|
183020
|
-
keyMap.clear();
|
|
183021
|
-
}
|
|
183022
|
-
}
|
|
183023
|
-
};
|
|
183024
|
-
cachedFn.has = (key) => {
|
|
183025
|
-
if (!shouldCache || !lruCache) return false;
|
|
183026
|
-
try {
|
|
183027
|
-
const stringKey = getCacheKeyString(key);
|
|
183028
|
-
return lruCache.has(stringKey);
|
|
183029
|
-
} catch (error49) {
|
|
183030
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
183031
|
-
throw new Error(
|
|
183032
|
-
`failed to hash cache key for has()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`
|
|
183033
|
-
);
|
|
183034
|
-
}
|
|
183035
|
-
};
|
|
183036
|
-
cachedFn.invalidate = (predicate) => {
|
|
183037
|
-
if (!shouldCache || !lruCache) return 0;
|
|
183038
|
-
let count = 0;
|
|
183039
|
-
for (const [stringKey, originalKey] of keyMap) {
|
|
183040
|
-
if (predicate(originalKey)) {
|
|
183041
|
-
lruCache.delete(stringKey);
|
|
183042
|
-
keyMap.delete(stringKey);
|
|
183043
|
-
count++;
|
|
183044
|
-
}
|
|
183045
|
-
}
|
|
183046
|
-
return count;
|
|
183047
|
-
};
|
|
183048
|
-
return cachedFn;
|
|
183049
|
-
}
|
|
183050
|
-
|
|
183051
182877
|
// mcp/git.ts
|
|
183052
182878
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
183053
182879
|
import { writeFileSync as writeFileSync9 } from "node:fs";
|
|
@@ -187827,7 +187653,7 @@ async function acquireNewToken(opts) {
|
|
|
187827
187653
|
return await op(() => acquireTokenViaOIDC(opts), {
|
|
187828
187654
|
name: "token exchange",
|
|
187829
187655
|
retries: [1e3, 2e3],
|
|
187830
|
-
|
|
187656
|
+
rethrow: (error49) => !isTransientTokenError(error49)
|
|
187831
187657
|
})();
|
|
187832
187658
|
}
|
|
187833
187659
|
if (process.env.GITHUB_ACTIONS === "true") {
|
|
@@ -188954,7 +188780,7 @@ async function patchWorkflowRunFields(ctx, fields) {
|
|
|
188954
188780
|
name: "patchWorkflowRunFields",
|
|
188955
188781
|
// only retry transient network errors; explicit HTTP failures throw
|
|
188956
188782
|
// a status-bearing message and should fail fast.
|
|
188957
|
-
|
|
188783
|
+
rethrow: (error49) => !isTransientNetworkError(error49)
|
|
188958
188784
|
}
|
|
188959
188785
|
)();
|
|
188960
188786
|
} catch (error49) {
|
|
@@ -189795,7 +189621,7 @@ function CreatePullRequestReviewTool(ctx) {
|
|
|
189795
189621
|
}) : createReviewWithStrandedRecovery(ctx, params),
|
|
189796
189622
|
{
|
|
189797
189623
|
retries: TRANSIENT_REVIEW_RETRY_DELAYS_MS,
|
|
189798
|
-
|
|
189624
|
+
rethrow: (err) => !isTransientReviewError(err),
|
|
189799
189625
|
name: "review submission"
|
|
189800
189626
|
}
|
|
189801
189627
|
)();
|
|
@@ -190490,7 +190316,7 @@ async function checkoutPrBranch(pr, params) {
|
|
|
190490
190316
|
{
|
|
190491
190317
|
retries: PULL_REF_RETRY_DELAYS_MS,
|
|
190492
190318
|
name: `pull/${pr.number}/head fetch`,
|
|
190493
|
-
|
|
190319
|
+
rethrow: (e) => !PULL_REF_MISSING_PATTERN.test(e instanceof Error ? e.message : String(e))
|
|
190494
190320
|
}
|
|
190495
190321
|
)();
|
|
190496
190322
|
$("git", ["checkout", localBranch], { log: false });
|
|
@@ -191169,7 +190995,7 @@ function ReopenCurrentTool(ctx) {
|
|
|
191169
190995
|
}
|
|
191170
190996
|
|
|
191171
190997
|
// prep/index.ts
|
|
191172
|
-
import { performance as
|
|
190998
|
+
import { performance as performance8 } from "node:perf_hooks";
|
|
191173
190999
|
|
|
191174
191000
|
// prep/installNodeDependencies.ts
|
|
191175
191001
|
import { existsSync as existsSync8 } from "node:fs";
|
|
@@ -191628,7 +191454,7 @@ var installPythonDependencies = {
|
|
|
191628
191454
|
var prepSteps = [installNodeDependencies, installPythonDependencies];
|
|
191629
191455
|
async function runPrepPhase(options) {
|
|
191630
191456
|
log.debug("\xBB starting prep phase...");
|
|
191631
|
-
const startTime =
|
|
191457
|
+
const startTime = performance8.now();
|
|
191632
191458
|
const results = [];
|
|
191633
191459
|
const preDirty = await dirtyTrackedPaths();
|
|
191634
191460
|
try {
|
|
@@ -191650,7 +191476,7 @@ async function runPrepPhase(options) {
|
|
|
191650
191476
|
} finally {
|
|
191651
191477
|
await restoreDirtiedSince({ before: preDirty, actor: "prep" });
|
|
191652
191478
|
}
|
|
191653
|
-
const totalDurationMs =
|
|
191479
|
+
const totalDurationMs = performance8.now() - startTime;
|
|
191654
191480
|
log.debug(`\xBB prep phase completed (${Math.round(totalDurationMs)}ms)`);
|
|
191655
191481
|
return results;
|
|
191656
191482
|
}
|
|
@@ -193889,10 +193715,12 @@ function buildMissingApiKeyError(params) {
|
|
|
193889
193715
|
const [primary, ...alternates] = envVars;
|
|
193890
193716
|
const envVarList = primary ? `\`${primary}\`${alternates.length > 0 ? ` (or ${alternates.map((v) => `\`${v}\``).join(" / ")})` : ""}` : void 0;
|
|
193891
193717
|
const lead = envVarList ? `**${MISSING_KEY_MARKER}** \u2014 this run used \`${params.model}\`, which needs ${envVarList}, but the runner has no key for it.` : `**${MISSING_KEY_MARKER}** \u2014 Pullfrog needs at least one LLM provider API key (e.g. \`ANTHROPIC_API_KEY\`, \`OPENAI_API_KEY\`, \`GEMINI_API_KEY\`) configured as a GitHub Actions secret.`;
|
|
193718
|
+
const unhosted = params.model?.includes("/") ? getModelManagedCredentials(params.model).find((name) => unhostedSubscriptions.has(name)) : void 0;
|
|
193719
|
+
const fix = unhosted ? `**To fix:** your ${SUBSCRIPTION_CREDENTIALS[unhosted]?.label} is stored, but this runner has no passwordless \`sudo\`, which Pullfrog needs to keep it in \`${PULLFROG_DATA_DIR}\`, out of the agent's reach. Allow passwordless \`sudo\` for the runner user, run on a GitHub-hosted runner, or add an API key as a GitHub Actions secret or a Pullfrog secret.` : "**To fix:** add the key as a GitHub Actions secret (referenced from your workflow's `env:` block) or as a Pullfrog secret in the console \u2014 or switch this repo to a different model (free models need no key).";
|
|
193892
193720
|
return [
|
|
193893
193721
|
lead,
|
|
193894
193722
|
"",
|
|
193895
|
-
|
|
193723
|
+
fix,
|
|
193896
193724
|
"",
|
|
193897
193725
|
`[Open repo secrets \u2192](${githubSecretsUrl}) \xB7 [Configure model \u2192](${settingsUrl}) \xB7 [Setup docs \u2192](https://docs.pullfrog.com/keys) \xB7 [Ask in Discord \u2192](https://discord.gg/8y96raFg8e)`
|
|
193898
193726
|
].join("\n");
|
|
@@ -194849,7 +194677,7 @@ var select = op(
|
|
|
194849
194677
|
},
|
|
194850
194678
|
{
|
|
194851
194679
|
retries: [250, 1e3],
|
|
194852
|
-
|
|
194680
|
+
rethrow: (error49) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500
|
|
194853
194681
|
}
|
|
194854
194682
|
);
|
|
194855
194683
|
function subscriptionForModel(model) {
|
|
@@ -196302,7 +196130,7 @@ async function mintProxyKey(ctx) {
|
|
|
196302
196130
|
{
|
|
196303
196131
|
name: "proxy key mint",
|
|
196304
196132
|
retries: [1e3, 2e3],
|
|
196305
|
-
|
|
196133
|
+
rethrow: (error49) => !(error49 instanceof TransientError)
|
|
196306
196134
|
}
|
|
196307
196135
|
)();
|
|
196308
196136
|
if (response.status === 402) {
|
|
@@ -196340,7 +196168,7 @@ async function buildProxyTokenHeaders(ctx) {
|
|
|
196340
196168
|
const oidcToken = await op(() => fetchIdTokenFromStash(creds), {
|
|
196341
196169
|
name: "ID token mint",
|
|
196342
196170
|
retries: [1e3, 2e3],
|
|
196343
|
-
|
|
196171
|
+
rethrow: (error49) => !isTransientTokenError(error49)
|
|
196344
196172
|
})();
|
|
196345
196173
|
return {
|
|
196346
196174
|
Authorization: `Bearer ${oidcToken}`,
|
|
@@ -196709,7 +196537,7 @@ async function resolveRunContextData(params) {
|
|
|
196709
196537
|
op(() => params.octokit.repos.get({ owner: repoContext.owner, repo: repoContext.name }), {
|
|
196710
196538
|
name: "repos.get",
|
|
196711
196539
|
retries: [100, 500],
|
|
196712
|
-
|
|
196540
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
196713
196541
|
})(),
|
|
196714
196542
|
fetchRunContext({
|
|
196715
196543
|
token: params.token,
|
|
@@ -197260,7 +197088,7 @@ async function autoMergeAfterApprove(ctx) {
|
|
|
197260
197088
|
{
|
|
197261
197089
|
name: "enablePullRequestAutoMerge",
|
|
197262
197090
|
retries: [500, 2e3],
|
|
197263
|
-
|
|
197091
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
197264
197092
|
}
|
|
197265
197093
|
)();
|
|
197266
197094
|
log.info(`autoMerge: pr=#${pullNumber} @ ${headSha.slice(0, 7)} \u2192 native auto-merge enabled`);
|
|
@@ -197364,7 +197192,7 @@ async function dispatchFollowUpReReview(ctx, reviewedSha) {
|
|
|
197364
197192
|
{
|
|
197365
197193
|
name: "reReviewDispatch",
|
|
197366
197194
|
retries: [500, 2e3],
|
|
197367
|
-
|
|
197195
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
197368
197196
|
}
|
|
197369
197197
|
)();
|
|
197370
197198
|
}
|