@blockrun/clawrouter 0.12.300 → 0.12.301
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 +11 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -48768,7 +48768,8 @@ async function parseLogFile(filePath) {
|
|
|
48768
48768
|
cost: entry.cost || 0,
|
|
48769
48769
|
baselineCost: entry.baselineCost || entry.cost || 0,
|
|
48770
48770
|
savings: entry.savings || 0,
|
|
48771
|
-
latencyMs: entry.latencyMs || 0
|
|
48771
|
+
latencyMs: entry.latencyMs || 0,
|
|
48772
|
+
status: entry.status === "error" || entry.status === "success" ? entry.status : void 0
|
|
48772
48773
|
});
|
|
48773
48774
|
} catch {
|
|
48774
48775
|
}
|
|
@@ -48822,11 +48823,17 @@ async function getStats(days = 7) {
|
|
|
48822
48823
|
let totalCost = 0;
|
|
48823
48824
|
let totalBaselineCost = 0;
|
|
48824
48825
|
let totalLatency = 0;
|
|
48826
|
+
let errorCount = 0;
|
|
48825
48827
|
for (const file of filesToRead) {
|
|
48826
48828
|
const date = file.replace("usage-", "").replace(".jsonl", "");
|
|
48827
48829
|
const filePath = join6(LOG_DIR2, file);
|
|
48828
48830
|
const entries = await parseLogFile(filePath);
|
|
48829
48831
|
if (entries.length === 0) continue;
|
|
48832
|
+
for (const entry of entries) {
|
|
48833
|
+
if (entry.status === "error") {
|
|
48834
|
+
errorCount++;
|
|
48835
|
+
}
|
|
48836
|
+
}
|
|
48830
48837
|
const dayStats = aggregateDay(date, entries);
|
|
48831
48838
|
dailyBreakdown.push(dayStats);
|
|
48832
48839
|
totalRequests += dayStats.totalRequests;
|
|
@@ -48879,8 +48886,9 @@ async function getStats(days = 7) {
|
|
|
48879
48886
|
byModel: byModelWithPercentage,
|
|
48880
48887
|
dailyBreakdown: dailyBreakdown.reverse(),
|
|
48881
48888
|
// Oldest first for charts
|
|
48882
|
-
entriesWithBaseline
|
|
48889
|
+
entriesWithBaseline,
|
|
48883
48890
|
// How many entries have valid baseline tracking
|
|
48891
|
+
errorCount
|
|
48884
48892
|
};
|
|
48885
48893
|
}
|
|
48886
48894
|
function formatStatsAscii(stats) {
|
|
@@ -287490,8 +287498,7 @@ async function collectLogInfo() {
|
|
|
287490
287498
|
return {
|
|
287491
287499
|
requestsLast24h: stats.totalRequests,
|
|
287492
287500
|
costLast24h: `$${stats.totalCost.toFixed(4)}`,
|
|
287493
|
-
errorsFound:
|
|
287494
|
-
// TODO: parse error logs
|
|
287501
|
+
errorsFound: stats.errorCount
|
|
287495
287502
|
};
|
|
287496
287503
|
} catch {
|
|
287497
287504
|
return {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -260853,7 +260853,8 @@ async function parseLogFile(filePath) {
|
|
|
260853
260853
|
cost: entry.cost || 0,
|
|
260854
260854
|
baselineCost: entry.baselineCost || entry.cost || 0,
|
|
260855
260855
|
savings: entry.savings || 0,
|
|
260856
|
-
latencyMs: entry.latencyMs || 0
|
|
260856
|
+
latencyMs: entry.latencyMs || 0,
|
|
260857
|
+
status: entry.status === "error" || entry.status === "success" ? entry.status : void 0
|
|
260857
260858
|
});
|
|
260858
260859
|
} catch {
|
|
260859
260860
|
}
|
|
@@ -260907,11 +260908,17 @@ async function getStats(days = 7) {
|
|
|
260907
260908
|
let totalCost = 0;
|
|
260908
260909
|
let totalBaselineCost = 0;
|
|
260909
260910
|
let totalLatency = 0;
|
|
260911
|
+
let errorCount = 0;
|
|
260910
260912
|
for (const file of filesToRead) {
|
|
260911
260913
|
const date = file.replace("usage-", "").replace(".jsonl", "");
|
|
260912
260914
|
const filePath = join6(LOG_DIR2, file);
|
|
260913
260915
|
const entries = await parseLogFile(filePath);
|
|
260914
260916
|
if (entries.length === 0) continue;
|
|
260917
|
+
for (const entry of entries) {
|
|
260918
|
+
if (entry.status === "error") {
|
|
260919
|
+
errorCount++;
|
|
260920
|
+
}
|
|
260921
|
+
}
|
|
260915
260922
|
const dayStats = aggregateDay(date, entries);
|
|
260916
260923
|
dailyBreakdown.push(dayStats);
|
|
260917
260924
|
totalRequests += dayStats.totalRequests;
|
|
@@ -260964,8 +260971,9 @@ async function getStats(days = 7) {
|
|
|
260964
260971
|
byModel: byModelWithPercentage,
|
|
260965
260972
|
dailyBreakdown: dailyBreakdown.reverse(),
|
|
260966
260973
|
// Oldest first for charts
|
|
260967
|
-
entriesWithBaseline
|
|
260974
|
+
entriesWithBaseline,
|
|
260968
260975
|
// How many entries have valid baseline tracking
|
|
260976
|
+
errorCount
|
|
260969
260977
|
};
|
|
260970
260978
|
}
|
|
260971
260979
|
function formatStatsAscii(stats) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.301",
|
|
4
4
|
"description": "Smart LLM router — save 84% on inference costs. 90 models (7 free). Pay by credit card (API key) or USDC (x402 wallet).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|