@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 +18 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -83,6 +83,14 @@ var init_solana_balance = __esm({
|
|
|
83
83
|
async fetchBalance() {
|
|
84
84
|
const owner = solAddress(this.walletAddress);
|
|
85
85
|
const mint = solAddress(SOLANA_USDC_MINT);
|
|
86
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
87
|
+
const result = await this.fetchBalanceOnce(owner, mint);
|
|
88
|
+
if (result > 0n || attempt === 1) return result;
|
|
89
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
90
|
+
}
|
|
91
|
+
return 0n;
|
|
92
|
+
}
|
|
93
|
+
async fetchBalanceOnce(owner, mint) {
|
|
86
94
|
const controller = new AbortController();
|
|
87
95
|
const timer = setTimeout(() => controller.abort(), BALANCE_TIMEOUT_MS);
|
|
88
96
|
try {
|
|
@@ -1021,6 +1029,13 @@ function resolveModelAlias(model) {
|
|
|
1021
1029
|
if (resolvedWithoutPrefix) return resolvedWithoutPrefix;
|
|
1022
1030
|
return withoutPrefix;
|
|
1023
1031
|
}
|
|
1032
|
+
if (normalized.startsWith("openai/")) {
|
|
1033
|
+
const withoutPrefix = normalized.slice("openai/".length);
|
|
1034
|
+
const resolvedWithoutPrefix = MODEL_ALIASES[withoutPrefix];
|
|
1035
|
+
if (resolvedWithoutPrefix) return resolvedWithoutPrefix;
|
|
1036
|
+
const isVirtualProfile = BLOCKRUN_MODELS.some((m) => m.id === withoutPrefix);
|
|
1037
|
+
if (isVirtualProfile) return withoutPrefix;
|
|
1038
|
+
}
|
|
1024
1039
|
return model;
|
|
1025
1040
|
}
|
|
1026
1041
|
var BLOCKRUN_MODELS = [
|
|
@@ -6845,9 +6860,9 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
6845
6860
|
const normalizedModel = typeof parsed.model === "string" ? parsed.model.trim().toLowerCase() : "";
|
|
6846
6861
|
const resolvedModel = resolveModelAlias(normalizedModel);
|
|
6847
6862
|
const wasAlias = resolvedModel !== normalizedModel;
|
|
6848
|
-
const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel);
|
|
6863
|
+
const isRoutingProfile = ROUTING_PROFILES.has(normalizedModel) || ROUTING_PROFILES.has(resolvedModel);
|
|
6849
6864
|
if (isRoutingProfile) {
|
|
6850
|
-
const profileName =
|
|
6865
|
+
const profileName = resolvedModel.replace("blockrun/", "");
|
|
6851
6866
|
routingProfile = profileName;
|
|
6852
6867
|
}
|
|
6853
6868
|
console.log(
|