@blockrun/clawrouter 0.12.8 → 0.12.10
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 +32 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2041,8 +2041,7 @@ var BLOCKRUN_MODELS = [
|
|
|
2041
2041
|
outputPrice: 3,
|
|
2042
2042
|
contextWindow: 1e6,
|
|
2043
2043
|
maxOutput: 65536,
|
|
2044
|
-
vision: true
|
|
2045
|
-
toolCalling: true
|
|
2044
|
+
vision: true
|
|
2046
2045
|
},
|
|
2047
2046
|
{
|
|
2048
2047
|
id: "google/gemini-2.5-pro",
|
|
@@ -2318,7 +2317,7 @@ async function logUsage(entry) {
|
|
|
2318
2317
|
}
|
|
2319
2318
|
|
|
2320
2319
|
// src/stats.ts
|
|
2321
|
-
import { readdir } from "fs/promises";
|
|
2320
|
+
import { readdir, unlink } from "fs/promises";
|
|
2322
2321
|
|
|
2323
2322
|
// src/fs-read.ts
|
|
2324
2323
|
import { open } from "fs/promises";
|
|
@@ -2487,6 +2486,16 @@ async function getStats(days = 7) {
|
|
|
2487
2486
|
// How many entries have valid baseline tracking
|
|
2488
2487
|
};
|
|
2489
2488
|
}
|
|
2489
|
+
async function clearStats() {
|
|
2490
|
+
try {
|
|
2491
|
+
const files = await readdir(LOG_DIR2);
|
|
2492
|
+
const logFiles = files.filter((f) => f.startsWith("usage-") && f.endsWith(".jsonl"));
|
|
2493
|
+
await Promise.all(logFiles.map((f) => unlink(join3(LOG_DIR2, f))));
|
|
2494
|
+
return { deletedFiles: logFiles.length };
|
|
2495
|
+
} catch {
|
|
2496
|
+
return { deletedFiles: 0 };
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2490
2499
|
|
|
2491
2500
|
// src/dedup.ts
|
|
2492
2501
|
import { createHash } from "crypto";
|
|
@@ -5648,6 +5657,21 @@ async function startProxy(options) {
|
|
|
5648
5657
|
res.end(JSON.stringify(stats, null, 2));
|
|
5649
5658
|
return;
|
|
5650
5659
|
}
|
|
5660
|
+
if (req.url === "/stats" && req.method === "DELETE") {
|
|
5661
|
+
try {
|
|
5662
|
+
const result = await clearStats();
|
|
5663
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
5664
|
+
res.end(JSON.stringify({ cleared: true, deletedFiles: result.deletedFiles }));
|
|
5665
|
+
} catch (err) {
|
|
5666
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
5667
|
+
res.end(
|
|
5668
|
+
JSON.stringify({
|
|
5669
|
+
error: `Failed to clear stats: ${err instanceof Error ? err.message : String(err)}`
|
|
5670
|
+
})
|
|
5671
|
+
);
|
|
5672
|
+
}
|
|
5673
|
+
return;
|
|
5674
|
+
}
|
|
5651
5675
|
if (req.url === "/stats" || req.url?.startsWith("/stats?")) {
|
|
5652
5676
|
try {
|
|
5653
5677
|
const url = new URL(req.url, "http://localhost");
|
|
@@ -6645,7 +6669,11 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
6645
6669
|
`[ClawRouter] Tool-calling filter: excluded ${toolExcluded.join(", ")} (no structured function call support)`
|
|
6646
6670
|
);
|
|
6647
6671
|
}
|
|
6648
|
-
const TOOL_NONCOMPLIANT_MODELS = [
|
|
6672
|
+
const TOOL_NONCOMPLIANT_MODELS = [
|
|
6673
|
+
"google/gemini-2.5-flash-lite",
|
|
6674
|
+
"google/gemini-3-pro-preview",
|
|
6675
|
+
"google/gemini-3.1-pro"
|
|
6676
|
+
];
|
|
6649
6677
|
if (hasTools && toolFiltered.length > 1) {
|
|
6650
6678
|
const compliant = toolFiltered.filter((m) => !TOOL_NONCOMPLIANT_MODELS.includes(m));
|
|
6651
6679
|
if (compliant.length > 0 && compliant.length < toolFiltered.length) {
|