@mastra/react 0.0.0-netlify-no-bundle-20251127120354 → 0.0.0-partial-response-backport-20251204204441

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,23 +1,26 @@
1
1
  # @mastra/react-hooks
2
2
 
3
- ## 0.0.0-netlify-no-bundle-20251127120354
3
+ ## 0.0.0-partial-response-backport-20251204204441
4
4
 
5
- ### Minor Changes
6
-
7
- - Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
5
+ ### Patch Changes
8
6
 
9
- - Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
7
+ - Updated dependencies [[`5de72e1`](https://github.com/mastra-ai/mastra/commit/5de72e1a3fa51b860e7e0a606b66cf6f97fc100c), [`2b62302`](https://github.com/mastra-ai/mastra/commit/2b623027a9d65c1dbc963bf651e9e6a9d09da1fa), [`d233ca0`](https://github.com/mastra-ai/mastra/commit/d233ca0939760cbf1f4d2d594a436939124cf10f)]:
8
+ - @mastra/client-js@0.0.0-partial-response-backport-20251204204441
10
9
 
11
- - Renamed `MastraMessageV2` to `MastraDBMessage` ([#9255](https://github.com/mastra-ai/mastra/pull/9255))
12
- Made the return format of all methods that return db messages consistent. It's always `{ messages: MastraDBMessage[] }` now, and messages can be converted after that using `@mastra/ai-sdk/ui`'s `toAISdkV4/5Messages()` function
10
+ ## 0.0.22-alpha.0
13
11
 
14
12
  ### Patch Changes
15
13
 
16
- - Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
14
+ - Updated dependencies []:
15
+ - @mastra/client-js@0.16.16-alpha.0
17
16
 
18
- - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
17
+ ## 0.0.21
18
+
19
+ ### Patch Changes
20
+
21
+ - Configurable resourceId in react useChat ([#10561](https://github.com/mastra-ai/mastra/pull/10561))
19
22
 
20
- - fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
23
+ - fix(agent): persist messages before tool suspension ([#10542](https://github.com/mastra-ai/mastra/pull/10542))
21
24
 
22
25
  Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
23
26
 
@@ -40,18 +43,16 @@
40
43
 
41
44
  Fixes #9745, #9906
42
45
 
43
- - Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
44
-
45
- - Updated dependencies [[`3852192`](https://github.com/mastra-ai/mastra/commit/3852192c81b2a4f1f883f17d80ce50e0c60dba55), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`b7de533`](https://github.com/mastra-ai/mastra/commit/b7de53361667eb51fefd89fcaed924f3c57cee8d), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`1ee3411`](https://github.com/mastra-ai/mastra/commit/1ee34113192b11aa8bcdd8d9d5830ae13254b345), [`dbd9db0`](https://github.com/mastra-ai/mastra/commit/dbd9db0d5c2797a210b9098e7e3e613718e5442f), [`6a86fe5`](https://github.com/mastra-ai/mastra/commit/6a86fe56b8ff53ca2eb3ed87ffc0748749ebadce), [`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`f93d992`](https://github.com/mastra-ai/mastra/commit/f93d992a37d5431ab4a71246835d403ef7c4ce85), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`595a3b8`](https://github.com/mastra-ai/mastra/commit/595a3b8727c901f44e333909c09843c711224440), [`ea0b8de`](https://github.com/mastra-ai/mastra/commit/ea0b8dec0d4bc86a72a7e75b2f56c6017c58786d), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`519d9e6`](https://github.com/mastra-ai/mastra/commit/519d9e6d31910457c54bdae8b7b7cb3a69f41831), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`dfe3f8c`](https://github.com/mastra-ai/mastra/commit/dfe3f8c7376ffe159236819e19ca522143c1f972), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`e8dcd71`](https://github.com/mastra-ai/mastra/commit/e8dcd71fa5e473c8ba1d6dad99eef182d20a0491), [`63f2f18`](https://github.com/mastra-ai/mastra/commit/63f2f1863dffe3ad23221d0660ed4e4f2b81789d), [`c23200d`](https://github.com/mastra-ai/mastra/commit/c23200ddfd60830effb39329674ba4ca93be6aac), [`363284b`](https://github.com/mastra-ai/mastra/commit/363284bb974e850f06f40f89a28c79d9f432d7e4), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`e1bb9c9`](https://github.com/mastra-ai/mastra/commit/e1bb9c94b4eb68b019ae275981be3feb769b5365)]:
46
- - @mastra/client-js@0.0.0-netlify-no-bundle-20251127120354
46
+ - Updated dependencies []:
47
+ - @mastra/client-js@0.16.15
47
48
 
48
- ## 0.1.0-beta.5
49
+ ## 0.0.21-alpha.0
49
50
 
50
51
  ### Patch Changes
51
52
 
52
- - Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
53
+ - Configurable resourceId in react useChat ([#10561](https://github.com/mastra-ai/mastra/pull/10561))
53
54
 
54
- - fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
55
+ - fix(agent): persist messages before tool suspension ([#10542](https://github.com/mastra-ai/mastra/pull/10542))
55
56
 
56
57
  Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
57
58
 
@@ -74,56 +75,158 @@
74
75
 
75
76
  Fixes #9745, #9906
76
77
 
77
- - Updated dependencies [[`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f)]:
78
- - @mastra/client-js@1.0.0-beta.5
78
+ - Updated dependencies []:
79
+ - @mastra/client-js@0.16.15-alpha.0
80
+
81
+ ## 0.0.20
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies []:
86
+ - @mastra/client-js@0.16.14
87
+
88
+ ## 0.0.20-alpha.0
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies []:
93
+ - @mastra/client-js@0.16.14-alpha.0
94
+
95
+ ## 0.0.19
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies []:
100
+ - @mastra/client-js@0.16.13
101
+
102
+ ## 0.0.19-alpha.0
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies []:
107
+ - @mastra/client-js@0.16.13-alpha.0
108
+
109
+ ## 0.0.18
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [[`91fa2b0`](https://github.com/mastra-ai/mastra/commit/91fa2b0cf077561d835baef8519a1422f1decd55)]:
114
+ - @mastra/client-js@0.16.12
115
+
116
+ ## 0.0.18-alpha.0
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [[`91fa2b0`](https://github.com/mastra-ai/mastra/commit/91fa2b0cf077561d835baef8519a1422f1decd55)]:
121
+ - @mastra/client-js@0.16.12-alpha.0
122
+
123
+ ## 0.0.17
79
124
 
80
- ## 0.1.0-beta.4
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies []:
128
+ - @mastra/client-js@0.16.11
129
+
130
+ ## 0.0.17-alpha.0
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies []:
135
+ - @mastra/client-js@0.16.11-alpha.0
136
+
137
+ ## 0.0.16
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies [[`082393c`](https://github.com/mastra-ai/mastra/commit/082393c002f3751113a48da28e4c0ed3db9824d7)]:
142
+ - @mastra/client-js@0.16.10
143
+
144
+ ## 0.0.16-alpha.0
145
+
146
+ ### Patch Changes
147
+
148
+ - Updated dependencies [[`082393c`](https://github.com/mastra-ai/mastra/commit/082393c002f3751113a48da28e4c0ed3db9824d7)]:
149
+ - @mastra/client-js@0.16.10-alpha.0
150
+
151
+ ## 0.0.15
81
152
 
82
153
  ### Patch Changes
83
154
 
84
- - Updated dependencies [[`6a86fe5`](https://github.com/mastra-ai/mastra/commit/6a86fe56b8ff53ca2eb3ed87ffc0748749ebadce), [`595a3b8`](https://github.com/mastra-ai/mastra/commit/595a3b8727c901f44e333909c09843c711224440)]:
85
- - @mastra/client-js@1.0.0-beta.4
155
+ - update peerdeps ([`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc))
156
+
157
+ - Updated dependencies [[`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`139588d`](https://github.com/mastra-ai/mastra/commit/139588df7755c9111a3060f72a789c1a8c95e091), [`186b29b`](https://github.com/mastra-ai/mastra/commit/186b29bd51ac1dcc24ad3825fdb7207a6d6391a6)]:
158
+ - @mastra/client-js@0.16.9
86
159
 
87
- ## 0.1.0-beta.3
160
+ ## 0.0.15-alpha.0
88
161
 
89
162
  ### Patch Changes
90
163
 
91
- - Updated dependencies [[`e1bb9c9`](https://github.com/mastra-ai/mastra/commit/e1bb9c94b4eb68b019ae275981be3feb769b5365)]:
92
- - @mastra/client-js@1.0.0-beta.3
164
+ - update peerdeps ([`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc))
93
165
 
94
- ## 0.1.0-beta.2
166
+ - Updated dependencies [[`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`139588d`](https://github.com/mastra-ai/mastra/commit/139588df7755c9111a3060f72a789c1a8c95e091), [`186b29b`](https://github.com/mastra-ai/mastra/commit/186b29bd51ac1dcc24ad3825fdb7207a6d6391a6)]:
167
+ - @mastra/client-js@0.16.9-alpha.0
168
+
169
+ ## 0.0.14
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [[`b55bbce`](https://github.com/mastra-ai/mastra/commit/b55bbce89404d35fdd967012dd503fae343d4c2d), [`e742d37`](https://github.com/mastra-ai/mastra/commit/e742d371f24ef8059670cc05e9aee308eac068b9)]:
174
+ - @mastra/client-js@0.16.8
175
+
176
+ ## 0.0.14-alpha.0
177
+
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies [[`b55bbce`](https://github.com/mastra-ai/mastra/commit/b55bbce89404d35fdd967012dd503fae343d4c2d), [`e742d37`](https://github.com/mastra-ai/mastra/commit/e742d371f24ef8059670cc05e9aee308eac068b9)]:
181
+ - @mastra/client-js@0.16.8-alpha.0
182
+
183
+ ## 0.0.13
95
184
 
96
185
  ### Patch Changes
97
186
 
98
187
  - Updated dependencies []:
99
- - @mastra/client-js@1.0.0-beta.2
188
+ - @mastra/client-js@0.16.7
100
189
 
101
- ## 0.1.0-beta.1
190
+ ## 0.0.13-alpha.1
102
191
 
103
192
  ### Patch Changes
104
193
 
105
- - Updated dependencies [[`dbd9db0`](https://github.com/mastra-ai/mastra/commit/dbd9db0d5c2797a210b9098e7e3e613718e5442f)]:
106
- - @mastra/client-js@1.0.0-beta.1
194
+ - Updated dependencies []:
195
+ - @mastra/client-js@0.16.7-alpha.1
107
196
 
108
- ## 0.1.0-beta.0
197
+ ## 0.0.13-alpha.0
109
198
 
110
- ### Minor Changes
199
+ ### Patch Changes
111
200
 
112
- - Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
201
+ - Updated dependencies []:
202
+ - @mastra/client-js@0.16.7-alpha.0
113
203
 
114
- - Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
204
+ ## 0.0.12
115
205
 
116
- - Renamed `MastraMessageV2` to `MastraDBMessage` ([#9255](https://github.com/mastra-ai/mastra/pull/9255))
117
- Made the return format of all methods that return db messages consistent. It's always `{ messages: MastraDBMessage[] }` now, and messages can be converted after that using `@mastra/ai-sdk/ui`'s `toAISdkV4/5Messages()` function
206
+ ### Patch Changes
207
+
208
+ - Fix peerdependencies ([`eb7c1c8`](https://github.com/mastra-ai/mastra/commit/eb7c1c8c592d8fb16dfd250e337d9cdc73c8d5de))
209
+
210
+ - Updated dependencies [[`eb7c1c8`](https://github.com/mastra-ai/mastra/commit/eb7c1c8c592d8fb16dfd250e337d9cdc73c8d5de)]:
211
+ - @mastra/client-js@0.16.6
212
+
213
+ ## 0.0.11
118
214
 
119
215
  ### Patch Changes
120
216
 
121
217
  - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
122
218
 
123
- - Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
219
+ - Updated dependencies [[`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18)]:
220
+ - @mastra/client-js@0.16.5
221
+
222
+ ## 0.0.11-alpha.0
223
+
224
+ ### Patch Changes
225
+
226
+ - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
124
227
 
125
- - Updated dependencies [[`3852192`](https://github.com/mastra-ai/mastra/commit/3852192c81b2a4f1f883f17d80ce50e0c60dba55), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`b7de533`](https://github.com/mastra-ai/mastra/commit/b7de53361667eb51fefd89fcaed924f3c57cee8d), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`1ee3411`](https://github.com/mastra-ai/mastra/commit/1ee34113192b11aa8bcdd8d9d5830ae13254b345), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`f93d992`](https://github.com/mastra-ai/mastra/commit/f93d992a37d5431ab4a71246835d403ef7c4ce85), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`ea0b8de`](https://github.com/mastra-ai/mastra/commit/ea0b8dec0d4bc86a72a7e75b2f56c6017c58786d), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`519d9e6`](https://github.com/mastra-ai/mastra/commit/519d9e6d31910457c54bdae8b7b7cb3a69f41831), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`dfe3f8c`](https://github.com/mastra-ai/mastra/commit/dfe3f8c7376ffe159236819e19ca522143c1f972), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`e8dcd71`](https://github.com/mastra-ai/mastra/commit/e8dcd71fa5e473c8ba1d6dad99eef182d20a0491), [`63f2f18`](https://github.com/mastra-ai/mastra/commit/63f2f1863dffe3ad23221d0660ed4e4f2b81789d), [`c23200d`](https://github.com/mastra-ai/mastra/commit/c23200ddfd60830effb39329674ba4ca93be6aac), [`363284b`](https://github.com/mastra-ai/mastra/commit/363284bb974e850f06f40f89a28c79d9f432d7e4), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014)]:
126
- - @mastra/client-js@1.0.0-beta.0
228
+ - Updated dependencies [[`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18)]:
229
+ - @mastra/client-js@0.16.5-alpha.0
127
230
 
128
231
  ## 0.0.10
129
232
 
package/dist/index.cjs CHANGED
@@ -442,10 +442,11 @@ const toUIMessage = ({ chunk, conversation, metadata }) => {
442
442
  const lastMessage = result[result.length - 1];
443
443
  if (!lastMessage || lastMessage.role !== "assistant") return result;
444
444
  const parts = lastMessage.parts.map((part) => {
445
- if (typeof part === "object" && part !== null && "type" in part && "state" in part && part.state === "streaming") {
446
- if (part.type === "text" || part.type === "reasoning") {
447
- return { ...part, state: "done" };
448
- }
445
+ if (part.type === "text" && part.state === "streaming") {
446
+ return { ...part, state: "done" };
447
+ }
448
+ if (part.type === "reasoning" && part.state === "streaming") {
449
+ return { ...part, state: "done" };
449
450
  }
450
451
  return part;
451
452
  });
@@ -617,23 +618,13 @@ const toAssistantUIMessage = (message) => {
617
618
  };
618
619
  }
619
620
  if (part.type === "file") {
620
- const type = part.mediaType.includes("image/") ? "image" : "file";
621
- if (type === "file") {
622
- return {
623
- type,
624
- mimeType: part.mediaType,
625
- data: part.url,
626
- // Use URL as data source
627
- metadata: message.metadata
628
- };
629
- }
630
- if (type === "image") {
631
- return {
632
- type,
633
- image: part.url,
634
- metadata: message.metadata
635
- };
636
- }
621
+ return {
622
+ type: "file",
623
+ mimeType: part.mediaType,
624
+ data: part.url,
625
+ // Use URL as data source
626
+ metadata: message.metadata
627
+ };
637
628
  }
638
629
  if (part.type === "dynamic-tool") {
639
630
  const baseToolCall = {
@@ -724,9 +715,7 @@ const toAssistantUIMessage = (message) => {
724
715
 
725
716
  const resolveInitialMessages = (messages) => {
726
717
  return messages.map((message) => {
727
- const networkPart = message.parts.find(
728
- (part) => typeof part === "object" && part !== null && "type" in part && part.type === "text" && "text" in part && typeof part.text === "string" && part.text.includes('"isNetwork":true')
729
- );
718
+ const networkPart = message.parts.find((part) => part.type === "text" && part.text.includes('"isNetwork":true'));
730
719
  if (networkPart && networkPart.type === "text") {
731
720
  try {
732
721
  const json = JSON.parse(networkPart.text);
@@ -1211,51 +1200,6 @@ class AISdkNetworkTransformer {
1211
1200
  };
1212
1201
  }
1213
1202
 
1214
- const fromCoreUserMessageToUIMessage = (coreUserMessage) => {
1215
- const id = `user-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
1216
- const parts = typeof coreUserMessage.content === "string" ? [
1217
- {
1218
- type: "text",
1219
- text: coreUserMessage.content
1220
- }
1221
- ] : coreUserMessage.content.map((part) => {
1222
- switch (part.type) {
1223
- case "text": {
1224
- return {
1225
- type: "text",
1226
- text: part.text
1227
- };
1228
- }
1229
- case "image": {
1230
- const url = typeof part.image === "string" ? part.image : part.image instanceof URL ? part.image.toString() : "";
1231
- return {
1232
- type: "file",
1233
- mediaType: part.mimeType ?? "image/*",
1234
- url
1235
- };
1236
- }
1237
- case "file": {
1238
- const url = typeof part.data === "string" ? part.data : part.data instanceof URL ? part.data.toString() : "";
1239
- return {
1240
- type: "file",
1241
- mediaType: part.mimeType,
1242
- url,
1243
- ...part.filename !== void 0 ? { filename: part.filename } : {}
1244
- };
1245
- }
1246
- default: {
1247
- const exhaustiveCheck = part;
1248
- throw new Error(`Unhandled content part type: ${exhaustiveCheck.type}`);
1249
- }
1250
- }
1251
- });
1252
- return {
1253
- id,
1254
- role: "user",
1255
- parts
1256
- };
1257
- };
1258
-
1259
1203
  const useChat = ({ agentId, resourceId, initializeMessages }) => {
1260
1204
  const extractRunIdFromMessages = (messages2) => {
1261
1205
  for (const message of messages2) {
@@ -1279,7 +1223,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1279
1223
  const [isRunning, setIsRunning] = react.useState(false);
1280
1224
  const generate = async ({
1281
1225
  coreUserMessages,
1282
- requestContext,
1226
+ runtimeContext,
1283
1227
  threadId,
1284
1228
  modelSettings,
1285
1229
  signal,
@@ -1317,7 +1261,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1317
1261
  topP
1318
1262
  },
1319
1263
  instructions,
1320
- requestContext,
1264
+ runtimeContext,
1321
1265
  ...threadId ? { threadId, resourceId: resourceId || agentId } : {},
1322
1266
  providerOptions
1323
1267
  });
@@ -1333,7 +1277,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1333
1277
  setMessages((prev) => [...prev, ...mastraUIMessages]);
1334
1278
  }
1335
1279
  };
1336
- const stream = async ({ coreUserMessages, requestContext, threadId, onChunk, modelSettings, signal }) => {
1280
+ const stream = async ({ coreUserMessages, runtimeContext, threadId, onChunk, modelSettings, signal }) => {
1337
1281
  const {
1338
1282
  frequencyPenalty,
1339
1283
  presencePenalty,
@@ -1368,7 +1312,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1368
1312
  topP
1369
1313
  },
1370
1314
  instructions,
1371
- requestContext,
1315
+ runtimeContext,
1372
1316
  ...threadId ? { threadId, resourceId: resourceId || agentId } : {},
1373
1317
  providerOptions,
1374
1318
  requireToolApproval
@@ -1385,7 +1329,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1385
1329
  };
1386
1330
  const network = async ({
1387
1331
  coreUserMessages,
1388
- requestContext,
1332
+ runtimeContext,
1389
1333
  threadId,
1390
1334
  onNetworkChunk,
1391
1335
  modelSettings,
@@ -1412,7 +1356,7 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1412
1356
  topP
1413
1357
  },
1414
1358
  runId,
1415
- requestContext,
1359
+ runtimeContext,
1416
1360
  ...threadId ? { thread: threadId, resourceId: resourceId || agentId } : {}
1417
1361
  });
1418
1362
  const transformer = new AISdkNetworkTransformer();
@@ -1465,18 +1409,14 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
1465
1409
  };
1466
1410
  const sendMessage = async ({ mode = "stream", ...args }) => {
1467
1411
  const nextMessage = { role: "user", content: [{ type: "text", text: args.message }] };
1468
- const coreUserMessages = [nextMessage];
1469
- if (args.coreUserMessages) {
1470
- coreUserMessages.push(...args.coreUserMessages);
1471
- }
1472
- const uiMessages = coreUserMessages.map(fromCoreUserMessageToUIMessage);
1473
- setMessages((s) => [...s, ...uiMessages]);
1412
+ const messages2 = args.coreUserMessages ? [nextMessage, ...args.coreUserMessages] : [nextMessage];
1413
+ setMessages((s) => [...s, { role: "user", parts: [{ type: "text", text: args.message }] }]);
1474
1414
  if (mode === "generate") {
1475
- await generate({ ...args, coreUserMessages });
1415
+ await generate({ ...args, coreUserMessages: messages2 });
1476
1416
  } else if (mode === "stream") {
1477
- await stream({ ...args, coreUserMessages });
1417
+ await stream({ ...args, coreUserMessages: messages2 });
1478
1418
  } else if (mode === "network") {
1479
- await network({ ...args, coreUserMessages });
1419
+ await network({ ...args, coreUserMessages: messages2 });
1480
1420
  }
1481
1421
  };
1482
1422
  return {