@mastra/react 0.0.0-bundle-studio-cloud-20251222034739 → 0.0.0-bundle-version-20260121091645

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,13 +1,144 @@
1
- # @mastra/react-hooks
1
+ # @mastra/react
2
2
 
3
- ## 0.0.0-bundle-studio-cloud-20251222034739
3
+ ## 0.0.0-bundle-version-20260121091645
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - @mastra/client-js@0.0.0-bundle-version-20260121091645
9
+
10
+ ## 0.1.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies:
15
+ - @mastra/client-js@1.0.1
16
+
17
+ ## 0.1.1-alpha.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies:
22
+ - @mastra/client-js@1.0.1-alpha.0
23
+
24
+ ## 0.1.0
4
25
 
5
26
  ### Minor Changes
6
27
 
28
+ - Added human-in-the-loop (HITL) tool approval support for `generate()` method. ([#12056](https://github.com/mastra-ai/mastra/pull/12056))
29
+
30
+ **Why:** This provides parity between `stream()` and `generate()` for tool approval flows, allowing non-streaming use cases to leverage `requireToolApproval` without needing to switch to streaming.
31
+
32
+ Previously, tool approval with `requireToolApproval` only worked with `stream()`. Now you can use the same approval flow with `generate()` for non-streaming use cases.
33
+
34
+ **Using tool approval with generate()**
35
+
36
+ ```typescript
37
+ const output = await agent.generate('Find user John', {
38
+ requireToolApproval: true,
39
+ });
40
+
41
+ // Check if a tool is waiting for approval
42
+ if (output.finishReason === 'suspended') {
43
+ console.log('Tool requires approval:', output.suspendPayload.toolName);
44
+
45
+ // Approve the tool call
46
+ const result = await agent.approveToolCallGenerate({
47
+ runId: output.runId,
48
+ toolCallId: output.suspendPayload.toolCallId,
49
+ });
50
+
51
+ console.log(result.text);
52
+ }
53
+ ```
54
+
55
+ **Declining a tool call**
56
+
57
+ ```typescript
58
+ if (output.finishReason === 'suspended') {
59
+ const result = await agent.declineToolCallGenerate({
60
+ runId: output.runId,
61
+ toolCallId: output.suspendPayload.toolCallId,
62
+ });
63
+ }
64
+ ```
65
+
66
+ **New methods added:**
67
+ - `agent.approveToolCallGenerate({ runId, toolCallId })` - Approves a pending tool call and returns the complete result
68
+ - `agent.declineToolCallGenerate({ runId, toolCallId })` - Declines a pending tool call and returns the complete result
69
+
70
+ **Server routes added:**
71
+ - `POST /api/agents/:agentId/approve-tool-call-generate`
72
+ - `POST /api/agents/:agentId/decline-tool-call-generate`
73
+
74
+ The playground UI now also supports tool approval when using generate mode.
75
+
7
76
  - Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
8
77
 
78
+ - **Fixed:** Align `Agent.network` with core and update `@mastra/react` network usage. ([#12015](https://github.com/mastra-ai/mastra/pull/12015))
79
+
9
80
  - Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
10
81
 
82
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
83
+
84
+ ## What changed
85
+
86
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
87
+
88
+ **Before:**
89
+
90
+ ```typescript
91
+ // Old span structure
92
+ span.agentId; // 'my-agent'
93
+ span.toolId; // undefined
94
+ span.workflowId; // undefined
95
+ ```
96
+
97
+ **After:**
98
+
99
+ ```typescript
100
+ // New span structure
101
+ span.entityType; // EntityType.AGENT
102
+ span.entityId; // 'my-agent'
103
+ span.entityName; // 'My Agent'
104
+ ```
105
+
106
+ ## New `listTraces()` API
107
+
108
+ Query traces with filtering, pagination, and sorting:
109
+
110
+ ```typescript
111
+ const { spans, pagination } = await storage.listTraces({
112
+ filters: {
113
+ entityType: EntityType.AGENT,
114
+ entityId: 'my-agent',
115
+ userId: 'user-123',
116
+ environment: 'production',
117
+ status: TraceStatus.SUCCESS,
118
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
119
+ },
120
+ pagination: { page: 0, perPage: 50 },
121
+ orderBy: { field: 'startedAt', direction: 'DESC' },
122
+ });
123
+ ```
124
+
125
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
126
+
127
+ ## New retrieval methods
128
+ - `getSpan({ traceId, spanId })` - Get a single span
129
+ - `getRootSpan({ traceId })` - Get the root span of a trace
130
+ - `getTrace({ traceId })` - Get all spans for a trace
131
+
132
+ ## Backward compatibility
133
+
134
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
135
+
136
+ ## Migration
137
+
138
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
139
+
140
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
141
+
11
142
  - Renamed `MastraMessageV2` to `MastraDBMessage` ([#9255](https://github.com/mastra-ai/mastra/pull/9255))
12
143
  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
144
 
@@ -41,8 +172,81 @@
41
172
  });
42
173
  ```
43
174
 
175
+ - Removes the deprecated `threadId` and `resourceId` options from `AgentExecutionOptions`. These have been deprecated for months in favour of the `memory` option. ([#11897](https://github.com/mastra-ai/mastra/pull/11897))
176
+
177
+ ### Breaking Changes
178
+
179
+ #### `@mastra/core`
180
+
181
+ The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
182
+
183
+ ```ts
184
+ // Before
185
+ await agent.stream('Hello', {
186
+ threadId: 'thread-123',
187
+ resourceId: 'user-456',
188
+ });
189
+
190
+ // After
191
+ await agent.stream('Hello', {
192
+ memory: {
193
+ thread: 'thread-123',
194
+ resource: 'user-456',
195
+ },
196
+ });
197
+ ```
198
+
199
+ #### `@mastra/server`
200
+
201
+ The `threadId`, `resourceId`, and `resourceid` fields have been removed from the main agent execution body schema. The server now expects the `memory` option format in request bodies. Legacy routes (`/api/agents/:agentId/generate-legacy` and `/api/agents/:agentId/stream-legacy`) continue to support the deprecated fields.
202
+
203
+ #### `@mastra/react`
204
+
205
+ The `useChat` hook now internally converts `threadId` to the `memory` option format when making API calls. No changes needed in component code - the hook handles the conversion automatically.
206
+
207
+ #### `@mastra/client-js`
208
+
209
+ When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
210
+
211
+ ```ts
212
+ const agent = client.getAgent('my-agent');
213
+
214
+ // Before
215
+ await agent.generate([...], {
216
+ threadId: 'thread-123',
217
+ resourceId: 'user-456',
218
+ });
219
+
220
+ // After
221
+ await agent.generate([...], {
222
+ memory: {
223
+ thread: 'thread-123',
224
+ resource: 'user-456',
225
+ },
226
+ });
227
+ ```
228
+
44
229
  - Adjust the types to accept tracingOptions ([#10742](https://github.com/mastra-ai/mastra/pull/10742))
45
230
 
231
+ - Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
232
+ - Add suspend/resume capabilities to agent network
233
+ - Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
234
+
235
+ `agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
236
+
237
+ - Fix TypeScript errors during build declaration generation ([#11682](https://github.com/mastra-ai/mastra/pull/11682))
238
+
239
+ Updated test file `toUIMessage.test.ts` to match current `@mastra/core` types:
240
+ - Changed `error` property from string to `Error` object (per `StepFailure` type)
241
+ - Added missing `resumeSchema` property to `tool-call-approval` payloads (per `ToolCallApprovalPayload` type)
242
+ - Added `zod` as peer/dev dependency for test type support
243
+
244
+ - Fix text parts incorrectly merging across tool calls ([#11783](https://github.com/mastra-ai/mastra/pull/11783))
245
+
246
+ Previously, when an agent produced text before and after a tool call (e.g., "Let me search for that" → tool call → "Here's what I found"), the text parts would be merged into a single part, losing the separation. This fix introduces a `textId` property to track separate text streams, ensuring each text stream maintains its own text part in the UI message.
247
+
248
+ Fixes #11577
249
+
46
250
  - Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
47
251
 
48
252
  - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
@@ -68,8 +272,23 @@
68
272
 
69
273
  Fixes #9745, #9906
70
274
 
275
+ - Fixed compatibility with updated `@mastra/client-js` generate and stream API signatures ([#12011](https://github.com/mastra-ai/mastra/pull/12011))
276
+
277
+ - Fixed agent network not returning text response when routing agent handles requests without delegation. ([#11497](https://github.com/mastra-ai/mastra/pull/11497))
278
+
279
+ **What changed:**
280
+ - Agent networks now correctly stream text responses when the routing agent decides to handle a request itself instead of delegating to sub-agents, workflows, or tools
281
+ - Added fallback in transformers to ensure text is always returned even if core events are missing
282
+
283
+ **Why this matters:**
284
+ Previously, when using `toAISdkV5Stream` or `networkRoute()` outside of the Mastra Studio UI, no text content was returned when the routing agent handled requests directly. This fix ensures consistent behavior across all API routes.
285
+
286
+ Fixes #11219
287
+
71
288
  - Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
72
289
 
290
+ - Display network completion validation results and scorer feedback in the Playground when viewing agent network runs, letting users see pass/fail status and actionable feedback from completion scorers ([#11562](https://github.com/mastra-ai/mastra/pull/11562))
291
+
73
292
  - Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
74
293
 
75
294
  When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
@@ -94,8 +313,305 @@
94
313
  - Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
95
314
  - Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
96
315
  - Update related `@assistant-ui/*` packages for compatibility
97
- - 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), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`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), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`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), [`1b85674`](https://github.com/mastra-ai/mastra/commit/1b85674123708d9b85834dccc9eae601a9d0891c), [`5a1ede1`](https://github.com/mastra-ai/mastra/commit/5a1ede1f7ab527b9ead11f7eee2f73e67aeca9e4), [`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), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`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), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`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), [`439eaf7`](https://github.com/mastra-ai/mastra/commit/439eaf75447809b05e326666675a4dcbf9c334ce), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db), [`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)]:
98
- - @mastra/client-js@0.0.0-bundle-studio-cloud-20251222034739
316
+ - Updated dependencies [[`6edf340`](https://github.com/mastra-ai/mastra/commit/6edf3402f6a46ee8def2f42a2287785251fbffd6), [`bc72b52`](https://github.com/mastra-ai/mastra/commit/bc72b529ee4478fe89ecd85a8be47ce0127b82a0), [`ed3e3dd`](https://github.com/mastra-ai/mastra/commit/ed3e3ddec69d564fe2b125e083437f76331f1283), [`c042bd0`](https://github.com/mastra-ai/mastra/commit/c042bd0b743e0e86199d0cb83344ca7690e34a9c), [`3852192`](https://github.com/mastra-ai/mastra/commit/3852192c81b2a4f1f883f17d80ce50e0c60dba55), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`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), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`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), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`e1b7118`](https://github.com/mastra-ai/mastra/commit/e1b7118f42ca0a97247afc75e57dcd5fdf987752), [`461e448`](https://github.com/mastra-ai/mastra/commit/461e448852fe999506a6046d50b1efc27d8aa378), [`441c7b6`](https://github.com/mastra-ai/mastra/commit/441c7b6665915cfa7fd625fded8c0f518530bf10), [`b7de533`](https://github.com/mastra-ai/mastra/commit/b7de53361667eb51fefd89fcaed924f3c57cee8d), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`1b85674`](https://github.com/mastra-ai/mastra/commit/1b85674123708d9b85834dccc9eae601a9d0891c), [`5a1ede1`](https://github.com/mastra-ai/mastra/commit/5a1ede1f7ab527b9ead11f7eee2f73e67aeca9e4), [`47b1c16`](https://github.com/mastra-ai/mastra/commit/47b1c16a01c7ffb6765fe1e499b49092f8b7eba3), [`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), [`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`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), [`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`e4d366a`](https://github.com/mastra-ai/mastra/commit/e4d366aeb500371dd4210d6aa8361a4c21d87034), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`632fdb8`](https://github.com/mastra-ai/mastra/commit/632fdb8b3cd9ff6f90399256d526db439fc1758b), [`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), [`9312dcd`](https://github.com/mastra-ai/mastra/commit/9312dcd1c6f5b321929e7d382e763d95fdc030f5), [`184f01d`](https://github.com/mastra-ai/mastra/commit/184f01d1f534ec0be9703d3996f2e088b4a560eb), [`363284b`](https://github.com/mastra-ai/mastra/commit/363284bb974e850f06f40f89a28c79d9f432d7e4), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`58e3931`](https://github.com/mastra-ai/mastra/commit/58e3931af9baa5921688566210f00fb0c10479fa), [`439eaf7`](https://github.com/mastra-ai/mastra/commit/439eaf75447809b05e326666675a4dcbf9c334ce), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db), [`08bb631`](https://github.com/mastra-ai/mastra/commit/08bb631ae2b14684b2678e3549d0b399a6f0561e), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`6cbb549`](https://github.com/mastra-ai/mastra/commit/6cbb549475201a2fbf158f0fd7323f6495f46d08), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`e1bb9c9`](https://github.com/mastra-ai/mastra/commit/e1bb9c94b4eb68b019ae275981be3feb769b5365), [`106c960`](https://github.com/mastra-ai/mastra/commit/106c960df5d110ec15ac8f45de8858597fb90ad5)]:
317
+ - @mastra/client-js@1.0.0
318
+
319
+ ## 0.1.0-beta.27
320
+
321
+ ### Patch Changes
322
+
323
+ - Updated dependencies:
324
+ - @mastra/client-js@1.0.0-beta.27
325
+
326
+ ## 0.1.0-beta.26
327
+
328
+ ### Patch Changes
329
+
330
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac)]:
331
+ - @mastra/client-js@1.0.0-beta.26
332
+
333
+ ## 0.1.0-beta.25
334
+
335
+ ### Minor Changes
336
+
337
+ - Added human-in-the-loop (HITL) tool approval support for `generate()` method. ([#12056](https://github.com/mastra-ai/mastra/pull/12056))
338
+
339
+ **Why:** This provides parity between `stream()` and `generate()` for tool approval flows, allowing non-streaming use cases to leverage `requireToolApproval` without needing to switch to streaming.
340
+
341
+ Previously, tool approval with `requireToolApproval` only worked with `stream()`. Now you can use the same approval flow with `generate()` for non-streaming use cases.
342
+
343
+ **Using tool approval with generate()**
344
+
345
+ ```typescript
346
+ const output = await agent.generate('Find user John', {
347
+ requireToolApproval: true,
348
+ });
349
+
350
+ // Check if a tool is waiting for approval
351
+ if (output.finishReason === 'suspended') {
352
+ console.log('Tool requires approval:', output.suspendPayload.toolName);
353
+
354
+ // Approve the tool call
355
+ const result = await agent.approveToolCallGenerate({
356
+ runId: output.runId,
357
+ toolCallId: output.suspendPayload.toolCallId,
358
+ });
359
+
360
+ console.log(result.text);
361
+ }
362
+ ```
363
+
364
+ **Declining a tool call**
365
+
366
+ ```typescript
367
+ if (output.finishReason === 'suspended') {
368
+ const result = await agent.declineToolCallGenerate({
369
+ runId: output.runId,
370
+ toolCallId: output.suspendPayload.toolCallId,
371
+ });
372
+ }
373
+ ```
374
+
375
+ **New methods added:**
376
+ - `agent.approveToolCallGenerate({ runId, toolCallId })` - Approves a pending tool call and returns the complete result
377
+ - `agent.declineToolCallGenerate({ runId, toolCallId })` - Declines a pending tool call and returns the complete result
378
+
379
+ **Server routes added:**
380
+ - `POST /api/agents/:agentId/approve-tool-call-generate`
381
+ - `POST /api/agents/:agentId/decline-tool-call-generate`
382
+
383
+ The playground UI now also supports tool approval when using generate mode.
384
+
385
+ ### Patch Changes
386
+
387
+ - Updated dependencies [[`ed3e3dd`](https://github.com/mastra-ai/mastra/commit/ed3e3ddec69d564fe2b125e083437f76331f1283), [`47b1c16`](https://github.com/mastra-ai/mastra/commit/47b1c16a01c7ffb6765fe1e499b49092f8b7eba3), [`9312dcd`](https://github.com/mastra-ai/mastra/commit/9312dcd1c6f5b321929e7d382e763d95fdc030f5)]:
388
+ - @mastra/client-js@1.0.0-beta.25
389
+
390
+ ## 0.1.0-beta.23
391
+
392
+ ### Major Changes
393
+
394
+ - **Fixed:** Align `Agent.network` with core and update `@mastra/react` network usage. ([#12015](https://github.com/mastra-ai/mastra/pull/12015))
395
+
396
+ ### Patch Changes
397
+
398
+ - Fixed compatibility with updated `@mastra/client-js` generate and stream API signatures ([#12011](https://github.com/mastra-ai/mastra/pull/12011))
399
+
400
+ - Updated dependencies [[`461e448`](https://github.com/mastra-ai/mastra/commit/461e448852fe999506a6046d50b1efc27d8aa378)]:
401
+ - @mastra/client-js@1.0.0-beta.24
402
+
403
+ ## 0.1.0-beta.23
404
+
405
+ ### Patch Changes
406
+
407
+ - Updated dependencies:
408
+ - @mastra/client-js@1.0.0-beta.23
409
+
410
+ ## 0.1.0-beta.22
411
+
412
+ ### Patch Changes
413
+
414
+ - Removes the deprecated `threadId` and `resourceId` options from `AgentExecutionOptions`. These have been deprecated for months in favour of the `memory` option. ([#11897](https://github.com/mastra-ai/mastra/pull/11897))
415
+
416
+ ### Breaking Changes
417
+
418
+ #### `@mastra/core`
419
+
420
+ The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
421
+
422
+ ```ts
423
+ // Before
424
+ await agent.stream('Hello', {
425
+ threadId: 'thread-123',
426
+ resourceId: 'user-456',
427
+ });
428
+
429
+ // After
430
+ await agent.stream('Hello', {
431
+ memory: {
432
+ thread: 'thread-123',
433
+ resource: 'user-456',
434
+ },
435
+ });
436
+ ```
437
+
438
+ #### `@mastra/server`
439
+
440
+ The `threadId`, `resourceId`, and `resourceid` fields have been removed from the main agent execution body schema. The server now expects the `memory` option format in request bodies. Legacy routes (`/api/agents/:agentId/generate-legacy` and `/api/agents/:agentId/stream-legacy`) continue to support the deprecated fields.
441
+
442
+ #### `@mastra/react`
443
+
444
+ The `useChat` hook now internally converts `threadId` to the `memory` option format when making API calls. No changes needed in component code - the hook handles the conversion automatically.
445
+
446
+ #### `@mastra/client-js`
447
+
448
+ When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
449
+
450
+ ```ts
451
+ const agent = client.getAgent('my-agent');
452
+
453
+ // Before
454
+ await agent.generate({
455
+ messages: [...],
456
+ threadId: 'thread-123',
457
+ resourceId: 'user-456',
458
+ });
459
+
460
+ // After
461
+ await agent.generate({
462
+ messages: [...],
463
+ memory: {
464
+ thread: 'thread-123',
465
+ resource: 'user-456',
466
+ },
467
+ });
468
+ ```
469
+
470
+ - Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
471
+ - Add suspend/resume capabilities to agent network
472
+ - Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
473
+
474
+ `agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
475
+
476
+ - Fix text parts incorrectly merging across tool calls ([#11783](https://github.com/mastra-ai/mastra/pull/11783))
477
+
478
+ Previously, when an agent produced text before and after a tool call (e.g., "Let me search for that" → tool call → "Here's what I found"), the text parts would be merged into a single part, losing the separation. This fix introduces a `textId` property to track separate text streams, ensuring each text stream maintains its own text part in the UI message.
479
+
480
+ Fixes #11577
481
+
482
+ - Updated dependencies [[`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151)]:
483
+ - @mastra/client-js@1.0.0-beta.22
484
+
485
+ ## 0.1.0-beta.21
486
+
487
+ ### Patch Changes
488
+
489
+ - Updated dependencies:
490
+ - @mastra/client-js@1.0.0-beta.21
491
+
492
+ ## 0.1.0-beta.20
493
+
494
+ ### Patch Changes
495
+
496
+ - Fix TypeScript errors during build declaration generation ([#11682](https://github.com/mastra-ai/mastra/pull/11682))
497
+
498
+ Updated test file `toUIMessage.test.ts` to match current `@mastra/core` types:
499
+ - Changed `error` property from string to `Error` object (per `StepFailure` type)
500
+ - Added missing `resumeSchema` property to `tool-call-approval` payloads (per `ToolCallApprovalPayload` type)
501
+ - Added `zod` as peer/dev dependency for test type support
502
+
503
+ - Fixed agent network not returning text response when routing agent handles requests without delegation. ([#11497](https://github.com/mastra-ai/mastra/pull/11497))
504
+
505
+ **What changed:**
506
+ - Agent networks now correctly stream text responses when the routing agent decides to handle a request itself instead of delegating to sub-agents, workflows, or tools
507
+ - Added fallback in transformers to ensure text is always returned even if core events are missing
508
+
509
+ **Why this matters:**
510
+ Previously, when using `toAISdkV5Stream` or `networkRoute()` outside of the Mastra Studio UI, no text content was returned when the routing agent handled requests directly. This fix ensures consistent behavior across all API routes.
511
+
512
+ Fixes #11219
513
+
514
+ - Display network completion validation results and scorer feedback in the Playground when viewing agent network runs, letting users see pass/fail status and actionable feedback from completion scorers ([#11562](https://github.com/mastra-ai/mastra/pull/11562))
515
+
516
+ - Updated dependencies [[`bc72b52`](https://github.com/mastra-ai/mastra/commit/bc72b529ee4478fe89ecd85a8be47ce0127b82a0), [`c042bd0`](https://github.com/mastra-ai/mastra/commit/c042bd0b743e0e86199d0cb83344ca7690e34a9c), [`e4d366a`](https://github.com/mastra-ai/mastra/commit/e4d366aeb500371dd4210d6aa8361a4c21d87034), [`58e3931`](https://github.com/mastra-ai/mastra/commit/58e3931af9baa5921688566210f00fb0c10479fa), [`08bb631`](https://github.com/mastra-ai/mastra/commit/08bb631ae2b14684b2678e3549d0b399a6f0561e), [`106c960`](https://github.com/mastra-ai/mastra/commit/106c960df5d110ec15ac8f45de8858597fb90ad5)]:
517
+ - @mastra/client-js@1.0.0-beta.20
518
+
519
+ ## 0.1.0-beta.19
520
+
521
+ ### Patch Changes
522
+
523
+ - Updated dependencies:
524
+ - @mastra/client-js@1.0.0-beta.19
525
+
526
+ ## 0.1.0-beta.18
527
+
528
+ ### Patch Changes
529
+
530
+ - Updated dependencies:
531
+ - @mastra/client-js@1.0.0-beta.18
532
+
533
+ ## 0.1.0-beta.17
534
+
535
+ ### Patch Changes
536
+
537
+ - Updated dependencies:
538
+ - @mastra/client-js@1.0.0-beta.17
539
+
540
+ ## 0.1.0-beta.16
541
+
542
+ ### Patch Changes
543
+
544
+ - Updated dependencies [[`6cbb549`](https://github.com/mastra-ai/mastra/commit/6cbb549475201a2fbf158f0fd7323f6495f46d08)]:
545
+ - @mastra/client-js@1.0.0-beta.16
546
+
547
+ ## 0.1.0-beta.15
548
+
549
+ ### Minor Changes
550
+
551
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
552
+
553
+ ## What changed
554
+
555
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
556
+
557
+ **Before:**
558
+
559
+ ```typescript
560
+ // Old span structure
561
+ span.agentId; // 'my-agent'
562
+ span.toolId; // undefined
563
+ span.workflowId; // undefined
564
+ ```
565
+
566
+ **After:**
567
+
568
+ ```typescript
569
+ // New span structure
570
+ span.entityType; // EntityType.AGENT
571
+ span.entityId; // 'my-agent'
572
+ span.entityName; // 'My Agent'
573
+ ```
574
+
575
+ ## New `listTraces()` API
576
+
577
+ Query traces with filtering, pagination, and sorting:
578
+
579
+ ```typescript
580
+ const { spans, pagination } = await storage.listTraces({
581
+ filters: {
582
+ entityType: EntityType.AGENT,
583
+ entityId: 'my-agent',
584
+ userId: 'user-123',
585
+ environment: 'production',
586
+ status: TraceStatus.SUCCESS,
587
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
588
+ },
589
+ pagination: { page: 0, perPage: 50 },
590
+ orderBy: { field: 'startedAt', direction: 'DESC' },
591
+ });
592
+ ```
593
+
594
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
595
+
596
+ ## New retrieval methods
597
+ - `getSpan({ traceId, spanId })` - Get a single span
598
+ - `getRootSpan({ traceId })` - Get the root span of a trace
599
+ - `getTrace({ traceId })` - Get all spans for a trace
600
+
601
+ ## Backward compatibility
602
+
603
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
604
+
605
+ ## Migration
606
+
607
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
608
+
609
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
610
+
611
+ ### Patch Changes
612
+
613
+ - Updated dependencies [[`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`632fdb8`](https://github.com/mastra-ai/mastra/commit/632fdb8b3cd9ff6f90399256d526db439fc1758b), [`184f01d`](https://github.com/mastra-ai/mastra/commit/184f01d1f534ec0be9703d3996f2e088b4a560eb)]:
614
+ - @mastra/client-js@1.0.0-beta.15
99
615
 
100
616
  ## 0.1.0-beta.14
101
617