botinabox 2.4.0 → 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.
- package/dist/index.js +23 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2173,9 +2173,11 @@ ${ctx2}`;
|
|
|
2173
2173
|
void this.extractAsync(messageId);
|
|
2174
2174
|
} catch (err) {
|
|
2175
2175
|
await this.hooks.emit("typing.stop", { channel: this.channel, threadId: threadTs });
|
|
2176
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
2177
|
+
console.error("[ChatPipelineV2] Pipeline error:", errMsg);
|
|
2176
2178
|
await this.hooks.emit("pipeline.error", {
|
|
2177
2179
|
messageId,
|
|
2178
|
-
error:
|
|
2180
|
+
error: errMsg
|
|
2179
2181
|
});
|
|
2180
2182
|
}
|
|
2181
2183
|
});
|
|
@@ -2269,8 +2271,8 @@ ${ctx2}`;
|
|
|
2269
2271
|
}
|
|
2270
2272
|
toolResults.push({
|
|
2271
2273
|
type: "tool_result",
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
+
tool_use_id: toolUse.id,
|
|
2275
|
+
content: result
|
|
2274
2276
|
});
|
|
2275
2277
|
} catch (err) {
|
|
2276
2278
|
toolResults.push({
|
|
@@ -2315,7 +2317,24 @@ ${ctx2}`;
|
|
|
2315
2317
|
const maxChars = 16e3;
|
|
2316
2318
|
let charCount = 0;
|
|
2317
2319
|
for (const row of rows) {
|
|
2318
|
-
const
|
|
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;
|
|
2319
2338
|
const direction = row.direction;
|
|
2320
2339
|
if (!includeAssistant && direction !== "inbound") continue;
|
|
2321
2340
|
if (charCount + body.length > maxChars) break;
|