@elizaos/plugin-elizacloud 2.0.3-beta.4 → 2.0.3-beta.6

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 CHANGED
@@ -6949,6 +6949,17 @@ async function* parseOpenAiSseStream(body) {
6949
6949
  } catch {}
6950
6950
  }
6951
6951
  }
6952
+ function isCompleteJsonObject(value) {
6953
+ const trimmed = value.trim();
6954
+ if (!trimmed.startsWith("{"))
6955
+ return false;
6956
+ try {
6957
+ const parsed = JSON.parse(trimmed);
6958
+ return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
6959
+ } catch {
6960
+ return false;
6961
+ }
6962
+ }
6952
6963
  function accumulateToolCallDeltas(acc, deltas) {
6953
6964
  if (!Array.isArray(deltas))
6954
6965
  return;
@@ -6963,8 +6974,13 @@ function accumulateToolCallDeltas(acc, deltas) {
6963
6974
  const name = firstString(fn.name);
6964
6975
  if (name)
6965
6976
  cur.name = name;
6966
- if (typeof fn.arguments === "string")
6967
- cur.args += fn.arguments;
6977
+ if (typeof fn.arguments === "string") {
6978
+ if (isCompleteJsonObject(cur.args) && isCompleteJsonObject(fn.arguments)) {
6979
+ cur.args = fn.arguments;
6980
+ } else {
6981
+ cur.args += fn.arguments;
6982
+ }
6983
+ }
6968
6984
  acc.set(index, cur);
6969
6985
  }
6970
6986
  }
@@ -9894,4 +9910,4 @@ export {
9894
9910
  BackupScheduler
9895
9911
  };
9896
9912
 
9897
- //# debugId=2FE7D4ED3F49EFD864756E2164756E21
9913
+ //# debugId=CF77C81E67FDCD4764756E2164756E21