@blockrun/clawrouter 0.8.27 → 0.8.28

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/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("\u2551 ClawRouter by BlockRun v0.8.20 \u2551");
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 = fileURLToPath(import.meta.url);
2303
- var __dirname = dirname(__filename);
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 pkg = require2(join3(__dirname, "..", "package.json"));
2306
- var VERSION = pkg.version;
2307
- var USER_AGENT = `clawrouter/${VERSION}`;
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, VERSION) > 0) {
2470
+ if (compareSemver(latest, VERSION2) > 0) {
2466
2471
  console.log("");
2467
- console.log(`\x1B[33m\u2B06\uFE0F ClawRouter ${latest} available (you have ${VERSION})\x1B[0m`);
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
  }
@@ -4169,7 +4174,7 @@ var plugin = {
4169
4174
  id: "clawrouter",
4170
4175
  name: "ClawRouter",
4171
4176
  description: "Smart LLM router \u2014 30+ models, x402 micropayments, 78% cost savings",
4172
- version: VERSION,
4177
+ version: VERSION2,
4173
4178
  async register(api) {
4174
4179
  const isDisabled = process.env.CLAWROUTER_DISABLED === "true" || process.env.CLAWROUTER_DISABLED === "1";
4175
4180
  if (isDisabled) {