botinabox 2.4.1 → 2.4.2

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2271,8 +2271,8 @@ ${ctx2}`;
2271
2271
  }
2272
2272
  toolResults.push({
2273
2273
  type: "tool_result",
2274
- id: toolUse.id,
2275
- text: result
2274
+ tool_use_id: toolUse.id,
2275
+ content: result
2276
2276
  });
2277
2277
  } catch (err) {
2278
2278
  toolResults.push({
@@ -2317,7 +2317,24 @@ ${ctx2}`;
2317
2317
  const maxChars = 16e3;
2318
2318
  let charCount = 0;
2319
2319
  for (const row of rows) {
2320
- const body = row.body ?? "";
2320
+ const rawBody = row.body;
2321
+ if (!rawBody) continue;
2322
+ let body;
2323
+ if (rawBody.startsWith("[") || rawBody.startsWith("{")) {
2324
+ try {
2325
+ const parsed = JSON.parse(rawBody);
2326
+ if (Array.isArray(parsed)) {
2327
+ body = parsed.filter((b) => b.type === "text").map((b) => b.text ?? "").join("");
2328
+ } else {
2329
+ body = rawBody;
2330
+ }
2331
+ } catch {
2332
+ body = rawBody;
2333
+ }
2334
+ } else {
2335
+ body = rawBody;
2336
+ }
2337
+ if (!body) continue;
2321
2338
  const direction = row.direction;
2322
2339
  if (!includeAssistant && direction !== "inbound") continue;
2323
2340
  if (charCount + body.length > maxChars) break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",