@blockrun/clawrouter 0.12.310 → 0.12.312
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 +2199 -2162
- package/dist/index.js +3407 -3370
- package/dist/router/index.js +2612 -2572
- package/package.json +2 -2
- package/scripts/update.sh +36 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.312",
|
|
4
4
|
"description": "Smart LLM router — save 84% on inference costs. 91 models (8 free). Pay by credit card (API key) or USDC (x402 wallet).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
118
|
"@blockrun/model-catalog": "https://codeload.github.com/BlockRunAI/model-catalog/tar.gz/b95efe2f025c9968742e6479bc9ec71b6a40c0f4",
|
|
119
|
-
"@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/
|
|
119
|
+
"@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/273c2af0a9abe70212efbad7117b72eb3038cffc",
|
|
120
120
|
"@eslint/js": "^10.0.1",
|
|
121
121
|
"eslint": "^10.2.0",
|
|
122
122
|
"openclaw": "^2026.7.2-beta.7",
|
package/scripts/update.sh
CHANGED
|
@@ -112,6 +112,40 @@ if (best) console.log(path.dirname(best.packagePath));
|
|
|
112
112
|
NODE
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
# Print the EVM address for the wallet key in $1, or $2 if it can't be derived.
|
|
116
|
+
# The key is read by node from the file itself: it must never be interpolated
|
|
117
|
+
# into a `node -e` program or passed as an argument, because a process's argv
|
|
118
|
+
# is visible to other local users (/proc/<pid>/cmdline) and to exec auditing.
|
|
119
|
+
# See GHSA-27x5-82hg-xwr6.
|
|
120
|
+
derive_wallet_address() {
|
|
121
|
+
local address
|
|
122
|
+
# The heredoc lives in its own function: bash 3.2 (macOS /bin/bash) can't
|
|
123
|
+
# parse a heredoc nested inside $(...).
|
|
124
|
+
address=$(print_wallet_address "$1" 2>/dev/null) || address=""
|
|
125
|
+
if [ -n "$address" ]; then
|
|
126
|
+
echo "$address"
|
|
127
|
+
else
|
|
128
|
+
echo "$2"
|
|
129
|
+
fi
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
print_wallet_address() {
|
|
133
|
+
WALLET_KEY_FILE="$1" PACKAGE_DIR="$ACTIVE_PACKAGE_DIR" node <<'NODE'
|
|
134
|
+
try {
|
|
135
|
+
const fs = require('fs');
|
|
136
|
+
const key = fs.readFileSync(process.env.WALLET_KEY_FILE, 'utf8').replace(/\s+/g, '');
|
|
137
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(key)) process.exit(1);
|
|
138
|
+
const { privateKeyToAccount } = require(
|
|
139
|
+
require.resolve('viem/accounts', { paths: [process.env.PACKAGE_DIR || process.cwd()] }),
|
|
140
|
+
);
|
|
141
|
+
console.log(privateKeyToAccount(key).address);
|
|
142
|
+
} catch {
|
|
143
|
+
// viem not resolvable yet (fresh install path) or unreadable key file
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
NODE
|
|
147
|
+
}
|
|
148
|
+
|
|
115
149
|
sync_cli_shim() {
|
|
116
150
|
local package_dir="$1"
|
|
117
151
|
if [ -z "$package_dir" ] || [ ! -f "$package_dir/dist/cli.js" ]; then
|
|
@@ -256,16 +290,7 @@ if [ -f "$WALLET_FILE" ]; then
|
|
|
256
290
|
|
|
257
291
|
if [[ "$WALLET_KEY" == 0x* ]] && [ "$KEY_LEN" -eq 66 ]; then
|
|
258
292
|
# Derive wallet address via node (viem is available post-install)
|
|
259
|
-
WALLET_ADDRESS=$(
|
|
260
|
-
try {
|
|
261
|
-
const { privateKeyToAccount } = require(require.resolve('viem/accounts', { paths: ['$ACTIVE_PACKAGE_DIR'] }));
|
|
262
|
-
const acct = privateKeyToAccount('$WALLET_KEY');
|
|
263
|
-
console.log(acct.address);
|
|
264
|
-
} catch {
|
|
265
|
-
// viem not available yet (fresh install path), skip address check
|
|
266
|
-
console.log('(address check skipped)');
|
|
267
|
-
}
|
|
268
|
-
" 2>/dev/null || echo "(address check skipped)")
|
|
293
|
+
WALLET_ADDRESS=$(derive_wallet_address "$WALLET_FILE" "(address check skipped)")
|
|
269
294
|
|
|
270
295
|
WALLET_BACKUP="$(mktemp "$HOME/.openclaw/blockrun/wallet.key.bak.XXXXXX")"
|
|
271
296
|
cp "$WALLET_FILE" "$WALLET_BACKUP"
|
|
@@ -1251,13 +1276,7 @@ echo ""
|
|
|
1251
1276
|
|
|
1252
1277
|
# Show final wallet address
|
|
1253
1278
|
if [ -f "$WALLET_FILE" ]; then
|
|
1254
|
-
|
|
1255
|
-
FINAL_ADDRESS=$(node -e "
|
|
1256
|
-
try {
|
|
1257
|
-
const { privateKeyToAccount } = require(require.resolve('viem/accounts', { paths: ['$ACTIVE_PACKAGE_DIR'] }));
|
|
1258
|
-
console.log(privateKeyToAccount('$FINAL_KEY').address);
|
|
1259
|
-
} catch { console.log('(run /wallet in OpenClaw to see your address)'); }
|
|
1260
|
-
" 2>/dev/null || echo "(run /wallet in OpenClaw to see your address)")
|
|
1279
|
+
FINAL_ADDRESS=$(derive_wallet_address "$WALLET_FILE" "(run /wallet in OpenClaw to see your address)")
|
|
1261
1280
|
|
|
1262
1281
|
echo " Wallet: $FINAL_ADDRESS"
|
|
1263
1282
|
echo " Key file: $WALLET_FILE"
|