@elvatis_com/openclaw-cli-bridge-elvatis 1.8.3 → 1.8.4
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/package.json +1 -1
- package/src/proxy-server.ts +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvatis_com/openclaw-cli-bridge-elvatis",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Bridges gemini, claude, and codex CLI tools as OpenClaw model providers. Reads existing CLI auth without re-login.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
package/src/proxy-server.ts
CHANGED
|
@@ -575,10 +575,18 @@ async function handleRequest(
|
|
|
575
575
|
}
|
|
576
576
|
return String(content ?? "");
|
|
577
577
|
};
|
|
578
|
-
|
|
578
|
+
// BitNet has a 4096 token context window. Long sessions blow it up and
|
|
579
|
+
// cause a hard C++ crash (no graceful error). Truncate to system prompt +
|
|
580
|
+
// last 10 messages (~2k tokens max) to stay safely within the limit.
|
|
581
|
+
const BITNET_MAX_MESSAGES = 10;
|
|
582
|
+
const allFlat = parsed.messages.map((m) => ({
|
|
579
583
|
role: m.role,
|
|
580
584
|
content: flattenContent(m.content),
|
|
581
585
|
}));
|
|
586
|
+
const systemMsgs = allFlat.filter((m) => m.role === "system");
|
|
587
|
+
const nonSystemMsgs = allFlat.filter((m) => m.role !== "system");
|
|
588
|
+
const truncated = nonSystemMsgs.slice(-BITNET_MAX_MESSAGES);
|
|
589
|
+
const bitnetMessages = [...systemMsgs, ...truncated];
|
|
582
590
|
const requestBody = JSON.stringify({ ...parsed, messages: bitnetMessages, tools: undefined });
|
|
583
591
|
|
|
584
592
|
try {
|