blun-king-cli 9.1.629 → 9.1.630

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 (3) hide show
  1. package/blun.mjs +25 -34
  2. package/package.json +1 -1
  3. package/worker-host.mjs +17 -26
package/blun.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:c6e4e4587ddf016fdb40a775622da5455beee2ed97708e374bf683b38e4a9dea
2
+ // BLUN_BUILD_INPUT_SHA256:295bff16bb3a40df46f164599652a975e64b232ee91e1b245fa87962a4b61885
3
3
  /*! wasm-webp 0.1.0
4
4
  MIT License
5
5
 
@@ -13347,23 +13347,15 @@ var init_managed_usage = __esmMin((() => {
13347
13347
  init_utils$2();
13348
13348
  DEFAULT_BLUN_BASE_URL = "https://api.blun.ai/v1";
13349
13349
  DEFAULT_BLUN_AUXILIARY_BASE_URL = "https://api.blun.ai/coding/v1";
13350
- ACCOUNT_USAGE_WINDOWS = [
13351
- [
13352
- "fuenf_stunden",
13353
- "five_hours",
13354
- "5h"
13355
- ],
13356
- [
13357
- "sieben_tage",
13358
- "seven_days",
13359
- "7d"
13360
- ],
13361
- [
13362
- "monat",
13363
- "month",
13364
- "month"
13365
- ]
13366
- ];
13350
+ ACCOUNT_USAGE_WINDOWS = [[
13351
+ "sieben_tage",
13352
+ "seven_days",
13353
+ "7d"
13354
+ ], [
13355
+ "monat",
13356
+ "month",
13357
+ "month"
13358
+ ]];
13367
13359
  }));
13368
13360
  function cloneOverrides(overrides) {
13369
13361
  if (overrides === void 0) return void 0;
@@ -13864,9 +13856,11 @@ function parseManagedQuotaPayload(payload) {
13864
13856
  const billingKind = nonEmptyString$6(payload["art"]);
13865
13857
  const globalUnlimited = payload["unlimited"];
13866
13858
  if (plan === void 0 || typeof paid !== "boolean" || !Number.isSafeInteger(creditCents) || creditCents < 0 || billingKind === void 0 || globalUnlimited !== void 0 && typeof globalUnlimited !== "boolean" || !isRecord$27(payload["stand"])) return;
13867
- if (!hasStrictQuotaStand(payload["stand"], globalUnlimited === true)) return void 0;
13859
+ const stand = payload["stand"];
13860
+ if (!hasStrictQuotaStand(stand, globalUnlimited === true)) return void 0;
13861
+ const presentWindows = QUOTA_WINDOWS.filter(([sourceKey]) => sourceKey in stand);
13868
13862
  const limits = parseManagedUsagePayload(payload).limits;
13869
- if (limits.length !== REQUIRED_WINDOWS.length || REQUIRED_WINDOWS.some(([, id]) => limits.filter((row) => row.id === id).length !== 1)) return;
13863
+ if (limits.length !== presentWindows.length || presentWindows.some(([, id]) => limits.filter((row) => row.id === id).length !== 1)) return;
13870
13864
  return {
13871
13865
  plan,
13872
13866
  paid,
@@ -13931,7 +13925,8 @@ function nonEmptyString$6(value) {
13931
13925
  return normalized.length === 0 ? void 0 : normalized;
13932
13926
  }
13933
13927
  function hasStrictQuotaStand(stand, globalUnlimited) {
13934
- return REQUIRED_WINDOWS.every(([sourceKey]) => {
13928
+ return QUOTA_WINDOWS.every(([sourceKey]) => {
13929
+ if (!(sourceKey in stand)) return true;
13935
13930
  const row = stand[sourceKey];
13936
13931
  if (!isRecord$27(row)) return false;
13937
13932
  const used = row["verbraucht"];
@@ -13954,18 +13949,14 @@ function hasValidResetAt(value) {
13954
13949
  if (typeof value !== "string") return false;
13955
13950
  return /(?:Z|[+-]\d{2}:\d{2})$/i.test(value) && Number.isFinite(Date.parse(value));
13956
13951
  }
13957
- var MANAGED_QUOTA_PATH, REQUIRED_WINDOWS;
13952
+ var MANAGED_QUOTA_PATH, QUOTA_WINDOWS;
13958
13953
  var init_managed_quota$1 = __esmMin((() => {
13959
13954
  init_constants$6();
13960
13955
  init_api_error();
13961
13956
  init_managed_usage();
13962
13957
  init_utils$2();
13963
13958
  MANAGED_QUOTA_PATH = "/api/verbrauch/mein-stand";
13964
- REQUIRED_WINDOWS = [
13965
- ["fuenf_stunden", "five_hours"],
13966
- ["sieben_tage", "seven_days"],
13967
- ["monat", "month"]
13968
- ];
13959
+ QUOTA_WINDOWS = [["sieben_tage", "seven_days"], ["monat", "month"]];
13969
13960
  }));
13970
13961
  function blunCodeFeedbackUrl(baseUrl) {
13971
13962
  return `${blunCodeAuxiliaryBaseUrl(baseUrl)}/feedback`;
@@ -529129,8 +529120,11 @@ function normalizeManagedQuotaWindows(rows) {
529129
529120
  unlimited: row.unlimited === true ? true : void 0
529130
529121
  });
529131
529122
  }
529132
- if (byId.size !== WINDOW_IDS.length) return void 0;
529133
- return WINDOW_IDS.map((id) => byId.get(id));
529123
+ if (byId.size === 0 && rows.some((row) => row.id !== void 0 && WINDOW_IDS.includes(row.id))) return;
529124
+ return WINDOW_IDS.flatMap((id) => {
529125
+ const window = byId.get(id);
529126
+ return window === void 0 ? [] : [window];
529127
+ });
529134
529128
  }
529135
529129
  function selectHighestManagedQuotaWindow(windows) {
529136
529130
  return windows?.filter((window) => window.unlimited !== true).reduce((highest, window) => highest === void 0 || window.fraction > highest.fraction ? window : highest, void 0);
@@ -529148,11 +529142,7 @@ function nextManagedQuotaWarning(windows, highestShown) {
529148
529142
  var MANAGED_QUOTA_WARNING_METADATA_KEY, WINDOW_IDS;
529149
529143
  var init_managed_quota = __esmMin((() => {
529150
529144
  MANAGED_QUOTA_WARNING_METADATA_KEY = "managedQuotaWarningThreshold";
529151
- WINDOW_IDS = [
529152
- "five_hours",
529153
- "seven_days",
529154
- "month"
529155
- ];
529145
+ WINDOW_IDS = ["seven_days", "month"];
529156
529146
  }));
529157
529147
  function managedProviderOnly(providers) {
529158
529148
  const managed = providers[DEFAULT_OAUTH_PROVIDER_NAME];
@@ -537127,6 +537117,7 @@ function centerQuotaLine(line, width) {
537127
537117
  return `${" ".repeat(leftPadding)}${line}`;
537128
537118
  }
537129
537119
  function formatManagedQuotaFooterLines(windows, colors, width, options = {}) {
537120
+ windows = windows.filter((window) => window.id !== "five_hours");
537130
537121
  if (windows.length === 0 || width <= 0) return [];
537131
537122
  const locale = options.locale ?? getCurrentUiLocale();
537132
537123
  const variants = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.629",
3
+ "version": "9.1.630",
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": {
package/worker-host.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:c6e4e4587ddf016fdb40a775622da5455beee2ed97708e374bf683b38e4a9dea
2
+ // BLUN_BUILD_INPUT_SHA256:295bff16bb3a40df46f164599652a975e64b232ee91e1b245fa87962a4b61885
3
3
  /*! wasm-webp 0.1.0
4
4
  MIT License
5
5
 
@@ -13011,23 +13011,15 @@ function managedContextWindowFrom(payload) {
13011
13011
  const [first] = values;
13012
13012
  return values.every((value) => value === first) ? first : void 0;
13013
13013
  }
13014
- const ACCOUNT_USAGE_WINDOWS = [
13015
- [
13016
- "fuenf_stunden",
13017
- "five_hours",
13018
- "5h"
13019
- ],
13020
- [
13021
- "sieben_tage",
13022
- "seven_days",
13023
- "7d"
13024
- ],
13025
- [
13026
- "monat",
13027
- "month",
13028
- "month"
13029
- ]
13030
- ];
13014
+ const ACCOUNT_USAGE_WINDOWS = [[
13015
+ "sieben_tage",
13016
+ "seven_days",
13017
+ "7d"
13018
+ ], [
13019
+ "monat",
13020
+ "month",
13021
+ "month"
13022
+ ]];
13031
13023
  function toAccountUsageRow(raw, id, label, accountUnlimited) {
13032
13024
  if (!isRecord$9(raw)) return null;
13033
13025
  const used = toInt(raw["verbraucht"]);
@@ -13738,11 +13730,7 @@ async function provisionManagedBlunCodeConfig(options) {
13738
13730
  };
13739
13731
  }
13740
13732
  const MANAGED_QUOTA_PATH = "/api/verbrauch/mein-stand";
13741
- const REQUIRED_WINDOWS = [
13742
- ["fuenf_stunden", "five_hours"],
13743
- ["sieben_tage", "seven_days"],
13744
- ["monat", "month"]
13745
- ];
13733
+ const QUOTA_WINDOWS = [["sieben_tage", "seven_days"], ["monat", "month"]];
13746
13734
  function blunManagedQuotaUrl(oauthHost) {
13747
13735
  return `${(oauthHost ?? process.env["BLUN_OAUTH_HOST"] ?? "https://account.blun.ai").replace(/\/+$/, "")}${MANAGED_QUOTA_PATH}`;
13748
13736
  }
@@ -13754,9 +13742,11 @@ function parseManagedQuotaPayload(payload) {
13754
13742
  const billingKind = nonEmptyString$5(payload["art"]);
13755
13743
  const globalUnlimited = payload["unlimited"];
13756
13744
  if (plan === void 0 || typeof paid !== "boolean" || !Number.isSafeInteger(creditCents) || creditCents < 0 || billingKind === void 0 || globalUnlimited !== void 0 && typeof globalUnlimited !== "boolean" || !isRecord$9(payload["stand"])) return;
13757
- if (!hasStrictQuotaStand(payload["stand"], globalUnlimited === true)) return void 0;
13745
+ const stand = payload["stand"];
13746
+ if (!hasStrictQuotaStand(stand, globalUnlimited === true)) return void 0;
13747
+ const presentWindows = QUOTA_WINDOWS.filter(([sourceKey]) => sourceKey in stand);
13758
13748
  const limits = parseManagedUsagePayload(payload).limits;
13759
- if (limits.length !== REQUIRED_WINDOWS.length || REQUIRED_WINDOWS.some(([, id]) => limits.filter((row) => row.id === id).length !== 1)) return;
13749
+ if (limits.length !== presentWindows.length || presentWindows.some(([, id]) => limits.filter((row) => row.id === id).length !== 1)) return;
13760
13750
  return {
13761
13751
  plan,
13762
13752
  paid,
@@ -13821,7 +13811,8 @@ function nonEmptyString$5(value) {
13821
13811
  return normalized.length === 0 ? void 0 : normalized;
13822
13812
  }
13823
13813
  function hasStrictQuotaStand(stand, globalUnlimited) {
13824
- return REQUIRED_WINDOWS.every(([sourceKey]) => {
13814
+ return QUOTA_WINDOWS.every(([sourceKey]) => {
13815
+ if (!(sourceKey in stand)) return true;
13825
13816
  const row = stand[sourceKey];
13826
13817
  if (!isRecord$9(row)) return false;
13827
13818
  const used = row["verbraucht"];