@blockrun/clawrouter 0.8.27 → 0.8.29
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 +25 -23
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -478,8 +478,7 @@ declare function getSessionId(headers: Record<string, string | string[] | undefi
|
|
|
478
478
|
*/
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
|
-
* Get the proxy port from
|
|
482
|
-
* Port is validated at module load time, this just returns the cached value.
|
|
481
|
+
* Get the proxy port from environment variable or default.
|
|
483
482
|
*/
|
|
484
483
|
declare function getProxyPort(): number;
|
|
485
484
|
/** Callback info for low balance warning */
|
package/dist/index.js
CHANGED
|
@@ -1810,8 +1810,13 @@ async function logUsage(entry) {
|
|
|
1810
1810
|
|
|
1811
1811
|
// src/stats.ts
|
|
1812
1812
|
import { readFile, readdir } from "fs/promises";
|
|
1813
|
-
import { join as join2 } from "path";
|
|
1813
|
+
import { join as join2, dirname } from "path";
|
|
1814
1814
|
import { homedir as homedir2 } from "os";
|
|
1815
|
+
import { fileURLToPath } from "url";
|
|
1816
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1817
|
+
var pkgPath = join2(__dirname, "..", "package.json");
|
|
1818
|
+
var pkg = JSON.parse(await readFile(pkgPath, "utf-8").catch(() => '{"version":"unknown"}'));
|
|
1819
|
+
var VERSION = pkg.version;
|
|
1815
1820
|
var LOG_DIR2 = join2(homedir2(), ".openclaw", "blockrun", "logs");
|
|
1816
1821
|
async function parseLogFile(filePath) {
|
|
1817
1822
|
try {
|
|
@@ -1941,7 +1946,7 @@ async function getStats(days = 7) {
|
|
|
1941
1946
|
function formatStatsAscii(stats) {
|
|
1942
1947
|
const lines = [];
|
|
1943
1948
|
lines.push("\u2554\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
1944
|
-
lines.push(
|
|
1949
|
+
lines.push(`\u2551 ClawRouter by BlockRun v${VERSION}`.padEnd(61) + "\u2551");
|
|
1945
1950
|
lines.push("\u2551 Usage Statistics \u2551");
|
|
1946
1951
|
lines.push("\u2560\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563");
|
|
1947
1952
|
lines.push(`\u2551 Period: ${stats.period.padEnd(49)}\u2551`);
|
|
@@ -2297,14 +2302,14 @@ var BalanceMonitor = class {
|
|
|
2297
2302
|
|
|
2298
2303
|
// src/version.ts
|
|
2299
2304
|
import { createRequire } from "module";
|
|
2300
|
-
import { fileURLToPath } from "url";
|
|
2301
|
-
import { dirname, join as join3 } from "path";
|
|
2302
|
-
var __filename =
|
|
2303
|
-
var
|
|
2305
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2306
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
2307
|
+
var __filename = fileURLToPath2(import.meta.url);
|
|
2308
|
+
var __dirname2 = dirname2(__filename);
|
|
2304
2309
|
var require2 = createRequire(import.meta.url);
|
|
2305
|
-
var
|
|
2306
|
-
var
|
|
2307
|
-
var USER_AGENT = `clawrouter/${
|
|
2310
|
+
var pkg2 = require2(join3(__dirname2, "..", "package.json"));
|
|
2311
|
+
var VERSION2 = pkg2.version;
|
|
2312
|
+
var USER_AGENT = `clawrouter/${VERSION2}`;
|
|
2308
2313
|
|
|
2309
2314
|
// src/session.ts
|
|
2310
2315
|
var DEFAULT_SESSION_CONFIG = {
|
|
@@ -2462,9 +2467,9 @@ async function checkForUpdates() {
|
|
|
2462
2467
|
const data = await res.json();
|
|
2463
2468
|
const latest = data.version;
|
|
2464
2469
|
if (!latest) return;
|
|
2465
|
-
if (compareSemver(latest,
|
|
2470
|
+
if (compareSemver(latest, VERSION2) > 0) {
|
|
2466
2471
|
console.log("");
|
|
2467
|
-
console.log(`\x1B[33m\u2B06\uFE0F ClawRouter ${latest} available (you have ${
|
|
2472
|
+
console.log(`\x1B[33m\u2B06\uFE0F ClawRouter ${latest} available (you have ${VERSION2})\x1B[0m`);
|
|
2468
2473
|
console.log(` Run: \x1B[36mcurl -fsSL ${UPDATE_URL} | bash\x1B[0m`);
|
|
2469
2474
|
console.log("");
|
|
2470
2475
|
}
|
|
@@ -2489,16 +2494,6 @@ var FREE_MODEL = "nvidia/gpt-oss-120b";
|
|
|
2489
2494
|
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
2490
2495
|
var DEFAULT_REQUEST_TIMEOUT_MS = 18e4;
|
|
2491
2496
|
var DEFAULT_PORT = 8402;
|
|
2492
|
-
var PROXY_PORT = (() => {
|
|
2493
|
-
const envPort = process.env.BLOCKRUN_PROXY_PORT;
|
|
2494
|
-
if (envPort) {
|
|
2495
|
-
const parsed = parseInt(envPort, 10);
|
|
2496
|
-
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2497
|
-
return parsed;
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
return DEFAULT_PORT;
|
|
2501
|
-
})();
|
|
2502
2497
|
var MAX_FALLBACK_ATTEMPTS = 3;
|
|
2503
2498
|
var HEALTH_CHECK_TIMEOUT_MS = 2e3;
|
|
2504
2499
|
var RATE_LIMIT_COOLDOWN_MS = 6e4;
|
|
@@ -2598,7 +2593,14 @@ function safeWrite(res, data) {
|
|
|
2598
2593
|
}
|
|
2599
2594
|
var BALANCE_CHECK_BUFFER = 1.5;
|
|
2600
2595
|
function getProxyPort() {
|
|
2601
|
-
|
|
2596
|
+
const envPort = process.env.BLOCKRUN_PROXY_PORT;
|
|
2597
|
+
if (envPort) {
|
|
2598
|
+
const parsed = parseInt(envPort, 10);
|
|
2599
|
+
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2600
|
+
return parsed;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
return DEFAULT_PORT;
|
|
2602
2604
|
}
|
|
2603
2605
|
async function checkExistingProxy(port) {
|
|
2604
2606
|
const controller = new AbortController();
|
|
@@ -4169,7 +4171,7 @@ var plugin = {
|
|
|
4169
4171
|
id: "clawrouter",
|
|
4170
4172
|
name: "ClawRouter",
|
|
4171
4173
|
description: "Smart LLM router \u2014 30+ models, x402 micropayments, 78% cost savings",
|
|
4172
|
-
version:
|
|
4174
|
+
version: VERSION2,
|
|
4173
4175
|
async register(api) {
|
|
4174
4176
|
const isDisabled = process.env.CLAWROUTER_DISABLED === "true" || process.env.CLAWROUTER_DISABLED === "1";
|
|
4175
4177
|
if (isDisabled) {
|