apiblaze 0.19.24 → 0.19.25
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 +22 -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.25";
|
|
936
936
|
|
|
937
937
|
// src/index.ts
|
|
938
938
|
init_types();
|
|
@@ -6343,6 +6343,26 @@ function renderToolEvents(events, cred) {
|
|
|
6343
6343
|
}
|
|
6344
6344
|
}
|
|
6345
6345
|
}
|
|
6346
|
+
function renderFailedToolResults(delta, events) {
|
|
6347
|
+
const failed = new Set((events ?? []).filter((e) => e.status === "error").map((e) => e.name));
|
|
6348
|
+
if (failed.size === 0) return;
|
|
6349
|
+
for (const m of delta ?? []) {
|
|
6350
|
+
if (!m || m.role !== "tool" || typeof m.content !== "string") continue;
|
|
6351
|
+
const body = m.content.trim();
|
|
6352
|
+
if (!body) continue;
|
|
6353
|
+
const pretty = (() => {
|
|
6354
|
+
try {
|
|
6355
|
+
return JSON.stringify(JSON.parse(body), null, 2);
|
|
6356
|
+
} catch {
|
|
6357
|
+
return body;
|
|
6358
|
+
}
|
|
6359
|
+
})();
|
|
6360
|
+
console.log(import_chalk39.default.dim(" response:"));
|
|
6361
|
+
for (const line of pretty.split("\n").slice(0, 24)) {
|
|
6362
|
+
console.log(import_chalk39.default.dim(` ${line}`));
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6346
6366
|
function billingLine(billing) {
|
|
6347
6367
|
if (!billing || typeof billing.cents !== "number") return null;
|
|
6348
6368
|
if (typeof billing.free_turns_remaining === "number") return null;
|
|
@@ -6438,6 +6458,7 @@ async function replTurn(p, messages, userText) {
|
|
|
6438
6458
|
return t ? { header: "Authorization", value: `Bearer ${t}` } : void 0;
|
|
6439
6459
|
})() : p.dpKey ? { header: "X-API-Key", value: p.dpKey } : void 0
|
|
6440
6460
|
);
|
|
6461
|
+
renderFailedToolResults(data.delta, data.tool_events);
|
|
6441
6462
|
for (const m of data.delta) messages.push(m);
|
|
6442
6463
|
printAssistant(data.delta);
|
|
6443
6464
|
}
|