@mastra/server 1.30.0-alpha.1 → 1.30.0

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,5 +1,127 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update peer dependencies to match core package version bump (1.0.5) ([#12557](https://github.com/mastra-ai/mastra/pull/12557))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fixed a regression in 1.29.0 where configuring an agent with channel adapters (e.g. `channels.adapters.slack`) caused server startup to crash with a "Custom API route ... must not start with /api" error. The custom-route prefix validation now skips framework-generated webhook routes. ([#15952](https://github.com/mastra-ai/mastra/pull/15952))
12
+
13
+ - Fix MCP client support in the agent editor: ([#15945](https://github.com/mastra-ai/mastra/pull/15945))
14
+ - MCP client form dirty state: Save button now enables after adding/removing MCP clients
15
+ - MCP tool name matching: Both bare and namespaced tool names are matched correctly
16
+ - Auth token forwarding: Token from cookie or header is forwarded to auth-protected MCP servers
17
+ - String interpolation: Request context variables in system prompts now resolve correctly
18
+
19
+ - Add durable agents with resumable streams ([#12557](https://github.com/mastra-ai/mastra/pull/12557))
20
+
21
+ Durable agents make agent execution resilient to disconnections, crashes, and long-running operations.
22
+
23
+ ### The Problem
24
+
25
+ Standard agent streaming has two fragility points:
26
+ 1. **Connection drops** - If a client disconnects mid-stream (network blip, browser refresh, mobile app backgrounded), all subsequent events are lost. The client has no way to "catch up" on what they missed.
27
+ 2. **Long-running operations** - Agent loops with tool calls can take minutes. Holding an HTTP connection open that long is unreliable. If the server restarts or the connection times out, the work is lost.
28
+
29
+ ### The Solution
30
+
31
+ **Resumable streams** solve connection drops. Every event is cached with a sequential index. If a client disconnects at event 5, they can reconnect and request events starting from index 6. They receive cached events immediately, then continue with live events as they arrive.
32
+
33
+ **Durable execution** solves long-running operations. Instead of executing the agent loop directly in the HTTP request, execution happens in a workflow engine (built-in evented engine or Inngest). The HTTP request just subscribes to events. If the connection drops, execution continues. The client can reconnect anytime to observe progress.
34
+
35
+ ### Usage
36
+
37
+ Wrap any existing `Agent` with durability using factory functions:
38
+
39
+ ```typescript
40
+ import { Agent } from '@mastra/core/agent';
41
+ import { createDurableAgent } from '@mastra/core/agent/durable';
42
+
43
+ const agent = new Agent({
44
+ id: 'my-agent',
45
+ model: openai('gpt-4'),
46
+ instructions: 'You are helpful',
47
+ });
48
+
49
+ const durableAgent = createDurableAgent({ agent });
50
+ ```
51
+
52
+ **Factory functions for different execution strategies:**
53
+
54
+ | Factory | Execution | Use Case |
55
+ | ---------------------------------------- | ----------------------------------- | ------------------------------- |
56
+ | `createDurableAgent({ agent })` | Local, synchronous | Development, simple deployments |
57
+ | `createEventedAgent({ agent })` | Fire-and-forget via workflow engine | Long-running operations |
58
+ | `createInngestAgent({ agent, inngest })` | Inngest-powered | Production, distributed systems |
59
+
60
+ ### Resumable Streams
61
+
62
+ ```typescript
63
+ // Start streaming
64
+ const { runId, output } = await durableAgent.stream('Analyze this data...');
65
+
66
+ // Client disconnects at event 5...
67
+
68
+ // Reconnect and resume from where we left off
69
+ const { output: resumed } = await durableAgent.observe(runId, { offset: 6 });
70
+ // Receives events 6, 7, 8... from cache, then continues with live events
71
+ ```
72
+
73
+ ### PubSub and Cache
74
+
75
+ Durable agents use two infrastructure components:
76
+
77
+ | Component | Purpose | Default |
78
+ | ---------- | ----------------------------------------- | --------------------- |
79
+ | **PubSub** | Real-time event delivery during streaming | `EventEmitterPubSub` |
80
+ | **Cache** | Stores events for replay on reconnection | `InMemoryServerCache` |
81
+
82
+ When `stream()` is called, events flow through pubsub in real-time. The cache stores each event with a sequential index. When `observe()` is called, missed events replay from cache before continuing with live events.
83
+
84
+ **Configure via Mastra instance (recommended):**
85
+
86
+ ```typescript
87
+ const mastra = new Mastra({
88
+ cache: new RedisServerCache({ url: 'redis://...' }),
89
+ pubsub: new RedisPubSub({ url: 'redis://...' }),
90
+ agents: {
91
+ // Inherits cache and pubsub from Mastra
92
+ myAgent: createDurableAgent({ agent }),
93
+ },
94
+ });
95
+ ```
96
+
97
+ **Configure per-agent (overrides Mastra):**
98
+
99
+ ```typescript
100
+ const durableAgent = createDurableAgent({
101
+ agent,
102
+ cache: new RedisServerCache({ url: 'redis://...' }),
103
+ pubsub: new RedisPubSub({ url: 'redis://...' }),
104
+ });
105
+ ```
106
+
107
+ **Disable caching (streams won't be resumable):**
108
+
109
+ ```typescript
110
+ const durableAgent = createDurableAgent({ agent, cache: false });
111
+ ```
112
+
113
+ For single-instance deployments, the defaults work fine. For multi-instance deployments (load balancer, horizontal scaling), use Redis-backed implementations so any instance can serve reconnection requests.
114
+
115
+ ### Class Hierarchy
116
+ - `DurableAgent` extends `Agent` - base class with resumable streams
117
+ - `EventedAgent` extends `DurableAgent` - fire-and-forget execution
118
+ - `InngestAgent` extends `DurableAgent` - Inngest-powered execution
119
+
120
+ - Fix A2A streaming to emit incremental artifact updates from the agent full stream while preserving final structured output artifacts. ([#15941](https://github.com/mastra-ai/mastra/pull/15941))
121
+
122
+ - Updated dependencies [[`920c757`](https://github.com/mastra-ai/mastra/commit/920c75799c6bd71787d86deaf654a35af4c839ca), [`d587199`](https://github.com/mastra-ai/mastra/commit/d5871993c0371bde2b0717d6b47194755baa1443), [`1fe2533`](https://github.com/mastra-ai/mastra/commit/1fe2533c4382ca6858aac7c4b63e888c2eac6541), [`f8694b6`](https://github.com/mastra-ai/mastra/commit/f8694b6fa0b7a5cde71d794c3bbef4957c55bcb8)]:
123
+ - @mastra/core@1.30.0
124
+
3
125
  ## 1.30.0-alpha.1
4
126
 
5
127
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-server
3
3
  description: Documentation for @mastra/server. Use when working with @mastra/server APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/server"
6
- version: "1.30.0-alpha.1"
6
+ version: "1.30.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.30.0-alpha.1",
2
+ "version": "1.30.0",
3
3
  "package": "@mastra/server",
4
4
  "exports": {},
5
5
  "modules": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/server",
3
- "version": "1.30.0-alpha.1",
3
+ "version": "1.30.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -113,12 +113,12 @@
113
113
  "vitest": "4.1.5",
114
114
  "zod": "^4.3.6",
115
115
  "@internal/core": "0.0.0",
116
- "@internal/storage-test-utils": "0.0.84",
117
- "@internal/lint": "0.0.88",
118
- "@internal/test-utils": "0.0.24",
119
- "@mastra/agent-builder": "1.0.32-alpha.0",
120
- "@internal/types-builder": "0.0.63",
121
- "@mastra/core": "1.30.0-alpha.1",
116
+ "@internal/storage-test-utils": "0.0.85",
117
+ "@internal/lint": "0.0.89",
118
+ "@internal/test-utils": "0.0.25",
119
+ "@mastra/agent-builder": "1.0.32",
120
+ "@mastra/core": "1.30.0",
121
+ "@internal/types-builder": "0.0.64",
122
122
  "@mastra/schema-compat": "1.2.9"
123
123
  },
124
124
  "homepage": "https://mastra.ai",