@friendlyrobot/discord-pi-agent 0.19.8 → 0.19.9
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 +13 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -375,11 +375,20 @@ function truncateForLog(value, maxLength = 400) {
|
|
|
375
375
|
return `${value.slice(0, maxLength)}...`;
|
|
376
376
|
}
|
|
377
377
|
function extractToolOutput(output) {
|
|
378
|
-
|
|
379
|
-
return output;
|
|
380
|
-
}
|
|
378
|
+
let processed = output;
|
|
381
379
|
try {
|
|
382
|
-
|
|
380
|
+
processed = JSON.parse(output);
|
|
381
|
+
if (Array.isArray(processed)) {
|
|
382
|
+
return processed.map((item) => {
|
|
383
|
+
if (item?.type === "text") {
|
|
384
|
+
return item.text;
|
|
385
|
+
} else {
|
|
386
|
+
return JSON.stringify(item);
|
|
387
|
+
}
|
|
388
|
+
}).join(`
|
|
389
|
+
`);
|
|
390
|
+
}
|
|
391
|
+
return String(output);
|
|
383
392
|
} catch {
|
|
384
393
|
return String(output);
|
|
385
394
|
}
|