@bunny-agent/runner-cli 0.9.50-beta.5 → 0.9.50-beta.6
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/bundle.mjs +68 -0
- package/package.json +4 -4
package/dist/bundle.mjs
CHANGED
|
@@ -5349,12 +5349,79 @@ function serializeResult(result) {
|
|
|
5349
5349
|
|
|
5350
5350
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
5351
5351
|
var LOG_PREFIX2 = "[bunny-agent:pi]";
|
|
5352
|
+
var LLM_THOUGHT_SIGNATURE_SEPARATOR = "__thought__";
|
|
5352
5353
|
function applyAllowedTools(tools, allowedTools) {
|
|
5353
5354
|
if (!allowedTools)
|
|
5354
5355
|
return tools;
|
|
5355
5356
|
const allowed = new Set(allowedTools);
|
|
5356
5357
|
return tools.filter((tool) => allowed.has(tool.name));
|
|
5357
5358
|
}
|
|
5359
|
+
function shouldStripLLMThoughtSignaturesForModel(model) {
|
|
5360
|
+
const id = (model.id ?? "").toLowerCase();
|
|
5361
|
+
return !id.includes("gemini");
|
|
5362
|
+
}
|
|
5363
|
+
function stripLLMThoughtSignatureFromId(id) {
|
|
5364
|
+
const separatorIndex = id.indexOf(LLM_THOUGHT_SIGNATURE_SEPARATOR);
|
|
5365
|
+
if (separatorIndex === -1)
|
|
5366
|
+
return id;
|
|
5367
|
+
return id.slice(0, separatorIndex);
|
|
5368
|
+
}
|
|
5369
|
+
function stripLLMThoughtSignaturesFromSessionManager(sessionManager, model) {
|
|
5370
|
+
if (!shouldStripLLMThoughtSignaturesForModel(model))
|
|
5371
|
+
return;
|
|
5372
|
+
const manager = sessionManager;
|
|
5373
|
+
const entries = manager.getEntries?.();
|
|
5374
|
+
if (Array.isArray(entries)) {
|
|
5375
|
+
for (const entry of entries) {
|
|
5376
|
+
if (entry == null || typeof entry !== "object")
|
|
5377
|
+
continue;
|
|
5378
|
+
const message = entry.message;
|
|
5379
|
+
if (entry.type === "message") {
|
|
5380
|
+
stripLLMThoughtSignaturesFromMessage(message);
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
return;
|
|
5384
|
+
}
|
|
5385
|
+
const context = sessionManager.buildSessionContext?.();
|
|
5386
|
+
const messages = context?.messages;
|
|
5387
|
+
if (!Array.isArray(messages))
|
|
5388
|
+
return;
|
|
5389
|
+
for (const message of messages) {
|
|
5390
|
+
stripLLMThoughtSignaturesFromMessage(message);
|
|
5391
|
+
}
|
|
5392
|
+
}
|
|
5393
|
+
function stripLLMThoughtSignaturesFromMessage(message) {
|
|
5394
|
+
if (message == null || typeof message !== "object")
|
|
5395
|
+
return;
|
|
5396
|
+
const msg = message;
|
|
5397
|
+
if (typeof msg.toolCallId === "string") {
|
|
5398
|
+
msg.toolCallId = stripLLMThoughtSignatureFromId(msg.toolCallId);
|
|
5399
|
+
}
|
|
5400
|
+
if (typeof msg.tool_call_id === "string") {
|
|
5401
|
+
msg.tool_call_id = stripLLMThoughtSignatureFromId(msg.tool_call_id);
|
|
5402
|
+
}
|
|
5403
|
+
if (!Array.isArray(msg.content))
|
|
5404
|
+
return;
|
|
5405
|
+
for (const block of msg.content) {
|
|
5406
|
+
if (block == null || typeof block !== "object")
|
|
5407
|
+
continue;
|
|
5408
|
+
const contentBlock = block;
|
|
5409
|
+
if (contentBlock.type !== "toolCall")
|
|
5410
|
+
continue;
|
|
5411
|
+
if (typeof contentBlock.id === "string") {
|
|
5412
|
+
contentBlock.id = stripLLMThoughtSignatureFromId(contentBlock.id);
|
|
5413
|
+
}
|
|
5414
|
+
if (typeof contentBlock.toolCallId === "string") {
|
|
5415
|
+
contentBlock.toolCallId = stripLLMThoughtSignatureFromId(contentBlock.toolCallId);
|
|
5416
|
+
}
|
|
5417
|
+
if (typeof contentBlock.tool_call_id === "string") {
|
|
5418
|
+
contentBlock.tool_call_id = stripLLMThoughtSignatureFromId(contentBlock.tool_call_id);
|
|
5419
|
+
}
|
|
5420
|
+
if (typeof contentBlock.call_id === "string") {
|
|
5421
|
+
contentBlock.call_id = stripLLMThoughtSignatureFromId(contentBlock.call_id);
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5358
5425
|
function parseModelSpec(model) {
|
|
5359
5426
|
const trimmed = model.trim();
|
|
5360
5427
|
const separator = trimmed.indexOf(":");
|
|
@@ -5504,6 +5571,7 @@ function createPiRunner(options = {}) {
|
|
|
5504
5571
|
}
|
|
5505
5572
|
return SessionManager2.create(cwd);
|
|
5506
5573
|
})();
|
|
5574
|
+
stripLLMThoughtSignaturesFromSessionManager(sessionManager, model);
|
|
5507
5575
|
const resourceLoader = options.skillPaths ? new BunnyAgentResourceLoader({
|
|
5508
5576
|
cwd,
|
|
5509
5577
|
skillPaths: options.skillPaths,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunny-agent/runner-cli",
|
|
3
|
-
"version": "0.9.50-beta.
|
|
3
|
+
"version": "0.9.50-beta.6",
|
|
4
4
|
"description": "BunnyAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"esbuild": "^0.27.2",
|
|
54
54
|
"typescript": "^5.3.0",
|
|
55
55
|
"vitest": "^1.6.1",
|
|
56
|
-
"@bunny-agent/runner-harness": "0.1.1-beta.0",
|
|
57
56
|
"@bunny-agent/runner-claude": "0.6.2",
|
|
58
57
|
"@bunny-agent/runner-codex": "0.6.2",
|
|
59
|
-
"@bunny-agent/runner-gemini": "0.6.2",
|
|
60
58
|
"@bunny-agent/runner-opencode": "0.6.2",
|
|
61
|
-
"@bunny-agent/runner-pi": "0.6.4-beta.0"
|
|
59
|
+
"@bunny-agent/runner-pi": "0.6.4-beta.0",
|
|
60
|
+
"@bunny-agent/runner-gemini": "0.6.2",
|
|
61
|
+
"@bunny-agent/runner-harness": "0.1.1-beta.0"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsc && pnpm bundle",
|