@mastra/mcp-docs-server 1.2.4 → 1.2.5-alpha.3
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/docs/agent-builder/deploying.md +1 -1
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/background-tasks.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/durable-agents.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/goals.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/heartbeats.md +5 -5
- package/.docs/docs/{agents → long-running-agents}/signal-providers.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/config.md +1 -2
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +81 -1
- package/.docs/docs/voice/speech-to-text.md +19 -1
- package/.docs/docs/voice/text-to-speech.md +21 -1
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/docs/workflows/human-in-the-loop.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/channels.md +76 -0
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
- package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
- package/.docs/guides/concepts/streaming.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -2
- package/.docs/guides/guide/signal-provider.md +5 -5
- package/.docs/models/environment-variables.md +2 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +2 -1
- package/.docs/models/providers/friendli.md +1 -2
- package/.docs/models/providers/kenari.md +95 -0
- package/.docs/models/providers/nvidia.md +2 -3
- package/.docs/models/providers/tencent-token-plan.md +7 -7
- package/.docs/models/providers/tencent-tokenhub.md +5 -4
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/acp/acp-agent.md +5 -5
- package/.docs/reference/acp/create-acp-tool.md +5 -5
- package/.docs/reference/agent-controller/agent-controller-class.md +27 -27
- package/.docs/reference/agents/agent.md +34 -34
- package/.docs/reference/agents/channels.md +19 -19
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +22 -22
- package/.docs/reference/agents/generate.md +10 -10
- package/.docs/reference/agents/generateLegacy.md +12 -12
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +9 -9
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +4 -4
- package/.docs/reference/ai-sdk/handle-chat-stream.md +6 -6
- package/.docs/reference/ai-sdk/handle-network-stream.md +3 -3
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +4 -4
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/with-mastra.md +2 -2
- package/.docs/reference/ai-sdk/workflow-route.md +2 -2
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +1 -1
- package/.docs/reference/auth/google.md +10 -10
- package/.docs/reference/auth/okta.md +11 -11
- package/.docs/reference/auth/workos.md +3 -3
- package/.docs/reference/channels/slack-provider.md +15 -15
- package/.docs/reference/cli/mastra.md +145 -0
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/mastra-client.md +5 -5
- package/.docs/reference/client-js/responses.md +3 -3
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/getAgentById.md +3 -3
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listWorkflows.md +1 -1
- package/.docs/reference/core/mastra-class.md +3 -3
- package/.docs/reference/core/removeWorkspace.md +2 -2
- package/.docs/reference/datasets/compareExperiments.md +1 -1
- package/.docs/reference/datasets/getItemHistory.md +1 -1
- package/.docs/reference/datasets/list.md +5 -5
- package/.docs/reference/datasets/listExperimentResults.md +4 -4
- package/.docs/reference/datasets/listExperiments.md +4 -4
- package/.docs/reference/datasets/listItems.md +5 -5
- package/.docs/reference/datasets/listVersions.md +3 -3
- package/.docs/reference/datasets/startExperiment.md +8 -8
- package/.docs/reference/datasets/startExperimentAsync.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +7 -7
- package/.docs/reference/editor/agent-builder/builder-models.md +4 -4
- package/.docs/reference/editor/blob-store-provider.md +2 -2
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +2 -2
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/processor-provider.md +4 -4
- package/.docs/reference/editor/sandbox-provider.md +2 -2
- package/.docs/reference/editor/storage-browser-ref.md +2 -2
- package/.docs/reference/editor/storage-workspace-ref.md +7 -7
- package/.docs/reference/evals/create-scorer.md +8 -8
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +7 -7
- package/.docs/reference/evals/trajectory-accuracy.md +1 -1
- package/.docs/reference/index.md +2 -2
- package/.docs/reference/logging/pino-logger.md +4 -4
- package/.docs/reference/memory/cloneThread.md +35 -4
- package/.docs/reference/memory/memory-class.md +5 -5
- package/.docs/reference/memory/observational-memory.md +43 -43
- package/.docs/reference/memory/recall.md +4 -4
- package/.docs/reference/memory/serialized-memory-config.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +4 -4
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +20 -20
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/response-cache.md +6 -6
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/pubsub/base.md +7 -7
- package/.docs/reference/pubsub/caching-pubsub.md +1 -1
- package/.docs/reference/pubsub/event-emitter.md +2 -2
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +6 -6
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +3 -3
- package/.docs/reference/server/register-api-route.md +3 -3
- package/.docs/reference/signals/create-notification-inbox-tool.md +3 -3
- package/.docs/reference/signals/signal-provider.md +7 -7
- package/.docs/reference/signals/webhook-signal-provider.md +2 -2
- package/.docs/reference/storage/clickhouse.md +7 -7
- package/.docs/reference/storage/composite.md +2 -2
- package/.docs/reference/storage/duckdb.md +1 -1
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/redis.md +2 -2
- package/.docs/reference/storage/retention.md +5 -5
- package/.docs/reference/storage/spanner.md +6 -6
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +14 -14
- package/.docs/reference/streaming/agents/streamLegacy.md +10 -10
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/templates/overview.md +1 -140
- package/.docs/reference/tools/brightdata.md +4 -4
- package/.docs/reference/tools/create-code-mode.md +5 -5
- package/.docs/reference/tools/create-tool.md +15 -15
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +2 -2
- package/.docs/reference/tools/mcp-server.md +12 -12
- package/.docs/reference/tools/perplexity.md +3 -3
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/voice/google-gemini-live.md +3 -3
- package/.docs/reference/voice/inworld-realtime.md +12 -12
- package/.docs/reference/voice/inworld.md +2 -2
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +4 -4
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +5 -5
- package/.docs/reference/workspace/archil-filesystem.md +5 -5
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -1
- package/.docs/reference/workspace/daytona-sandbox.md +1 -1
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +3 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/mesa-filesystem.md +3 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +4 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/{vercel-microvm-sandbox.md → vercel-sandbox.md} +21 -15
- package/.docs/reference/workspace/{vercel.md → vercel-serverless.md} +21 -14
- package/.docs/reference/workspace/workspace-class.md +15 -15
- package/CHANGELOG.md +15 -0
- package/package.json +5 -5
- package/.docs/docs/agents/adding-voice.md +0 -383
- package/.docs/docs/community/contributing-templates.md +0 -5
- package/.docs/docs/community/discord.md +0 -11
- package/.docs/guides/build-your-ui/copilotkit.md +0 -291
- package/LICENSE.md +0 -30
- /package/.docs/docs/{community/licensing.md → license.md} +0 -0
- /package/.docs/docs/{agents → long-running-agents}/signals.md +0 -0
|
@@ -137,9 +137,9 @@ await pubsub.subscribeFromOffset('my-topic', 42, event => {
|
|
|
137
137
|
|
|
138
138
|
## Properties
|
|
139
139
|
|
|
140
|
-
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Delivery modes the implementation supports. Defaults to
|
|
140
|
+
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Delivery modes the implementation supports. Defaults to \["pull"].
|
|
141
141
|
|
|
142
|
-
**supportsNativeBatching** (`boolean`): Whether the implementation honors
|
|
142
|
+
**supportsNativeBatching** (`boolean`): Whether the implementation honors options.batch on subscribe(). Defaults to false. Backends that integrate batching internally override this and return true.
|
|
143
143
|
|
|
144
144
|
## Types
|
|
145
145
|
|
|
@@ -163,7 +163,7 @@ await pubsub.subscribeFromOffset('my-topic', 42, event => {
|
|
|
163
163
|
|
|
164
164
|
**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.
|
|
165
165
|
|
|
166
|
-
**batch** (`SubscribeBatchOptions`): Opt in to batched delivery for this subscription. When omitted, events are delivered one at a time. Honored only by backends where
|
|
166
|
+
**batch** (`SubscribeBatchOptions`): Opt in to batched delivery for this subscription. When omitted, events are delivered one at a time. Honored only by backends where supportsNativeBatching is true.
|
|
167
167
|
|
|
168
168
|
### `SubscribeBatchOptions`
|
|
169
169
|
|
|
@@ -173,15 +173,15 @@ Per-subscription batching policy. The callback signature doesn't change; a batch
|
|
|
173
173
|
|
|
174
174
|
**maxWaitMs** (`number`): Maximum time in milliseconds the oldest event may sit in the buffer. The timer starts when the buffer transitions from empty to non-empty.
|
|
175
175
|
|
|
176
|
-
**minIntervalMs** (`number`): Minimum time in milliseconds between consecutive batch deliveries. Even when
|
|
176
|
+
**minIntervalMs** (`number`): Minimum time in milliseconds between consecutive batch deliveries. Even when maxSize or maxWaitMs would fire, the buffer holds until this interval has elapsed since the last delivery.
|
|
177
177
|
|
|
178
|
-
**isImmediate** (`(event: Event) => boolean`): When it returns
|
|
178
|
+
**isImmediate** (`(event: Event) => boolean`): When it returns true for an event, the buffer flushes immediately on publish, subject to minIntervalMs. A per-event escape hatch.
|
|
179
179
|
|
|
180
|
-
**coalesce** (`(events: Event[]) => Event[]`): Applied to the queued batch before delivery to drop superseded events. Must return a subset of its input by reference identity; returning freshly constructed
|
|
180
|
+
**coalesce** (`(events: Event[]) => Event[]`): Applied to the queued batch before delivery to drop superseded events. Must return a subset of its input by reference identity; returning freshly constructed Event objects is a contract violation and discards the whole batch. Ordering of kept events is preserved.
|
|
181
181
|
|
|
182
182
|
**maxBufferSize** (`number`): Maximum events the buffer may hold before overflow handling kicks in. Events flagged immediate are never dropped on overflow. (Default: `256`)
|
|
183
183
|
|
|
184
|
-
**overflow** (`"drop-oldest" | "drop-newest" | "coalesce-or-drop-oldest"`): Overflow strategy when the buffer exceeds
|
|
184
|
+
**overflow** (`"drop-oldest" | "drop-newest" | "coalesce-or-drop-oldest"`): Overflow strategy when the buffer exceeds maxBufferSize. coalesce-or-drop-oldest runs coalesce first, then drops oldest if still over budget. (Default: `coalesce-or-drop-oldest`)
|
|
185
185
|
|
|
186
186
|
### `EventCallback`
|
|
187
187
|
|
|
@@ -44,7 +44,7 @@ const pubsub = withCaching(new EventEmitterPubSub(), new InMemoryServerCache())
|
|
|
44
44
|
|
|
45
45
|
## Properties
|
|
46
46
|
|
|
47
|
-
**supportsNativeBatching** (`boolean`): Mirrors the inner pub/sub. Returns
|
|
47
|
+
**supportsNativeBatching** (`boolean`): Mirrors the inner pub/sub. Returns true only when the wrapped implementation supports batching.
|
|
48
48
|
|
|
49
49
|
## Methods
|
|
50
50
|
|
|
@@ -47,9 +47,9 @@ const pubsub = new EventEmitterPubSub(undefined, { logger })
|
|
|
47
47
|
|
|
48
48
|
## Properties
|
|
49
49
|
|
|
50
|
-
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns
|
|
50
|
+
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \["pull", "push"]. The emitter can serve a pull-style worker or push events directly to listeners.
|
|
51
51
|
|
|
52
|
-
**supportsNativeBatching** (`boolean`): Returns
|
|
52
|
+
**supportsNativeBatching** (`boolean`): Returns true. Subscribers can opt in to batched delivery with options.batch.
|
|
53
53
|
|
|
54
54
|
## Methods
|
|
55
55
|
|
|
@@ -51,7 +51,7 @@ export const mastra = new Mastra({
|
|
|
51
51
|
|
|
52
52
|
## Constructor parameters
|
|
53
53
|
|
|
54
|
-
**config** (`ClientConfig`): Configuration for the Google Cloud Pub/Sub client, including credentials and project ID. See the
|
|
54
|
+
**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.
|
|
55
55
|
|
|
56
56
|
## Methods
|
|
57
57
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# LeaseProvider
|
|
4
4
|
|
|
5
|
-
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a given resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
|
|
5
|
+
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/long-running-agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a given resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
|
|
6
6
|
|
|
7
7
|
Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can genuinely coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that cannot lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
|
|
8
8
|
|
|
@@ -62,7 +62,7 @@ Returns: `Promise<{ acquired: boolean; owner?: string }>`
|
|
|
62
62
|
|
|
63
63
|
**key** (`string`): The lease key, such as a thread key.
|
|
64
64
|
|
|
65
|
-
**owner** (`string`): Identifier for the owner, such as a
|
|
65
|
+
**owner** (`string`): Identifier for the owner, such as a runId. The same owner can call acquireLease idempotently to renew or release.
|
|
66
66
|
|
|
67
67
|
**ttlMs** (`number`): Time-to-live in milliseconds for the lease.
|
|
68
68
|
|
|
@@ -129,5 +129,5 @@ When the configured pub/sub backend does not implement `LeaseProvider`, the runt
|
|
|
129
129
|
|
|
130
130
|
- [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
|
|
131
131
|
- [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
|
|
132
|
-
- [Signals](https://mastra.ai/docs/agents/signals): The runtime that uses leasing to coordinate thread runs across processes
|
|
132
|
+
- [Signals](https://mastra.ai/docs/long-running-agents/signals): The runtime that uses leasing to coordinate thread runs across processes
|
|
133
133
|
- [Channels](https://mastra.ai/docs/agents/channels): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
|
|
@@ -53,13 +53,13 @@ export const mastra = new Mastra({
|
|
|
53
53
|
|
|
54
54
|
## Constructor parameters
|
|
55
55
|
|
|
56
|
-
**url** (`string`): Redis connection URL. Falls back to
|
|
56
|
+
**url** (`string`): Redis connection URL. Falls back to redisOptions.url. (Default: `redis://localhost:6379`)
|
|
57
57
|
|
|
58
|
-
**keyPrefix** (`string`): Prefix for stream keys. Each topic maps to
|
|
58
|
+
**keyPrefix** (`string`): Prefix for stream keys. Each topic maps to \<keyPrefix>:\<topic>. (Default: `mastra:topic`)
|
|
59
59
|
|
|
60
60
|
**blockMs** (`number`): How long, in milliseconds, each read blocks while waiting for new events. (Default: `1000`)
|
|
61
61
|
|
|
62
|
-
**redisOptions** (`RedisClientOptions`): Options passed to the underlying
|
|
62
|
+
**redisOptions** (`RedisClientOptions`): Options passed to the underlying redis client for advanced configuration.
|
|
63
63
|
|
|
64
64
|
**maxStreamLength** (`number`): Approximate maximum number of entries kept per stream. Set to 0 to disable trimming. (Default: `10000`)
|
|
65
65
|
|
|
@@ -67,13 +67,13 @@ export const mastra = new Mastra({
|
|
|
67
67
|
|
|
68
68
|
**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`)
|
|
69
69
|
|
|
70
|
-
**maxDeliveryAttempts** (`number`): Maximum times an event is redelivered through
|
|
70
|
+
**maxDeliveryAttempts** (`number`): Maximum times an event is redelivered through nack before it is dropped. Pass Infinity to disable the cap. (Default: `5`)
|
|
71
71
|
|
|
72
72
|
**logger** (`{ debug?: Function; warn?: Function }`): Optional logger for diagnostics. When omitted, suppressed errors are silent.
|
|
73
73
|
|
|
74
74
|
## Properties
|
|
75
75
|
|
|
76
|
-
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns
|
|
76
|
+
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \["pull"].
|
|
77
77
|
|
|
78
78
|
## Methods
|
|
79
79
|
|
|
@@ -111,7 +111,7 @@ When a subscriber calls `nack`, the event is republished with an incremented `de
|
|
|
111
111
|
|
|
112
112
|
## Distributed leasing
|
|
113
113
|
|
|
114
|
-
`RedisStreamsPubSub` implements the [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) contract on top of the same Redis connection. The [signals runtime](https://mastra.ai/docs/agents/signals) uses it to elect a single owner (usually per thread key) so that across instances only one process wakes and runs the agent, and others route follow-up work to the holder. This is what makes signals work on serverless and multi-instance deployments; without a shared lease, each instance would start its own competing run.
|
|
114
|
+
`RedisStreamsPubSub` implements the [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) contract on top of the same Redis connection. The [signals runtime](https://mastra.ai/docs/long-running-agents/signals) uses it to elect a single owner (usually per thread key) so that across instances only one process wakes and runs the agent, and others route follow-up work to the holder. This is what makes signals work on serverless and multi-instance deployments; without a shared lease, each instance would start its own competing run.
|
|
115
115
|
|
|
116
116
|
Lease keys are namespaced under the same `keyPrefix` as topics, as `<keyPrefix>:lease:<key>`. All operations are atomic: `acquireLease` uses `SET NX PX` and refreshes its own TTL idempotently, while `releaseLease`, `renewLease`, and `transferLease` use Lua scripts that check ownership before mutating, so a concurrent renewal from another owner is never clobbered.
|
|
117
117
|
|
|
@@ -31,7 +31,7 @@ export const mastra = new Mastra({
|
|
|
31
31
|
|
|
32
32
|
**socketPath** (`string`): The socket path passed to the constructor.
|
|
33
33
|
|
|
34
|
-
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns
|
|
34
|
+
**supportedModes** (`ReadonlyArray<"pull" | "push">`): Returns \["push"].
|
|
35
35
|
|
|
36
36
|
**isBroker** (`boolean`): Whether this instance currently acts as the broker.
|
|
37
37
|
|
|
@@ -178,9 +178,9 @@ The options documented below are passed directly at the top level of the configu
|
|
|
178
178
|
|
|
179
179
|
**joinThreshold** (`number`): Maximum token count for merging related sections. Sections exceeding this limit individually are left intact, but smaller sections are merged with siblings or parents if the combined size stays under this threshold. (Default: `500`)
|
|
180
180
|
|
|
181
|
-
**modelName** (`string`): Name of the model for tokenization. If provided, the model's underlying tokenization
|
|
181
|
+
**modelName** (`string`): Name of the model for tokenization. If provided, the model's underlying tokenization encodingName will be used.
|
|
182
182
|
|
|
183
|
-
**encodingName** (`string`): Name of the token encoding to use. Derived from
|
|
183
|
+
**encodingName** (`string`): Name of the token encoding to use. Derived from modelName if available. (Default: `cl100k_base`)
|
|
184
184
|
|
|
185
185
|
**allowedSpecial** (`Set<string> | 'all'`): Set of special tokens allowed during tokenization, or 'all' to allow all special tokens
|
|
186
186
|
|
|
@@ -22,9 +22,9 @@ function createRoute<TPath, TQuery, TBody, TResponse, TResponseType>(
|
|
|
22
22
|
|
|
23
23
|
**method** (`'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'ALL'`): HTTP method
|
|
24
24
|
|
|
25
|
-
**path** (`string`): Route path with optional params (e.g.,
|
|
25
|
+
**path** (`string`): Route path with optional params (e.g., /api/items/:id)
|
|
26
26
|
|
|
27
|
-
**responseType** (`'json' | 'stream'`): Response format. Internal routes may use additional types (
|
|
27
|
+
**responseType** (`'json' | 'stream'`): Response format. Internal routes may use additional types (datastream-response, mcp-http, mcp-sse).
|
|
28
28
|
|
|
29
29
|
**handler** (`ServerRouteHandler`): Route handler function
|
|
30
30
|
|
|
@@ -48,7 +48,7 @@ function createRoute<TPath, TQuery, TBody, TResponse, TResponseType>(
|
|
|
48
48
|
|
|
49
49
|
**deprecated** (`boolean`): Mark route as deprecated
|
|
50
50
|
|
|
51
|
-
**onValidationError** (`(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`): Custom validation error handler for this route. Overrides the server-level
|
|
51
|
+
**onValidationError** (`(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`): Custom validation error handler for this route. Overrides the server-level onValidationError hook. Return { status, body } to customize the response, or undefined to use the default.
|
|
52
52
|
|
|
53
53
|
## Handler parameters
|
|
54
54
|
|
|
@@ -60,21 +60,21 @@ app.listen(4111, () => {
|
|
|
60
60
|
|
|
61
61
|
**mastra** (`Mastra`): Mastra instance
|
|
62
62
|
|
|
63
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
63
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
64
64
|
|
|
65
|
-
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g.,
|
|
65
|
+
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
66
66
|
|
|
67
67
|
**bodyLimitOptions** (`{ maxSize: number, onError: (err) => unknown }`): Request body size limits
|
|
68
68
|
|
|
69
69
|
**streamOptions** (`{ redact?: boolean }`): Stream redaction config. When true, redacts sensitive data from streams. (Default: `{ redact: true }`)
|
|
70
70
|
|
|
71
|
-
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are
|
|
71
|
+
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH (e.g., GET:/api/health). Value false makes route public, true requires auth.
|
|
72
72
|
|
|
73
73
|
**tools** (`Record<string, Tool>`): Available tools for the server
|
|
74
74
|
|
|
75
75
|
**taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
|
|
76
76
|
|
|
77
|
-
**mcpOptions** (`MCPOptions`): MCP transport options. Set
|
|
77
|
+
**mcpOptions** (`MCPOptions`): MCP transport options. Set serverless: true for stateless environments like Cloudflare Workers or Vercel Edge.
|
|
78
78
|
|
|
79
79
|
## Differences from Hono
|
|
80
80
|
|
|
@@ -61,21 +61,21 @@ app.listen({ port: 3000 }, (err, address) => {
|
|
|
61
61
|
|
|
62
62
|
**mastra** (`Mastra`): Mastra instance
|
|
63
63
|
|
|
64
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
64
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
65
65
|
|
|
66
|
-
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g.,
|
|
66
|
+
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
67
67
|
|
|
68
68
|
**bodyLimitOptions** (`BodyLimitOptions`): Request body size limits
|
|
69
69
|
|
|
70
70
|
**streamOptions** (`StreamOptions`): Stream redaction config. When true (default), redacts sensitive data (system prompts, tool definitions, API keys) from stream chunks before sending to clients. (Default: `{ redact: true }`)
|
|
71
71
|
|
|
72
|
-
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are
|
|
72
|
+
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH (e.g., GET:/api/health). Value false makes route public, true requires auth.
|
|
73
73
|
|
|
74
74
|
**tools** (`ToolsInput`): Available tools for the server
|
|
75
75
|
|
|
76
76
|
**taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
|
|
77
77
|
|
|
78
|
-
**mcpOptions** (`MCPOptions`): MCP transport options. Set
|
|
78
|
+
**mcpOptions** (`MCPOptions`): MCP transport options. Set serverless: true for stateless environments like Cloudflare Workers or Vercel Edge.
|
|
79
79
|
|
|
80
80
|
## Protecting raw routes
|
|
81
81
|
|
|
@@ -55,21 +55,21 @@ export default app
|
|
|
55
55
|
|
|
56
56
|
**mastra** (`Mastra`): Mastra instance
|
|
57
57
|
|
|
58
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
58
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
59
59
|
|
|
60
|
-
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g.,
|
|
60
|
+
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
61
61
|
|
|
62
62
|
**bodyLimitOptions** (`{ maxSize: number, onError: (err) => unknown }`): Request body size limits
|
|
63
63
|
|
|
64
64
|
**streamOptions** (`{ redact?: boolean }`): Stream redaction config. When true, redacts sensitive data from streams. (Default: `{ redact: true }`)
|
|
65
65
|
|
|
66
|
-
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are
|
|
66
|
+
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH (e.g., GET:/api/health). Value false makes route public, true requires auth.
|
|
67
67
|
|
|
68
68
|
**tools** (`Record<string, Tool>`): Available tools for the server
|
|
69
69
|
|
|
70
70
|
**taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
|
|
71
71
|
|
|
72
|
-
**mcpOptions** (`MCPOptions`): MCP transport options. Set
|
|
72
|
+
**mcpOptions** (`MCPOptions`): MCP transport options. Set serverless: true for stateless environments like Cloudflare Workers or Vercel Edge.
|
|
73
73
|
|
|
74
74
|
## Adding custom routes
|
|
75
75
|
|
|
@@ -60,21 +60,21 @@ app.listen(3000, () => {
|
|
|
60
60
|
|
|
61
61
|
**mastra** (`Mastra`): Mastra instance
|
|
62
62
|
|
|
63
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
63
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
64
64
|
|
|
65
|
-
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g.,
|
|
65
|
+
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
66
66
|
|
|
67
67
|
**bodyLimitOptions** (`BodyLimitOptions`): Request body size limits
|
|
68
68
|
|
|
69
69
|
**streamOptions** (`StreamOptions`): Stream redaction config. When true (default), redacts sensitive data (system prompts, tool definitions, API keys) from stream chunks before sending to clients. (Default: `{ redact: true }`)
|
|
70
70
|
|
|
71
|
-
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are
|
|
71
|
+
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH (e.g., GET:/api/health). Value false makes route public, true requires auth.
|
|
72
72
|
|
|
73
73
|
**tools** (`ToolsInput`): Available tools for the server
|
|
74
74
|
|
|
75
75
|
**taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
|
|
76
76
|
|
|
77
|
-
**mcpOptions** (`MCPOptions`): MCP transport options. Set
|
|
77
|
+
**mcpOptions** (`MCPOptions`): MCP transport options. Set serverless: true for stateless environments like Cloudflare Workers or Vercel Edge.
|
|
78
78
|
|
|
79
79
|
## Error handling
|
|
80
80
|
|
|
@@ -34,7 +34,7 @@ constructor(options: MastraServerOptions<TApp>)
|
|
|
34
34
|
|
|
35
35
|
**mastra** (`Mastra`): Mastra instance
|
|
36
36
|
|
|
37
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
37
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
38
38
|
|
|
39
39
|
**openapiPath** (`string`): Path to serve OpenAPI spec (Default: `''`)
|
|
40
40
|
|
|
@@ -73,7 +73,7 @@ By default, Mastra routes mount under `/api`. Use `prefix` to change it.
|
|
|
73
73
|
|
|
74
74
|
**mastra** (`Mastra`): Mastra instance
|
|
75
75
|
|
|
76
|
-
**prefix** (`string`): Route path prefix (e.g.,
|
|
76
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `` `/api` ``)
|
|
77
77
|
|
|
78
78
|
**rateLimitOptions** (`{ enabled?: boolean; defaultLimit?: number; windowMs?: number; generateLimit?: number }`): Rate limiting config (enabled by default)
|
|
79
79
|
|
|
@@ -87,7 +87,7 @@ By default, Mastra routes mount under `/api`. Use `prefix` to change it.
|
|
|
87
87
|
|
|
88
88
|
**contextOptions** (`{ strict?: boolean; logWarnings?: boolean }`): Request context parsing config
|
|
89
89
|
|
|
90
|
-
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are
|
|
90
|
+
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH.
|
|
91
91
|
|
|
92
92
|
**tools** (`Record<string, Tool>`): Registered tools for the server
|
|
93
93
|
|
|
@@ -95,7 +95,7 @@ By default, Mastra routes mount under `/api`. Use `prefix` to change it.
|
|
|
95
95
|
|
|
96
96
|
**mcpOptions** (`{ serverless?: boolean; sessionIdGenerator?: () => string }`): MCP transport options
|
|
97
97
|
|
|
98
|
-
**auth** (`{ enabled?: boolean; allowQueryApiKey?: boolean }`): Enable Mastra token auth. Disabled by default — most NestJS apps use their own auth guards. Query-string
|
|
98
|
+
**auth** (`{ enabled?: boolean; allowQueryApiKey?: boolean }`): Enable Mastra token auth. Disabled by default — most NestJS apps use their own auth guards. Query-string apiKey auth is opt-in for backward compatibility. (Default: `` `{ enabled: false }` ``)
|
|
99
99
|
|
|
100
100
|
## Async registration
|
|
101
101
|
|
|
@@ -26,13 +26,13 @@ registerApiRoute("/items/:itemId", { ... })
|
|
|
26
26
|
|
|
27
27
|
**method** (`'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'ALL'`): HTTP method for the route
|
|
28
28
|
|
|
29
|
-
**handler** (`Handler`): Route handler function receiving Hono Context. Use either
|
|
29
|
+
**handler** (`Handler`): Route handler function receiving Hono Context. Use either handler or createHandler, not both.
|
|
30
30
|
|
|
31
|
-
**createHandler** (`(c: Context) => Promise<Handler>`): Async factory function to create the handler. Use either
|
|
31
|
+
**createHandler** (`(c: Context) => Promise<Handler>`): Async factory function to create the handler. Use either handler or createHandler, not both.
|
|
32
32
|
|
|
33
33
|
**middleware** (`MiddlewareHandler | MiddlewareHandler[]`): Route-specific middleware functions
|
|
34
34
|
|
|
35
|
-
**cors** (`CorsOptions`): Route-specific CORS configuration. Use this when one custom route needs a different cross-origin policy from
|
|
35
|
+
**cors** (`CorsOptions`): Route-specific CORS configuration. Use this when one custom route needs a different cross-origin policy from server.cors.
|
|
36
36
|
|
|
37
37
|
**openapi** (`DescribeRouteOptions`): OpenAPI metadata for Swagger UI documentation
|
|
38
38
|
|
|
@@ -33,7 +33,7 @@ export const supportAgent = new Agent({
|
|
|
33
33
|
|
|
34
34
|
**options** (`object`): Tool configuration.
|
|
35
35
|
|
|
36
|
-
**options.storage** (`NotificationsStorage`): Notification storage domain returned by
|
|
36
|
+
**options.storage** (`NotificationsStorage`): Notification storage domain returned by storage.getStore('notifications').
|
|
37
37
|
|
|
38
38
|
## Tool input
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ The generated tool has the id `notification-inbox` and accepts these input field
|
|
|
43
43
|
|
|
44
44
|
**threadId** (`string`): Thread ID to inspect. Defaults to the current agent thread when available.
|
|
45
45
|
|
|
46
|
-
**id** (`string`): Notification ID. Required for
|
|
46
|
+
**id** (`string`): Notification ID. Required for markSeen, dismiss, and archive. Optional for read.
|
|
47
47
|
|
|
48
48
|
**status** (`'pending' | 'delivered' | 'seen' | 'dismissed' | 'archived' | 'discarded'`): Status filter for list, read, or search actions.
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ The generated tool has the id `notification-inbox` and accepts these input field
|
|
|
51
51
|
|
|
52
52
|
**source** (`string`): Source filter for list, read, or search actions.
|
|
53
53
|
|
|
54
|
-
**query** (`string`): Search query. Required when
|
|
54
|
+
**query** (`string`): Search query. Required when action is search.
|
|
55
55
|
|
|
56
56
|
**limit** (`number`): Maximum number of notifications to return. Must be a positive integer.
|
|
57
57
|
|
|
@@ -63,9 +63,9 @@ The agent calls `connect(this)`, registers any processors or tools the provider
|
|
|
63
63
|
|
|
64
64
|
**name** (`string`): Human-readable display name for the provider.
|
|
65
65
|
|
|
66
|
-
**pollInterval** (`number`): Poll interval in milliseconds. When set, the framework calls
|
|
66
|
+
**pollInterval** (`number`): Poll interval in milliseconds. When set, the framework calls poll() on this interval. Leave undefined or 0 for webhook-only providers.
|
|
67
67
|
|
|
68
|
-
**isConnected** (`boolean`): Whether this provider is connected to an agent. Returns
|
|
68
|
+
**isConnected** (`boolean`): Whether this provider is connected to an agent. Returns true after connect() is called. Used internally to skip re-wiring during Agent.\_\_fork().
|
|
69
69
|
|
|
70
70
|
## Methods
|
|
71
71
|
|
|
@@ -154,9 +154,9 @@ const sub = this.subscribe(
|
|
|
154
154
|
|
|
155
155
|
Returns: `SignalSubscription` — the created subscription, or the existing one with merged metadata.
|
|
156
156
|
|
|
157
|
-
**target** (`SignalProviderTarget`): The thread to subscribe. Must include
|
|
157
|
+
**target** (`SignalProviderTarget`): The thread to subscribe. Must include threadId and resourceId.
|
|
158
158
|
|
|
159
|
-
**externalResourceId** (`string`): Provider-specific identifier for the external resource (for example,
|
|
159
|
+
**externalResourceId** (`string`): Provider-specific identifier for the external resource (for example, "github:owner/repo#123").
|
|
160
160
|
|
|
161
161
|
**metadata** (`Record<string, unknown>`): Additional data to store with the subscription. Merged into existing metadata on duplicate subscribes.
|
|
162
162
|
|
|
@@ -352,7 +352,7 @@ await this.notify(
|
|
|
352
352
|
|
|
353
353
|
**notification.source** (`string`): Identifier for the notification source.
|
|
354
354
|
|
|
355
|
-
**notification.kind** (`string`): Type of event (for example,
|
|
355
|
+
**notification.kind** (`string`): Type of event (for example, "pr-updated", "new-message").
|
|
356
356
|
|
|
357
357
|
**notification.summary** (`string`): Human-readable summary of the event.
|
|
358
358
|
|
|
@@ -360,7 +360,7 @@ await this.notify(
|
|
|
360
360
|
|
|
361
361
|
**notification.payload** (`unknown`): Arbitrary data attached to the notification.
|
|
362
362
|
|
|
363
|
-
**target** (`SignalProviderTarget`): The thread to notify. Must include
|
|
363
|
+
**target** (`SignalProviderTarget`): The thread to notify. Must include threadId and resourceId.
|
|
364
364
|
|
|
365
365
|
## Types
|
|
366
366
|
|
|
@@ -376,7 +376,7 @@ The subscription object returned by `subscribe()`.
|
|
|
376
376
|
|
|
377
377
|
**resourceId** (`string`): The resource owning the thread.
|
|
378
378
|
|
|
379
|
-
**externalResourceId** (`string`): Provider-specific identifier for the external resource (for example,
|
|
379
|
+
**externalResourceId** (`string`): Provider-specific identifier for the external resource (for example, "github:owner/repo#123").
|
|
380
380
|
|
|
381
381
|
**subscribedAt** (`Date`): When the subscription was created.
|
|
382
382
|
|
|
@@ -53,7 +53,7 @@ const result = await webhookProvider.handleWebhook({
|
|
|
53
53
|
|
|
54
54
|
**name** (`string`): Human-readable name. (Default: `'Webhook Signals'`)
|
|
55
55
|
|
|
56
|
-
**extractResourceId** (`(payload: unknown) => string | string[] | undefined`): Extract the external resource ID from a webhook payload. Return
|
|
56
|
+
**extractResourceId** (`(payload: unknown) => string | string[] | undefined`): Extract the external resource ID from a webhook payload. Return undefined to skip the event. Can return an array to match multiple resources. (Default: ``Returns `payload.resource` or `payload.externalResourceId` if present``)
|
|
57
57
|
|
|
58
58
|
**buildNotification** (`(payload: unknown, subscription: SignalSubscription) => SendNotificationSignalInput`): Build the notification object from a webhook payload and the matched subscription. (Default: `` Returns `{ source: id, kind: 'webhook-event', summary, payload }` ``)
|
|
59
59
|
|
|
@@ -75,7 +75,7 @@ webhookProvider.subscribeThread(
|
|
|
75
75
|
|
|
76
76
|
Returns: `SignalSubscription`
|
|
77
77
|
|
|
78
|
-
**target** (`SignalProviderTarget`): The thread to subscribe. Must include
|
|
78
|
+
**target** (`SignalProviderTarget`): The thread to subscribe. Must include threadId and resourceId.
|
|
79
79
|
|
|
80
80
|
**externalResourceId** (`string`): The external resource to monitor (for example, a repository full name).
|
|
81
81
|
|
|
@@ -174,19 +174,19 @@ The same `client` form is accepted by `ObservabilityStorageClickhouse` and `Obse
|
|
|
174
174
|
|
|
175
175
|
**id** (`string`): Unique identifier for this storage instance.
|
|
176
176
|
|
|
177
|
-
**url** (`string`): ClickHouse server URL (for example,
|
|
177
|
+
**url** (`string`): ClickHouse server URL (for example, https\://your-instance.clickhouse.cloud:8443 or http\://localhost:8123). Required when not passing a pre-configured client.
|
|
178
178
|
|
|
179
|
-
**username** (`string`): ClickHouse username. Required when not passing a pre-configured
|
|
179
|
+
**username** (`string`): ClickHouse username. Required when not passing a pre-configured client.
|
|
180
180
|
|
|
181
|
-
**password** (`string`): ClickHouse password. Required when not passing a pre-configured
|
|
181
|
+
**password** (`string`): ClickHouse password. Required when not passing a pre-configured client. It can be an empty string for the default user on a local instance.
|
|
182
182
|
|
|
183
|
-
**client** (`ClickHouseClient`): Pre-configured ClickHouse client from
|
|
183
|
+
**client** (`ClickHouseClient`): Pre-configured ClickHouse client from @clickhouse/client. Use this when you need custom request settings. Mutually exclusive with the credential fields above.
|
|
184
184
|
|
|
185
|
-
**ttl** (`object`): Per-table TTL configuration applied at table creation time. Accepts row-level and column-level TTLs in interval units from
|
|
185
|
+
**ttl** (`object`): Per-table TTL configuration applied at table creation time. Accepts row-level and column-level TTLs in interval units from NANOSECOND through YEAR.
|
|
186
186
|
|
|
187
|
-
**replication** (`{ cluster?: string; zookeeperPath?: string; replicaName?: string }`): Opt-in replicated table configuration for multi-replica ClickHouse clusters. When set, Mastra creates replicated MergeTree tables. When
|
|
187
|
+
**replication** (`{ cluster?: string; zookeeperPath?: string; replicaName?: string }`): Opt-in replicated table configuration for multi-replica ClickHouse clusters. When set, Mastra creates replicated MergeTree tables. When cluster is set, Mastra also adds ON CLUSTER to Mastra-owned data definition language (DDL).
|
|
188
188
|
|
|
189
|
-
**disableInit** (`boolean`): When
|
|
189
|
+
**disableInit** (`boolean`): When true, the store does not run table creation or migrations on first use. Call storage.init() explicitly from your deployment scripts. (Default: `false`)
|
|
190
190
|
|
|
191
191
|
`ClickhouseStore` also accepts every option from `ClickHouseClientConfigOptions` (such as `database`, `request_timeout`, `compression`, `keep_alive`, and `max_open_connections`).
|
|
192
192
|
|
|
@@ -128,11 +128,11 @@ export const mastra = new Mastra({
|
|
|
128
128
|
|
|
129
129
|
**id** (`string`): Unique identifier for this storage instance.
|
|
130
130
|
|
|
131
|
-
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in
|
|
131
|
+
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in domains will use this storage's domains as fallbacks.
|
|
132
132
|
|
|
133
133
|
**disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
|
|
134
134
|
|
|
135
|
-
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both
|
|
135
|
+
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage.
|
|
136
136
|
|
|
137
137
|
**domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
|
|
138
138
|
|
|
@@ -108,7 +108,7 @@ const duckdb = new DuckDBStore({ path: ':memory:' })
|
|
|
108
108
|
|
|
109
109
|
**id** (`string`): Unique identifier for this storage instance. (Default: `'duckdb'`)
|
|
110
110
|
|
|
111
|
-
**path** (`string`): Path to the DuckDB database file. Use
|
|
111
|
+
**path** (`string`): Path to the DuckDB database file. Use :memory: for an ephemeral in-memory database. (Default: `'mastra.duckdb'`)
|
|
112
112
|
|
|
113
113
|
### Lower-level types
|
|
114
114
|
|
|
@@ -118,7 +118,7 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
|
|
|
118
118
|
|
|
119
119
|
**config.endpoint** (`string`): Custom endpoint for DynamoDB (e.g., 'http\://localhost:8000' for local development).
|
|
120
120
|
|
|
121
|
-
**config.credentials** (`object`): AWS credentials object with
|
|
121
|
+
**config.credentials** (`object`): AWS credentials object with accessKeyId and secretAccessKey. If not provided, the AWS SDK will attempt to source credentials from environment variables, IAM roles (e.g., for EC2/Lambda), or the shared AWS credentials file.
|
|
122
122
|
|
|
123
123
|
**config.ttl** (`object`): TTL (Time To Live) configuration for automatic data expiration. Configure per entity type: thread, message, trace, eval, workflow\_snapshot, resource, score. Each entity config includes: enabled (boolean), attributeName (string, default: 'ttl'), defaultTtlSeconds (number).
|
|
124
124
|
|
|
@@ -91,7 +91,7 @@ storage: new LibSQLStore({
|
|
|
91
91
|
|
|
92
92
|
## Options
|
|
93
93
|
|
|
94
|
-
**url** (`string`): Database URL. Use
|
|
94
|
+
**url** (`string`): Database URL. Use :memory: for in-memory database, file:filename.db for a file database, or a libSQL connection string (e.g., libsql://your-database.turso.io) for remote storage.
|
|
95
95
|
|
|
96
96
|
**authToken** (`string`): Authentication token for remote libSQL databases.
|
|
97
97
|
|
|
@@ -45,7 +45,7 @@ const storage = new PostgresStore({
|
|
|
45
45
|
|
|
46
46
|
**id** (`string`): Unique identifier for this storage instance.
|
|
47
47
|
|
|
48
|
-
**connectionString** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using
|
|
48
|
+
**connectionString** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using pool or individual host-based parameters (host, port, database, user, password).
|
|
49
49
|
|
|
50
50
|
**host** (`string`): Database server hostname or IP address. Used with other host-based parameters as an alternative to connectionString.
|
|
51
51
|
|
|
@@ -57,7 +57,7 @@ const storage = new PostgresStore({
|
|
|
57
57
|
|
|
58
58
|
**password** (`string`): Password for the database user.
|
|
59
59
|
|
|
60
|
-
**pool** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when
|
|
60
|
+
**pool** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when store.close() is called.
|
|
61
61
|
|
|
62
62
|
**schemaName** (`string`): The name of the schema you want the storage to use. Defaults to 'public'.
|
|
63
63
|
|
|
@@ -69,7 +69,7 @@ const storage = new RedisStore({
|
|
|
69
69
|
|
|
70
70
|
**id** (`string`): Unique identifier for the storage instance
|
|
71
71
|
|
|
72
|
-
**connectionString** (`string`): Redis connection URL (e.g.,
|
|
72
|
+
**connectionString** (`string`): Redis connection URL (e.g., redis\://localhost:6379 or redis\://:password\@localhost:6379)
|
|
73
73
|
|
|
74
74
|
**host** (`string`): Redis host address
|
|
75
75
|
|
|
@@ -79,7 +79,7 @@ const storage = new RedisStore({
|
|
|
79
79
|
|
|
80
80
|
**db** (`number`): Redis database number (Default: `0`)
|
|
81
81
|
|
|
82
|
-
**client** (`RedisClient`): Pre-configured redis client (from the
|
|
82
|
+
**client** (`RedisClient`): Pre-configured redis client (from the redis package) for advanced setups
|
|
83
83
|
|
|
84
84
|
> **Note:** You must provide either `connectionString`, `host`, or `client`. These options are mutually exclusive.
|
|
85
85
|
|
|
@@ -55,11 +55,11 @@ Set the `retention` field on the store config.
|
|
|
55
55
|
|
|
56
56
|
**retention** (`RetentionConfig`): Per-domain, per-table age policies. Unset domains and tables are kept forever.
|
|
57
57
|
|
|
58
|
-
**retention.\[domain]** (`Record<TableKey, TableRetentionPolicy>`): A real storage domain key (e.g.
|
|
58
|
+
**retention.\[domain]** (`Record<TableKey, TableRetentionPolicy>`): A real storage domain key (e.g. memory, observability). Maps that domain's retention-eligible table keys to their policies.
|
|
59
59
|
|
|
60
60
|
### TableRetentionPolicy
|
|
61
61
|
|
|
62
|
-
**maxAge** (`Duration`): Maximum age to keep rows. Rows whose anchor timestamp is strictly older than
|
|
62
|
+
**maxAge** (`Duration`): Maximum age to keep rows. Rows whose anchor timestamp is strictly older than Date.now() - maxAge are eligible for deletion. A number is milliseconds, or a string with a unit suffix: ms, s, m, h, d, w (e.g. '30d', '12h').
|
|
63
63
|
|
|
64
64
|
**batchSize** (`number`): Rows deleted per batch. Each batch is its own transaction, which bounds lock duration and WAL growth on large tables. (Default: `1000`)
|
|
65
65
|
|
|
@@ -122,13 +122,13 @@ Returns: `Promise<PruneResult[]>`
|
|
|
122
122
|
|
|
123
123
|
##### PruneOptions
|
|
124
124
|
|
|
125
|
-
**maxBatches** (`number`): Maximum delete batches per table per call. When reached, that table's result is returned with
|
|
125
|
+
**maxBatches** (`number`): Maximum delete batches per table per call. When reached, that table's result is returned with done: false.
|
|
126
126
|
|
|
127
|
-
**maxRows** (`number`): Maximum rows deleted per table per call. When reached, that table's result is returned with
|
|
127
|
+
**maxRows** (`number`): Maximum rows deleted per table per call. When reached, that table's result is returned with done: false.
|
|
128
128
|
|
|
129
129
|
**pauseMs** (`number`): Delay in milliseconds between batches, to avoid starving live traffic.
|
|
130
130
|
|
|
131
|
-
**signal** (`AbortSignal`): Cooperative cancellation. The batch loop checks it between batches and stops cleanly, returning partial results with
|
|
131
|
+
**signal** (`AbortSignal`): Cooperative cancellation. The batch loop checks it between batches and stops cleanly, returning partial results with done: false.
|
|
132
132
|
|
|
133
133
|
##### PruneResult
|
|
134
134
|
|