pullfrog 0.1.94 → 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/index.js CHANGED
@@ -3682,7 +3682,7 @@ var require_util2 = __commonJS({
3682
3682
  "use strict";
3683
3683
  var { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = require_constants2();
3684
3684
  var { getGlobalOrigin } = require_global();
3685
- var { performance: performance10 } = __require("perf_hooks");
3685
+ var { performance: performance9 } = __require("perf_hooks");
3686
3686
  var { isBlobLike, toUSVString, ReadableStreamFrom } = require_util();
3687
3687
  var assert3 = __require("assert");
3688
3688
  var { isUint8Array } = __require("util/types");
@@ -3845,7 +3845,7 @@ var require_util2 = __commonJS({
3845
3845
  }
3846
3846
  }
3847
3847
  function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
3848
- return performance10.now();
3848
+ return performance9.now();
3849
3849
  }
3850
3850
  function createOpaqueTimingInfo(timingInfo) {
3851
3851
  return {
@@ -45129,7 +45129,7 @@ var require_util9 = __commonJS({
45129
45129
  var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants9();
45130
45130
  var { getGlobalOrigin } = require_global3();
45131
45131
  var { collectAnHTTPQuotedString, parseMIMEType } = require_data_url();
45132
- var { performance: performance10 } = __require("node:perf_hooks");
45132
+ var { performance: performance9 } = __require("node:perf_hooks");
45133
45133
  var { ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util8();
45134
45134
  var assert3 = __require("node:assert");
45135
45135
  var { isUint8Array } = __require("node:util/types");
@@ -45284,7 +45284,7 @@ var require_util9 = __commonJS({
45284
45284
  };
45285
45285
  }
45286
45286
  function coarsenedSharedCurrentTime(crossOriginIsolatedCapability) {
45287
- return coarsenTime(performance10.now(), crossOriginIsolatedCapability);
45287
+ return coarsenTime(performance9.now(), crossOriginIsolatedCapability);
45288
45288
  }
45289
45289
  function createOpaqueTimingInfo(timingInfo) {
45290
45290
  return {
@@ -75565,7 +75565,7 @@ var require_fast_uri = __commonJS({
75565
75565
  normalizeString(uri, options);
75566
75566
  } else if (typeof uri === "object") {
75567
75567
  uri = /** @type {T} */
75568
- parse6(serialize(uri, options), options);
75568
+ parse6(serialize2(uri, options), options);
75569
75569
  }
75570
75570
  return uri;
75571
75571
  }
@@ -75600,13 +75600,13 @@ var require_fast_uri = __commonJS({
75600
75600
  throw new Error(resolved.error);
75601
75601
  }
75602
75602
  schemelessOptions.skipEscape = true;
75603
- return serialize(resolved, schemelessOptions);
75603
+ return serialize2(resolved, schemelessOptions);
75604
75604
  }
75605
75605
  function resolveComponent(base, relative, options, skipNormalization) {
75606
75606
  const target = {};
75607
75607
  if (!skipNormalization) {
75608
- base = parse6(serialize(base, options), options);
75609
- relative = parse6(serialize(relative, options), options);
75608
+ base = parse6(serialize2(base, options), options);
75609
+ relative = parse6(serialize2(relative, options), options);
75610
75610
  }
75611
75611
  options = options || {};
75612
75612
  if (!options.tolerant && relative.scheme) {
@@ -75660,7 +75660,7 @@ var require_fast_uri = __commonJS({
75660
75660
  const normalizedB = normalizeComparableURI(uriB, options);
75661
75661
  return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
75662
75662
  }
75663
- function serialize(cmpts, opts) {
75663
+ function serialize2(cmpts, opts) {
75664
75664
  const component = {
75665
75665
  host: cmpts.host,
75666
75666
  scheme: cmpts.scheme,
@@ -75914,7 +75914,7 @@ var require_fast_uri = __commonJS({
75914
75914
  function normalizeStringWithStatus(uri, opts) {
75915
75915
  const { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
75916
75916
  return {
75917
- normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed2, opts),
75917
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize2(parsed2, opts),
75918
75918
  malformedAuthorityOrPort,
75919
75919
  malformedPercentEncoding,
75920
75920
  malformedSchemeSpecific,
@@ -75928,7 +75928,7 @@ var require_fast_uri = __commonJS({
75928
75928
  }
75929
75929
  let value2;
75930
75930
  try {
75931
- value2 = typeof uri === "string" ? uri : serialize(uri, opts);
75931
+ value2 = typeof uri === "string" ? uri : serialize2(uri, opts);
75932
75932
  } catch {
75933
75933
  return void 0;
75934
75934
  }
@@ -75941,7 +75941,7 @@ var require_fast_uri = __commonJS({
75941
75941
  resolve: resolve3,
75942
75942
  resolveComponent,
75943
75943
  equal,
75944
- serialize,
75944
+ serialize: serialize2,
75945
75945
  parse: parse6
75946
75946
  };
75947
75947
  module.exports = fastUri;
@@ -79498,384 +79498,6 @@ var init_index_DoHiaFQM = __esm({
79498
79498
  }
79499
79499
  });
79500
79500
 
79501
- // node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js
79502
- var require_object_hash = __commonJS({
79503
- "node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js"(exports, module) {
79504
- "use strict";
79505
- var crypto5 = __require("crypto");
79506
- exports = module.exports = objectHash;
79507
- function objectHash(object5, options) {
79508
- options = applyDefaults(object5, options);
79509
- return hash3(object5, options);
79510
- }
79511
- exports.sha1 = function(object5) {
79512
- return objectHash(object5);
79513
- };
79514
- exports.keys = function(object5) {
79515
- return objectHash(object5, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
79516
- };
79517
- exports.MD5 = function(object5) {
79518
- return objectHash(object5, { algorithm: "md5", encoding: "hex" });
79519
- };
79520
- exports.keysMD5 = function(object5) {
79521
- return objectHash(object5, { algorithm: "md5", encoding: "hex", excludeValues: true });
79522
- };
79523
- var hashes = crypto5.getHashes ? crypto5.getHashes().slice() : ["sha1", "md5"];
79524
- hashes.push("passthrough");
79525
- var encodings = ["buffer", "hex", "binary", "base64"];
79526
- function applyDefaults(object5, sourceOptions) {
79527
- sourceOptions = sourceOptions || {};
79528
- var options = {};
79529
- options.algorithm = sourceOptions.algorithm || "sha1";
79530
- options.encoding = sourceOptions.encoding || "hex";
79531
- options.excludeValues = sourceOptions.excludeValues ? true : false;
79532
- options.algorithm = options.algorithm.toLowerCase();
79533
- options.encoding = options.encoding.toLowerCase();
79534
- options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
79535
- options.respectType = sourceOptions.respectType === false ? false : true;
79536
- options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
79537
- options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
79538
- options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
79539
- options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
79540
- options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
79541
- options.replacer = sourceOptions.replacer || void 0;
79542
- options.excludeKeys = sourceOptions.excludeKeys || void 0;
79543
- if (typeof object5 === "undefined") {
79544
- throw new Error("Object argument required.");
79545
- }
79546
- for (var i = 0; i < hashes.length; ++i) {
79547
- if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
79548
- options.algorithm = hashes[i];
79549
- }
79550
- }
79551
- if (hashes.indexOf(options.algorithm) === -1) {
79552
- throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
79553
- }
79554
- if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
79555
- throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
79556
- }
79557
- return options;
79558
- }
79559
- function isNativeFunction(f) {
79560
- if (typeof f !== "function") {
79561
- return false;
79562
- }
79563
- var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
79564
- return exp.exec(Function.prototype.toString.call(f)) != null;
79565
- }
79566
- function hash3(object5, options) {
79567
- var hashingStream;
79568
- if (options.algorithm !== "passthrough") {
79569
- hashingStream = crypto5.createHash(options.algorithm);
79570
- } else {
79571
- hashingStream = new PassThrough();
79572
- }
79573
- if (typeof hashingStream.write === "undefined") {
79574
- hashingStream.write = hashingStream.update;
79575
- hashingStream.end = hashingStream.update;
79576
- }
79577
- var hasher = typeHasher(options, hashingStream);
79578
- hasher.dispatch(object5);
79579
- if (!hashingStream.update) {
79580
- hashingStream.end("");
79581
- }
79582
- if (hashingStream.digest) {
79583
- return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
79584
- }
79585
- var buf = hashingStream.read();
79586
- if (options.encoding === "buffer") {
79587
- return buf;
79588
- }
79589
- return buf.toString(options.encoding);
79590
- }
79591
- exports.writeToStream = function(object5, options, stream) {
79592
- if (typeof stream === "undefined") {
79593
- stream = options;
79594
- options = {};
79595
- }
79596
- options = applyDefaults(object5, options);
79597
- return typeHasher(options, stream).dispatch(object5);
79598
- };
79599
- function typeHasher(options, writeTo, context) {
79600
- context = context || [];
79601
- var write2 = function(str) {
79602
- if (writeTo.update) {
79603
- return writeTo.update(str, "utf8");
79604
- } else {
79605
- return writeTo.write(str, "utf8");
79606
- }
79607
- };
79608
- return {
79609
- dispatch: function(value2) {
79610
- if (options.replacer) {
79611
- value2 = options.replacer(value2);
79612
- }
79613
- var type2 = typeof value2;
79614
- if (value2 === null) {
79615
- type2 = "null";
79616
- }
79617
- return this["_" + type2](value2);
79618
- },
79619
- _object: function(object5) {
79620
- var pattern = /\[object (.*)\]/i;
79621
- var objString = Object.prototype.toString.call(object5);
79622
- var objType = pattern.exec(objString);
79623
- if (!objType) {
79624
- objType = "unknown:[" + objString + "]";
79625
- } else {
79626
- objType = objType[1];
79627
- }
79628
- objType = objType.toLowerCase();
79629
- var objectNumber = null;
79630
- if ((objectNumber = context.indexOf(object5)) >= 0) {
79631
- return this.dispatch("[CIRCULAR:" + objectNumber + "]");
79632
- } else {
79633
- context.push(object5);
79634
- }
79635
- if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object5)) {
79636
- write2("buffer:");
79637
- return write2(object5);
79638
- }
79639
- if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
79640
- if (this["_" + objType]) {
79641
- this["_" + objType](object5);
79642
- } else if (options.ignoreUnknown) {
79643
- return write2("[" + objType + "]");
79644
- } else {
79645
- throw new Error('Unknown object type "' + objType + '"');
79646
- }
79647
- } else {
79648
- var keys = Object.keys(object5);
79649
- if (options.unorderedObjects) {
79650
- keys = keys.sort();
79651
- }
79652
- if (options.respectType !== false && !isNativeFunction(object5)) {
79653
- keys.splice(0, 0, "prototype", "__proto__", "constructor");
79654
- }
79655
- if (options.excludeKeys) {
79656
- keys = keys.filter(function(key) {
79657
- return !options.excludeKeys(key);
79658
- });
79659
- }
79660
- write2("object:" + keys.length + ":");
79661
- var self2 = this;
79662
- return keys.forEach(function(key) {
79663
- self2.dispatch(key);
79664
- write2(":");
79665
- if (!options.excludeValues) {
79666
- self2.dispatch(object5[key]);
79667
- }
79668
- write2(",");
79669
- });
79670
- }
79671
- },
79672
- _array: function(arr, unordered) {
79673
- unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
79674
- var self2 = this;
79675
- write2("array:" + arr.length + ":");
79676
- if (!unordered || arr.length <= 1) {
79677
- return arr.forEach(function(entry) {
79678
- return self2.dispatch(entry);
79679
- });
79680
- }
79681
- var contextAdditions = [];
79682
- var entries = arr.map(function(entry) {
79683
- var strm = new PassThrough();
79684
- var localContext = context.slice();
79685
- var hasher = typeHasher(options, strm, localContext);
79686
- hasher.dispatch(entry);
79687
- contextAdditions = contextAdditions.concat(localContext.slice(context.length));
79688
- return strm.read().toString();
79689
- });
79690
- context = context.concat(contextAdditions);
79691
- entries.sort();
79692
- return this._array(entries, false);
79693
- },
79694
- _date: function(date6) {
79695
- return write2("date:" + date6.toJSON());
79696
- },
79697
- _symbol: function(sym) {
79698
- return write2("symbol:" + sym.toString());
79699
- },
79700
- _error: function(err) {
79701
- return write2("error:" + err.toString());
79702
- },
79703
- _boolean: function(bool) {
79704
- return write2("bool:" + bool.toString());
79705
- },
79706
- _string: function(string6) {
79707
- write2("string:" + string6.length + ":");
79708
- write2(string6.toString());
79709
- },
79710
- _function: function(fn2) {
79711
- write2("fn:");
79712
- if (isNativeFunction(fn2)) {
79713
- this.dispatch("[native]");
79714
- } else {
79715
- this.dispatch(fn2.toString());
79716
- }
79717
- if (options.respectFunctionNames !== false) {
79718
- this.dispatch("function-name:" + String(fn2.name));
79719
- }
79720
- if (options.respectFunctionProperties) {
79721
- this._object(fn2);
79722
- }
79723
- },
79724
- _number: function(number6) {
79725
- return write2("number:" + number6.toString());
79726
- },
79727
- _xml: function(xml) {
79728
- return write2("xml:" + xml.toString());
79729
- },
79730
- _null: function() {
79731
- return write2("Null");
79732
- },
79733
- _undefined: function() {
79734
- return write2("Undefined");
79735
- },
79736
- _regexp: function(regex4) {
79737
- return write2("regex:" + regex4.toString());
79738
- },
79739
- _uint8array: function(arr) {
79740
- write2("uint8array:");
79741
- return this.dispatch(Array.prototype.slice.call(arr));
79742
- },
79743
- _uint8clampedarray: function(arr) {
79744
- write2("uint8clampedarray:");
79745
- return this.dispatch(Array.prototype.slice.call(arr));
79746
- },
79747
- _int8array: function(arr) {
79748
- write2("int8array:");
79749
- return this.dispatch(Array.prototype.slice.call(arr));
79750
- },
79751
- _uint16array: function(arr) {
79752
- write2("uint16array:");
79753
- return this.dispatch(Array.prototype.slice.call(arr));
79754
- },
79755
- _int16array: function(arr) {
79756
- write2("int16array:");
79757
- return this.dispatch(Array.prototype.slice.call(arr));
79758
- },
79759
- _uint32array: function(arr) {
79760
- write2("uint32array:");
79761
- return this.dispatch(Array.prototype.slice.call(arr));
79762
- },
79763
- _int32array: function(arr) {
79764
- write2("int32array:");
79765
- return this.dispatch(Array.prototype.slice.call(arr));
79766
- },
79767
- _float32array: function(arr) {
79768
- write2("float32array:");
79769
- return this.dispatch(Array.prototype.slice.call(arr));
79770
- },
79771
- _float64array: function(arr) {
79772
- write2("float64array:");
79773
- return this.dispatch(Array.prototype.slice.call(arr));
79774
- },
79775
- _arraybuffer: function(arr) {
79776
- write2("arraybuffer:");
79777
- return this.dispatch(new Uint8Array(arr));
79778
- },
79779
- _url: function(url4) {
79780
- return write2("url:" + url4.toString(), "utf8");
79781
- },
79782
- _map: function(map2) {
79783
- write2("map:");
79784
- var arr = Array.from(map2);
79785
- return this._array(arr, options.unorderedSets !== false);
79786
- },
79787
- _set: function(set2) {
79788
- write2("set:");
79789
- var arr = Array.from(set2);
79790
- return this._array(arr, options.unorderedSets !== false);
79791
- },
79792
- _file: function(file2) {
79793
- write2("file:");
79794
- return this.dispatch([file2.name, file2.size, file2.type, file2.lastModfied]);
79795
- },
79796
- _blob: function() {
79797
- if (options.ignoreUnknown) {
79798
- return write2("[blob]");
79799
- }
79800
- throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
79801
- },
79802
- _domwindow: function() {
79803
- return write2("domwindow");
79804
- },
79805
- _bigint: function(number6) {
79806
- return write2("bigint:" + number6.toString());
79807
- },
79808
- /* Node.js standard native objects */
79809
- _process: function() {
79810
- return write2("process");
79811
- },
79812
- _timer: function() {
79813
- return write2("timer");
79814
- },
79815
- _pipe: function() {
79816
- return write2("pipe");
79817
- },
79818
- _tcp: function() {
79819
- return write2("tcp");
79820
- },
79821
- _udp: function() {
79822
- return write2("udp");
79823
- },
79824
- _tty: function() {
79825
- return write2("tty");
79826
- },
79827
- _statwatcher: function() {
79828
- return write2("statwatcher");
79829
- },
79830
- _securecontext: function() {
79831
- return write2("securecontext");
79832
- },
79833
- _connection: function() {
79834
- return write2("connection");
79835
- },
79836
- _zlib: function() {
79837
- return write2("zlib");
79838
- },
79839
- _context: function() {
79840
- return write2("context");
79841
- },
79842
- _nodescript: function() {
79843
- return write2("nodescript");
79844
- },
79845
- _httpparser: function() {
79846
- return write2("httpparser");
79847
- },
79848
- _dataview: function() {
79849
- return write2("dataview");
79850
- },
79851
- _signal: function() {
79852
- return write2("signal");
79853
- },
79854
- _fsevent: function() {
79855
- return write2("fsevent");
79856
- },
79857
- _tlswrap: function() {
79858
- return write2("tlswrap");
79859
- }
79860
- };
79861
- }
79862
- function PassThrough() {
79863
- return {
79864
- buf: "",
79865
- write: function(b) {
79866
- this.buf += b;
79867
- },
79868
- end: function(b) {
79869
- this.buf += b;
79870
- },
79871
- read: function() {
79872
- return this.buf;
79873
- }
79874
- };
79875
- }
79876
- }
79877
- });
79878
-
79879
79501
  // node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js
79880
79502
  var require_light = __commonJS({
79881
79503
  "node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js"(exports, module) {
@@ -104358,6 +103980,17 @@ var providers = {
104358
103980
  // see the big-pickle note above (#1077).
104359
103981
  isFree: true
104360
103982
  },
103983
+ // Zen's FREE stealth preview (listed 2026-10-01), the fifth promo. Zen
103984
+ // has not published its data terms yet, so the description claims none.
103985
+ "fledge-alpha": {
103986
+ displayName: "Fledge Alpha",
103987
+ description: "Stealth preview, free for a limited time",
103988
+ resolve: "opencode/fledge-alpha-free",
103989
+ effort: ["low", "high", "max"],
103990
+ // free to run, still gated on the provider's own OPENCODE_API_KEY —
103991
+ // see the big-pickle note above (#1077).
103992
+ isFree: true
103993
+ },
104361
103994
  // Zen's live free MiMo, and the second free row in a menu that big-pickle
104362
103995
  // was alone in since `mimo-v2-pro-free` lost its model.
104363
103996
  mimo: {
@@ -105972,7 +105605,7 @@ var import_semver = __toESM(require_semver2(), 1);
105972
105605
  // package.json
105973
105606
  var package_default = {
105974
105607
  name: "pullfrog",
105975
- version: "0.1.94",
105608
+ version: "0.1.95",
105976
105609
  cliContractVersion: "1",
105977
105610
  type: "module",
105978
105611
  bin: {
@@ -106038,7 +105671,7 @@ var package_default = {
106038
105671
  undici: "^7.22.0",
106039
105672
  vitest: "^4.0.17",
106040
105673
  yaml: "^2.8.2",
106041
- yes: "0.0.3",
105674
+ yes: "0.1.0",
106042
105675
  zod: "4.3.6"
106043
105676
  },
106044
105677
  repository: {
@@ -134763,21 +134396,21 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134763
134396
  const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils6();
134764
134397
  const { SCHEMES, getSchemeHandler } = require_schemes2();
134765
134398
  function normalize3(uri, options) {
134766
- if (typeof uri === "string") uri = serialize(parse6(uri, options), options);
134767
- else if (typeof uri === "object") uri = parse6(serialize(uri, options), options);
134399
+ if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
134400
+ else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
134768
134401
  return uri;
134769
134402
  }
134770
134403
  function resolve3(baseURI, relativeURI, options) {
134771
134404
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
134772
134405
  const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
134773
134406
  schemelessOptions.skipEscape = true;
134774
- return serialize(resolved, schemelessOptions);
134407
+ return serialize2(resolved, schemelessOptions);
134775
134408
  }
134776
134409
  function resolveComponent(base, relative, options, skipNormalization) {
134777
134410
  const target = {};
134778
134411
  if (!skipNormalization) {
134779
- base = parse6(serialize(base, options), options);
134780
- relative = parse6(serialize(relative, options), options);
134412
+ base = parse6(serialize2(base, options), options);
134413
+ relative = parse6(serialize2(relative, options), options);
134781
134414
  }
134782
134415
  options = options || {};
134783
134416
  if (!options.tolerant && relative.scheme) {
@@ -134821,27 +134454,27 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134821
134454
  function equal(uriA, uriB, options) {
134822
134455
  if (typeof uriA === "string") {
134823
134456
  uriA = unescape(uriA);
134824
- uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), {
134457
+ uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
134825
134458
  ...options,
134826
134459
  skipEscape: true
134827
134460
  });
134828
- } else if (typeof uriA === "object") uriA = serialize(normalizeComponentEncoding(uriA, true), {
134461
+ } else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
134829
134462
  ...options,
134830
134463
  skipEscape: true
134831
134464
  });
134832
134465
  if (typeof uriB === "string") {
134833
134466
  uriB = unescape(uriB);
134834
- uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), {
134467
+ uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
134835
134468
  ...options,
134836
134469
  skipEscape: true
134837
134470
  });
134838
- } else if (typeof uriB === "object") uriB = serialize(normalizeComponentEncoding(uriB, true), {
134471
+ } else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
134839
134472
  ...options,
134840
134473
  skipEscape: true
134841
134474
  });
134842
134475
  return uriA.toLowerCase() === uriB.toLowerCase();
134843
134476
  }
134844
- function serialize(cmpts, opts) {
134477
+ function serialize2(cmpts, opts) {
134845
134478
  const component = {
134846
134479
  host: cmpts.host,
134847
134480
  scheme: cmpts.scheme,
@@ -134944,7 +134577,7 @@ var require_fast_uri2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134944
134577
  resolve: resolve3,
134945
134578
  resolveComponent,
134946
134579
  equal,
134947
- serialize,
134580
+ serialize: serialize2,
134948
134581
  parse: parse6
134949
134582
  };
134950
134583
  module.exports = fastUri;
@@ -149048,21 +148681,21 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
149048
148681
  const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils7();
149049
148682
  const { SCHEMES, getSchemeHandler } = require_schemes3();
149050
148683
  function normalize3(uri, options) {
149051
- if (typeof uri === "string") uri = serialize(parse6(uri, options), options);
149052
- else if (typeof uri === "object") uri = parse6(serialize(uri, options), options);
148684
+ if (typeof uri === "string") uri = serialize2(parse6(uri, options), options);
148685
+ else if (typeof uri === "object") uri = parse6(serialize2(uri, options), options);
149053
148686
  return uri;
149054
148687
  }
149055
148688
  function resolve3(baseURI, relativeURI, options) {
149056
148689
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
149057
148690
  const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
149058
148691
  schemelessOptions.skipEscape = true;
149059
- return serialize(resolved, schemelessOptions);
148692
+ return serialize2(resolved, schemelessOptions);
149060
148693
  }
149061
148694
  function resolveComponent(base, relative, options, skipNormalization) {
149062
148695
  const target = {};
149063
148696
  if (!skipNormalization) {
149064
- base = parse6(serialize(base, options), options);
149065
- relative = parse6(serialize(relative, options), options);
148697
+ base = parse6(serialize2(base, options), options);
148698
+ relative = parse6(serialize2(relative, options), options);
149066
148699
  }
149067
148700
  options = options || {};
149068
148701
  if (!options.tolerant && relative.scheme) {
@@ -149106,27 +148739,27 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
149106
148739
  function equal(uriA, uriB, options) {
149107
148740
  if (typeof uriA === "string") {
149108
148741
  uriA = unescape(uriA);
149109
- uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), {
148742
+ uriA = serialize2(normalizeComponentEncoding(parse6(uriA, options), true), {
149110
148743
  ...options,
149111
148744
  skipEscape: true
149112
148745
  });
149113
- } else if (typeof uriA === "object") uriA = serialize(normalizeComponentEncoding(uriA, true), {
148746
+ } else if (typeof uriA === "object") uriA = serialize2(normalizeComponentEncoding(uriA, true), {
149114
148747
  ...options,
149115
148748
  skipEscape: true
149116
148749
  });
149117
148750
  if (typeof uriB === "string") {
149118
148751
  uriB = unescape(uriB);
149119
- uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), {
148752
+ uriB = serialize2(normalizeComponentEncoding(parse6(uriB, options), true), {
149120
148753
  ...options,
149121
148754
  skipEscape: true
149122
148755
  });
149123
- } else if (typeof uriB === "object") uriB = serialize(normalizeComponentEncoding(uriB, true), {
148756
+ } else if (typeof uriB === "object") uriB = serialize2(normalizeComponentEncoding(uriB, true), {
149124
148757
  ...options,
149125
148758
  skipEscape: true
149126
148759
  });
149127
148760
  return uriA.toLowerCase() === uriB.toLowerCase();
149128
148761
  }
149129
- function serialize(cmpts, opts) {
148762
+ function serialize2(cmpts, opts) {
149130
148763
  const component = {
149131
148764
  host: cmpts.host,
149132
148765
  scheme: cmpts.scheme,
@@ -149229,7 +148862,7 @@ var require_fast_uri3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
149229
148862
  resolve: resolve3,
149230
148863
  resolveComponent,
149231
148864
  equal,
149232
- serialize,
148865
+ serialize: serialize2,
149233
148866
  parse: parse6
149234
148867
  };
149235
148868
  module.exports = fastUri;
@@ -174522,8 +174155,8 @@ var createNode = ({ id, kind, inner, meta: meta3, $: $2, ignoreCache }) => {
174522
174155
  let innerJson = {};
174523
174156
  for (const [k2, v] of innerEntries) {
174524
174157
  const keyImpl = impl.keys[k2];
174525
- const serialize = keyImpl.serialize ?? (keyImpl.child ? serializeListableChild : defaultValueSerializer);
174526
- innerJson[k2] = serialize(v);
174158
+ const serialize2 = keyImpl.serialize ?? (keyImpl.child ? serializeListableChild : defaultValueSerializer);
174159
+ innerJson[k2] = serialize2(v);
174527
174160
  if (keyImpl.child === true) {
174528
174161
  const listableNode = v;
174529
174162
  if (isArray(listableNode))
@@ -180072,10 +179705,22 @@ var schema = ark.schema;
180072
179705
  var define2 = ark.define;
180073
179706
  var declare = ark.declare;
180074
179707
 
180075
- // node_modules/.pnpm/yes@0.0.3/node_modules/yes/dist/index.js
180076
- import { performance as performance8 } from "node:perf_hooks";
179708
+ // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
180077
179709
  import { setTimeout as sleep2 } from "node:timers/promises";
180078
179710
 
179711
+ // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/adapter.js
179712
+ var AdapterError = class extends Error {
179713
+ method;
179714
+ /** the full store key, or the op's prefix when the call covered many keys. never the raw input. */
179715
+ key;
179716
+ constructor(method, key, cause) {
179717
+ super(`cache ${method} failed for ${key}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
179718
+ this.name = "AdapterError";
179719
+ this.method = method;
179720
+ this.key = key;
179721
+ }
179722
+ };
179723
+
180079
179724
  // node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/node/index.min.js
180080
179725
  import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
180081
179726
  var S = P("lru-cache:metrics");
@@ -180661,8 +180306,78 @@ var I = class d2 {
180661
180306
  }
180662
180307
  };
180663
180308
 
180664
- // node_modules/.pnpm/yes@0.0.3/node_modules/yes/dist/index.js
180665
- var import_object_hash = __toESM(require_object_hash(), 1);
180309
+ // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/memory.js
180310
+ function memory(options = {}) {
180311
+ const store = new I({ max: options.maxItems ?? 1e3 });
180312
+ return {
180313
+ get: (key) => store.get(key),
180314
+ peek: (key) => store.peek(key),
180315
+ // the TTL rides on each entry rather than the whole cache, so ops with
180316
+ // different lifetimes can share one store
180317
+ set: (key, entry, ttlMs) => {
180318
+ store.set(key, entry, { ttl: ttlMs });
180319
+ },
180320
+ delete: (keys) => {
180321
+ for (const key of keys)
180322
+ store.delete(key);
180323
+ },
180324
+ // a snapshot, so deleting while iterating is safe. lru-cache skips expired
180325
+ // entries itself.
180326
+ list: (prefix) => [...store.entries()].filter(([key]) => key.startsWith(prefix))
180327
+ };
180328
+ }
180329
+
180330
+ // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/key.js
180331
+ import { hash as hash2 } from "node:crypto";
180332
+ function hashKey(value2) {
180333
+ return hash2("sha1", serialize(value2, 0));
180334
+ }
180335
+ var MAX_DEPTH = 64;
180336
+ function serialize(value2, depth) {
180337
+ switch (typeof value2) {
180338
+ case "string":
180339
+ return JSON.stringify(value2);
180340
+ case "number":
180341
+ if (!Number.isFinite(value2))
180342
+ throw new Error(`${value2} cannot be part of a cache key`);
180343
+ return String(value2);
180344
+ case "boolean":
180345
+ return value2 ? "true" : "false";
180346
+ case "undefined":
180347
+ throw new Error("undefined cannot be part of a cache key, except as an object property");
180348
+ case "object":
180349
+ break;
180350
+ default:
180351
+ throw new Error(`a ${typeof value2} cannot be part of a cache key`);
180352
+ }
180353
+ if (value2 === null)
180354
+ return "null";
180355
+ if (depth === MAX_DEPTH)
180356
+ throw new Error(`an input nested more than ${MAX_DEPTH} levels deep, or circular`);
180357
+ depth++;
180358
+ if (Array.isArray(value2)) {
180359
+ let out2 = "[";
180360
+ for (let i = 0; i < value2.length; i++)
180361
+ out2 += `${i ? "," : ""}${serialize(value2[i], depth)}`;
180362
+ return `${out2}]`;
180363
+ }
180364
+ const proto = Object.getPrototypeOf(value2);
180365
+ if (proto !== Object.prototype && proto !== null) {
180366
+ const name = proto.constructor?.name || "class instance";
180367
+ throw new Error(`a ${name} cannot be part of a cache key: only JSON data can`);
180368
+ }
180369
+ const record3 = value2;
180370
+ const keys = Object.keys(record3).sort();
180371
+ let out = "";
180372
+ for (const key of keys) {
180373
+ const v = record3[key];
180374
+ if (v !== void 0)
180375
+ out += `${out ? "," : ""}${JSON.stringify(key)}:${serialize(v, depth)}`;
180376
+ }
180377
+ return `{${out}}`;
180378
+ }
180379
+
180380
+ // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
180666
180381
  var VOID_KEY = "~void";
180667
180382
  function getCacheKeyString(value2) {
180668
180383
  if (value2 === void 0)
@@ -180671,12 +180386,7 @@ function getCacheKeyString(value2) {
180671
180386
  throw new Error("cache key cannot be null");
180672
180387
  }
180673
180388
  try {
180674
- if (typeof value2 === "string")
180675
- return value2;
180676
- return (0, import_object_hash.default)(value2, {
180677
- unorderedObjects: true,
180678
- unorderedArrays: true
180679
- });
180389
+ return hashKey(value2);
180680
180390
  } catch (error49) {
180681
180391
  throw new Error(`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`);
180682
180392
  }
@@ -180738,15 +180448,21 @@ async function assertSchema(schema2, value2) {
180738
180448
  var log2 = {
180739
180449
  info: (...args2) => console.log(...args2),
180740
180450
  error: (...args2) => console.error(...args2),
180741
- debug: (...args2) => {
180742
- if (process.env.LOG_LEVEL === "debug")
180743
- console.log(...args2);
180744
- },
180745
180451
  prod: (...args2) => {
180746
180452
  if (process.env.NODE_ENV === "production")
180747
180453
  console.log(...args2);
180748
180454
  }
180749
180455
  };
180456
+ function debugTrace(namePrefix, key) {
180457
+ if (process.env.LOG_LEVEL !== "debug")
180458
+ return void 0;
180459
+ const prefix = `${namePrefix}[${(/* @__PURE__ */ new Date()).toISOString()}]`;
180460
+ return {
180461
+ start: performance.now(),
180462
+ log: (message, data) => console.log(`${prefix} ${message}`, { key, ...data }),
180463
+ since: (start) => `${Math.round(performance.now() - start)}ms`
180464
+ };
180465
+ }
180750
180466
  function op(fnOrOptions, options) {
180751
180467
  if (typeof fnOrOptions === "function") {
180752
180468
  return _op(fnOrOptions, options ?? {});
@@ -180754,16 +180470,110 @@ function op(fnOrOptions, options) {
180754
180470
  const { input: inputSchema, output: outputSchema, run, ...opOptions } = fnOrOptions;
180755
180471
  return _op(run, opOptions, { input: inputSchema, output: outputSchema });
180756
180472
  }
180473
+ var isThenable = (value2) => typeof value2?.then === "function";
180474
+ function freshEntry(value2) {
180475
+ if (value2 === null || typeof value2 !== "object" || !("value" in value2))
180476
+ return void 0;
180477
+ const expires = value2.expires;
180478
+ return typeof expires === "number" && expires > Date.now() ? value2 : void 0;
180479
+ }
180480
+ var adapterMethods = ["get", "set", "delete", "list"];
180481
+ function callAdapter(method, key, run) {
180482
+ let result;
180483
+ try {
180484
+ result = run();
180485
+ } catch (error49) {
180486
+ throw new AdapterError(method, key, error49);
180487
+ }
180488
+ if (!isThenable(result))
180489
+ return result;
180490
+ return result.then(void 0, (error49) => {
180491
+ throw new AdapterError(method, key, error49);
180492
+ });
180493
+ }
180494
+ var DELETE_BATCH = 1e3;
180495
+ function sweep(store, prefix, match3) {
180496
+ const now = Date.now();
180497
+ const keys = [];
180498
+ let count = 0;
180499
+ let matchError;
180500
+ const take = ([key, entry]) => {
180501
+ if (!(entry.expires > now))
180502
+ return void keys.push(key);
180503
+ let matched;
180504
+ try {
180505
+ matched = match3(entry.input);
180506
+ } catch (error49) {
180507
+ matchError = { error: error49 };
180508
+ throw error49;
180509
+ }
180510
+ if (matched) {
180511
+ keys.push(key);
180512
+ count++;
180513
+ }
180514
+ };
180515
+ const fail = (error49) => {
180516
+ throw matchError ? matchError.error : new AdapterError("list", prefix, error49);
180517
+ };
180518
+ const deleteFrom = (from) => {
180519
+ for (let i = from; i < keys.length; i += DELETE_BATCH) {
180520
+ const batch = keys.slice(i, i + DELETE_BATCH);
180521
+ const deleted = callAdapter("delete", prefix, () => store.delete(batch));
180522
+ if (isThenable(deleted))
180523
+ return Promise.resolve(deleted).then(() => deleteFrom(i + DELETE_BATCH));
180524
+ }
180525
+ return count;
180526
+ };
180527
+ let listed;
180528
+ try {
180529
+ listed = store.list(prefix);
180530
+ } catch (error49) {
180531
+ return fail(error49);
180532
+ }
180533
+ if (!isThenable(listed) && Symbol.iterator in Object(listed)) {
180534
+ try {
180535
+ for (const item of listed)
180536
+ take(item);
180537
+ } catch (error49) {
180538
+ fail(error49);
180539
+ }
180540
+ return deleteFrom(0);
180541
+ }
180542
+ return (async () => {
180543
+ try {
180544
+ for await (const item of await listed)
180545
+ take(item);
180546
+ } catch (error49) {
180547
+ fail(error49);
180548
+ }
180549
+ return deleteFrom(0);
180550
+ })();
180551
+ }
180757
180552
  function _op(fn2, options, schemas = {}) {
180758
- const shouldCache = options.ttl !== void 0;
180759
- const lruCache = shouldCache ? new I({
180760
- max: options.maxItems ?? 1e3,
180761
- ttl: options.ttl
180762
- }) : null;
180763
- const keyMap = shouldCache ? new I({
180764
- max: options.maxItems ?? 1e3,
180765
- ttl: options.ttl
180766
- }) : null;
180553
+ const { ttl, cache: adapter } = options;
180554
+ const shouldCache = ttl !== void 0;
180555
+ if (shouldCache && !(ttl > 0 && Number.isFinite(ttl))) {
180556
+ throw new Error(`ttl must be a positive number of milliseconds, got ${ttl}`);
180557
+ }
180558
+ if (adapter) {
180559
+ if (!options.name)
180560
+ throw new Error(`an op with a cache adapter needs a name: its keys are "yes:<name>:<hash>"`);
180561
+ if (options.name.includes(":")) {
180562
+ throw new Error(`op name "${options.name}" cannot contain ":" with a cache adapter: its keys would overlap another op's`);
180563
+ }
180564
+ if (!shouldCache)
180565
+ throw new Error(`${options.name}: a cache adapter does nothing without a ttl`);
180566
+ if (options.maxItems !== void 0) {
180567
+ throw new Error(`${options.name}: maxItems sizes the default memory store; size the adapter instead`);
180568
+ }
180569
+ const missing = adapterMethods.filter((method) => typeof adapter[method] !== "function");
180570
+ if (missing.length) {
180571
+ throw new Error(`${options.name}: cache is missing ${missing.join(", ")}; an adapter has get, set, delete and list (a Map or a Keyv is not one)`);
180572
+ }
180573
+ }
180574
+ const defaultStore = shouldCache && !adapter ? memory({ maxItems: options.maxItems }) : void 0;
180575
+ const store = adapter ?? defaultStore;
180576
+ const prefix = adapter ? `yes:${options.name}:` : "";
180767
180577
  const inFlightPromises = /* @__PURE__ */ new Map();
180768
180578
  const namePrefix = options.name ? `[${options.name}] ` : "";
180769
180579
  const defaultCacheHit = options.cacheHit === null ? () => {
@@ -180776,11 +180586,21 @@ function _op(fn2, options, schemas = {}) {
180776
180586
  if (options.name && shouldCache)
180777
180587
  log2.prod(`${namePrefix}cache miss`);
180778
180588
  });
180779
- const keyInput = (value2) => {
180589
+ const methodKey = (value2, method) => {
180590
+ const toKey = (input) => {
180591
+ try {
180592
+ return prefix + getCacheKeyString(input);
180593
+ } catch (error49) {
180594
+ const errorMessage = error49 instanceof Error ? error49.message : String(error49);
180595
+ throw new Error(`failed to hash cache key for ${method}()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`);
180596
+ }
180597
+ };
180780
180598
  if (!schemas.input)
180781
- return value2;
180599
+ return toKey(value2);
180782
180600
  const result = schemas.input["~standard"].validate(value2);
180783
- return result instanceof Promise || result.issues ? value2 : result.value;
180601
+ if (result instanceof Promise)
180602
+ return result.then((r) => toKey(r.issues ? value2 : r.value));
180603
+ return toKey(result.issues ? value2 : result.value);
180784
180604
  };
180785
180605
  const cachedFn = async (rawInput, ctx) => {
180786
180606
  const input = schemas.input ? await assertSchema(schemas.input, rawInput) : rawInput;
@@ -180791,54 +180611,57 @@ function _op(fn2, options, schemas = {}) {
180791
180611
  const errorMessage = error49 instanceof Error ? error49.message : String(error49);
180792
180612
  throw new Error(`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`);
180793
180613
  }
180794
- const startTime = performance8.now();
180795
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
180796
- log2.debug(`${namePrefix}[${timestamp}] cache lookup started`, { key });
180797
- if (shouldCache && lruCache) {
180798
- const cached4 = lruCache.get(key);
180799
- if (cached4 !== void 0) {
180800
- if (keyMap?.get(key) === void 0)
180801
- keyMap?.set(key, input);
180802
- const runtime = performance8.now() - startTime;
180803
- log2.debug(`${namePrefix}[${timestamp}] cache hit (from lru)`, {
180804
- key,
180805
- runtime: `${Math.round(runtime)}ms`
180806
- });
180807
- defaultCacheHit(key);
180808
- return cached4;
180809
- }
180810
- }
180614
+ const trace = debugTrace(namePrefix, key);
180615
+ trace?.log("cache lookup started");
180811
180616
  const inFlight = inFlightPromises.get(key);
180812
180617
  if (inFlight) {
180813
- log2.debug(`${namePrefix}[${timestamp}] cache hit (in-flight)`, { key });
180618
+ trace?.log("cache hit (in-flight)");
180814
180619
  defaultCacheHit(key);
180815
180620
  return inFlight;
180816
180621
  }
180817
- log2.debug(`${namePrefix}[${timestamp}] cache miss, executing function`, {
180818
- key
180819
- });
180820
- defaultCacheMiss(key);
180622
+ const fullKey = store ? prefix + key : "";
180623
+ let pendingRead;
180624
+ if (store) {
180625
+ let read2;
180626
+ try {
180627
+ read2 = store.get(fullKey);
180628
+ } catch (error49) {
180629
+ throw new AdapterError("get", fullKey, error49);
180630
+ }
180631
+ if (isThenable(read2)) {
180632
+ pendingRead = read2.then(void 0, (error49) => {
180633
+ throw new AdapterError("get", fullKey, error49);
180634
+ });
180635
+ } else {
180636
+ const entry = store === defaultStore ? read2 : freshEntry(read2);
180637
+ if (entry) {
180638
+ trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
180639
+ defaultCacheHit(key);
180640
+ return entry.value;
180641
+ }
180642
+ }
180643
+ }
180821
180644
  const retries = options.retries ?? [];
180822
- let lastError;
180823
- const execStartTime = performance8.now();
180645
+ const execStart = trace ? performance.now() : 0;
180824
180646
  const promise2 = (async () => {
180825
- for (let attempt = 0; attempt <= retries.length; attempt++) {
180647
+ if (pendingRead) {
180648
+ const entry = freshEntry(await pendingRead);
180649
+ if (entry) {
180650
+ trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
180651
+ defaultCacheHit(key);
180652
+ return entry.value;
180653
+ }
180654
+ }
180655
+ trace?.log("cache miss, executing function");
180656
+ defaultCacheMiss(key);
180657
+ let result;
180658
+ let lastError;
180659
+ let attempt = 0;
180660
+ for (; attempt <= retries.length; attempt++) {
180826
180661
  try {
180827
180662
  const returned = await fn2(input, ctx);
180828
- const result = schemas.output ? await assertSchema(schemas.output, returned) : returned;
180829
- const execRuntime2 = performance8.now() - execStartTime;
180830
- const skip = options.skipCache ? options.skipCache(result) : false;
180831
- if (shouldCache && lruCache && result !== null && result !== void 0 && !skip) {
180832
- lruCache.set(key, result);
180833
- keyMap?.set(key, input);
180834
- }
180835
- log2.debug(`${namePrefix}[${timestamp}] function executed successfully`, {
180836
- key,
180837
- runtime: `${Math.round(execRuntime2)}ms`,
180838
- attempt: attempt + 1,
180839
- cached: shouldCache && result !== null && result !== void 0 && !skip
180840
- });
180841
- return result;
180663
+ result = schemas.output ? await assertSchema(schemas.output, returned) : returned;
180664
+ break;
180842
180665
  } catch (error49) {
180843
180666
  if (error49 instanceof ValidationError || options.rethrow?.(error49))
180844
180667
  throw error49;
@@ -180874,14 +180697,31 @@ function _op(fn2, options, schemas = {}) {
180874
180697
  }
180875
180698
  }
180876
180699
  }
180877
- const execRuntime = performance8.now() - execStartTime;
180878
- log2.debug(`${namePrefix}[${timestamp}] function failed after all retries`, {
180879
- key,
180880
- runtime: `${Math.round(execRuntime)}ms`,
180881
- attempts: retries.length + 1,
180882
- error: lastError instanceof Error ? lastError.message : lastError
180883
- });
180884
- throw lastError;
180700
+ if (attempt > retries.length) {
180701
+ trace?.log("function failed after all retries", {
180702
+ runtime: trace.since(execStart),
180703
+ attempts: retries.length + 1,
180704
+ error: lastError instanceof Error ? lastError.message : lastError
180705
+ });
180706
+ throw lastError;
180707
+ }
180708
+ const skip = options.skipCache ? options.skipCache(result) : false;
180709
+ const storable = store !== void 0 && result !== null && result !== void 0 && !(result instanceof Error) && !skip;
180710
+ let cached4 = false;
180711
+ if (storable) {
180712
+ const created = Date.now();
180713
+ const entry = { value: result, created, expires: created + ttl, input };
180714
+ try {
180715
+ const written = callAdapter("set", fullKey, () => store.set(fullKey, entry, ttl));
180716
+ if (isThenable(written))
180717
+ await written;
180718
+ cached4 = true;
180719
+ } catch (error49) {
180720
+ log2.error(`${namePrefix}cache write failed, returning the result uncached`, error49);
180721
+ }
180722
+ }
180723
+ trace?.log("function executed successfully", { runtime: trace.since(execStart), attempt: attempt + 1, cached: cached4 });
180724
+ return result;
180885
180725
  })();
180886
180726
  inFlightPromises.set(key, promise2);
180887
180727
  try {
@@ -180890,47 +180730,35 @@ function _op(fn2, options, schemas = {}) {
180890
180730
  inFlightPromises.delete(key);
180891
180731
  }
180892
180732
  };
180893
- cachedFn.clear = (key) => {
180894
- if (shouldCache && lruCache) {
180895
- if (key !== void 0) {
180896
- let stringKey;
180897
- try {
180898
- stringKey = getCacheKeyString(keyInput(key));
180899
- } catch (error49) {
180900
- const errorMessage = error49 instanceof Error ? error49.message : String(error49);
180901
- throw new Error(`failed to hash cache key for clear()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`);
180902
- }
180903
- lruCache.delete(stringKey);
180904
- keyMap.delete(stringKey);
180905
- } else {
180906
- lruCache.clear();
180907
- keyMap.clear();
180908
- }
180733
+ cachedFn.clear = async (key) => {
180734
+ if (!store)
180735
+ return;
180736
+ if (key === void 0) {
180737
+ await sweep(store, prefix, () => true);
180738
+ return;
180909
180739
  }
180740
+ let fullKey = methodKey(key, "clear");
180741
+ if (typeof fullKey !== "string")
180742
+ fullKey = await fullKey;
180743
+ const target = fullKey;
180744
+ await callAdapter("delete", target, () => store.delete([target]));
180910
180745
  };
180911
- cachedFn.has = (key) => {
180912
- if (!shouldCache || !lruCache)
180746
+ cachedFn.has = async (key) => {
180747
+ if (!store)
180913
180748
  return false;
180914
- try {
180915
- const stringKey = getCacheKeyString(keyInput(key));
180916
- return lruCache.has(stringKey);
180917
- } catch (error49) {
180918
- const errorMessage = error49 instanceof Error ? error49.message : String(error49);
180919
- throw new Error(`failed to hash cache key for has()${namePrefix ? ` in ${options.name}` : ""}: ${errorMessage}`);
180920
- }
180749
+ let fullKey = methodKey(key, "has");
180750
+ if (typeof fullKey !== "string")
180751
+ fullKey = await fullKey;
180752
+ const target = fullKey;
180753
+ const memoryStore = store;
180754
+ const read2 = callAdapter("get", target, () => memoryStore.peek ? memoryStore.peek(target) : store.get(target));
180755
+ return freshEntry(await read2) !== void 0;
180921
180756
  };
180922
180757
  cachedFn.invalidate = (predicate) => {
180923
- if (!shouldCache || !lruCache)
180924
- return 0;
180925
- let count = 0;
180926
- for (const [stringKey, originalKey] of keyMap) {
180927
- if (predicate(originalKey)) {
180928
- lruCache.delete(stringKey);
180929
- keyMap.delete(stringKey);
180930
- count++;
180931
- }
180932
- }
180933
- return count;
180758
+ if (!store)
180759
+ return Promise.resolve(0);
180760
+ const count = sweep(store, prefix, predicate);
180761
+ return typeof count === "number" ? Promise.resolve(count) : count;
180934
180762
  };
180935
180763
  return cachedFn;
180936
180764
  }
@@ -191167,7 +190995,7 @@ function ReopenCurrentTool(ctx) {
191167
190995
  }
191168
190996
 
191169
190997
  // prep/index.ts
191170
- import { performance as performance9 } from "node:perf_hooks";
190998
+ import { performance as performance8 } from "node:perf_hooks";
191171
190999
 
191172
191000
  // prep/installNodeDependencies.ts
191173
191001
  import { existsSync as existsSync8 } from "node:fs";
@@ -191626,7 +191454,7 @@ var installPythonDependencies = {
191626
191454
  var prepSteps = [installNodeDependencies, installPythonDependencies];
191627
191455
  async function runPrepPhase(options) {
191628
191456
  log.debug("\xBB starting prep phase...");
191629
- const startTime = performance9.now();
191457
+ const startTime = performance8.now();
191630
191458
  const results = [];
191631
191459
  const preDirty = await dirtyTrackedPaths();
191632
191460
  try {
@@ -191648,7 +191476,7 @@ async function runPrepPhase(options) {
191648
191476
  } finally {
191649
191477
  await restoreDirtiedSince({ before: preDirty, actor: "prep" });
191650
191478
  }
191651
- const totalDurationMs = performance9.now() - startTime;
191479
+ const totalDurationMs = performance8.now() - startTime;
191652
191480
  log.debug(`\xBB prep phase completed (${Math.round(totalDurationMs)}ms)`);
191653
191481
  return results;
191654
191482
  }