@blockrun/clawrouter 0.9.38 → 0.9.39
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 +24 -20
- package/dist/cli.js.map +1 -1
- package/dist/index.js +37 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1316,20 +1316,12 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1316
1316
|
SIMPLE: {
|
|
1317
1317
|
primary: "moonshot/kimi-k2.5",
|
|
1318
1318
|
// Cheaper than Haiku ($0.5/$2.4 vs $1/$5), larger context
|
|
1319
|
-
fallback: [
|
|
1320
|
-
"claude-haiku-4.5",
|
|
1321
|
-
"xai/grok-4-1-fast-non-reasoning",
|
|
1322
|
-
"openai/gpt-4o-mini"
|
|
1323
|
-
]
|
|
1319
|
+
fallback: ["claude-haiku-4.5", "xai/grok-4-1-fast-non-reasoning", "openai/gpt-4o-mini"]
|
|
1324
1320
|
},
|
|
1325
1321
|
MEDIUM: {
|
|
1326
1322
|
primary: "xai/grok-code-fast-1",
|
|
1327
1323
|
// Code specialist for agentic coding
|
|
1328
|
-
fallback: [
|
|
1329
|
-
"moonshot/kimi-k2.5",
|
|
1330
|
-
"claude-haiku-4.5",
|
|
1331
|
-
"claude-sonnet-4"
|
|
1332
|
-
]
|
|
1324
|
+
fallback: ["moonshot/kimi-k2.5", "claude-haiku-4.5", "claude-sonnet-4"]
|
|
1333
1325
|
},
|
|
1334
1326
|
COMPLEX: {
|
|
1335
1327
|
primary: "claude-sonnet-4",
|
|
@@ -1344,11 +1336,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1344
1336
|
REASONING: {
|
|
1345
1337
|
primary: "claude-sonnet-4",
|
|
1346
1338
|
// Strong tool use + reasoning for agentic tasks
|
|
1347
|
-
fallback: [
|
|
1348
|
-
"claude-opus-4",
|
|
1349
|
-
"xai/grok-4-1-fast-reasoning",
|
|
1350
|
-
"deepseek/deepseek-reasoner"
|
|
1351
|
-
]
|
|
1339
|
+
fallback: ["claude-opus-4", "xai/grok-4-1-fast-reasoning", "deepseek/deepseek-reasoner"]
|
|
1352
1340
|
}
|
|
1353
1341
|
},
|
|
1354
1342
|
overrides: {
|
|
@@ -1896,7 +1884,23 @@ async function logUsage(entry) {
|
|
|
1896
1884
|
}
|
|
1897
1885
|
|
|
1898
1886
|
// src/stats.ts
|
|
1899
|
-
import {
|
|
1887
|
+
import { readdir } from "fs/promises";
|
|
1888
|
+
|
|
1889
|
+
// src/fs-read.ts
|
|
1890
|
+
import { open } from "fs/promises";
|
|
1891
|
+
import { openSync, readSync, closeSync, fstatSync } from "fs";
|
|
1892
|
+
async function readTextFile(filePath) {
|
|
1893
|
+
const fh = await open(filePath, "r");
|
|
1894
|
+
try {
|
|
1895
|
+
const buf = Buffer.alloc((await fh.stat()).size);
|
|
1896
|
+
await fh.read(buf, 0, buf.length, 0);
|
|
1897
|
+
return buf.toString("utf-8");
|
|
1898
|
+
} finally {
|
|
1899
|
+
await fh.close();
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
// src/stats.ts
|
|
1900
1904
|
import { join as join3 } from "path";
|
|
1901
1905
|
import { homedir as homedir2 } from "os";
|
|
1902
1906
|
|
|
@@ -1915,7 +1919,7 @@ var USER_AGENT = `clawrouter/${VERSION}`;
|
|
|
1915
1919
|
var LOG_DIR2 = join3(homedir2(), ".openclaw", "blockrun", "logs");
|
|
1916
1920
|
async function parseLogFile(filePath) {
|
|
1917
1921
|
try {
|
|
1918
|
-
const content = await
|
|
1922
|
+
const content = await readTextFile(filePath);
|
|
1919
1923
|
const lines = content.trim().split("\n").filter(Boolean);
|
|
1920
1924
|
return lines.map((line) => {
|
|
1921
1925
|
const entry = JSON.parse(line);
|
|
@@ -5064,7 +5068,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
5064
5068
|
}
|
|
5065
5069
|
|
|
5066
5070
|
// src/auth.ts
|
|
5067
|
-
import { writeFile,
|
|
5071
|
+
import { writeFile, mkdir as mkdir2 } from "fs/promises";
|
|
5068
5072
|
import { join as join4 } from "path";
|
|
5069
5073
|
import { homedir as homedir3 } from "os";
|
|
5070
5074
|
import { generatePrivateKey, privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
@@ -5072,7 +5076,7 @@ var WALLET_DIR = join4(homedir3(), ".openclaw", "blockrun");
|
|
|
5072
5076
|
var WALLET_FILE = join4(WALLET_DIR, "wallet.key");
|
|
5073
5077
|
async function loadSavedWallet() {
|
|
5074
5078
|
try {
|
|
5075
|
-
const key = (await
|
|
5079
|
+
const key = (await readTextFile(WALLET_FILE)).trim();
|
|
5076
5080
|
if (key.startsWith("0x") && key.length === 66) {
|
|
5077
5081
|
console.log(`[ClawRouter] \u2713 Loaded existing wallet from ${WALLET_FILE}`);
|
|
5078
5082
|
return key;
|
|
@@ -5093,7 +5097,7 @@ async function generateAndSaveWallet() {
|
|
|
5093
5097
|
await mkdir2(WALLET_DIR, { recursive: true });
|
|
5094
5098
|
await writeFile(WALLET_FILE, key + "\n", { mode: 384 });
|
|
5095
5099
|
try {
|
|
5096
|
-
const verification = (await
|
|
5100
|
+
const verification = (await readTextFile(WALLET_FILE)).trim();
|
|
5097
5101
|
if (verification !== key) {
|
|
5098
5102
|
throw new Error("Wallet file verification failed - content mismatch");
|
|
5099
5103
|
}
|