ai 5.0.236 → 5.0.237

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.mjs CHANGED
@@ -727,7 +727,7 @@ import {
727
727
  } from "@ai-sdk/provider-utils";
728
728
 
729
729
  // src/version.ts
730
- var VERSION = true ? "5.0.236" : "0.0.0-test";
730
+ var VERSION = true ? "5.0.237" : "0.0.0-test";
731
731
 
732
732
  // src/util/download/download.ts
733
733
  var download = async ({
@@ -10229,6 +10229,27 @@ function createUIMessageStream({
10229
10229
  }
10230
10230
 
10231
10231
  // src/ui-message-stream/read-ui-message-stream.ts
10232
+ function createUIMessageSnapshot(message) {
10233
+ const textByPartIndex = /* @__PURE__ */ new Map();
10234
+ const messageWithoutText = {
10235
+ ...message,
10236
+ parts: message.parts.map((part, index) => {
10237
+ if (part.type === "text" || part.type === "reasoning") {
10238
+ textByPartIndex.set(index, part.text);
10239
+ return { ...part, text: "" };
10240
+ }
10241
+ return part;
10242
+ })
10243
+ };
10244
+ const snapshot = structuredClone(messageWithoutText);
10245
+ for (const [index, text2] of textByPartIndex) {
10246
+ const part = snapshot.parts[index];
10247
+ if (part.type === "text" || part.type === "reasoning") {
10248
+ part.text = text2;
10249
+ }
10250
+ }
10251
+ return snapshot;
10252
+ }
10232
10253
  function readUIMessageStream({
10233
10254
  message,
10234
10255
  stream,
@@ -10261,7 +10282,7 @@ function readUIMessageStream({
10261
10282
  return job({
10262
10283
  state,
10263
10284
  write: () => {
10264
- controller == null ? void 0 : controller.enqueue(structuredClone(state.message));
10285
+ controller == null ? void 0 : controller.enqueue(createUIMessageSnapshot(state.message));
10265
10286
  }
10266
10287
  });
10267
10288
  },