@mastra/mcp-docs-server 1.0.0-beta.14 → 1.0.0-beta.15
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/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +51 -51
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +76 -76
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +218 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +308 -308
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +128 -128
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +235 -235
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +81 -81
- package/.docs/organized/changelogs/%40mastra%2Freact.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +125 -125
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +195 -195
- package/.docs/organized/changelogs/create-mastra.md +11 -11
- package/.docs/organized/changelogs/mastra.md +40 -40
- package/.docs/organized/code-examples/agent-v6.md +70 -11
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +8 -3
- package/.docs/raw/deployment/overview.mdx +3 -4
- package/.docs/raw/deployment/workflow-runners.mdx +14 -0
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/deployment/inngest.mdx +198 -140
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +11 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +41 -0
- package/.docs/raw/mastra-cloud/deployment.mdx +39 -0
- package/.docs/raw/mastra-cloud/observability.mdx +9 -15
- package/.docs/raw/mastra-cloud/overview.mdx +14 -44
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- package/.docs/raw/reference/logging/pino-logger.mdx +1 -1
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +39 -18
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +4 -2
- package/.docs/raw/reference/storage/lance.mdx +3 -2
- package/.docs/raw/reference/storage/libsql.mdx +5 -2
- package/.docs/raw/reference/storage/mongodb.mdx +4 -2
- package/.docs/raw/reference/storage/mssql.mdx +4 -2
- package/.docs/raw/reference/storage/postgresql.mdx +4 -2
- package/.docs/raw/voice/overview.mdx +1 -1
- package/.docs/raw/workflows/overview.mdx +1 -1
- package/.docs/raw/workflows/snapshots.mdx +2 -1
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -96
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -106
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -362
|
@@ -1,5 +1,312 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.15
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Introduce StorageDomain base class for composite storage support ([#11249](https://github.com/mastra-ai/mastra/pull/11249))
|
|
8
|
+
|
|
9
|
+
Storage adapters now use a domain-based architecture where each domain (memory, workflows, scores, observability, agents) extends a `StorageDomain` base class with `init()` and `dangerouslyClearAll()` methods.
|
|
10
|
+
|
|
11
|
+
**Key changes:**
|
|
12
|
+
- Add `StorageDomain` abstract base class that all domain storage classes extend
|
|
13
|
+
- Add `InMemoryDB` class for shared state across in-memory domain implementations
|
|
14
|
+
- All storage domains now implement `dangerouslyClearAll()` for test cleanup
|
|
15
|
+
- Remove `operations` from public `StorageDomains` type (now internal to each adapter)
|
|
16
|
+
- Add flexible client/config patterns - domains accept either an existing database client or config to create one internally
|
|
17
|
+
|
|
18
|
+
**Why this matters:**
|
|
19
|
+
|
|
20
|
+
This enables composite storage where you can use different database adapters per domain:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Mastra } from '@mastra/core';
|
|
24
|
+
import { PostgresStore } from '@mastra/pg';
|
|
25
|
+
import { ClickhouseStore } from '@mastra/clickhouse';
|
|
26
|
+
|
|
27
|
+
// Use Postgres for most domains but Clickhouse for observability
|
|
28
|
+
const mastra = new Mastra({
|
|
29
|
+
storage: new PostgresStore({
|
|
30
|
+
connectionString: 'postgres://...',
|
|
31
|
+
}),
|
|
32
|
+
// Future: override specific domains
|
|
33
|
+
// observability: new ClickhouseStore({ ... }).getStore('observability'),
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Standalone domain usage:**
|
|
38
|
+
|
|
39
|
+
Domains can now be used independently with flexible configuration:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { MemoryLibSQL } from '@mastra/libsql/memory';
|
|
43
|
+
|
|
44
|
+
// Option 1: Pass config to create client internally
|
|
45
|
+
const memory = new MemoryLibSQL({
|
|
46
|
+
url: 'file:./local.db',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Option 2: Pass existing client for shared connections
|
|
50
|
+
import { createClient } from '@libsql/client';
|
|
51
|
+
const client = createClient({ url: 'file:./local.db' });
|
|
52
|
+
const memory = new MemoryLibSQL({ client });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Breaking changes:**
|
|
56
|
+
- `StorageDomains` type no longer includes `operations` - access via `getStore()` instead
|
|
57
|
+
- Domain base classes now require implementing `dangerouslyClearAll()` method
|
|
58
|
+
|
|
59
|
+
- Refactor storage architecture to use domain-specific stores via `getStore()` pattern ([#11361](https://github.com/mastra-ai/mastra/pull/11361))
|
|
60
|
+
|
|
61
|
+
### Summary
|
|
62
|
+
|
|
63
|
+
This release introduces a new storage architecture that replaces passthrough methods on `MastraStorage` with domain-specific storage interfaces accessed via `getStore()`. This change reduces code duplication across storage adapters and provides a cleaner, more modular API.
|
|
64
|
+
|
|
65
|
+
### Migration Guide
|
|
66
|
+
|
|
67
|
+
All direct method calls on storage instances should be updated to use `getStore()`:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Before
|
|
71
|
+
const thread = await storage.getThreadById({ threadId });
|
|
72
|
+
await storage.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
73
|
+
await storage.createSpan(span);
|
|
74
|
+
|
|
75
|
+
// After
|
|
76
|
+
const memory = await storage.getStore('memory');
|
|
77
|
+
const thread = await memory?.getThreadById({ threadId });
|
|
78
|
+
|
|
79
|
+
const workflows = await storage.getStore('workflows');
|
|
80
|
+
await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
81
|
+
|
|
82
|
+
const observability = await storage.getStore('observability');
|
|
83
|
+
await observability?.createSpan(span);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Available Domains
|
|
87
|
+
- **`memory`**: Thread and message operations (`getThreadById`, `saveThread`, `saveMessages`, etc.)
|
|
88
|
+
- **`workflows`**: Workflow state persistence (`persistWorkflowSnapshot`, `loadWorkflowSnapshot`, `getWorkflowRunById`, etc.)
|
|
89
|
+
- **`scores`**: Evaluation scores (`saveScore`, `listScoresByScorerId`, etc.)
|
|
90
|
+
- **`observability`**: Tracing and spans (`createSpan`, `updateSpan`, `getTrace`, etc.)
|
|
91
|
+
- **`agents`**: Stored agent configurations (`createAgent`, `getAgentById`, `listAgents`, etc.)
|
|
92
|
+
|
|
93
|
+
### Breaking Changes
|
|
94
|
+
- Passthrough methods have been removed from `MastraStorage` base class
|
|
95
|
+
- All storage adapters now require accessing domains via `getStore()`
|
|
96
|
+
- The `stores` property on storage instances is now the canonical way to access domain storage
|
|
97
|
+
|
|
98
|
+
### Internal Changes
|
|
99
|
+
- Each storage adapter now initializes domain-specific stores in its constructor
|
|
100
|
+
- Domain stores share database connections and handle their own table initialization
|
|
101
|
+
|
|
102
|
+
- Add support for AI SDK v6 ToolLoopAgent in Mastra ([#11254](https://github.com/mastra-ai/mastra/pull/11254))
|
|
103
|
+
|
|
104
|
+
You can now pass an AI SDK v6 `ToolLoopAgent` directly to Mastra's agents configuration. The agent will be automatically converted to a Mastra Agent while preserving all ToolLoopAgent lifecycle hooks:
|
|
105
|
+
- `prepareCall` - Called once at the start of generate/stream
|
|
106
|
+
- `prepareStep` - Called before each step in the agentic loop
|
|
107
|
+
- `stopWhen` - Custom stop conditions for the loop
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { ToolLoopAgent } from 'ai';
|
|
113
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
114
|
+
|
|
115
|
+
const toolLoopAgent = new ToolLoopAgent({
|
|
116
|
+
model: openai('gpt-4o'),
|
|
117
|
+
instructions: 'You are a helpful assistant.',
|
|
118
|
+
tools: { weather: weatherTool },
|
|
119
|
+
prepareStep: async ({ stepNumber }) => {
|
|
120
|
+
if (stepNumber === 0) {
|
|
121
|
+
return { toolChoice: 'required' };
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const mastra = new Mastra({
|
|
127
|
+
agents: { toolLoopAgent },
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Use like any other Mastra agent
|
|
131
|
+
const agent = mastra.getAgent('toolLoopAgent');
|
|
132
|
+
const result = await agent.generate('What is the weather?');
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
|
|
136
|
+
|
|
137
|
+
## What changed
|
|
138
|
+
|
|
139
|
+
Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
|
|
140
|
+
|
|
141
|
+
**Before:**
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// Old span structure
|
|
145
|
+
span.agentId; // 'my-agent'
|
|
146
|
+
span.toolId; // undefined
|
|
147
|
+
span.workflowId; // undefined
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**After:**
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// New span structure
|
|
154
|
+
span.entityType; // EntityType.AGENT
|
|
155
|
+
span.entityId; // 'my-agent'
|
|
156
|
+
span.entityName; // 'My Agent'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## New `listTraces()` API
|
|
160
|
+
|
|
161
|
+
Query traces with filtering, pagination, and sorting:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
const { spans, pagination } = await storage.listTraces({
|
|
165
|
+
filters: {
|
|
166
|
+
entityType: EntityType.AGENT,
|
|
167
|
+
entityId: 'my-agent',
|
|
168
|
+
userId: 'user-123',
|
|
169
|
+
environment: 'production',
|
|
170
|
+
status: TraceStatus.SUCCESS,
|
|
171
|
+
startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
|
|
172
|
+
},
|
|
173
|
+
pagination: { page: 0, perPage: 50 },
|
|
174
|
+
orderBy: { field: 'startedAt', direction: 'DESC' },
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**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`.
|
|
179
|
+
|
|
180
|
+
## New retrieval methods
|
|
181
|
+
- `getSpan({ traceId, spanId })` - Get a single span
|
|
182
|
+
- `getRootSpan({ traceId })` - Get the root span of a trace
|
|
183
|
+
- `getTrace({ traceId })` - Get all spans for a trace
|
|
184
|
+
|
|
185
|
+
## Backward compatibility
|
|
186
|
+
|
|
187
|
+
The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
|
|
188
|
+
|
|
189
|
+
## Migration
|
|
190
|
+
|
|
191
|
+
**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`.
|
|
192
|
+
|
|
193
|
+
**No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- When calling `abort()` inside a `processInputStep` processor, the TripWire was being caught by the model retry logic instead of emitting a tripwire chunk to the stream. ([#11343](https://github.com/mastra-ai/mastra/pull/11343))
|
|
198
|
+
|
|
199
|
+
Before this fix, processors using `processInputStep` with abort would see errors like:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Error executing model gpt-4o-mini, attempt 1==== TripWire [Error]: Potentially harmful content detected
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Now the TripWire is properly handled - it emits a tripwire chunk and signals the abort correctly,
|
|
206
|
+
|
|
207
|
+
- Consolidate memory integration tests and fix working memory filtering in MessageHistory processor ([#11367](https://github.com/mastra-ai/mastra/pull/11367))
|
|
208
|
+
|
|
209
|
+
Moved `extractWorkingMemoryTags`, `removeWorkingMemoryTags`, and `extractWorkingMemoryContent` utilities from `@mastra/memory` to `@mastra/core/memory` so they can be used by the `MessageHistory` processor.
|
|
210
|
+
|
|
211
|
+
Updated `MessageHistory.filterMessagesForPersistence()` to properly filter out `updateWorkingMemory` tool invocations and strip working memory tags from text content, fixing an issue where working memory tool call arguments were polluting saved message history for v5+ models.
|
|
212
|
+
|
|
213
|
+
Also consolidated integration tests for agent-memory, working-memory, and pg-storage into shared test functions that can run against multiple model versions (v4, v5, v6).
|
|
214
|
+
|
|
215
|
+
- Add support for AI SDK's `needsApproval` in tools. ([#11388](https://github.com/mastra-ai/mastra/pull/11388))
|
|
216
|
+
|
|
217
|
+
**AI SDK tools with static approval:**
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { tool } from 'ai';
|
|
221
|
+
import { z } from 'zod';
|
|
222
|
+
|
|
223
|
+
const weatherTool = tool({
|
|
224
|
+
description: 'Get weather information',
|
|
225
|
+
inputSchema: z.object({ city: z.string() }),
|
|
226
|
+
needsApproval: true,
|
|
227
|
+
execute: async ({ city }) => {
|
|
228
|
+
return { weather: 'sunny', temp: 72 };
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**AI SDK tools with dynamic approval:**
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const paymentTool = tool({
|
|
237
|
+
description: 'Process payment',
|
|
238
|
+
inputSchema: z.object({ amount: z.number() }),
|
|
239
|
+
needsApproval: async ({ amount }) => amount > 1000,
|
|
240
|
+
execute: async ({ amount }) => {
|
|
241
|
+
return { success: true, amount };
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Mastra tools continue to work with `requireApproval`:**
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import { createTool } from '@mastra/core';
|
|
250
|
+
|
|
251
|
+
const deleteTool = createTool({
|
|
252
|
+
id: 'delete-file',
|
|
253
|
+
description: 'Delete a file',
|
|
254
|
+
requireApproval: true,
|
|
255
|
+
inputSchema: z.object({ path: z.string() }),
|
|
256
|
+
execute: async ({ path }) => {
|
|
257
|
+
return { deleted: true };
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
- Fix stopWhen type to accept AI SDK v6 StopCondition functions like `stepCountIs()` ([#11402](https://github.com/mastra-ai/mastra/pull/11402))
|
|
263
|
+
|
|
264
|
+
- Fix missing `title` field in Convex threads table schema ([#11356](https://github.com/mastra-ai/mastra/pull/11356))
|
|
265
|
+
|
|
266
|
+
The Convex schema was hardcoded and out of sync with the core `TABLE_SCHEMAS`, causing errors when creating threads:
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
Error: Failed to insert or update a document in table "mastra_threads"
|
|
270
|
+
because it does not match the schema: Object contains extra field `title`
|
|
271
|
+
that is not in the validator.
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Now the Convex schema dynamically builds from `TABLE_SCHEMAS` via a new `@mastra/core/storage/constants` export path that doesn't pull in Node.js dependencies (safe for Convex's sandboxed schema evaluation).
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
// Users can now import schema tables without Node.js dependency issues
|
|
278
|
+
import { mastraThreadsTable, mastraMessagesTable } from '@mastra/convex/schema';
|
|
279
|
+
|
|
280
|
+
export default defineSchema({
|
|
281
|
+
mastra_threads: mastraThreadsTable,
|
|
282
|
+
mastra_messages: mastraMessagesTable,
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Fixes #11319
|
|
287
|
+
|
|
288
|
+
- Added support for AI SDK v6 embedding models (specification version v3) in memory and vector modules. Fixed TypeScript error where `ModelRouterEmbeddingModel` was trying to implement a union type instead of `EmbeddingModelV2` directly. ([#11362](https://github.com/mastra-ai/mastra/pull/11362))
|
|
289
|
+
|
|
290
|
+
- fix: support gs:// and s3:// cloud storage URLs in attachmentsToParts ([#11398](https://github.com/mastra-ai/mastra/pull/11398))
|
|
291
|
+
|
|
292
|
+
- Add validation to detect when a function is passed as a tool instead of a tool object. Previously, passing a tool factory function (e.g., `tools: { myTool }` instead of `tools: { myTool: myTool() }`) would silently fail - the LLM would request tool calls but nothing would execute. Now throws a clear error with guidance on how to fix it. ([#11288](https://github.com/mastra-ai/mastra/pull/11288))
|
|
293
|
+
|
|
294
|
+
- Fix reasoning providerMetadata leaking into text parts when using memory with OpenAI reasoning models. The runState.providerOptions is now cleared after reasoning-end to prevent text parts from inheriting the reasoning's itemId. ([#11380](https://github.com/mastra-ai/mastra/pull/11380))
|
|
295
|
+
|
|
296
|
+
- Upgrade AI SDK v6 from beta to stable (6.0.1) and fix finishReason breaking change. ([#11351](https://github.com/mastra-ai/mastra/pull/11351))
|
|
297
|
+
|
|
298
|
+
AI SDK v6 stable changed finishReason from a string to an object with `unified` and `raw` properties. Added `normalizeFinishReason()` helper to handle both v5 (string) and v6 (object) formats at the stream transform layer
|
|
299
|
+
|
|
300
|
+
- Improve autoResumeSuspendedTools instruction for tool approval ([#11338](https://github.com/mastra-ai/mastra/pull/11338))
|
|
301
|
+
|
|
302
|
+
- Add debugger-like click-through UI to workflow graph ([#11350](https://github.com/mastra-ai/mastra/pull/11350))
|
|
303
|
+
|
|
304
|
+
- Add `perStep` option to workflow run methods, allowing a workflow to run just a step instead of all the workflow steps ([#11276](https://github.com/mastra-ai/mastra/pull/11276))
|
|
305
|
+
|
|
306
|
+
- Fix workflow throwing error when using .map after .foreach ([#11352](https://github.com/mastra-ai/mastra/pull/11352))
|
|
307
|
+
|
|
308
|
+
- Bump @ai-sdk/openai from 3.0.0-beta.102 to 3.0.1 ([#11377](https://github.com/mastra-ai/mastra/pull/11377))
|
|
309
|
+
|
|
3
310
|
## 1.0.0-beta.14
|
|
4
311
|
|
|
5
312
|
### Minor Changes
|
|
@@ -191,312 +498,5 @@
|
|
|
191
498
|
await updateJobStatus(result.status);
|
|
192
499
|
},
|
|
193
500
|
onError: async (errorInfo) => {
|
|
194
|
-
// Handle workflow failures
|
|
195
|
-
await logError(errorInfo.error);
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Both callbacks support sync and async functions. Callback errors are caught and logged, not propagated to the workflow result.
|
|
202
|
-
|
|
203
|
-
## 1.0.0-beta.12
|
|
204
|
-
|
|
205
|
-
### Patch Changes
|
|
206
|
-
|
|
207
|
-
- Remove redundant toolCalls from network agent finalResult ([#11189](https://github.com/mastra-ai/mastra/pull/11189))
|
|
208
|
-
|
|
209
|
-
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.
|
|
210
|
-
|
|
211
|
-
**Before:** `finalResult: { text, toolCalls, messages }`
|
|
212
|
-
**After:** `finalResult: { text, messages }`
|
|
213
|
-
|
|
214
|
-
+**Migration:** If you were accessing `finalResult.toolCalls`, retrieve tool calls from `finalResult.messages` by filtering for messages with `type: 'tool-call'`.
|
|
215
|
-
|
|
216
|
-
Updated `@mastra/react` to extract tool calls directly from the `messages` array instead of the removed `toolCalls` field when resolving initial messages from memory.
|
|
217
|
-
|
|
218
|
-
Fixes #11059
|
|
219
|
-
|
|
220
|
-
- Embed AI types to fix peerdeps mismatches ([`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808))
|
|
221
|
-
|
|
222
|
-
- Fix invalid state: Controller is already closed ([`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd))
|
|
223
|
-
|
|
224
|
-
Fixes #11005
|
|
225
|
-
|
|
226
|
-
- Fix HITL (Human-In-The-Loop) tool execution bug when mixing tools with and without execute functions. ([#11178](https://github.com/mastra-ai/mastra/pull/11178))
|
|
227
|
-
|
|
228
|
-
When an agent called multiple tools simultaneously where some had `execute` functions and others didn't (HITL tools expecting `addToolResult` from the frontend), the HITL tools would incorrectly receive `result: undefined` and be marked as "output-available" instead of "input-available". This caused the agent to continue instead of pausing for user input.
|
|
229
|
-
|
|
230
|
-
- Add resourceId to workflow routes ([#11166](https://github.com/mastra-ai/mastra/pull/11166))
|
|
231
|
-
|
|
232
|
-
- Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
|
|
233
|
-
|
|
234
|
-
The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
const agent = new Agent({
|
|
238
|
-
//...agent information,
|
|
239
|
-
defaultAgentOptions: {
|
|
240
|
-
autoResumeSuspendedTools: true,
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
- Preserve error details when thrown from workflow steps ([#10992](https://github.com/mastra-ai/mastra/pull/10992))
|
|
246
|
-
- Errors thrown in workflow steps now preserve full error details including `cause` chain and custom properties
|
|
247
|
-
- Added `SerializedError` type with proper cause chain support
|
|
248
|
-
- Added `SerializedStepResult` and `SerializedStepFailure` types for handling errors loaded from storage
|
|
249
|
-
- Enhanced `addErrorToJSON` to recursively serialize error cause chains with max depth protection
|
|
250
|
-
- Added `hydrateSerializedStepErrors` to convert serialized errors back to Error instances
|
|
251
|
-
- Fixed Inngest workflow error handling to extract original error from `NonRetriableError.cause`
|
|
252
|
-
|
|
253
|
-
- Move `@ai-sdk/azure` to devDependencies ([#10218](https://github.com/mastra-ai/mastra/pull/10218))
|
|
254
|
-
|
|
255
|
-
- Refactor internal event system from Emitter to PubSub abstraction for workflow event handling. This change replaces the EventEmitter-based event system with a pluggable PubSub interface, enabling support for distributed workflow execution backends like Inngest. Adds `close()` method to PubSub implementations for proper cleanup. ([#11052](https://github.com/mastra-ai/mastra/pull/11052))
|
|
256
|
-
|
|
257
|
-
- Add `startAsync()` method and fix Inngest duplicate workflow execution bug ([#11093](https://github.com/mastra-ai/mastra/pull/11093))
|
|
258
|
-
|
|
259
|
-
**New Feature: `startAsync()` for fire-and-forget workflow execution**
|
|
260
|
-
- Add `Run.startAsync()` to base workflow class - starts workflow in background and returns `{ runId }` immediately
|
|
261
|
-
- Add `EventedRun.startAsync()` - publishes workflow start event without subscribing for completion
|
|
262
|
-
- Add `InngestRun.startAsync()` - sends Inngest event without polling for result
|
|
263
|
-
|
|
264
|
-
**Bug Fix: Prevent duplicate Inngest workflow executions**
|
|
265
|
-
- Fix `getRuns()` to properly handle rate limits (429), empty responses, and JSON parse errors with retry logic and exponential backoff
|
|
266
|
-
- Fix `getRunOutput()` to throw `NonRetriableError` when polling fails, preventing Inngest from retrying the parent function and re-triggering the workflow
|
|
267
|
-
- Add timeout to `getRunOutput()` polling (default 5 minutes) with `NonRetriableError` on timeout
|
|
268
|
-
|
|
269
|
-
This fixes a production issue where polling failures after successful workflow completion caused Inngest to retry the parent function, which fired a new workflow event and resulted in duplicate executions (e.g., duplicate Slack messages).
|
|
270
|
-
|
|
271
|
-
- Preserve error details when thrown from workflow steps ([#10992](https://github.com/mastra-ai/mastra/pull/10992))
|
|
272
|
-
|
|
273
|
-
Workflow errors now retain custom properties like `statusCode`, `responseHeaders`, and `cause` chains. This enables error-specific recovery logic in your applications.
|
|
274
|
-
|
|
275
|
-
**Before:**
|
|
276
|
-
|
|
277
|
-
```typescript
|
|
278
|
-
const result = await workflow.execute({ input });
|
|
279
|
-
if (result.status === 'failed') {
|
|
280
|
-
// Custom error properties were lost
|
|
281
|
-
console.log(result.error); // "Step execution failed" (just a string)
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
**After:**
|
|
286
|
-
|
|
287
|
-
```typescript
|
|
288
|
-
const result = await workflow.execute({ input });
|
|
289
|
-
if (result.status === 'failed') {
|
|
290
|
-
// Custom properties are preserved
|
|
291
|
-
console.log(result.error.message); // "Step execution failed"
|
|
292
|
-
console.log(result.error.statusCode); // 429
|
|
293
|
-
console.log(result.error.cause?.name); // "RateLimitError"
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
**Type change:** `WorkflowState.error` and `WorkflowRunState.error` types changed from `string | Error` to `SerializedError`.
|
|
298
|
-
|
|
299
|
-
Other changes:
|
|
300
|
-
- Added `UpdateWorkflowStateOptions` type for workflow state updates
|
|
301
|
-
|
|
302
|
-
- Fix Zod 4 compatibility issue with structuredOutput in agent.generate() ([#11133](https://github.com/mastra-ai/mastra/pull/11133))
|
|
303
|
-
|
|
304
|
-
Users with Zod 4 installed would see `TypeError: undefined is not an object (evaluating 'def.valueType._zod')` when using `structuredOutput` with agent.generate(). This happened because ProcessorStepSchema contains `z.custom()` fields that hold user-provided Zod schemas, and the workflow validation was trying to deeply validate these schemas causing version conflicts.
|
|
305
|
-
|
|
306
|
-
The fix disables input validation for processor workflows since `z.custom()` fields are meant to pass through arbitrary types without deep validation.
|
|
307
|
-
|
|
308
|
-
- Truncate map config when too long ([#11175](https://github.com/mastra-ai/mastra/pull/11175))
|
|
309
|
-
|
|
310
|
-
- Add helpful JSDoc comments to `BundlerConfig` properties (used with `bundler` option) ([#10218](https://github.com/mastra-ai/mastra/pull/10218))
|
|
311
|
-
|
|
312
|
-
- Fixes .network() method ignores MASTRA_RESOURCE_ID_KEY from requestContext ([`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f))
|
|
313
|
-
|
|
314
|
-
- fix: make getSqlType consistent across storage adapters ([#11112](https://github.com/mastra-ai/mastra/pull/11112))
|
|
315
|
-
- PostgreSQL: use `getSqlType()` in `createTable` instead of `toUpperCase()`
|
|
316
|
-
- LibSQL: use `getSqlType()` in `createTable`, return `JSONB` for jsonb type (matches SQLite 3.45+ support)
|
|
317
|
-
- ClickHouse: use `getSqlType()` in `createTable` instead of `COLUMN_TYPES` constant, add missing types (uuid, float, boolean)
|
|
318
|
-
- Remove unused `getSqlType()` and `getDefaultValue()` from `MastraStorage` base class (all stores use `StoreOperations` versions)
|
|
319
|
-
|
|
320
|
-
- Fix workflow cancel not updating status when workflow is suspended ([#11139](https://github.com/mastra-ai/mastra/pull/11139))
|
|
321
|
-
- `Run.cancel()` now updates workflow status to 'canceled' in storage, resolving the issue where suspended workflows remained in 'suspended' status after cancellation
|
|
322
|
-
- Cancellation status is immediately persisted and reflected to observers
|
|
323
|
-
|
|
324
|
-
- What changed: ([#10998](https://github.com/mastra-ai/mastra/pull/10998))
|
|
325
|
-
|
|
326
|
-
Support for sequential tool execution was added. Tool call concurrency is now set conditionally, defaulting to 1 when sequential execution is needed (to avoid race conditions that interfere with human-in-the-loop approval during the workflow) rather than the default of 10 when concurrency is acceptable.
|
|
327
|
-
|
|
328
|
-
How it was changed:
|
|
329
|
-
|
|
330
|
-
A `sequentialExecutionRequired` constant was set to a boolean depending on whether any of the tools involved in a returned agentic execution workflow would require approval. If any tool has a 'suspendSchema' property (used for conditionally suspending execution and waiting for human input), or if they have their `requireApproval` property set to `true`, then the concurrency property used in the toolCallStep is set to 1, causing sequential execution. The old default of 10 remains otherwise.
|
|
331
|
-
|
|
332
|
-
- Fixed duplicate assistant messages appearing when using `useChat` with memory enabled. ([#11195](https://github.com/mastra-ai/mastra/pull/11195))
|
|
333
|
-
|
|
334
|
-
**What was happening:** When using `useChat` with `chatRoute` and memory, assistant messages were being duplicated in storage after multiple conversation turns. This occurred because the backend-generated message ID wasn't being sent back to `useChat`, causing ID mismatches during deduplication.
|
|
335
|
-
|
|
336
|
-
**What changed:**
|
|
337
|
-
- The backend now sends the assistant message ID in the stream's start event, so `useChat` uses the same ID as storage
|
|
338
|
-
- Custom `data-*` parts (from `writer.custom()`) are now preserved when messages contain V5 tool parts
|
|
339
|
-
|
|
340
|
-
Fixes #11091
|
|
341
|
-
|
|
342
|
-
- Updated dependencies [[`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`5a632bd`](https://github.com/mastra-ai/mastra/commit/5a632bdf7b78953b664f5e038e98d4ba5f971e47)]:
|
|
343
|
-
- @mastra/schema-compat@1.0.0-beta.3
|
|
344
|
-
- @mastra/observability@1.0.0-beta.5
|
|
345
|
-
|
|
346
|
-
## 1.0.0-beta.11
|
|
347
|
-
|
|
348
|
-
### Minor Changes
|
|
349
|
-
|
|
350
|
-
- Respect structured outputs for v2 models so tool schemas aren’t stripped ([#11038](https://github.com/mastra-ai/mastra/pull/11038))
|
|
351
|
-
|
|
352
|
-
### Patch Changes
|
|
353
|
-
|
|
354
|
-
- Fix type safety for message ordering - restrict `orderBy` to only accept `'createdAt'` field ([#11069](https://github.com/mastra-ai/mastra/pull/11069))
|
|
355
|
-
|
|
356
|
-
Messages don't have an `updatedAt` field, but the previous type allowed ordering by it, which would return empty results. This change adds compile-time type safety by making `StorageOrderBy` generic and restricting `StorageListMessagesInput.orderBy` to only accept `'createdAt'`. The API validation schemas have also been updated to reject invalid orderBy values at runtime.
|
|
357
|
-
|
|
358
|
-
- Loosen tools types in processInputStep / prepareStep. ([#11071](https://github.com/mastra-ai/mastra/pull/11071))
|
|
359
|
-
|
|
360
|
-
- Added the ability to provide a base path for Mastra Studio. ([#10441](https://github.com/mastra-ai/mastra/pull/10441))
|
|
361
|
-
|
|
362
|
-
```ts
|
|
363
|
-
import { Mastra } from '@mastra/core';
|
|
364
|
-
|
|
365
|
-
export const mastra = new Mastra({
|
|
366
|
-
server: {
|
|
367
|
-
studioBase: '/my-mastra-studio',
|
|
368
|
-
},
|
|
369
|
-
});
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
This will make Mastra Studio available at `http://localhost:4111/my-mastra-studio`.
|
|
373
|
-
|
|
374
|
-
- Expand `processInputStep` processor method and integrate `prepareStep` as a processor ([#10774](https://github.com/mastra-ai/mastra/pull/10774))
|
|
375
|
-
|
|
376
|
-
**New Features:**
|
|
377
|
-
- `prepareStep` callback now runs through the standard `processInputStep` pipeline
|
|
378
|
-
- Processors can now modify per-step: `model`, `tools`, `toolChoice`, `activeTools`, `messages`, `systemMessages`, `providerOptions`, `modelSettings`, and `structuredOutput`
|
|
379
|
-
- Processor chaining: each processor receives accumulated state from previous processors
|
|
380
|
-
- System messages are isolated per-step (reset at start of each step)
|
|
381
|
-
|
|
382
|
-
**Breaking Change:**
|
|
383
|
-
- `prepareStep` messages format changed from AI SDK v5 model messages to `MastraDBMessage` format
|
|
384
|
-
- Migration: Use `messageList.get.all.aiV5.model()` if you need the old format
|
|
385
|
-
|
|
386
|
-
- Multiple Processor improvements including: ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
|
|
387
|
-
- Workflows can now return tripwires, they bubble up from agents that return tripwires in a step
|
|
388
|
-
- You can write processors as workflows using the existing Workflow primitive, every processor flow is now a workflow.
|
|
389
|
-
- tripwires that you throw can now return additional information including ability to retry the step
|
|
390
|
-
- New processor method `processOutputStep` added which runs after every step.
|
|
391
|
-
|
|
392
|
-
**What's new:**
|
|
393
|
-
|
|
394
|
-
**1. Retry mechanism with LLM feedback** - Processors can now request retries with feedback that gets sent back to the LLM:
|
|
395
|
-
|
|
396
|
-
```typescript
|
|
397
|
-
processOutputStep: async ({ text, abort, retryCount }) => {
|
|
398
|
-
if (isLowQuality(text)) {
|
|
399
|
-
abort('Response quality too low', { retry: true, metadata: { score: 0.6 } });
|
|
400
|
-
}
|
|
401
|
-
return [];
|
|
402
|
-
};
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
Configure with `maxProcessorRetries` (default: 3). Rejected steps are preserved in `result.steps[n].tripwire`. Retries are only available in `processOutputStep` and `processInputStep`. It will replay the step with additional context added.
|
|
406
|
-
|
|
407
|
-
**2. Workflow orchestration for processors** - Processors can now be composed using workflow primitives:
|
|
408
|
-
|
|
409
|
-
```typescript
|
|
410
|
-
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
411
|
-
import {
|
|
412
|
-
ProcessorStepSchema,
|
|
413
|
-
} from '@mastra/core/processors';
|
|
414
|
-
|
|
415
|
-
const moderationWorkflow = createWorkflow({ id: 'moderation', inputSchema: ProcessorStepSchema, outputSchema: ProcessorStepSchema })
|
|
416
|
-
.then(createStep(new lengthValidator({...})))
|
|
417
|
-
.parallel([createStep(new piiDetector({...}), createStep(new toxicityChecker({...}))])
|
|
418
|
-
.commit();
|
|
419
|
-
|
|
420
|
-
const agent = new Agent({ inputProcessors: [moderationWorkflow] });
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Every processor array that gets passed to an agent gets added as a workflow
|
|
424
|
-
<img width="614" height="673" alt="image" src="https://github.com/user-attachments/assets/0d79f1fd-8fca-4d86-8b45-22fddea984a8" />
|
|
425
|
-
|
|
426
|
-
**3. Extended tripwire API** - `abort()` now accepts options for retry control and typed metadata:
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
abort('reason', { retry: true, metadata: { score: 0.8, category: 'quality' } });
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
**4. New `processOutputStep` method** - Per-step output processing with access to step number, finish reason, tool calls, and retry count.
|
|
433
|
-
|
|
434
|
-
**5. Workflow tripwire status** - Workflows now have a `'tripwire'` status distinct from `'failed'`, properly bubbling up processor rejections.
|
|
435
|
-
|
|
436
|
-
## 1.0.0-beta.10
|
|
437
|
-
|
|
438
|
-
### Patch Changes
|
|
439
|
-
|
|
440
|
-
- Add support for typed structured output in agent workflow steps ([#11014](https://github.com/mastra-ai/mastra/pull/11014))
|
|
441
|
-
|
|
442
|
-
When wrapping an agent with `createStep()` and providing a `structuredOutput.schema`, the step's `outputSchema` is now correctly inferred from the provided schema instead of defaulting to `{ text: string }`.
|
|
443
|
-
|
|
444
|
-
This enables type-safe chaining of agent steps with structured output to subsequent steps:
|
|
445
|
-
|
|
446
|
-
```typescript
|
|
447
|
-
const articleSchema = z.object({
|
|
448
|
-
title: z.string(),
|
|
449
|
-
summary: z.string(),
|
|
450
|
-
tags: z.array(z.string()),
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
// Agent step with structured output - outputSchema is now articleSchema
|
|
454
|
-
const agentStep = createStep(agent, {
|
|
455
|
-
structuredOutput: { schema: articleSchema },
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
// Next step can receive the structured output directly
|
|
459
|
-
const processStep = createStep({
|
|
460
|
-
id: 'process',
|
|
461
|
-
inputSchema: articleSchema, // Matches agent's outputSchema
|
|
462
|
-
outputSchema: z.object({ tagCount: z.number() }),
|
|
463
|
-
execute: async ({ inputData }) => ({
|
|
464
|
-
tagCount: inputData.tags.length, // Fully typed!
|
|
465
|
-
}),
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
workflow.then(agentStep).then(processStep).commit();
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
When `structuredOutput` is not provided, the agent step continues to use the default `{ text: string }` output schema.
|
|
472
|
-
|
|
473
|
-
- Fixed a bug where multiple tools streaming output simultaneously could fail with "WritableStreamDefaultWriter is locked" errors. Tool streaming now works reliably during concurrent tool executions. ([#10830](https://github.com/mastra-ai/mastra/pull/10830))
|
|
474
|
-
|
|
475
|
-
- Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
|
|
476
|
-
|
|
477
|
-
```typescript
|
|
478
|
-
await workflow.deleteWorkflowRunById(runId);
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
- Fixed CachedToken tracking in all Observability Exporters. Also fixed TimeToFirstToken in Langfuse, Braintrust, PostHog exporters. Fixed trace formatting in Posthog Exporter. ([#11029](https://github.com/mastra-ai/mastra/pull/11029))
|
|
482
|
-
|
|
483
|
-
- fix: persist data-\* chunks from writer.custom() to memory storage ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
|
|
484
|
-
- Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools
|
|
485
|
-
- Data chunks are now saved to message storage so they survive page refreshes
|
|
486
|
-
- Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
|
|
487
|
-
- Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
|
|
488
|
-
- Update related `@assistant-ui/*` packages for compatibility
|
|
489
|
-
|
|
490
|
-
- Fixed double validation bug that prevented Zod transforms from working correctly in tool schemas. ([#11025](https://github.com/mastra-ai/mastra/pull/11025))
|
|
491
|
-
|
|
492
|
-
When tools with Zod `.transform()` or `.pipe()` in their `outputSchema` were executed through the Agent pipeline, validation was happening twice - once in Tool.execute() (correct) and again in CoreToolBuilder (incorrect). The second validation received already-transformed data but expected pre-transform data, causing validation errors.
|
|
493
|
-
|
|
494
|
-
This fix enables proper use of Zod transforms in both `inputSchema` (for normalizing/cleaning input data) and `outputSchema` (for transforming output data to be LLM-friendly).
|
|
495
|
-
|
|
496
|
-
- Updated dependencies [[`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932)]:
|
|
497
|
-
- @mastra/observability@1.0.0-beta.4
|
|
498
|
-
|
|
499
|
-
## 1.0.0-beta.9
|
|
500
|
-
|
|
501
501
|
|
|
502
|
-
...
|
|
502
|
+
... 6796 more lines hidden. See full changelog in package directory.
|