blun-king-cli 9.1.109 → 9.1.110

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.
Files changed (2) hide show
  1. package/blun.mjs +10 -3
  2. package/package.json +1 -1
package/blun.mjs CHANGED
@@ -1654,9 +1654,11 @@ var init_errors$10 = __esmMin((() => {
1654
1654
  }
1655
1655
  };
1656
1656
  APIProviderRateLimitError = class extends APIStatusError {
1657
- constructor(message, requestId) {
1657
+ retryAfterMs;
1658
+ constructor(message, requestId, retryAfterMs) {
1658
1659
  super(429, message, requestId);
1659
1660
  this.name = "APIProviderRateLimitError";
1661
+ this.retryAfterMs = typeof retryAfterMs === "number" && Number.isFinite(retryAfterMs) && retryAfterMs >= 0 ? retryAfterMs : null;
1660
1662
  }
1661
1663
  };
1662
1664
  APIPaymentRequiredError = class extends APIStatusError {
@@ -1849,6 +1851,7 @@ async function responseError(response) {
1849
1851
  apiCode: code,
1850
1852
  retryAfterMs: retryAfterHeaderMs(response.headers)
1851
1853
  });
1854
+ if (response.status === 429) return new APIProviderRateLimitError(message, requestId, retryAfterHeaderMs(response.headers));
1852
1855
  return normalizeAPIStatusError(response.status, message, requestId);
1853
1856
  }
1854
1857
  function retryAfterHeaderMs(headers) {
@@ -30322,7 +30325,7 @@ async function chatWithRetry(input) {
30322
30325
  logRequestFailure(input, error, attempt, maxAttempts);
30323
30326
  throw error;
30324
30327
  }
30325
- const delayMs = delays[attempt - 1] ?? 0;
30328
+ const delayMs = retryDelayForError(error, delays[attempt - 1] ?? 0);
30326
30329
  input.params.signal.throwIfAborted();
30327
30330
  input.dispatchEvent({
30328
30331
  type: "step.retrying",
@@ -30338,6 +30341,10 @@ async function chatWithRetry(input) {
30338
30341
  await sleepForRetry(delayMs, input.params.signal);
30339
30342
  }
30340
30343
  }
30344
+ function retryDelayForError(error, fallbackDelayMs) {
30345
+ if (!(error instanceof APIProviderRateLimitError) || error.retryAfterMs === null) return fallbackDelayMs;
30346
+ return Math.max(fallbackDelayMs, error.retryAfterMs);
30347
+ }
30341
30348
  function logRequestFailure(input, error, attempt, maxAttempts) {
30342
30349
  if (isAbortError$4(error) || input.params.signal.aborted) return;
30343
30350
  input.log?.warn("llm request failed", {
@@ -257727,7 +257734,7 @@ var init_rg_locator = __esmMin((() => {
257727
257734
  import_yauzl$2 = require_yauzl();
257728
257735
  init_abort();
257729
257736
  RG_VERSION = "15.0.0";
257730
- RG_BASE_URL = "https://blun.ai/blun/rg";
257737
+ RG_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}`;
257731
257738
  DOWNLOAD_TIMEOUT_MS$1 = 6e5;
257732
257739
  RG_ARCHIVE_SHA256 = {
257733
257740
  "ripgrep-15.0.0-aarch64-apple-darwin.tar.gz": "98bb2e61e7277ba0ea72d2ae2592497fd8d2940934a16b122448d302a6637e3b",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.109",
3
+ "version": "9.1.110",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {