open-agents-ai 0.186.67 → 0.186.68
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 +35 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -261557,6 +261557,40 @@ var init_nexusBackend = __esm({
|
|
|
261557
261557
|
this.lastSystemMetrics = responseData.system;
|
|
261558
261558
|
this.lastSystemMetricsTs = Date.now();
|
|
261559
261559
|
}
|
|
261560
|
+
const fallbackChoices = responseData?.choices;
|
|
261561
|
+
if (fallbackChoices && Array.isArray(fallbackChoices)) {
|
|
261562
|
+
const fbMsg = fallbackChoices[0]?.message || {};
|
|
261563
|
+
const fbToolCalls = fbMsg.tool_calls || [];
|
|
261564
|
+
const fbContent = typeof fbMsg.content === "string" ? fbMsg.content : null;
|
|
261565
|
+
if (fbContent) {
|
|
261566
|
+
const words = fbContent.split(/(\s+)/);
|
|
261567
|
+
for (const word2 of words) {
|
|
261568
|
+
if (word2)
|
|
261569
|
+
yield { type: "content", content: word2 };
|
|
261570
|
+
}
|
|
261571
|
+
}
|
|
261572
|
+
if (fbToolCalls.length > 0) {
|
|
261573
|
+
for (const tc of fbToolCalls) {
|
|
261574
|
+
const fn = tc.function || {};
|
|
261575
|
+
let args;
|
|
261576
|
+
try {
|
|
261577
|
+
args = typeof fn.arguments === "string" ? JSON.parse(fn.arguments) : fn.arguments ?? {};
|
|
261578
|
+
} catch {
|
|
261579
|
+
args = { _raw: fn.arguments };
|
|
261580
|
+
}
|
|
261581
|
+
yield {
|
|
261582
|
+
type: "tool_call_delta",
|
|
261583
|
+
toolCallId: tc.id || `call_${randomBytes14(8).toString("hex")}`,
|
|
261584
|
+
toolCallName: fn.name,
|
|
261585
|
+
toolCallArgs: JSON.stringify(args)
|
|
261586
|
+
};
|
|
261587
|
+
}
|
|
261588
|
+
yield { type: "finish", finishReason: "tool_calls" };
|
|
261589
|
+
} else {
|
|
261590
|
+
yield { type: "finish", finishReason: "stop" };
|
|
261591
|
+
}
|
|
261592
|
+
return;
|
|
261593
|
+
}
|
|
261560
261594
|
const content = responseData ? responseData.response || "" : "";
|
|
261561
261595
|
if (content) {
|
|
261562
261596
|
const words = content.split(/(\s+)/);
|
|
@@ -261642,7 +261676,7 @@ var init_nexusBackend = __esm({
|
|
|
261642
261676
|
yield {
|
|
261643
261677
|
type: "tool_call_delta",
|
|
261644
261678
|
toolCallIndex: i2,
|
|
261645
|
-
toolCallId: tc.id ||
|
|
261679
|
+
toolCallId: tc.id || `call_${randomBytes14(8).toString("hex")}`,
|
|
261646
261680
|
toolCallName: fn.name,
|
|
261647
261681
|
toolCallArgs: JSON.stringify(args)
|
|
261648
261682
|
};
|
package/package.json
CHANGED