@mastra/mcp-docs-server 1.1.42-alpha.8 → 1.1.43-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.
Files changed (159) hide show
  1. package/.docs/docs/agent-builder/memory.md +1 -1
  2. package/.docs/docs/agents/a2a.md +1 -1
  3. package/.docs/docs/agents/acp.md +23 -160
  4. package/.docs/docs/agents/adding-voice.md +7 -7
  5. package/.docs/docs/agents/agent-approval.md +1 -1
  6. package/.docs/docs/agents/background-tasks.md +2 -2
  7. package/.docs/docs/agents/channels.md +1 -1
  8. package/.docs/docs/agents/code-mode.md +3 -3
  9. package/.docs/docs/agents/guardrails.md +2 -2
  10. package/.docs/docs/agents/networks.md +1 -1
  11. package/.docs/docs/agents/overview.md +1 -1
  12. package/.docs/docs/agents/processors.md +146 -3
  13. package/.docs/docs/agents/sdk-agents.md +261 -0
  14. package/.docs/docs/agents/signals.md +230 -10
  15. package/.docs/docs/agents/structured-output.md +5 -5
  16. package/.docs/docs/agents/supervisor-agents.md +2 -2
  17. package/.docs/docs/agents/using-tools.md +5 -5
  18. package/.docs/docs/browser/agent-browser.md +1 -1
  19. package/.docs/docs/browser/browser-viewer.md +1 -1
  20. package/.docs/docs/browser/overview.md +1 -1
  21. package/.docs/docs/browser/stagehand.md +5 -5
  22. package/.docs/docs/build-with-ai/skills.md +3 -3
  23. package/.docs/docs/editor/overview.md +12 -11
  24. package/.docs/docs/evals/custom-scorers.md +1 -1
  25. package/.docs/docs/evals/datasets/running-experiments.md +1 -1
  26. package/.docs/docs/evals/overview.md +2 -2
  27. package/.docs/docs/getting-started/build-with-ai.md +37 -0
  28. package/.docs/docs/mastra-platform/observability.md +4 -4
  29. package/.docs/docs/mcp/mcp-apps.md +3 -3
  30. package/.docs/docs/mcp/overview.md +1 -1
  31. package/.docs/docs/memory/memory-processors.md +6 -6
  32. package/.docs/docs/memory/multi-user-threads.md +2 -2
  33. package/.docs/docs/memory/semantic-recall.md +1 -1
  34. package/.docs/docs/memory/storage.md +2 -1
  35. package/.docs/docs/memory/working-memory.md +28 -1
  36. package/.docs/docs/observability/metrics/querying.md +1 -1
  37. package/.docs/docs/observability/tracing/exporters/langfuse.md +1 -1
  38. package/.docs/docs/observability/tracing/exporters/langsmith.md +2 -2
  39. package/.docs/docs/rag/graph-rag.md +2 -2
  40. package/.docs/docs/rag/retrieval.md +12 -12
  41. package/.docs/docs/server/auth/fga.md +2 -0
  42. package/.docs/docs/server/mastra-client.md +1 -1
  43. package/.docs/docs/server/pubsub.md +124 -0
  44. package/.docs/docs/server/request-context.md +3 -3
  45. package/.docs/docs/streaming/overview.md +1 -1
  46. package/.docs/docs/streaming/tool-streaming.md +1 -1
  47. package/.docs/docs/studio/auth.md +20 -0
  48. package/.docs/docs/voice/overview.md +25 -25
  49. package/.docs/docs/voice/speech-to-speech.md +4 -4
  50. package/.docs/docs/voice/speech-to-text.md +1 -1
  51. package/.docs/docs/voice/text-to-speech.md +1 -1
  52. package/.docs/docs/workspace/filesystem.md +2 -2
  53. package/.docs/docs/workspace/overview.md +1 -1
  54. package/.docs/docs/workspace/sandbox.md +1 -1
  55. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
  56. package/.docs/guides/guide/ai-recruiter.md +1 -1
  57. package/.docs/guides/guide/chef-michel.md +1 -1
  58. package/.docs/guides/guide/code-review-bot.md +1 -1
  59. package/.docs/guides/guide/dev-assistant.md +1 -1
  60. package/.docs/guides/guide/docs-manager.md +1 -1
  61. package/.docs/guides/guide/firecrawl.md +1 -1
  62. package/.docs/guides/guide/github-actions-pr-description.md +1 -1
  63. package/.docs/guides/guide/research-assistant.md +1 -1
  64. package/.docs/guides/guide/research-coordinator.md +2 -2
  65. package/.docs/guides/guide/slack-assistant.md +1 -1
  66. package/.docs/guides/guide/stock-agent.md +2 -2
  67. package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
  68. package/.docs/guides/migrations/agentnetwork.md +4 -4
  69. package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
  70. package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
  71. package/.docs/reference/acp/acp-agent.md +228 -0
  72. package/.docs/reference/acp/create-acp-tool.md +131 -0
  73. package/.docs/reference/agents/agent.md +55 -5
  74. package/.docs/reference/agents/channels.md +47 -5
  75. package/.docs/reference/agents/durable-agent.md +239 -0
  76. package/.docs/reference/agents/generateLegacy.md +1 -1
  77. package/.docs/reference/agents/getLLM.md +2 -2
  78. package/.docs/reference/agents/getMetadata.md +2 -2
  79. package/.docs/reference/agents/network.md +1 -1
  80. package/.docs/reference/browser/agent-browser.md +1 -1
  81. package/.docs/reference/browser/browser-viewer.md +1 -1
  82. package/.docs/reference/browser/mastra-browser.md +1 -1
  83. package/.docs/reference/browser/stagehand-browser.md +5 -5
  84. package/.docs/reference/cli/mastra.md +5 -5
  85. package/.docs/reference/client-js/agents.md +41 -7
  86. package/.docs/reference/configuration.md +1 -1
  87. package/.docs/reference/evals/answer-relevancy.md +1 -1
  88. package/.docs/reference/evals/answer-similarity.md +1 -1
  89. package/.docs/reference/evals/bias.md +1 -1
  90. package/.docs/reference/evals/context-precision.md +3 -3
  91. package/.docs/reference/evals/context-relevance.md +11 -11
  92. package/.docs/reference/evals/faithfulness.md +1 -1
  93. package/.docs/reference/evals/hallucination.md +5 -5
  94. package/.docs/reference/evals/noise-sensitivity.md +11 -11
  95. package/.docs/reference/evals/prompt-alignment.md +15 -15
  96. package/.docs/reference/evals/tool-call-accuracy.md +3 -3
  97. package/.docs/reference/evals/toxicity.md +1 -1
  98. package/.docs/reference/index.md +9 -0
  99. package/.docs/reference/memory/memory-class.md +3 -3
  100. package/.docs/reference/memory/observational-memory.md +4 -4
  101. package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
  102. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  103. package/.docs/reference/processors/cost-guard-processor.md +1 -1
  104. package/.docs/reference/processors/language-detector.md +1 -1
  105. package/.docs/reference/processors/message-history-processor.md +1 -1
  106. package/.docs/reference/processors/moderation-processor.md +2 -2
  107. package/.docs/reference/processors/pii-detector.md +2 -2
  108. package/.docs/reference/processors/prefill-error-handler.md +2 -2
  109. package/.docs/reference/processors/processor-interface.md +2 -2
  110. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  111. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  112. package/.docs/reference/processors/response-cache.md +2 -2
  113. package/.docs/reference/processors/semantic-recall-processor.md +1 -1
  114. package/.docs/reference/processors/skill-search-processor.md +1 -1
  115. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  116. package/.docs/reference/processors/token-limiter-processor.md +3 -3
  117. package/.docs/reference/processors/tool-call-filter.md +2 -2
  118. package/.docs/reference/processors/tool-search-processor.md +2 -2
  119. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  120. package/.docs/reference/processors/working-memory-processor.md +1 -1
  121. package/.docs/reference/pubsub/base.md +168 -0
  122. package/.docs/reference/pubsub/caching-pubsub.md +102 -0
  123. package/.docs/reference/pubsub/event-emitter.md +72 -0
  124. package/.docs/reference/pubsub/google-cloud-pubsub.md +94 -0
  125. package/.docs/reference/pubsub/redis-streams.md +108 -0
  126. package/.docs/reference/pubsub/unix-socket-pubsub.md +52 -0
  127. package/.docs/reference/rag/rerank.md +1 -1
  128. package/.docs/reference/server/nestjs-adapter.md +1 -1
  129. package/.docs/reference/storage/dsql.md +1 -1
  130. package/.docs/reference/storage/libsql.md +6 -0
  131. package/.docs/reference/storage/mongodb.md +4 -1
  132. package/.docs/reference/storage/postgresql.md +4 -1
  133. package/.docs/reference/storage/redis.md +1 -1
  134. package/.docs/reference/storage/spanner.md +5 -0
  135. package/.docs/reference/storage/upstash.md +1 -1
  136. package/.docs/reference/streaming/agents/stream.md +1 -1
  137. package/.docs/reference/templates/overview.md +1 -1
  138. package/.docs/reference/tools/mcp-client.md +2 -2
  139. package/.docs/reference/tools/mcp-server.md +33 -1
  140. package/.docs/reference/tools/vector-query-tool.md +1 -1
  141. package/.docs/reference/vectors/libsql.md +1 -1
  142. package/.docs/reference/vectors/mongodb.md +1 -1
  143. package/.docs/reference/vectors/pg.md +1 -1
  144. package/.docs/reference/vectors/upstash.md +1 -1
  145. package/.docs/reference/voice/voice.addInstructions.md +1 -1
  146. package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
  147. package/.docs/reference/workspace/azure-blob-filesystem.md +1 -1
  148. package/.docs/reference/workspace/docker-sandbox.md +1 -1
  149. package/.docs/reference/workspace/e2b-sandbox.md +9 -5
  150. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
  151. package/.docs/reference/workspace/gcs-filesystem.md +1 -1
  152. package/.docs/reference/workspace/google-drive-filesystem.md +1 -1
  153. package/.docs/reference/workspace/local-filesystem.md +1 -1
  154. package/.docs/reference/workspace/local-sandbox.md +1 -1
  155. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  156. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  157. package/CHANGELOG.md +38 -0
  158. package/package.json +6 -6
  159. package/.docs/docs/agents/response-caching.md +0 -150
