@blockrun/clawrouter 0.9.13 → 0.9.15
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 +8 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/models.ts
|
|
2
2
|
var MODEL_ALIASES = {
|
|
3
|
-
// Claude
|
|
3
|
+
// Claude - short names
|
|
4
4
|
claude: "anthropic/claude-sonnet-4",
|
|
5
5
|
sonnet: "anthropic/claude-sonnet-4",
|
|
6
6
|
opus: "anthropic/claude-opus-4.6",
|
|
@@ -8,6 +8,11 @@ var MODEL_ALIASES = {
|
|
|
8
8
|
"opus-46": "anthropic/claude-opus-4.6",
|
|
9
9
|
"opus-45": "anthropic/claude-opus-4.5",
|
|
10
10
|
haiku: "anthropic/claude-haiku-4.5",
|
|
11
|
+
// Claude - provider/shortname patterns (common in agent frameworks)
|
|
12
|
+
"anthropic/sonnet": "anthropic/claude-sonnet-4",
|
|
13
|
+
"anthropic/opus": "anthropic/claude-opus-4.6",
|
|
14
|
+
"anthropic/haiku": "anthropic/claude-haiku-4.5",
|
|
15
|
+
"anthropic/claude": "anthropic/claude-sonnet-4",
|
|
11
16
|
// OpenAI
|
|
12
17
|
gpt: "openai/gpt-4o",
|
|
13
18
|
gpt4: "openai/gpt-4o",
|
|
@@ -4371,6 +4376,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
4371
4376
|
isStreaming = parsed.stream === true;
|
|
4372
4377
|
modelId = parsed.model || "";
|
|
4373
4378
|
maxTokens = parsed.max_tokens || 4096;
|
|
4379
|
+
let bodyModified = false;
|
|
4374
4380
|
if (sessionId && Array.isArray(parsed.messages)) {
|
|
4375
4381
|
const messages = parsed.messages;
|
|
4376
4382
|
const lastUserMsg = [...messages].reverse().find((m) => m.role === "user");
|
|
@@ -4388,13 +4394,13 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
4388
4394
|
messages.unshift({ role: "system", content: journalText });
|
|
4389
4395
|
}
|
|
4390
4396
|
parsed.messages = messages;
|
|
4397
|
+
bodyModified = true;
|
|
4391
4398
|
console.log(
|
|
4392
4399
|
`[ClawRouter] Injected session journal (${journalText.length} chars) for session ${sessionId.slice(0, 8)}...`
|
|
4393
4400
|
);
|
|
4394
4401
|
}
|
|
4395
4402
|
}
|
|
4396
4403
|
}
|
|
4397
|
-
let bodyModified = false;
|
|
4398
4404
|
if (parsed.stream === true) {
|
|
4399
4405
|
parsed.stream = false;
|
|
4400
4406
|
bodyModified = true;
|
|
@@ -5253,7 +5259,7 @@ function injectModelsConfig(logger) {
|
|
|
5253
5259
|
{ id: "opus", alias: "br-opus" },
|
|
5254
5260
|
{ id: "haiku", alias: "br-haiku" },
|
|
5255
5261
|
{ id: "gpt5", alias: "gpt5" },
|
|
5256
|
-
{ id: "
|
|
5262
|
+
{ id: "codex", alias: "codex" },
|
|
5257
5263
|
{ id: "grok-fast", alias: "grok-fast" },
|
|
5258
5264
|
{ id: "grok-code", alias: "grok-code" },
|
|
5259
5265
|
{ id: "deepseek", alias: "deepseek" },
|