ai 4.2.6 → 4.2.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # ai
2
2
 
3
+ ## 4.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 65243ce: fix (ui): introduce step start parts
8
+ - Updated dependencies [65243ce]
9
+ - @ai-sdk/ui-utils@1.2.2
10
+ - @ai-sdk/react@1.2.3
11
+
12
+ ## 4.2.7
13
+
14
+ ### Patch Changes
15
+
16
+ - e14c066: fix (ai/core): convert user ui messages with only parts (no content) to core messages
17
+
3
18
  ## 4.2.6
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1744,13 +1744,24 @@ function convertToCoreMessages(messages, options) {
1744
1744
  break;
1745
1745
  }
1746
1746
  case "user": {
1747
- coreMessages.push({
1748
- role: "user",
1749
- content: experimental_attachments ? [
1750
- { type: "text", text: content },
1751
- ...attachmentsToParts(experimental_attachments)
1752
- ] : content
1753
- });
1747
+ if (message.parts == null) {
1748
+ coreMessages.push({
1749
+ role: "user",
1750
+ content: experimental_attachments ? [
1751
+ { type: "text", text: content },
1752
+ ...attachmentsToParts(experimental_attachments)
1753
+ ] : content
1754
+ });
1755
+ } else {
1756
+ const textParts = message.parts.filter((part) => part.type === "text").map((part) => ({
1757
+ type: "text",
1758
+ text: part.text
1759
+ }));
1760
+ coreMessages.push({
1761
+ role: "user",
1762
+ content: experimental_attachments ? [...textParts, ...attachmentsToParts(experimental_attachments)] : textParts
1763
+ });
1764
+ }
1754
1765
  break;
1755
1766
  }
1756
1767
  case "assistant": {
@@ -6564,7 +6575,7 @@ function appendResponseMessages({
6564
6575
  }));
6565
6576
  };
6566
6577
  var getToolInvocations = getToolInvocations2;
6567
- const parts = [];
6578
+ const parts = [{ type: "step-start" }];
6568
6579
  let textContent = "";
6569
6580
  let reasoningTextContent = void 0;
6570
6581
  if (typeof message.content === "string") {