@blockrun/clawrouter 0.12.13 → 0.12.16

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.js CHANGED
@@ -1744,6 +1744,13 @@ function resolveModelAlias(model) {
1744
1744
  if (resolvedWithoutPrefix) return resolvedWithoutPrefix;
1745
1745
  return withoutPrefix;
1746
1746
  }
1747
+ if (normalized.startsWith("openai/")) {
1748
+ const withoutPrefix = normalized.slice("openai/".length);
1749
+ const resolvedWithoutPrefix = MODEL_ALIASES[withoutPrefix];
1750
+ if (resolvedWithoutPrefix) return resolvedWithoutPrefix;
1751
+ const isVirtualProfile = BLOCKRUN_MODELS.some((m) => m.id === withoutPrefix);
1752
+ if (isVirtualProfile) return withoutPrefix;
1753
+ }
1747
1754
  return model;
1748
1755
  }
1749
1756
  var BLOCKRUN_MODELS = [
@@ -3027,6 +3034,14 @@ var SolanaBalanceMonitor = class {
3027
3034
  async fetchBalance() {
3028
3035
  const owner = solAddress(this.walletAddress);
3029
3036
  const mint = solAddress(SOLANA_USDC_MINT);
3037
+ for (let attempt = 0; attempt < 2; attempt++) {
3038
+ const result = await this.fetchBalanceOnce(owner, mint);
3039
+ if (result > 0n || attempt === 1) return result;
3040
+ await new Promise((r) => setTimeout(r, 1e3));
3041
+ }
3042
+ return 0n;
3043
+ }
3044
+ async fetchBalanceOnce(owner, mint) {
3030
3045
  const controller = new AbortController();
3031
3046
  const timer = setTimeout(() => controller.abort(), BALANCE_TIMEOUT_MS);
3032
3047
  try {
@@ -6361,9 +6376,9 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
6361
6376
  const normalizedModel = typeof parsed.model === "string" ? parsed.model.trim().toLowerCase() : "";
6362
6377
  const resolvedModel = resolveModelAlias(normalizedModel);
6363
6378
  const wasAlias = resolvedModel !== normalizedModel;
6364
- const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel);
6379
+ const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel) || ROUTING_PROFILES.has(resolvedModel);
6365
6380
  if (isRoutingProfile) {
6366
- const profileName = normalizedModel.replace("blockrun/", "");
6381
+ const profileName = resolvedModel.replace("blockrun/", "");
6367
6382
  routingProfile = profileName;
6368
6383
  }
6369
6384
  console.log(
@@ -7740,6 +7755,7 @@ ClawRouter Partner APIs (v${VERSION})
7740
7755
  } else {
7741
7756
  console.log(`[ClawRouter] Wallet balance: ${balance.balanceUSD}`);
7742
7757
  }
7758
+ proxy.balanceMonitor.invalidate();
7743
7759
  } catch {
7744
7760
  console.log(`[ClawRouter] Wallet: ${displayAddress} (balance check pending)`);
7745
7761
  }