@@ -43,7 +43,7 @@ export const agent = new Agent({
43
43
  id: 'normalized-agent',
44
44
  name: 'normalized-agent',
45
45
  instructions: 'You are a helpful assistant',
46
- model: 'openai/gpt-5.4',
46
+ model: 'openai/gpt-5.5',
47
47
  inputProcessors: [
48
48
  new UnicodeNormalizer({
49
49
  stripControlChars: true,
@@ -67,7 +67,7 @@ const storage = new PostgresStorage({
67
67
  export const agent = new Agent({
68
68
  name: 'personalized-agent',
69
69
  instructions: 'You are a helpful assistant that remembers user preferences',
70
- model: 'openai/gpt-5.4',
70
+ model: 'openai/gpt-5.5',
71
71
  inputProcessors: [
72
72
  new WorkingMemory({
73
73
  storage,
@@ -0,0 +1,168 @@
1
+ # PubSub
2
+
3
+ `PubSub` is the abstract base class for Mastra's event system. It defines the contract that every pub/sub backend implements, so the rest of Mastra can publish and subscribe to events without knowing which transport is in use.
4
+
5
+ Mastra uses pub/sub internally for workflow event processing, streaming, and cross-component communication. Most applications use the default [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) and never construct a `PubSub` directly. Implement this class only when you need a custom transport.
6
+
7
+ For built-in implementations, see [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter), [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub), [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub), [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), and [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub).
8
+
9
+ ## Usage example
10
+
11
+ Extend `PubSub` and implement the four abstract methods to add a custom backend.
12
+
13
+ ```typescript
14
+ import { PubSub } from '@mastra/core/events'
15
+ import type { Event, EventCallback, SubscribeOptions } from '@mastra/core/events'
16
+
17
+ export class CustomPubSub extends PubSub {
18
+ async publish(topic: string, event: Omit<Event, 'id' | 'createdAt'>): Promise<void> {
19
+ // Deliver the event to subscribers of `topic`.
20
+ }
21
+
22
+ async subscribe(topic: string, cb: EventCallback, options?: SubscribeOptions): Promise<void> {
23
+ // Register `cb` to receive events published to `topic`.
24
+ }
25
+
26
+ async unsubscribe(topic: string, cb: EventCallback): Promise<void> {
27
+ // Remove a previously registered callback.
28
+ }
29
+
30
+ async flush(): Promise<void> {
31
+ // Wait for any in-flight deliveries to settle.
32
+ }
33
+ }
34
+ ```
35
+
36
+ Pass the instance to the [Mastra](https://mastra.ai/reference/core/mastra-class) constructor:
37
+
38
+ ```typescript
39
+ import { Mastra } from '@mastra/core'
40
+ import { CustomPubSub } from './pubsub'
41
+
42
+ export const mastra = new Mastra({
43
+ pubsub: new CustomPubSub(),
44
+ })
45
+ ```
46
+
47
+ ## Delivery modes
48
+
49
+ A `PubSub` declares which delivery modes it supports through the `supportedModes` property. Mastra reads this to decide whether to run a long-lived worker that pulls events.
50
+
51
+ | Mode | Description |
52
+ | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
53
+ | `pull` | Consumers actively read from the broker, for example Redis Streams `XREADGROUP`. Mastra runs an orchestration worker to read. |
54
+ | `push` | Events arrive without the consumer asking, either in-process or through an HTTP endpoint. No read loop is required. |
55
+
56
+ The default is `['pull']` so that custom implementations keep today's behavior unless they opt in to push delivery.
57
+
58
+ ## Methods
59
+
60
+ ### Core methods
61
+
62
+ #### `publish(topic, event)`
63
+
64
+ Publishes an event to a topic. The `id` and `createdAt` fields are assigned by the implementation.
65
+
66
+ ```typescript
67
+ await pubsub.publish('my-topic', {
68
+ type: 'example',
69
+ data: { value: 1 },
70
+ runId: 'run-123',
71
+ })
72
+ ```
73
+
74
+ #### `subscribe(topic, cb, options?)`
75
+
76
+ Registers a callback to receive events published to a topic. When `options.group` is set, subscribers in the same group compete for messages and each event is delivered to one member. Without a group, every subscriber receives every event.
77
+
78
+ ```typescript
79
+ await pubsub.subscribe('my-topic', (event, ack, nack) => {
80
+ console.log(event)
81
+ })
82
+ ```
83
+
84
+ #### `unsubscribe(topic, cb)`
85
+
86
+ Removes a previously registered callback from a topic.
87
+
88
+ ```typescript
89
+ await pubsub.unsubscribe('my-topic', callback)
90
+ ```
91
+
92
+ #### `flush()`
93
+
94
+ Waits for any in-flight deliveries to settle. Call this before shutdown to avoid dropping events.
95
+
96
+ ```typescript
97
+ await pubsub.flush()
98
+ ```
99
+
100
+ ### Replay methods
101
+
102
+ These methods support resuming a stream after a disconnect. The default implementations fall back to a regular `subscribe`, so backends without history support behave as live-only. [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub) overrides them to replay cached events.
103
+
104
+ #### `getHistory(topic, offset?)`
105
+
106
+ Returns cached events for a topic, starting at `offset`. Returns an empty array when the backend has no history.
107
+
108
+ ```typescript
109
+ const events = await pubsub.getHistory('my-topic', 0)
110
+ ```
111
+
112
+ Returns: `Promise<Event[]>`
113
+
114
+ #### `subscribeWithReplay(topic, cb)`
115
+
116
+ Replays cached events, then subscribes to live events.
117
+
118
+ ```typescript
119
+ await pubsub.subscribeWithReplay('my-topic', event => {
120
+ console.log(event)
121
+ })
122
+ ```
123
+
124
+ #### `subscribeFromOffset(topic, offset, cb)`
125
+
126
+ Replays cached events starting at a known position, then subscribes to live events. This is more efficient than a full replay when the client knows its last position.
127
+
128
+ ```typescript
129
+ await pubsub.subscribeFromOffset('my-topic', 42, event => {
130
+ console.log(event)
131
+ })
132
+ ```
133
+
134
+ ## Properties
135
+
136
+ **supportedModes** (`ReadonlyArray<"pull" | "push">`): Delivery modes the implementation supports. Defaults to \`\["pull"]\`.
137
+
138
+ ## Types
139
+
140
+ ### `Event`
141
+
142
+ **type** (`string`): Event type identifier.
143
+
144
+ **id** (`string`): Unique event ID, assigned by the implementation on publish.
145
+
146
+ **data** (`any`): Event payload.
147
+
148
+ **runId** (`string`): Run the event belongs to.
149
+
150
+ **createdAt** (`Date`): Timestamp assigned by the implementation on publish.
151
+
152
+ **index** (`number`): Sequential position used to resume from a specific offset.
153
+
154
+ **deliveryAttempt** (`number`): Number of times the event has been delivered. Starts at 1. Defaults to 1 when the backend does not track redelivery.
155
+
156
+ ### `SubscribeOptions`
157
+
158
+ **group** (`string`): When set, subscribers with the same group compete for messages and each event is delivered to one member. When omitted, every subscriber receives every event.
159
+
160
+ ### `EventCallback`
161
+
162
+ The callback signature for subscribers: `(event: Event, ack?: () => Promise<void>, nack?: () => Promise<void>) => void`.
163
+
164
+ **event** (`Event`): The delivered event.
165
+
166
+ **ack** (`() => Promise<void>`): Acknowledge successful processing. The event is removed from the queue.
167
+
168
+ **nack** (`() => Promise<void>`): Negative acknowledge. The event is requeued for redelivery after a delay.
@@ -0,0 +1,102 @@
1
+ # CachingPubSub
2
+
3
+ `CachingPubSub` wraps any [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation and adds event caching and replay. It records every published event per topic in a cache, so a subscriber that connects late or reconnects after a disconnect can replay the events it missed before continuing with live events.
4
+
5
+ Use it to build resumable streams on top of a transport that does not keep history, such as [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). Transports that already persist events, such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), do not need this wrapper.
6
+
7
+ ## Usage example
8
+
9
+ Wrap an inner pub/sub and provide a server cache to store events.
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core'
13
+ import { CachingPubSub, EventEmitterPubSub } from '@mastra/core/events'
14
+ import { InMemoryServerCache } from '@mastra/core/cache'
15
+
16
+ const cache = new InMemoryServerCache()
17
+ const pubsub = new CachingPubSub(new EventEmitterPubSub(), cache)
18
+
19
+ export const mastra = new Mastra({
20
+ pubsub,
21
+ })
22
+ ```
23
+
24
+ The `withCaching` helper returns the same instance and reads better when wrapping inline:
25
+
26
+ ```typescript
27
+ import { withCaching, EventEmitterPubSub } from '@mastra/core/events'
28
+ import { InMemoryServerCache } from '@mastra/core/cache'
29
+
30
+ const pubsub = withCaching(new EventEmitterPubSub(), new InMemoryServerCache())
31
+ ```
32
+
33
+ ## Constructor parameters
34
+
35
+ **inner** (`PubSub`): The pub/sub implementation to wrap. All publishes and live subscriptions pass through to this instance.
36
+
37
+ **cache** (`MastraServerCache`): Cache used to store events per topic for replay.
38
+
39
+ **options** (`CachingPubSubOptions`): Optional configuration.
40
+
41
+ ## Methods
42
+
43
+ `CachingPubSub` implements the [`PubSub`](https://mastra.ai/reference/pubsub/base) contract. It overrides the replay methods to read cached events. The methods below describe the caching behavior.
44
+
45
+ ### `publish(topic, event)`
46
+
47
+ Caches the event with a sequential index, then publishes it to the inner pub/sub.
48
+
49
+ ```typescript
50
+ await pubsub.publish('my-topic', {
51
+ type: 'example',
52
+ data: { value: 1 },
53
+ runId: 'run-123',
54
+ })
55
+ ```
56
+
57
+ ### `subscribeWithReplay(topic, cb)`
58
+
59
+ Replays all cached events for the topic, then subscribes to live events.
60
+
61
+ ```typescript
62
+ await pubsub.subscribeWithReplay('my-topic', event => {
63
+ console.log(event)
64
+ })
65
+ ```
66
+
67
+ ### `subscribeFromOffset(topic, offset, cb)`
68
+
69
+ Replays cached events starting at `offset`, then subscribes to live events. Use this when the client knows its last position, to avoid replaying the whole history.
70
+
71
+ ```typescript
72
+ await pubsub.subscribeFromOffset('my-topic', 42, event => {
73
+ console.log(event)
74
+ })
75
+ ```
76
+
77
+ ### `getHistory(topic, offset?)`
78
+
79
+ Returns cached events for the topic, starting at `offset`.
80
+
81
+ ```typescript
82
+ const events = await pubsub.getHistory('my-topic', 0)
83
+ ```
84
+
85
+ Returns: `Promise<Event[]>`
86
+
87
+ ## Functions
88
+
89
+ ### `withCaching(pubsub, cache, options?)`
90
+
91
+ Convenience wrapper that constructs a `CachingPubSub`. Accepts the same arguments as the constructor and returns the new instance.
92
+
93
+ ```typescript
94
+ import { withCaching, EventEmitterPubSub } from '@mastra/core/events'
95
+ import { InMemoryServerCache } from '@mastra/core/cache'
96
+
97
+ const pubsub = withCaching(new EventEmitterPubSub(), new InMemoryServerCache(), {
98
+ keyPrefix: 'events:',
99
+ })
100
+ ```
101
+
102
+ Returns: `CachingPubSub`
@@ -0,0 +1,72 @@
1
+ # EventEmitterPubSub
2
+
3
+ `EventEmitterPubSub` is the default [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation. It delivers events in-process using a Node.js [`EventEmitter`](https://nodejs.org/api/events.html#class-eventemitter), so it works without any external service.
4
+
5
+ Use it for single-process applications. For delivery across processes on one host, see [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub). For distributed delivery, see [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub).
6
+
7
+ Because it is in-process, events are not persisted and are not shared with other processes. Wrap it in [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub) when you need replay for resumable streams.
8
+
9
+ ## Usage example
10
+
11
+ `EventEmitterPubSub` is used automatically when you do not configure a `pubsub` option, so most applications never construct it directly. Create one explicitly only when you want to configure or share it.
12
+
13
+ ```typescript
14
+ import { Mastra } from '@mastra/core'
15
+ import { EventEmitterPubSub } from '@mastra/core/events'
16
+
17
+ export const mastra = new Mastra({
18
+ pubsub: new EventEmitterPubSub(),
19
+ })
20
+ ```
21
+
22
+ To share an emitter with other parts of your application, pass an existing `EventEmitter`:
23
+
24
+ ```typescript
25
+ import EventEmitter from 'node:events'
26
+ import { EventEmitterPubSub } from '@mastra/core/events'
27
+
28
+ const emitter = new EventEmitter()
29
+ const pubsub = new EventEmitterPubSub(emitter)
30
+ ```
31
+
32
+ ## Constructor parameters
33
+
34
+ **existingEmitter** (`EventEmitter`): An existing Node.js EventEmitter to use for delivery. When omitted, a new EventEmitter is created.
35
+
36
+ ## Properties
37
+
38
+ **supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \`\["pull", "push"]\`. The emitter can serve a pull-style worker or push events directly to listeners.
39
+
40
+ ## Methods
41
+
42
+ `EventEmitterPubSub` implements the [`PubSub`](https://mastra.ai/reference/pubsub/base) contract. The methods below have behavior specific to this implementation.
43
+
44
+ ### `subscribe(topic, cb, options?)`
45
+
46
+ Registers a callback for a topic. Without `options.group`, every subscriber receives every event. With a group, events are distributed round-robin across members of that group.
47
+
48
+ ```typescript
49
+ await pubsub.subscribe('workflow.events', (event, ack, nack) => {
50
+ console.log(event)
51
+ })
52
+ ```
53
+
54
+ ### `flush()`
55
+
56
+ Waits for any pending redeliveries from `nack` to fire before resolving.
57
+
58
+ ```typescript
59
+ await pubsub.flush()
60
+ ```
61
+
62
+ ### `close()`
63
+
64
+ Removes all listeners and cancels pending redeliveries. Call this during graceful shutdown.
65
+
66
+ ```typescript
67
+ await pubsub.close()
68
+ ```
69
+
70
+ ## Redelivery
71
+
72
+ When a grouped subscriber calls `nack`, the event is redelivered to the group after a short delay, and its `deliveryAttempt` count increases. Calling `ack` clears the tracking for that event. Fan-out subscribers receive no-op `ack` and `nack` functions, since each event reaches every subscriber once.
@@ -0,0 +1,94 @@
1
+ # GoogleCloudPubSub
2
+
3
+ `GoogleCloudPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation backed by [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs). It delivers events across processes and hosts using Google Cloud topics and subscriptions, with ordered delivery and message acknowledgment.
4
+
5
+ Use it for distributed deployments on Google Cloud. For single-process delivery, use [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). For Redis, use [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams).
6
+
7
+ Each topic maps to a Google Cloud topic. Subscriptions with a group share a named subscription, so members compete for events. Subscriptions without a group create a per-instance subscription, so every instance receives every event.
8
+
9
+ ## Installation
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @mastra/google-cloud-pubsub
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @mastra/google-cloud-pubsub
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @mastra/google-cloud-pubsub
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @mastra/google-cloud-pubsub
33
+ ```
34
+
35
+ ## Usage example
36
+
37
+ Pass a Google Cloud client configuration, such as a project ID.
38
+
39
+ ```typescript
40
+ import { Mastra } from '@mastra/core'
41
+ import { GoogleCloudPubSub } from '@mastra/google-cloud-pubsub'
42
+
43
+ export const mastra = new Mastra({
44
+ pubsub: new GoogleCloudPubSub({
45
+ projectId: 'my-project',
46
+ }),
47
+ })
48
+ ```
49
+
50
+ ## Constructor parameters
51
+
52
+ **config** (`ClientConfig`): Configuration for the Google Cloud Pub/Sub client, including credentials and project ID. See the \`@google-cloud/pubsub\` client documentation for all fields.
53
+
54
+ ## Methods
55
+
56
+ `GoogleCloudPubSub` implements the [`PubSub`](https://mastra.ai/reference/pubsub/base) contract. The methods below are specific to this implementation.
57
+
58
+ ### `init(topicName, group?)`
59
+
60
+ Creates the topic and a subscription if they do not already exist, and returns the subscription. `subscribe` calls this internally, so you rarely call it directly.
61
+
62
+ ```typescript
63
+ await pubsub.init('workflow.events')
64
+ ```
65
+
66
+ ### `subscribe(topic, cb, options?)`
67
+
68
+ Subscribes to a topic. With `options.group`, members of the group share a subscription and compete for events. Without a group, the instance receives every event through its own subscription.
69
+
70
+ ```typescript
71
+ await pubsub.subscribe('workflow.events', (event, ack, nack) => {
72
+ console.log(event)
73
+ })
74
+ ```
75
+
76
+ ### `flush()`
77
+
78
+ Waits for pending acknowledgments to complete.
79
+
80
+ ```typescript
81
+ await pubsub.flush()
82
+ ```
83
+
84
+ ### `destroy(topicName)`
85
+
86
+ Removes the subscription and topic for a given topic name. Use this to clean up Google Cloud resources.
87
+
88
+ ```typescript
89
+ await pubsub.destroy('workflow.events')
90
+ ```
91
+
92
+ ## Acknowledgment
93
+
94
+ Each delivered event includes `ack` and `nack` functions. Call `ack` after successful processing to remove the event from the subscription. When neither is called, Google Cloud redelivers the event after its acknowledgment deadline expires.
@@ -0,0 +1,108 @@
1
+ # RedisStreamsPubSub
2
+
3
+ `RedisStreamsPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation backed by [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/). It delivers events across processes and hosts, with persistence, consumer groups, and redelivery on failure.
4
+
5
+ Use it for distributed deployments where several services share an event stream. For single-process delivery, use [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). For Google Cloud, use [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub).
6
+
7
+ Each topic maps to a Redis stream key. Subscriptions with a group use a Redis consumer group, so members share work round-robin. Subscriptions without a group create a private consumer group, so every subscriber receives every event.
8
+
9
+ `RedisStreamsPubSub` is a pull transport: consumers read events with `XREADGROUP`, so Mastra runs an orchestration worker to read on its behalf.
10
+
11
+ ## Installation
12
+
13
+ **npm**:
14
+
15
+ ```bash
16
+ npm install @mastra/redis-streams
17
+ ```
18
+
19
+ **pnpm**:
20
+
21
+ ```bash
22
+ pnpm add @mastra/redis-streams
23
+ ```
24
+
25
+ **Yarn**:
26
+
27
+ ```bash
28
+ yarn add @mastra/redis-streams
29
+ ```
30
+
31
+ **Bun**:
32
+
33
+ ```bash
34
+ bun add @mastra/redis-streams
35
+ ```
36
+
37
+ ## Usage example
38
+
39
+ Provide a Redis connection URL.
40
+
41
+ ```typescript
42
+ import { Mastra } from '@mastra/core'
43
+ import { RedisStreamsPubSub } from '@mastra/redis-streams'
44
+
45
+ export const mastra = new Mastra({
46
+ pubsub: new RedisStreamsPubSub({
47
+ url: 'redis://localhost:6379',
48
+ }),
49
+ })
50
+ ```
51
+
52
+ ## Constructor parameters
53
+
54
+ **url** (`string`): Redis connection URL. Falls back to \`redisOptions.url\`. (Default: `redis://localhost:6379`)
55
+
56
+ **keyPrefix** (`string`): Prefix for stream keys. Each topic maps to \`\<keyPrefix>:\<topic>\`. (Default: `mastra:topic`)
57
+
58
+ **blockMs** (`number`): How long, in milliseconds, each read blocks while waiting for new events. (Default: `1000`)
59
+
60
+ **redisOptions** (`RedisClientOptions`): Options passed to the underlying \`redis\` client for advanced configuration.
61
+
62
+ **maxStreamLength** (`number`): Approximate maximum number of entries kept per stream. Set to 0 to disable trimming. (Default: `10000`)
63
+
64
+ **reclaimIntervalMs** (`number`): How often, in milliseconds, a subscription reclaims events that an earlier consumer read but never acknowledged. Set to 0 to disable. (Default: `30000`)
65
+
66
+ **reclaimIdleMs** (`number`): Minimum idle time, in milliseconds, before a pending event is eligible for reclaim. Keep this well above typical processing time to avoid double delivery. (Default: `60000`)
67
+
68
+ **maxDeliveryAttempts** (`number`): Maximum times an event is redelivered through \`nack\` before it is dropped. Pass \`Infinity\` to disable the cap. (Default: `5`)
69
+
70
+ **logger** (`{ debug?: Function; warn?: Function }`): Optional logger for diagnostics. When omitted, suppressed errors are silent.
71
+
72
+ ## Properties
73
+
74
+ **supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \`\["pull"]\`.
75
+
76
+ ## Methods
77
+
78
+ `RedisStreamsPubSub` implements the [`PubSub`](https://mastra.ai/reference/pubsub/base) contract. The methods below have behavior specific to this implementation.
79
+
80
+ ### `subscribe(topic, cb, options?)`
81
+
82
+ Subscribes to a topic. With `options.group`, members of the group share events through a Redis consumer group. Without a group, the subscriber receives every event through a private consumer group.
83
+
84
+ ```typescript
85
+ await pubsub.subscribe('workflow.events', (event, ack, nack) => {
86
+ console.log(event)
87
+ })
88
+ ```
89
+
90
+ ### `flush()`
91
+
92
+ Waits for in-flight publishes to complete.
93
+
94
+ ```typescript
95
+ await pubsub.flush()
96
+ ```
97
+
98
+ ### `close()`
99
+
100
+ Closes the Redis connections and stops all subscriptions. Call this during graceful shutdown.
101
+
102
+ ```typescript
103
+ await pubsub.close()
104
+ ```
105
+
106
+ ## Redelivery and reclaim
107
+
108
+ When a subscriber calls `nack`, the event is republished with an incremented `deliveryAttempt` and the original is acknowledged. Once an event reaches `maxDeliveryAttempts`, it is dropped instead of redelivered. Separately, each subscription periodically reclaims events that an earlier consumer in the group read but never acknowledged, controlled by `reclaimIntervalMs` and `reclaimIdleMs`.
@@ -0,0 +1,52 @@
1
+ # UnixSocketPubSub
2
+
3
+ `UnixSocketPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation that delivers events across processes on a single host using a Unix domain socket. It elects one process as a broker, and other processes connect to it as clients. If the broker exits, the remaining clients elect a new broker automatically.
4
+
5
+ Use it when several local processes need to share a stream, such as coordinating thread streams across the Mastra Code terminal interface. For single-process delivery, use [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). For distributed delivery across hosts, use [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub).
6
+
7
+ `UnixSocketPubSub` is a push transport: events arrive without a read loop, so Mastra does not run a pull worker for it.
8
+
9
+ ## Usage example
10
+
11
+ Pass a socket path that every participating process shares.
12
+
13
+ ```typescript
14
+ import { Mastra } from '@mastra/core'
15
+ import { UnixSocketPubSub } from '@mastra/core/events'
16
+
17
+ export const mastra = new Mastra({
18
+ pubsub: new UnixSocketPubSub('/tmp/mastra/events.sock'),
19
+ })
20
+ ```
21
+
22
+ ## Constructor parameters
23
+
24
+ **socketPath** (`string`): Path to the Unix domain socket. All processes that share a stream must use the same path.
25
+
26
+ **options** (`UnixSocketPubSubOptions`): Optional configuration.
27
+
28
+ ## Properties
29
+
30
+ **socketPath** (`string`): The socket path passed to the constructor.
31
+
32
+ **supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \`\["push"]\`.
33
+
34
+ **isBroker** (`boolean`): Whether this instance currently acts as the broker.
35
+
36
+ **remoteClientCount** (`number`): Number of remote clients connected to this broker. Always 0 when this instance is not the broker.
37
+
38
+ ## Methods
39
+
40
+ `UnixSocketPubSub` implements the [`PubSub`](https://mastra.ai/reference/pubsub/base) contract. The method below is specific to this implementation.
41
+
42
+ ### `close()`
43
+
44
+ Closes the socket connection and, when this instance is the broker, releases the broker role. Call this during graceful shutdown.
45
+
46
+ ```typescript
47
+ await pubsub.close()
48
+ ```
49
+
50
+ ## Broker election
51
+
52
+ The first process to bind the socket becomes the broker and routes events between all connected clients. Other processes connect as clients. When the broker exits, an exclusive lock file serializes the next election so exactly one client becomes the new broker, and the remaining clients resubscribe to it. This avoids a split-brain state where two processes both act as broker.
@@ -16,7 +16,7 @@ function rerank(
16
16
  ```typescript
17
17
  import { rerank } from '@mastra/rag'
18
18
 
19
- const model = 'openai/gpt-5.4'
19
+ const model = 'openai/gpt-5.5'
20
20
 
21
21
  const rerankedResults = await rerank(vectorSearchResults, 'How do I deploy to production?', model, {
22
22
  weights: {
@@ -114,7 +114,7 @@ import { Mastra } from '@mastra/core/mastra'
114
114
  greeter: {
115
115
  name: 'greeter',
116
116
  description: 'Greets the user',
117
- model: config.get('MASTRA_MODEL', '__OPENAI_MODEL_MINI__'),
117
+ model: config.get('MASTRA_MODEL', 'openai/gpt-5-mini'),
118
118
  },
119
119
  },
120
120
  }),
@@ -241,7 +241,7 @@ export const dsqlAgent = new Agent({
241
241
  name: 'DSQL Agent',
242
242
  instructions:
243
243
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
244
- model: 'openai/gpt-5.4',
244
+ model: 'openai/gpt-5.5',
245
245
  memory: new Memory({
246
246
  storage: new DSQLStore({
247
247
  id: 'dsql-agent-storage',
@@ -93,6 +93,12 @@ storage: new LibSQLStore({
93
93
 
94
94
  **authToken** (`string`): Authentication token for remote libSQL databases.
95
95
 
96
+ ## Managed tables
97
+
98
+ The storage implementation creates the core storage tables automatically, including `mastra_notifications` for notification inbox records and delivery metadata.
99
+
100
+ `LibSQLStore` exposes notification storage through `getStore('notifications')`.
101
+
96
102
  ## Initialization
97
103
 
98
104
  When you pass storage to the Mastra class, `init()` is called automatically to create the [core schema](https://mastra.ai/reference/storage/overview):
@@ -97,6 +97,9 @@ The storage implementation handles collection creation and management automatica
97
97
  - `mastra_traces`: Stores telemetry and tracing data
98
98
  - `mastra_scorers`: Stores scoring and evaluation data
99
99
  - `mastra_resources`: Stores resource working memory data
100
+ - `mastra_notifications`: Stores notification inbox records and delivery metadata
101
+
102
+ `MongoDBStore` exposes notification storage through `getStore('notifications')`.
100
103
 
101
104
  ### Initialization
102
105
 
@@ -206,7 +209,7 @@ export const mongodbAgent = new Agent({
206
209
  name: 'mongodb-agent',
207
210
  instructions:
208
211
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
209
- model: 'openai/gpt-5.4',
212
+ model: 'openai/gpt-5.5',
210
213
  memory: new Memory({
211
214
  storage: new MongoDBStore({
212
215
  uri: process.env.MONGODB_URI!,