@mastra/react 0.0.0-safe-stringify-telemetry-20251205024938 → 0.0.0-scorers-logs-20251208101616
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 +63 -141
- package/dist/index.cjs +102 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +102 -29
- package/dist/index.js.map +1 -1
- package/dist/react.css +1 -1
- package/dist/src/agent/hooks.d.ts +4 -2
- package/dist/src/lib/ai-sdk/utils/fromCoreUserMessageToUIMessage.d.ts +10 -0
- package/dist/src/lib/ai-sdk/utils/fromCoreUserMessageToUIMessage.test.d.ts +1 -0
- package/package.json +10 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
# @mastra/react-hooks
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-scorers-logs-20251208101616
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- @mastra/client-js@0.0.0-safe-stringify-telemetry-20251205024938
|
|
7
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
|
|
11
10
|
|
|
12
|
-
|
|
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
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- @mastra/client-js@0.16.16-alpha.0
|
|
14
|
+
### Patch Changes
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
- Adjust the types to accept tracingOptions ([#10742](https://github.com/mastra-ai/mastra/pull/10742))
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
- Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
|
|
20
19
|
|
|
21
|
-
-
|
|
20
|
+
- Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
|
|
22
21
|
|
|
23
|
-
- fix(agent): persist messages before tool suspension ([#
|
|
22
|
+
- fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
24
23
|
|
|
25
24
|
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.
|
|
26
25
|
|
|
@@ -43,16 +42,41 @@
|
|
|
43
42
|
|
|
44
43
|
Fixes #9745, #9906
|
|
45
44
|
|
|
46
|
-
-
|
|
47
|
-
|
|
45
|
+
- Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`6edf340`](https://github.com/mastra-ai/mastra/commit/6edf3402f6a46ee8def2f42a2287785251fbffd6), [`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), [`ad7e8f1`](https://github.com/mastra-ai/mastra/commit/ad7e8f16ac843cbd16687ad47b66ba96bcffe111), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`e1b7118`](https://github.com/mastra-ai/mastra/commit/e1b7118f42ca0a97247afc75e57dcd5fdf987752), [`441c7b6`](https://github.com/mastra-ai/mastra/commit/441c7b6665915cfa7fd625fded8c0f518530bf10), [`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), [`5fe71bc`](https://github.com/mastra-ai/mastra/commit/5fe71bc925dfce597df69c89241f33b378028c63), [`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), [`e849603`](https://github.com/mastra-ai/mastra/commit/e849603a596269069f58a438b98449ea2770493d), [`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), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`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)]:
|
|
48
|
+
- @mastra/client-js@0.0.0-scorers-logs-20251208101616
|
|
49
|
+
|
|
50
|
+
## 0.1.0-beta.8
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies:
|
|
55
|
+
- @mastra/client-js@1.0.0-beta.8
|
|
48
56
|
|
|
49
|
-
## 0.0
|
|
57
|
+
## 0.1.0-beta.7
|
|
50
58
|
|
|
51
59
|
### Patch Changes
|
|
52
60
|
|
|
53
|
-
-
|
|
61
|
+
- Updated dependencies [[`5fe71bc`](https://github.com/mastra-ai/mastra/commit/5fe71bc925dfce597df69c89241f33b378028c63), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141)]:
|
|
62
|
+
- @mastra/client-js@1.0.0-beta.7
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
## 0.1.0-beta.6
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Adjust the types to accept tracingOptions ([#10742](https://github.com/mastra-ai/mastra/pull/10742))
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [[`6edf340`](https://github.com/mastra-ai/mastra/commit/6edf3402f6a46ee8def2f42a2287785251fbffd6), [`ad7e8f1`](https://github.com/mastra-ai/mastra/commit/ad7e8f16ac843cbd16687ad47b66ba96bcffe111), [`e1b7118`](https://github.com/mastra-ai/mastra/commit/e1b7118f42ca0a97247afc75e57dcd5fdf987752), [`441c7b6`](https://github.com/mastra-ai/mastra/commit/441c7b6665915cfa7fd625fded8c0f518530bf10), [`e849603`](https://github.com/mastra-ai/mastra/commit/e849603a596269069f58a438b98449ea2770493d)]:
|
|
71
|
+
- @mastra/client-js@1.0.0-beta.6
|
|
72
|
+
|
|
73
|
+
## 0.1.0-beta.5
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
|
|
78
|
+
|
|
79
|
+
- fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
56
80
|
|
|
57
81
|
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.
|
|
58
82
|
|
|
@@ -75,158 +99,56 @@
|
|
|
75
99
|
|
|
76
100
|
Fixes #9745, #9906
|
|
77
101
|
|
|
78
|
-
- Updated dependencies []:
|
|
79
|
-
- @mastra/client-js@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
|
|
102
|
+
- Updated dependencies [[`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f)]:
|
|
103
|
+
- @mastra/client-js@1.0.0-beta.5
|
|
115
104
|
|
|
116
|
-
## 0.0
|
|
105
|
+
## 0.1.0-beta.4
|
|
117
106
|
|
|
118
107
|
### Patch Changes
|
|
119
108
|
|
|
120
|
-
- Updated dependencies [[`
|
|
121
|
-
- @mastra/client-js@0.
|
|
109
|
+
- Updated dependencies [[`6a86fe5`](https://github.com/mastra-ai/mastra/commit/6a86fe56b8ff53ca2eb3ed87ffc0748749ebadce), [`595a3b8`](https://github.com/mastra-ai/mastra/commit/595a3b8727c901f44e333909c09843c711224440)]:
|
|
110
|
+
- @mastra/client-js@1.0.0-beta.4
|
|
122
111
|
|
|
123
|
-
## 0.0.
|
|
112
|
+
## 0.1.0-beta.3
|
|
124
113
|
|
|
125
114
|
### Patch Changes
|
|
126
115
|
|
|
127
|
-
- Updated dependencies []:
|
|
128
|
-
- @mastra/client-js@0.
|
|
116
|
+
- Updated dependencies [[`e1bb9c9`](https://github.com/mastra-ai/mastra/commit/e1bb9c94b4eb68b019ae275981be3feb769b5365)]:
|
|
117
|
+
- @mastra/client-js@1.0.0-beta.3
|
|
129
118
|
|
|
130
|
-
## 0.0
|
|
119
|
+
## 0.1.0-beta.2
|
|
131
120
|
|
|
132
121
|
### Patch Changes
|
|
133
122
|
|
|
134
123
|
- Updated dependencies []:
|
|
135
|
-
- @mastra/client-js@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
|
|
124
|
+
- @mastra/client-js@1.0.0-beta.2
|
|
143
125
|
|
|
144
|
-
## 0.0
|
|
126
|
+
## 0.1.0-beta.1
|
|
145
127
|
|
|
146
128
|
### Patch Changes
|
|
147
129
|
|
|
148
|
-
- Updated dependencies [[`
|
|
149
|
-
- @mastra/client-js@0.
|
|
130
|
+
- Updated dependencies [[`dbd9db0`](https://github.com/mastra-ai/mastra/commit/dbd9db0d5c2797a210b9098e7e3e613718e5442f)]:
|
|
131
|
+
- @mastra/client-js@1.0.0-beta.1
|
|
150
132
|
|
|
151
|
-
## 0.0.
|
|
133
|
+
## 0.1.0-beta.0
|
|
152
134
|
|
|
153
|
-
###
|
|
154
|
-
|
|
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
|
|
159
|
-
|
|
160
|
-
## 0.0.15-alpha.0
|
|
161
|
-
|
|
162
|
-
### Patch Changes
|
|
135
|
+
### Minor Changes
|
|
163
136
|
|
|
164
|
-
-
|
|
137
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
165
138
|
|
|
166
|
-
-
|
|
167
|
-
- @mastra/client-js@0.16.9-alpha.0
|
|
139
|
+
- Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
|
|
168
140
|
|
|
169
|
-
|
|
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
|
|
184
|
-
|
|
185
|
-
### Patch Changes
|
|
186
|
-
|
|
187
|
-
- Updated dependencies []:
|
|
188
|
-
- @mastra/client-js@0.16.7
|
|
189
|
-
|
|
190
|
-
## 0.0.13-alpha.1
|
|
191
|
-
|
|
192
|
-
### Patch Changes
|
|
193
|
-
|
|
194
|
-
- Updated dependencies []:
|
|
195
|
-
- @mastra/client-js@0.16.7-alpha.1
|
|
196
|
-
|
|
197
|
-
## 0.0.13-alpha.0
|
|
198
|
-
|
|
199
|
-
### Patch Changes
|
|
200
|
-
|
|
201
|
-
- Updated dependencies []:
|
|
202
|
-
- @mastra/client-js@0.16.7-alpha.0
|
|
203
|
-
|
|
204
|
-
## 0.0.12
|
|
205
|
-
|
|
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
|
|
141
|
+
- Renamed `MastraMessageV2` to `MastraDBMessage` ([#9255](https://github.com/mastra-ai/mastra/pull/9255))
|
|
142
|
+
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
|
|
214
143
|
|
|
215
144
|
### Patch Changes
|
|
216
145
|
|
|
217
146
|
- Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
|
|
218
147
|
|
|
219
|
-
-
|
|
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))
|
|
148
|
+
- Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
|
|
227
149
|
|
|
228
|
-
- Updated dependencies [[`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`
|
|
229
|
-
- @mastra/client-js@0.
|
|
150
|
+
- 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)]:
|
|
151
|
+
- @mastra/client-js@1.0.0-beta.0
|
|
230
152
|
|
|
231
153
|
## 0.0.10
|
|
232
154
|
|
package/dist/index.cjs
CHANGED
|
@@ -442,11 +442,10 @@ 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 (part
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
return { ...part, state: "done" };
|
|
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
|
+
}
|
|
450
449
|
}
|
|
451
450
|
return part;
|
|
452
451
|
});
|
|
@@ -618,13 +617,23 @@ const toAssistantUIMessage = (message) => {
|
|
|
618
617
|
};
|
|
619
618
|
}
|
|
620
619
|
if (part.type === "file") {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
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
|
+
}
|
|
628
637
|
}
|
|
629
638
|
if (part.type === "dynamic-tool") {
|
|
630
639
|
const baseToolCall = {
|
|
@@ -715,7 +724,9 @@ const toAssistantUIMessage = (message) => {
|
|
|
715
724
|
|
|
716
725
|
const resolveInitialMessages = (messages) => {
|
|
717
726
|
return messages.map((message) => {
|
|
718
|
-
const networkPart = message.parts.find(
|
|
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
|
+
);
|
|
719
730
|
if (networkPart && networkPart.type === "text") {
|
|
720
731
|
try {
|
|
721
732
|
const json = JSON.parse(networkPart.text);
|
|
@@ -1200,6 +1211,51 @@ class AISdkNetworkTransformer {
|
|
|
1200
1211
|
};
|
|
1201
1212
|
}
|
|
1202
1213
|
|
|
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
|
+
|
|
1203
1259
|
const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
1204
1260
|
const extractRunIdFromMessages = (messages2) => {
|
|
1205
1261
|
for (const message of messages2) {
|
|
@@ -1223,11 +1279,12 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1223
1279
|
const [isRunning, setIsRunning] = react.useState(false);
|
|
1224
1280
|
const generate = async ({
|
|
1225
1281
|
coreUserMessages,
|
|
1226
|
-
|
|
1282
|
+
requestContext,
|
|
1227
1283
|
threadId,
|
|
1228
1284
|
modelSettings,
|
|
1229
1285
|
signal,
|
|
1230
|
-
onFinish
|
|
1286
|
+
onFinish,
|
|
1287
|
+
tracingOptions
|
|
1231
1288
|
}) => {
|
|
1232
1289
|
const {
|
|
1233
1290
|
frequencyPenalty,
|
|
@@ -1261,9 +1318,10 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1261
1318
|
topP
|
|
1262
1319
|
},
|
|
1263
1320
|
instructions,
|
|
1264
|
-
|
|
1321
|
+
requestContext,
|
|
1265
1322
|
...threadId ? { threadId, resourceId: resourceId || agentId } : {},
|
|
1266
|
-
providerOptions
|
|
1323
|
+
providerOptions,
|
|
1324
|
+
tracingOptions
|
|
1267
1325
|
});
|
|
1268
1326
|
setIsRunning(false);
|
|
1269
1327
|
if (response && "uiMessages" in response.response && response.response.uiMessages) {
|
|
@@ -1277,7 +1335,15 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1277
1335
|
setMessages((prev) => [...prev, ...mastraUIMessages]);
|
|
1278
1336
|
}
|
|
1279
1337
|
};
|
|
1280
|
-
const stream = async ({
|
|
1338
|
+
const stream = async ({
|
|
1339
|
+
coreUserMessages,
|
|
1340
|
+
requestContext,
|
|
1341
|
+
threadId,
|
|
1342
|
+
onChunk,
|
|
1343
|
+
modelSettings,
|
|
1344
|
+
signal,
|
|
1345
|
+
tracingOptions
|
|
1346
|
+
}) => {
|
|
1281
1347
|
const {
|
|
1282
1348
|
frequencyPenalty,
|
|
1283
1349
|
presencePenalty,
|
|
@@ -1312,10 +1378,11 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1312
1378
|
topP
|
|
1313
1379
|
},
|
|
1314
1380
|
instructions,
|
|
1315
|
-
|
|
1381
|
+
requestContext,
|
|
1316
1382
|
...threadId ? { threadId, resourceId: resourceId || agentId } : {},
|
|
1317
1383
|
providerOptions,
|
|
1318
|
-
requireToolApproval
|
|
1384
|
+
requireToolApproval,
|
|
1385
|
+
tracingOptions
|
|
1319
1386
|
});
|
|
1320
1387
|
_onChunk.current = onChunk;
|
|
1321
1388
|
_currentRunId.current = runId;
|
|
@@ -1329,11 +1396,12 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1329
1396
|
};
|
|
1330
1397
|
const network = async ({
|
|
1331
1398
|
coreUserMessages,
|
|
1332
|
-
|
|
1399
|
+
requestContext,
|
|
1333
1400
|
threadId,
|
|
1334
1401
|
onNetworkChunk,
|
|
1335
1402
|
modelSettings,
|
|
1336
|
-
signal
|
|
1403
|
+
signal,
|
|
1404
|
+
tracingOptions
|
|
1337
1405
|
}) => {
|
|
1338
1406
|
const { frequencyPenalty, presencePenalty, maxRetries, maxTokens, temperature, topK, topP, maxSteps } = modelSettings || {};
|
|
1339
1407
|
setIsRunning(true);
|
|
@@ -1356,8 +1424,9 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1356
1424
|
topP
|
|
1357
1425
|
},
|
|
1358
1426
|
runId,
|
|
1359
|
-
|
|
1360
|
-
...threadId ? { thread: threadId, resourceId: resourceId || agentId } : {}
|
|
1427
|
+
requestContext,
|
|
1428
|
+
...threadId ? { thread: threadId, resourceId: resourceId || agentId } : {},
|
|
1429
|
+
tracingOptions
|
|
1361
1430
|
});
|
|
1362
1431
|
const transformer = new AISdkNetworkTransformer();
|
|
1363
1432
|
await response.processDataStream({
|
|
@@ -1409,14 +1478,18 @@ const useChat = ({ agentId, resourceId, initializeMessages }) => {
|
|
|
1409
1478
|
};
|
|
1410
1479
|
const sendMessage = async ({ mode = "stream", ...args }) => {
|
|
1411
1480
|
const nextMessage = { role: "user", content: [{ type: "text", text: args.message }] };
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1481
|
+
const coreUserMessages = [nextMessage];
|
|
1482
|
+
if (args.coreUserMessages) {
|
|
1483
|
+
coreUserMessages.push(...args.coreUserMessages);
|
|
1484
|
+
}
|
|
1485
|
+
const uiMessages = coreUserMessages.map(fromCoreUserMessageToUIMessage);
|
|
1486
|
+
setMessages((s) => [...s, ...uiMessages]);
|
|
1414
1487
|
if (mode === "generate") {
|
|
1415
|
-
await generate({ ...args, coreUserMessages
|
|
1488
|
+
await generate({ ...args, coreUserMessages });
|
|
1416
1489
|
} else if (mode === "stream") {
|
|
1417
|
-
await stream({ ...args, coreUserMessages
|
|
1490
|
+
await stream({ ...args, coreUserMessages });
|
|
1418
1491
|
} else if (mode === "network") {
|
|
1419
|
-
await network({ ...args, coreUserMessages
|
|
1492
|
+
await network({ ...args, coreUserMessages });
|
|
1420
1493
|
}
|
|
1421
1494
|
};
|
|
1422
1495
|
return {
|