apiblaze 0.19.24 → 0.19.26
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/index.js +25 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -932,7 +932,7 @@ var import_commander = require("commander");
|
|
|
932
932
|
var import_chalk44 = __toESM(require("chalk"));
|
|
933
933
|
|
|
934
934
|
// package.json
|
|
935
|
-
var version = "0.19.
|
|
935
|
+
var version = "0.19.26";
|
|
936
936
|
|
|
937
937
|
// src/index.ts
|
|
938
938
|
init_types();
|
|
@@ -6343,6 +6343,29 @@ function renderToolEvents(events, cred) {
|
|
|
6343
6343
|
}
|
|
6344
6344
|
}
|
|
6345
6345
|
}
|
|
6346
|
+
function renderToolResults(delta, events) {
|
|
6347
|
+
const anyFailed = (events ?? []).some((e) => e.status === "error");
|
|
6348
|
+
if (!anyFailed && !isVerbose()) return;
|
|
6349
|
+
const cap = anyFailed ? 24 : 12;
|
|
6350
|
+
for (const m of delta ?? []) {
|
|
6351
|
+
if (!m || m.role !== "tool" || typeof m.content !== "string") continue;
|
|
6352
|
+
const body = m.content.trim();
|
|
6353
|
+
if (!body) continue;
|
|
6354
|
+
const pretty = (() => {
|
|
6355
|
+
try {
|
|
6356
|
+
return JSON.stringify(JSON.parse(body), null, 2);
|
|
6357
|
+
} catch {
|
|
6358
|
+
return body;
|
|
6359
|
+
}
|
|
6360
|
+
})();
|
|
6361
|
+
const lines = pretty.split("\n");
|
|
6362
|
+
console.log(import_chalk39.default.dim(" response:"));
|
|
6363
|
+
for (const line of lines.slice(0, cap)) {
|
|
6364
|
+
console.log(import_chalk39.default.dim(` ${line}`));
|
|
6365
|
+
}
|
|
6366
|
+
if (lines.length > cap) console.log(import_chalk39.default.dim(` \u2026${lines.length - cap} more lines`));
|
|
6367
|
+
}
|
|
6368
|
+
}
|
|
6346
6369
|
function billingLine(billing) {
|
|
6347
6370
|
if (!billing || typeof billing.cents !== "number") return null;
|
|
6348
6371
|
if (typeof billing.free_turns_remaining === "number") return null;
|
|
@@ -6438,6 +6461,7 @@ async function replTurn(p, messages, userText) {
|
|
|
6438
6461
|
return t ? { header: "Authorization", value: `Bearer ${t}` } : void 0;
|
|
6439
6462
|
})() : p.dpKey ? { header: "X-API-Key", value: p.dpKey } : void 0
|
|
6440
6463
|
);
|
|
6464
|
+
renderToolResults(data.delta, data.tool_events);
|
|
6441
6465
|
for (const m of data.delta) messages.push(m);
|
|
6442
6466
|
printAssistant(data.delta);
|
|
6443
6467
|
}
|