@blockrun/clawrouter 0.10.6 → 0.10.8
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 +36 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +62 -11
- package/dist/index.js.map +1 -1
- package/package.json +22 -22
- package/scripts/reinstall.sh +44 -0
- package/scripts/update.sh +168 -0
package/dist/cli.js
CHANGED
|
@@ -511,7 +511,7 @@ function calibrateConfidence(distance, steepness) {
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
// src/router/selector.ts
|
|
514
|
-
var BASELINE_MODEL_ID = "anthropic/claude-opus-4
|
|
514
|
+
var BASELINE_MODEL_ID = "anthropic/claude-opus-4.6";
|
|
515
515
|
function selectModel(tier, confidence, method, reasoning, tierConfigs, modelPricing, estimatedInputTokens, maxOutputTokens, routingProfile) {
|
|
516
516
|
const tierConfig = tierConfigs[tier];
|
|
517
517
|
const model = tierConfig.primary;
|
|
@@ -1880,6 +1880,8 @@ var MODEL_ALIASES = {
|
|
|
1880
1880
|
reasoner: "deepseek/deepseek-reasoner",
|
|
1881
1881
|
// Kimi / Moonshot
|
|
1882
1882
|
kimi: "moonshot/kimi-k2.5",
|
|
1883
|
+
moonshot: "moonshot/kimi-k2.5",
|
|
1884
|
+
"kimi-k2.5": "moonshot/kimi-k2.5",
|
|
1883
1885
|
// Google
|
|
1884
1886
|
gemini: "google/gemini-2.5-pro",
|
|
1885
1887
|
flash: "google/gemini-2.5-flash",
|
|
@@ -4272,7 +4274,10 @@ var PROVIDER_ERROR_PATTERNS = [
|
|
|
4272
4274
|
/authentication.*failed/i,
|
|
4273
4275
|
/request too large/i,
|
|
4274
4276
|
/request.*size.*exceeds/i,
|
|
4275
|
-
/payload too large/i
|
|
4277
|
+
/payload too large/i,
|
|
4278
|
+
/payment.*verification.*failed/i,
|
|
4279
|
+
/model.*not.*allowed/i,
|
|
4280
|
+
/unknown.*model/i
|
|
4276
4281
|
];
|
|
4277
4282
|
var DEGRADED_RESPONSE_PATTERNS = [
|
|
4278
4283
|
/the ai service is temporarily overloaded/i,
|
|
@@ -4592,7 +4597,7 @@ function estimateAmount(modelId, bodyLength, maxTokens) {
|
|
|
4592
4597
|
const estimatedInputTokens = Math.ceil(bodyLength / 4);
|
|
4593
4598
|
const estimatedOutputTokens = maxTokens || model.maxOutput || 4096;
|
|
4594
4599
|
const costUsd = estimatedInputTokens / 1e6 * model.inputPrice + estimatedOutputTokens / 1e6 * model.outputPrice;
|
|
4595
|
-
const amountMicros = Math.max(
|
|
4600
|
+
const amountMicros = Math.max(1e3, Math.ceil(costUsd * 1.2 * 1e6));
|
|
4596
4601
|
return amountMicros.toString();
|
|
4597
4602
|
}
|
|
4598
4603
|
async function proxyPartnerRequest(req, res, apiBase, payFetch) {
|
|
@@ -5681,12 +5686,24 @@ async function loadSavedWallet() {
|
|
|
5681
5686
|
console.log(`[ClawRouter] \u2713 Loaded existing wallet from ${WALLET_FILE}`);
|
|
5682
5687
|
return key;
|
|
5683
5688
|
}
|
|
5684
|
-
console.
|
|
5689
|
+
console.error(`[ClawRouter] \u2717 CRITICAL: Wallet file exists but has invalid format!`);
|
|
5690
|
+
console.error(`[ClawRouter] File: ${WALLET_FILE}`);
|
|
5691
|
+
console.error(`[ClawRouter] Expected: 0x followed by 64 hex characters (66 chars total)`);
|
|
5692
|
+
console.error(`[ClawRouter] To fix: restore your backup key or set BLOCKRUN_WALLET_KEY env var`);
|
|
5693
|
+
throw new Error(
|
|
5694
|
+
`Wallet file at ${WALLET_FILE} is corrupted or has wrong format. Refusing to auto-generate new wallet to protect existing funds. Restore your backup key or set BLOCKRUN_WALLET_KEY environment variable.`
|
|
5695
|
+
);
|
|
5685
5696
|
} catch (err) {
|
|
5686
5697
|
if (err.code !== "ENOENT") {
|
|
5698
|
+
if (err instanceof Error && err.message.includes("Refusing to auto-generate")) {
|
|
5699
|
+
throw err;
|
|
5700
|
+
}
|
|
5687
5701
|
console.error(
|
|
5688
5702
|
`[ClawRouter] \u2717 Failed to read wallet file: ${err instanceof Error ? err.message : String(err)}`
|
|
5689
5703
|
);
|
|
5704
|
+
throw new Error(
|
|
5705
|
+
`Cannot read wallet file at ${WALLET_FILE}: ${err instanceof Error ? err.message : String(err)}. Refusing to auto-generate new wallet to protect existing funds. Fix file permissions or set BLOCKRUN_WALLET_KEY environment variable.`
|
|
5706
|
+
);
|
|
5690
5707
|
}
|
|
5691
5708
|
}
|
|
5692
5709
|
return void 0;
|
|
@@ -5707,6 +5724,20 @@ async function generateAndSaveWallet() {
|
|
|
5707
5724
|
`Failed to verify wallet file after creation: ${err instanceof Error ? err.message : String(err)}`
|
|
5708
5725
|
);
|
|
5709
5726
|
}
|
|
5727
|
+
console.log(`[ClawRouter]`);
|
|
5728
|
+
console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
5729
|
+
console.log(`[ClawRouter] NEW WALLET GENERATED \u2014 BACK UP YOUR KEY NOW`);
|
|
5730
|
+
console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
5731
|
+
console.log(`[ClawRouter] Address : ${account.address}`);
|
|
5732
|
+
console.log(`[ClawRouter] Key file: ${WALLET_FILE}`);
|
|
5733
|
+
console.log(`[ClawRouter]`);
|
|
5734
|
+
console.log(`[ClawRouter] To back up, run in OpenClaw:`);
|
|
5735
|
+
console.log(`[ClawRouter] /wallet export`);
|
|
5736
|
+
console.log(`[ClawRouter]`);
|
|
5737
|
+
console.log(`[ClawRouter] To restore on another machine:`);
|
|
5738
|
+
console.log(`[ClawRouter] export BLOCKRUN_WALLET_KEY=<your_key>`);
|
|
5739
|
+
console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
5740
|
+
console.log(`[ClawRouter]`);
|
|
5710
5741
|
return { key, address: account.address };
|
|
5711
5742
|
}
|
|
5712
5743
|
async function resolveOrGenerateWalletKey() {
|
|
@@ -6027,7 +6058,7 @@ var PARTNER_SERVICES = [
|
|
|
6027
6058
|
id: "x_users_lookup",
|
|
6028
6059
|
name: "Twitter/X User Lookup",
|
|
6029
6060
|
partner: "AttentionVC",
|
|
6030
|
-
description: "
|
|
6061
|
+
description: "ALWAYS use this tool to look up real-time Twitter/X user profiles. Call this when the user asks about any Twitter/X account, username, handle, follower count, verification status, bio, or profile. Do NOT answer Twitter/X user questions from memory \u2014 always fetch live data with this tool. Returns: follower count, verification badge, bio, location, join date. Accepts up to 100 usernames per request (without @ prefix).",
|
|
6031
6062
|
proxyPath: "/x/users/lookup",
|
|
6032
6063
|
method: "POST",
|
|
6033
6064
|
params: [
|