@mastra/react 0.1.0-beta.9 → 0.1.1
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 +698 -1
- package/dist/chunk-55VPMN3N-Ax1F4Y75.js +249 -0
- package/dist/chunk-55VPMN3N-Ax1F4Y75.js.map +1 -0
- package/dist/chunk-55VPMN3N-BHqoDkCq.cjs +251 -0
- package/dist/chunk-55VPMN3N-BHqoDkCq.cjs.map +1 -0
- package/dist/index-BaK_Y6TP.cjs +185 -0
- package/dist/index-BaK_Y6TP.cjs.map +1 -0
- package/dist/index-C1OzXW5i.js +180 -0
- package/dist/index-C1OzXW5i.js.map +1 -0
- package/dist/index-ChvWx-iU.cjs +20711 -0
- package/dist/index-ChvWx-iU.cjs.map +1 -0
- package/dist/index-D3JtF_Zl.js +20628 -0
- package/dist/index-D3JtF_Zl.js.map +1 -0
- package/dist/index.cjs +65 -1878
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1818
- package/dist/index.js.map +1 -1
- package/dist/src/agent/hooks.d.ts +9 -0
- package/dist/src/lib/ai-sdk/types.d.ts +78 -3
- package/dist/token-6GSAFR2W-SPYPLMBM-CWoxKwfk.cjs +64 -0
- package/dist/token-6GSAFR2W-SPYPLMBM-CWoxKwfk.cjs.map +1 -0
- package/dist/token-6GSAFR2W-SPYPLMBM-ChURikIE.js +60 -0
- package/dist/token-6GSAFR2W-SPYPLMBM-ChURikIE.js.map +1 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB-BU9ZxL1w.cjs +11 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB-BU9ZxL1w.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB-hEay2AHp.js +7 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB-hEay2AHp.js.map +1 -0
- package/package.json +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,701 @@
|
|
|
1
|
-
# @mastra/react
|
|
1
|
+
# @mastra/react
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @mastra/client-js@1.0.1
|
|
9
|
+
|
|
10
|
+
## 0.1.1-alpha.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies:
|
|
15
|
+
- @mastra/client-js@1.0.1-alpha.0
|
|
16
|
+
|
|
17
|
+
## 0.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- Added human-in-the-loop (HITL) tool approval support for `generate()` method. ([#12056](https://github.com/mastra-ai/mastra/pull/12056))
|
|
22
|
+
|
|
23
|
+
**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.
|
|
24
|
+
|
|
25
|
+
Previously, tool approval with `requireToolApproval` only worked with `stream()`. Now you can use the same approval flow with `generate()` for non-streaming use cases.
|
|
26
|
+
|
|
27
|
+
**Using tool approval with generate()**
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const output = await agent.generate('Find user John', {
|
|
31
|
+
requireToolApproval: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Check if a tool is waiting for approval
|
|
35
|
+
if (output.finishReason === 'suspended') {
|
|
36
|
+
console.log('Tool requires approval:', output.suspendPayload.toolName);
|
|
37
|
+
|
|
38
|
+
// Approve the tool call
|
|
39
|
+
const result = await agent.approveToolCallGenerate({
|
|
40
|
+
runId: output.runId,
|
|
41
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
console.log(result.text);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Declining a tool call**
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
if (output.finishReason === 'suspended') {
|
|
52
|
+
const result = await agent.declineToolCallGenerate({
|
|
53
|
+
runId: output.runId,
|
|
54
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**New methods added:**
|
|
60
|
+
- `agent.approveToolCallGenerate({ runId, toolCallId })` - Approves a pending tool call and returns the complete result
|
|
61
|
+
- `agent.declineToolCallGenerate({ runId, toolCallId })` - Declines a pending tool call and returns the complete result
|
|
62
|
+
|
|
63
|
+
**Server routes added:**
|
|
64
|
+
- `POST /api/agents/:agentId/approve-tool-call-generate`
|
|
65
|
+
- `POST /api/agents/:agentId/decline-tool-call-generate`
|
|
66
|
+
|
|
67
|
+
The playground UI now also supports tool approval when using generate mode.
|
|
68
|
+
|
|
69
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
70
|
+
|
|
71
|
+
- **Fixed:** Align `Agent.network` with core and update `@mastra/react` network usage. ([#12015](https://github.com/mastra-ai/mastra/pull/12015))
|
|
72
|
+
|
|
73
|
+
- Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
|
|
74
|
+
|
|
75
|
+
- Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
|
|
76
|
+
|
|
77
|
+
## What changed
|
|
78
|
+
|
|
79
|
+
Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
|
|
80
|
+
|
|
81
|
+
**Before:**
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Old span structure
|
|
85
|
+
span.agentId; // 'my-agent'
|
|
86
|
+
span.toolId; // undefined
|
|
87
|
+
span.workflowId; // undefined
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**After:**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// New span structure
|
|
94
|
+
span.entityType; // EntityType.AGENT
|
|
95
|
+
span.entityId; // 'my-agent'
|
|
96
|
+
span.entityName; // 'My Agent'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## New `listTraces()` API
|
|
100
|
+
|
|
101
|
+
Query traces with filtering, pagination, and sorting:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const { spans, pagination } = await storage.listTraces({
|
|
105
|
+
filters: {
|
|
106
|
+
entityType: EntityType.AGENT,
|
|
107
|
+
entityId: 'my-agent',
|
|
108
|
+
userId: 'user-123',
|
|
109
|
+
environment: 'production',
|
|
110
|
+
status: TraceStatus.SUCCESS,
|
|
111
|
+
startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
|
|
112
|
+
},
|
|
113
|
+
pagination: { page: 0, perPage: 50 },
|
|
114
|
+
orderBy: { field: 'startedAt', direction: 'DESC' },
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**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`.
|
|
119
|
+
|
|
120
|
+
## New retrieval methods
|
|
121
|
+
- `getSpan({ traceId, spanId })` - Get a single span
|
|
122
|
+
- `getRootSpan({ traceId })` - Get the root span of a trace
|
|
123
|
+
- `getTrace({ traceId })` - Get all spans for a trace
|
|
124
|
+
|
|
125
|
+
## Backward compatibility
|
|
126
|
+
|
|
127
|
+
The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
|
|
128
|
+
|
|
129
|
+
## Migration
|
|
130
|
+
|
|
131
|
+
**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`.
|
|
132
|
+
|
|
133
|
+
**No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
|
|
134
|
+
|
|
135
|
+
- Renamed `MastraMessageV2` to `MastraDBMessage` ([#9255](https://github.com/mastra-ai/mastra/pull/9255))
|
|
136
|
+
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
|
|
137
|
+
|
|
138
|
+
- Fix "MessagePartRuntime is not available" error when chatting with agents in Studio playground by replacing deprecated `useMessagePart` hook with `useAssistantState` ([#11039](https://github.com/mastra-ai/mastra/pull/11039))
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- Remove redundant toolCalls from network agent finalResult ([#11189](https://github.com/mastra-ai/mastra/pull/11189))
|
|
143
|
+
|
|
144
|
+
The network agent's `finalResult` was storing `toolCalls` separately even though all tool call information is already present in the `messages` array (as `tool-call` and `tool-result` type messages). This caused significant token waste since the routing agent reads this data from memory on every iteration.
|
|
145
|
+
|
|
146
|
+
**Before:** `finalResult: { text, toolCalls, messages }`
|
|
147
|
+
**After:** `finalResult: { text, messages }`
|
|
148
|
+
|
|
149
|
+
+**Migration:** If you were accessing `finalResult.toolCalls`, retrieve tool calls from `finalResult.messages` by filtering for messages with `type: 'tool-call'`.
|
|
150
|
+
|
|
151
|
+
Updated `@mastra/react` to extract tool calls directly from the `messages` array instead of the removed `toolCalls` field when resolving initial messages from memory.
|
|
152
|
+
|
|
153
|
+
Fixes #11059
|
|
154
|
+
|
|
155
|
+
- Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
|
|
156
|
+
|
|
157
|
+
The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const agent = new Agent({
|
|
161
|
+
//...agent information,
|
|
162
|
+
defaultAgentOptions: {
|
|
163
|
+
autoResumeSuspendedTools: true,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- 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))
|
|
169
|
+
|
|
170
|
+
### Breaking Changes
|
|
171
|
+
|
|
172
|
+
#### `@mastra/core`
|
|
173
|
+
|
|
174
|
+
The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
// Before
|
|
178
|
+
await agent.stream('Hello', {
|
|
179
|
+
threadId: 'thread-123',
|
|
180
|
+
resourceId: 'user-456',
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// After
|
|
184
|
+
await agent.stream('Hello', {
|
|
185
|
+
memory: {
|
|
186
|
+
thread: 'thread-123',
|
|
187
|
+
resource: 'user-456',
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### `@mastra/server`
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
#### `@mastra/react`
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
#### `@mastra/client-js`
|
|
201
|
+
|
|
202
|
+
When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
const agent = client.getAgent('my-agent');
|
|
206
|
+
|
|
207
|
+
// Before
|
|
208
|
+
await agent.generate([...], {
|
|
209
|
+
threadId: 'thread-123',
|
|
210
|
+
resourceId: 'user-456',
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// After
|
|
214
|
+
await agent.generate([...], {
|
|
215
|
+
memory: {
|
|
216
|
+
thread: 'thread-123',
|
|
217
|
+
resource: 'user-456',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
- Adjust the types to accept tracingOptions ([#10742](https://github.com/mastra-ai/mastra/pull/10742))
|
|
223
|
+
|
|
224
|
+
- Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
|
|
225
|
+
- Add suspend/resume capabilities to agent network
|
|
226
|
+
- Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
|
|
227
|
+
|
|
228
|
+
`agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
|
|
229
|
+
|
|
230
|
+
- Fix TypeScript errors during build declaration generation ([#11682](https://github.com/mastra-ai/mastra/pull/11682))
|
|
231
|
+
|
|
232
|
+
Updated test file `toUIMessage.test.ts` to match current `@mastra/core` types:
|
|
233
|
+
- Changed `error` property from string to `Error` object (per `StepFailure` type)
|
|
234
|
+
- Added missing `resumeSchema` property to `tool-call-approval` payloads (per `ToolCallApprovalPayload` type)
|
|
235
|
+
- Added `zod` as peer/dev dependency for test type support
|
|
236
|
+
|
|
237
|
+
- Fix text parts incorrectly merging across tool calls ([#11783](https://github.com/mastra-ai/mastra/pull/11783))
|
|
238
|
+
|
|
239
|
+
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.
|
|
240
|
+
|
|
241
|
+
Fixes #11577
|
|
242
|
+
|
|
243
|
+
- Configurable resourceId in react useChat ([#10461](https://github.com/mastra-ai/mastra/pull/10461))
|
|
244
|
+
|
|
245
|
+
- Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
|
|
246
|
+
|
|
247
|
+
- 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. ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
248
|
+
|
|
249
|
+
**Backend changes (@mastra/core):**
|
|
250
|
+
- Add assistant messages to messageList immediately after LLM execution
|
|
251
|
+
- Flush messages synchronously before suspension to persist state
|
|
252
|
+
- Create thread if it doesn't exist before flushing
|
|
253
|
+
- Add metadata helpers to persist and remove tool approval state
|
|
254
|
+
- Pass saveQueueManager and memory context through workflow for immediate persistence
|
|
255
|
+
|
|
256
|
+
**Frontend changes (@mastra/react):**
|
|
257
|
+
- Extract runId from pending approvals to enable resumption after refresh
|
|
258
|
+
- Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
|
|
259
|
+
- Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
|
|
260
|
+
- Change runId from hardcoded `agentId` to unique `uuid()`
|
|
261
|
+
|
|
262
|
+
**UI changes (@mastra/playground-ui):**
|
|
263
|
+
- Handle tool calls awaiting approval in message initialization
|
|
264
|
+
- Convert approval metadata format when loading initial messages
|
|
265
|
+
|
|
266
|
+
Fixes #9745, #9906
|
|
267
|
+
|
|
268
|
+
- Fixed compatibility with updated `@mastra/client-js` generate and stream API signatures ([#12011](https://github.com/mastra-ai/mastra/pull/12011))
|
|
269
|
+
|
|
270
|
+
- Fixed agent network not returning text response when routing agent handles requests without delegation. ([#11497](https://github.com/mastra-ai/mastra/pull/11497))
|
|
271
|
+
|
|
272
|
+
**What changed:**
|
|
273
|
+
- 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
|
|
274
|
+
- Added fallback in transformers to ensure text is always returned even if core events are missing
|
|
275
|
+
|
|
276
|
+
**Why this matters:**
|
|
277
|
+
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.
|
|
278
|
+
|
|
279
|
+
Fixes #11219
|
|
280
|
+
|
|
281
|
+
- Fix multi modal in react sdk ([#9373](https://github.com/mastra-ai/mastra/pull/9373))
|
|
282
|
+
|
|
283
|
+
- 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))
|
|
284
|
+
|
|
285
|
+
- 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))
|
|
286
|
+
|
|
287
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
const run = await workflow.createRun();
|
|
291
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
292
|
+
|
|
293
|
+
if (result.status === 'tripwire') {
|
|
294
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
295
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
296
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
301
|
+
|
|
302
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
303
|
+
|
|
304
|
+
- - Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
|
|
305
|
+
- Data chunks are now saved to message storage so they survive page refreshes
|
|
306
|
+
- Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
|
|
307
|
+
- Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
|
|
308
|
+
- Update related `@assistant-ui/*` packages for compatibility
|
|
309
|
+
- 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)]:
|
|
310
|
+
- @mastra/client-js@1.0.0
|
|
311
|
+
|
|
312
|
+
## 0.1.0-beta.27
|
|
313
|
+
|
|
314
|
+
### Patch Changes
|
|
315
|
+
|
|
316
|
+
- Updated dependencies:
|
|
317
|
+
- @mastra/client-js@1.0.0-beta.27
|
|
318
|
+
|
|
319
|
+
## 0.1.0-beta.26
|
|
320
|
+
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac)]:
|
|
324
|
+
- @mastra/client-js@1.0.0-beta.26
|
|
325
|
+
|
|
326
|
+
## 0.1.0-beta.25
|
|
327
|
+
|
|
328
|
+
### Minor Changes
|
|
329
|
+
|
|
330
|
+
- Added human-in-the-loop (HITL) tool approval support for `generate()` method. ([#12056](https://github.com/mastra-ai/mastra/pull/12056))
|
|
331
|
+
|
|
332
|
+
**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.
|
|
333
|
+
|
|
334
|
+
Previously, tool approval with `requireToolApproval` only worked with `stream()`. Now you can use the same approval flow with `generate()` for non-streaming use cases.
|
|
335
|
+
|
|
336
|
+
**Using tool approval with generate()**
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
const output = await agent.generate('Find user John', {
|
|
340
|
+
requireToolApproval: true,
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Check if a tool is waiting for approval
|
|
344
|
+
if (output.finishReason === 'suspended') {
|
|
345
|
+
console.log('Tool requires approval:', output.suspendPayload.toolName);
|
|
346
|
+
|
|
347
|
+
// Approve the tool call
|
|
348
|
+
const result = await agent.approveToolCallGenerate({
|
|
349
|
+
runId: output.runId,
|
|
350
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
console.log(result.text);
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Declining a tool call**
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
if (output.finishReason === 'suspended') {
|
|
361
|
+
const result = await agent.declineToolCallGenerate({
|
|
362
|
+
runId: output.runId,
|
|
363
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**New methods added:**
|
|
369
|
+
- `agent.approveToolCallGenerate({ runId, toolCallId })` - Approves a pending tool call and returns the complete result
|
|
370
|
+
- `agent.declineToolCallGenerate({ runId, toolCallId })` - Declines a pending tool call and returns the complete result
|
|
371
|
+
|
|
372
|
+
**Server routes added:**
|
|
373
|
+
- `POST /api/agents/:agentId/approve-tool-call-generate`
|
|
374
|
+
- `POST /api/agents/:agentId/decline-tool-call-generate`
|
|
375
|
+
|
|
376
|
+
The playground UI now also supports tool approval when using generate mode.
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- 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)]:
|
|
381
|
+
- @mastra/client-js@1.0.0-beta.25
|
|
382
|
+
|
|
383
|
+
## 0.1.0-beta.23
|
|
384
|
+
|
|
385
|
+
### Major Changes
|
|
386
|
+
|
|
387
|
+
- **Fixed:** Align `Agent.network` with core and update `@mastra/react` network usage. ([#12015](https://github.com/mastra-ai/mastra/pull/12015))
|
|
388
|
+
|
|
389
|
+
### Patch Changes
|
|
390
|
+
|
|
391
|
+
- Fixed compatibility with updated `@mastra/client-js` generate and stream API signatures ([#12011](https://github.com/mastra-ai/mastra/pull/12011))
|
|
392
|
+
|
|
393
|
+
- Updated dependencies [[`461e448`](https://github.com/mastra-ai/mastra/commit/461e448852fe999506a6046d50b1efc27d8aa378)]:
|
|
394
|
+
- @mastra/client-js@1.0.0-beta.24
|
|
395
|
+
|
|
396
|
+
## 0.1.0-beta.23
|
|
397
|
+
|
|
398
|
+
### Patch Changes
|
|
399
|
+
|
|
400
|
+
- Updated dependencies:
|
|
401
|
+
- @mastra/client-js@1.0.0-beta.23
|
|
402
|
+
|
|
403
|
+
## 0.1.0-beta.22
|
|
404
|
+
|
|
405
|
+
### Patch Changes
|
|
406
|
+
|
|
407
|
+
- 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))
|
|
408
|
+
|
|
409
|
+
### Breaking Changes
|
|
410
|
+
|
|
411
|
+
#### `@mastra/core`
|
|
412
|
+
|
|
413
|
+
The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
|
|
414
|
+
|
|
415
|
+
```ts
|
|
416
|
+
// Before
|
|
417
|
+
await agent.stream('Hello', {
|
|
418
|
+
threadId: 'thread-123',
|
|
419
|
+
resourceId: 'user-456',
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// After
|
|
423
|
+
await agent.stream('Hello', {
|
|
424
|
+
memory: {
|
|
425
|
+
thread: 'thread-123',
|
|
426
|
+
resource: 'user-456',
|
|
427
|
+
},
|
|
428
|
+
});
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
#### `@mastra/server`
|
|
432
|
+
|
|
433
|
+
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.
|
|
434
|
+
|
|
435
|
+
#### `@mastra/react`
|
|
436
|
+
|
|
437
|
+
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.
|
|
438
|
+
|
|
439
|
+
#### `@mastra/client-js`
|
|
440
|
+
|
|
441
|
+
When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
|
|
442
|
+
|
|
443
|
+
```ts
|
|
444
|
+
const agent = client.getAgent('my-agent');
|
|
445
|
+
|
|
446
|
+
// Before
|
|
447
|
+
await agent.generate({
|
|
448
|
+
messages: [...],
|
|
449
|
+
threadId: 'thread-123',
|
|
450
|
+
resourceId: 'user-456',
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// After
|
|
454
|
+
await agent.generate({
|
|
455
|
+
messages: [...],
|
|
456
|
+
memory: {
|
|
457
|
+
thread: 'thread-123',
|
|
458
|
+
resource: 'user-456',
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
- Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
|
|
464
|
+
- Add suspend/resume capabilities to agent network
|
|
465
|
+
- Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
|
|
466
|
+
|
|
467
|
+
`agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
|
|
468
|
+
|
|
469
|
+
- Fix text parts incorrectly merging across tool calls ([#11783](https://github.com/mastra-ai/mastra/pull/11783))
|
|
470
|
+
|
|
471
|
+
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.
|
|
472
|
+
|
|
473
|
+
Fixes #11577
|
|
474
|
+
|
|
475
|
+
- 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)]:
|
|
476
|
+
- @mastra/client-js@1.0.0-beta.22
|
|
477
|
+
|
|
478
|
+
## 0.1.0-beta.21
|
|
479
|
+
|
|
480
|
+
### Patch Changes
|
|
481
|
+
|
|
482
|
+
- Updated dependencies:
|
|
483
|
+
- @mastra/client-js@1.0.0-beta.21
|
|
484
|
+
|
|
485
|
+
## 0.1.0-beta.20
|
|
486
|
+
|
|
487
|
+
### Patch Changes
|
|
488
|
+
|
|
489
|
+
- Fix TypeScript errors during build declaration generation ([#11682](https://github.com/mastra-ai/mastra/pull/11682))
|
|
490
|
+
|
|
491
|
+
Updated test file `toUIMessage.test.ts` to match current `@mastra/core` types:
|
|
492
|
+
- Changed `error` property from string to `Error` object (per `StepFailure` type)
|
|
493
|
+
- Added missing `resumeSchema` property to `tool-call-approval` payloads (per `ToolCallApprovalPayload` type)
|
|
494
|
+
- Added `zod` as peer/dev dependency for test type support
|
|
495
|
+
|
|
496
|
+
- Fixed agent network not returning text response when routing agent handles requests without delegation. ([#11497](https://github.com/mastra-ai/mastra/pull/11497))
|
|
497
|
+
|
|
498
|
+
**What changed:**
|
|
499
|
+
- 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
|
|
500
|
+
- Added fallback in transformers to ensure text is always returned even if core events are missing
|
|
501
|
+
|
|
502
|
+
**Why this matters:**
|
|
503
|
+
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.
|
|
504
|
+
|
|
505
|
+
Fixes #11219
|
|
506
|
+
|
|
507
|
+
- 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))
|
|
508
|
+
|
|
509
|
+
- 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)]:
|
|
510
|
+
- @mastra/client-js@1.0.0-beta.20
|
|
511
|
+
|
|
512
|
+
## 0.1.0-beta.19
|
|
513
|
+
|
|
514
|
+
### Patch Changes
|
|
515
|
+
|
|
516
|
+
- Updated dependencies:
|
|
517
|
+
- @mastra/client-js@1.0.0-beta.19
|
|
518
|
+
|
|
519
|
+
## 0.1.0-beta.18
|
|
520
|
+
|
|
521
|
+
### Patch Changes
|
|
522
|
+
|
|
523
|
+
- Updated dependencies:
|
|
524
|
+
- @mastra/client-js@1.0.0-beta.18
|
|
525
|
+
|
|
526
|
+
## 0.1.0-beta.17
|
|
527
|
+
|
|
528
|
+
### Patch Changes
|
|
529
|
+
|
|
530
|
+
- Updated dependencies:
|
|
531
|
+
- @mastra/client-js@1.0.0-beta.17
|
|
532
|
+
|
|
533
|
+
## 0.1.0-beta.16
|
|
534
|
+
|
|
535
|
+
### Patch Changes
|
|
536
|
+
|
|
537
|
+
- Updated dependencies [[`6cbb549`](https://github.com/mastra-ai/mastra/commit/6cbb549475201a2fbf158f0fd7323f6495f46d08)]:
|
|
538
|
+
- @mastra/client-js@1.0.0-beta.16
|
|
539
|
+
|
|
540
|
+
## 0.1.0-beta.15
|
|
541
|
+
|
|
542
|
+
### Minor Changes
|
|
543
|
+
|
|
544
|
+
- Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
|
|
545
|
+
|
|
546
|
+
## What changed
|
|
547
|
+
|
|
548
|
+
Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
|
|
549
|
+
|
|
550
|
+
**Before:**
|
|
551
|
+
|
|
552
|
+
```typescript
|
|
553
|
+
// Old span structure
|
|
554
|
+
span.agentId; // 'my-agent'
|
|
555
|
+
span.toolId; // undefined
|
|
556
|
+
span.workflowId; // undefined
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**After:**
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
// New span structure
|
|
563
|
+
span.entityType; // EntityType.AGENT
|
|
564
|
+
span.entityId; // 'my-agent'
|
|
565
|
+
span.entityName; // 'My Agent'
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
## New `listTraces()` API
|
|
569
|
+
|
|
570
|
+
Query traces with filtering, pagination, and sorting:
|
|
571
|
+
|
|
572
|
+
```typescript
|
|
573
|
+
const { spans, pagination } = await storage.listTraces({
|
|
574
|
+
filters: {
|
|
575
|
+
entityType: EntityType.AGENT,
|
|
576
|
+
entityId: 'my-agent',
|
|
577
|
+
userId: 'user-123',
|
|
578
|
+
environment: 'production',
|
|
579
|
+
status: TraceStatus.SUCCESS,
|
|
580
|
+
startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
|
|
581
|
+
},
|
|
582
|
+
pagination: { page: 0, perPage: 50 },
|
|
583
|
+
orderBy: { field: 'startedAt', direction: 'DESC' },
|
|
584
|
+
});
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
**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`.
|
|
588
|
+
|
|
589
|
+
## New retrieval methods
|
|
590
|
+
- `getSpan({ traceId, spanId })` - Get a single span
|
|
591
|
+
- `getRootSpan({ traceId })` - Get the root span of a trace
|
|
592
|
+
- `getTrace({ traceId })` - Get all spans for a trace
|
|
593
|
+
|
|
594
|
+
## Backward compatibility
|
|
595
|
+
|
|
596
|
+
The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
|
|
597
|
+
|
|
598
|
+
## Migration
|
|
599
|
+
|
|
600
|
+
**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`.
|
|
601
|
+
|
|
602
|
+
**No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
|
|
603
|
+
|
|
604
|
+
### Patch Changes
|
|
605
|
+
|
|
606
|
+
- 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)]:
|
|
607
|
+
- @mastra/client-js@1.0.0-beta.15
|
|
608
|
+
|
|
609
|
+
## 0.1.0-beta.14
|
|
610
|
+
|
|
611
|
+
### Patch Changes
|
|
612
|
+
|
|
613
|
+
- Updated dependencies [[`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
|
|
614
|
+
- @mastra/client-js@1.0.0-beta.14
|
|
615
|
+
|
|
616
|
+
## 0.1.0-beta.13
|
|
617
|
+
|
|
618
|
+
### Patch Changes
|
|
619
|
+
|
|
620
|
+
- Updated dependencies:
|
|
621
|
+
- @mastra/client-js@1.0.0-beta.13
|
|
622
|
+
|
|
623
|
+
## 0.1.0-beta.12
|
|
624
|
+
|
|
625
|
+
### Patch Changes
|
|
626
|
+
|
|
627
|
+
- Remove redundant toolCalls from network agent finalResult ([#11189](https://github.com/mastra-ai/mastra/pull/11189))
|
|
628
|
+
|
|
629
|
+
The network agent's `finalResult` was storing `toolCalls` separately even though all tool call information is already present in the `messages` array (as `tool-call` and `tool-result` type messages). This caused significant token waste since the routing agent reads this data from memory on every iteration.
|
|
630
|
+
|
|
631
|
+
**Before:** `finalResult: { text, toolCalls, messages }`
|
|
632
|
+
**After:** `finalResult: { text, messages }`
|
|
633
|
+
|
|
634
|
+
+**Migration:** If you were accessing `finalResult.toolCalls`, retrieve tool calls from `finalResult.messages` by filtering for messages with `type: 'tool-call'`.
|
|
635
|
+
|
|
636
|
+
Updated `@mastra/react` to extract tool calls directly from the `messages` array instead of the removed `toolCalls` field when resolving initial messages from memory.
|
|
637
|
+
|
|
638
|
+
Fixes #11059
|
|
639
|
+
|
|
640
|
+
- Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
|
|
641
|
+
|
|
642
|
+
The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
|
|
643
|
+
|
|
644
|
+
```typescript
|
|
645
|
+
const agent = new Agent({
|
|
646
|
+
//...agent information,
|
|
647
|
+
defaultAgentOptions: {
|
|
648
|
+
autoResumeSuspendedTools: true,
|
|
649
|
+
},
|
|
650
|
+
});
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
- Updated dependencies [[`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`1b85674`](https://github.com/mastra-ai/mastra/commit/1b85674123708d9b85834dccc9eae601a9d0891c), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`439eaf7`](https://github.com/mastra-ai/mastra/commit/439eaf75447809b05e326666675a4dcbf9c334ce)]:
|
|
654
|
+
- @mastra/client-js@1.0.0-beta.12
|
|
655
|
+
|
|
656
|
+
## 0.1.0-beta.11
|
|
657
|
+
|
|
658
|
+
### Patch Changes
|
|
659
|
+
|
|
660
|
+
- 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))
|
|
661
|
+
|
|
662
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
663
|
+
|
|
664
|
+
```typescript showLineNumbers copy
|
|
665
|
+
const run = await workflow.createRun();
|
|
666
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
667
|
+
|
|
668
|
+
if (result.status === 'tripwire') {
|
|
669
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
670
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
671
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
672
|
+
}
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
676
|
+
|
|
677
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
678
|
+
|
|
679
|
+
- Updated dependencies [[`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
|
|
680
|
+
- @mastra/client-js@1.0.0-beta.11
|
|
681
|
+
|
|
682
|
+
## 0.1.0-beta.10
|
|
683
|
+
|
|
684
|
+
### Minor Changes
|
|
685
|
+
|
|
686
|
+
- Fix "MessagePartRuntime is not available" error when chatting with agents in Studio playground by replacing deprecated `useMessagePart` hook with `useAssistantState` ([#11039](https://github.com/mastra-ai/mastra/pull/11039))
|
|
687
|
+
|
|
688
|
+
### Patch Changes
|
|
689
|
+
|
|
690
|
+
- fix: persist data-\* chunks from writer.custom() to memory storage ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
|
|
691
|
+
- Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools
|
|
692
|
+
- Data chunks are now saved to message storage so they survive page refreshes
|
|
693
|
+
- Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
|
|
694
|
+
- Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
|
|
695
|
+
- Update related `@assistant-ui/*` packages for compatibility
|
|
696
|
+
|
|
697
|
+
- Updated dependencies [[`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d)]:
|
|
698
|
+
- @mastra/client-js@1.0.0-beta.10
|
|
2
699
|
|
|
3
700
|
## 0.1.0-beta.9
|
|
4
701
|
|