@friendlyrobot/discord-pi-agent 0.19.9 → 0.19.11
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 +7 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -375,23 +375,19 @@ function truncateForLog(value, maxLength = 400) {
|
|
|
375
375
|
return `${value.slice(0, maxLength)}...`;
|
|
376
376
|
}
|
|
377
377
|
function extractToolOutput(output) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (item?.type === "text") {
|
|
378
|
+
if (typeof output === "object" && output !== null) {
|
|
379
|
+
const obj = output;
|
|
380
|
+
if (Array.isArray(obj.content)) {
|
|
381
|
+
return obj.content.map((item) => {
|
|
382
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
384
383
|
return item.text;
|
|
385
|
-
} else {
|
|
386
|
-
return JSON.stringify(item);
|
|
387
384
|
}
|
|
385
|
+
return JSON.stringify(item);
|
|
388
386
|
}).join(`
|
|
389
387
|
`);
|
|
390
388
|
}
|
|
391
|
-
return String(output);
|
|
392
|
-
} catch {
|
|
393
|
-
return String(output);
|
|
394
389
|
}
|
|
390
|
+
return String(output);
|
|
395
391
|
}
|
|
396
392
|
function getLatestAssistantText(messages) {
|
|
397
393
|
const latestAssistantMessage = [...messages].reverse().find((message) => {
|