@blockrun/clawrouter 0.12.13 → 0.12.17
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 +26 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 {
|
|
@@ -3673,7 +3688,14 @@ async function generateAndSaveWallet() {
|
|
|
3673
3688
|
const existingMnemonic = await loadMnemonic();
|
|
3674
3689
|
if (existingMnemonic) {
|
|
3675
3690
|
throw new Error(
|
|
3676
|
-
`Mnemonic file exists at ${MNEMONIC_FILE} but wallet.key is missing.
|
|
3691
|
+
`Mnemonic file exists at ${MNEMONIC_FILE} but wallet.key is missing.
|
|
3692
|
+
Refusing to generate a new wallet to protect existing funds.
|
|
3693
|
+
|
|
3694
|
+
Restore your EVM private key using one of:
|
|
3695
|
+
Windows: set BLOCKRUN_WALLET_KEY=0x<your_key>
|
|
3696
|
+
Mac/Linux: export BLOCKRUN_WALLET_KEY=0x<your_key>
|
|
3697
|
+
|
|
3698
|
+
Then run: npx @blockrun/clawrouter`
|
|
3677
3699
|
);
|
|
3678
3700
|
}
|
|
3679
3701
|
const mnemonic = generateWalletMnemonic();
|
|
@@ -6361,9 +6383,9 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
6361
6383
|
const normalizedModel = typeof parsed.model === "string" ? parsed.model.trim().toLowerCase() : "";
|
|
6362
6384
|
const resolvedModel = resolveModelAlias(normalizedModel);
|
|
6363
6385
|
const wasAlias = resolvedModel !== normalizedModel;
|
|
6364
|
-
const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel);
|
|
6386
|
+
const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel) || ROUTING_PROFILES.has(resolvedModel);
|
|
6365
6387
|
if (isRoutingProfile) {
|
|
6366
|
-
const profileName =
|
|
6388
|
+
const profileName = resolvedModel.replace("blockrun/", "");
|
|
6367
6389
|
routingProfile = profileName;
|
|
6368
6390
|
}
|
|
6369
6391
|
console.log(
|
|
@@ -7740,6 +7762,7 @@ ClawRouter Partner APIs (v${VERSION})
|
|
|
7740
7762
|
} else {
|
|
7741
7763
|
console.log(`[ClawRouter] Wallet balance: ${balance.balanceUSD}`);
|
|
7742
7764
|
}
|
|
7765
|
+
proxy.balanceMonitor.invalidate();
|
|
7743
7766
|
} catch {
|
|
7744
7767
|
console.log(`[ClawRouter] Wallet: ${displayAddress} (balance check pending)`);
|
|
7745
7768
|
}
|