@elizaos/plugin-elizacloud 2.0.3-beta.3 → 2.0.3-beta.5

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.
@@ -4833,6 +4833,17 @@ async function* parseOpenAiSseStream(body) {
4833
4833
  } catch {}
4834
4834
  }
4835
4835
  }
4836
+ function isCompleteJsonObject(value) {
4837
+ const trimmed = value.trim();
4838
+ if (!trimmed.startsWith("{"))
4839
+ return false;
4840
+ try {
4841
+ const parsed = JSON.parse(trimmed);
4842
+ return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
4843
+ } catch {
4844
+ return false;
4845
+ }
4846
+ }
4836
4847
  function accumulateToolCallDeltas(acc, deltas) {
4837
4848
  if (!Array.isArray(deltas))
4838
4849
  return;
@@ -4847,8 +4858,13 @@ function accumulateToolCallDeltas(acc, deltas) {
4847
4858
  const name = firstString(fn.name);
4848
4859
  if (name)
4849
4860
  cur.name = name;
4850
- if (typeof fn.arguments === "string")
4851
- cur.args += fn.arguments;
4861
+ if (typeof fn.arguments === "string") {
4862
+ if (isCompleteJsonObject(cur.args) && isCompleteJsonObject(fn.arguments)) {
4863
+ cur.args = fn.arguments;
4864
+ } else {
4865
+ cur.args += fn.arguments;
4866
+ }
4867
+ }
4852
4868
  acc.set(index, cur);
4853
4869
  }
4854
4870
  }
@@ -9624,4 +9640,4 @@ init_cloud_wallet();
9624
9640
  init_cloud_secrets();
9625
9641
  var index_node_default = src_default;
9626
9642
 
9627
- //# debugId=E8635C379B80BE6064756E2164756E21
9643
+ //# debugId=D034ECA0AAC234DD64756E2164756E21