pullfrog 0.1.95 → 0.1.96

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 CHANGED
@@ -13774,9 +13774,9 @@ var require_timers = __commonJS({
13774
13774
  }
13775
13775
  }
13776
13776
  var Timeout = class {
13777
- constructor(callback, delay2, opaque) {
13777
+ constructor(callback, delay3, opaque) {
13778
13778
  this.callback = callback;
13779
- this.delay = delay2;
13779
+ this.delay = delay3;
13780
13780
  this.opaque = opaque;
13781
13781
  this.state = -2;
13782
13782
  this.refresh();
@@ -13795,8 +13795,8 @@ var require_timers = __commonJS({
13795
13795
  }
13796
13796
  };
13797
13797
  module.exports = {
13798
- setTimeout(callback, delay2, opaque) {
13799
- return delay2 < 1e3 ? setTimeout(callback, delay2, opaque) : new Timeout(callback, delay2, opaque);
13798
+ setTimeout(callback, delay3, opaque) {
13799
+ return delay3 < 1e3 ? setTimeout(callback, delay3, opaque) : new Timeout(callback, delay3, opaque);
13800
13800
  },
13801
13801
  clearTimeout(timeout) {
13802
13802
  if (timeout instanceof Timeout) {
@@ -18076,7 +18076,7 @@ var require_request = __commonJS({
18076
18076
  method,
18077
18077
  body,
18078
18078
  headers,
18079
- query,
18079
+ query: query2,
18080
18080
  idempotent,
18081
18081
  blocking,
18082
18082
  upgrade,
@@ -18153,7 +18153,7 @@ var require_request = __commonJS({
18153
18153
  this.completed = false;
18154
18154
  this.aborted = false;
18155
18155
  this.upgrade = upgrade || null;
18156
- this.path = query ? util2.buildURL(path4, query) : path4;
18156
+ this.path = query2 ? util2.buildURL(path4, query2) : path4;
18157
18157
  this.origin = origin;
18158
18158
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
18159
18159
  this.blocking = blocking == null ? false : blocking;
@@ -22867,13 +22867,13 @@ var require_mock_utils = __commonJS({
22867
22867
  }
22868
22868
  }
22869
22869
  function buildKey(opts) {
22870
- const { path: path4, method, body, headers, query } = opts;
22870
+ const { path: path4, method, body, headers, query: query2 } = opts;
22871
22871
  return {
22872
22872
  path: path4,
22873
22873
  method,
22874
22874
  body,
22875
22875
  headers,
22876
- query
22876
+ query: query2
22877
22877
  };
22878
22878
  }
22879
22879
  function generateKeyValues(data) {
@@ -22900,7 +22900,7 @@ var require_mock_utils = __commonJS({
22900
22900
  if (mockDispatch2.data.callback) {
22901
22901
  mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) };
22902
22902
  }
22903
- const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay2, persist } = mockDispatch2;
22903
+ const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay3, persist } = mockDispatch2;
22904
22904
  const { timesInvoked, times } = mockDispatch2;
22905
22905
  mockDispatch2.consumed = !persist && timesInvoked >= times;
22906
22906
  mockDispatch2.pending = timesInvoked < times;
@@ -22909,10 +22909,10 @@ var require_mock_utils = __commonJS({
22909
22909
  handler2.onError(error49);
22910
22910
  return true;
22911
22911
  }
22912
- if (typeof delay2 === "number" && delay2 > 0) {
22912
+ if (typeof delay3 === "number" && delay3 > 0) {
22913
22913
  setTimeout(() => {
22914
22914
  handleReply(this[kDispatches]);
22915
- }, delay2);
22915
+ }, delay3);
22916
22916
  } else {
22917
22917
  handleReply(this[kDispatches]);
22918
22918
  }
@@ -38747,8 +38747,8 @@ var require_coerce = __commonJS({
38747
38747
  const minor = match3[3] || "0";
38748
38748
  const patch = match3[4] || "0";
38749
38749
  const prerelease = options.includePrerelease && match3[5] ? `-${match3[5]}` : "";
38750
- const build3 = options.includePrerelease && match3[6] ? `+${match3[6]}` : "";
38751
- return parse6(`${major}.${minor}.${patch}${prerelease}${build3}`, options);
38750
+ const build4 = options.includePrerelease && match3[6] ? `+${match3[6]}` : "";
38751
+ return parse6(`${major}.${minor}.${patch}${prerelease}${build4}`, options);
38752
38752
  };
38753
38753
  module.exports = coerce;
38754
38754
  }
@@ -40581,9 +40581,9 @@ var require_timers2 = __commonJS({
40581
40581
  * before the specified function or code is executed.
40582
40582
  * @param {*} arg
40583
40583
  */
40584
- constructor(callback, delay2, arg10) {
40584
+ constructor(callback, delay3, arg10) {
40585
40585
  this._onTimeout = callback;
40586
- this._idleTimeout = delay2;
40586
+ this._idleTimeout = delay3;
40587
40587
  this._timerArg = arg10;
40588
40588
  this.refresh();
40589
40589
  }
@@ -40628,8 +40628,8 @@ var require_timers2 = __commonJS({
40628
40628
  * when the timer expires.
40629
40629
  * @returns {NodeJS.Timeout|FastTimer}
40630
40630
  */
40631
- setTimeout(callback, delay2, arg10) {
40632
- return delay2 <= RESOLUTION_MS ? setTimeout(callback, delay2, arg10) : new FastTimer(callback, delay2, arg10);
40631
+ setTimeout(callback, delay3, arg10) {
40632
+ return delay3 <= RESOLUTION_MS ? setTimeout(callback, delay3, arg10) : new FastTimer(callback, delay3, arg10);
40633
40633
  },
40634
40634
  /**
40635
40635
  * The clearTimeout method cancels an instantiated Timer previously created
@@ -40655,8 +40655,8 @@ var require_timers2 = __commonJS({
40655
40655
  * when the timer expires.
40656
40656
  * @returns {FastTimer}
40657
40657
  */
40658
- setFastTimeout(callback, delay2, arg10) {
40659
- return new FastTimer(callback, delay2, arg10);
40658
+ setFastTimeout(callback, delay3, arg10) {
40659
+ return new FastTimer(callback, delay3, arg10);
40660
40660
  },
40661
40661
  /**
40662
40662
  * The clearTimeout method cancels an instantiated FastTimer previously
@@ -40682,8 +40682,8 @@ var require_timers2 = __commonJS({
40682
40682
  * @deprecated
40683
40683
  * @param {number} [delay=0] The delay in milliseconds to add to the now value.
40684
40684
  */
40685
- tick(delay2 = 0) {
40686
- fastNow += delay2 - RESOLUTION_MS + 1;
40685
+ tick(delay3 = 0) {
40686
+ fastNow += delay3 - RESOLUTION_MS + 1;
40687
40687
  onTick();
40688
40688
  onTick();
40689
40689
  },
@@ -42507,7 +42507,7 @@ var require_request3 = __commonJS({
42507
42507
  method,
42508
42508
  body,
42509
42509
  headers,
42510
- query,
42510
+ query: query2,
42511
42511
  idempotent,
42512
42512
  blocking,
42513
42513
  upgrade,
@@ -42599,7 +42599,7 @@ var require_request3 = __commonJS({
42599
42599
  this.completed = false;
42600
42600
  this.aborted = false;
42601
42601
  this.upgrade = upgrade || null;
42602
- this.path = query ? serializePathWithQuery(path4, query) : path4;
42602
+ this.path = query2 ? serializePathWithQuery(path4, query2) : path4;
42603
42603
  this.origin = origin;
42604
42604
  this.protocol = getProtocolFromUrlString(origin);
42605
42605
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -47166,21 +47166,21 @@ var require_client_h1 = __commonJS({
47166
47166
  this.connection = "";
47167
47167
  this.maxResponseSize = client2[kMaxResponseSize];
47168
47168
  }
47169
- setTimeout(delay2, type2) {
47170
- if (delay2 !== this.timeoutValue || type2 & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
47169
+ setTimeout(delay3, type2) {
47170
+ if (delay3 !== this.timeoutValue || type2 & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
47171
47171
  if (this.timeout) {
47172
47172
  timers.clearTimeout(this.timeout);
47173
47173
  this.timeout = null;
47174
47174
  }
47175
- if (delay2) {
47175
+ if (delay3) {
47176
47176
  if (type2 & USE_FAST_TIMER) {
47177
- this.timeout = timers.setFastTimeout(onParserTimeout, delay2, this.timeoutWeakRef);
47177
+ this.timeout = timers.setFastTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
47178
47178
  } else {
47179
- this.timeout = setTimeout(onParserTimeout, delay2, this.timeoutWeakRef);
47179
+ this.timeout = setTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
47180
47180
  this.timeout?.unref();
47181
47181
  }
47182
47182
  }
47183
- this.timeoutValue = delay2;
47183
+ this.timeoutValue = delay3;
47184
47184
  } else if (this.timeout) {
47185
47185
  if (this.timeout.refresh) {
47186
47186
  this.timeout.refresh();
@@ -53174,11 +53174,11 @@ var require_mock_utils2 = __commonJS({
53174
53174
  }
53175
53175
  return true;
53176
53176
  }
53177
- function normalizeSearchParams(query) {
53178
- if (typeof query !== "string") {
53179
- return query;
53177
+ function normalizeSearchParams(query2) {
53178
+ if (typeof query2 !== "string") {
53179
+ return query2;
53180
53180
  }
53181
- const originalQp = new URLSearchParams(query);
53181
+ const originalQp = new URLSearchParams(query2);
53182
53182
  const normalizedQp = new URLSearchParams();
53183
53183
  for (let [key, value2] of originalQp.entries()) {
53184
53184
  key = key.replace("[]", "");
@@ -53286,13 +53286,13 @@ var require_mock_utils2 = __commonJS({
53286
53286
  return path4;
53287
53287
  }
53288
53288
  function buildKey(opts) {
53289
- const { path: path4, method, body, headers, query } = opts;
53289
+ const { path: path4, method, body, headers, query: query2 } = opts;
53290
53290
  return {
53291
53291
  path: path4,
53292
53292
  method,
53293
53293
  body,
53294
53294
  headers,
53295
- query
53295
+ query: query2
53296
53296
  };
53297
53297
  }
53298
53298
  function generateKeyValues(data) {
@@ -53329,7 +53329,7 @@ var require_mock_utils2 = __commonJS({
53329
53329
  if (mockDispatch2.data.callback) {
53330
53330
  mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) };
53331
53331
  }
53332
- const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay2, persist } = mockDispatch2;
53332
+ const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay3, persist } = mockDispatch2;
53333
53333
  const { timesInvoked, times } = mockDispatch2;
53334
53334
  mockDispatch2.consumed = !persist && timesInvoked >= times;
53335
53335
  mockDispatch2.pending = timesInvoked < times;
@@ -53352,11 +53352,11 @@ var require_mock_utils2 = __commonJS({
53352
53352
  handler2.onError(err);
53353
53353
  }
53354
53354
  handler2.onConnect?.(abort, null);
53355
- if (typeof delay2 === "number" && delay2 > 0) {
53355
+ if (typeof delay3 === "number" && delay3 > 0) {
53356
53356
  timer = setTimeout(() => {
53357
53357
  timer = null;
53358
53358
  handleReply(this[kDispatches]);
53359
- }, delay2);
53359
+ }, delay3);
53360
53360
  } else {
53361
53361
  handleReply(this[kDispatches]);
53362
53362
  }
@@ -53726,13 +53726,13 @@ var require_mock_call_history = __commonJS({
53726
53726
  function makeFilterCalls(parameterName) {
53727
53727
  return (parameterValue, logs) => {
53728
53728
  if (typeof parameterValue === "string" || parameterValue == null) {
53729
- return logs.filter((log4) => {
53730
- return log4[parameterName] === parameterValue;
53729
+ return logs.filter((log3) => {
53730
+ return log3[parameterName] === parameterValue;
53731
53731
  });
53732
53732
  }
53733
53733
  if (parameterValue instanceof RegExp) {
53734
- return logs.filter((log4) => {
53735
- return parameterValue.test(log4[parameterName]);
53734
+ return logs.filter((log3) => {
53735
+ return parameterValue.test(log3[parameterName]);
53736
53736
  });
53737
53737
  }
53738
53738
  throw new InvalidArgumentError(`${parameterName} parameter should be one of string, regexp, undefined or null`);
@@ -53827,8 +53827,8 @@ var require_mock_call_history = __commonJS({
53827
53827
  return this.logs.filter(criteria);
53828
53828
  }
53829
53829
  if (criteria instanceof RegExp) {
53830
- return this.logs.filter((log4) => {
53831
- return criteria.test(log4.toString());
53830
+ return this.logs.filter((log3) => {
53831
+ return criteria.test(log3.toString());
53832
53832
  });
53833
53833
  }
53834
53834
  if (typeof criteria === "object" && criteria !== null) {
@@ -53878,13 +53878,13 @@ var require_mock_call_history = __commonJS({
53878
53878
  this.logs = [];
53879
53879
  }
53880
53880
  [kMockCallHistoryAddLog](requestInit) {
53881
- const log4 = new MockCallHistoryLog(requestInit);
53882
- this.logs.push(log4);
53883
- return log4;
53881
+ const log3 = new MockCallHistoryLog(requestInit);
53882
+ this.logs.push(log3);
53883
+ return log3;
53884
53884
  }
53885
53885
  *[Symbol.iterator]() {
53886
- for (const log4 of this.calls()) {
53887
- yield log4;
53886
+ for (const log3 of this.calls()) {
53887
+ yield log3;
53888
53888
  }
53889
53889
  }
53890
53890
  };
@@ -56296,18 +56296,18 @@ var require_cache2 = __commonJS({
56296
56296
  }
56297
56297
  }
56298
56298
  }
56299
- function makeDeduplicationKey(cacheKey2, excludeHeaders) {
56299
+ function makeDeduplicationKey(cacheKey3, excludeHeaders) {
56300
56300
  const headers = {};
56301
- if (cacheKey2.headers) {
56302
- const sortedHeaders = Object.keys(cacheKey2.headers).sort();
56301
+ if (cacheKey3.headers) {
56302
+ const sortedHeaders = Object.keys(cacheKey3.headers).sort();
56303
56303
  for (const header of sortedHeaders) {
56304
56304
  if (excludeHeaders?.has(header.toLowerCase())) {
56305
56305
  continue;
56306
56306
  }
56307
- headers[header] = cacheKey2.headers[header];
56307
+ headers[header] = cacheKey3.headers[header];
56308
56308
  }
56309
56309
  }
56310
- return JSON.stringify([cacheKey2.origin, cacheKey2.method, cacheKey2.path, headers]);
56310
+ return JSON.stringify([cacheKey3.origin, cacheKey3.method, cacheKey3.path, headers]);
56311
56311
  }
56312
56312
  module.exports = {
56313
56313
  makeCacheKey,
@@ -56881,7 +56881,7 @@ var require_cache_handler = __commonJS({
56881
56881
  }
56882
56882
  }
56883
56883
  }
56884
- function getSameOriginPath(cacheKey2, location) {
56884
+ function getSameOriginPath(cacheKey3, location) {
56885
56885
  if (typeof location !== "string") {
56886
56886
  return void 0;
56887
56887
  }
@@ -56889,8 +56889,8 @@ var require_cache_handler = __commonJS({
56889
56889
  let requestUrl;
56890
56890
  let locationUrl;
56891
56891
  try {
56892
- originUrl = new URL(cacheKey2.origin);
56893
- requestUrl = new URL(cacheKey2.path, originUrl);
56892
+ originUrl = new URL(cacheKey3.origin);
56893
+ requestUrl = new URL(cacheKey3.path, originUrl);
56894
56894
  locationUrl = new URL(location, requestUrl);
56895
56895
  } catch {
56896
56896
  return void 0;
@@ -56900,38 +56900,38 @@ var require_cache_handler = __commonJS({
56900
56900
  }
56901
56901
  return locationUrl.pathname + locationUrl.search;
56902
56902
  }
56903
- function deleteCachedUri(store, cacheKey2, path4) {
56903
+ function deleteCachedUri(store, cacheKey3, path4) {
56904
56904
  deleteCachedValue(store, {
56905
- ...cacheKey2,
56905
+ ...cacheKey3,
56906
56906
  path: path4
56907
56907
  });
56908
56908
  for (let i2 = 0; i2 < util2.safeHTTPMethods.length; i2++) {
56909
56909
  const method = util2.safeHTTPMethods[i2];
56910
- if (method !== cacheKey2.method) {
56910
+ if (method !== cacheKey3.method) {
56911
56911
  deleteCachedValue(store, {
56912
- ...cacheKey2,
56912
+ ...cacheKey3,
56913
56913
  method,
56914
56914
  path: path4
56915
56915
  });
56916
56916
  }
56917
56917
  }
56918
56918
  }
56919
- function deleteLocationTargets(store, cacheKey2, headerValue) {
56919
+ function deleteLocationTargets(store, cacheKey3, headerValue) {
56920
56920
  if (headerValue === void 0) {
56921
56921
  return;
56922
56922
  }
56923
56923
  const values = Array.isArray(headerValue) ? headerValue : [headerValue];
56924
56924
  for (let i2 = 0; i2 < values.length; i2++) {
56925
- const path4 = getSameOriginPath(cacheKey2, values[i2]);
56925
+ const path4 = getSameOriginPath(cacheKey3, values[i2]);
56926
56926
  if (path4 !== void 0) {
56927
- deleteCachedUri(store, cacheKey2, path4);
56927
+ deleteCachedUri(store, cacheKey3, path4);
56928
56928
  }
56929
56929
  }
56930
56930
  }
56931
- function invalidateUnsafeRequest(store, cacheKey2, resHeaders) {
56932
- deleteCachedUri(store, cacheKey2, cacheKey2.path);
56933
- deleteLocationTargets(store, cacheKey2, resHeaders.location);
56934
- deleteLocationTargets(store, cacheKey2, resHeaders["content-location"]);
56931
+ function invalidateUnsafeRequest(store, cacheKey3, resHeaders) {
56932
+ deleteCachedUri(store, cacheKey3, cacheKey3.path);
56933
+ deleteLocationTargets(store, cacheKey3, resHeaders.location);
56934
+ deleteLocationTargets(store, cacheKey3, resHeaders["content-location"]);
56935
56935
  }
56936
56936
  var CacheHandler = class {
56937
56937
  /**
@@ -56963,11 +56963,11 @@ var require_cache_handler = __commonJS({
56963
56963
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
56964
56964
  * @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
56965
56965
  */
56966
- constructor({ store, type: type2, cacheByDefault }, cacheKey2, handler2) {
56966
+ constructor({ store, type: type2, cacheByDefault }, cacheKey3, handler2) {
56967
56967
  this.#store = store;
56968
56968
  this.#cacheType = type2;
56969
56969
  this.#cacheByDefault = cacheByDefault;
56970
- this.#cacheKey = cacheKey2;
56970
+ this.#cacheKey = cacheKey3;
56971
56971
  this.#handler = handler2;
56972
56972
  }
56973
56973
  onRequestStart(controller, context) {
@@ -57160,15 +57160,15 @@ var require_cache_handler = __commonJS({
57160
57160
  this.#handler.onResponseError?.(controller, err);
57161
57161
  }
57162
57162
  };
57163
- function deleteCachedValue(store, cacheKey2) {
57163
+ function deleteCachedValue(store, cacheKey3) {
57164
57164
  try {
57165
- store.delete(cacheKey2)?.catch?.(noop4);
57165
+ store.delete(cacheKey3)?.catch?.(noop4);
57166
57166
  } catch {
57167
57167
  }
57168
57168
  }
57169
- function deleteCachedValueIfNotModified(statusCode, store, cacheKey2) {
57169
+ function deleteCachedValueIfNotModified(statusCode, store, cacheKey3) {
57170
57170
  if (statusCode === 304) {
57171
- deleteCachedValue(store, cacheKey2);
57171
+ deleteCachedValue(store, cacheKey3);
57172
57172
  }
57173
57173
  }
57174
57174
  function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
@@ -57734,9 +57734,9 @@ var require_cache3 = __commonJS({
57734
57734
  function revalidationResponseUpdatesCacheControl(headers) {
57735
57735
  return headers["cache-control"] !== void 0;
57736
57736
  }
57737
- function deleteCachedValue(store, cacheKey2) {
57737
+ function deleteCachedValue(store, cacheKey3) {
57738
57738
  try {
57739
- store.delete(cacheKey2)?.catch?.(nop);
57739
+ store.delete(cacheKey3)?.catch?.(nop);
57740
57740
  } catch {
57741
57741
  }
57742
57742
  }
@@ -57788,7 +57788,7 @@ var require_cache3 = __commonJS({
57788
57788
  const staleWhileRevalidateExpiry = result.staleAt + staleWhileRevalidate * 1e3;
57789
57789
  return now <= staleWhileRevalidateExpiry;
57790
57790
  }
57791
- function handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler2, opts, reqCacheControl) {
57791
+ function handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl) {
57792
57792
  if (reqCacheControl?.["only-if-cached"]) {
57793
57793
  let aborted3 = false;
57794
57794
  try {
@@ -57816,7 +57816,7 @@ var require_cache3 = __commonJS({
57816
57816
  }
57817
57817
  return true;
57818
57818
  }
57819
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler2));
57819
+ return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
57820
57820
  }
57821
57821
  function sendCachedValue(handler2, opts, result, age, context, isStale2) {
57822
57822
  const stream = util2.isStream(result.body) ? result.body : Readable2.from(result.body ?? []);
@@ -57872,20 +57872,20 @@ var require_cache3 = __commonJS({
57872
57872
  });
57873
57873
  }
57874
57874
  }
57875
- function handleResult2(dispatch, globalOpts, cacheKey2, handler2, opts, reqCacheControl, result) {
57875
+ function handleResult2(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl, result) {
57876
57876
  if (!result) {
57877
- return handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler2, opts, reqCacheControl);
57877
+ return handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl);
57878
57878
  }
57879
57879
  if (globalOpts.type === "shared" && Object.hasOwn(result.headers, "set-cookie")) {
57880
57880
  if (util2.isStream(result.body)) {
57881
57881
  result.body.on("error", nop).destroy();
57882
57882
  }
57883
- deleteCachedValue(globalOpts.store, cacheKey2);
57884
- return handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler2, opts, reqCacheControl);
57883
+ deleteCachedValue(globalOpts.store, cacheKey3);
57884
+ return handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl);
57885
57885
  }
57886
57886
  const now = Date.now();
57887
57887
  if (now > result.deleteAt) {
57888
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler2));
57888
+ return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
57889
57889
  }
57890
57890
  const age = Math.round((now - result.cachedAt) / 1e3);
57891
57891
  const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
@@ -57893,7 +57893,7 @@ var require_cache3 = __commonJS({
57893
57893
  const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
57894
57894
  if (stale || revalidate) {
57895
57895
  if (util2.isStream(opts.body) && util2.bodyLength(opts.body) !== 0) {
57896
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler2));
57896
+ return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
57897
57897
  }
57898
57898
  if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
57899
57899
  sendCachedValue(handler2, opts, result, age, null, true);
@@ -57904,7 +57904,7 @@ var require_cache3 = __commonJS({
57904
57904
  ...opts,
57905
57905
  headers: headers2
57906
57906
  },
57907
- new CacheHandler(globalOpts, cacheKey2, {
57907
+ new CacheHandler(globalOpts, cacheKey3, {
57908
57908
  // Silent handler that just updates the cache
57909
57909
  onRequestStart() {
57910
57910
  },
@@ -57944,11 +57944,11 @@ var require_cache3 = __commonJS({
57944
57944
  if (util2.isStream(result.body)) {
57945
57945
  result.body.on("error", nop).destroy();
57946
57946
  }
57947
- deleteCachedValue(globalOpts.store, cacheKey2);
57948
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler2));
57947
+ deleteCachedValue(globalOpts.store, cacheKey3);
57948
+ return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
57949
57949
  }
57950
57950
  if (revalidationResponseUpdatesCacheControl(headers2)) {
57951
- deleteCachedValue(globalOpts.store, cacheKey2);
57951
+ deleteCachedValue(globalOpts.store, cacheKey3);
57952
57952
  }
57953
57953
  }
57954
57954
  sendCachedValue(handler2, opts, result, age, context, stale);
@@ -57956,7 +57956,7 @@ var require_cache3 = __commonJS({
57956
57956
  result.body.on("error", nop).destroy();
57957
57957
  }
57958
57958
  },
57959
- new CacheHandler(globalOpts, cacheKey2, handler2),
57959
+ new CacheHandler(globalOpts, cacheKey3, handler2),
57960
57960
  withinStaleIfErrorThreshold
57961
57961
  )
57962
57962
  );
@@ -58031,16 +58031,16 @@ var require_cache3 = __commonJS({
58031
58031
  if (reqCacheControl?.["no-store"]) {
58032
58032
  return dispatch(opts2, handler2);
58033
58033
  }
58034
- const cacheKey2 = makeCacheKey(opts2);
58034
+ const cacheKey3 = makeCacheKey(opts2);
58035
58035
  if (!arrayIncludes(util2.safeHTTPMethods, opts2.method)) {
58036
- return dispatch(opts2, new CacheHandler(globalOpts, cacheKey2, handler2));
58036
+ return dispatch(opts2, new CacheHandler(globalOpts, cacheKey3, handler2));
58037
58037
  }
58038
- const result = store.get(cacheKey2);
58038
+ const result = store.get(cacheKey3);
58039
58039
  if (result && typeof result.then === "function") {
58040
58040
  return result.then((result2) => handleResult2(
58041
58041
  dispatch,
58042
58042
  globalOpts,
58043
- cacheKey2,
58043
+ cacheKey3,
58044
58044
  handler2,
58045
58045
  opts2,
58046
58046
  reqCacheControl,
@@ -58050,7 +58050,7 @@ var require_cache3 = __commonJS({
58050
58050
  return handleResult2(
58051
58051
  dispatch,
58052
58052
  globalOpts,
58053
- cacheKey2,
58053
+ cacheKey3,
58054
58054
  handler2,
58055
58055
  opts2,
58056
58056
  reqCacheControl,
@@ -58943,8 +58943,8 @@ var require_deduplicate = __commonJS({
58943
58943
  }
58944
58944
  }
58945
58945
  }
58946
- const cacheKey2 = makeCacheKey(opts2);
58947
- const dedupeKey = makeDeduplicationKey(cacheKey2, excludeHeaderNamesSet);
58946
+ const cacheKey3 = makeCacheKey(opts2);
58947
+ const dedupeKey = makeDeduplicationKey(cacheKey3, excludeHeaderNamesSet);
58948
58948
  const pendingHandler = pendingRequests.get(dedupeKey);
58949
58949
  if (pendingHandler) {
58950
58950
  if (pendingHandler.addWaitingHandler(handler2)) {
@@ -76549,8 +76549,8 @@ var require_core2 = __commonJS({
76549
76549
  return this;
76550
76550
  }
76551
76551
  case "object": {
76552
- const cacheKey2 = schemaKeyRef;
76553
- this._cache.delete(cacheKey2);
76552
+ const cacheKey3 = schemaKeyRef;
76553
+ this._cache.delete(cacheKey3);
76554
76554
  let id = schemaKeyRef[this.opts.schemaId];
76555
76555
  if (id) {
76556
76556
  id = (0, resolve_1.normalizeId)(id);
@@ -76715,11 +76715,11 @@ var require_core2 = __commonJS({
76715
76715
  Ajv5.ValidationError = validation_error_1.default;
76716
76716
  Ajv5.MissingRefError = ref_error_1.default;
76717
76717
  exports.default = Ajv5;
76718
- function checkOptions(checkOpts, options, msg, log4 = "error") {
76718
+ function checkOptions(checkOpts, options, msg, log3 = "error") {
76719
76719
  for (const key in checkOpts) {
76720
76720
  const opt = key;
76721
76721
  if (opt in options)
76722
- this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
76722
+ this.logger[log3](`${msg}: option ${key}. ${checkOpts[opt]}`);
76723
76723
  }
76724
76724
  }
76725
76725
  function getSchEnv(keyRef) {
@@ -99987,7 +99987,7 @@ var require_node = __commonJS({
99987
99987
  var tty = __require("tty");
99988
99988
  var util2 = __require("util");
99989
99989
  exports.init = init;
99990
- exports.log = log4;
99990
+ exports.log = log3;
99991
99991
  exports.formatArgs = formatArgs2;
99992
99992
  exports.save = save;
99993
99993
  exports.load = load;
@@ -100122,7 +100122,7 @@ var require_node = __commonJS({
100122
100122
  }
100123
100123
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
100124
100124
  }
100125
- function log4(...args2) {
100125
+ function log3(...args2) {
100126
100126
  return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args2) + "\n");
100127
100127
  }
100128
100128
  function save(namespaces) {
@@ -106963,7 +106963,7 @@ var import_picocolors = __toESM(require_picocolors(), 1);
106963
106963
  // package.json
106964
106964
  var package_default = {
106965
106965
  name: "pullfrog",
106966
- version: "0.1.95",
106966
+ version: "0.1.96",
106967
106967
  cliContractVersion: "1",
106968
106968
  type: "module",
106969
106969
  bin: {
@@ -107029,7 +107029,7 @@ var package_default = {
107029
107029
  undici: "^7.22.0",
107030
107030
  vitest: "^4.0.17",
107031
107031
  yaml: "^2.8.2",
107032
- yes: "0.1.0",
107032
+ yes: "0.2.3",
107033
107033
  zod: "4.3.6"
107034
107034
  },
107035
107035
  repository: {
@@ -107264,10 +107264,10 @@ function targetName(target) {
107264
107264
  async function configurationApi(input) {
107265
107265
  const token = input.token ?? tryGetGhToken();
107266
107266
  if (!token) throw new Error(GH_TOKEN_HELP);
107267
- const query = new URLSearchParams({ owner: input.target.owner });
107268
- if (input.target.repo) query.set("repo", input.target.repo);
107267
+ const query2 = new URLSearchParams({ owner: input.target.owner });
107268
+ if (input.target.repo) query2.set("repo", input.target.repo);
107269
107269
  const response = await pullfrogApi({
107270
- path: `/api/cli/${input.path}?${query}`,
107270
+ path: `/api/cli/${input.path}?${query2}`,
107271
107271
  token,
107272
107272
  method: input.method,
107273
107273
  body: input.body
@@ -109762,7 +109762,11 @@ var providers = {
109762
109762
  "glm-flash": {
109763
109763
  displayName: "GLM Flash",
109764
109764
  resolve: "opencode-go/glm-5.3-flash",
109765
- effort: ["low", "high", "max"],
109765
+ // the Go endpoint intermittently rejects reasoning_effort ("native reasoning
109766
+ // control reasoning_effort is not allowed") mid-run, despite models.dev
109767
+ // advertising a ladder — so this route sends none.
109768
+ effort: [],
109769
+ openRouterEffort: ["low", "high", "max"],
109766
109770
  openRouterResolve: "openrouter/z-ai/glm-5.3-flash"
109767
109771
  },
109768
109772
  // legacy alias — the slug pinned a version instead of a brand tier and
@@ -110218,7 +110222,7 @@ var providers = {
110218
110222
  "deepseek-pro": {
110219
110223
  displayName: "DeepSeek Pro",
110220
110224
  resolve: "vercel/deepseek/deepseek-v4-pro-0813",
110221
- effort: ["none", "high", "max"]
110225
+ effort: ["none", "low", "high", "max"]
110222
110226
  },
110223
110227
  // the gateway's bare `deepseek-v4-flash` is the April preview — the same
110224
110228
  // fork trap as OpenRouter, with `deepseek-v4-flash-0731` beside it — so
@@ -110226,7 +110230,7 @@ var providers = {
110226
110230
  "deepseek-flash": {
110227
110231
  displayName: "DeepSeek Flash",
110228
110232
  resolve: "vercel/deepseek/deepseek-v4.1-flash",
110229
- effort: ["none", "high", "max"]
110233
+ effort: ["none", "low", "high", "max"]
110230
110234
  },
110231
110235
  glm: {
110232
110236
  displayName: "GLM",
@@ -110432,13 +110436,13 @@ for (const [name, ladder] of Object.entries({ ...PROVIDER_LADDERS, router: ROUTE
110432
110436
  if (terminal.size < 2) throw new Error(`${name} ladder runs every tier on ${[...terminal][0]}`);
110433
110437
  }
110434
110438
  var OSS_MODEL_ALLOWLIST = [
110435
- "deepseek/deepseek-flash",
110436
- "openai/gpt-luna",
110437
- "openrouter/minimax-m2.5",
110438
110439
  // opt-in: 0.86x the old default on the measured mix, and Meta trains on the
110439
110440
  // traffic — fine for public code on headless runs, the human decided
110440
110441
  // 2026-09-11. unmeasured on a real run; not the default until it is.
110441
- "meta/muse-spark-contributor"
110442
+ "meta/muse-spark-contributor",
110443
+ "deepseek/deepseek-flash",
110444
+ "openai/gpt-luna",
110445
+ "openrouter/minimax-m2.5"
110442
110446
  ];
110443
110447
  var OSS_RECOMMENDED_MODEL = AUTO_TIER_TARGET[AUTO_EFFICIENT];
110444
110448
  function ossFundedModelNames() {
@@ -111438,6 +111442,9 @@ function trackChild(options) {
111438
111442
  function untrackChild(child) {
111439
111443
  activeChildren.delete(child);
111440
111444
  }
111445
+ function isTrackedChild(child) {
111446
+ return activeChildren.has(child);
111447
+ }
111441
111448
  function killTrackedChildren() {
111442
111449
  for (const entry of activeChildren) {
111443
111450
  const child = entry[0];
@@ -111451,6 +111458,7 @@ function killTrackedChildren() {
111451
111458
  }
111452
111459
  child.kill("SIGKILL");
111453
111460
  }
111461
+ activeChildren.clear();
111454
111462
  }
111455
111463
  var handlersInstalled = false;
111456
111464
  function installSignalHandler() {
@@ -112173,7 +112181,7 @@ ${PR_SUMMARY_FORMAT}`
112173
112181
 
112174
112182
  Follow these rules:
112175
112183
  - note: the first create_pull_request_review submission may error with a one-time diff-coverage nudge listing unread TOC regions. retry the same call to proceed \u2014 optionally after reading the listed ranges. the pre-flight will not block again this session.
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.
112184
+ - 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 \`no_review_needed: true\` and 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.
112177
112185
  - 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.
112178
112186
  - 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.
112179
112187
  - 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.
@@ -112334,7 +112342,7 @@ function buildUnsubmittedReviewPrompt(mode) {
112334
112342
  "",
112335
112343
  "do exactly one of:",
112336
112344
  "- if you have findings: call `create_pull_request_review` now with your aggregated review (body + inline comments). the first call may error once with a diff-coverage nudge \u2014 retry the same call to proceed.",
112337
- "- if there are genuinely no actionable findings since the last review (e.g. only formatting / comment / lockfile changes): call `report_progress` with a 1-2 sentence summary explaining that no review was warranted.",
112345
+ "- if there are genuinely no actionable findings since the last review (e.g. only formatting / comment / lockfile changes): call `report_progress` with `no_review_needed: true` and a 1-2 sentence summary explaining that no review was warranted.",
112338
112346
  "",
112339
112347
  "do NOT stop again until one of those tools has been called successfully."
112340
112348
  ].join("\n");
@@ -113315,6 +113323,8 @@ var claude = agent({
113315
113323
  PWD: repoDir
113316
113324
  };
113317
113325
  env2.CLAUDE_CODE_AUTO_COMPACT_WINDOW ||= "500000";
113326
+ env2.CLAUDE_CODE_ENABLE_TODO_TOOLS = "1";
113327
+ env2.CLAUDE_CODE_ENABLE_TASKS = "0";
113318
113328
  if (isBedrockRoute) {
113319
113329
  env2.CLAUDE_CODE_USE_BEDROCK = "1";
113320
113330
  }
@@ -114465,6 +114475,7 @@ var codex = agent({
114465
114475
  // agents/opencode.ts
114466
114476
  import { spawn as nodeSpawn2 } from "node:child_process";
114467
114477
  import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "node:fs";
114478
+ import { totalmem } from "node:os";
114468
114479
  import { join as join8 } from "node:path";
114469
114480
  import { performance as performance7 } from "node:perf_hooks";
114470
114481
 
@@ -114742,13 +114753,13 @@ var defaultPathSerializer = ({ path: path4, url: _url3 }) => {
114742
114753
  }
114743
114754
  return url4;
114744
114755
  };
114745
- var getUrl = ({ baseUrl, path: path4, query, querySerializer, url: _url3 }) => {
114756
+ var getUrl = ({ baseUrl, path: path4, query: query2, querySerializer, url: _url3 }) => {
114746
114757
  const pathUrl = _url3.startsWith("/") ? _url3 : `/${_url3}`;
114747
114758
  let url4 = (baseUrl ?? "") + pathUrl;
114748
114759
  if (path4) {
114749
114760
  url4 = defaultPathSerializer({ path: path4, url: url4 });
114750
114761
  }
114751
- let search2 = query ? querySerializer(query) : "";
114762
+ let search2 = query2 ? querySerializer(query2) : "";
114752
114763
  if (search2.startsWith("?")) {
114753
114764
  search2 = search2.substring(1);
114754
114765
  }
@@ -119816,9 +119827,9 @@ function rewrite(request2, values) {
119816
119827
  const value2 = pick2(request2.headers.get(name), key === "directory" ? values.directory : values.workspace, key === "directory" ? encodeURIComponent : void 0);
119817
119828
  if (!value2)
119818
119829
  continue;
119819
- for (const query of url4.pathname.startsWith("/api/") ? [key, `location[${key}]`] : [key]) {
119820
- if (!url4.searchParams.has(query)) {
119821
- url4.searchParams.set(query, value2);
119830
+ for (const query2 of url4.pathname.startsWith("/api/") ? [key, `location[${key}]`] : [key]) {
119831
+ if (!url4.searchParams.has(query2)) {
119832
+ url4.searchParams.set(query2, value2);
119822
119833
  }
119823
119834
  }
119824
119835
  changed = true;
@@ -120338,11 +120349,12 @@ function bootOpencodeServer(params) {
120338
120349
  log2.debug(`[opencode serve] ${text}`);
120339
120350
  });
120340
120351
  let closed = false;
120352
+ let exitCause;
120341
120353
  const close = async () => {
120342
120354
  if (closed) return;
120343
120355
  closed = true;
120344
120356
  untrackChild(proc);
120345
- if (proc.pid && !proc.killed) {
120357
+ if (proc.pid && proc.exitCode === null && proc.signalCode === null) {
120346
120358
  try {
120347
120359
  process.kill(-proc.pid, "SIGTERM");
120348
120360
  } catch {
@@ -120376,7 +120388,7 @@ function bootOpencodeServer(params) {
120376
120388
  if (match3?.[1]) {
120377
120389
  resolved = true;
120378
120390
  log2.info(`\xBB opencode server up: ${match3[1]}`);
120379
- resolve3({ baseUrl: match3[1], proc, close, recentStderr });
120391
+ resolve3({ baseUrl: match3[1], proc, close, recentStderr, exitCause: () => exitCause });
120380
120392
  }
120381
120393
  }
120382
120394
  const lines = text.split("\n");
@@ -120393,6 +120405,11 @@ function bootOpencodeServer(params) {
120393
120405
  reject(new Error(`failed to spawn opencode serve: ${err.message}`));
120394
120406
  }
120395
120407
  });
120408
+ proc.once("exit", (code, signal) => {
120409
+ if (!resolved || !isTrackedChild(proc)) return;
120410
+ exitCause = describeServerExit(code, signal);
120411
+ log2.warning(withServerStderr(`\xBB ${exitCause}`, recentStderr));
120412
+ });
120396
120413
  proc.once("close", (code, signal) => {
120397
120414
  if (!resolved) {
120398
120415
  const tail = recentStderr.slice(-5).join("\n");
@@ -120426,6 +120443,12 @@ function withServerStderr(message, recentStderr) {
120426
120443
  opencode server stderr:
120427
120444
  ${tail}` : message;
120428
120445
  }
120446
+ function describeServerExit(code, signal) {
120447
+ if (signal !== "SIGKILL") return `opencode server exited mid-run (${signal ?? `code ${code}`})`;
120448
+ const limit = process.constrainedMemory();
120449
+ const memoryGb = ((limit > 0 ? Math.min(limit, totalmem()) : totalmem()) / 1024 ** 3).toFixed(1);
120450
+ return `opencode server was killed (SIGKILL) mid-run, usually by the kernel OOM killer \u2014 this runner has ${memoryGb} GB of memory`;
120451
+ }
120429
120452
  function newTurn() {
120430
120453
  return {
120431
120454
  finalText: "",
@@ -120651,7 +120674,8 @@ async function runPromptTurn(ctx, params) {
120651
120674
  costUsd: usage.costUsd
120652
120675
  });
120653
120676
  }
120654
- const diagnosis = ctx.diagnostic.lastProviderError ? ` \u2014 likely cause: ${ctx.diagnostic.lastProviderError}` : "";
120677
+ const cause = ctx.serverExitCause() ?? ctx.diagnostic.lastProviderError;
120678
+ const diagnosis = cause ? ` \u2014 likely cause: ${cause}` : "";
120655
120679
  if (networkError) {
120656
120680
  return {
120657
120681
  success: false,
@@ -120969,6 +120993,7 @@ var opencode = agent({
120969
120993
  loggedToolCallIDs: /* @__PURE__ */ new Set(),
120970
120994
  mcpToolCalls: 0,
120971
120995
  recentStderr: server.recentStderr,
120996
+ serverExitCause: server.exitCause,
120972
120997
  diagnostic: {
120973
120998
  label: "Pullfrog",
120974
120999
  recentStderr: server.recentStderr,
@@ -126399,10 +126424,10 @@ function getMatch(pattern, exp) {
126399
126424
  }
126400
126425
  function parseQuery(pattern, options = {}) {
126401
126426
  return pattern.replace(/\\\|/g, ESCAPED_PIPE).split(OR_TOKEN).map((item) => {
126402
- const query = tokenize(item.replace(/\u0000/g, "|").trim()).filter((item2) => item2 && !!item2.trim());
126427
+ const query2 = tokenize(item.replace(/\u0000/g, "|").trim()).filter((item2) => item2 && !!item2.trim());
126403
126428
  const results = [];
126404
- for (let i2 = 0, len = query.length; i2 < len; i2 += 1) {
126405
- const queryItem = query[i2];
126429
+ for (let i2 = 0, len = query2.length; i2 < len; i2 += 1) {
126430
+ const queryItem = query2[i2];
126406
126431
  let found = false;
126407
126432
  let idx = -1;
126408
126433
  while (!found && ++idx < matchersLen) {
@@ -126450,8 +126475,8 @@ var ExtendedSearch = class {
126450
126475
  return options.useExtendedSearch;
126451
126476
  }
126452
126477
  searchIn(text) {
126453
- const query = this.query;
126454
- if (!query) return {
126478
+ const query2 = this.query;
126479
+ if (!query2) return {
126455
126480
  isMatch: false,
126456
126481
  score: 1
126457
126482
  };
@@ -126462,8 +126487,8 @@ var ExtendedSearch = class {
126462
126487
  const allIndices = [];
126463
126488
  let totalScore = 0;
126464
126489
  let hasInverse = false;
126465
- for (let i2 = 0, qLen = query.length; i2 < qLen; i2 += 1) {
126466
- const searchers = query[i2];
126490
+ for (let i2 = 0, qLen = query2.length; i2 < qLen; i2 += 1) {
126491
+ const searchers = query2[i2];
126467
126492
  allIndices.length = 0;
126468
126493
  numMatches = 0;
126469
126494
  hasInverse = false;
@@ -126519,26 +126544,26 @@ var KeyType = {
126519
126544
  PATH: "$path",
126520
126545
  PATTERN: "$val"
126521
126546
  };
126522
- var isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
126523
- var isPath = (query) => !!query[KeyType.PATH];
126524
- var isLeaf = (query) => !isArray2(query) && isObject2(query) && !isExpression(query);
126525
- var convertToExplicit = (query) => ({ [LogicalOperator.AND]: Object.keys(query).map((key) => ({ [key]: query[key] })) });
126526
- function parse3(query, options, { auto = true } = {}) {
126527
- const next2 = (query2) => {
126528
- if (isString(query2)) {
126547
+ var isExpression = (query2) => !!(query2[LogicalOperator.AND] || query2[LogicalOperator.OR]);
126548
+ var isPath = (query2) => !!query2[KeyType.PATH];
126549
+ var isLeaf = (query2) => !isArray2(query2) && isObject2(query2) && !isExpression(query2);
126550
+ var convertToExplicit = (query2) => ({ [LogicalOperator.AND]: Object.keys(query2).map((key) => ({ [key]: query2[key] })) });
126551
+ function parse3(query2, options, { auto = true } = {}) {
126552
+ const next2 = (query3) => {
126553
+ if (isString(query3)) {
126529
126554
  const obj = {
126530
126555
  keyId: null,
126531
- pattern: query2
126556
+ pattern: query3
126532
126557
  };
126533
- if (auto) obj.searcher = createSearcher(query2, options);
126558
+ if (auto) obj.searcher = createSearcher(query3, options);
126534
126559
  return obj;
126535
126560
  }
126536
- const keys = Object.keys(query2);
126537
- const isQueryPath = isPath(query2);
126538
- if (!isQueryPath && keys.length > 1 && !isExpression(query2)) return next2(convertToExplicit(query2));
126539
- if (isLeaf(query2)) {
126540
- const key = isQueryPath ? query2[KeyType.PATH] : keys[0];
126541
- const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key];
126561
+ const keys = Object.keys(query3);
126562
+ const isQueryPath = isPath(query3);
126563
+ if (!isQueryPath && keys.length > 1 && !isExpression(query3)) return next2(convertToExplicit(query3));
126564
+ if (isLeaf(query3)) {
126565
+ const key = isQueryPath ? query3[KeyType.PATH] : keys[0];
126566
+ const pattern = isQueryPath ? query3[KeyType.PATTERN] : query3[key];
126542
126567
  if (!isString(pattern)) throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
126543
126568
  const obj = {
126544
126569
  keyId: createKeyId(key),
@@ -126552,15 +126577,15 @@ function parse3(query, options, { auto = true } = {}) {
126552
126577
  operator: keys[0]
126553
126578
  };
126554
126579
  keys.forEach((key) => {
126555
- const value2 = query2[key];
126580
+ const value2 = query3[key];
126556
126581
  if (isArray2(value2)) value2.forEach((item) => {
126557
126582
  node2.children.push(next2(item));
126558
126583
  });
126559
126584
  });
126560
126585
  return node2;
126561
126586
  };
126562
- if (!isExpression(query)) query = convertToExplicit(query);
126563
- return next2(query);
126587
+ if (!isExpression(query2)) query2 = convertToExplicit(query2);
126588
+ return next2(query2);
126564
126589
  }
126565
126590
  function computeScoreSingle(matches, { ignoreFieldNorm = Config3.ignoreFieldNorm }) {
126566
126591
  let totalScore = 1;
@@ -126856,13 +126881,13 @@ var Fuse = class {
126856
126881
  this._lastQuery = null;
126857
126882
  this._lastSearcher = null;
126858
126883
  }
126859
- _getSearcher(query) {
126860
- if (this._lastQuery === query) return this._lastSearcher;
126861
- const searcher = createSearcher(query, this._invertedIndex ? {
126884
+ _getSearcher(query2) {
126885
+ if (this._lastQuery === query2) return this._lastSearcher;
126886
+ const searcher = createSearcher(query2, this._invertedIndex ? {
126862
126887
  ...this.options,
126863
126888
  _invertedIndex: this._invertedIndex
126864
126889
  } : this.options);
126865
- this._lastQuery = query;
126890
+ this._lastQuery = query2;
126866
126891
  this._lastSearcher = searcher;
126867
126892
  return searcher;
126868
126893
  }
@@ -126931,10 +126956,10 @@ var Fuse = class {
126931
126956
  _normalizedKeys() {
126932
126957
  return this._myIndex.keys.map((key) => this._keyStore.get(key.id) || key);
126933
126958
  }
126934
- search(query, options) {
126959
+ search(query2, options) {
126935
126960
  const { limit = -1 } = options || {};
126936
126961
  const { includeMatches, includeScore, shouldSort, sortFn, ignoreFieldNorm } = this.options;
126937
- if (isString(query) && !query.trim()) {
126962
+ if (isString(query2) && !query2.trim()) {
126938
126963
  let docs = this._docs.map((item, idx) => ({
126939
126964
  item,
126940
126965
  refIndex: idx
@@ -126942,25 +126967,25 @@ var Fuse = class {
126942
126967
  if (isNumber(limit) && limit > -1) docs = docs.slice(0, limit);
126943
126968
  return docs;
126944
126969
  }
126945
- const useHeap = shouldSort && isNumber(limit) && limit > 0 && isString(query);
126970
+ const useHeap = shouldSort && isNumber(limit) && limit > 0 && isString(query2);
126946
126971
  const comparator = sortFn;
126947
126972
  const stable = (a2, b) => comparator(a2, b) || a2.idx - b.idx;
126948
126973
  let results;
126949
126974
  if (useHeap) {
126950
126975
  const heap = new MaxHeap(limit, stable);
126951
- if (isString(this._docs[0])) this._searchStringList(query, {
126976
+ if (isString(this._docs[0])) this._searchStringList(query2, {
126952
126977
  heap,
126953
126978
  ignoreFieldNorm
126954
126979
  });
126955
- else this._searchObjectList(query, {
126980
+ else this._searchObjectList(query2, {
126956
126981
  heap,
126957
126982
  ignoreFieldNorm
126958
126983
  });
126959
126984
  results = heap.extractSorted();
126960
126985
  } else {
126961
- results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
126986
+ results = isString(query2) ? isString(this._docs[0]) ? this._searchStringList(query2) : this._searchObjectList(query2) : this._searchLogical(query2);
126962
126987
  computeScore(results, { ignoreFieldNorm });
126963
- if (shouldSort) results.sort(isString(query) ? stable : comparator);
126988
+ if (shouldSort) results.sort(isString(query2) ? stable : comparator);
126964
126989
  if (isNumber(limit) && limit > -1) results = results.slice(0, limit);
126965
126990
  }
126966
126991
  return format(results, this._docs, {
@@ -126968,8 +126993,8 @@ var Fuse = class {
126968
126993
  includeScore
126969
126994
  });
126970
126995
  }
126971
- _searchStringList(query, { heap, ignoreFieldNorm } = {}) {
126972
- const searcher = this._getSearcher(query);
126996
+ _searchStringList(query2, { heap, ignoreFieldNorm } = {}) {
126997
+ const searcher = this._getSearcher(query2);
126973
126998
  const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
126974
126999
  const { records } = this._myIndex;
126975
127000
  const results = heap ? null : [];
@@ -127004,8 +127029,8 @@ var Fuse = class {
127004
127029
  });
127005
127030
  return results;
127006
127031
  }
127007
- _searchLogical(query) {
127008
- const expression = parse3(query, this.options);
127032
+ _searchLogical(query2) {
127033
+ const expression = parse3(query2, this.options);
127009
127034
  const keys = this._normalizedKeys();
127010
127035
  const evaluate = (node2, item, idx) => {
127011
127036
  if (!("children" in node2)) {
@@ -127065,8 +127090,8 @@ var Fuse = class {
127065
127090
  });
127066
127091
  return results;
127067
127092
  }
127068
- _searchObjectList(query, { heap, ignoreFieldNorm } = {}) {
127069
- const searcher = this._getSearcher(query);
127093
+ _searchObjectList(query2, { heap, ignoreFieldNorm } = {}) {
127094
+ const searcher = this._getSearcher(query2);
127070
127095
  const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
127071
127096
  const { records } = this._myIndex;
127072
127097
  const keys = this._normalizedKeys();
@@ -127293,10 +127318,10 @@ var getPattern = (label, next2) => {
127293
127318
  if (label === "*") return "*";
127294
127319
  const match3 = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
127295
127320
  if (match3) {
127296
- const cacheKey2 = `${label}#${next2}`;
127297
- if (!patternCache[cacheKey2]) {
127298
- if (match3[2]) patternCache[cacheKey2] = next2 && next2[0] !== ":" && next2[0] !== "*" ? [
127299
- cacheKey2,
127321
+ const cacheKey3 = `${label}#${next2}`;
127322
+ if (!patternCache[cacheKey3]) {
127323
+ if (match3[2]) patternCache[cacheKey3] = next2 && next2[0] !== ":" && next2[0] !== "*" ? [
127324
+ cacheKey3,
127300
127325
  match3[1],
127301
127326
  new RegExp(`^${match3[2]}(?=/${next2})`)
127302
127327
  ] : [
@@ -127304,13 +127329,13 @@ var getPattern = (label, next2) => {
127304
127329
  match3[1],
127305
127330
  new RegExp(`^${match3[2]}$`)
127306
127331
  ];
127307
- else patternCache[cacheKey2] = [
127332
+ else patternCache[cacheKey3] = [
127308
127333
  label,
127309
127334
  match3[1],
127310
127335
  true
127311
127336
  ];
127312
127337
  }
127313
- return patternCache[cacheKey2];
127338
+ return patternCache[cacheKey3];
127314
127339
  }
127315
127340
  return null;
127316
127341
  };
@@ -137799,9 +137824,9 @@ var require_schemes2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
137799
137824
  wsComponent.secure = void 0;
137800
137825
  }
137801
137826
  if (wsComponent.resourceName) {
137802
- const [path4, query] = wsComponent.resourceName.split("?");
137827
+ const [path4, query2] = wsComponent.resourceName.split("?");
137803
137828
  wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
137804
- wsComponent.query = query;
137829
+ wsComponent.query = query2;
137805
137830
  wsComponent.resourceName = void 0;
137806
137831
  }
137807
137832
  wsComponent.fragment = void 0;
@@ -138416,8 +138441,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
138416
138441
  return this;
138417
138442
  }
138418
138443
  case "object": {
138419
- const cacheKey2 = schemaKeyRef;
138420
- this._cache.delete(cacheKey2);
138444
+ const cacheKey3 = schemaKeyRef;
138445
+ this._cache.delete(cacheKey3);
138421
138446
  let id = schemaKeyRef[this.opts.schemaId];
138422
138447
  if (id) {
138423
138448
  id = (0, resolve_1.normalizeId)(id);
@@ -138560,10 +138585,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
138560
138585
  Ajv5.ValidationError = validation_error_1.default;
138561
138586
  Ajv5.MissingRefError = ref_error_1.default;
138562
138587
  exports.default = Ajv5;
138563
- function checkOptions(checkOpts, options, msg, log4 = "error") {
138588
+ function checkOptions(checkOpts, options, msg, log3 = "error") {
138564
138589
  for (const key in checkOpts) {
138565
138590
  const opt = key;
138566
- if (opt in options) this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
138591
+ if (opt in options) this.logger[log3](`${msg}: option ${key}. ${checkOpts[opt]}`);
138567
138592
  }
138568
138593
  }
138569
138594
  function getSchEnv(keyRef) {
@@ -152084,9 +152109,9 @@ var require_schemes3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
152084
152109
  wsComponent.secure = void 0;
152085
152110
  }
152086
152111
  if (wsComponent.resourceName) {
152087
- const [path4, query] = wsComponent.resourceName.split("?");
152112
+ const [path4, query2] = wsComponent.resourceName.split("?");
152088
152113
  wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
152089
- wsComponent.query = query;
152114
+ wsComponent.query = query2;
152090
152115
  wsComponent.resourceName = void 0;
152091
152116
  }
152092
152117
  wsComponent.fragment = void 0;
@@ -152701,8 +152726,8 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
152701
152726
  return this;
152702
152727
  }
152703
152728
  case "object": {
152704
- const cacheKey2 = schemaKeyRef;
152705
- this._cache.delete(cacheKey2);
152729
+ const cacheKey3 = schemaKeyRef;
152730
+ this._cache.delete(cacheKey3);
152706
152731
  let id = schemaKeyRef[this.opts.schemaId];
152707
152732
  if (id) {
152708
152733
  id = (0, resolve_1.normalizeId)(id);
@@ -152845,10 +152870,10 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
152845
152870
  Ajv5.ValidationError = validation_error_1.default;
152846
152871
  Ajv5.MissingRefError = ref_error_1.default;
152847
152872
  exports.default = Ajv5;
152848
- function checkOptions(checkOpts, options, msg, log4 = "error") {
152873
+ function checkOptions(checkOpts, options, msg, log3 = "error") {
152849
152874
  for (const key in checkOpts) {
152850
152875
  const opt = key;
152851
- if (opt in options) this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
152876
+ if (opt in options) this.logger[log3](`${msg}: option ${key}. ${checkOpts[opt]}`);
152852
152877
  }
152853
152878
  }
152854
152879
  function getSchEnv(keyRef) {
@@ -163541,7 +163566,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
163541
163566
  if (!namespace) throw new TypeError("argument namespace is required");
163542
163567
  var file2 = callSiteLocation(getStack()[1])[0];
163543
163568
  function deprecate$1(message) {
163544
- log4.call(deprecate$1, message);
163569
+ log3.call(deprecate$1, message);
163545
163570
  }
163546
163571
  deprecate$1._file = file2;
163547
163572
  deprecate$1._ignored = isignored(namespace);
@@ -163563,7 +163588,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
163563
163588
  if (process.traceDeprecation) return true;
163564
163589
  return containsNamespace(process.env.TRACE_DEPRECATION || "", namespace);
163565
163590
  }
163566
- function log4(message, site) {
163591
+ function log3(message, site) {
163567
163592
  var haslisteners = eehaslisteners(process, "deprecation");
163568
163593
  if (!haslisteners && this._ignored) return;
163569
163594
  var caller;
@@ -163669,7 +163694,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
163669
163694
  var args2 = createArgumentsString(fn2.length);
163670
163695
  var site = callSiteLocation(getStack()[1]);
163671
163696
  site.name = fn2.name;
163672
- return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args2 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2, log4, this, message, site);
163697
+ return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args2 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2, log3, this, message, site);
163673
163698
  }
163674
163699
  function wrapproperty(obj, prop, message) {
163675
163700
  if (!obj || typeof obj !== "object" && typeof obj !== "function") throw new TypeError("argument obj must be object");
@@ -163683,11 +163708,11 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
163683
163708
  var get2 = descriptor.get;
163684
163709
  var set2 = descriptor.set;
163685
163710
  if (typeof get2 === "function") descriptor.get = function getter() {
163686
- log4.call(deprecate$1, message, site);
163711
+ log3.call(deprecate$1, message, site);
163687
163712
  return get2.apply(this, arguments);
163688
163713
  };
163689
163714
  if (typeof set2 === "function") descriptor.set = function setter() {
163690
- log4.call(deprecate$1, message, site);
163715
+ log3.call(deprecate$1, message, site);
163691
163716
  return set2.apply(this, arguments);
163692
163717
  };
163693
163718
  Object.defineProperty(obj, prop, descriptor);
@@ -174735,7 +174760,7 @@ ${error49 instanceof Error ? error49.stack : JSON.stringify(error49)}`
174735
174760
  );
174736
174761
  }
174737
174762
  };
174738
- const log4 = {
174763
+ const log3 = {
174739
174764
  debug: (message, context) => {
174740
174765
  this.#server.sendLoggingMessage({
174741
174766
  data: {
@@ -174803,7 +174828,7 @@ ${error49 instanceof Error ? error49.stack : JSON.stringify(error49)}`
174803
174828
  client: {
174804
174829
  version: this.#server.getClientVersion()
174805
174830
  },
174806
- log: log4,
174831
+ log: log3,
174807
174832
  reportProgress: reportProgress2,
174808
174833
  requestId: typeof request2.params?._meta?.requestId === "string" ? request2.params._meta.requestId : void 0,
174809
174834
  session: this.#auth,
@@ -177888,8 +177913,8 @@ var defaultableMorphCache = {};
177888
177913
  var getDefaultableMorph = (node2) => {
177889
177914
  if (!node2.hasDefault())
177890
177915
  return;
177891
- const cacheKey2 = `{${node2.compiledKey}: ${node2.value.id} = ${defaultValueSerializer(node2.default)}}`;
177892
- return defaultableMorphCache[cacheKey2] ??= computeDefaultValueMorph(node2.key, node2.value, node2.default);
177916
+ const cacheKey3 = `{${node2.compiledKey}: ${node2.value.id} = ${defaultValueSerializer(node2.default)}}`;
177917
+ return defaultableMorphCache[cacheKey3] ??= computeDefaultValueMorph(node2.key, node2.value, node2.default);
177893
177918
  };
177894
177919
  var computeDefaultValueMorph = (key, value2, defaultInput) => {
177895
177920
  if (typeof defaultInput === "function") {
@@ -180062,15 +180087,15 @@ var getDefaultableMorphs = (node2) => {
180062
180087
  if (!node2.defaultables)
180063
180088
  return [];
180064
180089
  const morphs = [];
180065
- let cacheKey2 = "[";
180090
+ let cacheKey3 = "[";
180066
180091
  const lastDefaultableIndex = node2.prefixLength + node2.defaultablesLength - 1;
180067
180092
  for (let i2 = node2.prefixLength; i2 <= lastDefaultableIndex; i2++) {
180068
180093
  const [elementNode, defaultValue] = node2.defaultables[i2 - node2.prefixLength];
180069
180094
  morphs.push(computeDefaultValueMorph(i2, elementNode, defaultValue));
180070
- cacheKey2 += `${i2}: ${elementNode.id} = ${defaultValueSerializer(defaultValue)}, `;
180095
+ cacheKey3 += `${i2}: ${elementNode.id} = ${defaultValueSerializer(defaultValue)}, `;
180071
180096
  }
180072
- cacheKey2 += "]";
180073
- return defaultableMorphsCache[cacheKey2] ??= morphs;
180097
+ cacheKey3 += "]";
180098
+ return defaultableMorphsCache[cacheKey3] ??= morphs;
180074
180099
  };
180075
180100
  var Sequence = {
180076
180101
  implementation: implementation21,
@@ -180760,40 +180785,40 @@ var StructureNode = class extends BaseConstraint {
180760
180785
  };
180761
180786
  var defaultableMorphsCache2 = {};
180762
180787
  var constructStructuralMorphCacheKey = (node2) => {
180763
- let cacheKey2 = "";
180788
+ let cacheKey3 = "";
180764
180789
  for (let i2 = 0; i2 < node2.defaultable.length; i2++)
180765
- cacheKey2 += node2.defaultable[i2].defaultValueMorphRef;
180790
+ cacheKey3 += node2.defaultable[i2].defaultValueMorphRef;
180766
180791
  if (node2.sequence?.defaultValueMorphsReference)
180767
- cacheKey2 += node2.sequence?.defaultValueMorphsReference;
180792
+ cacheKey3 += node2.sequence?.defaultValueMorphsReference;
180768
180793
  if (node2.undeclared === "delete") {
180769
- cacheKey2 += "delete !(";
180794
+ cacheKey3 += "delete !(";
180770
180795
  if (node2.required)
180771
180796
  for (const n3 of node2.required)
180772
- cacheKey2 += n3.compiledKey + " | ";
180797
+ cacheKey3 += n3.compiledKey + " | ";
180773
180798
  if (node2.optional)
180774
180799
  for (const n3 of node2.optional)
180775
- cacheKey2 += n3.compiledKey + " | ";
180800
+ cacheKey3 += n3.compiledKey + " | ";
180776
180801
  if (node2.index)
180777
180802
  for (const index of node2.index)
180778
- cacheKey2 += index.signature.id + " | ";
180803
+ cacheKey3 += index.signature.id + " | ";
180779
180804
  if (node2.sequence) {
180780
180805
  if (node2.sequence.maxLength === null)
180781
- cacheKey2 += intrinsic.nonNegativeIntegerString.id;
180806
+ cacheKey3 += intrinsic.nonNegativeIntegerString.id;
180782
180807
  else {
180783
180808
  for (let i2 = 0; i2 < node2.sequence.tuple.length; i2++)
180784
- cacheKey2 += i2 + " | ";
180809
+ cacheKey3 += i2 + " | ";
180785
180810
  }
180786
180811
  }
180787
- cacheKey2 += ")";
180812
+ cacheKey3 += ")";
180788
180813
  }
180789
- return cacheKey2;
180814
+ return cacheKey3;
180790
180815
  };
180791
180816
  var getPossibleMorph = (node2) => {
180792
- const cacheKey2 = constructStructuralMorphCacheKey(node2);
180793
- if (!cacheKey2)
180817
+ const cacheKey3 = constructStructuralMorphCacheKey(node2);
180818
+ if (!cacheKey3)
180794
180819
  return void 0;
180795
- if (defaultableMorphsCache2[cacheKey2])
180796
- return defaultableMorphsCache2[cacheKey2];
180820
+ if (defaultableMorphsCache2[cacheKey3])
180821
+ return defaultableMorphsCache2[cacheKey3];
180797
180822
  const $arkStructuralMorph = (data, ctx) => {
180798
180823
  for (let i2 = 0; i2 < node2.defaultable.length; i2++) {
180799
180824
  if (!(node2.defaultable[i2].key in data))
@@ -180810,7 +180835,7 @@ var getPossibleMorph = (node2) => {
180810
180835
  }
180811
180836
  return data;
180812
180837
  };
180813
- return defaultableMorphsCache2[cacheKey2] = $arkStructuralMorph;
180838
+ return defaultableMorphsCache2[cacheKey3] = $arkStructuralMorph;
180814
180839
  };
180815
180840
  var precompileMorphs = (js, node2) => {
180816
180841
  const requiresContext = node2.defaultable.some((node3) => node3.defaultValueMorph.length === 2) || node2.sequence?.defaultValueMorphs.some((morph) => morph.length === 2);
@@ -183215,10 +183240,10 @@ var schema = ark.schema;
183215
183240
  var define2 = ark.define;
183216
183241
  var declare = ark.declare;
183217
183242
 
183218
- // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/index.js
183243
+ // node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/index.js
183219
183244
  import { setTimeout as sleep2 } from "node:timers/promises";
183220
183245
 
183221
- // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/cache/adapter.js
183246
+ // node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/cache/adapter.js
183222
183247
  var AdapterError = class extends Error {
183223
183248
  method;
183224
183249
  /** the full store key, or the op's prefix when the call covered many keys. never the raw input. */
@@ -183816,43 +183841,45 @@ var I2 = class d2 {
183816
183841
  }
183817
183842
  };
183818
183843
 
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 });
183844
+ // node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/cache/memory.js
183845
+ function memory({ maxItems = 1e3 } = {}) {
183846
+ const store = new I2({ max: maxItems });
183822
183847
  return {
183823
183848
  get: (key) => store.get(key),
183824
183849
  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
- },
183850
+ // the TTL rides on each entry, so ops with different lifetimes can share one store
183851
+ set: (key, entry, ttlMs) => store.set(key, entry, { ttl: ttlMs }),
183830
183852
  delete: (keys) => {
183831
183853
  for (const key of keys)
183832
183854
  store.delete(key);
183833
183855
  },
183834
- // a snapshot, so deleting while iterating is safe. lru-cache skips expired
183835
- // entries itself.
183856
+ // a snapshot, so deleting while iterating is safe
183836
183857
  list: (prefix) => [...store.entries()].filter(([key]) => key.startsWith(prefix))
183837
183858
  };
183838
183859
  }
183839
183860
 
183840
- // node_modules/.pnpm/yes@0.1.0/node_modules/yes/dist/key.js
183861
+ // node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/key.js
183841
183862
  import { hash as hash2 } from "node:crypto";
183842
183863
  function hashKey(value2) {
183843
- return hash2("sha1", serialize(value2, 0));
183864
+ return hash2("sha1", canonical(value2));
183865
+ }
183866
+ function canonical(value2) {
183867
+ return serialize(value2, 0);
183868
+ }
183869
+ function cacheKey2(value2) {
183870
+ if (value2 === null)
183871
+ throw new Error("null cannot be part of a cache key");
183872
+ return value2 === void 0 ? "~void" : hashKey(value2);
183844
183873
  }
183845
- var MAX_DEPTH = 64;
183846
183874
  function serialize(value2, depth) {
183847
183875
  switch (typeof value2) {
183848
- case "string":
183849
- return JSON.stringify(value2);
183850
183876
  case "number":
183851
- if (!Number.isFinite(value2))
183852
- throw new Error(`${value2} cannot be part of a cache key`);
183853
- return String(value2);
183877
+ if (Number.isFinite(value2))
183878
+ return String(value2);
183879
+ throw new Error(`${value2} cannot be part of a cache key`);
183880
+ case "string":
183854
183881
  case "boolean":
183855
- return value2 ? "true" : "false";
183882
+ return JSON.stringify(value2);
183856
183883
  case "undefined":
183857
183884
  throw new Error("undefined cannot be part of a cache key, except as an object property");
183858
183885
  case "object":
@@ -183862,9 +183889,8 @@ function serialize(value2, depth) {
183862
183889
  }
183863
183890
  if (value2 === null)
183864
183891
  return "null";
183865
- if (depth === MAX_DEPTH)
183866
- throw new Error(`an input nested more than ${MAX_DEPTH} levels deep, or circular`);
183867
- depth++;
183892
+ if (depth++ === 64)
183893
+ throw new Error("an input nested more than 64 levels deep, or circular");
183868
183894
  if (Array.isArray(value2)) {
183869
183895
  let out2 = "[";
183870
183896
  for (let i2 = 0; i2 < value2.length; i2++)
@@ -183876,77 +183902,26 @@ function serialize(value2, depth) {
183876
183902
  const name = proto.constructor?.name || "class instance";
183877
183903
  throw new Error(`a ${name} cannot be part of a cache key: only JSON data can`);
183878
183904
  }
183879
- const record3 = value2;
183880
- const keys = Object.keys(record3).sort();
183881
183905
  let out = "";
183882
- for (const key of keys) {
183883
- const v = record3[key];
183906
+ for (const key of Object.keys(value2).sort()) {
183907
+ const v = value2[key];
183884
183908
  if (v !== void 0)
183885
183909
  out += `${out ? "," : ""}${JSON.stringify(key)}:${serialize(v, depth)}`;
183886
183910
  }
183887
183911
  return `{${out}}`;
183888
183912
  }
183889
183913
 
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;
183914
+ // node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/index.js
183915
+ function delay2(schedule, attempt) {
183916
+ const d3 = schedule[attempt - 1];
183917
+ return d3 === void 0 ? -1 : Math.round(d3 / 2 + Math.random() * d3 / 2);
183940
183918
  }
183941
183919
  var ValidationError = class extends Error {
183942
- result;
183943
- issues;
183920
+ name = "ValidationError";
183944
183921
  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;
183922
+ const { message } = result;
183923
+ super(typeof message === "string" ? message : `validation failed: ${result.issues.map((i2) => i2.message).join(", ")}`);
183924
+ Object.assign(this, { result, issues: result.issues });
183950
183925
  }
183951
183926
  };
183952
183927
  async function assertSchema(schema2, value2) {
@@ -183955,322 +183930,212 @@ async function assertSchema(schema2, value2) {
183955
183930
  throw new ValidationError(result);
183956
183931
  return result.value;
183957
183932
  }
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;
183933
+ function op(options) {
183934
+ return build3(options, true);
183935
+ }
183936
+ function build3(options, cacheMethods) {
183937
+ const { name, input: inputSchema, output: outputSchema, run: run4, dedupe, ttl, cache: adapter } = options;
183938
+ const { retry } = options;
183939
+ const delayFor = Array.isArray(retry) ? (_, attempt) => delay2(retry, attempt) : retry;
183940
+ if (ttl !== void 0 && typeof ttl !== "function" && !isLifetime(ttl)) {
183941
+ throw new TypeError(`yes.op: ttl must be a positive number of milliseconds, got ${ttl}`);
183942
+ }
183943
+ const lifetime = typeof ttl === "function" ? ttl : () => ttl;
183944
+ if (adapter && (!name || name.includes(":"))) {
183945
+ throw new TypeError(`yes.op: an op with a cache adapter needs a name without ":", got ${JSON.stringify(name)}`);
183946
+ }
183947
+ if (adapter && ttl === void 0)
183948
+ throw new TypeError(`yes.op: a cache adapter does nothing without a ttl`);
183949
+ const store = ttl === void 0 ? void 0 : adapter ?? memory({ maxItems: options.maxItems });
183950
+ const prefix = adapter ? `yes:${name}:` : "";
183951
+ const label = name ? `[${name}] ` : "";
183952
+ const logCache = (event) => () => {
183953
+ if (name && store && process.env.NODE_ENV === "production")
183954
+ console.log(`${label}cache ${event}`);
183955
+ };
183956
+ const { cacheHit = logCache("hit"), cacheMiss = logCache("miss") } = options;
183957
+ const keyOf = (input) => {
184014
183958
  try {
184015
- matched = match3(entry.input);
183959
+ return cacheKey2(input);
184016
183960
  } catch (error49) {
184017
- matchError = { error: error49 };
184018
- throw error49;
184019
- }
184020
- if (matched) {
184021
- keys.push(key);
184022
- count++;
183961
+ throw new Error(`${label}${error49.message}. dedupe and ttl key the input, and a query always dedupes; a write is yes.mutation, which never keys.`, { cause: error49 });
184023
183962
  }
184024
183963
  };
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;
183964
+ const report = (attempt, message, error49, key) => {
183965
+ console.log(`${label}attempt ${attempt} ${message}`);
183966
+ const data = key === void 0 ? { error: error49, attempt } : { key, error: error49, attempt };
183967
+ console.log(...label ? [label, data] : [data]);
184036
183968
  };
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) => {
183969
+ const attempts = async (input, ctx, key, trace) => {
183970
+ for (let attempt = 1; ; attempt++) {
184101
183971
  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;
183972
+ const returned = await run4(input, ctx);
183973
+ const result = outputSchema ? await assertSchema(outputSchema, returned) : returned;
183974
+ trace?.(`run resolved on attempt ${attempt}`);
183975
+ return result;
183976
+ } catch (thrown) {
183977
+ let error49 = thrown;
183978
+ let wait = -1;
183979
+ if (delayFor && !(error49 instanceof ValidationError)) {
183980
+ try {
183981
+ wait = delayFor(error49, attempt);
183982
+ } catch (stop2) {
183983
+ error49 = stop2;
183984
+ }
183985
+ }
183986
+ if (wait >= 0) {
183987
+ report(attempt, `failed, retrying in ${wait}ms`, error49, key);
183988
+ await sleep2(wait);
183989
+ continue;
184151
183990
  }
183991
+ if (attempt > 1)
183992
+ report(attempt, "failed, not retrying", error49, key);
183993
+ trace?.(`run failed on attempt ${attempt}`, { error: error49 });
183994
+ throw error49;
184152
183995
  }
184153
183996
  }
184154
- const retries = options.retries ?? [];
184155
- const execStart = trace ? performance.now() : 0;
183997
+ };
183998
+ const hit = (key, trace, from, value2) => {
183999
+ trace?.(`cache hit (${from})`);
184000
+ cacheHit?.(key);
184001
+ return value2;
184002
+ };
184003
+ const inFlight = /* @__PURE__ */ new Map();
184004
+ const call = async (rawInput, ctx) => {
184005
+ const input = inputSchema ? await assertSchema(inputSchema, rawInput) : rawInput;
184006
+ if (!dedupe && !store)
184007
+ return attempts(input, ctx, void 0, debugTrace(label));
184008
+ const key = keyOf(input);
184009
+ const trace = debugTrace(label, key);
184010
+ const shared = inFlight.get(key);
184011
+ if (shared)
184012
+ return hit(key, trace, "in-flight", shared);
184013
+ const fullKey = prefix + key;
184014
+ const read2 = store && callAdapter("get", fullKey, () => store.get(fullKey));
184015
+ const entry = freshEntry(read2);
184016
+ if (entry)
184017
+ return hit(key, trace, "from store", entry.value);
184156
184018
  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) {
184019
+ const stored = isThenable(read2) ? freshEntry(await read2) : void 0;
184020
+ if (stored)
184021
+ return hit(key, trace, "from store", stored.value);
184022
+ trace?.("cache miss, running");
184023
+ cacheMiss?.(key);
184024
+ const result = await attempts(input, ctx, key, trace);
184025
+ const ms = store && !options.skipCache?.(result) && result != null && !(result instanceof Error) && lifetime(result);
184026
+ if (store && isLifetime(ms)) {
184222
184027
  const created = Date.now();
184223
- const entry = { value: result, created, expires: created + ttl, input };
184224
184028
  try {
184225
- const written = callAdapter("set", fullKey, () => store.set(fullKey, entry, ttl));
184226
- if (isThenable(written))
184227
- await written;
184228
- cached4 = true;
184029
+ await store.set(fullKey, { value: result, created, expires: created + ms, input }, ms);
184229
184030
  } catch (error49) {
184230
- log3.error(`${namePrefix}cache write failed, returning the result uncached`, error49);
184031
+ console.error(`${label}cache write failed, returning the result uncached`, new AdapterError("set", fullKey, error49));
184231
184032
  }
184232
184033
  }
184233
- trace?.log("function executed successfully", { runtime: trace.since(execStart), attempt: attempt + 1, cached: cached4 });
184234
184034
  return result;
184235
184035
  })();
184236
- inFlightPromises.set(key, promise2);
184237
- try {
184238
- return await promise2;
184239
- } finally {
184240
- inFlightPromises.delete(key);
184036
+ if (!dedupe)
184037
+ return promise2;
184038
+ inFlight.set(key, promise2);
184039
+ return promise2.finally(() => inFlight.delete(key));
184040
+ };
184041
+ if (!cacheMethods)
184042
+ return call;
184043
+ const withKey = (input, use) => {
184044
+ const toKey = (result2) => use(prefix + keyOf(result2 && !result2.issues ? result2.value : input));
184045
+ const result = inputSchema?.["~standard"].validate(input);
184046
+ return result instanceof Promise ? result.then(toKey) : toKey(result);
184047
+ };
184048
+ return Object.assign(call, {
184049
+ clear: async (input) => {
184050
+ if (!store)
184051
+ return;
184052
+ if (input === void 0)
184053
+ await sweep(store, prefix, () => true);
184054
+ else
184055
+ await withKey(input, (key) => callAdapter("delete", key, () => store.delete([key])));
184056
+ },
184057
+ // the memory store peeks, so asking whether a key is cached does not change which key is evicted next
184058
+ has: async (input) => !!store && !!freshEntry(await withKey(input, (key) => callAdapter("get", key, () => "peek" in store ? store.peek(key) : store.get(key)))),
184059
+ // not `async`: on the memory store a predicate that throws throws here, not in a promise nobody awaits
184060
+ invalidate: (match3) => {
184061
+ const accepts = typeof match3 === "function" ? match3 : fieldsMatch(match3);
184062
+ return Promise.resolve(store ? sweep(store, prefix, accepts) : 0);
184241
184063
  }
184242
- };
184243
- cachedFn.clear = async (key) => {
184244
- if (!store)
184245
- return;
184246
- if (key === void 0) {
184247
- await sweep(store, prefix, () => true);
184248
- return;
184064
+ });
184065
+ }
184066
+ function query(options) {
184067
+ return op({ ...options, dedupe: true });
184068
+ }
184069
+ function mutation({ dedupe: _dedupe, ttl: _ttl, cache: _cache, ...options }) {
184070
+ return build3(options, false);
184071
+ }
184072
+ function debugTrace(label, key) {
184073
+ if (process.env.LOG_LEVEL !== "debug")
184074
+ return;
184075
+ const prefix = `${label}[${(/* @__PURE__ */ new Date()).toISOString()}]`;
184076
+ const start = performance.now();
184077
+ return (message, data) => console.log(`${prefix} ${message} +${Math.round(performance.now() - start)}ms`, { ...key && { key }, ...data });
184078
+ }
184079
+ var isLifetime = (ms) => typeof ms === "number" && ms > 0 && Number.isFinite(ms);
184080
+ function fieldsMatch(partial3) {
184081
+ const fields = Object.entries(partial3).map(([field, value2]) => [
184082
+ field,
184083
+ value2 === void 0 ? void 0 : canonical(value2)
184084
+ ]);
184085
+ return (input) => typeof input === "object" && input !== null && fields.every(([field, value2]) => {
184086
+ const actual = input[field];
184087
+ return actual === void 0 ? value2 === void 0 : value2 !== void 0 && canonical(actual) === value2;
184088
+ });
184089
+ }
184090
+ var isThenable = (value2) => typeof value2?.then === "function";
184091
+ function freshEntry(value2) {
184092
+ return typeof value2?.expires === "number" && value2.expires > Date.now() && "value" in value2 ? value2 : void 0;
184093
+ }
184094
+ function callAdapter(method, key, run4) {
184095
+ try {
184096
+ const result = run4();
184097
+ if (!isThenable(result))
184098
+ return result;
184099
+ return result.then(void 0, (error49) => {
184100
+ throw new AdapterError(method, key, error49);
184101
+ });
184102
+ } catch (error49) {
184103
+ throw new AdapterError(method, key, error49);
184104
+ }
184105
+ }
184106
+ function sweep(store, prefix, match3) {
184107
+ const purge = (listed2) => {
184108
+ const now = Date.now();
184109
+ const keys = [];
184110
+ let count = 0;
184111
+ for (const [key, { input, expires }] of listed2) {
184112
+ if (!(expires > now))
184113
+ keys.push(key);
184114
+ else if (match3(input)) {
184115
+ keys.push(key);
184116
+ count++;
184117
+ }
184249
184118
  }
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;
184119
+ const remove = (from) => {
184120
+ if (from >= keys.length)
184121
+ return count;
184122
+ const deleted = callAdapter("delete", prefix, () => store.delete(keys.slice(from, from + 1e3)));
184123
+ return isThenable(deleted) ? Promise.resolve(deleted).then(() => remove(from + 1e3)) : remove(from + 1e3);
184124
+ };
184125
+ return remove(0);
184272
184126
  };
184273
- return cachedFn;
184127
+ const listed = callAdapter("list", prefix, () => {
184128
+ const listed2 = store.list(prefix);
184129
+ if (Array.isArray(listed2))
184130
+ return listed2;
184131
+ return (async () => {
184132
+ const items = [];
184133
+ for await (const item of await listed2)
184134
+ items.push(item);
184135
+ return items;
184136
+ })();
184137
+ });
184138
+ return Array.isArray(listed) ? purge(listed) : listed.then(purge);
184274
184139
  }
184275
184140
 
184276
184141
  // utils/progressComment.ts
@@ -186056,7 +185921,7 @@ function ShellTool(ctx) {
186056
185921
  return tool({
186057
185922
  name: "shell",
186058
185923
  timeoutMs: 12e4,
186059
- description: `Execute shell commands securely. Environment is filtered to remove API keys and secrets.
185924
+ description: `Execute shell commands securely.${ctx.payload.shell === "restricted" ? " Environment is filtered to remove API keys and secrets." : ""}
186060
185925
 
186061
185926
  Example: \`shell({ command: "pnpm test", description: "run the test suite" })\`.
186062
185927
 
@@ -187901,7 +187766,7 @@ async function fetchWrapper(requestOptions) {
187901
187766
  "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
187902
187767
  );
187903
187768
  }
187904
- const log4 = requestOptions.request?.log || console;
187769
+ const log3 = requestOptions.request?.log || console;
187905
187770
  const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
187906
187771
  const body = isPlainObject8(requestOptions.body) || Array.isArray(requestOptions.body) ? JSONStringify(requestOptions.body) : requestOptions.body;
187907
187772
  const requestHeaders = Object.fromEntries(
@@ -187959,7 +187824,7 @@ async function fetchWrapper(requestOptions) {
187959
187824
  if ("deprecation" in responseHeaders) {
187960
187825
  const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
187961
187826
  const deprecationLink = matches && matches.pop();
187962
- log4.warn(
187827
+ log3.warn(
187963
187828
  `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
187964
187829
  );
187965
187830
  }
@@ -188097,9 +187962,9 @@ var NON_VARIABLE_OPTIONS = [
188097
187962
  ];
188098
187963
  var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
188099
187964
  var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
188100
- function graphql(request2, query, options) {
187965
+ function graphql(request2, query2, options) {
188101
187966
  if (options) {
188102
- if (typeof query === "string" && "query" in options) {
187967
+ if (typeof query2 === "string" && "query" in options) {
188103
187968
  return Promise.reject(
188104
187969
  new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
188105
187970
  );
@@ -188113,7 +187978,7 @@ function graphql(request2, query, options) {
188113
187978
  );
188114
187979
  }
188115
187980
  }
188116
- const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
187981
+ const parsedOptions = typeof query2 === "string" ? Object.assign({ query: query2 }, options) : query2;
188117
187982
  const requestOptions = Object.keys(
188118
187983
  parsedOptions
188119
187984
  ).reduce((result, key) => {
@@ -188148,8 +188013,8 @@ function graphql(request2, query, options) {
188148
188013
  }
188149
188014
  function withDefaults3(request2, newDefaults) {
188150
188015
  const newRequest2 = request2.defaults(newDefaults);
188151
- const newApi = (query, options) => {
188152
- return graphql(newRequest2, query, options);
188016
+ const newApi = (query2, options) => {
188017
+ return graphql(newRequest2, query2, options);
188153
188018
  };
188154
188019
  return Object.assign(newApi, {
188155
188020
  defaults: withDefaults3.bind(null, newRequest2),
@@ -190993,16 +190858,17 @@ function translateIdTokenError(error49) {
190993
190858
  if (!status) return error49;
190994
190859
  return new TokenExchangeError(Number(status), error49.message);
190995
190860
  }
190996
- var mintIdToken = op(
190997
- async () => {
190861
+ var mintIdToken = query({
190862
+ run: async () => {
190998
190863
  try {
190999
190864
  return await core4.getIDToken(OIDC_AUDIENCE);
191000
190865
  } catch (error49) {
191001
190866
  throw translateIdTokenError(error49);
191002
190867
  }
191003
190868
  },
191004
- { ttl: 6e4, name: "OIDC ID token" }
191005
- );
190869
+ ttl: 6e4,
190870
+ name: "OIDC ID token"
190871
+ });
191006
190872
  async function acquireTokenViaOIDC(opts) {
191007
190873
  const oidcToken = opts?.oidc ? await fetchIdTokenFromStash(opts.oidc) : await mintIdToken();
191008
190874
  const repos = [...opts?.repos ?? []];
@@ -191160,10 +191026,10 @@ function isTransientTokenError(error49) {
191160
191026
  }
191161
191027
  async function acquireNewToken(opts) {
191162
191028
  if (opts?.oidc || isOIDCAvailable()) {
191163
- return await op(() => acquireTokenViaOIDC(opts), {
191029
+ return await mutation({
191030
+ run: () => acquireTokenViaOIDC(opts),
191164
191031
  name: "token exchange",
191165
- retries: [1e3, 2e3],
191166
- rethrow: (error49) => !isTransientTokenError(error49)
191032
+ retry: (error49, attempt) => isTransientTokenError(error49) ? delay2([1e3, 2e3], attempt) : -1
191167
191033
  })();
191168
191034
  }
191169
191035
  if (process.env.GITHUB_ACTIONS === "true") {
@@ -191497,19 +191363,19 @@ async function pushWithRetry(args2, token, refreshGitToken, cwd = process.cwd())
191497
191363
  if ((kind === "transient" || kind === "transient-auth") && attempt < TRANSIENT_RETRY_DELAYS_MS.length) {
191498
191364
  if (kind === "transient-auth" && refreshGitToken) {
191499
191365
  currentToken = await refreshGitToken(currentToken);
191500
- const delay3 = Math.round(1e3 * (0.75 + Math.random() * 0.5));
191366
+ const delay4 = Math.round(1e3 * (0.75 + Math.random() * 0.5));
191501
191367
  log2.info(
191502
- `push attempt ${attempt + 1} failed (auth), re-minted token, retrying in ${delay3}ms: ${msg.slice(0, 300)}`
191368
+ `push attempt ${attempt + 1} failed (auth), re-minted token, retrying in ${delay4}ms: ${msg.slice(0, 300)}`
191503
191369
  );
191504
- await new Promise((r2) => setTimeout(r2, delay3));
191370
+ await new Promise((r2) => setTimeout(r2, delay4));
191505
191371
  continue;
191506
191372
  }
191507
191373
  const baseDelay = TRANSIENT_RETRY_DELAYS_MS[attempt] ?? 5e3;
191508
- const delay2 = Math.round(baseDelay * (0.75 + Math.random() * 0.5));
191374
+ const delay3 = Math.round(baseDelay * (0.75 + Math.random() * 0.5));
191509
191375
  log2.info(
191510
- `push attempt ${attempt + 1} failed (transient), retrying in ${delay2}ms: ${msg.slice(0, 300)}`
191376
+ `push attempt ${attempt + 1} failed (transient), retrying in ${delay3}ms: ${msg.slice(0, 300)}`
191511
191377
  );
191512
- await new Promise((r2) => setTimeout(r2, delay2));
191378
+ await new Promise((r2) => setTimeout(r2, delay3));
191513
191379
  continue;
191514
191380
  }
191515
191381
  throw err;
@@ -192234,6 +192100,112 @@ function isTransientOctokitError(error49) {
192234
192100
  return isTransientNetworkError(error49);
192235
192101
  }
192236
192102
 
192103
+ // utils/runContext.ts
192104
+ import { randomUUID as randomUUID5 } from "node:crypto";
192105
+ var START_KEY = randomUUID5();
192106
+ var defaultSettings = {
192107
+ model: null,
192108
+ effort: null,
192109
+ modes: [],
192110
+ setupScript: null,
192111
+ postCheckoutScript: null,
192112
+ prepushScript: null,
192113
+ stopScript: null,
192114
+ push: "restricted",
192115
+ shell: "restricted",
192116
+ prApproveEnabled: false,
192117
+ reviewDrafts: false,
192118
+ autoMergeEnabled: false,
192119
+ codexAgent: false,
192120
+ signedCommits: false,
192121
+ repoIntelligence: false,
192122
+ progressComments: true,
192123
+ statusChecks: true,
192124
+ approvalCheck: false,
192125
+ modeInstructions: {},
192126
+ learnings: null,
192127
+ learningsHeadings: [],
192128
+ envAllowlist: null,
192129
+ xrepoBrief: null,
192130
+ xrepoLearnings: null,
192131
+ xrepoLearningsHeadings: []
192132
+ };
192133
+ var defaultRunContext = {
192134
+ settings: defaultSettings,
192135
+ apiToken: "",
192136
+ oss: false,
192137
+ plan: "none"
192138
+ };
192139
+ var unknownSecretsRunContext = {
192140
+ ...defaultRunContext,
192141
+ secretsUnavailable: true
192142
+ };
192143
+ async function fetchRunContext(params) {
192144
+ const timeoutMs = 3e4;
192145
+ const controller = new AbortController();
192146
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
192147
+ try {
192148
+ const headers = {
192149
+ Authorization: `Bearer ${params.token}`,
192150
+ "X-Pullfrog-Credential-Pools": "1"
192151
+ };
192152
+ if (params.oidcToken) {
192153
+ headers["X-GitHub-OIDC-Token"] = params.oidcToken;
192154
+ }
192155
+ const query2 = new URLSearchParams({ start: START_KEY });
192156
+ if (params.runType) query2.set("type", params.runType);
192157
+ if (params.plainPrompt) query2.set("prompt", "plain");
192158
+ if (params.routedTier) query2.set("tier", params.routedTier);
192159
+ const search2 = query2.toString();
192160
+ const response = await apiFetch({
192161
+ path: `/api/repo/${params.repoContext.owner}/${params.repoContext.name}/run-context${search2 ? `?${search2}` : ""}`,
192162
+ headers,
192163
+ signal: controller.signal
192164
+ });
192165
+ clearTimeout(timeoutId);
192166
+ if (response.status === 402) {
192167
+ const body = await response.json().catch(() => null);
192168
+ const reason = typeof body === "object" && body !== null && "reason" in body ? body.reason : null;
192169
+ const commercialRefused = reason === "subscription_unpaid" || reason === "subscription_ended" ? reason : "commercial";
192170
+ return { ...defaultRunContext, commercialRefused };
192171
+ }
192172
+ if (!response.ok) {
192173
+ return response.status >= 500 ? unknownSecretsRunContext : defaultRunContext;
192174
+ }
192175
+ const data = await response.json();
192176
+ if (data === null) {
192177
+ return defaultRunContext;
192178
+ }
192179
+ return {
192180
+ settings: {
192181
+ ...defaultSettings,
192182
+ ...data.settings,
192183
+ modes: data.settings?.modes ?? [],
192184
+ setupScript: data.settings?.setupScript ?? null,
192185
+ postCheckoutScript: data.settings?.postCheckoutScript ?? null,
192186
+ prepushScript: data.settings?.prepushScript ?? null,
192187
+ stopScript: data.settings?.stopScript ?? null,
192188
+ learningsHeadings: data.settings?.learningsHeadings ?? [],
192189
+ xrepoBrief: data.settings?.xrepoBrief ?? null,
192190
+ xrepoLearnings: data.settings?.xrepoLearnings ?? null,
192191
+ xrepoLearningsHeadings: data.settings?.xrepoLearningsHeadings ?? []
192192
+ },
192193
+ apiToken: data.apiToken,
192194
+ oss: data.oss ?? false,
192195
+ plan: data.plan ?? "none",
192196
+ proxyModel: data.proxyModel,
192197
+ dbSecrets: data.dbSecrets,
192198
+ credentialAccess: data.credentialAccess,
192199
+ secretsUnavailable: data.secretsUnavailable,
192200
+ routerUnfunded: data.routerUnfunded,
192201
+ trialFallback: data.trialFallback
192202
+ };
192203
+ } catch {
192204
+ clearTimeout(timeoutId);
192205
+ return unknownSecretsRunContext;
192206
+ }
192207
+ }
192208
+
192237
192209
  // utils/patchWorkflowRunFields.ts
192238
192210
  var STRING_KEYS = [
192239
192211
  "prNodeId",
@@ -192252,6 +192224,7 @@ var NUMBER_KEYS = [
192252
192224
  "cacheWriteTokens",
192253
192225
  "costUsd"
192254
192226
  ];
192227
+ var FLAG_KEYS = ["reviewSkipped"];
192255
192228
  async function patchWorkflowRunFields(ctx, fields) {
192256
192229
  if (ctx.runId === void 0 || !ctx.apiToken) return;
192257
192230
  if (ctx.toolState.workflowRunUnclaimed) return;
@@ -192268,10 +192241,17 @@ async function patchWorkflowRunFields(ctx, fields) {
192268
192241
  body[key] = value2;
192269
192242
  }
192270
192243
  }
192244
+ for (const key of FLAG_KEYS) {
192245
+ if (fields[key]) body[key] = true;
192246
+ }
192247
+ if (fields.succeeded !== void 0) body.succeeded = fields.succeeded;
192271
192248
  if (Object.keys(body).length === 0) return;
192249
+ body.startKey = START_KEY;
192250
+ const runAttempt = Number(process.env.GITHUB_RUN_ATTEMPT);
192251
+ if (Number.isInteger(runAttempt) && runAttempt >= 1) body.runAttempt = runAttempt;
192272
192252
  try {
192273
- await op(
192274
- async () => {
192253
+ await mutation({
192254
+ run: async () => {
192275
192255
  const response = await apiFetch({
192276
192256
  path: `/api/workflow-run/${ctx.runId}`,
192277
192257
  method: "PATCH",
@@ -192282,17 +192262,18 @@ async function patchWorkflowRunFields(ctx, fields) {
192282
192262
  body: JSON.stringify(body),
192283
192263
  signal: AbortSignal.timeout(1e4)
192284
192264
  });
192285
- if (response.status === 404) ctx.toolState.workflowRunUnclaimed = true;
192265
+ if (response.status === 404) {
192266
+ ctx.toolState.workflowRunUnclaimed = true;
192267
+ log2.info(`\xBB Pullfrog has no record of run ${ctx.runId}; skipping run metadata updates`);
192268
+ return;
192269
+ }
192286
192270
  if (!response.ok) throw new Error(`PATCH workflow-run: ${response.status}`);
192287
192271
  },
192288
- {
192289
- retries: [2e3, 4e3],
192290
- name: "patchWorkflowRunFields",
192291
- // only retry transient network errors; explicit HTTP failures throw
192292
- // a status-bearing message and should fail fast.
192293
- rethrow: (error49) => !isTransientNetworkError(error49)
192294
- }
192295
- )();
192272
+ // only retry transient network errors; explicit HTTP failures throw
192273
+ // a status-bearing message and should fail fast.
192274
+ retry: (error49, attempt) => isTransientNetworkError(error49) ? delay2([2e3, 4e3], attempt) : -1,
192275
+ name: "patchWorkflowRunFields"
192276
+ })();
192296
192277
  } catch (error49) {
192297
192278
  log2.warning(`patchWorkflowRunFields failed: ${error49}`);
192298
192279
  }
@@ -192465,6 +192446,9 @@ var ReportProgress = type({
192465
192446
  body: type.string.describe("the progress update content to share"),
192466
192447
  "target_plan_comment?": type("boolean").describe(
192467
192448
  "for revising an existing plan comment ONLY. set to true only when the PlanEdit checklist from select_mode tells you to (i.e. a prior plan comment was found for this issue). NEVER set on the initial plan post \u2014 the initial plan reuses the run's progress comment and is posted by calling report_progress without this flag."
192449
+ ),
192450
+ "no_review_needed?": type("boolean").describe(
192451
+ "IncrementalReview only: true when you judged the new commits need no review, never for a blocker."
192468
192452
  )
192469
192453
  });
192470
192454
  async function reportProgress(ctx, params) {
@@ -192592,6 +192576,9 @@ function ReportProgressTool(ctx) {
192592
192576
  description: 'Share progress on the associated GitHub issue/PR. The first call creates a comment; subsequent calls update it in place. Example: `report_progress({ body: "Implemented the auth check and added tests." })`. Call this at the end of every run with a brief final summary (1-3 sentences) unless the mode guidance instructs otherwise. The current task list is automatically appended in a collapsible section \u2014 do not restate individual steps.',
192593
192577
  parameters: ReportProgress,
192594
192578
  execute: execute(async (params) => {
192579
+ if (params.no_review_needed) {
192580
+ ctx.toolState.noReviewNeededSha = primaryRepoState(ctx.toolState).checkoutSha;
192581
+ }
192595
192582
  if (ctx.toolState.standaloneCommentId !== void 0 && !params.target_plan_comment) {
192596
192583
  ctx.toolState.lastProgressBody = params.body;
192597
192584
  return {
@@ -193123,18 +193110,15 @@ function CreatePullRequestReviewTool(ctx) {
193123
193110
  }
193124
193111
  let result;
193125
193112
  try {
193126
- result = await op(
193127
- () => body ? createAndSubmitWithFooter(ctx, params, {
193113
+ result = await mutation({
193114
+ run: () => body ? createAndSubmitWithFooter(ctx, params, {
193128
193115
  body,
193129
193116
  approved: approved ?? false,
193130
193117
  hasComments: (params.comments?.length ?? 0) > 0
193131
193118
  }) : createReviewWithStrandedRecovery(ctx, params),
193132
- {
193133
- retries: TRANSIENT_REVIEW_RETRY_DELAYS_MS,
193134
- rethrow: (err) => !isTransientReviewError(err),
193135
- name: "review submission"
193136
- }
193137
- )();
193119
+ retry: (error49, attempt) => isTransientReviewError(error49) ? delay2(TRANSIENT_REVIEW_RETRY_DELAYS_MS, attempt) : -1,
193120
+ name: "review submission"
193121
+ })();
193138
193122
  } catch (err) {
193139
193123
  if (ctx.toolState.approval) ctx.toolState.approval.wouldApprove = false;
193140
193124
  if (isTransientReviewError(err)) {
@@ -193807,8 +193791,8 @@ async function checkoutPrBranch(pr, params) {
193807
193791
  if (!alreadyOnBranch) {
193808
193792
  $("git", ["checkout", "-B", pr.baseRef, `origin/${pr.baseRef}`], { log: false });
193809
193793
  log2.debug(`\xBB fetching PR #${pr.number} (${localBranch})...`);
193810
- await op(
193811
- async () => {
193794
+ await mutation({
193795
+ run: async () => {
193812
193796
  try {
193813
193797
  await $gitFetchWithDeepen(
193814
193798
  ["--no-tags", "origin", `+pull/${pr.number}/head:${localBranch}`],
@@ -193823,12 +193807,9 @@ async function checkoutPrBranch(pr, params) {
193823
193807
  throw e;
193824
193808
  }
193825
193809
  },
193826
- {
193827
- retries: PULL_REF_RETRY_DELAYS_MS,
193828
- name: `pull/${pr.number}/head fetch`,
193829
- rethrow: (e) => !PULL_REF_MISSING_PATTERN.test(e instanceof Error ? e.message : String(e))
193830
- }
193831
- )();
193810
+ retry: (error49, attempt) => PULL_REF_MISSING_PATTERN.test(error49 instanceof Error ? error49.message : String(error49)) ? delay2(PULL_REF_RETRY_DELAYS_MS, attempt) : -1,
193811
+ name: `pull/${pr.number}/head fetch`
193812
+ })();
193832
193813
  $("git", ["checkout", localBranch], { log: false });
193833
193814
  log2.debug(`\xBB checked out PR #${pr.number}`);
193834
193815
  repoState.checkoutSha = $("git", ["rev-parse", "HEAD"], { log: false }).trim();
@@ -196174,8 +196155,8 @@ function buildThreadBlocks(threads, filePatchMap, reviewId) {
196174
196155
  }
196175
196156
  return threadBlocks;
196176
196157
  }
196177
- var fetchAllReviewThreads = op(
196178
- async (key, ctx) => {
196158
+ var fetchAllReviewThreads = query({
196159
+ run: async (key, ctx) => {
196179
196160
  const threads = [];
196180
196161
  let cursor3 = null;
196181
196162
  for (let page = 0; page < 50; page += 1) {
@@ -196192,21 +196173,21 @@ var fetchAllReviewThreads = op(
196192
196173
  }
196193
196174
  return threads;
196194
196175
  },
196195
- { ttl: 6e4, name: "reviewThreads" }
196196
- );
196197
- var fetchPrFiles = op(
196198
- async (key, ctx) => ctx.octokit.paginate(ctx.octokit.rest.pulls.listFiles, {
196176
+ ttl: 6e4,
196177
+ name: "reviewThreads"
196178
+ });
196179
+ var fetchPrFiles = query({
196180
+ run: async (key, ctx) => ctx.octokit.paginate(ctx.octokit.rest.pulls.listFiles, {
196199
196181
  owner: key.owner,
196200
196182
  repo: key.name,
196201
196183
  pull_number: key.pullNumber,
196202
196184
  per_page: 100
196203
196185
  }),
196204
- { ttl: 6e4, name: "prFiles" }
196205
- );
196186
+ ttl: 6e4,
196187
+ name: "prFiles"
196188
+ });
196206
196189
  function invalidateReviewThreadCache(repo) {
196207
- fetchAllReviewThreads.invalidate(
196208
- (cached4) => cached4.owner === repo.owner && cached4.name === repo.name
196209
- );
196190
+ fetchAllReviewThreads.invalidate({ owner: repo.owner, name: repo.name });
196210
196191
  }
196211
196192
  async function getReviewThreads(input) {
196212
196193
  const allThreads = structuredClone(
@@ -196933,7 +196914,7 @@ function buildCommonTools(ctx, outputSchema) {
196933
196914
  if (isStandalone || outputSchema) {
196934
196915
  tools.push(SetOutputTool(ctx, outputSchema));
196935
196916
  }
196936
- if (ctx.payload.shell === "restricted") {
196917
+ if (ctx.payload.shell !== "disabled") {
196937
196918
  tools.push(ShellTool(ctx));
196938
196919
  tools.push(KillBackgroundTool(ctx));
196939
196920
  }
@@ -197765,11 +197746,11 @@ function formatBillingErrorSummary(error49, owner) {
197765
197746
  }
197766
197747
  if (error49.code === "router_monthly_limit") {
197767
197748
  return [
197768
- "**Pullfrog Router hit its monthly spend limit.**",
197749
+ "**Pullfrog Router is out of credit, and the monthly spend limit blocks the next auto-reload.**",
197769
197750
  "",
197770
- "Auto-reloads are paused for the rest of this UTC month. Ask your admin to raise the cap, or wait for it to reset at 00:00 UTC on the 1st.",
197751
+ "Top up by hand, ask your admin to raise the cap, or wait for it to reset at 00:00 UTC on the 1st.",
197771
197752
  "",
197772
- `[Adjust limit \u2192](${billingConsoleUrl(owner)})`
197753
+ `[Top up balance \u2192](${billingConsoleUrl(owner)}) \xB7 [Adjust limit \u2192](${billingConsoleUrl(owner)})`
197773
197754
  ].join("\n");
197774
197755
  }
197775
197756
  if (error49.code === "commercial_plan_required") {
@@ -198013,7 +197994,13 @@ var codexUsageSchema = external_exports.object({
198013
197994
  limit_reached: external_exports.boolean(),
198014
197995
  primary_window: codexWindowSchema,
198015
197996
  secondary_window: codexWindowSchema
198016
- }).optional()
197997
+ }).optional(),
197998
+ credits: external_exports.object({
197999
+ has_credits: external_exports.boolean().optional(),
198000
+ unlimited: external_exports.boolean().optional(),
198001
+ overage_limit_reached: external_exports.boolean().optional()
198002
+ }).nullish(),
198003
+ spend_control: external_exports.object({ reached: external_exports.boolean().optional() }).nullish()
198017
198004
  });
198018
198005
  var unknown4 = { status: "unknown" };
198019
198006
  async function readSubscriptionEndpoint(input) {
@@ -198056,9 +198043,12 @@ async function probeSubscription(input) {
198056
198043
  const body = await response.json().catch(() => null);
198057
198044
  if (!codex2) return unknown4;
198058
198045
  const parsed2 = codexUsageSchema.safeParse(body);
198059
- const limit = parsed2.success ? parsed2.data.rate_limit : void 0;
198060
- if (!limit) return unknown4;
198046
+ if (!parsed2.success || !parsed2.data.rate_limit) return unknown4;
198047
+ const limit = parsed2.data.rate_limit;
198061
198048
  if (limit.allowed && !limit.limit_reached) return { status: "usable" };
198049
+ const credits = parsed2.data.credits;
198050
+ if ((credits?.has_credits || credits?.unlimited) && !credits.overage_limit_reached && !parsed2.data.spend_control?.reached)
198051
+ return { status: "usable" };
198062
198052
  const windows = [limit.primary_window, limit.secondary_window];
198063
198053
  const full = windows.filter((window2) => (window2?.used_percent ?? 0) >= 100);
198064
198054
  const resets = (full.length ? full : windows).flatMap(
@@ -198106,15 +198096,24 @@ async function probeInference(input) {
198106
198096
  const error49 = external_exports.object({ error: external_exports.object({ code: external_exports.string() }) }).safeParse(await response.json().catch(() => null));
198107
198097
  return error49.success && error49.data.error.code === "insufficient_quota" ? { status: "exhausted", detail: "refused with 429: insufficient quota", resetAt: void 0 } : unknown4;
198108
198098
  }
198099
+ if (response?.status === 401 || response?.status === 403)
198100
+ return {
198101
+ status: "rejected",
198102
+ detail: `rejected with ${response.status}${await providerReason(response)}`
198103
+ };
198109
198104
  await response?.body?.cancel();
198110
198105
  if (!response) return unknown4;
198111
198106
  if (response.ok) return { status: "usable" };
198112
- if (response.status === 401 || response.status === 403)
198113
- return { status: "rejected", detail: `rejected with ${response.status}` };
198114
198107
  if (response.status === 402)
198115
198108
  return { status: "exhausted", detail: "refused with 402", resetAt: void 0 };
198116
198109
  return unknown4;
198117
198110
  }
198111
+ async function providerReason(response) {
198112
+ const body = external_exports.object({ error: external_exports.union([external_exports.string(), external_exports.object({ message: external_exports.string() })]) }).safeParse(await response.json().catch(() => null));
198113
+ if (!body.success) return "";
198114
+ const error49 = body.data.error;
198115
+ return `: ${(typeof error49 === "string" ? error49 : error49.message).slice(0, 300)}`;
198116
+ }
198118
198117
 
198119
198118
  // utils/credentialPool.ts
198120
198119
  var receipts = {};
@@ -198123,8 +198122,8 @@ function saveReceipts() {
198123
198122
  for (const receipt of Object.values(receipts)) maskSecret(receipt);
198124
198123
  saveSecretState("credential_receipts", JSON.stringify(receipts));
198125
198124
  }
198126
- var select2 = op(
198127
- async (input) => {
198125
+ var select2 = mutation({
198126
+ run: async (input) => {
198128
198127
  const response = await apiFetch({
198129
198128
  path: "/api/runtime/credentials",
198130
198129
  method: "POST",
@@ -198142,11 +198141,8 @@ var select2 = op(
198142
198141
  });
198143
198142
  return selectedCredentialSchema.parse(await response.json());
198144
198143
  },
198145
- {
198146
- retries: [250, 1e3],
198147
- rethrow: (error49) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500
198148
- }
198149
- );
198144
+ retry: (error49, attempt) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500 ? -1 : delay2([250, 1e3], attempt)
198145
+ });
198150
198146
  function subscriptionForModel(model) {
198151
198147
  if (!model.includes("/")) return null;
198152
198148
  const provider2 = getModelProvider(model);
@@ -198209,12 +198205,14 @@ async function selectConfiguredCredential(input) {
198209
198205
  const subscription = subscriptionForModel(model);
198210
198206
  const names = getModelEnvVars(model).filter((name) => name !== subscription);
198211
198207
  if (subscription) names.unshift(subscription);
198208
+ const opencodePinned = process.env.PULLFROG_AGENT?.trim() === "opencode";
198209
+ const presentable = (name) => canInstallSubscription(name) && !(opencodePinned && CLAUDE_CODE_ONLY_CREDENTIALS.includes(name));
198212
198210
  const candidates = access.candidates.filter(
198213
- (candidate) => names.includes(candidate.name) && canInstallSubscription(candidate.name)
198211
+ (candidate) => names.includes(candidate.name) && presentable(candidate.name)
198214
198212
  );
198215
198213
  if (!candidates.length) return false;
198216
198214
  const options = [
198217
- ...names.filter((name) => workflowCredentials[name] && canInstallSubscription(name)).map((name) => ({ name, candidate: void 0 })),
198215
+ ...names.filter((name) => workflowCredentials[name] && presentable(name)).map((name) => ({ name, candidate: void 0 })),
198218
198216
  ...candidates.map((candidate) => ({ name: candidate.name, candidate }))
198219
198217
  ].sort((a2, b) => Number(b.name === subscription) - Number(a2.name === subscription));
198220
198218
  const refused = [];
@@ -198271,7 +198269,7 @@ function activate(input) {
198271
198269
  }
198272
198270
 
198273
198271
  // utils/gitAuthServer.ts
198274
- import { randomUUID as randomUUID5 } from "node:crypto";
198272
+ import { randomUUID as randomUUID6 } from "node:crypto";
198275
198273
  import { writeFileSync as writeFileSync15 } from "node:fs";
198276
198274
  import { createServer as createServer3 } from "node:http";
198277
198275
  import { join as join25 } from "node:path";
@@ -198329,7 +198327,7 @@ async function startGitAuthServer(tmpdir4) {
198329
198327
  const port = rawAddr.port;
198330
198328
  log2.debug(`git auth server listening on 127.0.0.1:${port}`);
198331
198329
  function register7(token) {
198332
- const code = randomUUID5();
198330
+ const code = randomUUID6();
198333
198331
  codes.set(code, { token, state: "active" });
198334
198332
  return code;
198335
198333
  }
@@ -198341,7 +198339,7 @@ async function startGitAuthServer(tmpdir4) {
198341
198339
  entry.timeout.unref();
198342
198340
  }
198343
198341
  function writeAskpassScript(code) {
198344
- const scriptId = randomUUID5();
198342
+ const scriptId = randomUUID6();
198345
198343
  const scriptName = `askpass-${scriptId}.js`;
198346
198344
  const scriptPath = join25(tmpdir4, scriptName);
198347
198345
  const content = [
@@ -198432,13 +198430,10 @@ function getShellInstructions(shell, t2) {
198432
198430
 
198433
198431
  Shell command execution is DISABLED. Do not attempt to run shell commands.`;
198434
198432
  case "restricted":
198435
- return `### Shell commands
198436
-
198437
- Use the \`${t2("shell")}\` MCP tool for all shell command execution. This tool provides a secure environment with filtered credentials. Do NOT use any native shell tool \u2014 it is disabled for security. For long-running processes (dev servers, watchers), use \`shell({ command, background: true })\`. Use \`${t2("kill_background")}\` to stop background processes.`;
198438
198433
  case "enabled":
198439
198434
  return `### Shell commands
198440
198435
 
198441
- Use your native shell tool for shell command execution.`;
198436
+ Use the \`${t2("shell")}\` MCP tool for all shell command execution.${shell === "restricted" ? " This tool provides a secure environment with filtered credentials. Do NOT use any native shell tool \u2014 it is disabled for security." : ""} For long-running processes (dev servers, watchers), use \`shell({ command, background: true })\`. Use \`${t2("kill_background")}\` to stop background processes.`;
198442
198437
  default: {
198443
198438
  const _exhaustive = shell;
198444
198439
  return _exhaustive;
@@ -199583,8 +199578,8 @@ async function mintProxyKey(ctx) {
199583
199578
  try {
199584
199579
  const headers = await buildProxyTokenHeaders(ctx);
199585
199580
  if (!headers) return null;
199586
- const response = await op(
199587
- async () => {
199581
+ const response = await mutation({
199582
+ run: async () => {
199588
199583
  const r2 = await apiFetch({ path: "/api/proxy-token", method: "POST", headers });
199589
199584
  if (r2.status >= 500) {
199590
199585
  const body = await r2.json().catch(() => null);
@@ -199594,12 +199589,9 @@ async function mintProxyKey(ctx) {
199594
199589
  }
199595
199590
  return r2;
199596
199591
  },
199597
- {
199598
- name: "proxy key mint",
199599
- retries: [1e3, 2e3],
199600
- rethrow: (error49) => !(error49 instanceof TransientError)
199601
- }
199602
- )();
199592
+ name: "proxy key mint",
199593
+ retry: (error49, attempt) => error49 instanceof TransientError ? delay2([1e3, 2e3], attempt) : -1
199594
+ })();
199603
199595
  if (response.status === 402) {
199604
199596
  const body = await response.json().catch(() => null);
199605
199597
  throw new BillingError(body?.error ?? "insufficient balance", {
@@ -199632,10 +199624,10 @@ async function buildProxyTokenHeaders(ctx) {
199632
199624
  const fundingSource = ctx.fundingSource;
199633
199625
  if (ctx.oidcCredentials) {
199634
199626
  const creds = ctx.oidcCredentials;
199635
- const oidcToken = await op(() => fetchIdTokenFromStash(creds), {
199627
+ const oidcToken = await query({
199628
+ run: () => fetchIdTokenFromStash(creds),
199636
199629
  name: "ID token mint",
199637
- retries: [1e3, 2e3],
199638
- rethrow: (error49) => !isTransientTokenError(error49)
199630
+ retry: (error49, attempt) => isTransientTokenError(error49) ? delay2([1e3, 2e3], attempt) : -1
199639
199631
  })();
199640
199632
  return {
199641
199633
  Authorization: `Bearer ${oidcToken}`,
@@ -199882,109 +199874,6 @@ ${collapsible}` : output;
199882
199874
  };
199883
199875
  }
199884
199876
 
199885
- // utils/runContext.ts
199886
- var defaultSettings = {
199887
- model: null,
199888
- effort: null,
199889
- modes: [],
199890
- setupScript: null,
199891
- postCheckoutScript: null,
199892
- prepushScript: null,
199893
- stopScript: null,
199894
- push: "restricted",
199895
- shell: "restricted",
199896
- prApproveEnabled: false,
199897
- reviewDrafts: false,
199898
- autoMergeEnabled: false,
199899
- codexAgent: false,
199900
- signedCommits: false,
199901
- repoIntelligence: false,
199902
- progressComments: true,
199903
- statusChecks: true,
199904
- approvalCheck: false,
199905
- modeInstructions: {},
199906
- learnings: null,
199907
- learningsHeadings: [],
199908
- envAllowlist: null,
199909
- xrepoBrief: null,
199910
- xrepoLearnings: null,
199911
- xrepoLearningsHeadings: []
199912
- };
199913
- var defaultRunContext = {
199914
- settings: defaultSettings,
199915
- apiToken: "",
199916
- oss: false,
199917
- plan: "none"
199918
- };
199919
- var unknownSecretsRunContext = {
199920
- ...defaultRunContext,
199921
- secretsUnavailable: true
199922
- };
199923
- async function fetchRunContext(params) {
199924
- const timeoutMs = 3e4;
199925
- const controller = new AbortController();
199926
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
199927
- try {
199928
- const headers = {
199929
- Authorization: `Bearer ${params.token}`,
199930
- "X-Pullfrog-Credential-Pools": "1"
199931
- };
199932
- if (params.oidcToken) {
199933
- headers["X-GitHub-OIDC-Token"] = params.oidcToken;
199934
- }
199935
- const query = new URLSearchParams();
199936
- if (params.runType) query.set("type", params.runType);
199937
- if (params.routedTier) query.set("tier", params.routedTier);
199938
- const search2 = query.toString();
199939
- const response = await apiFetch({
199940
- path: `/api/repo/${params.repoContext.owner}/${params.repoContext.name}/run-context${search2 ? `?${search2}` : ""}`,
199941
- headers,
199942
- signal: controller.signal
199943
- });
199944
- clearTimeout(timeoutId);
199945
- if (response.status === 402) {
199946
- const body = await response.json().catch(() => null);
199947
- const reason = typeof body === "object" && body !== null && "reason" in body ? body.reason : null;
199948
- const commercialRefused = reason === "subscription_unpaid" || reason === "subscription_ended" ? reason : "commercial";
199949
- return { ...defaultRunContext, commercialRefused };
199950
- }
199951
- if (!response.ok) {
199952
- return response.status >= 500 ? unknownSecretsRunContext : defaultRunContext;
199953
- }
199954
- const data = await response.json();
199955
- if (data === null) {
199956
- return defaultRunContext;
199957
- }
199958
- return {
199959
- settings: {
199960
- ...defaultSettings,
199961
- ...data.settings,
199962
- modes: data.settings?.modes ?? [],
199963
- setupScript: data.settings?.setupScript ?? null,
199964
- postCheckoutScript: data.settings?.postCheckoutScript ?? null,
199965
- prepushScript: data.settings?.prepushScript ?? null,
199966
- stopScript: data.settings?.stopScript ?? null,
199967
- learningsHeadings: data.settings?.learningsHeadings ?? [],
199968
- xrepoBrief: data.settings?.xrepoBrief ?? null,
199969
- xrepoLearnings: data.settings?.xrepoLearnings ?? null,
199970
- xrepoLearningsHeadings: data.settings?.xrepoLearningsHeadings ?? []
199971
- },
199972
- apiToken: data.apiToken,
199973
- oss: data.oss ?? false,
199974
- plan: data.plan ?? "none",
199975
- proxyModel: data.proxyModel,
199976
- dbSecrets: data.dbSecrets,
199977
- credentialAccess: data.credentialAccess,
199978
- secretsUnavailable: data.secretsUnavailable,
199979
- routerUnfunded: data.routerUnfunded,
199980
- trialFallback: data.trialFallback
199981
- };
199982
- } catch {
199983
- clearTimeout(timeoutId);
199984
- return unknownSecretsRunContext;
199985
- }
199986
- }
199987
-
199988
199877
  // utils/runContextData.ts
199989
199878
  async function resolveRunContextData(params) {
199990
199879
  const actionRef = process.env.GITHUB_ACTION_REF;
@@ -199994,23 +199883,25 @@ async function resolveRunContextData(params) {
199994
199883
  const repoContext = parseRepoContext();
199995
199884
  let oidcToken;
199996
199885
  try {
199997
- oidcToken = await op(() => mintIdToken(), {
199886
+ oidcToken = await query({
199887
+ run: () => mintIdToken(),
199998
199888
  name: "OIDC mint",
199999
- retries: process.env.ACTIONS_ID_TOKEN_REQUEST_URL ? [200, 1e3] : []
199889
+ retry: process.env.ACTIONS_ID_TOKEN_REQUEST_URL ? [200, 1e3] : []
200000
199890
  })();
200001
199891
  } catch {
200002
199892
  }
200003
199893
  const [repoResponse, runContext] = await Promise.all([
200004
- op(() => params.octokit.repos.get({ owner: repoContext.owner, repo: repoContext.name }), {
199894
+ query({
199895
+ run: () => params.octokit.repos.get({ owner: repoContext.owner, repo: repoContext.name }),
200005
199896
  name: "repos.get",
200006
- retries: [100, 500],
200007
- rethrow: (error49) => !isTransientOctokitError(error49)
199897
+ retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([100, 500], attempt) : -1
200008
199898
  })(),
200009
199899
  fetchRunContext({
200010
199900
  token: params.token,
200011
199901
  repoContext,
200012
199902
  oidcToken,
200013
199903
  runType: params.runType,
199904
+ plainPrompt: params.plainPrompt,
200014
199905
  routedTier: params.routedTier
200015
199906
  })
200016
199907
  ]);
@@ -200547,17 +200438,14 @@ async function autoMergeAfterApprove(ctx) {
200547
200438
  });
200548
200439
  if (hasBlockingHumanReview(reviews)) return skip("human changes requested");
200549
200440
  try {
200550
- await op(
200551
- () => ctx.octokit.graphql(ENABLE_AUTO_MERGE, {
200441
+ await mutation({
200442
+ run: () => ctx.octokit.graphql(ENABLE_AUTO_MERGE, {
200552
200443
  pullRequestId: pr.data.node_id,
200553
200444
  headSha
200554
200445
  }),
200555
- {
200556
- name: "enablePullRequestAutoMerge",
200557
- retries: [500, 2e3],
200558
- rethrow: (error49) => !isTransientOctokitError(error49)
200559
- }
200560
- )();
200446
+ name: "enablePullRequestAutoMerge",
200447
+ retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([500, 2e3], attempt) : -1
200448
+ })();
200561
200449
  log2.info(`autoMerge: pr=#${pullNumber} @ ${headSha.slice(0, 7)} \u2192 native auto-merge enabled`);
200562
200450
  await comment(
200563
200451
  "> \u2705 Approved \u2014 auto-merge enabled; GitHub will merge once required checks pass."
@@ -200595,7 +200483,17 @@ async function autoMergeAfterApprove(ctx) {
200595
200483
  var RE_REVIEW_PREAMBLE = "Incrementally re-review the new commits on this pull request. Use the IncrementalReview mode.";
200596
200484
  async function postReviewCleanup(ctx) {
200597
200485
  const review = ctx.toolState.review;
200598
- if (!review) return;
200486
+ if (!review) {
200487
+ const checkoutSha = primaryRepoState(ctx.toolState).checkoutSha;
200488
+ if (ctx.toolState.selectedMode === "IncrementalReview" && checkoutSha) {
200489
+ await patchWorkflowRunFields(ctx, { reviewSkipped: true });
200490
+ await bestEffort(
200491
+ () => dispatchFollowUpReReview(ctx, checkoutSha),
200492
+ "follow-up re-review dispatch"
200493
+ );
200494
+ }
200495
+ return;
200496
+ }
200599
200497
  delete ctx.toolState.review;
200600
200498
  await bestEffort(() => reportReviewNodeId(ctx, { nodeId: review.nodeId }), "reportReviewNodeId");
200601
200499
  if (review.reviewedSha) {
@@ -200648,20 +200546,17 @@ async function dispatchFollowUpReReview(ctx, reviewedSha) {
200648
200546
  eventInstructions: RE_REVIEW_PREAMBLE,
200649
200547
  event
200650
200548
  };
200651
- await op(
200652
- () => ctx.octokit.rest.actions.createWorkflowDispatch({
200549
+ await mutation({
200550
+ run: () => ctx.octokit.rest.actions.createWorkflowDispatch({
200653
200551
  owner: ctx.repo.owner,
200654
200552
  repo: ctx.repo.name,
200655
200553
  workflow_id: getCurrentWorkflowFilename(),
200656
200554
  ref: pr.data.base.repo.default_branch,
200657
200555
  inputs: { prompt: JSON.stringify(payload) }
200658
200556
  }),
200659
- {
200660
- name: "reReviewDispatch",
200661
- retries: [500, 2e3],
200662
- rethrow: (error49) => !isTransientOctokitError(error49)
200663
- }
200664
- )();
200557
+ name: "reReviewDispatch",
200558
+ retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([500, 2e3], attempt) : -1
200559
+ })();
200665
200560
  }
200666
200561
  function getCurrentWorkflowFilename() {
200667
200562
  const ref = process.env.GITHUB_WORKFLOW_REF ?? "";
@@ -200671,6 +200566,7 @@ function getCurrentWorkflowFilename() {
200671
200566
 
200672
200567
  // utils/runStatusCheck.ts
200673
200568
  var RUN_STATUS_CHECK_NAME = "pullfrog";
200569
+ var GITHUB_ACTIONS_APP_SLUG = "github-actions";
200674
200570
  var APPROVAL_CHECK_NAME = "pullfrog-approval";
200675
200571
  function parseCheckRunId(raw2) {
200676
200572
  if (!raw2?.id) return void 0;
@@ -200724,7 +200620,12 @@ function terminalOutput(params) {
200724
200620
  const review = params.reviewUrl ? `
200725
200621
 
200726
200622
  [View the review Pullfrog posted \u2192](${params.reviewUrl})` : "";
200727
- if (params.conclusion === "success") return { title: base.title, summary: base.summary + review };
200623
+ if (params.conclusion === "success") {
200624
+ const note = params.note ? `
200625
+
200626
+ ${params.note}` : "";
200627
+ return { title: base.title, summary: base.summary + review + note };
200628
+ }
200728
200629
  return {
200729
200630
  title: base.title,
200730
200631
  summary: base.summary + logsLine(params.detailsUrl) + review + disableCheckLine(params.owner, params.repo)
@@ -200742,7 +200643,8 @@ async function finalizeRunStatusCheck(params) {
200742
200643
  owner: params.owner,
200743
200644
  repo: params.repo,
200744
200645
  detailsUrl: params.detailsUrl,
200745
- reviewUrl: params.reviewUrl
200646
+ reviewUrl: params.reviewUrl,
200647
+ note: params.note
200746
200648
  })
200747
200649
  };
200748
200650
  if (params.detailsUrl) updateParams.details_url = params.detailsUrl;
@@ -200761,7 +200663,8 @@ async function createTerminalRunStatusCheck(params) {
200761
200663
  owner: params.owner,
200762
200664
  repo: params.repo,
200763
200665
  detailsUrl: params.detailsUrl,
200764
- reviewUrl: params.reviewUrl
200666
+ reviewUrl: params.reviewUrl,
200667
+ note: params.note
200765
200668
  })
200766
200669
  };
200767
200670
  if (params.detailsUrl) createParams.details_url = params.detailsUrl;
@@ -200777,6 +200680,8 @@ async function reportStatusChecks(ctx, params) {
200777
200680
  if (checkRunId === void 0 && !ctx.payload.runStatusCheck && !ctx.payload.approvalCheck) return;
200778
200681
  const conclusion = params.runSucceeded ? "success" : "failure";
200779
200682
  const detailsUrl = ctx.runId ? `https://github.com/${ctx.repo.owner}/${ctx.repo.name}/actions/runs/${ctx.runId}` : void 0;
200683
+ const approval = ctx.toolState.approval;
200684
+ const note = event.silent && !approval?.url ? ctx.toolState.lastProgressBody : void 0;
200780
200685
  if (checkRunId !== void 0) {
200781
200686
  await finalizeRunStatusCheck({
200782
200687
  octokit: ctx.octokit,
@@ -200785,11 +200690,12 @@ async function reportStatusChecks(ctx, params) {
200785
200690
  checkRunId,
200786
200691
  conclusion,
200787
200692
  detailsUrl,
200788
- reviewUrl: ctx.toolState.approval?.url
200693
+ reviewUrl: approval?.url,
200694
+ note
200789
200695
  }).then(() => log2.info(`\xBB finalized ${RUN_STATUS_CHECK_NAME} check (${conclusion})`)).catch((err) => log2.debug(`status checks: ${RUN_STATUS_CHECK_NAME} finalize failed: ${err}`));
200790
200696
  }
200791
- const approval = ctx.toolState.approval;
200792
- const needsApprovalCheck = ctx.payload.approvalCheck && params.runSucceeded && approval;
200697
+ const carriesApproval = !approval && ctx.toolState.selectedMode === "IncrementalReview";
200698
+ const needsApprovalCheck = ctx.payload.approvalCheck && params.runSucceeded && (approval !== void 0 || carriesApproval);
200793
200699
  const needsFallbackRunCheck = ctx.payload.runStatusCheck && checkRunId === void 0;
200794
200700
  if (!needsApprovalCheck && !needsFallbackRunCheck) return;
200795
200701
  let headSha;
@@ -200812,25 +200718,64 @@ async function reportStatusChecks(ctx, params) {
200812
200718
  headSha: primaryRepoState(ctx.toolState).checkoutSha ?? headSha,
200813
200719
  conclusion,
200814
200720
  detailsUrl,
200815
- reviewUrl: ctx.toolState.approval?.url
200721
+ reviewUrl: approval?.url,
200722
+ note
200816
200723
  }).then(() => log2.info(`\xBB posted ${RUN_STATUS_CHECK_NAME} check (${conclusion})`)).catch((err) => log2.debug(`status checks: ${RUN_STATUS_CHECK_NAME} post failed: ${err}`));
200817
200724
  }
200818
- if (!needsApprovalCheck || !approval) return;
200725
+ if (!needsApprovalCheck) return;
200726
+ const verdict = approval ? { wouldApprove: approval.wouldApprove, sha: approval.sha ?? headSha, carriedLine: "" } : await carriedApproval(ctx, pullNumber).catch((err) => {
200727
+ log2.debug(`status checks: ${APPROVAL_CHECK_NAME} carry-forward failed: ${err}`);
200728
+ return void 0;
200729
+ });
200730
+ if (!verdict) return;
200819
200731
  const createParams = {
200820
200732
  owner: ctx.repo.owner,
200821
200733
  repo: ctx.repo.name,
200822
200734
  name: APPROVAL_CHECK_NAME,
200823
- head_sha: approval.sha ?? headSha,
200735
+ head_sha: verdict.sha,
200824
200736
  status: "completed",
200825
- conclusion: approval.wouldApprove ? "success" : "failure",
200737
+ conclusion: verdict.wouldApprove ? "success" : "failure",
200826
200738
  output: {
200827
- title: approval.wouldApprove ? "Pullfrog would approve" : "Pullfrog would not approve",
200828
- summary: approval.wouldApprove ? "Pullfrog has no outstanding review feedback on this PR." : "Pullfrog has outstanding review feedback or requested changes on this PR."
200739
+ title: verdict.wouldApprove ? "Pullfrog would approve" : "Pullfrog would not approve",
200740
+ summary: (verdict.wouldApprove ? "Pullfrog has no outstanding review feedback on this PR." : "Pullfrog has outstanding review feedback or requested changes on this PR.") + verdict.carriedLine
200829
200741
  }
200830
200742
  };
200831
200743
  if (detailsUrl) createParams.details_url = detailsUrl;
200832
200744
  await ctx.octokit.rest.checks.create(createParams).then(() => log2.info(`\xBB posted ${APPROVAL_CHECK_NAME} check`)).catch((err) => log2.debug(`status checks: ${APPROVAL_CHECK_NAME} post failed: ${err}`));
200833
200745
  }
200746
+ async function carriedApproval(ctx, pullNumber) {
200747
+ const primary = primaryRepoState(ctx.toolState);
200748
+ if (!primary.beforeSha || !primary.checkoutSha) return void 0;
200749
+ if (await latestApprovalConclusion(ctx, primary.checkoutSha) !== void 0) return void 0;
200750
+ const prior = await latestApprovalConclusion(ctx, primary.beforeSha);
200751
+ if (prior === void 0) return void 0;
200752
+ const from = primary.beforeSha.slice(0, 7);
200753
+ if (prior !== "success") {
200754
+ const carriedLine = `
200755
+
200756
+ No review covered this commit, so the verdict on ${from} carries forward.`;
200757
+ return { wouldApprove: false, sha: primary.checkoutSha, carriedLine };
200758
+ }
200759
+ if (ctx.toolState.noReviewNeededSha !== primary.checkoutSha) return void 0;
200760
+ return {
200761
+ wouldApprove: await countOutstandingPullfrogThreads(ctx, pullNumber) === 0,
200762
+ sha: primary.checkoutSha,
200763
+ carriedLine: `
200764
+
200765
+ Pullfrog found nothing to review in the commits since ${from}.`
200766
+ };
200767
+ }
200768
+ async function latestApprovalConclusion(ctx, ref) {
200769
+ const result = await ctx.octokit.rest.checks.listForRef({
200770
+ owner: ctx.repo.owner,
200771
+ repo: ctx.repo.name,
200772
+ ref,
200773
+ check_name: APPROVAL_CHECK_NAME,
200774
+ status: "completed"
200775
+ });
200776
+ const latest = result.data.check_runs.filter((run4) => run4.app?.slug !== GITHUB_ACTIONS_APP_SLUG).sort((a2, b) => (b.completed_at ?? "").localeCompare(a2.completed_at ?? ""))[0];
200777
+ return latest?.conclusion ?? void 0;
200778
+ }
200834
200779
 
200835
200780
  // utils/runLifecycle.ts
200836
200781
  async function persistRunArtifacts(toolContext) {
@@ -201169,6 +201114,7 @@ async function main() {
201169
201114
  octokit: initialOctokit,
201170
201115
  token: jobToken,
201171
201116
  runType: typeof resolvedPromptInput === "string" ? void 0 : resolvedPromptInput.type,
201117
+ plainPrompt: typeof resolvedPromptInput === "string",
201172
201118
  routedTier: typeof resolvedPromptInput === "string" ? void 0 : resolvedPromptInput.routing?.tier
201173
201119
  });
201174
201120
  timer.checkpoint("runContextData");
@@ -201265,7 +201211,7 @@ async function main() {
201265
201211
  oidc: oidcCredentials
201266
201212
  }), true);
201267
201213
  wipeRunnerLeakSurface();
201268
- if (payload.shell === "restricted" && getSandboxMethod() === "none") {
201214
+ if (payload.shell !== "disabled" && process.env.CI === "true" && getSandboxMethod() === "none") {
201269
201215
  payload.shell = "disabled";
201270
201216
  log2.warning(
201271
201217
  "\xBB shell commands are disabled for this run: this runner provides no PID-namespace isolation (unprivileged unshare, sudo unshare and userns-nested unshare all failed). on a self-hosted Kubernetes/ARC runner, allow user-namespace creation in the pod's seccomp profile \u2014 see https://docs.pullfrog.com/security#self-hosted-runners"
@@ -201286,6 +201232,7 @@ async function main() {
201286
201232
  const octokit = createOctokit(tokenRef.mcpToken, getMcpTokenRefresh());
201287
201233
  const runInfo = await resolveRun({ octokit });
201288
201234
  let toolContext;
201235
+ let succeeded = false;
201289
201236
  let progressCallbackDisabled = false;
201290
201237
  let todoTracker;
201291
201238
  let vertexCredentials;
@@ -201703,11 +201650,13 @@ ${instructions.user}` : null,
201703
201650
  );
201704
201651
  }
201705
201652
  await finalizeSuccessRun({ toolContext, toolState, result, repo: runContext.repo });
201706
- return await handleAgentResult({
201653
+ const outcome = await handleAgentResult({
201707
201654
  result,
201708
201655
  toolContext,
201709
201656
  silent: payload.event.silent ?? false
201710
201657
  });
201658
+ succeeded = outcome.success;
201659
+ return outcome;
201711
201660
  } catch (_2) {
201712
201661
  var _error2 = _2, _hasError2 = true;
201713
201662
  } finally {
@@ -201753,9 +201702,8 @@ ${instructions.user}` : null,
201753
201702
  if (toolState.model) patch.model = toolState.model;
201754
201703
  if (toolState.agent) patch.agent = toolState.agent;
201755
201704
  if (toolState.credential) patch.credential = toolState.credential;
201756
- if (Object.keys(patch).length > 0) {
201757
- await patchWorkflowRunFields(toolContext, patch);
201758
- }
201705
+ patch.succeeded = succeeded;
201706
+ await patchWorkflowRunFields(toolContext, patch);
201759
201707
  }
201760
201708
  cleanupVertexCredentials(vertexCredentials);
201761
201709
  }
@@ -202307,7 +202255,7 @@ function resolveTarget2(repo) {
202307
202255
  return { owner: match3[1], repo: match3[2] };
202308
202256
  }
202309
202257
  function cliVersion() {
202310
- const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.95");
202258
+ const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.96");
202311
202259
  if (!parts) return "0.0.0";
202312
202260
  return `${Number(parts[1])}.${Number(parts[2])}.${Number(parts[3])}`;
202313
202261
  }
@@ -202453,10 +202401,10 @@ async function runCli8(input) {
202453
202401
  if (isTerminal2(error49)) bail(error49.message);
202454
202402
  throw error49;
202455
202403
  }
202456
- const poll = op(pollPrEvents, {
202404
+ const poll = query({
202405
+ run: (input2) => pollPrEvents(input2),
202457
202406
  name: "pr-events poll",
202458
- retries: [1e3, 2e3, 5e3, 1e4, 15e3],
202459
- rethrow: isTerminal2
202407
+ retry: (error49, attempt) => isTerminal2(error49) ? -1 : delay2([1e3, 2e3, 5e3, 1e4, 15e3], attempt)
202460
202408
  });
202461
202409
  for (; ; ) {
202462
202410
  try {
@@ -202474,7 +202422,7 @@ async function runCli8(input) {
202474
202422
  }
202475
202423
 
202476
202424
  // cli.ts
202477
- var VERSION10 = "0.1.95";
202425
+ var VERSION10 = "0.1.96";
202478
202426
  var bin = basename2(process.argv[1] || "");
202479
202427
  var PROG = bin === "pf" || bin === "pullfrog" ? bin : "pullfrog";
202480
202428
  var rawArgs = process.argv.slice(2);