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/cli.mjs
CHANGED
|
@@ -16041,7 +16041,7 @@ var require_util2 = __commonJS({
|
|
|
16041
16041
|
"use strict";
|
|
16042
16042
|
var { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = require_constants2();
|
|
16043
16043
|
var { getGlobalOrigin } = require_global();
|
|
16044
|
-
var { performance:
|
|
16044
|
+
var { performance: performance9 } = __require("perf_hooks");
|
|
16045
16045
|
var { isBlobLike, toUSVString, ReadableStreamFrom } = require_util();
|
|
16046
16046
|
var assert3 = __require("assert");
|
|
16047
16047
|
var { isUint8Array } = __require("util/types");
|
|
@@ -16204,7 +16204,7 @@ var require_util2 = __commonJS({
|
|
|
16204
16204
|
}
|
|
16205
16205
|
}
|
|
16206
16206
|
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
|
|
16207
|
-
return
|
|
16207
|
+
return performance9.now();
|
|
16208
16208
|
}
|
|
16209
16209
|
function createOpaqueTimingInfo(timingInfo) {
|
|
16210
16210
|
return {
|
|
@@ -45402,7 +45402,7 @@ var require_util9 = __commonJS({
|
|
|
45402
45402
|
var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants9();
|
|
45403
45403
|
var { getGlobalOrigin } = require_global3();
|
|
45404
45404
|
var { collectAnHTTPQuotedString, parseMIMEType } = require_data_url();
|
|
45405
|
-
var { performance:
|
|
45405
|
+
var { performance: performance9 } = __require("node:perf_hooks");
|
|
45406
45406
|
var { ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util8();
|
|
45407
45407
|
var assert3 = __require("node:assert");
|
|
45408
45408
|
var { isUint8Array } = __require("node:util/types");
|
|
@@ -45557,7 +45557,7 @@ var require_util9 = __commonJS({
|
|
|
45557
45557
|
};
|
|
45558
45558
|
}
|
|
45559
45559
|
function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
|
|
45560
|
-
return coarsenTime(
|
|
45560
|
+
return coarsenTime(performance9.now(), crossOriginIsolatedCapability);
|
|
45561
45561
|
}
|
|
45562
45562
|
function createOpaqueTimingInfo(timingInfo) {
|
|
45563
45563
|
return {
|
|
@@ -74479,9 +74479,9 @@ var require_validate = __commonJS({
|
|
|
74479
74479
|
}
|
|
74480
74480
|
}
|
|
74481
74481
|
function returnResults(it) {
|
|
74482
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
74482
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
74483
74483
|
if (schemaEnv.$async) {
|
|
74484
|
-
gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${
|
|
74484
|
+
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})`));
|
|
74485
74485
|
} else {
|
|
74486
74486
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
74487
74487
|
if (opts.unevaluated)
|
|
@@ -74833,14 +74833,14 @@ var require_validation_error = __commonJS({
|
|
|
74833
74833
|
"node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js"(exports) {
|
|
74834
74834
|
"use strict";
|
|
74835
74835
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74836
|
-
var
|
|
74836
|
+
var ValidationError2 = class extends Error {
|
|
74837
74837
|
constructor(errors) {
|
|
74838
74838
|
super("validation failed");
|
|
74839
74839
|
this.errors = errors;
|
|
74840
74840
|
this.ajv = this.validation = true;
|
|
74841
74841
|
}
|
|
74842
74842
|
};
|
|
74843
|
-
exports.default =
|
|
74843
|
+
exports.default = ValidationError2;
|
|
74844
74844
|
}
|
|
74845
74845
|
});
|
|
74846
74846
|
|
|
@@ -75838,7 +75838,7 @@ var require_fast_uri = __commonJS({
|
|
|
75838
75838
|
normalizeString(uri, options);
|
|
75839
75839
|
} else if (typeof uri === "object") {
|
|
75840
75840
|
uri = /** @type {T} */
|
|
75841
|
-
parse6(
|
|
75841
|
+
parse6(serialize2(uri, options), options);
|
|
75842
75842
|
}
|
|
75843
75843
|
return uri;
|
|
75844
75844
|
}
|
|
@@ -75873,13 +75873,13 @@ var require_fast_uri = __commonJS({
|
|
|
75873
75873
|
throw new Error(resolved.error);
|
|
75874
75874
|
}
|
|
75875
75875
|
schemelessOptions.skipEscape = true;
|
|
75876
|
-
return
|
|
75876
|
+
return serialize2(resolved, schemelessOptions);
|
|
75877
75877
|
}
|
|
75878
75878
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
75879
75879
|
const target = {};
|
|
75880
75880
|
if (!skipNormalization) {
|
|
75881
|
-
base = parse6(
|
|
75882
|
-
relative = parse6(
|
|
75881
|
+
base = parse6(serialize2(base, options), options);
|
|
75882
|
+
relative = parse6(serialize2(relative, options), options);
|
|
75883
75883
|
}
|
|
75884
75884
|
options = options || {};
|
|
75885
75885
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -75933,7 +75933,7 @@ var require_fast_uri = __commonJS({
|
|
|
75933
75933
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
75934
75934
|
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
75935
75935
|
}
|
|
75936
|
-
function
|
|
75936
|
+
function serialize2(cmpts, opts) {
|
|
75937
75937
|
const component = {
|
|
75938
75938
|
host: cmpts.host,
|
|
75939
75939
|
scheme: cmpts.scheme,
|
|
@@ -76187,7 +76187,7 @@ var require_fast_uri = __commonJS({
|
|
|
76187
76187
|
function normalizeStringWithStatus(uri, opts) {
|
|
76188
76188
|
const { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
76189
76189
|
return {
|
|
76190
|
-
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri :
|
|
76190
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize2(parsed2, opts),
|
|
76191
76191
|
malformedAuthorityOrPort,
|
|
76192
76192
|
malformedPercentEncoding,
|
|
76193
76193
|
malformedSchemeSpecific,
|
|
@@ -76201,7 +76201,7 @@ var require_fast_uri = __commonJS({
|
|
|
76201
76201
|
}
|
|
76202
76202
|
let value2;
|
|
76203
76203
|
try {
|
|
76204
|
-
value2 = typeof uri === "string" ? uri :
|
|
76204
|
+
value2 = typeof uri === "string" ? uri : serialize2(uri, opts);
|
|
76205
76205
|
} catch {
|
|
76206
76206
|
return void 0;
|
|
76207
76207
|
}
|
|
@@ -76214,7 +76214,7 @@ var require_fast_uri = __commonJS({
|
|
|
76214
76214
|
resolve: resolve3,
|
|
76215
76215
|
resolveComponent,
|
|
76216
76216
|
equal,
|
|
76217
|
-
serialize,
|
|
76217
|
+
serialize: serialize2,
|
|
76218
76218
|
parse: parse6
|
|
76219
76219
|
};
|
|
76220
76220
|
module.exports = fastUri;
|
|
@@ -76661,7 +76661,7 @@ var require_core2 = __commonJS({
|
|
|
76661
76661
|
}
|
|
76662
76662
|
}
|
|
76663
76663
|
}
|
|
76664
|
-
_addSchema(schema2, meta3, baseId,
|
|
76664
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
76665
76665
|
let id;
|
|
76666
76666
|
const { schemaId } = this.opts;
|
|
76667
76667
|
if (typeof schema2 == "object") {
|
|
@@ -76684,7 +76684,7 @@ var require_core2 = __commonJS({
|
|
|
76684
76684
|
this._checkUnique(baseId);
|
|
76685
76685
|
this.refs[baseId] = sch;
|
|
76686
76686
|
}
|
|
76687
|
-
if (
|
|
76687
|
+
if (validateSchema)
|
|
76688
76688
|
this.validateSchema(schema2, true);
|
|
76689
76689
|
return sch;
|
|
76690
76690
|
}
|
|
@@ -79771,384 +79771,6 @@ var init_index_DoHiaFQM = __esm({
|
|
|
79771
79771
|
}
|
|
79772
79772
|
});
|
|
79773
79773
|
|
|
79774
|
-
// node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js
|
|
79775
|
-
var require_object_hash = __commonJS({
|
|
79776
|
-
"node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js"(exports, module) {
|
|
79777
|
-
"use strict";
|
|
79778
|
-
var crypto5 = __require("crypto");
|
|
79779
|
-
exports = module.exports = objectHash;
|
|
79780
|
-
function objectHash(object5, options) {
|
|
79781
|
-
options = applyDefaults(object5, options);
|
|
79782
|
-
return hash3(object5, options);
|
|
79783
|
-
}
|
|
79784
|
-
exports.sha1 = function(object5) {
|
|
79785
|
-
return objectHash(object5);
|
|
79786
|
-
};
|
|
79787
|
-
exports.keys = function(object5) {
|
|
79788
|
-
return objectHash(object5, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
|
|
79789
|
-
};
|
|
79790
|
-
exports.MD5 = function(object5) {
|
|
79791
|
-
return objectHash(object5, { algorithm: "md5", encoding: "hex" });
|
|
79792
|
-
};
|
|
79793
|
-
exports.keysMD5 = function(object5) {
|
|
79794
|
-
return objectHash(object5, { algorithm: "md5", encoding: "hex", excludeValues: true });
|
|
79795
|
-
};
|
|
79796
|
-
var hashes = crypto5.getHashes ? crypto5.getHashes().slice() : ["sha1", "md5"];
|
|
79797
|
-
hashes.push("passthrough");
|
|
79798
|
-
var encodings = ["buffer", "hex", "binary", "base64"];
|
|
79799
|
-
function applyDefaults(object5, sourceOptions) {
|
|
79800
|
-
sourceOptions = sourceOptions || {};
|
|
79801
|
-
var options = {};
|
|
79802
|
-
options.algorithm = sourceOptions.algorithm || "sha1";
|
|
79803
|
-
options.encoding = sourceOptions.encoding || "hex";
|
|
79804
|
-
options.excludeValues = sourceOptions.excludeValues ? true : false;
|
|
79805
|
-
options.algorithm = options.algorithm.toLowerCase();
|
|
79806
|
-
options.encoding = options.encoding.toLowerCase();
|
|
79807
|
-
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
|
|
79808
|
-
options.respectType = sourceOptions.respectType === false ? false : true;
|
|
79809
|
-
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
|
|
79810
|
-
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
|
|
79811
|
-
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
|
|
79812
|
-
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
|
|
79813
|
-
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
|
|
79814
|
-
options.replacer = sourceOptions.replacer || void 0;
|
|
79815
|
-
options.excludeKeys = sourceOptions.excludeKeys || void 0;
|
|
79816
|
-
if (typeof object5 === "undefined") {
|
|
79817
|
-
throw new Error("Object argument required.");
|
|
79818
|
-
}
|
|
79819
|
-
for (var i2 = 0; i2 < hashes.length; ++i2) {
|
|
79820
|
-
if (hashes[i2].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
79821
|
-
options.algorithm = hashes[i2];
|
|
79822
|
-
}
|
|
79823
|
-
}
|
|
79824
|
-
if (hashes.indexOf(options.algorithm) === -1) {
|
|
79825
|
-
throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
|
|
79826
|
-
}
|
|
79827
|
-
if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
|
|
79828
|
-
throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
|
|
79829
|
-
}
|
|
79830
|
-
return options;
|
|
79831
|
-
}
|
|
79832
|
-
function isNativeFunction(f) {
|
|
79833
|
-
if (typeof f !== "function") {
|
|
79834
|
-
return false;
|
|
79835
|
-
}
|
|
79836
|
-
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
79837
|
-
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
79838
|
-
}
|
|
79839
|
-
function hash3(object5, options) {
|
|
79840
|
-
var hashingStream;
|
|
79841
|
-
if (options.algorithm !== "passthrough") {
|
|
79842
|
-
hashingStream = crypto5.createHash(options.algorithm);
|
|
79843
|
-
} else {
|
|
79844
|
-
hashingStream = new PassThrough();
|
|
79845
|
-
}
|
|
79846
|
-
if (typeof hashingStream.write === "undefined") {
|
|
79847
|
-
hashingStream.write = hashingStream.update;
|
|
79848
|
-
hashingStream.end = hashingStream.update;
|
|
79849
|
-
}
|
|
79850
|
-
var hasher = typeHasher(options, hashingStream);
|
|
79851
|
-
hasher.dispatch(object5);
|
|
79852
|
-
if (!hashingStream.update) {
|
|
79853
|
-
hashingStream.end("");
|
|
79854
|
-
}
|
|
79855
|
-
if (hashingStream.digest) {
|
|
79856
|
-
return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
|
|
79857
|
-
}
|
|
79858
|
-
var buf = hashingStream.read();
|
|
79859
|
-
if (options.encoding === "buffer") {
|
|
79860
|
-
return buf;
|
|
79861
|
-
}
|
|
79862
|
-
return buf.toString(options.encoding);
|
|
79863
|
-
}
|
|
79864
|
-
exports.writeToStream = function(object5, options, stream) {
|
|
79865
|
-
if (typeof stream === "undefined") {
|
|
79866
|
-
stream = options;
|
|
79867
|
-
options = {};
|
|
79868
|
-
}
|
|
79869
|
-
options = applyDefaults(object5, options);
|
|
79870
|
-
return typeHasher(options, stream).dispatch(object5);
|
|
79871
|
-
};
|
|
79872
|
-
function typeHasher(options, writeTo, context) {
|
|
79873
|
-
context = context || [];
|
|
79874
|
-
var write2 = function(str) {
|
|
79875
|
-
if (writeTo.update) {
|
|
79876
|
-
return writeTo.update(str, "utf8");
|
|
79877
|
-
} else {
|
|
79878
|
-
return writeTo.write(str, "utf8");
|
|
79879
|
-
}
|
|
79880
|
-
};
|
|
79881
|
-
return {
|
|
79882
|
-
dispatch: function(value2) {
|
|
79883
|
-
if (options.replacer) {
|
|
79884
|
-
value2 = options.replacer(value2);
|
|
79885
|
-
}
|
|
79886
|
-
var type2 = typeof value2;
|
|
79887
|
-
if (value2 === null) {
|
|
79888
|
-
type2 = "null";
|
|
79889
|
-
}
|
|
79890
|
-
return this["_" + type2](value2);
|
|
79891
|
-
},
|
|
79892
|
-
_object: function(object5) {
|
|
79893
|
-
var pattern = /\[object (.*)\]/i;
|
|
79894
|
-
var objString = Object.prototype.toString.call(object5);
|
|
79895
|
-
var objType = pattern.exec(objString);
|
|
79896
|
-
if (!objType) {
|
|
79897
|
-
objType = "unknown:[" + objString + "]";
|
|
79898
|
-
} else {
|
|
79899
|
-
objType = objType[1];
|
|
79900
|
-
}
|
|
79901
|
-
objType = objType.toLowerCase();
|
|
79902
|
-
var objectNumber = null;
|
|
79903
|
-
if ((objectNumber = context.indexOf(object5)) >= 0) {
|
|
79904
|
-
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
|
|
79905
|
-
} else {
|
|
79906
|
-
context.push(object5);
|
|
79907
|
-
}
|
|
79908
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object5)) {
|
|
79909
|
-
write2("buffer:");
|
|
79910
|
-
return write2(object5);
|
|
79911
|
-
}
|
|
79912
|
-
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
|
|
79913
|
-
if (this["_" + objType]) {
|
|
79914
|
-
this["_" + objType](object5);
|
|
79915
|
-
} else if (options.ignoreUnknown) {
|
|
79916
|
-
return write2("[" + objType + "]");
|
|
79917
|
-
} else {
|
|
79918
|
-
throw new Error('Unknown object type "' + objType + '"');
|
|
79919
|
-
}
|
|
79920
|
-
} else {
|
|
79921
|
-
var keys = Object.keys(object5);
|
|
79922
|
-
if (options.unorderedObjects) {
|
|
79923
|
-
keys = keys.sort();
|
|
79924
|
-
}
|
|
79925
|
-
if (options.respectType !== false && !isNativeFunction(object5)) {
|
|
79926
|
-
keys.splice(0, 0, "prototype", "__proto__", "constructor");
|
|
79927
|
-
}
|
|
79928
|
-
if (options.excludeKeys) {
|
|
79929
|
-
keys = keys.filter(function(key) {
|
|
79930
|
-
return !options.excludeKeys(key);
|
|
79931
|
-
});
|
|
79932
|
-
}
|
|
79933
|
-
write2("object:" + keys.length + ":");
|
|
79934
|
-
var self2 = this;
|
|
79935
|
-
return keys.forEach(function(key) {
|
|
79936
|
-
self2.dispatch(key);
|
|
79937
|
-
write2(":");
|
|
79938
|
-
if (!options.excludeValues) {
|
|
79939
|
-
self2.dispatch(object5[key]);
|
|
79940
|
-
}
|
|
79941
|
-
write2(",");
|
|
79942
|
-
});
|
|
79943
|
-
}
|
|
79944
|
-
},
|
|
79945
|
-
_array: function(arr, unordered) {
|
|
79946
|
-
unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
|
|
79947
|
-
var self2 = this;
|
|
79948
|
-
write2("array:" + arr.length + ":");
|
|
79949
|
-
if (!unordered || arr.length <= 1) {
|
|
79950
|
-
return arr.forEach(function(entry) {
|
|
79951
|
-
return self2.dispatch(entry);
|
|
79952
|
-
});
|
|
79953
|
-
}
|
|
79954
|
-
var contextAdditions = [];
|
|
79955
|
-
var entries = arr.map(function(entry) {
|
|
79956
|
-
var strm = new PassThrough();
|
|
79957
|
-
var localContext = context.slice();
|
|
79958
|
-
var hasher = typeHasher(options, strm, localContext);
|
|
79959
|
-
hasher.dispatch(entry);
|
|
79960
|
-
contextAdditions = contextAdditions.concat(localContext.slice(context.length));
|
|
79961
|
-
return strm.read().toString();
|
|
79962
|
-
});
|
|
79963
|
-
context = context.concat(contextAdditions);
|
|
79964
|
-
entries.sort();
|
|
79965
|
-
return this._array(entries, false);
|
|
79966
|
-
},
|
|
79967
|
-
_date: function(date6) {
|
|
79968
|
-
return write2("date:" + date6.toJSON());
|
|
79969
|
-
},
|
|
79970
|
-
_symbol: function(sym) {
|
|
79971
|
-
return write2("symbol:" + sym.toString());
|
|
79972
|
-
},
|
|
79973
|
-
_error: function(err) {
|
|
79974
|
-
return write2("error:" + err.toString());
|
|
79975
|
-
},
|
|
79976
|
-
_boolean: function(bool) {
|
|
79977
|
-
return write2("bool:" + bool.toString());
|
|
79978
|
-
},
|
|
79979
|
-
_string: function(string6) {
|
|
79980
|
-
write2("string:" + string6.length + ":");
|
|
79981
|
-
write2(string6.toString());
|
|
79982
|
-
},
|
|
79983
|
-
_function: function(fn2) {
|
|
79984
|
-
write2("fn:");
|
|
79985
|
-
if (isNativeFunction(fn2)) {
|
|
79986
|
-
this.dispatch("[native]");
|
|
79987
|
-
} else {
|
|
79988
|
-
this.dispatch(fn2.toString());
|
|
79989
|
-
}
|
|
79990
|
-
if (options.respectFunctionNames !== false) {
|
|
79991
|
-
this.dispatch("function-name:" + String(fn2.name));
|
|
79992
|
-
}
|
|
79993
|
-
if (options.respectFunctionProperties) {
|
|
79994
|
-
this._object(fn2);
|
|
79995
|
-
}
|
|
79996
|
-
},
|
|
79997
|
-
_number: function(number6) {
|
|
79998
|
-
return write2("number:" + number6.toString());
|
|
79999
|
-
},
|
|
80000
|
-
_xml: function(xml) {
|
|
80001
|
-
return write2("xml:" + xml.toString());
|
|
80002
|
-
},
|
|
80003
|
-
_null: function() {
|
|
80004
|
-
return write2("Null");
|
|
80005
|
-
},
|
|
80006
|
-
_undefined: function() {
|
|
80007
|
-
return write2("Undefined");
|
|
80008
|
-
},
|
|
80009
|
-
_regexp: function(regex4) {
|
|
80010
|
-
return write2("regex:" + regex4.toString());
|
|
80011
|
-
},
|
|
80012
|
-
_uint8array: function(arr) {
|
|
80013
|
-
write2("uint8array:");
|
|
80014
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80015
|
-
},
|
|
80016
|
-
_uint8clampedarray: function(arr) {
|
|
80017
|
-
write2("uint8clampedarray:");
|
|
80018
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80019
|
-
},
|
|
80020
|
-
_int8array: function(arr) {
|
|
80021
|
-
write2("int8array:");
|
|
80022
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80023
|
-
},
|
|
80024
|
-
_uint16array: function(arr) {
|
|
80025
|
-
write2("uint16array:");
|
|
80026
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80027
|
-
},
|
|
80028
|
-
_int16array: function(arr) {
|
|
80029
|
-
write2("int16array:");
|
|
80030
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80031
|
-
},
|
|
80032
|
-
_uint32array: function(arr) {
|
|
80033
|
-
write2("uint32array:");
|
|
80034
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80035
|
-
},
|
|
80036
|
-
_int32array: function(arr) {
|
|
80037
|
-
write2("int32array:");
|
|
80038
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80039
|
-
},
|
|
80040
|
-
_float32array: function(arr) {
|
|
80041
|
-
write2("float32array:");
|
|
80042
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80043
|
-
},
|
|
80044
|
-
_float64array: function(arr) {
|
|
80045
|
-
write2("float64array:");
|
|
80046
|
-
return this.dispatch(Array.prototype.slice.call(arr));
|
|
80047
|
-
},
|
|
80048
|
-
_arraybuffer: function(arr) {
|
|
80049
|
-
write2("arraybuffer:");
|
|
80050
|
-
return this.dispatch(new Uint8Array(arr));
|
|
80051
|
-
},
|
|
80052
|
-
_url: function(url4) {
|
|
80053
|
-
return write2("url:" + url4.toString(), "utf8");
|
|
80054
|
-
},
|
|
80055
|
-
_map: function(map2) {
|
|
80056
|
-
write2("map:");
|
|
80057
|
-
var arr = Array.from(map2);
|
|
80058
|
-
return this._array(arr, options.unorderedSets !== false);
|
|
80059
|
-
},
|
|
80060
|
-
_set: function(set2) {
|
|
80061
|
-
write2("set:");
|
|
80062
|
-
var arr = Array.from(set2);
|
|
80063
|
-
return this._array(arr, options.unorderedSets !== false);
|
|
80064
|
-
},
|
|
80065
|
-
_file: function(file2) {
|
|
80066
|
-
write2("file:");
|
|
80067
|
-
return this.dispatch([file2.name, file2.size, file2.type, file2.lastModfied]);
|
|
80068
|
-
},
|
|
80069
|
-
_blob: function() {
|
|
80070
|
-
if (options.ignoreUnknown) {
|
|
80071
|
-
return write2("[blob]");
|
|
80072
|
-
}
|
|
80073
|
-
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');
|
|
80074
|
-
},
|
|
80075
|
-
_domwindow: function() {
|
|
80076
|
-
return write2("domwindow");
|
|
80077
|
-
},
|
|
80078
|
-
_bigint: function(number6) {
|
|
80079
|
-
return write2("bigint:" + number6.toString());
|
|
80080
|
-
},
|
|
80081
|
-
/* Node.js standard native objects */
|
|
80082
|
-
_process: function() {
|
|
80083
|
-
return write2("process");
|
|
80084
|
-
},
|
|
80085
|
-
_timer: function() {
|
|
80086
|
-
return write2("timer");
|
|
80087
|
-
},
|
|
80088
|
-
_pipe: function() {
|
|
80089
|
-
return write2("pipe");
|
|
80090
|
-
},
|
|
80091
|
-
_tcp: function() {
|
|
80092
|
-
return write2("tcp");
|
|
80093
|
-
},
|
|
80094
|
-
_udp: function() {
|
|
80095
|
-
return write2("udp");
|
|
80096
|
-
},
|
|
80097
|
-
_tty: function() {
|
|
80098
|
-
return write2("tty");
|
|
80099
|
-
},
|
|
80100
|
-
_statwatcher: function() {
|
|
80101
|
-
return write2("statwatcher");
|
|
80102
|
-
},
|
|
80103
|
-
_securecontext: function() {
|
|
80104
|
-
return write2("securecontext");
|
|
80105
|
-
},
|
|
80106
|
-
_connection: function() {
|
|
80107
|
-
return write2("connection");
|
|
80108
|
-
},
|
|
80109
|
-
_zlib: function() {
|
|
80110
|
-
return write2("zlib");
|
|
80111
|
-
},
|
|
80112
|
-
_context: function() {
|
|
80113
|
-
return write2("context");
|
|
80114
|
-
},
|
|
80115
|
-
_nodescript: function() {
|
|
80116
|
-
return write2("nodescript");
|
|
80117
|
-
},
|
|
80118
|
-
_httpparser: function() {
|
|
80119
|
-
return write2("httpparser");
|
|
80120
|
-
},
|
|
80121
|
-
_dataview: function() {
|
|
80122
|
-
return write2("dataview");
|
|
80123
|
-
},
|
|
80124
|
-
_signal: function() {
|
|
80125
|
-
return write2("signal");
|
|
80126
|
-
},
|
|
80127
|
-
_fsevent: function() {
|
|
80128
|
-
return write2("fsevent");
|
|
80129
|
-
},
|
|
80130
|
-
_tlswrap: function() {
|
|
80131
|
-
return write2("tlswrap");
|
|
80132
|
-
}
|
|
80133
|
-
};
|
|
80134
|
-
}
|
|
80135
|
-
function PassThrough() {
|
|
80136
|
-
return {
|
|
80137
|
-
buf: "",
|
|
80138
|
-
write: function(b) {
|
|
80139
|
-
this.buf += b;
|
|
80140
|
-
},
|
|
80141
|
-
end: function(b) {
|
|
80142
|
-
this.buf += b;
|
|
80143
|
-
},
|
|
80144
|
-
read: function() {
|
|
80145
|
-
return this.buf;
|
|
80146
|
-
}
|
|
80147
|
-
};
|
|
80148
|
-
}
|
|
80149
|
-
}
|
|
80150
|
-
});
|
|
80151
|
-
|
|
80152
79774
|
// node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js
|
|
80153
79775
|
var require_light = __commonJS({
|
|
80154
79776
|
"node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js"(exports, module) {
|
|
@@ -107341,7 +106963,7 @@ var import_picocolors = __toESM(require_picocolors(), 1);
|
|
|
107341
106963
|
// package.json
|
|
107342
106964
|
var package_default = {
|
|
107343
106965
|
name: "pullfrog",
|
|
107344
|
-
version: "0.1.
|
|
106966
|
+
version: "0.1.95",
|
|
107345
106967
|
cliContractVersion: "1",
|
|
107346
106968
|
type: "module",
|
|
107347
106969
|
bin: {
|
|
@@ -107383,7 +107005,6 @@ var package_default = {
|
|
|
107383
107005
|
"@standard-schema/spec": "1.1.0",
|
|
107384
107006
|
"@toon-format/toon": "^1.0.0",
|
|
107385
107007
|
"@types/node": "^24.7.2",
|
|
107386
|
-
"@types/object-hash": "^3.0.6",
|
|
107387
107008
|
"@types/semver": "^7.7.1",
|
|
107388
107009
|
"@types/turndown": "^5.0.5",
|
|
107389
107010
|
"agent-browser": "0.25.4",
|
|
@@ -107397,8 +107018,6 @@ var package_default = {
|
|
|
107397
107018
|
fastmcp: "^3.34.0",
|
|
107398
107019
|
"file-type": "^21.3.0",
|
|
107399
107020
|
husky: "^9.0.0",
|
|
107400
|
-
"lru-cache": "^11.0.0",
|
|
107401
|
-
"object-hash": "^3.0.0",
|
|
107402
107021
|
"opencode-ai": "1.18.29",
|
|
107403
107022
|
"package-manager-detector": "^1.6.0",
|
|
107404
107023
|
picocolors: "^1.1.1",
|
|
@@ -107410,6 +107029,7 @@ var package_default = {
|
|
|
107410
107029
|
undici: "^7.22.0",
|
|
107411
107030
|
vitest: "^4.0.17",
|
|
107412
107031
|
yaml: "^2.8.2",
|
|
107032
|
+
yes: "0.1.0",
|
|
107413
107033
|
zod: "4.3.6"
|
|
107414
107034
|
},
|
|
107415
107035
|
repository: {
|
|
@@ -107443,12 +107063,6 @@ var package_default = {
|
|
|
107443
107063
|
import: "./dist/internal.js",
|
|
107444
107064
|
default: "./dist/internal.js"
|
|
107445
107065
|
},
|
|
107446
|
-
"./yes": {
|
|
107447
|
-
"@pullfrog/source": "./yes/index.ts",
|
|
107448
|
-
types: "./dist/yes/index.d.ts",
|
|
107449
|
-
import: "./dist/yes.js",
|
|
107450
|
-
default: "./dist/yes.js"
|
|
107451
|
-
},
|
|
107452
107066
|
"./package.json": "./package.json"
|
|
107453
107067
|
},
|
|
107454
107068
|
packageManager: "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a"
|
|
@@ -110075,6 +109689,17 @@ var providers = {
|
|
|
110075
109689
|
// see the big-pickle note above (#1077).
|
|
110076
109690
|
isFree: true
|
|
110077
109691
|
},
|
|
109692
|
+
// Zen's FREE stealth preview (listed 2026-10-01), the fifth promo. Zen
|
|
109693
|
+
// has not published its data terms yet, so the description claims none.
|
|
109694
|
+
"fledge-alpha": {
|
|
109695
|
+
displayName: "Fledge Alpha",
|
|
109696
|
+
description: "Stealth preview, free for a limited time",
|
|
109697
|
+
resolve: "opencode/fledge-alpha-free",
|
|
109698
|
+
effort: ["low", "high", "max"],
|
|
109699
|
+
// free to run, still gated on the provider's own OPENCODE_API_KEY —
|
|
109700
|
+
// see the big-pickle note above (#1077).
|
|
109701
|
+
isFree: true
|
|
109702
|
+
},
|
|
110078
109703
|
// Zen's live free MiMo, and the second free row in a menu that big-pickle
|
|
110079
109704
|
// was alone in since `mimo-v2-pro-free` lost its model.
|
|
110080
109705
|
mimo: {
|
|
@@ -112265,12 +111890,14 @@ The body has at most three parts, in this order:
|
|
|
112265
111890
|
|
|
112266
111891
|
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.
|
|
112267
111892
|
2. **Cross-cutting issue sections** (zero or more) \u2014 one \`### {emoji} {what's wrong, not what to do}\` heading per concern.
|
|
112268
|
-
3. **\`### \u2139\uFE0F Nitpicks\`** at the very bottom, if any \u2014 a flat bullet list, no technical-details block.
|
|
111893
|
+
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.
|
|
112269
111894
|
|
|
112270
111895
|
**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.
|
|
112271
111896
|
|
|
112272
111897
|
**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).
|
|
112273
111898
|
|
|
111899
|
+
**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.
|
|
111900
|
+
|
|
112274
111901
|
**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.
|
|
112275
111902
|
|
|
112276
111903
|
## Metadata comment
|
|
@@ -112443,9 +112070,9 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
|
|
|
112443
112070
|
|
|
112444
112071
|
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.
|
|
112445
112072
|
|
|
112446
|
-
**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?);
|
|
112073
|
+
**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.
|
|
112447
112074
|
|
|
112448
|
-
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.
|
|
112075
|
+
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.
|
|
112449
112076
|
|
|
112450
112077
|
7. **submit**: ALWAYS submit exactly one review via \`${t2("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.
|
|
112451
112078
|
|
|
@@ -112466,9 +112093,9 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
|
|
|
112466
112093
|
\`approved: false\`. Body opens with \`> [!CAUTION]\\n> This PR introduces ...\`, followed by the PR summary. Include all inline comments via \`comments\`.
|
|
112467
112094
|
- **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):
|
|
112468
112095
|
\`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\`.
|
|
112469
|
-
- **minor suggestions only** (
|
|
112096
|
+
- **minor suggestions only** (low-stakes findings, or Nitpicks only):
|
|
112470
112097
|
\`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.
|
|
112471
|
-
- **informational observations** (mergeable as-is, nothing actionable \u2014 e.g. prior feedback addressed cleanly,
|
|
112098
|
+
- **informational observations** (mergeable as-is, nothing actionable \u2014 e.g. prior feedback addressed cleanly, calling out something noteworthy without recommending a change):
|
|
112472
112099
|
\`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.
|
|
112473
112100
|
- **no actionable issues**:
|
|
112474
112101
|
\`approved: true\`. Body opens with \`> \u2705 No new issues found.\\n\\n\` followed by the PR summary.
|
|
@@ -112534,9 +112161,9 @@ ${PR_SUMMARY_FORMAT}`
|
|
|
112534
112161
|
|
|
112535
112162
|
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 \`${t2("list_pull_request_reviews")}\` in step 4) and run \`git diff <prior-review-sha>..HEAD\` to isolate the lines added since that review.
|
|
112536
112163
|
|
|
112537
|
-
**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?);
|
|
112164
|
+
**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.
|
|
112538
112165
|
|
|
112539
|
-
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.
|
|
112166
|
+
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.
|
|
112540
112167
|
|
|
112541
112168
|
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.
|
|
112542
112169
|
|
|
@@ -112549,8 +112176,8 @@ ${PR_SUMMARY_FORMAT}`
|
|
|
112549
112176
|
- IF NO NEW ISSUES, NON-SUBSTANTIVE CHANGES ONLY (trivial formatting, import reordering, comment tweaks): do NOT submit a review. Instead call \`${t2("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.
|
|
112550
112177
|
- ELSE IF NEW CRITICAL ISSUES (blocks merge \u2014 bugs, security, data loss, broken core flows): call \`${t2("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.
|
|
112551
112178
|
- 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 \`${t2("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.
|
|
112552
|
-
- ELSE IF NEW MINOR SUGGESTIONS ONLY (
|
|
112553
|
-
- ELSE IF INFORMATIONAL OBSERVATIONS (mergeable as-is, but worth surfacing \u2014 e.g. prior feedback addressed cleanly
|
|
112179
|
+
- ELSE IF NEW MINOR SUGGESTIONS ONLY (low-stakes findings, or Nitpicks only): call \`${t2("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.
|
|
112180
|
+
- ELSE IF INFORMATIONAL OBSERVATIONS (mergeable as-is, but worth surfacing \u2014 e.g. prior feedback addressed cleanly, or a noteworthy positive observation): call \`${t2("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.
|
|
112554
112181
|
- ELSE IF NO NEW ISSUES, SUBSTANTIVE CHANGES (new functionality, behavior changes, or fixes to prior review feedback): call \`${t2("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.
|
|
112555
112182
|
|
|
112556
112183
|
${PR_SUMMARY_FORMAT}`
|
|
@@ -113905,6 +113532,7 @@ function installCodexHome() {
|
|
|
113905
113532
|
return { codexHome, authPath, originalRefresh: body.tokens.refresh_token };
|
|
113906
113533
|
}
|
|
113907
113534
|
var dataHome;
|
|
113535
|
+
var unhostedSubscriptions = /* @__PURE__ */ new Set();
|
|
113908
113536
|
function canInstallSubscription(name) {
|
|
113909
113537
|
return name !== CODEX_AUTH_ENV && name !== XAI_AUTH_ENV || resolveDataHome() !== null;
|
|
113910
113538
|
}
|
|
@@ -113931,8 +113559,10 @@ function bootstrapPullfrogDataDir() {
|
|
|
113931
113559
|
log2.warning(
|
|
113932
113560
|
`\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.`
|
|
113933
113561
|
);
|
|
113934
|
-
|
|
113935
|
-
|
|
113562
|
+
for (const name of [CODEX_AUTH_ENV, XAI_AUTH_ENV]) {
|
|
113563
|
+
if (process.env[name]) unhostedSubscriptions.add(name);
|
|
113564
|
+
delete process.env[name];
|
|
113565
|
+
}
|
|
113936
113566
|
return null;
|
|
113937
113567
|
}
|
|
113938
113568
|
return PULLFROG_DATA_DIR;
|
|
@@ -137381,8 +137011,8 @@ var require_validate2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
137381
137011
|
}
|
|
137382
137012
|
}
|
|
137383
137013
|
function returnResults(it) {
|
|
137384
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
137385
|
-
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 ${
|
|
137014
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
137015
|
+
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})`));
|
|
137386
137016
|
else {
|
|
137387
137017
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
137388
137018
|
if (opts.unevaluated) assignEvaluated(it);
|
|
@@ -137664,14 +137294,14 @@ var require_validate2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
137664
137294
|
}));
|
|
137665
137295
|
var require_validation_error2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
137666
137296
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
137667
|
-
var
|
|
137297
|
+
var ValidationError2 = class extends Error {
|
|
137668
137298
|
constructor(errors) {
|
|
137669
137299
|
super("validation failed");
|
|
137670
137300
|
this.errors = errors;
|
|
137671
137301
|
this.ajv = this.validation = true;
|
|
137672
137302
|
}
|
|
137673
137303
|
};
|
|
137674
|
-
exports.default =
|
|
137304
|
+
exports.default = ValidationError2;
|
|
137675
137305
|
}));
|
|
137676
137306
|
var require_ref_error2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
137677
137307
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -138276,21 +137906,21 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138276
137906
|
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils6();
|
|
138277
137907
|
const { SCHEMES, getSchemeHandler } = require_schemes2();
|
|
138278
137908
|
function normalize3(uri, options) {
|
|
138279
|
-
if (typeof uri === "string") uri =
|
|
138280
|
-
else if (typeof uri === "object") uri = parse6(
|
|
137909
|
+
if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
|
|
137910
|
+
else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
|
|
138281
137911
|
return uri;
|
|
138282
137912
|
}
|
|
138283
137913
|
function resolve3(baseURI, relativeURI, options) {
|
|
138284
137914
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
138285
137915
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
138286
137916
|
schemelessOptions.skipEscape = true;
|
|
138287
|
-
return
|
|
137917
|
+
return serialize2(resolved, schemelessOptions);
|
|
138288
137918
|
}
|
|
138289
137919
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
138290
137920
|
const target = {};
|
|
138291
137921
|
if (!skipNormalization) {
|
|
138292
|
-
base = parse6(
|
|
138293
|
-
relative = parse6(
|
|
137922
|
+
base = parse6(serialize2(base, options), options);
|
|
137923
|
+
relative = parse6(serialize2(relative, options), options);
|
|
138294
137924
|
}
|
|
138295
137925
|
options = options || {};
|
|
138296
137926
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -138334,27 +137964,27 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138334
137964
|
function equal(uriA, uriB, options) {
|
|
138335
137965
|
if (typeof uriA === "string") {
|
|
138336
137966
|
uriA = unescape(uriA);
|
|
138337
|
-
uriA =
|
|
137967
|
+
uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
|
|
138338
137968
|
...options,
|
|
138339
137969
|
skipEscape: true
|
|
138340
137970
|
});
|
|
138341
|
-
} else if (typeof uriA === "object") uriA =
|
|
137971
|
+
} else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
|
|
138342
137972
|
...options,
|
|
138343
137973
|
skipEscape: true
|
|
138344
137974
|
});
|
|
138345
137975
|
if (typeof uriB === "string") {
|
|
138346
137976
|
uriB = unescape(uriB);
|
|
138347
|
-
uriB =
|
|
137977
|
+
uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
|
|
138348
137978
|
...options,
|
|
138349
137979
|
skipEscape: true
|
|
138350
137980
|
});
|
|
138351
|
-
} else if (typeof uriB === "object") uriB =
|
|
137981
|
+
} else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
|
|
138352
137982
|
...options,
|
|
138353
137983
|
skipEscape: true
|
|
138354
137984
|
});
|
|
138355
137985
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
138356
137986
|
}
|
|
138357
|
-
function
|
|
137987
|
+
function serialize2(cmpts, opts) {
|
|
138358
137988
|
const component = {
|
|
138359
137989
|
host: cmpts.host,
|
|
138360
137990
|
scheme: cmpts.scheme,
|
|
@@ -138457,7 +138087,7 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138457
138087
|
resolve: resolve3,
|
|
138458
138088
|
resolveComponent,
|
|
138459
138089
|
equal,
|
|
138460
|
-
serialize,
|
|
138090
|
+
serialize: serialize2,
|
|
138461
138091
|
parse: parse6
|
|
138462
138092
|
};
|
|
138463
138093
|
module.exports = fastUri;
|
|
@@ -138883,7 +138513,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
138883
138513
|
}
|
|
138884
138514
|
}
|
|
138885
138515
|
}
|
|
138886
|
-
_addSchema(schema2, meta3, baseId,
|
|
138516
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
138887
138517
|
let id;
|
|
138888
138518
|
const { schemaId } = this.opts;
|
|
138889
138519
|
if (typeof schema2 == "object") id = schema2[schemaId];
|
|
@@ -138905,7 +138535,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
138905
138535
|
if (baseId) this._checkUnique(baseId);
|
|
138906
138536
|
this.refs[baseId] = sch;
|
|
138907
138537
|
}
|
|
138908
|
-
if (
|
|
138538
|
+
if (validateSchema) this.validateSchema(schema2, true);
|
|
138909
138539
|
return sch;
|
|
138910
138540
|
}
|
|
138911
138541
|
_checkUnique(id) {
|
|
@@ -151666,8 +151296,8 @@ var require_validate3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
151666
151296
|
}
|
|
151667
151297
|
}
|
|
151668
151298
|
function returnResults(it) {
|
|
151669
|
-
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
151670
|
-
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 ${
|
|
151299
|
+
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
151300
|
+
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})`));
|
|
151671
151301
|
else {
|
|
151672
151302
|
gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
|
|
151673
151303
|
if (opts.unevaluated) assignEvaluated(it);
|
|
@@ -151949,14 +151579,14 @@ var require_validate3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
151949
151579
|
}));
|
|
151950
151580
|
var require_validation_error3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
151951
151581
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
151952
|
-
var
|
|
151582
|
+
var ValidationError2 = class extends Error {
|
|
151953
151583
|
constructor(errors) {
|
|
151954
151584
|
super("validation failed");
|
|
151955
151585
|
this.errors = errors;
|
|
151956
151586
|
this.ajv = this.validation = true;
|
|
151957
151587
|
}
|
|
151958
151588
|
};
|
|
151959
|
-
exports.default =
|
|
151589
|
+
exports.default = ValidationError2;
|
|
151960
151590
|
}));
|
|
151961
151591
|
var require_ref_error3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
151962
151592
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -152561,21 +152191,21 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
152561
152191
|
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils7();
|
|
152562
152192
|
const { SCHEMES, getSchemeHandler } = require_schemes3();
|
|
152563
152193
|
function normalize3(uri, options) {
|
|
152564
|
-
if (typeof uri === "string") uri =
|
|
152565
|
-
else if (typeof uri === "object") uri = parse6(
|
|
152194
|
+
if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
|
|
152195
|
+
else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
|
|
152566
152196
|
return uri;
|
|
152567
152197
|
}
|
|
152568
152198
|
function resolve3(baseURI, relativeURI, options) {
|
|
152569
152199
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
152570
152200
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
152571
152201
|
schemelessOptions.skipEscape = true;
|
|
152572
|
-
return
|
|
152202
|
+
return serialize2(resolved, schemelessOptions);
|
|
152573
152203
|
}
|
|
152574
152204
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
152575
152205
|
const target = {};
|
|
152576
152206
|
if (!skipNormalization) {
|
|
152577
|
-
base = parse6(
|
|
152578
|
-
relative = parse6(
|
|
152207
|
+
base = parse6(serialize2(base, options), options);
|
|
152208
|
+
relative = parse6(serialize2(relative, options), options);
|
|
152579
152209
|
}
|
|
152580
152210
|
options = options || {};
|
|
152581
152211
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -152619,27 +152249,27 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
152619
152249
|
function equal(uriA, uriB, options) {
|
|
152620
152250
|
if (typeof uriA === "string") {
|
|
152621
152251
|
uriA = unescape(uriA);
|
|
152622
|
-
uriA =
|
|
152252
|
+
uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
|
|
152623
152253
|
...options,
|
|
152624
152254
|
skipEscape: true
|
|
152625
152255
|
});
|
|
152626
|
-
} else if (typeof uriA === "object") uriA =
|
|
152256
|
+
} else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
|
|
152627
152257
|
...options,
|
|
152628
152258
|
skipEscape: true
|
|
152629
152259
|
});
|
|
152630
152260
|
if (typeof uriB === "string") {
|
|
152631
152261
|
uriB = unescape(uriB);
|
|
152632
|
-
uriB =
|
|
152262
|
+
uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
|
|
152633
152263
|
...options,
|
|
152634
152264
|
skipEscape: true
|
|
152635
152265
|
});
|
|
152636
|
-
} else if (typeof uriB === "object") uriB =
|
|
152266
|
+
} else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
|
|
152637
152267
|
...options,
|
|
152638
152268
|
skipEscape: true
|
|
152639
152269
|
});
|
|
152640
152270
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
152641
152271
|
}
|
|
152642
|
-
function
|
|
152272
|
+
function serialize2(cmpts, opts) {
|
|
152643
152273
|
const component = {
|
|
152644
152274
|
host: cmpts.host,
|
|
152645
152275
|
scheme: cmpts.scheme,
|
|
@@ -152742,7 +152372,7 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
152742
152372
|
resolve: resolve3,
|
|
152743
152373
|
resolveComponent,
|
|
152744
152374
|
equal,
|
|
152745
|
-
serialize,
|
|
152375
|
+
serialize: serialize2,
|
|
152746
152376
|
parse: parse6
|
|
152747
152377
|
};
|
|
152748
152378
|
module.exports = fastUri;
|
|
@@ -153168,7 +152798,7 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
153168
152798
|
}
|
|
153169
152799
|
}
|
|
153170
152800
|
}
|
|
153171
|
-
_addSchema(schema2, meta3, baseId,
|
|
152801
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
153172
152802
|
let id;
|
|
153173
152803
|
const { schemaId } = this.opts;
|
|
153174
152804
|
if (typeof schema2 == "object") id = schema2[schemaId];
|
|
@@ -153190,7 +152820,7 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
153190
152820
|
if (baseId) this._checkUnique(baseId);
|
|
153191
152821
|
this.refs[baseId] = sch;
|
|
153192
152822
|
}
|
|
153193
|
-
if (
|
|
152823
|
+
if (validateSchema) this.validateSchema(schema2, true);
|
|
153194
152824
|
return sch;
|
|
153195
152825
|
}
|
|
153196
152826
|
_checkUnique(id) {
|
|
@@ -178035,8 +177665,8 @@ var createNode = ({ id, kind, inner, meta: meta3, $: $2, ignoreCache }) => {
|
|
|
178035
177665
|
let innerJson = {};
|
|
178036
177666
|
for (const [k2, v] of innerEntries) {
|
|
178037
177667
|
const keyImpl = impl.keys[k2];
|
|
178038
|
-
const
|
|
178039
|
-
innerJson[k2] =
|
|
177668
|
+
const serialize2 = keyImpl.serialize ?? (keyImpl.child ? serializeListableChild : defaultValueSerializer);
|
|
177669
|
+
innerJson[k2] = serialize2(v);
|
|
178040
177670
|
if (keyImpl.child === true) {
|
|
178041
177671
|
const listableNode = v;
|
|
178042
177672
|
if (isArray(listableNode))
|
|
@@ -183585,6 +183215,1064 @@ var schema = ark.schema;
|
|
|
183585
183215
|
var define2 = ark.define;
|
|
183586
183216
|
var declare = ark.declare;
|
|
183587
183217
|
|
|
183218
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
|
|
183219
|
+
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
183220
|
+
|
|
183221
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/adapter.js
|
|
183222
|
+
var AdapterError = class extends Error {
|
|
183223
|
+
method;
|
|
183224
|
+
/** the full store key, or the op's prefix when the call covered many keys. never the raw input. */
|
|
183225
|
+
key;
|
|
183226
|
+
constructor(method, key, cause) {
|
|
183227
|
+
super(`cache ${method} failed for ${key}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
183228
|
+
this.name = "AdapterError";
|
|
183229
|
+
this.method = method;
|
|
183230
|
+
this.key = key;
|
|
183231
|
+
}
|
|
183232
|
+
};
|
|
183233
|
+
|
|
183234
|
+
// node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
183235
|
+
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
183236
|
+
var S = P("lru-cache:metrics");
|
|
183237
|
+
var W2 = G("lru-cache");
|
|
183238
|
+
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
183239
|
+
var R2 = () => S.hasSubscribers || W2.hasSubscribers;
|
|
183240
|
+
var U2 = /* @__PURE__ */ new Set();
|
|
183241
|
+
var M = typeof process == "object" && process ? process : {};
|
|
183242
|
+
var k = (d3, e, t2, i2) => {
|
|
183243
|
+
typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t2, i2) : console.error(`[${t2}] ${e}: ${d3}`);
|
|
183244
|
+
};
|
|
183245
|
+
var H = (d3) => !U2.has(d3);
|
|
183246
|
+
var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
|
|
183247
|
+
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;
|
|
183248
|
+
var O = class extends Array {
|
|
183249
|
+
constructor(e) {
|
|
183250
|
+
super(e), this.fill(0);
|
|
183251
|
+
}
|
|
183252
|
+
};
|
|
183253
|
+
var x = class d {
|
|
183254
|
+
heap;
|
|
183255
|
+
length;
|
|
183256
|
+
static #o = false;
|
|
183257
|
+
static create(e) {
|
|
183258
|
+
let t2 = j(e);
|
|
183259
|
+
if (!t2) return [];
|
|
183260
|
+
d.#o = true;
|
|
183261
|
+
let i2 = new d(e, t2);
|
|
183262
|
+
return d.#o = false, i2;
|
|
183263
|
+
}
|
|
183264
|
+
constructor(e, t2) {
|
|
183265
|
+
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
183266
|
+
this.heap = new t2(e), this.length = 0;
|
|
183267
|
+
}
|
|
183268
|
+
push(e) {
|
|
183269
|
+
this.heap[this.length++] = e;
|
|
183270
|
+
}
|
|
183271
|
+
pop() {
|
|
183272
|
+
return this.heap[--this.length];
|
|
183273
|
+
}
|
|
183274
|
+
};
|
|
183275
|
+
var I2 = class d2 {
|
|
183276
|
+
#o;
|
|
183277
|
+
#c;
|
|
183278
|
+
#S;
|
|
183279
|
+
#O;
|
|
183280
|
+
#w;
|
|
183281
|
+
#M;
|
|
183282
|
+
#I;
|
|
183283
|
+
#m;
|
|
183284
|
+
get perf() {
|
|
183285
|
+
return this.#m;
|
|
183286
|
+
}
|
|
183287
|
+
ttl;
|
|
183288
|
+
ttlResolution;
|
|
183289
|
+
ttlAutopurge;
|
|
183290
|
+
updateAgeOnGet;
|
|
183291
|
+
updateAgeOnHas;
|
|
183292
|
+
allowStale;
|
|
183293
|
+
noDisposeOnSet;
|
|
183294
|
+
noUpdateTTL;
|
|
183295
|
+
maxEntrySize;
|
|
183296
|
+
sizeCalculation;
|
|
183297
|
+
noDeleteOnFetchRejection;
|
|
183298
|
+
noDeleteOnStaleGet;
|
|
183299
|
+
allowStaleOnFetchAbort;
|
|
183300
|
+
allowStaleOnFetchRejection;
|
|
183301
|
+
ignoreFetchAbort;
|
|
183302
|
+
backgroundFetchSize;
|
|
183303
|
+
#n;
|
|
183304
|
+
#b;
|
|
183305
|
+
#s;
|
|
183306
|
+
#i;
|
|
183307
|
+
#t;
|
|
183308
|
+
#l;
|
|
183309
|
+
#u;
|
|
183310
|
+
#a;
|
|
183311
|
+
#h;
|
|
183312
|
+
#y;
|
|
183313
|
+
#r;
|
|
183314
|
+
#_;
|
|
183315
|
+
#F;
|
|
183316
|
+
#d;
|
|
183317
|
+
#g;
|
|
183318
|
+
#T;
|
|
183319
|
+
#U;
|
|
183320
|
+
#f;
|
|
183321
|
+
#D;
|
|
183322
|
+
static unsafeExposeInternals(e) {
|
|
183323
|
+
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() {
|
|
183324
|
+
return e.#a;
|
|
183325
|
+
}, get tail() {
|
|
183326
|
+
return e.#h;
|
|
183327
|
+
}, free: e.#y, isBackgroundFetch: (t2) => e.#e(t2), backgroundFetch: (t2, i2, s, n3) => e.#P(t2, i2, s, n3), moveToTail: (t2) => e.#L(t2), indexes: (t2) => e.#A(t2), rindexes: (t2) => e.#z(t2), isStale: (t2) => e.#p(t2) };
|
|
183328
|
+
}
|
|
183329
|
+
get max() {
|
|
183330
|
+
return this.#o;
|
|
183331
|
+
}
|
|
183332
|
+
get maxSize() {
|
|
183333
|
+
return this.#c;
|
|
183334
|
+
}
|
|
183335
|
+
get calculatedSize() {
|
|
183336
|
+
return this.#b;
|
|
183337
|
+
}
|
|
183338
|
+
get size() {
|
|
183339
|
+
return this.#n;
|
|
183340
|
+
}
|
|
183341
|
+
get fetchMethod() {
|
|
183342
|
+
return this.#M;
|
|
183343
|
+
}
|
|
183344
|
+
get memoMethod() {
|
|
183345
|
+
return this.#I;
|
|
183346
|
+
}
|
|
183347
|
+
get dispose() {
|
|
183348
|
+
return this.#S;
|
|
183349
|
+
}
|
|
183350
|
+
get onInsert() {
|
|
183351
|
+
return this.#O;
|
|
183352
|
+
}
|
|
183353
|
+
get disposeAfter() {
|
|
183354
|
+
return this.#w;
|
|
183355
|
+
}
|
|
183356
|
+
constructor(e) {
|
|
183357
|
+
let { max: t2 = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n3, updateAgeOnGet: o, updateAgeOnHas: l2, allowStale: h2, dispose: r2, onInsert: c2, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u4, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y2, fetchMethod: a2, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z2, backgroundFetchSize: C = 1, perf: E } = e;
|
|
183358
|
+
if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
183359
|
+
if (this.#m = E ?? L, t2 !== 0 && !T(t2)) throw new TypeError("max option must be a nonnegative integer");
|
|
183360
|
+
let v = t2 ? j(t2) : Array;
|
|
183361
|
+
if (!v) throw new Error("invalid max value: " + t2);
|
|
183362
|
+
if (this.#o = t2, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y2, this.sizeCalculation) {
|
|
183363
|
+
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
183364
|
+
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
183365
|
+
}
|
|
183366
|
+
if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
183367
|
+
if (this.#I = w, a2 !== void 0 && typeof a2 != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
183368
|
+
if (this.#M = a2, this.#U = !!a2, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t2 }).fill(void 0), this.#t = Array.from({ length: t2 }).fill(void 0), this.#l = new v(t2), this.#u = new v(t2), this.#a = 0, this.#h = 0, this.#y = x.create(t2), this.#n = 0, this.#b = 0, typeof r2 == "function" && (this.#S = r2), typeof c2 == "function" && (this.#O = c2), 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 = !!u4, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z2, this.maxEntrySize !== 0) {
|
|
183369
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
183370
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
183371
|
+
this.#X();
|
|
183372
|
+
}
|
|
183373
|
+
if (this.allowStale = !!h2, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l2, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n3, this.ttl = i2 || 0, this.ttl) {
|
|
183374
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
183375
|
+
this.#k();
|
|
183376
|
+
}
|
|
183377
|
+
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
183378
|
+
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
183379
|
+
let D = "LRU_CACHE_UNBOUNDED";
|
|
183380
|
+
H(D) && (U2.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
183381
|
+
}
|
|
183382
|
+
}
|
|
183383
|
+
getRemainingTTL(e) {
|
|
183384
|
+
return this.#s.has(e) ? 1 / 0 : 0;
|
|
183385
|
+
}
|
|
183386
|
+
#k() {
|
|
183387
|
+
let e = new O(this.#o), t2 = new O(this.#o);
|
|
183388
|
+
this.#d = e, this.#F = t2;
|
|
183389
|
+
let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
183390
|
+
this.#g = i2, this.#H = (h2, r2, c2 = this.#m.now()) => {
|
|
183391
|
+
t2[h2] = r2 !== 0 ? c2 : 0, e[h2] = r2, s(h2, r2);
|
|
183392
|
+
}, this.#R = (h2) => {
|
|
183393
|
+
t2[h2] = e[h2] !== 0 ? this.#m.now() : 0, s(h2, e[h2]);
|
|
183394
|
+
};
|
|
183395
|
+
let s = this.ttlAutopurge ? (h2, r2) => {
|
|
183396
|
+
if (i2?.[h2] && (clearTimeout(i2[h2]), i2[h2] = void 0), r2 && r2 !== 0 && i2) {
|
|
183397
|
+
let c2 = setTimeout(() => {
|
|
183398
|
+
this.#p(h2) ? (this.#E(this.#i[h2], "expire"), i2[h2] = void 0) : s(h2, l2(h2));
|
|
183399
|
+
}, r2 + 1);
|
|
183400
|
+
c2.unref && c2.unref(), i2[h2] = c2;
|
|
183401
|
+
}
|
|
183402
|
+
} : () => {
|
|
183403
|
+
};
|
|
183404
|
+
this.#v = (h2, r2) => {
|
|
183405
|
+
if (e[r2]) {
|
|
183406
|
+
let c2 = e[r2], m = t2[r2];
|
|
183407
|
+
if (!c2 || !m) return;
|
|
183408
|
+
h2.ttl = c2, h2.start = m, h2.now = n3 || o();
|
|
183409
|
+
let _ = h2.now - m;
|
|
183410
|
+
h2.remainingTTL = c2 - _;
|
|
183411
|
+
}
|
|
183412
|
+
};
|
|
183413
|
+
let n3 = 0, o = () => {
|
|
183414
|
+
let h2 = this.#m.now();
|
|
183415
|
+
if (this.ttlResolution > 0) {
|
|
183416
|
+
n3 = h2;
|
|
183417
|
+
let r2 = setTimeout(() => n3 = 0, this.ttlResolution);
|
|
183418
|
+
r2.unref && r2.unref();
|
|
183419
|
+
}
|
|
183420
|
+
return h2;
|
|
183421
|
+
};
|
|
183422
|
+
this.getRemainingTTL = (h2) => {
|
|
183423
|
+
let r2 = this.#s.get(h2);
|
|
183424
|
+
return r2 === void 0 ? 0 : l2(r2);
|
|
183425
|
+
};
|
|
183426
|
+
let l2 = (h2) => {
|
|
183427
|
+
let r2 = e[h2], c2 = t2[h2];
|
|
183428
|
+
if (!r2 || !c2) return 1 / 0;
|
|
183429
|
+
let m = (n3 || o()) - c2;
|
|
183430
|
+
return r2 - m;
|
|
183431
|
+
};
|
|
183432
|
+
this.#p = (h2) => {
|
|
183433
|
+
let r2 = t2[h2], c2 = e[h2];
|
|
183434
|
+
return !!c2 && !!r2 && (n3 || o()) - r2 > c2;
|
|
183435
|
+
};
|
|
183436
|
+
}
|
|
183437
|
+
#R = () => {
|
|
183438
|
+
};
|
|
183439
|
+
#v = () => {
|
|
183440
|
+
};
|
|
183441
|
+
#H = () => {
|
|
183442
|
+
};
|
|
183443
|
+
#p = () => false;
|
|
183444
|
+
#X() {
|
|
183445
|
+
let e = new O(this.#o);
|
|
183446
|
+
this.#b = 0, this.#_ = e, this.#x = (t2) => {
|
|
183447
|
+
this.#b -= e[t2], e[t2] = 0;
|
|
183448
|
+
}, this.#N = (t2, i2, s, n3) => {
|
|
183449
|
+
if (!T(s)) {
|
|
183450
|
+
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
183451
|
+
if (n3) {
|
|
183452
|
+
if (typeof n3 != "function") throw new TypeError("sizeCalculation must be a function");
|
|
183453
|
+
if (s = n3(i2, t2), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
183454
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
183455
|
+
}
|
|
183456
|
+
return s;
|
|
183457
|
+
}, this.#j = (t2, i2, s) => {
|
|
183458
|
+
if (e[t2] = i2, this.#c) {
|
|
183459
|
+
let n3 = this.#c - e[t2];
|
|
183460
|
+
for (; this.#b > n3; ) this.#G(true);
|
|
183461
|
+
}
|
|
183462
|
+
this.#b += e[t2], s && (s.entrySize = i2, s.totalCalculatedSize = this.#b);
|
|
183463
|
+
};
|
|
183464
|
+
}
|
|
183465
|
+
#x = (e) => {
|
|
183466
|
+
};
|
|
183467
|
+
#j = (e, t2, i2) => {
|
|
183468
|
+
};
|
|
183469
|
+
#N = (e, t2, i2, s) => {
|
|
183470
|
+
if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
183471
|
+
return 0;
|
|
183472
|
+
};
|
|
183473
|
+
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
183474
|
+
if (this.#n) for (let t2 = this.#h; this.#V(t2) && ((e || !this.#p(t2)) && (yield t2), t2 !== this.#a); ) t2 = this.#u[t2];
|
|
183475
|
+
}
|
|
183476
|
+
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
183477
|
+
if (this.#n) for (let t2 = this.#a; this.#V(t2) && ((e || !this.#p(t2)) && (yield t2), t2 !== this.#h); ) t2 = this.#l[t2];
|
|
183478
|
+
}
|
|
183479
|
+
#V(e) {
|
|
183480
|
+
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
183481
|
+
}
|
|
183482
|
+
*entries() {
|
|
183483
|
+
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]]);
|
|
183484
|
+
}
|
|
183485
|
+
*rentries() {
|
|
183486
|
+
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]]);
|
|
183487
|
+
}
|
|
183488
|
+
*keys() {
|
|
183489
|
+
for (let e of this.#A()) {
|
|
183490
|
+
let t2 = this.#i[e];
|
|
183491
|
+
t2 !== void 0 && !this.#e(this.#t[e]) && (yield t2);
|
|
183492
|
+
}
|
|
183493
|
+
}
|
|
183494
|
+
*rkeys() {
|
|
183495
|
+
for (let e of this.#z()) {
|
|
183496
|
+
let t2 = this.#i[e];
|
|
183497
|
+
t2 !== void 0 && !this.#e(this.#t[e]) && (yield t2);
|
|
183498
|
+
}
|
|
183499
|
+
}
|
|
183500
|
+
*values() {
|
|
183501
|
+
for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
183502
|
+
}
|
|
183503
|
+
*rvalues() {
|
|
183504
|
+
for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
183505
|
+
}
|
|
183506
|
+
[Symbol.iterator]() {
|
|
183507
|
+
return this.entries();
|
|
183508
|
+
}
|
|
183509
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
183510
|
+
find(e, t2 = {}) {
|
|
183511
|
+
for (let i2 of this.#A()) {
|
|
183512
|
+
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
183513
|
+
if (n3 !== void 0 && e(n3, this.#i[i2], this)) return this.#C(this.#i[i2], t2);
|
|
183514
|
+
}
|
|
183515
|
+
}
|
|
183516
|
+
forEach(e, t2 = this) {
|
|
183517
|
+
for (let i2 of this.#A()) {
|
|
183518
|
+
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
183519
|
+
n3 !== void 0 && e.call(t2, n3, this.#i[i2], this);
|
|
183520
|
+
}
|
|
183521
|
+
}
|
|
183522
|
+
rforEach(e, t2 = this) {
|
|
183523
|
+
for (let i2 of this.#z()) {
|
|
183524
|
+
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
183525
|
+
n3 !== void 0 && e.call(t2, n3, this.#i[i2], this);
|
|
183526
|
+
}
|
|
183527
|
+
}
|
|
183528
|
+
purgeStale() {
|
|
183529
|
+
let e = false;
|
|
183530
|
+
for (let t2 of this.#z({ allowStale: true })) this.#p(t2) && (this.#E(this.#i[t2], "expire"), e = true);
|
|
183531
|
+
return e;
|
|
183532
|
+
}
|
|
183533
|
+
info(e) {
|
|
183534
|
+
let t2 = this.#s.get(e);
|
|
183535
|
+
if (t2 === void 0) return;
|
|
183536
|
+
let i2 = this.#t[t2], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
|
|
183537
|
+
if (s === void 0) return;
|
|
183538
|
+
let n3 = { value: s };
|
|
183539
|
+
if (this.#d && this.#F) {
|
|
183540
|
+
let o = this.#d[t2], l2 = this.#F[t2];
|
|
183541
|
+
if (o && l2) {
|
|
183542
|
+
let h2 = o - (this.#m.now() - l2);
|
|
183543
|
+
n3.ttl = h2, n3.start = Date.now();
|
|
183544
|
+
}
|
|
183545
|
+
}
|
|
183546
|
+
return this.#_ && (n3.size = this.#_[t2]), n3;
|
|
183547
|
+
}
|
|
183548
|
+
dump() {
|
|
183549
|
+
let e = [];
|
|
183550
|
+
for (let t2 of this.#A({ allowStale: true })) {
|
|
183551
|
+
let i2 = this.#i[t2], s = this.#t[t2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
183552
|
+
if (n3 === void 0 || i2 === void 0) continue;
|
|
183553
|
+
let o = { value: n3 };
|
|
183554
|
+
if (this.#d && this.#F) {
|
|
183555
|
+
o.ttl = this.#d[t2];
|
|
183556
|
+
let l2 = this.#m.now() - this.#F[t2];
|
|
183557
|
+
o.start = Math.floor(Date.now() - l2);
|
|
183558
|
+
}
|
|
183559
|
+
this.#_ && (o.size = this.#_[t2]), e.unshift([i2, o]);
|
|
183560
|
+
}
|
|
183561
|
+
return e;
|
|
183562
|
+
}
|
|
183563
|
+
load(e) {
|
|
183564
|
+
this.clear();
|
|
183565
|
+
for (let [t2, i2] of e) {
|
|
183566
|
+
if (i2.start) {
|
|
183567
|
+
let s = Date.now() - i2.start;
|
|
183568
|
+
i2.start = this.#m.now() - s;
|
|
183569
|
+
}
|
|
183570
|
+
this.#W(t2, i2.value, i2);
|
|
183571
|
+
}
|
|
183572
|
+
}
|
|
183573
|
+
set(e, t2, i2 = {}) {
|
|
183574
|
+
let { status: s = S.hasSubscribers ? {} : void 0 } = i2;
|
|
183575
|
+
i2.status = s, s && (s.op = "set", s.key = e, t2 !== void 0 && (s.value = t2), s.cache = this);
|
|
183576
|
+
let n3 = this.#W(e, t2, i2);
|
|
183577
|
+
return s && S.hasSubscribers && S.publish(s), n3;
|
|
183578
|
+
}
|
|
183579
|
+
#W(e, t2, i2, s) {
|
|
183580
|
+
let { ttl: n3 = this.ttl, start: o, noDisposeOnSet: l2 = this.noDisposeOnSet, sizeCalculation: h2 = this.sizeCalculation, status: r2 } = i2, c2 = this.#e(t2);
|
|
183581
|
+
if (t2 === void 0) return r2 && (r2.set = "deleted"), this.delete(e), this;
|
|
183582
|
+
let { noUpdateTTL: m = this.noUpdateTTL } = i2;
|
|
183583
|
+
r2 && !c2 && (r2.value = t2);
|
|
183584
|
+
let _ = this.#N(e, t2, i2.size || 0, h2, r2);
|
|
183585
|
+
if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r2 && (r2.set = "miss", r2.maxEntrySizeExceeded = true), this;
|
|
183586
|
+
let u4 = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
183587
|
+
if (u4 === void 0) u4 = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u4] = e, this.#t[u4] = t2, this.#s.set(e, u4), this.#l[this.#h] = u4, this.#u[u4] = this.#h, this.#h = u4, this.#n++, this.#j(u4, _, r2), r2 && (r2.set = "add"), m = false, this.#D && !c2 && this.#O?.(t2, e, "add");
|
|
183588
|
+
else {
|
|
183589
|
+
this.#L(u4);
|
|
183590
|
+
let g = this.#t[u4];
|
|
183591
|
+
if (t2 !== g) {
|
|
183592
|
+
if (!l2) if (this.#e(g)) {
|
|
183593
|
+
g !== s && g.__abortController.abort(new Error("replaced"));
|
|
183594
|
+
let { __staleWhileFetching: f } = g;
|
|
183595
|
+
f !== void 0 && f !== t2 && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
183596
|
+
} else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
|
|
183597
|
+
if (this.#x(u4), this.#j(u4, _, r2), this.#t[u4] = t2, !c2) {
|
|
183598
|
+
let f = g && this.#e(g) ? g.__staleWhileFetching : g, y2 = f === void 0 ? "add" : t2 !== f ? "replace" : "update";
|
|
183599
|
+
r2 && (r2.set = y2, f !== void 0 && (r2.oldValue = f)), this.#D && this.onInsert?.(t2, e, y2);
|
|
183600
|
+
}
|
|
183601
|
+
} else c2 || (r2 && (r2.set = "update"), this.#D && this.onInsert?.(t2, e, "update"));
|
|
183602
|
+
}
|
|
183603
|
+
if (n3 !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u4, n3, o), r2 && this.#v(r2, u4)), !l2 && this.#f && this.#r) {
|
|
183604
|
+
let g = this.#r, f;
|
|
183605
|
+
for (; f = g?.shift(); ) this.#w?.(...f);
|
|
183606
|
+
}
|
|
183607
|
+
return this;
|
|
183608
|
+
}
|
|
183609
|
+
pop() {
|
|
183610
|
+
try {
|
|
183611
|
+
for (; this.#n; ) {
|
|
183612
|
+
let e = this.#t[this.#a];
|
|
183613
|
+
if (this.#G(true), this.#e(e)) {
|
|
183614
|
+
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
183615
|
+
} else if (e !== void 0) return e;
|
|
183616
|
+
}
|
|
183617
|
+
} finally {
|
|
183618
|
+
if (this.#f && this.#r) {
|
|
183619
|
+
let e = this.#r, t2;
|
|
183620
|
+
for (; t2 = e?.shift(); ) this.#w?.(...t2);
|
|
183621
|
+
}
|
|
183622
|
+
}
|
|
183623
|
+
}
|
|
183624
|
+
#G(e) {
|
|
183625
|
+
let t2 = this.#a, i2 = this.#i[t2], s = this.#t[t2], n3 = this.#e(s);
|
|
183626
|
+
n3 && s.__abortController.abort(new Error("evicted"));
|
|
183627
|
+
let o = n3 ? s.__staleWhileFetching : s;
|
|
183628
|
+
return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i2, "evict"), this.#f && this.#r?.push([o, i2, "evict"])), this.#x(t2), this.#g?.[t2] && (clearTimeout(this.#g[t2]), this.#g[t2] = void 0), e && (this.#i[t2] = void 0, this.#t[t2] = void 0, this.#y.push(t2)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t2], this.#s.delete(i2), this.#n--, t2;
|
|
183629
|
+
}
|
|
183630
|
+
has(e, t2 = {}) {
|
|
183631
|
+
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
183632
|
+
t2.status = i2, i2 && (i2.op = "has", i2.key = e, i2.cache = this);
|
|
183633
|
+
let s = this.#Y(e, t2);
|
|
183634
|
+
return S.hasSubscribers && S.publish(i2), s;
|
|
183635
|
+
}
|
|
183636
|
+
#Y(e, t2 = {}) {
|
|
183637
|
+
let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = t2, n3 = this.#s.get(e);
|
|
183638
|
+
if (n3 !== void 0) {
|
|
183639
|
+
let o = this.#t[n3];
|
|
183640
|
+
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
183641
|
+
if (this.#p(n3)) s && (s.has = "stale", this.#v(s, n3));
|
|
183642
|
+
else return i2 && this.#R(n3), s && (s.has = "hit", this.#v(s, n3)), true;
|
|
183643
|
+
} else s && (s.has = "miss");
|
|
183644
|
+
return false;
|
|
183645
|
+
}
|
|
183646
|
+
peek(e, t2 = {}) {
|
|
183647
|
+
let { status: i2 = R2() ? {} : void 0 } = t2;
|
|
183648
|
+
i2 && (i2.op = "peek", i2.key = e, i2.cache = this), t2.status = i2;
|
|
183649
|
+
let s = this.#J(e, t2);
|
|
183650
|
+
return S.hasSubscribers && S.publish(i2), s;
|
|
183651
|
+
}
|
|
183652
|
+
#J(e, t2) {
|
|
183653
|
+
let { status: i2, allowStale: s = this.allowStale } = t2, n3 = this.#s.get(e);
|
|
183654
|
+
if (n3 === void 0 || !s && this.#p(n3)) {
|
|
183655
|
+
i2 && (i2.peek = n3 === void 0 ? "miss" : "stale");
|
|
183656
|
+
return;
|
|
183657
|
+
}
|
|
183658
|
+
let o = this.#t[n3], l2 = this.#e(o) ? o.__staleWhileFetching : o;
|
|
183659
|
+
return i2 && (l2 !== void 0 ? (i2.peek = "hit", i2.value = l2) : i2.peek = "miss"), l2;
|
|
183660
|
+
}
|
|
183661
|
+
#P(e, t2, i2, s) {
|
|
183662
|
+
let n3 = t2 === void 0 ? void 0 : this.#t[t2];
|
|
183663
|
+
if (this.#e(n3)) return n3;
|
|
183664
|
+
let o = new AbortController(), { signal: l2 } = i2;
|
|
183665
|
+
l2?.addEventListener("abort", () => o.abort(l2.reason), { signal: o.signal });
|
|
183666
|
+
let h2 = { signal: o.signal, options: i2, context: s }, r2 = (f, y2 = false) => {
|
|
183667
|
+
let { aborted: a2 } = o.signal, w = i2.ignoreFetchAbort && f !== void 0, F = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
|
|
183668
|
+
if (i2.status && (a2 && !y2 ? (i2.status.fetchAborted = true, i2.status.fetchError = o.signal.reason, w && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), a2 && !w && !y2) return m(o.signal.reason, F);
|
|
183669
|
+
let b = u4, p = this.#t[t2];
|
|
183670
|
+
return (p === u4 || p === void 0 && w && y2) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t2] = b.__staleWhileFetching : this.#E(e, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.#W(e, f, h2.options, b))), f;
|
|
183671
|
+
}, c2 = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), m(f, false)), m = (f, y2) => {
|
|
183672
|
+
let { aborted: a2 } = o.signal, w = a2 && i2.allowStaleOnFetchAbort, F = w || i2.allowStaleOnFetchRejection, b = F || i2.noDeleteOnFetchRejection, p = u4;
|
|
183673
|
+
if (this.#t[t2] === u4 && (!b || !y2 && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t2] = p.__staleWhileFetching)), F) return i2.status && p.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), p.__staleWhileFetching;
|
|
183674
|
+
if (p.__returned === p) throw f;
|
|
183675
|
+
}, _ = (f, y2) => {
|
|
183676
|
+
let a2 = this.#M?.(e, n3, h2);
|
|
183677
|
+
o.signal.addEventListener("abort", () => {
|
|
183678
|
+
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (w) => r2(w, true)));
|
|
183679
|
+
}), a2 && a2 instanceof Promise ? a2.then((w) => f(w === void 0 ? void 0 : w), y2) : a2 !== void 0 && f(a2);
|
|
183680
|
+
};
|
|
183681
|
+
i2.status && (i2.status.fetchDispatched = true);
|
|
183682
|
+
let u4 = new Promise(_).then(r2, c2), g = Object.assign(u4, { __abortController: o, __staleWhileFetching: n3, __returned: void 0 });
|
|
183683
|
+
return t2 === void 0 ? (this.#W(e, g, { ...h2.options, status: void 0 }), t2 = this.#s.get(e)) : this.#t[t2] = g, g;
|
|
183684
|
+
}
|
|
183685
|
+
#e(e) {
|
|
183686
|
+
if (!this.#U) return false;
|
|
183687
|
+
let t2 = e;
|
|
183688
|
+
return !!t2 && t2 instanceof Promise && t2.hasOwnProperty("__staleWhileFetching") && t2.__abortController instanceof AbortController;
|
|
183689
|
+
}
|
|
183690
|
+
fetch(e, t2 = {}) {
|
|
183691
|
+
let i2 = W2.hasSubscribers, { status: s = R2() ? {} : void 0 } = t2;
|
|
183692
|
+
t2.status = s, s && t2.context && (s.context = t2.context);
|
|
183693
|
+
let n3 = this.#B(e, t2);
|
|
183694
|
+
return s && i2 && (s.trace = true, W2.tracePromise(() => n3, s).catch(() => {
|
|
183695
|
+
})), n3;
|
|
183696
|
+
}
|
|
183697
|
+
async #B(e, t2 = {}) {
|
|
183698
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n3 = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l2 = this.noDisposeOnSet, size: h2 = 0, sizeCalculation: r2 = this.sizeCalculation, noUpdateTTL: c2 = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u4 = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y2 = false, status: a2, signal: w } = t2;
|
|
183699
|
+
if (a2 && (a2.op = "fetch", a2.key = e, y2 && (a2.forceRefresh = true), a2.cache = this), !this.#U) return a2 && (a2.fetch = "get"), this.#C(e, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n3, status: a2 });
|
|
183700
|
+
let F = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n3, ttl: o, noDisposeOnSet: l2, size: h2, sizeCalculation: r2, noUpdateTTL: c2, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u4, status: a2, signal: w }, b = this.#s.get(e);
|
|
183701
|
+
if (b === void 0) {
|
|
183702
|
+
a2 && (a2.fetch = "miss");
|
|
183703
|
+
let p = this.#P(e, b, F, f);
|
|
183704
|
+
return p.__returned = p;
|
|
183705
|
+
} else {
|
|
183706
|
+
let p = this.#t[b];
|
|
183707
|
+
if (this.#e(p)) {
|
|
183708
|
+
let v = i2 && p.__staleWhileFetching !== void 0;
|
|
183709
|
+
return a2 && (a2.fetch = "inflight", v && (a2.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
|
|
183710
|
+
}
|
|
183711
|
+
let A = this.#p(b);
|
|
183712
|
+
if (!y2 && !A) return a2 && (a2.fetch = "hit"), this.#L(b), s && this.#R(b), a2 && this.#v(a2, b), p;
|
|
183713
|
+
let z2 = this.#P(e, b, F, f), E = z2.__staleWhileFetching !== void 0 && i2;
|
|
183714
|
+
return a2 && (a2.fetch = A ? "stale" : "refresh", E && A && (a2.returnedStale = true)), E ? z2.__staleWhileFetching : z2.__returned = z2;
|
|
183715
|
+
}
|
|
183716
|
+
}
|
|
183717
|
+
forceFetch(e, t2 = {}) {
|
|
183718
|
+
let i2 = W2.hasSubscribers, { status: s = R2() ? {} : void 0 } = t2;
|
|
183719
|
+
t2.status = s, s && t2.context && (s.context = t2.context);
|
|
183720
|
+
let n3 = this.#K(e, t2);
|
|
183721
|
+
return s && i2 && (s.trace = true, W2.tracePromise(() => n3, s).catch(() => {
|
|
183722
|
+
})), n3;
|
|
183723
|
+
}
|
|
183724
|
+
async #K(e, t2 = {}) {
|
|
183725
|
+
let i2 = await this.#B(e, t2);
|
|
183726
|
+
if (i2 === void 0) throw new Error("fetch() returned undefined");
|
|
183727
|
+
return i2;
|
|
183728
|
+
}
|
|
183729
|
+
memo(e, t2 = {}) {
|
|
183730
|
+
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
183731
|
+
t2.status = i2, i2 && (i2.op = "memo", i2.key = e, t2.context && (i2.context = t2.context), i2.cache = this);
|
|
183732
|
+
let s = this.#Q(e, t2);
|
|
183733
|
+
return i2 && (i2.value = s), S.hasSubscribers && S.publish(i2), s;
|
|
183734
|
+
}
|
|
183735
|
+
#Q(e, t2 = {}) {
|
|
183736
|
+
let i2 = this.#I;
|
|
183737
|
+
if (!i2) throw new Error("no memoMethod provided to constructor");
|
|
183738
|
+
let { context: s, status: n3, forceRefresh: o, ...l2 } = t2;
|
|
183739
|
+
n3 && o && (n3.forceRefresh = true);
|
|
183740
|
+
let h2 = this.#C(e, l2), r2 = o || h2 === void 0;
|
|
183741
|
+
if (n3 && (n3.memo = r2 ? "miss" : "hit", r2 || (n3.value = h2)), !r2) return h2;
|
|
183742
|
+
let c2 = i2(e, h2, { options: l2, context: s });
|
|
183743
|
+
return n3 && (n3.value = c2), this.#W(e, c2, l2), c2;
|
|
183744
|
+
}
|
|
183745
|
+
get(e, t2 = {}) {
|
|
183746
|
+
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
183747
|
+
t2.status = i2, i2 && (i2.op = "get", i2.key = e, i2.cache = this);
|
|
183748
|
+
let s = this.#C(e, t2);
|
|
183749
|
+
return i2 && (s !== void 0 && (i2.value = s), S.hasSubscribers && S.publish(i2)), s;
|
|
183750
|
+
}
|
|
183751
|
+
#C(e, t2 = {}) {
|
|
183752
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n3 = this.noDeleteOnStaleGet, status: o } = t2, l2 = this.#s.get(e);
|
|
183753
|
+
if (l2 === void 0) {
|
|
183754
|
+
o && (o.get = "miss");
|
|
183755
|
+
return;
|
|
183756
|
+
}
|
|
183757
|
+
let h2 = this.#t[l2], r2 = this.#e(h2);
|
|
183758
|
+
return o && this.#v(o, l2), this.#p(l2) ? r2 ? (o && (o.get = "stale-fetching"), i2 && h2.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h2.__staleWhileFetching) : void 0) : (n3 || this.#E(e, "expire"), o && (o.get = "stale"), i2 ? (o && (o.returnedStale = true), h2) : void 0) : (o && (o.get = r2 ? "fetching" : "hit"), this.#L(l2), s && this.#R(l2), r2 ? h2.__staleWhileFetching : h2);
|
|
183759
|
+
}
|
|
183760
|
+
#$(e, t2) {
|
|
183761
|
+
this.#u[t2] = e, this.#l[e] = t2;
|
|
183762
|
+
}
|
|
183763
|
+
#L(e) {
|
|
183764
|
+
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);
|
|
183765
|
+
}
|
|
183766
|
+
delete(e) {
|
|
183767
|
+
return this.#E(e, "delete");
|
|
183768
|
+
}
|
|
183769
|
+
#E(e, t2) {
|
|
183770
|
+
S.hasSubscribers && S.publish({ op: "delete", delete: t2, key: e, cache: this });
|
|
183771
|
+
let i2 = false;
|
|
183772
|
+
if (this.#n !== 0) {
|
|
183773
|
+
let s = this.#s.get(e);
|
|
183774
|
+
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i2 = true, this.#n === 1) this.#q(t2);
|
|
183775
|
+
else {
|
|
183776
|
+
this.#x(s);
|
|
183777
|
+
let n3 = this.#t[s];
|
|
183778
|
+
if (this.#e(n3) ? n3.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n3, e, t2), this.#f && this.#r?.push([n3, e, t2])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
183779
|
+
else if (s === this.#a) this.#a = this.#l[s];
|
|
183780
|
+
else {
|
|
183781
|
+
let o = this.#u[s];
|
|
183782
|
+
this.#l[o] = this.#l[s];
|
|
183783
|
+
let l2 = this.#l[s];
|
|
183784
|
+
this.#u[l2] = this.#u[s];
|
|
183785
|
+
}
|
|
183786
|
+
this.#n--, this.#y.push(s);
|
|
183787
|
+
}
|
|
183788
|
+
}
|
|
183789
|
+
if (this.#f && this.#r?.length) {
|
|
183790
|
+
let s = this.#r, n3;
|
|
183791
|
+
for (; n3 = s?.shift(); ) this.#w?.(...n3);
|
|
183792
|
+
}
|
|
183793
|
+
return i2;
|
|
183794
|
+
}
|
|
183795
|
+
clear() {
|
|
183796
|
+
return this.#q("delete");
|
|
183797
|
+
}
|
|
183798
|
+
#q(e) {
|
|
183799
|
+
for (let t2 of this.#z({ allowStale: true })) {
|
|
183800
|
+
let i2 = this.#t[t2];
|
|
183801
|
+
if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
|
|
183802
|
+
else {
|
|
183803
|
+
let s = this.#i[t2];
|
|
183804
|
+
this.#T && this.#S?.(i2, s, e), this.#f && this.#r?.push([i2, s, e]);
|
|
183805
|
+
}
|
|
183806
|
+
}
|
|
183807
|
+
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
183808
|
+
this.#d.fill(0), this.#F.fill(0);
|
|
183809
|
+
for (let t2 of this.#g ?? []) t2 !== void 0 && clearTimeout(t2);
|
|
183810
|
+
this.#g?.fill(void 0);
|
|
183811
|
+
}
|
|
183812
|
+
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) {
|
|
183813
|
+
let t2 = this.#r, i2;
|
|
183814
|
+
for (; i2 = t2?.shift(); ) this.#w?.(...i2);
|
|
183815
|
+
}
|
|
183816
|
+
}
|
|
183817
|
+
};
|
|
183818
|
+
|
|
183819
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/memory.js
|
|
183820
|
+
function memory(options = {}) {
|
|
183821
|
+
const store = new I2({ max: options.maxItems ?? 1e3 });
|
|
183822
|
+
return {
|
|
183823
|
+
get: (key) => store.get(key),
|
|
183824
|
+
peek: (key) => store.peek(key),
|
|
183825
|
+
// the TTL rides on each entry rather than the whole cache, so ops with
|
|
183826
|
+
// different lifetimes can share one store
|
|
183827
|
+
set: (key, entry, ttlMs) => {
|
|
183828
|
+
store.set(key, entry, { ttl: ttlMs });
|
|
183829
|
+
},
|
|
183830
|
+
delete: (keys) => {
|
|
183831
|
+
for (const key of keys)
|
|
183832
|
+
store.delete(key);
|
|
183833
|
+
},
|
|
183834
|
+
// a snapshot, so deleting while iterating is safe. lru-cache skips expired
|
|
183835
|
+
// entries itself.
|
|
183836
|
+
list: (prefix) => [...store.entries()].filter(([key]) => key.startsWith(prefix))
|
|
183837
|
+
};
|
|
183838
|
+
}
|
|
183839
|
+
|
|
183840
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/key.js
|
|
183841
|
+
import { hash as hash2 } from "node:crypto";
|
|
183842
|
+
function hashKey(value2) {
|
|
183843
|
+
return hash2("sha1", serialize(value2, 0));
|
|
183844
|
+
}
|
|
183845
|
+
var MAX_DEPTH = 64;
|
|
183846
|
+
function serialize(value2, depth) {
|
|
183847
|
+
switch (typeof value2) {
|
|
183848
|
+
case "string":
|
|
183849
|
+
return JSON.stringify(value2);
|
|
183850
|
+
case "number":
|
|
183851
|
+
if (!Number.isFinite(value2))
|
|
183852
|
+
throw new Error(`${value2} cannot be part of a cache key`);
|
|
183853
|
+
return String(value2);
|
|
183854
|
+
case "boolean":
|
|
183855
|
+
return value2 ? "true" : "false";
|
|
183856
|
+
case "undefined":
|
|
183857
|
+
throw new Error("undefined cannot be part of a cache key, except as an object property");
|
|
183858
|
+
case "object":
|
|
183859
|
+
break;
|
|
183860
|
+
default:
|
|
183861
|
+
throw new Error(`a ${typeof value2} cannot be part of a cache key`);
|
|
183862
|
+
}
|
|
183863
|
+
if (value2 === null)
|
|
183864
|
+
return "null";
|
|
183865
|
+
if (depth === MAX_DEPTH)
|
|
183866
|
+
throw new Error(`an input nested more than ${MAX_DEPTH} levels deep, or circular`);
|
|
183867
|
+
depth++;
|
|
183868
|
+
if (Array.isArray(value2)) {
|
|
183869
|
+
let out2 = "[";
|
|
183870
|
+
for (let i2 = 0; i2 < value2.length; i2++)
|
|
183871
|
+
out2 += `${i2 ? "," : ""}${serialize(value2[i2], depth)}`;
|
|
183872
|
+
return `${out2}]`;
|
|
183873
|
+
}
|
|
183874
|
+
const proto = Object.getPrototypeOf(value2);
|
|
183875
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
183876
|
+
const name = proto.constructor?.name || "class instance";
|
|
183877
|
+
throw new Error(`a ${name} cannot be part of a cache key: only JSON data can`);
|
|
183878
|
+
}
|
|
183879
|
+
const record3 = value2;
|
|
183880
|
+
const keys = Object.keys(record3).sort();
|
|
183881
|
+
let out = "";
|
|
183882
|
+
for (const key of keys) {
|
|
183883
|
+
const v = record3[key];
|
|
183884
|
+
if (v !== void 0)
|
|
183885
|
+
out += `${out ? "," : ""}${JSON.stringify(key)}:${serialize(v, depth)}`;
|
|
183886
|
+
}
|
|
183887
|
+
return `{${out}}`;
|
|
183888
|
+
}
|
|
183889
|
+
|
|
183890
|
+
// node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
|
|
183891
|
+
var VOID_KEY = "~void";
|
|
183892
|
+
function getCacheKeyString(value2) {
|
|
183893
|
+
if (value2 === void 0)
|
|
183894
|
+
return VOID_KEY;
|
|
183895
|
+
if (value2 === null) {
|
|
183896
|
+
throw new Error("cache key cannot be null");
|
|
183897
|
+
}
|
|
183898
|
+
try {
|
|
183899
|
+
return hashKey(value2);
|
|
183900
|
+
} catch (error49) {
|
|
183901
|
+
throw new Error(`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`);
|
|
183902
|
+
}
|
|
183903
|
+
}
|
|
183904
|
+
function jitter(delayMs) {
|
|
183905
|
+
const half = delayMs / 2;
|
|
183906
|
+
return Math.round(half + Math.random() * half);
|
|
183907
|
+
}
|
|
183908
|
+
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
183909
|
+
function getErrorResponseHeaders(error49) {
|
|
183910
|
+
if (error49 === null || typeof error49 !== "object")
|
|
183911
|
+
return void 0;
|
|
183912
|
+
const source = error49;
|
|
183913
|
+
const headers = source.response?.headers ?? source.headers;
|
|
183914
|
+
if (headers === null || typeof headers !== "object")
|
|
183915
|
+
return void 0;
|
|
183916
|
+
return headers;
|
|
183917
|
+
}
|
|
183918
|
+
function retryAfterMs(error49) {
|
|
183919
|
+
const headers = getErrorResponseHeaders(error49);
|
|
183920
|
+
if (!headers)
|
|
183921
|
+
return void 0;
|
|
183922
|
+
const retryAfter = headers["retry-after"];
|
|
183923
|
+
if (typeof retryAfter === "string" && retryAfter.trim() !== "") {
|
|
183924
|
+
const seconds = Number(retryAfter);
|
|
183925
|
+
if (Number.isFinite(seconds))
|
|
183926
|
+
return Math.max(0, seconds * 1e3);
|
|
183927
|
+
const dateMs = Date.parse(retryAfter);
|
|
183928
|
+
if (!Number.isNaN(dateMs))
|
|
183929
|
+
return Math.max(0, dateMs - Date.now());
|
|
183930
|
+
}
|
|
183931
|
+
if (headers["x-ratelimit-remaining"] === "0") {
|
|
183932
|
+
const reset = headers["x-ratelimit-reset"];
|
|
183933
|
+
if (typeof reset === "string" && reset.trim() !== "") {
|
|
183934
|
+
const resetEpoch = Number(reset);
|
|
183935
|
+
if (Number.isFinite(resetEpoch))
|
|
183936
|
+
return Math.max(0, resetEpoch * 1e3 - Date.now());
|
|
183937
|
+
}
|
|
183938
|
+
}
|
|
183939
|
+
return void 0;
|
|
183940
|
+
}
|
|
183941
|
+
var ValidationError = class extends Error {
|
|
183942
|
+
result;
|
|
183943
|
+
issues;
|
|
183944
|
+
constructor(result) {
|
|
183945
|
+
const message = "message" in result && typeof result.message === "string" ? result.message : `validation failed: ${result.issues.map((i2) => i2.message).join(", ")}`;
|
|
183946
|
+
super(message);
|
|
183947
|
+
this.name = "ValidationError";
|
|
183948
|
+
this.result = result;
|
|
183949
|
+
this.issues = result.issues;
|
|
183950
|
+
}
|
|
183951
|
+
};
|
|
183952
|
+
async function assertSchema(schema2, value2) {
|
|
183953
|
+
const result = await schema2["~standard"].validate(value2);
|
|
183954
|
+
if (result.issues)
|
|
183955
|
+
throw new ValidationError(result);
|
|
183956
|
+
return result.value;
|
|
183957
|
+
}
|
|
183958
|
+
var log3 = {
|
|
183959
|
+
info: (...args2) => console.log(...args2),
|
|
183960
|
+
error: (...args2) => console.error(...args2),
|
|
183961
|
+
prod: (...args2) => {
|
|
183962
|
+
if (process.env.NODE_ENV === "production")
|
|
183963
|
+
console.log(...args2);
|
|
183964
|
+
}
|
|
183965
|
+
};
|
|
183966
|
+
function debugTrace(namePrefix, key) {
|
|
183967
|
+
if (process.env.LOG_LEVEL !== "debug")
|
|
183968
|
+
return void 0;
|
|
183969
|
+
const prefix = `${namePrefix}[${(/* @__PURE__ */ new Date()).toISOString()}]`;
|
|
183970
|
+
return {
|
|
183971
|
+
start: performance.now(),
|
|
183972
|
+
log: (message, data) => console.log(`${prefix} ${message}`, { key, ...data }),
|
|
183973
|
+
since: (start) => `${Math.round(performance.now() - start)}ms`
|
|
183974
|
+
};
|
|
183975
|
+
}
|
|
183976
|
+
function op(fnOrOptions, options) {
|
|
183977
|
+
if (typeof fnOrOptions === "function") {
|
|
183978
|
+
return _op(fnOrOptions, options ?? {});
|
|
183979
|
+
}
|
|
183980
|
+
const { input: inputSchema, output: outputSchema, run: run4, ...opOptions } = fnOrOptions;
|
|
183981
|
+
return _op(run4, opOptions, { input: inputSchema, output: outputSchema });
|
|
183982
|
+
}
|
|
183983
|
+
var isThenable = (value2) => typeof value2?.then === "function";
|
|
183984
|
+
function freshEntry(value2) {
|
|
183985
|
+
if (value2 === null || typeof value2 !== "object" || !("value" in value2))
|
|
183986
|
+
return void 0;
|
|
183987
|
+
const expires = value2.expires;
|
|
183988
|
+
return typeof expires === "number" && expires > Date.now() ? value2 : void 0;
|
|
183989
|
+
}
|
|
183990
|
+
var adapterMethods = ["get", "set", "delete", "list"];
|
|
183991
|
+
function callAdapter(method, key, run4) {
|
|
183992
|
+
let result;
|
|
183993
|
+
try {
|
|
183994
|
+
result = run4();
|
|
183995
|
+
} catch (error49) {
|
|
183996
|
+
throw new AdapterError(method, key, error49);
|
|
183997
|
+
}
|
|
183998
|
+
if (!isThenable(result))
|
|
183999
|
+
return result;
|
|
184000
|
+
return result.then(void 0, (error49) => {
|
|
184001
|
+
throw new AdapterError(method, key, error49);
|
|
184002
|
+
});
|
|
184003
|
+
}
|
|
184004
|
+
var DELETE_BATCH = 1e3;
|
|
184005
|
+
function sweep(store, prefix, match3) {
|
|
184006
|
+
const now = Date.now();
|
|
184007
|
+
const keys = [];
|
|
184008
|
+
let count = 0;
|
|
184009
|
+
let matchError;
|
|
184010
|
+
const take = ([key, entry]) => {
|
|
184011
|
+
if (!(entry.expires > now))
|
|
184012
|
+
return void keys.push(key);
|
|
184013
|
+
let matched;
|
|
184014
|
+
try {
|
|
184015
|
+
matched = match3(entry.input);
|
|
184016
|
+
} catch (error49) {
|
|
184017
|
+
matchError = { error: error49 };
|
|
184018
|
+
throw error49;
|
|
184019
|
+
}
|
|
184020
|
+
if (matched) {
|
|
184021
|
+
keys.push(key);
|
|
184022
|
+
count++;
|
|
184023
|
+
}
|
|
184024
|
+
};
|
|
184025
|
+
const fail2 = (error49) => {
|
|
184026
|
+
throw matchError ? matchError.error : new AdapterError("list", prefix, error49);
|
|
184027
|
+
};
|
|
184028
|
+
const deleteFrom = (from) => {
|
|
184029
|
+
for (let i2 = from; i2 < keys.length; i2 += DELETE_BATCH) {
|
|
184030
|
+
const batch = keys.slice(i2, i2 + DELETE_BATCH);
|
|
184031
|
+
const deleted = callAdapter("delete", prefix, () => store.delete(batch));
|
|
184032
|
+
if (isThenable(deleted))
|
|
184033
|
+
return Promise.resolve(deleted).then(() => deleteFrom(i2 + DELETE_BATCH));
|
|
184034
|
+
}
|
|
184035
|
+
return count;
|
|
184036
|
+
};
|
|
184037
|
+
let listed;
|
|
184038
|
+
try {
|
|
184039
|
+
listed = store.list(prefix);
|
|
184040
|
+
} catch (error49) {
|
|
184041
|
+
return fail2(error49);
|
|
184042
|
+
}
|
|
184043
|
+
if (!isThenable(listed) && Symbol.iterator in Object(listed)) {
|
|
184044
|
+
try {
|
|
184045
|
+
for (const item of listed)
|
|
184046
|
+
take(item);
|
|
184047
|
+
} catch (error49) {
|
|
184048
|
+
fail2(error49);
|
|
184049
|
+
}
|
|
184050
|
+
return deleteFrom(0);
|
|
184051
|
+
}
|
|
184052
|
+
return (async () => {
|
|
184053
|
+
try {
|
|
184054
|
+
for await (const item of await listed)
|
|
184055
|
+
take(item);
|
|
184056
|
+
} catch (error49) {
|
|
184057
|
+
fail2(error49);
|
|
184058
|
+
}
|
|
184059
|
+
return deleteFrom(0);
|
|
184060
|
+
})();
|
|
184061
|
+
}
|
|
184062
|
+
function _op(fn2, options, schemas = {}) {
|
|
184063
|
+
const { ttl, cache: adapter } = options;
|
|
184064
|
+
const shouldCache = ttl !== void 0;
|
|
184065
|
+
if (shouldCache && !(ttl > 0 && Number.isFinite(ttl))) {
|
|
184066
|
+
throw new Error(`ttl must be a positive number of milliseconds, got ${ttl}`);
|
|
184067
|
+
}
|
|
184068
|
+
if (adapter) {
|
|
184069
|
+
if (!options.name)
|
|
184070
|
+
throw new Error(`an op with a cache adapter needs a name: its keys are "yes:<name>:<hash>"`);
|
|
184071
|
+
if (options.name.includes(":")) {
|
|
184072
|
+
throw new Error(`op name "${options.name}" cannot contain ":" with a cache adapter: its keys would overlap another op's`);
|
|
184073
|
+
}
|
|
184074
|
+
if (!shouldCache)
|
|
184075
|
+
throw new Error(`${options.name}: a cache adapter does nothing without a ttl`);
|
|
184076
|
+
if (options.maxItems !== void 0) {
|
|
184077
|
+
throw new Error(`${options.name}: maxItems sizes the default memory store; size the adapter instead`);
|
|
184078
|
+
}
|
|
184079
|
+
const missing = adapterMethods.filter((method) => typeof adapter[method] !== "function");
|
|
184080
|
+
if (missing.length) {
|
|
184081
|
+
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)`);
|
|
184082
|
+
}
|
|
184083
|
+
}
|
|
184084
|
+
const defaultStore = shouldCache && !adapter ? memory({ maxItems: options.maxItems }) : void 0;
|
|
184085
|
+
const store = adapter ?? defaultStore;
|
|
184086
|
+
const prefix = adapter ? `yes:${options.name}:` : "";
|
|
184087
|
+
const inFlightPromises = /* @__PURE__ */ new Map();
|
|
184088
|
+
const namePrefix = options.name ? `[${options.name}] ` : "";
|
|
184089
|
+
const defaultCacheHit = options.cacheHit === null ? () => {
|
|
184090
|
+
} : options.cacheHit ?? (() => {
|
|
184091
|
+
if (options.name && shouldCache)
|
|
184092
|
+
log3.prod(`${namePrefix}cache hit`);
|
|
184093
|
+
});
|
|
184094
|
+
const defaultCacheMiss = options.cacheMiss === null ? () => {
|
|
184095
|
+
} : options.cacheMiss ?? (() => {
|
|
184096
|
+
if (options.name && shouldCache)
|
|
184097
|
+
log3.prod(`${namePrefix}cache miss`);
|
|
184098
|
+
});
|
|
184099
|
+
const methodKey = (value2, method) => {
|
|
184100
|
+
const toKey = (input) => {
|
|
184101
|
+
try {
|
|
184102
|
+
return prefix + getCacheKeyString(input);
|
|
184103
|
+
} catch (error49) {
|
|
184104
|
+
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
184105
|
+
throw new Error(`failed to hash cache key for ${method}()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`);
|
|
184106
|
+
}
|
|
184107
|
+
};
|
|
184108
|
+
if (!schemas.input)
|
|
184109
|
+
return toKey(value2);
|
|
184110
|
+
const result = schemas.input["~standard"].validate(value2);
|
|
184111
|
+
if (result instanceof Promise)
|
|
184112
|
+
return result.then((r2) => toKey(r2.issues ? value2 : r2.value));
|
|
184113
|
+
return toKey(result.issues ? value2 : result.value);
|
|
184114
|
+
};
|
|
184115
|
+
const cachedFn = async (rawInput, ctx) => {
|
|
184116
|
+
const input = schemas.input ? await assertSchema(schemas.input, rawInput) : rawInput;
|
|
184117
|
+
let key;
|
|
184118
|
+
try {
|
|
184119
|
+
key = getCacheKeyString(input);
|
|
184120
|
+
} catch (error49) {
|
|
184121
|
+
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
184122
|
+
throw new Error(`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`);
|
|
184123
|
+
}
|
|
184124
|
+
const trace = debugTrace(namePrefix, key);
|
|
184125
|
+
trace?.log("cache lookup started");
|
|
184126
|
+
const inFlight = inFlightPromises.get(key);
|
|
184127
|
+
if (inFlight) {
|
|
184128
|
+
trace?.log("cache hit (in-flight)");
|
|
184129
|
+
defaultCacheHit(key);
|
|
184130
|
+
return inFlight;
|
|
184131
|
+
}
|
|
184132
|
+
const fullKey = store ? prefix + key : "";
|
|
184133
|
+
let pendingRead;
|
|
184134
|
+
if (store) {
|
|
184135
|
+
let read2;
|
|
184136
|
+
try {
|
|
184137
|
+
read2 = store.get(fullKey);
|
|
184138
|
+
} catch (error49) {
|
|
184139
|
+
throw new AdapterError("get", fullKey, error49);
|
|
184140
|
+
}
|
|
184141
|
+
if (isThenable(read2)) {
|
|
184142
|
+
pendingRead = read2.then(void 0, (error49) => {
|
|
184143
|
+
throw new AdapterError("get", fullKey, error49);
|
|
184144
|
+
});
|
|
184145
|
+
} else {
|
|
184146
|
+
const entry = store === defaultStore ? read2 : freshEntry(read2);
|
|
184147
|
+
if (entry) {
|
|
184148
|
+
trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
|
|
184149
|
+
defaultCacheHit(key);
|
|
184150
|
+
return entry.value;
|
|
184151
|
+
}
|
|
184152
|
+
}
|
|
184153
|
+
}
|
|
184154
|
+
const retries = options.retries ?? [];
|
|
184155
|
+
const execStart = trace ? performance.now() : 0;
|
|
184156
|
+
const promise2 = (async () => {
|
|
184157
|
+
if (pendingRead) {
|
|
184158
|
+
const entry = freshEntry(await pendingRead);
|
|
184159
|
+
if (entry) {
|
|
184160
|
+
trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
|
|
184161
|
+
defaultCacheHit(key);
|
|
184162
|
+
return entry.value;
|
|
184163
|
+
}
|
|
184164
|
+
}
|
|
184165
|
+
trace?.log("cache miss, executing function");
|
|
184166
|
+
defaultCacheMiss(key);
|
|
184167
|
+
let result;
|
|
184168
|
+
let lastError;
|
|
184169
|
+
let attempt = 0;
|
|
184170
|
+
for (; attempt <= retries.length; attempt++) {
|
|
184171
|
+
try {
|
|
184172
|
+
const returned = await fn2(input, ctx);
|
|
184173
|
+
result = schemas.output ? await assertSchema(schemas.output, returned) : returned;
|
|
184174
|
+
break;
|
|
184175
|
+
} catch (error49) {
|
|
184176
|
+
if (error49 instanceof ValidationError || options.rethrow?.(error49))
|
|
184177
|
+
throw error49;
|
|
184178
|
+
lastError = error49;
|
|
184179
|
+
const isLastAttempt = attempt >= retries.length;
|
|
184180
|
+
if (isLastAttempt) {
|
|
184181
|
+
if (namePrefix) {
|
|
184182
|
+
log3.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
184183
|
+
log3.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
184184
|
+
} else {
|
|
184185
|
+
log3.info(`attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
184186
|
+
log3.info({ key, error: error49, attempt });
|
|
184187
|
+
}
|
|
184188
|
+
} else {
|
|
184189
|
+
let delay2 = retries[attempt];
|
|
184190
|
+
if (options.retryAfter) {
|
|
184191
|
+
const extract = options.retryAfter === true ? retryAfterMs : options.retryAfter;
|
|
184192
|
+
const hint = extract(error49);
|
|
184193
|
+
if (hint !== void 0) {
|
|
184194
|
+
const cap = options.retryAfterCap ?? DEFAULT_RETRY_AFTER_CAP_MS;
|
|
184195
|
+
delay2 = Math.max(delay2, Math.min(cap, hint));
|
|
184196
|
+
}
|
|
184197
|
+
}
|
|
184198
|
+
delay2 = jitter(delay2);
|
|
184199
|
+
if (namePrefix) {
|
|
184200
|
+
log3.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
184201
|
+
log3.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
184202
|
+
} else {
|
|
184203
|
+
log3.info(`attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
184204
|
+
log3.info({ key, error: error49, attempt });
|
|
184205
|
+
}
|
|
184206
|
+
await sleep2(delay2);
|
|
184207
|
+
}
|
|
184208
|
+
}
|
|
184209
|
+
}
|
|
184210
|
+
if (attempt > retries.length) {
|
|
184211
|
+
trace?.log("function failed after all retries", {
|
|
184212
|
+
runtime: trace.since(execStart),
|
|
184213
|
+
attempts: retries.length + 1,
|
|
184214
|
+
error: lastError instanceof Error ? lastError.message : lastError
|
|
184215
|
+
});
|
|
184216
|
+
throw lastError;
|
|
184217
|
+
}
|
|
184218
|
+
const skip = options.skipCache ? options.skipCache(result) : false;
|
|
184219
|
+
const storable = store !== void 0 && result !== null && result !== void 0 && !(result instanceof Error) && !skip;
|
|
184220
|
+
let cached4 = false;
|
|
184221
|
+
if (storable) {
|
|
184222
|
+
const created = Date.now();
|
|
184223
|
+
const entry = { value: result, created, expires: created + ttl, input };
|
|
184224
|
+
try {
|
|
184225
|
+
const written = callAdapter("set", fullKey, () => store.set(fullKey, entry, ttl));
|
|
184226
|
+
if (isThenable(written))
|
|
184227
|
+
await written;
|
|
184228
|
+
cached4 = true;
|
|
184229
|
+
} catch (error49) {
|
|
184230
|
+
log3.error(`${namePrefix}cache write failed, returning the result uncached`, error49);
|
|
184231
|
+
}
|
|
184232
|
+
}
|
|
184233
|
+
trace?.log("function executed successfully", { runtime: trace.since(execStart), attempt: attempt + 1, cached: cached4 });
|
|
184234
|
+
return result;
|
|
184235
|
+
})();
|
|
184236
|
+
inFlightPromises.set(key, promise2);
|
|
184237
|
+
try {
|
|
184238
|
+
return await promise2;
|
|
184239
|
+
} finally {
|
|
184240
|
+
inFlightPromises.delete(key);
|
|
184241
|
+
}
|
|
184242
|
+
};
|
|
184243
|
+
cachedFn.clear = async (key) => {
|
|
184244
|
+
if (!store)
|
|
184245
|
+
return;
|
|
184246
|
+
if (key === void 0) {
|
|
184247
|
+
await sweep(store, prefix, () => true);
|
|
184248
|
+
return;
|
|
184249
|
+
}
|
|
184250
|
+
let fullKey = methodKey(key, "clear");
|
|
184251
|
+
if (typeof fullKey !== "string")
|
|
184252
|
+
fullKey = await fullKey;
|
|
184253
|
+
const target = fullKey;
|
|
184254
|
+
await callAdapter("delete", target, () => store.delete([target]));
|
|
184255
|
+
};
|
|
184256
|
+
cachedFn.has = async (key) => {
|
|
184257
|
+
if (!store)
|
|
184258
|
+
return false;
|
|
184259
|
+
let fullKey = methodKey(key, "has");
|
|
184260
|
+
if (typeof fullKey !== "string")
|
|
184261
|
+
fullKey = await fullKey;
|
|
184262
|
+
const target = fullKey;
|
|
184263
|
+
const memoryStore = store;
|
|
184264
|
+
const read2 = callAdapter("get", target, () => memoryStore.peek ? memoryStore.peek(target) : store.get(target));
|
|
184265
|
+
return freshEntry(await read2) !== void 0;
|
|
184266
|
+
};
|
|
184267
|
+
cachedFn.invalidate = (predicate) => {
|
|
184268
|
+
if (!store)
|
|
184269
|
+
return Promise.resolve(0);
|
|
184270
|
+
const count = sweep(store, prefix, predicate);
|
|
184271
|
+
return typeof count === "number" ? Promise.resolve(count) : count;
|
|
184272
|
+
};
|
|
184273
|
+
return cachedFn;
|
|
184274
|
+
}
|
|
184275
|
+
|
|
183588
184276
|
// utils/progressComment.ts
|
|
183589
184277
|
function parseProgressComment(raw2) {
|
|
183590
184278
|
if (!raw2?.id) return void 0;
|
|
@@ -184538,7 +185226,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
|
|
|
184538
185226
|
import { closeSync, openSync, writeFileSync as writeFileSync9 } from "node:fs";
|
|
184539
185227
|
import { userInfo as userInfo2 } from "node:os";
|
|
184540
185228
|
import { join as join11 } from "node:path";
|
|
184541
|
-
import { setTimeout as
|
|
185229
|
+
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
184542
185230
|
|
|
184543
185231
|
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
|
184544
185232
|
var LIST_ITEM_MARKER = "-";
|
|
@@ -185469,7 +186157,7 @@ function KillBackgroundTool(ctx) {
|
|
|
185469
186157
|
process.kill(-proc.pid, "SIGTERM");
|
|
185470
186158
|
} catch {
|
|
185471
186159
|
}
|
|
185472
|
-
await
|
|
186160
|
+
await sleep3(200);
|
|
185473
186161
|
try {
|
|
185474
186162
|
process.kill(-proc.pid, "SIGKILL");
|
|
185475
186163
|
} catch {
|
|
@@ -185696,868 +186384,6 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
185696
186384
|
return hasChanges ? out : null;
|
|
185697
186385
|
}
|
|
185698
186386
|
|
|
185699
|
-
// yes/index.ts
|
|
185700
|
-
import { performance as performance8 } from "node:perf_hooks";
|
|
185701
|
-
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
185702
|
-
|
|
185703
|
-
// node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
185704
|
-
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
185705
|
-
var S = P("lru-cache:metrics");
|
|
185706
|
-
var W2 = G("lru-cache");
|
|
185707
|
-
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
185708
|
-
var R2 = () => S.hasSubscribers || W2.hasSubscribers;
|
|
185709
|
-
var U2 = /* @__PURE__ */ new Set();
|
|
185710
|
-
var M = typeof process == "object" && process ? process : {};
|
|
185711
|
-
var k = (d3, e, t2, i2) => {
|
|
185712
|
-
typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t2, i2) : console.error(`[${t2}] ${e}: ${d3}`);
|
|
185713
|
-
};
|
|
185714
|
-
var H = (d3) => !U2.has(d3);
|
|
185715
|
-
var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
|
|
185716
|
-
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;
|
|
185717
|
-
var O = class extends Array {
|
|
185718
|
-
constructor(e) {
|
|
185719
|
-
super(e), this.fill(0);
|
|
185720
|
-
}
|
|
185721
|
-
};
|
|
185722
|
-
var x = class d {
|
|
185723
|
-
heap;
|
|
185724
|
-
length;
|
|
185725
|
-
static #o = false;
|
|
185726
|
-
static create(e) {
|
|
185727
|
-
let t2 = j(e);
|
|
185728
|
-
if (!t2) return [];
|
|
185729
|
-
d.#o = true;
|
|
185730
|
-
let i2 = new d(e, t2);
|
|
185731
|
-
return d.#o = false, i2;
|
|
185732
|
-
}
|
|
185733
|
-
constructor(e, t2) {
|
|
185734
|
-
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
185735
|
-
this.heap = new t2(e), this.length = 0;
|
|
185736
|
-
}
|
|
185737
|
-
push(e) {
|
|
185738
|
-
this.heap[this.length++] = e;
|
|
185739
|
-
}
|
|
185740
|
-
pop() {
|
|
185741
|
-
return this.heap[--this.length];
|
|
185742
|
-
}
|
|
185743
|
-
};
|
|
185744
|
-
var I2 = class d2 {
|
|
185745
|
-
#o;
|
|
185746
|
-
#c;
|
|
185747
|
-
#S;
|
|
185748
|
-
#O;
|
|
185749
|
-
#w;
|
|
185750
|
-
#M;
|
|
185751
|
-
#I;
|
|
185752
|
-
#m;
|
|
185753
|
-
get perf() {
|
|
185754
|
-
return this.#m;
|
|
185755
|
-
}
|
|
185756
|
-
ttl;
|
|
185757
|
-
ttlResolution;
|
|
185758
|
-
ttlAutopurge;
|
|
185759
|
-
updateAgeOnGet;
|
|
185760
|
-
updateAgeOnHas;
|
|
185761
|
-
allowStale;
|
|
185762
|
-
noDisposeOnSet;
|
|
185763
|
-
noUpdateTTL;
|
|
185764
|
-
maxEntrySize;
|
|
185765
|
-
sizeCalculation;
|
|
185766
|
-
noDeleteOnFetchRejection;
|
|
185767
|
-
noDeleteOnStaleGet;
|
|
185768
|
-
allowStaleOnFetchAbort;
|
|
185769
|
-
allowStaleOnFetchRejection;
|
|
185770
|
-
ignoreFetchAbort;
|
|
185771
|
-
backgroundFetchSize;
|
|
185772
|
-
#n;
|
|
185773
|
-
#b;
|
|
185774
|
-
#s;
|
|
185775
|
-
#i;
|
|
185776
|
-
#t;
|
|
185777
|
-
#l;
|
|
185778
|
-
#u;
|
|
185779
|
-
#a;
|
|
185780
|
-
#h;
|
|
185781
|
-
#y;
|
|
185782
|
-
#r;
|
|
185783
|
-
#_;
|
|
185784
|
-
#F;
|
|
185785
|
-
#d;
|
|
185786
|
-
#g;
|
|
185787
|
-
#T;
|
|
185788
|
-
#U;
|
|
185789
|
-
#f;
|
|
185790
|
-
#D;
|
|
185791
|
-
static unsafeExposeInternals(e) {
|
|
185792
|
-
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() {
|
|
185793
|
-
return e.#a;
|
|
185794
|
-
}, get tail() {
|
|
185795
|
-
return e.#h;
|
|
185796
|
-
}, free: e.#y, isBackgroundFetch: (t2) => e.#e(t2), backgroundFetch: (t2, i2, s, n3) => e.#P(t2, i2, s, n3), moveToTail: (t2) => e.#L(t2), indexes: (t2) => e.#A(t2), rindexes: (t2) => e.#z(t2), isStale: (t2) => e.#p(t2) };
|
|
185797
|
-
}
|
|
185798
|
-
get max() {
|
|
185799
|
-
return this.#o;
|
|
185800
|
-
}
|
|
185801
|
-
get maxSize() {
|
|
185802
|
-
return this.#c;
|
|
185803
|
-
}
|
|
185804
|
-
get calculatedSize() {
|
|
185805
|
-
return this.#b;
|
|
185806
|
-
}
|
|
185807
|
-
get size() {
|
|
185808
|
-
return this.#n;
|
|
185809
|
-
}
|
|
185810
|
-
get fetchMethod() {
|
|
185811
|
-
return this.#M;
|
|
185812
|
-
}
|
|
185813
|
-
get memoMethod() {
|
|
185814
|
-
return this.#I;
|
|
185815
|
-
}
|
|
185816
|
-
get dispose() {
|
|
185817
|
-
return this.#S;
|
|
185818
|
-
}
|
|
185819
|
-
get onInsert() {
|
|
185820
|
-
return this.#O;
|
|
185821
|
-
}
|
|
185822
|
-
get disposeAfter() {
|
|
185823
|
-
return this.#w;
|
|
185824
|
-
}
|
|
185825
|
-
constructor(e) {
|
|
185826
|
-
let { max: t2 = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n3, updateAgeOnGet: o, updateAgeOnHas: l2, allowStale: h2, dispose: r2, onInsert: c2, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u4, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y2, fetchMethod: a2, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z2, backgroundFetchSize: C = 1, perf: E } = e;
|
|
185827
|
-
if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
185828
|
-
if (this.#m = E ?? L, t2 !== 0 && !T(t2)) throw new TypeError("max option must be a nonnegative integer");
|
|
185829
|
-
let v = t2 ? j(t2) : Array;
|
|
185830
|
-
if (!v) throw new Error("invalid max value: " + t2);
|
|
185831
|
-
if (this.#o = t2, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y2, this.sizeCalculation) {
|
|
185832
|
-
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
185833
|
-
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
185834
|
-
}
|
|
185835
|
-
if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
185836
|
-
if (this.#I = w, a2 !== void 0 && typeof a2 != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
185837
|
-
if (this.#M = a2, this.#U = !!a2, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t2 }).fill(void 0), this.#t = Array.from({ length: t2 }).fill(void 0), this.#l = new v(t2), this.#u = new v(t2), this.#a = 0, this.#h = 0, this.#y = x.create(t2), this.#n = 0, this.#b = 0, typeof r2 == "function" && (this.#S = r2), typeof c2 == "function" && (this.#O = c2), 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 = !!u4, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z2, this.maxEntrySize !== 0) {
|
|
185838
|
-
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
185839
|
-
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
185840
|
-
this.#X();
|
|
185841
|
-
}
|
|
185842
|
-
if (this.allowStale = !!h2, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l2, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n3, this.ttl = i2 || 0, this.ttl) {
|
|
185843
|
-
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
185844
|
-
this.#k();
|
|
185845
|
-
}
|
|
185846
|
-
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
185847
|
-
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
185848
|
-
let D = "LRU_CACHE_UNBOUNDED";
|
|
185849
|
-
H(D) && (U2.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
185850
|
-
}
|
|
185851
|
-
}
|
|
185852
|
-
getRemainingTTL(e) {
|
|
185853
|
-
return this.#s.has(e) ? 1 / 0 : 0;
|
|
185854
|
-
}
|
|
185855
|
-
#k() {
|
|
185856
|
-
let e = new O(this.#o), t2 = new O(this.#o);
|
|
185857
|
-
this.#d = e, this.#F = t2;
|
|
185858
|
-
let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
185859
|
-
this.#g = i2, this.#H = (h2, r2, c2 = this.#m.now()) => {
|
|
185860
|
-
t2[h2] = r2 !== 0 ? c2 : 0, e[h2] = r2, s(h2, r2);
|
|
185861
|
-
}, this.#R = (h2) => {
|
|
185862
|
-
t2[h2] = e[h2] !== 0 ? this.#m.now() : 0, s(h2, e[h2]);
|
|
185863
|
-
};
|
|
185864
|
-
let s = this.ttlAutopurge ? (h2, r2) => {
|
|
185865
|
-
if (i2?.[h2] && (clearTimeout(i2[h2]), i2[h2] = void 0), r2 && r2 !== 0 && i2) {
|
|
185866
|
-
let c2 = setTimeout(() => {
|
|
185867
|
-
this.#p(h2) ? (this.#E(this.#i[h2], "expire"), i2[h2] = void 0) : s(h2, l2(h2));
|
|
185868
|
-
}, r2 + 1);
|
|
185869
|
-
c2.unref && c2.unref(), i2[h2] = c2;
|
|
185870
|
-
}
|
|
185871
|
-
} : () => {
|
|
185872
|
-
};
|
|
185873
|
-
this.#v = (h2, r2) => {
|
|
185874
|
-
if (e[r2]) {
|
|
185875
|
-
let c2 = e[r2], m = t2[r2];
|
|
185876
|
-
if (!c2 || !m) return;
|
|
185877
|
-
h2.ttl = c2, h2.start = m, h2.now = n3 || o();
|
|
185878
|
-
let _ = h2.now - m;
|
|
185879
|
-
h2.remainingTTL = c2 - _;
|
|
185880
|
-
}
|
|
185881
|
-
};
|
|
185882
|
-
let n3 = 0, o = () => {
|
|
185883
|
-
let h2 = this.#m.now();
|
|
185884
|
-
if (this.ttlResolution > 0) {
|
|
185885
|
-
n3 = h2;
|
|
185886
|
-
let r2 = setTimeout(() => n3 = 0, this.ttlResolution);
|
|
185887
|
-
r2.unref && r2.unref();
|
|
185888
|
-
}
|
|
185889
|
-
return h2;
|
|
185890
|
-
};
|
|
185891
|
-
this.getRemainingTTL = (h2) => {
|
|
185892
|
-
let r2 = this.#s.get(h2);
|
|
185893
|
-
return r2 === void 0 ? 0 : l2(r2);
|
|
185894
|
-
};
|
|
185895
|
-
let l2 = (h2) => {
|
|
185896
|
-
let r2 = e[h2], c2 = t2[h2];
|
|
185897
|
-
if (!r2 || !c2) return 1 / 0;
|
|
185898
|
-
let m = (n3 || o()) - c2;
|
|
185899
|
-
return r2 - m;
|
|
185900
|
-
};
|
|
185901
|
-
this.#p = (h2) => {
|
|
185902
|
-
let r2 = t2[h2], c2 = e[h2];
|
|
185903
|
-
return !!c2 && !!r2 && (n3 || o()) - r2 > c2;
|
|
185904
|
-
};
|
|
185905
|
-
}
|
|
185906
|
-
#R = () => {
|
|
185907
|
-
};
|
|
185908
|
-
#v = () => {
|
|
185909
|
-
};
|
|
185910
|
-
#H = () => {
|
|
185911
|
-
};
|
|
185912
|
-
#p = () => false;
|
|
185913
|
-
#X() {
|
|
185914
|
-
let e = new O(this.#o);
|
|
185915
|
-
this.#b = 0, this.#_ = e, this.#x = (t2) => {
|
|
185916
|
-
this.#b -= e[t2], e[t2] = 0;
|
|
185917
|
-
}, this.#N = (t2, i2, s, n3) => {
|
|
185918
|
-
if (!T(s)) {
|
|
185919
|
-
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
185920
|
-
if (n3) {
|
|
185921
|
-
if (typeof n3 != "function") throw new TypeError("sizeCalculation must be a function");
|
|
185922
|
-
if (s = n3(i2, t2), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
185923
|
-
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
185924
|
-
}
|
|
185925
|
-
return s;
|
|
185926
|
-
}, this.#j = (t2, i2, s) => {
|
|
185927
|
-
if (e[t2] = i2, this.#c) {
|
|
185928
|
-
let n3 = this.#c - e[t2];
|
|
185929
|
-
for (; this.#b > n3; ) this.#G(true);
|
|
185930
|
-
}
|
|
185931
|
-
this.#b += e[t2], s && (s.entrySize = i2, s.totalCalculatedSize = this.#b);
|
|
185932
|
-
};
|
|
185933
|
-
}
|
|
185934
|
-
#x = (e) => {
|
|
185935
|
-
};
|
|
185936
|
-
#j = (e, t2, i2) => {
|
|
185937
|
-
};
|
|
185938
|
-
#N = (e, t2, i2, s) => {
|
|
185939
|
-
if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
185940
|
-
return 0;
|
|
185941
|
-
};
|
|
185942
|
-
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
185943
|
-
if (this.#n) for (let t2 = this.#h; this.#V(t2) && ((e || !this.#p(t2)) && (yield t2), t2 !== this.#a); ) t2 = this.#u[t2];
|
|
185944
|
-
}
|
|
185945
|
-
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
185946
|
-
if (this.#n) for (let t2 = this.#a; this.#V(t2) && ((e || !this.#p(t2)) && (yield t2), t2 !== this.#h); ) t2 = this.#l[t2];
|
|
185947
|
-
}
|
|
185948
|
-
#V(e) {
|
|
185949
|
-
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
185950
|
-
}
|
|
185951
|
-
*entries() {
|
|
185952
|
-
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]]);
|
|
185953
|
-
}
|
|
185954
|
-
*rentries() {
|
|
185955
|
-
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]]);
|
|
185956
|
-
}
|
|
185957
|
-
*keys() {
|
|
185958
|
-
for (let e of this.#A()) {
|
|
185959
|
-
let t2 = this.#i[e];
|
|
185960
|
-
t2 !== void 0 && !this.#e(this.#t[e]) && (yield t2);
|
|
185961
|
-
}
|
|
185962
|
-
}
|
|
185963
|
-
*rkeys() {
|
|
185964
|
-
for (let e of this.#z()) {
|
|
185965
|
-
let t2 = this.#i[e];
|
|
185966
|
-
t2 !== void 0 && !this.#e(this.#t[e]) && (yield t2);
|
|
185967
|
-
}
|
|
185968
|
-
}
|
|
185969
|
-
*values() {
|
|
185970
|
-
for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
185971
|
-
}
|
|
185972
|
-
*rvalues() {
|
|
185973
|
-
for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
185974
|
-
}
|
|
185975
|
-
[Symbol.iterator]() {
|
|
185976
|
-
return this.entries();
|
|
185977
|
-
}
|
|
185978
|
-
[Symbol.toStringTag] = "LRUCache";
|
|
185979
|
-
find(e, t2 = {}) {
|
|
185980
|
-
for (let i2 of this.#A()) {
|
|
185981
|
-
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
185982
|
-
if (n3 !== void 0 && e(n3, this.#i[i2], this)) return this.#C(this.#i[i2], t2);
|
|
185983
|
-
}
|
|
185984
|
-
}
|
|
185985
|
-
forEach(e, t2 = this) {
|
|
185986
|
-
for (let i2 of this.#A()) {
|
|
185987
|
-
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
185988
|
-
n3 !== void 0 && e.call(t2, n3, this.#i[i2], this);
|
|
185989
|
-
}
|
|
185990
|
-
}
|
|
185991
|
-
rforEach(e, t2 = this) {
|
|
185992
|
-
for (let i2 of this.#z()) {
|
|
185993
|
-
let s = this.#t[i2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
185994
|
-
n3 !== void 0 && e.call(t2, n3, this.#i[i2], this);
|
|
185995
|
-
}
|
|
185996
|
-
}
|
|
185997
|
-
purgeStale() {
|
|
185998
|
-
let e = false;
|
|
185999
|
-
for (let t2 of this.#z({ allowStale: true })) this.#p(t2) && (this.#E(this.#i[t2], "expire"), e = true);
|
|
186000
|
-
return e;
|
|
186001
|
-
}
|
|
186002
|
-
info(e) {
|
|
186003
|
-
let t2 = this.#s.get(e);
|
|
186004
|
-
if (t2 === void 0) return;
|
|
186005
|
-
let i2 = this.#t[t2], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
|
|
186006
|
-
if (s === void 0) return;
|
|
186007
|
-
let n3 = { value: s };
|
|
186008
|
-
if (this.#d && this.#F) {
|
|
186009
|
-
let o = this.#d[t2], l2 = this.#F[t2];
|
|
186010
|
-
if (o && l2) {
|
|
186011
|
-
let h2 = o - (this.#m.now() - l2);
|
|
186012
|
-
n3.ttl = h2, n3.start = Date.now();
|
|
186013
|
-
}
|
|
186014
|
-
}
|
|
186015
|
-
return this.#_ && (n3.size = this.#_[t2]), n3;
|
|
186016
|
-
}
|
|
186017
|
-
dump() {
|
|
186018
|
-
let e = [];
|
|
186019
|
-
for (let t2 of this.#A({ allowStale: true })) {
|
|
186020
|
-
let i2 = this.#i[t2], s = this.#t[t2], n3 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
186021
|
-
if (n3 === void 0 || i2 === void 0) continue;
|
|
186022
|
-
let o = { value: n3 };
|
|
186023
|
-
if (this.#d && this.#F) {
|
|
186024
|
-
o.ttl = this.#d[t2];
|
|
186025
|
-
let l2 = this.#m.now() - this.#F[t2];
|
|
186026
|
-
o.start = Math.floor(Date.now() - l2);
|
|
186027
|
-
}
|
|
186028
|
-
this.#_ && (o.size = this.#_[t2]), e.unshift([i2, o]);
|
|
186029
|
-
}
|
|
186030
|
-
return e;
|
|
186031
|
-
}
|
|
186032
|
-
load(e) {
|
|
186033
|
-
this.clear();
|
|
186034
|
-
for (let [t2, i2] of e) {
|
|
186035
|
-
if (i2.start) {
|
|
186036
|
-
let s = Date.now() - i2.start;
|
|
186037
|
-
i2.start = this.#m.now() - s;
|
|
186038
|
-
}
|
|
186039
|
-
this.#W(t2, i2.value, i2);
|
|
186040
|
-
}
|
|
186041
|
-
}
|
|
186042
|
-
set(e, t2, i2 = {}) {
|
|
186043
|
-
let { status: s = S.hasSubscribers ? {} : void 0 } = i2;
|
|
186044
|
-
i2.status = s, s && (s.op = "set", s.key = e, t2 !== void 0 && (s.value = t2), s.cache = this);
|
|
186045
|
-
let n3 = this.#W(e, t2, i2);
|
|
186046
|
-
return s && S.hasSubscribers && S.publish(s), n3;
|
|
186047
|
-
}
|
|
186048
|
-
#W(e, t2, i2, s) {
|
|
186049
|
-
let { ttl: n3 = this.ttl, start: o, noDisposeOnSet: l2 = this.noDisposeOnSet, sizeCalculation: h2 = this.sizeCalculation, status: r2 } = i2, c2 = this.#e(t2);
|
|
186050
|
-
if (t2 === void 0) return r2 && (r2.set = "deleted"), this.delete(e), this;
|
|
186051
|
-
let { noUpdateTTL: m = this.noUpdateTTL } = i2;
|
|
186052
|
-
r2 && !c2 && (r2.value = t2);
|
|
186053
|
-
let _ = this.#N(e, t2, i2.size || 0, h2, r2);
|
|
186054
|
-
if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r2 && (r2.set = "miss", r2.maxEntrySizeExceeded = true), this;
|
|
186055
|
-
let u4 = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
186056
|
-
if (u4 === void 0) u4 = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u4] = e, this.#t[u4] = t2, this.#s.set(e, u4), this.#l[this.#h] = u4, this.#u[u4] = this.#h, this.#h = u4, this.#n++, this.#j(u4, _, r2), r2 && (r2.set = "add"), m = false, this.#D && !c2 && this.#O?.(t2, e, "add");
|
|
186057
|
-
else {
|
|
186058
|
-
this.#L(u4);
|
|
186059
|
-
let g = this.#t[u4];
|
|
186060
|
-
if (t2 !== g) {
|
|
186061
|
-
if (!l2) if (this.#e(g)) {
|
|
186062
|
-
g !== s && g.__abortController.abort(new Error("replaced"));
|
|
186063
|
-
let { __staleWhileFetching: f } = g;
|
|
186064
|
-
f !== void 0 && f !== t2 && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
186065
|
-
} else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
|
|
186066
|
-
if (this.#x(u4), this.#j(u4, _, r2), this.#t[u4] = t2, !c2) {
|
|
186067
|
-
let f = g && this.#e(g) ? g.__staleWhileFetching : g, y2 = f === void 0 ? "add" : t2 !== f ? "replace" : "update";
|
|
186068
|
-
r2 && (r2.set = y2, f !== void 0 && (r2.oldValue = f)), this.#D && this.onInsert?.(t2, e, y2);
|
|
186069
|
-
}
|
|
186070
|
-
} else c2 || (r2 && (r2.set = "update"), this.#D && this.onInsert?.(t2, e, "update"));
|
|
186071
|
-
}
|
|
186072
|
-
if (n3 !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u4, n3, o), r2 && this.#v(r2, u4)), !l2 && this.#f && this.#r) {
|
|
186073
|
-
let g = this.#r, f;
|
|
186074
|
-
for (; f = g?.shift(); ) this.#w?.(...f);
|
|
186075
|
-
}
|
|
186076
|
-
return this;
|
|
186077
|
-
}
|
|
186078
|
-
pop() {
|
|
186079
|
-
try {
|
|
186080
|
-
for (; this.#n; ) {
|
|
186081
|
-
let e = this.#t[this.#a];
|
|
186082
|
-
if (this.#G(true), this.#e(e)) {
|
|
186083
|
-
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
186084
|
-
} else if (e !== void 0) return e;
|
|
186085
|
-
}
|
|
186086
|
-
} finally {
|
|
186087
|
-
if (this.#f && this.#r) {
|
|
186088
|
-
let e = this.#r, t2;
|
|
186089
|
-
for (; t2 = e?.shift(); ) this.#w?.(...t2);
|
|
186090
|
-
}
|
|
186091
|
-
}
|
|
186092
|
-
}
|
|
186093
|
-
#G(e) {
|
|
186094
|
-
let t2 = this.#a, i2 = this.#i[t2], s = this.#t[t2], n3 = this.#e(s);
|
|
186095
|
-
n3 && s.__abortController.abort(new Error("evicted"));
|
|
186096
|
-
let o = n3 ? s.__staleWhileFetching : s;
|
|
186097
|
-
return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i2, "evict"), this.#f && this.#r?.push([o, i2, "evict"])), this.#x(t2), this.#g?.[t2] && (clearTimeout(this.#g[t2]), this.#g[t2] = void 0), e && (this.#i[t2] = void 0, this.#t[t2] = void 0, this.#y.push(t2)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t2], this.#s.delete(i2), this.#n--, t2;
|
|
186098
|
-
}
|
|
186099
|
-
has(e, t2 = {}) {
|
|
186100
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
186101
|
-
t2.status = i2, i2 && (i2.op = "has", i2.key = e, i2.cache = this);
|
|
186102
|
-
let s = this.#Y(e, t2);
|
|
186103
|
-
return S.hasSubscribers && S.publish(i2), s;
|
|
186104
|
-
}
|
|
186105
|
-
#Y(e, t2 = {}) {
|
|
186106
|
-
let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = t2, n3 = this.#s.get(e);
|
|
186107
|
-
if (n3 !== void 0) {
|
|
186108
|
-
let o = this.#t[n3];
|
|
186109
|
-
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
186110
|
-
if (this.#p(n3)) s && (s.has = "stale", this.#v(s, n3));
|
|
186111
|
-
else return i2 && this.#R(n3), s && (s.has = "hit", this.#v(s, n3)), true;
|
|
186112
|
-
} else s && (s.has = "miss");
|
|
186113
|
-
return false;
|
|
186114
|
-
}
|
|
186115
|
-
peek(e, t2 = {}) {
|
|
186116
|
-
let { status: i2 = R2() ? {} : void 0 } = t2;
|
|
186117
|
-
i2 && (i2.op = "peek", i2.key = e, i2.cache = this), t2.status = i2;
|
|
186118
|
-
let s = this.#J(e, t2);
|
|
186119
|
-
return S.hasSubscribers && S.publish(i2), s;
|
|
186120
|
-
}
|
|
186121
|
-
#J(e, t2) {
|
|
186122
|
-
let { status: i2, allowStale: s = this.allowStale } = t2, n3 = this.#s.get(e);
|
|
186123
|
-
if (n3 === void 0 || !s && this.#p(n3)) {
|
|
186124
|
-
i2 && (i2.peek = n3 === void 0 ? "miss" : "stale");
|
|
186125
|
-
return;
|
|
186126
|
-
}
|
|
186127
|
-
let o = this.#t[n3], l2 = this.#e(o) ? o.__staleWhileFetching : o;
|
|
186128
|
-
return i2 && (l2 !== void 0 ? (i2.peek = "hit", i2.value = l2) : i2.peek = "miss"), l2;
|
|
186129
|
-
}
|
|
186130
|
-
#P(e, t2, i2, s) {
|
|
186131
|
-
let n3 = t2 === void 0 ? void 0 : this.#t[t2];
|
|
186132
|
-
if (this.#e(n3)) return n3;
|
|
186133
|
-
let o = new AbortController(), { signal: l2 } = i2;
|
|
186134
|
-
l2?.addEventListener("abort", () => o.abort(l2.reason), { signal: o.signal });
|
|
186135
|
-
let h2 = { signal: o.signal, options: i2, context: s }, r2 = (f, y2 = false) => {
|
|
186136
|
-
let { aborted: a2 } = o.signal, w = i2.ignoreFetchAbort && f !== void 0, F = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
|
|
186137
|
-
if (i2.status && (a2 && !y2 ? (i2.status.fetchAborted = true, i2.status.fetchError = o.signal.reason, w && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), a2 && !w && !y2) return m(o.signal.reason, F);
|
|
186138
|
-
let b = u4, p = this.#t[t2];
|
|
186139
|
-
return (p === u4 || p === void 0 && w && y2) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t2] = b.__staleWhileFetching : this.#E(e, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.#W(e, f, h2.options, b))), f;
|
|
186140
|
-
}, c2 = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), m(f, false)), m = (f, y2) => {
|
|
186141
|
-
let { aborted: a2 } = o.signal, w = a2 && i2.allowStaleOnFetchAbort, F = w || i2.allowStaleOnFetchRejection, b = F || i2.noDeleteOnFetchRejection, p = u4;
|
|
186142
|
-
if (this.#t[t2] === u4 && (!b || !y2 && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t2] = p.__staleWhileFetching)), F) return i2.status && p.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), p.__staleWhileFetching;
|
|
186143
|
-
if (p.__returned === p) throw f;
|
|
186144
|
-
}, _ = (f, y2) => {
|
|
186145
|
-
let a2 = this.#M?.(e, n3, h2);
|
|
186146
|
-
o.signal.addEventListener("abort", () => {
|
|
186147
|
-
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (w) => r2(w, true)));
|
|
186148
|
-
}), a2 && a2 instanceof Promise ? a2.then((w) => f(w === void 0 ? void 0 : w), y2) : a2 !== void 0 && f(a2);
|
|
186149
|
-
};
|
|
186150
|
-
i2.status && (i2.status.fetchDispatched = true);
|
|
186151
|
-
let u4 = new Promise(_).then(r2, c2), g = Object.assign(u4, { __abortController: o, __staleWhileFetching: n3, __returned: void 0 });
|
|
186152
|
-
return t2 === void 0 ? (this.#W(e, g, { ...h2.options, status: void 0 }), t2 = this.#s.get(e)) : this.#t[t2] = g, g;
|
|
186153
|
-
}
|
|
186154
|
-
#e(e) {
|
|
186155
|
-
if (!this.#U) return false;
|
|
186156
|
-
let t2 = e;
|
|
186157
|
-
return !!t2 && t2 instanceof Promise && t2.hasOwnProperty("__staleWhileFetching") && t2.__abortController instanceof AbortController;
|
|
186158
|
-
}
|
|
186159
|
-
fetch(e, t2 = {}) {
|
|
186160
|
-
let i2 = W2.hasSubscribers, { status: s = R2() ? {} : void 0 } = t2;
|
|
186161
|
-
t2.status = s, s && t2.context && (s.context = t2.context);
|
|
186162
|
-
let n3 = this.#B(e, t2);
|
|
186163
|
-
return s && i2 && (s.trace = true, W2.tracePromise(() => n3, s).catch(() => {
|
|
186164
|
-
})), n3;
|
|
186165
|
-
}
|
|
186166
|
-
async #B(e, t2 = {}) {
|
|
186167
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n3 = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l2 = this.noDisposeOnSet, size: h2 = 0, sizeCalculation: r2 = this.sizeCalculation, noUpdateTTL: c2 = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u4 = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y2 = false, status: a2, signal: w } = t2;
|
|
186168
|
-
if (a2 && (a2.op = "fetch", a2.key = e, y2 && (a2.forceRefresh = true), a2.cache = this), !this.#U) return a2 && (a2.fetch = "get"), this.#C(e, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n3, status: a2 });
|
|
186169
|
-
let F = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n3, ttl: o, noDisposeOnSet: l2, size: h2, sizeCalculation: r2, noUpdateTTL: c2, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u4, status: a2, signal: w }, b = this.#s.get(e);
|
|
186170
|
-
if (b === void 0) {
|
|
186171
|
-
a2 && (a2.fetch = "miss");
|
|
186172
|
-
let p = this.#P(e, b, F, f);
|
|
186173
|
-
return p.__returned = p;
|
|
186174
|
-
} else {
|
|
186175
|
-
let p = this.#t[b];
|
|
186176
|
-
if (this.#e(p)) {
|
|
186177
|
-
let v = i2 && p.__staleWhileFetching !== void 0;
|
|
186178
|
-
return a2 && (a2.fetch = "inflight", v && (a2.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
|
|
186179
|
-
}
|
|
186180
|
-
let A = this.#p(b);
|
|
186181
|
-
if (!y2 && !A) return a2 && (a2.fetch = "hit"), this.#L(b), s && this.#R(b), a2 && this.#v(a2, b), p;
|
|
186182
|
-
let z2 = this.#P(e, b, F, f), E = z2.__staleWhileFetching !== void 0 && i2;
|
|
186183
|
-
return a2 && (a2.fetch = A ? "stale" : "refresh", E && A && (a2.returnedStale = true)), E ? z2.__staleWhileFetching : z2.__returned = z2;
|
|
186184
|
-
}
|
|
186185
|
-
}
|
|
186186
|
-
forceFetch(e, t2 = {}) {
|
|
186187
|
-
let i2 = W2.hasSubscribers, { status: s = R2() ? {} : void 0 } = t2;
|
|
186188
|
-
t2.status = s, s && t2.context && (s.context = t2.context);
|
|
186189
|
-
let n3 = this.#K(e, t2);
|
|
186190
|
-
return s && i2 && (s.trace = true, W2.tracePromise(() => n3, s).catch(() => {
|
|
186191
|
-
})), n3;
|
|
186192
|
-
}
|
|
186193
|
-
async #K(e, t2 = {}) {
|
|
186194
|
-
let i2 = await this.#B(e, t2);
|
|
186195
|
-
if (i2 === void 0) throw new Error("fetch() returned undefined");
|
|
186196
|
-
return i2;
|
|
186197
|
-
}
|
|
186198
|
-
memo(e, t2 = {}) {
|
|
186199
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
186200
|
-
t2.status = i2, i2 && (i2.op = "memo", i2.key = e, t2.context && (i2.context = t2.context), i2.cache = this);
|
|
186201
|
-
let s = this.#Q(e, t2);
|
|
186202
|
-
return i2 && (i2.value = s), S.hasSubscribers && S.publish(i2), s;
|
|
186203
|
-
}
|
|
186204
|
-
#Q(e, t2 = {}) {
|
|
186205
|
-
let i2 = this.#I;
|
|
186206
|
-
if (!i2) throw new Error("no memoMethod provided to constructor");
|
|
186207
|
-
let { context: s, status: n3, forceRefresh: o, ...l2 } = t2;
|
|
186208
|
-
n3 && o && (n3.forceRefresh = true);
|
|
186209
|
-
let h2 = this.#C(e, l2), r2 = o || h2 === void 0;
|
|
186210
|
-
if (n3 && (n3.memo = r2 ? "miss" : "hit", r2 || (n3.value = h2)), !r2) return h2;
|
|
186211
|
-
let c2 = i2(e, h2, { options: l2, context: s });
|
|
186212
|
-
return n3 && (n3.value = c2), this.#W(e, c2, l2), c2;
|
|
186213
|
-
}
|
|
186214
|
-
get(e, t2 = {}) {
|
|
186215
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t2;
|
|
186216
|
-
t2.status = i2, i2 && (i2.op = "get", i2.key = e, i2.cache = this);
|
|
186217
|
-
let s = this.#C(e, t2);
|
|
186218
|
-
return i2 && (s !== void 0 && (i2.value = s), S.hasSubscribers && S.publish(i2)), s;
|
|
186219
|
-
}
|
|
186220
|
-
#C(e, t2 = {}) {
|
|
186221
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n3 = this.noDeleteOnStaleGet, status: o } = t2, l2 = this.#s.get(e);
|
|
186222
|
-
if (l2 === void 0) {
|
|
186223
|
-
o && (o.get = "miss");
|
|
186224
|
-
return;
|
|
186225
|
-
}
|
|
186226
|
-
let h2 = this.#t[l2], r2 = this.#e(h2);
|
|
186227
|
-
return o && this.#v(o, l2), this.#p(l2) ? r2 ? (o && (o.get = "stale-fetching"), i2 && h2.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h2.__staleWhileFetching) : void 0) : (n3 || this.#E(e, "expire"), o && (o.get = "stale"), i2 ? (o && (o.returnedStale = true), h2) : void 0) : (o && (o.get = r2 ? "fetching" : "hit"), this.#L(l2), s && this.#R(l2), r2 ? h2.__staleWhileFetching : h2);
|
|
186228
|
-
}
|
|
186229
|
-
#$(e, t2) {
|
|
186230
|
-
this.#u[t2] = e, this.#l[e] = t2;
|
|
186231
|
-
}
|
|
186232
|
-
#L(e) {
|
|
186233
|
-
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);
|
|
186234
|
-
}
|
|
186235
|
-
delete(e) {
|
|
186236
|
-
return this.#E(e, "delete");
|
|
186237
|
-
}
|
|
186238
|
-
#E(e, t2) {
|
|
186239
|
-
S.hasSubscribers && S.publish({ op: "delete", delete: t2, key: e, cache: this });
|
|
186240
|
-
let i2 = false;
|
|
186241
|
-
if (this.#n !== 0) {
|
|
186242
|
-
let s = this.#s.get(e);
|
|
186243
|
-
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i2 = true, this.#n === 1) this.#q(t2);
|
|
186244
|
-
else {
|
|
186245
|
-
this.#x(s);
|
|
186246
|
-
let n3 = this.#t[s];
|
|
186247
|
-
if (this.#e(n3) ? n3.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n3, e, t2), this.#f && this.#r?.push([n3, e, t2])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
186248
|
-
else if (s === this.#a) this.#a = this.#l[s];
|
|
186249
|
-
else {
|
|
186250
|
-
let o = this.#u[s];
|
|
186251
|
-
this.#l[o] = this.#l[s];
|
|
186252
|
-
let l2 = this.#l[s];
|
|
186253
|
-
this.#u[l2] = this.#u[s];
|
|
186254
|
-
}
|
|
186255
|
-
this.#n--, this.#y.push(s);
|
|
186256
|
-
}
|
|
186257
|
-
}
|
|
186258
|
-
if (this.#f && this.#r?.length) {
|
|
186259
|
-
let s = this.#r, n3;
|
|
186260
|
-
for (; n3 = s?.shift(); ) this.#w?.(...n3);
|
|
186261
|
-
}
|
|
186262
|
-
return i2;
|
|
186263
|
-
}
|
|
186264
|
-
clear() {
|
|
186265
|
-
return this.#q("delete");
|
|
186266
|
-
}
|
|
186267
|
-
#q(e) {
|
|
186268
|
-
for (let t2 of this.#z({ allowStale: true })) {
|
|
186269
|
-
let i2 = this.#t[t2];
|
|
186270
|
-
if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
|
|
186271
|
-
else {
|
|
186272
|
-
let s = this.#i[t2];
|
|
186273
|
-
this.#T && this.#S?.(i2, s, e), this.#f && this.#r?.push([i2, s, e]);
|
|
186274
|
-
}
|
|
186275
|
-
}
|
|
186276
|
-
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
186277
|
-
this.#d.fill(0), this.#F.fill(0);
|
|
186278
|
-
for (let t2 of this.#g ?? []) t2 !== void 0 && clearTimeout(t2);
|
|
186279
|
-
this.#g?.fill(void 0);
|
|
186280
|
-
}
|
|
186281
|
-
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) {
|
|
186282
|
-
let t2 = this.#r, i2;
|
|
186283
|
-
for (; i2 = t2?.shift(); ) this.#w?.(...i2);
|
|
186284
|
-
}
|
|
186285
|
-
}
|
|
186286
|
-
};
|
|
186287
|
-
|
|
186288
|
-
// yes/index.ts
|
|
186289
|
-
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
186290
|
-
var VOID_KEY = "~void";
|
|
186291
|
-
function getCacheKeyString(value2) {
|
|
186292
|
-
if (value2 === void 0) return VOID_KEY;
|
|
186293
|
-
if (value2 === null) {
|
|
186294
|
-
throw new Error("cache key cannot be null");
|
|
186295
|
-
}
|
|
186296
|
-
try {
|
|
186297
|
-
if (typeof value2 === "string") return value2;
|
|
186298
|
-
return (0, import_object_hash.default)(value2, { unorderedObjects: true, unorderedArrays: true });
|
|
186299
|
-
} catch (error49) {
|
|
186300
|
-
throw new Error(
|
|
186301
|
-
`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`
|
|
186302
|
-
);
|
|
186303
|
-
}
|
|
186304
|
-
}
|
|
186305
|
-
function jitter(delayMs) {
|
|
186306
|
-
const half = delayMs / 2;
|
|
186307
|
-
return Math.round(half + Math.random() * half);
|
|
186308
|
-
}
|
|
186309
|
-
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
186310
|
-
function getErrorResponseHeaders(error49) {
|
|
186311
|
-
if (error49 === null || typeof error49 !== "object") return void 0;
|
|
186312
|
-
const source = error49;
|
|
186313
|
-
const headers = source.response?.headers ?? source.headers;
|
|
186314
|
-
if (headers === null || typeof headers !== "object") return void 0;
|
|
186315
|
-
return headers;
|
|
186316
|
-
}
|
|
186317
|
-
function retryAfterMs(error49) {
|
|
186318
|
-
const headers = getErrorResponseHeaders(error49);
|
|
186319
|
-
if (!headers) return void 0;
|
|
186320
|
-
const retryAfter = headers["retry-after"];
|
|
186321
|
-
if (typeof retryAfter === "string" && retryAfter.trim() !== "") {
|
|
186322
|
-
const seconds = Number(retryAfter);
|
|
186323
|
-
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
186324
|
-
const dateMs = Date.parse(retryAfter);
|
|
186325
|
-
if (!Number.isNaN(dateMs)) return Math.max(0, dateMs - Date.now());
|
|
186326
|
-
}
|
|
186327
|
-
if (headers["x-ratelimit-remaining"] === "0") {
|
|
186328
|
-
const reset = headers["x-ratelimit-reset"];
|
|
186329
|
-
if (typeof reset === "string" && reset.trim() !== "") {
|
|
186330
|
-
const resetEpoch = Number(reset);
|
|
186331
|
-
if (Number.isFinite(resetEpoch)) return Math.max(0, resetEpoch * 1e3 - Date.now());
|
|
186332
|
-
}
|
|
186333
|
-
}
|
|
186334
|
-
return void 0;
|
|
186335
|
-
}
|
|
186336
|
-
function validateSchema(schema2, value2) {
|
|
186337
|
-
const result = schema2["~standard"].validate(value2);
|
|
186338
|
-
if (result instanceof Promise) {
|
|
186339
|
-
return result.then((res) => {
|
|
186340
|
-
if (res.issues) {
|
|
186341
|
-
const messages = res.issues.map((i2) => i2.message).join(", ");
|
|
186342
|
-
throw new Error(`validation failed: ${messages}`);
|
|
186343
|
-
}
|
|
186344
|
-
return res.value;
|
|
186345
|
-
});
|
|
186346
|
-
}
|
|
186347
|
-
if (result.issues) {
|
|
186348
|
-
const messages = result.issues.map((i2) => i2.message).join(", ");
|
|
186349
|
-
throw new Error(`validation failed: ${messages}`);
|
|
186350
|
-
}
|
|
186351
|
-
return result.value;
|
|
186352
|
-
}
|
|
186353
|
-
var log3 = {
|
|
186354
|
-
info: (...args2) => console.log(...args2),
|
|
186355
|
-
error: (...args2) => console.error(...args2),
|
|
186356
|
-
debug: (...args2) => {
|
|
186357
|
-
if (process.env.LOG_LEVEL === "debug") console.log(...args2);
|
|
186358
|
-
},
|
|
186359
|
-
prod: (...args2) => {
|
|
186360
|
-
if (process.env.NODE_ENV === "production") console.log(...args2);
|
|
186361
|
-
}
|
|
186362
|
-
};
|
|
186363
|
-
function op(fnOrOptions, options) {
|
|
186364
|
-
if (typeof fnOrOptions === "function") {
|
|
186365
|
-
return _op(fnOrOptions, options ?? {});
|
|
186366
|
-
}
|
|
186367
|
-
const { input: inputSchema, output: outputSchema, run: run4, ...opOptions } = fnOrOptions;
|
|
186368
|
-
const wrappedFn = async (rawInput, ctx) => {
|
|
186369
|
-
let input = rawInput;
|
|
186370
|
-
if (inputSchema) {
|
|
186371
|
-
const validated = validateSchema(inputSchema, rawInput);
|
|
186372
|
-
input = validated instanceof Promise ? await validated : validated;
|
|
186373
|
-
}
|
|
186374
|
-
const result = await run4(input, ctx);
|
|
186375
|
-
if (outputSchema) {
|
|
186376
|
-
const validated = validateSchema(outputSchema, result);
|
|
186377
|
-
return validated instanceof Promise ? await validated : validated;
|
|
186378
|
-
}
|
|
186379
|
-
return result;
|
|
186380
|
-
};
|
|
186381
|
-
return _op(wrappedFn, opOptions);
|
|
186382
|
-
}
|
|
186383
|
-
function _op(fn2, options) {
|
|
186384
|
-
const shouldCache = options.ttl !== void 0;
|
|
186385
|
-
const lruCache = shouldCache ? new I2({
|
|
186386
|
-
max: options.maxItems ?? 1e3,
|
|
186387
|
-
ttl: options.ttl
|
|
186388
|
-
}) : null;
|
|
186389
|
-
const keyMap = shouldCache ? new I2({
|
|
186390
|
-
max: options.maxItems ?? 1e3,
|
|
186391
|
-
ttl: options.ttl
|
|
186392
|
-
}) : null;
|
|
186393
|
-
const inFlightPromises = /* @__PURE__ */ new Map();
|
|
186394
|
-
const namePrefix = options.name ? `[${options.name}] ` : "";
|
|
186395
|
-
const defaultCacheHit = options.cacheHit === null ? () => {
|
|
186396
|
-
} : options.cacheHit ?? (() => {
|
|
186397
|
-
if (options.name && shouldCache) log3.prod(`${namePrefix}cache hit`);
|
|
186398
|
-
});
|
|
186399
|
-
const defaultCacheMiss = options.cacheMiss === null ? () => {
|
|
186400
|
-
} : options.cacheMiss ?? (() => {
|
|
186401
|
-
if (options.name && shouldCache) log3.prod(`${namePrefix}cache miss`);
|
|
186402
|
-
});
|
|
186403
|
-
const acceptsCtx = fn2.length === 2;
|
|
186404
|
-
const cachedFn = async (input, ctx) => {
|
|
186405
|
-
let key;
|
|
186406
|
-
try {
|
|
186407
|
-
key = getCacheKeyString(input);
|
|
186408
|
-
} catch (error49) {
|
|
186409
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
186410
|
-
throw new Error(
|
|
186411
|
-
`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`
|
|
186412
|
-
);
|
|
186413
|
-
}
|
|
186414
|
-
const startTime = performance8.now();
|
|
186415
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
186416
|
-
log3.debug(`${namePrefix}[${timestamp}] cache lookup started`, { key });
|
|
186417
|
-
if (shouldCache && lruCache) {
|
|
186418
|
-
const cached4 = lruCache.get(key);
|
|
186419
|
-
if (cached4 !== void 0) {
|
|
186420
|
-
if (keyMap?.get(key) === void 0) keyMap?.set(key, input);
|
|
186421
|
-
const runtime = performance8.now() - startTime;
|
|
186422
|
-
log3.debug(`${namePrefix}[${timestamp}] cache hit (from lru)`, {
|
|
186423
|
-
key,
|
|
186424
|
-
runtime: `${Math.round(runtime)}ms`
|
|
186425
|
-
});
|
|
186426
|
-
defaultCacheHit(key);
|
|
186427
|
-
return cached4;
|
|
186428
|
-
}
|
|
186429
|
-
}
|
|
186430
|
-
const inFlight = inFlightPromises.get(key);
|
|
186431
|
-
if (inFlight) {
|
|
186432
|
-
log3.debug(`${namePrefix}[${timestamp}] cache hit (in-flight)`, { key });
|
|
186433
|
-
defaultCacheHit(key);
|
|
186434
|
-
return inFlight;
|
|
186435
|
-
}
|
|
186436
|
-
log3.debug(`${namePrefix}[${timestamp}] cache miss, executing function`, { key });
|
|
186437
|
-
defaultCacheMiss(key);
|
|
186438
|
-
const retries = options.retries ?? [];
|
|
186439
|
-
let lastError;
|
|
186440
|
-
const execStartTime = performance8.now();
|
|
186441
|
-
const promise2 = (async () => {
|
|
186442
|
-
for (let attempt = 0; attempt <= retries.length; attempt++) {
|
|
186443
|
-
try {
|
|
186444
|
-
const result = acceptsCtx ? await fn2(input, ctx) : await fn2(input);
|
|
186445
|
-
const execRuntime2 = performance8.now() - execStartTime;
|
|
186446
|
-
const skip = options.skipCache ? options.skipCache(result) : false;
|
|
186447
|
-
if (shouldCache && lruCache && result !== null && result !== void 0 && !skip) {
|
|
186448
|
-
lruCache.set(key, result);
|
|
186449
|
-
keyMap?.set(key, input);
|
|
186450
|
-
}
|
|
186451
|
-
log3.debug(`${namePrefix}[${timestamp}] function executed successfully`, {
|
|
186452
|
-
key,
|
|
186453
|
-
runtime: `${Math.round(execRuntime2)}ms`,
|
|
186454
|
-
attempt: attempt + 1,
|
|
186455
|
-
cached: shouldCache && result !== null && result !== void 0 && !skip
|
|
186456
|
-
});
|
|
186457
|
-
return result;
|
|
186458
|
-
} catch (error49) {
|
|
186459
|
-
if (options.bail?.(error49)) throw error49;
|
|
186460
|
-
lastError = error49;
|
|
186461
|
-
const isLastAttempt = attempt >= retries.length;
|
|
186462
|
-
if (isLastAttempt) {
|
|
186463
|
-
if (namePrefix) {
|
|
186464
|
-
log3.info(
|
|
186465
|
-
`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`
|
|
186466
|
-
);
|
|
186467
|
-
log3.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
186468
|
-
} else {
|
|
186469
|
-
log3.info(`attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
186470
|
-
log3.info({ key, error: error49, attempt });
|
|
186471
|
-
}
|
|
186472
|
-
} else {
|
|
186473
|
-
let delay2 = retries[attempt];
|
|
186474
|
-
if (options.retryAfter) {
|
|
186475
|
-
const extract = options.retryAfter === true ? retryAfterMs : options.retryAfter;
|
|
186476
|
-
const hint = extract(error49);
|
|
186477
|
-
if (hint !== void 0) {
|
|
186478
|
-
const cap = options.retryAfterCap ?? DEFAULT_RETRY_AFTER_CAP_MS;
|
|
186479
|
-
delay2 = Math.max(delay2, Math.min(cap, hint));
|
|
186480
|
-
}
|
|
186481
|
-
}
|
|
186482
|
-
delay2 = jitter(delay2);
|
|
186483
|
-
if (namePrefix) {
|
|
186484
|
-
log3.info(
|
|
186485
|
-
`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`
|
|
186486
|
-
);
|
|
186487
|
-
log3.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
186488
|
-
} else {
|
|
186489
|
-
log3.info(
|
|
186490
|
-
`attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`
|
|
186491
|
-
);
|
|
186492
|
-
log3.info({ key, error: error49, attempt });
|
|
186493
|
-
}
|
|
186494
|
-
await sleep3(delay2);
|
|
186495
|
-
}
|
|
186496
|
-
}
|
|
186497
|
-
}
|
|
186498
|
-
const execRuntime = performance8.now() - execStartTime;
|
|
186499
|
-
log3.debug(`${namePrefix}[${timestamp}] function failed after all retries`, {
|
|
186500
|
-
key,
|
|
186501
|
-
runtime: `${Math.round(execRuntime)}ms`,
|
|
186502
|
-
attempts: retries.length + 1,
|
|
186503
|
-
error: lastError instanceof Error ? lastError.message : lastError
|
|
186504
|
-
});
|
|
186505
|
-
throw lastError;
|
|
186506
|
-
})();
|
|
186507
|
-
inFlightPromises.set(key, promise2);
|
|
186508
|
-
try {
|
|
186509
|
-
return await promise2;
|
|
186510
|
-
} finally {
|
|
186511
|
-
inFlightPromises.delete(key);
|
|
186512
|
-
}
|
|
186513
|
-
};
|
|
186514
|
-
cachedFn.clear = (key) => {
|
|
186515
|
-
if (shouldCache && lruCache) {
|
|
186516
|
-
if (key !== void 0) {
|
|
186517
|
-
let stringKey;
|
|
186518
|
-
try {
|
|
186519
|
-
stringKey = getCacheKeyString(key);
|
|
186520
|
-
} catch (error49) {
|
|
186521
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
186522
|
-
throw new Error(
|
|
186523
|
-
`failed to hash cache key for clear()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`
|
|
186524
|
-
);
|
|
186525
|
-
}
|
|
186526
|
-
lruCache.delete(stringKey);
|
|
186527
|
-
keyMap.delete(stringKey);
|
|
186528
|
-
} else {
|
|
186529
|
-
lruCache.clear();
|
|
186530
|
-
keyMap.clear();
|
|
186531
|
-
}
|
|
186532
|
-
}
|
|
186533
|
-
};
|
|
186534
|
-
cachedFn.has = (key) => {
|
|
186535
|
-
if (!shouldCache || !lruCache) return false;
|
|
186536
|
-
try {
|
|
186537
|
-
const stringKey = getCacheKeyString(key);
|
|
186538
|
-
return lruCache.has(stringKey);
|
|
186539
|
-
} catch (error49) {
|
|
186540
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
186541
|
-
throw new Error(
|
|
186542
|
-
`failed to hash cache key for has()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`
|
|
186543
|
-
);
|
|
186544
|
-
}
|
|
186545
|
-
};
|
|
186546
|
-
cachedFn.invalidate = (predicate) => {
|
|
186547
|
-
if (!shouldCache || !lruCache) return 0;
|
|
186548
|
-
let count = 0;
|
|
186549
|
-
for (const [stringKey, originalKey] of keyMap) {
|
|
186550
|
-
if (predicate(originalKey)) {
|
|
186551
|
-
lruCache.delete(stringKey);
|
|
186552
|
-
keyMap.delete(stringKey);
|
|
186553
|
-
count++;
|
|
186554
|
-
}
|
|
186555
|
-
}
|
|
186556
|
-
return count;
|
|
186557
|
-
};
|
|
186558
|
-
return cachedFn;
|
|
186559
|
-
}
|
|
186560
|
-
|
|
186561
186387
|
// mcp/git.ts
|
|
186562
186388
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
186563
186389
|
import { writeFileSync as writeFileSync10 } from "node:fs";
|
|
@@ -191337,7 +191163,7 @@ async function acquireNewToken(opts) {
|
|
|
191337
191163
|
return await op(() => acquireTokenViaOIDC(opts), {
|
|
191338
191164
|
name: "token exchange",
|
|
191339
191165
|
retries: [1e3, 2e3],
|
|
191340
|
-
|
|
191166
|
+
rethrow: (error49) => !isTransientTokenError(error49)
|
|
191341
191167
|
})();
|
|
191342
191168
|
}
|
|
191343
191169
|
if (process.env.GITHUB_ACTIONS === "true") {
|
|
@@ -192464,7 +192290,7 @@ async function patchWorkflowRunFields(ctx, fields) {
|
|
|
192464
192290
|
name: "patchWorkflowRunFields",
|
|
192465
192291
|
// only retry transient network errors; explicit HTTP failures throw
|
|
192466
192292
|
// a status-bearing message and should fail fast.
|
|
192467
|
-
|
|
192293
|
+
rethrow: (error49) => !isTransientNetworkError(error49)
|
|
192468
192294
|
}
|
|
192469
192295
|
)();
|
|
192470
192296
|
} catch (error49) {
|
|
@@ -193305,7 +193131,7 @@ function CreatePullRequestReviewTool(ctx) {
|
|
|
193305
193131
|
}) : createReviewWithStrandedRecovery(ctx, params),
|
|
193306
193132
|
{
|
|
193307
193133
|
retries: TRANSIENT_REVIEW_RETRY_DELAYS_MS,
|
|
193308
|
-
|
|
193134
|
+
rethrow: (err) => !isTransientReviewError(err),
|
|
193309
193135
|
name: "review submission"
|
|
193310
193136
|
}
|
|
193311
193137
|
)();
|
|
@@ -194000,7 +193826,7 @@ async function checkoutPrBranch(pr, params) {
|
|
|
194000
193826
|
{
|
|
194001
193827
|
retries: PULL_REF_RETRY_DELAYS_MS,
|
|
194002
193828
|
name: `pull/${pr.number}/head fetch`,
|
|
194003
|
-
|
|
193829
|
+
rethrow: (e) => !PULL_REF_MISSING_PATTERN.test(e instanceof Error ? e.message : String(e))
|
|
194004
193830
|
}
|
|
194005
193831
|
)();
|
|
194006
193832
|
$("git", ["checkout", localBranch], { log: false });
|
|
@@ -194679,7 +194505,7 @@ function ReopenCurrentTool(ctx) {
|
|
|
194679
194505
|
}
|
|
194680
194506
|
|
|
194681
194507
|
// prep/index.ts
|
|
194682
|
-
import { performance as
|
|
194508
|
+
import { performance as performance8 } from "node:perf_hooks";
|
|
194683
194509
|
|
|
194684
194510
|
// prep/installNodeDependencies.ts
|
|
194685
194511
|
import { existsSync as existsSync10 } from "node:fs";
|
|
@@ -195138,7 +194964,7 @@ var installPythonDependencies = {
|
|
|
195138
194964
|
var prepSteps = [installNodeDependencies, installPythonDependencies];
|
|
195139
194965
|
async function runPrepPhase(options) {
|
|
195140
194966
|
log2.debug("\xBB starting prep phase...");
|
|
195141
|
-
const startTime =
|
|
194967
|
+
const startTime = performance8.now();
|
|
195142
194968
|
const results = [];
|
|
195143
194969
|
const preDirty = await dirtyTrackedPaths();
|
|
195144
194970
|
try {
|
|
@@ -195160,7 +194986,7 @@ async function runPrepPhase(options) {
|
|
|
195160
194986
|
} finally {
|
|
195161
194987
|
await restoreDirtiedSince({ before: preDirty, actor: "prep" });
|
|
195162
194988
|
}
|
|
195163
|
-
const totalDurationMs =
|
|
194989
|
+
const totalDurationMs = performance8.now() - startTime;
|
|
195164
194990
|
log2.debug(`\xBB prep phase completed (${Math.round(totalDurationMs)}ms)`);
|
|
195165
194991
|
return results;
|
|
195166
194992
|
}
|
|
@@ -197399,10 +197225,12 @@ function buildMissingApiKeyError(params) {
|
|
|
197399
197225
|
const [primary, ...alternates] = envVars;
|
|
197400
197226
|
const envVarList = primary ? `\`${primary}\`${alternates.length > 0 ? ` (or ${alternates.map((v) => `\`${v}\``).join(" / ")})` : ""}` : void 0;
|
|
197401
197227
|
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.`;
|
|
197228
|
+
const unhosted = params.model?.includes("/") ? getModelManagedCredentials(params.model).find((name) => unhostedSubscriptions.has(name)) : void 0;
|
|
197229
|
+
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).";
|
|
197402
197230
|
return [
|
|
197403
197231
|
lead,
|
|
197404
197232
|
"",
|
|
197405
|
-
|
|
197233
|
+
fix,
|
|
197406
197234
|
"",
|
|
197407
197235
|
`[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)`
|
|
197408
197236
|
].join("\n");
|
|
@@ -198316,7 +198144,7 @@ var select2 = op(
|
|
|
198316
198144
|
},
|
|
198317
198145
|
{
|
|
198318
198146
|
retries: [250, 1e3],
|
|
198319
|
-
|
|
198147
|
+
rethrow: (error49) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500
|
|
198320
198148
|
}
|
|
198321
198149
|
);
|
|
198322
198150
|
function subscriptionForModel(model) {
|
|
@@ -199769,7 +199597,7 @@ async function mintProxyKey(ctx) {
|
|
|
199769
199597
|
{
|
|
199770
199598
|
name: "proxy key mint",
|
|
199771
199599
|
retries: [1e3, 2e3],
|
|
199772
|
-
|
|
199600
|
+
rethrow: (error49) => !(error49 instanceof TransientError)
|
|
199773
199601
|
}
|
|
199774
199602
|
)();
|
|
199775
199603
|
if (response.status === 402) {
|
|
@@ -199807,7 +199635,7 @@ async function buildProxyTokenHeaders(ctx) {
|
|
|
199807
199635
|
const oidcToken = await op(() => fetchIdTokenFromStash(creds), {
|
|
199808
199636
|
name: "ID token mint",
|
|
199809
199637
|
retries: [1e3, 2e3],
|
|
199810
|
-
|
|
199638
|
+
rethrow: (error49) => !isTransientTokenError(error49)
|
|
199811
199639
|
})();
|
|
199812
199640
|
return {
|
|
199813
199641
|
Authorization: `Bearer ${oidcToken}`,
|
|
@@ -200176,7 +200004,7 @@ async function resolveRunContextData(params) {
|
|
|
200176
200004
|
op(() => params.octokit.repos.get({ owner: repoContext.owner, repo: repoContext.name }), {
|
|
200177
200005
|
name: "repos.get",
|
|
200178
200006
|
retries: [100, 500],
|
|
200179
|
-
|
|
200007
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
200180
200008
|
})(),
|
|
200181
200009
|
fetchRunContext({
|
|
200182
200010
|
token: params.token,
|
|
@@ -200727,7 +200555,7 @@ async function autoMergeAfterApprove(ctx) {
|
|
|
200727
200555
|
{
|
|
200728
200556
|
name: "enablePullRequestAutoMerge",
|
|
200729
200557
|
retries: [500, 2e3],
|
|
200730
|
-
|
|
200558
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
200731
200559
|
}
|
|
200732
200560
|
)();
|
|
200733
200561
|
log2.info(`autoMerge: pr=#${pullNumber} @ ${headSha.slice(0, 7)} \u2192 native auto-merge enabled`);
|
|
@@ -200831,7 +200659,7 @@ async function dispatchFollowUpReReview(ctx, reviewedSha) {
|
|
|
200831
200659
|
{
|
|
200832
200660
|
name: "reReviewDispatch",
|
|
200833
200661
|
retries: [500, 2e3],
|
|
200834
|
-
|
|
200662
|
+
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
200835
200663
|
}
|
|
200836
200664
|
)();
|
|
200837
200665
|
}
|
|
@@ -202479,7 +202307,7 @@ function resolveTarget2(repo) {
|
|
|
202479
202307
|
return { owner: match3[1], repo: match3[2] };
|
|
202480
202308
|
}
|
|
202481
202309
|
function cliVersion() {
|
|
202482
|
-
const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.
|
|
202310
|
+
const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.95");
|
|
202483
202311
|
if (!parts) return "0.0.0";
|
|
202484
202312
|
return `${Number(parts[1])}.${Number(parts[2])}.${Number(parts[3])}`;
|
|
202485
202313
|
}
|
|
@@ -202628,7 +202456,7 @@ async function runCli8(input) {
|
|
|
202628
202456
|
const poll = op(pollPrEvents, {
|
|
202629
202457
|
name: "pr-events poll",
|
|
202630
202458
|
retries: [1e3, 2e3, 5e3, 1e4, 15e3],
|
|
202631
|
-
|
|
202459
|
+
rethrow: isTerminal2
|
|
202632
202460
|
});
|
|
202633
202461
|
for (; ; ) {
|
|
202634
202462
|
try {
|
|
@@ -202646,7 +202474,7 @@ async function runCli8(input) {
|
|
|
202646
202474
|
}
|
|
202647
202475
|
|
|
202648
202476
|
// cli.ts
|
|
202649
|
-
var VERSION10 = "0.1.
|
|
202477
|
+
var VERSION10 = "0.1.95";
|
|
202650
202478
|
var bin = basename2(process.argv[1] || "");
|
|
202651
202479
|
var PROG = bin === "pf" || bin === "pullfrog" ? bin : "pullfrog";
|
|
202652
202480
|
var rawArgs = process.argv.slice(2);
|