@mastra/inngest 1.3.0-alpha.0 → 1.3.1-alpha.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,160 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 1.3.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed peer dependency ranges so packages that use the Mastra server require a compatible Mastra core version. ([#16208](https://github.com/mastra-ai/mastra/pull/16208))
8
+
9
+ - Updated the `serve` and `createServe` JSDoc adapter examples to register Inngest at `/inngest/api` instead of `/api/inngest`, matching the Inngest deployment guide and in-repo example projects. ([#16186](https://github.com/mastra-ai/mastra/pull/16186))
10
+
11
+ **Why**
12
+
13
+ Mastra reserves the `/api` prefix for built-in routes (agents, workflows, memory). Custom `apiRoutes[].path` values that start with the server's `apiPrefix` (default `/api`) are rejected at startup, so the previous JSDoc snippets threw `Custom API route "/api/inngest" must not start with "/api"` when copy-pasted into a current Mastra project.
14
+
15
+ **Migration**
16
+
17
+ If you registered Inngest with the previous guide or JSDoc example:
18
+
19
+ ```ts
20
+ // Before
21
+ apiRoutes: [
22
+ {
23
+ path: '/api/inngest',
24
+ method: 'ALL',
25
+ createHandler: async ({ mastra }) => serve({ mastra, inngest }),
26
+ },
27
+ ];
28
+
29
+ // After
30
+ apiRoutes: [
31
+ {
32
+ path: '/inngest/api',
33
+ method: 'ALL',
34
+ createHandler: async ({ mastra }) => serve({ mastra, inngest }),
35
+ },
36
+ ];
37
+ ```
38
+
39
+ Update the dev server URL (`npx inngest-cli dev -u http://localhost:4111/inngest/api`) and, in production, set the **URL** field on your Inngest app to match.
40
+
41
+ If you cannot change the path, set `server.apiPrefix` (for example `/_mastra`) to relocate the built-in routes and remember to update `server.auth.protected` and any `MastraClient` `apiPrefix` to match. See the [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest) for the full walkthrough.
42
+
43
+ - Updated dependencies [[`ac47842`](https://github.com/mastra-ai/mastra/commit/ac478427aa7a5f5fdaed633a911218689b438c60)]:
44
+ - @mastra/core@1.33.0-alpha.0
45
+
46
+ ## 1.3.0
47
+
48
+ ### Minor Changes
49
+
50
+ - Add durable agents with resumable streams ([#12557](https://github.com/mastra-ai/mastra/pull/12557))
51
+
52
+ Durable agents make agent execution resilient to disconnections, crashes, and long-running operations.
53
+
54
+ ### The Problem
55
+
56
+ Standard agent streaming has two fragility points:
57
+ 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.
58
+ 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.
59
+
60
+ ### The Solution
61
+
62
+ **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.
63
+
64
+ **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.
65
+
66
+ ### Usage
67
+
68
+ Wrap any existing `Agent` with durability using factory functions:
69
+
70
+ ```typescript
71
+ import { Agent } from '@mastra/core/agent';
72
+ import { createDurableAgent } from '@mastra/core/agent/durable';
73
+
74
+ const agent = new Agent({
75
+ id: 'my-agent',
76
+ model: openai('gpt-4'),
77
+ instructions: 'You are helpful',
78
+ });
79
+
80
+ const durableAgent = createDurableAgent({ agent });
81
+ ```
82
+
83
+ **Factory functions for different execution strategies:**
84
+
85
+ | Factory | Execution | Use Case |
86
+ | ---------------------------------------- | ----------------------------------- | ------------------------------- |
87
+ | `createDurableAgent({ agent })` | Local, synchronous | Development, simple deployments |
88
+ | `createEventedAgent({ agent })` | Fire-and-forget via workflow engine | Long-running operations |
89
+ | `createInngestAgent({ agent, inngest })` | Inngest-powered | Production, distributed systems |
90
+
91
+ ### Resumable Streams
92
+
93
+ ```typescript
94
+ // Start streaming
95
+ const { runId, output } = await durableAgent.stream('Analyze this data...');
96
+
97
+ // Client disconnects at event 5...
98
+
99
+ // Reconnect and resume from where we left off
100
+ const { output: resumed } = await durableAgent.observe(runId, { offset: 6 });
101
+ // Receives events 6, 7, 8... from cache, then continues with live events
102
+ ```
103
+
104
+ ### PubSub and Cache
105
+
106
+ Durable agents use two infrastructure components:
107
+
108
+ | Component | Purpose | Default |
109
+ | ---------- | ----------------------------------------- | --------------------- |
110
+ | **PubSub** | Real-time event delivery during streaming | `EventEmitterPubSub` |
111
+ | **Cache** | Stores events for replay on reconnection | `InMemoryServerCache` |
112
+
113
+ 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.
114
+
115
+ **Configure via Mastra instance (recommended):**
116
+
117
+ ```typescript
118
+ const mastra = new Mastra({
119
+ cache: new RedisServerCache({ url: 'redis://...' }),
120
+ pubsub: new RedisPubSub({ url: 'redis://...' }),
121
+ agents: {
122
+ // Inherits cache and pubsub from Mastra
123
+ myAgent: createDurableAgent({ agent }),
124
+ },
125
+ });
126
+ ```
127
+
128
+ **Configure per-agent (overrides Mastra):**
129
+
130
+ ```typescript
131
+ const durableAgent = createDurableAgent({
132
+ agent,
133
+ cache: new RedisServerCache({ url: 'redis://...' }),
134
+ pubsub: new RedisPubSub({ url: 'redis://...' }),
135
+ });
136
+ ```
137
+
138
+ **Disable caching (streams won't be resumable):**
139
+
140
+ ```typescript
141
+ const durableAgent = createDurableAgent({ agent, cache: false });
142
+ ```
143
+
144
+ 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.
145
+
146
+ ### Class Hierarchy
147
+ - `DurableAgent` extends `Agent` - base class with resumable streams
148
+ - `EventedAgent` extends `DurableAgent` - fire-and-forget execution
149
+ - `InngestAgent` extends `DurableAgent` - Inngest-powered execution
150
+
151
+ - Update peer dependencies to match core package version bump (1.0.5) ([#12557](https://github.com/mastra-ai/mastra/pull/12557))
152
+
153
+ ### Patch Changes
154
+
155
+ - 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)]:
156
+ - @mastra/core@1.30.0
157
+
3
158
  ## 1.3.0-alpha.0
4
159
 
5
160
  ### Minor Changes