@mastra/mcp-docs-server 1.1.46-alpha.3 → 1.1.46-alpha.4
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/browser.md +1 -1
- package/.docs/docs/agent-builder/channels.md +1 -1
- package/.docs/docs/agent-builder/integrations.md +73 -0
- package/.docs/docs/agent-builder/overview.md +1 -0
- package/.docs/docs/agents/adding-voice.md +1 -1
- package/.docs/docs/agents/agent-approval.md +2 -2
- package/.docs/docs/agents/background-tasks.md +1 -1
- package/.docs/docs/agents/channels.md +2 -2
- package/.docs/docs/agents/code-mode.md +20 -56
- package/.docs/docs/agents/overview.md +1 -0
- package/.docs/docs/agents/sdk-agents.md +165 -1
- package/.docs/docs/agents/supervisor-agents.md +40 -2
- package/.docs/docs/agents/using-tools.md +59 -1
- package/.docs/docs/browser/agent-browser.md +1 -1
- package/.docs/docs/browser/browser-viewer.md +22 -15
- package/.docs/docs/browser/overview.md +1 -1
- package/.docs/docs/browser/stagehand.md +1 -1
- package/.docs/docs/editor/overview.md +6 -6
- package/.docs/docs/editor/prompts.md +3 -3
- package/.docs/docs/editor/tools.md +2 -2
- package/.docs/docs/evals/evals-with-memory.md +8 -8
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mcp/mcp-apps.md +4 -4
- package/.docs/docs/memory/observational-memory.md +1 -1
- package/.docs/docs/memory/working-memory.md +2 -2
- package/.docs/docs/observability/integrations/bridges/datadog.md +1 -1
- package/.docs/docs/observability/integrations/bridges/otel.md +1 -1
- package/.docs/docs/observability/integrations/exporters/laminar.md +1 -1
- package/.docs/docs/observability/integrations/exporters/langfuse.md +26 -1
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +4 -4
- package/.docs/docs/observability/integrations/exporters/otel.md +1 -1
- package/.docs/docs/observability/integrations/overview.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +3 -3
- package/.docs/docs/observability/metrics/querying.md +2 -2
- package/.docs/docs/observability/storage.md +2 -2
- package/.docs/docs/observability/tracing/overview.md +1 -1
- package/.docs/docs/server/auth/fga.md +15 -15
- package/.docs/docs/server/auth/okta.md +2 -2
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/custom-api-routes.md +1 -1
- package/.docs/docs/server/pubsub.md +4 -4
- package/.docs/docs/studio/auth.md +1 -1
- package/.docs/docs/studio/observability.md +3 -1
- package/.docs/docs/workflows/scheduled-workflows.md +13 -13
- package/.docs/docs/workspace/filesystem.md +1 -1
- package/.docs/docs/workspace/lsp.md +1 -1
- package/.docs/docs/workspace/overview.md +35 -1
- package/.docs/docs/workspace/sandbox.md +4 -3
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/deployment/aws-bedrock-agentcore.md +3 -3
- package/.docs/guides/deployment/inngest.md +5 -5
- package/.docs/guides/deployment/temporal.md +3 -3
- package/.docs/guides/getting-started/nestjs.md +1 -1
- package/.docs/guides/migrations/mastra-cloud.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
- package/.docs/reference/acp/acp-agent.md +2 -2
- package/.docs/reference/agents/agent.md +44 -0
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/agents/durable-agent.md +2 -2
- package/.docs/reference/agents/generate.md +2 -0
- package/.docs/reference/agents/generateLegacy.md +2 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/auth/workos.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/browser-viewer.md +11 -9
- package/.docs/reference/browser/stagehand-browser.md +1 -1
- package/.docs/reference/cli/mastra.md +3 -1
- package/.docs/reference/client-js/responses.md +2 -2
- package/.docs/reference/client-js/workflows.md +1 -1
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/removeWorkspace.md +26 -0
- package/.docs/reference/editor/browser-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +1 -1
- package/.docs/reference/evals/rubric.md +113 -0
- package/.docs/reference/evals/trajectory-accuracy.md +3 -3
- package/.docs/reference/harness/harness-class.md +81 -62
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/serialized-memory-config.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
- package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +5 -5
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +2 -2
- package/.docs/reference/processors/cost-guard-processor.md +2 -2
- package/.docs/reference/processors/processor-interface.md +4 -4
- package/.docs/reference/processors/response-cache.md +2 -2
- package/.docs/reference/processors/skill-search-processor.md +3 -3
- package/.docs/reference/processors/tool-search-processor.md +108 -4
- package/.docs/reference/pubsub/base.md +1 -1
- package/.docs/reference/pubsub/caching-pubsub.md +2 -2
- package/.docs/reference/pubsub/event-emitter.md +3 -3
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +2 -2
- package/.docs/reference/signals/task-signal-provider.md +62 -0
- package/.docs/reference/storage/clickhouse.md +49 -4
- package/.docs/reference/storage/composite.md +33 -1
- package/.docs/reference/storage/convex.md +2 -2
- package/.docs/reference/storage/dsql.md +7 -7
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/redis.md +3 -3
- package/.docs/reference/storage/spanner.md +7 -7
- package/.docs/reference/streaming/agents/stream.md +2 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +2 -0
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/tools/brightdata.md +3 -3
- package/.docs/reference/tools/create-code-mode.md +124 -0
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +5 -5
- package/.docs/reference/tools/mcp-server.md +45 -0
- package/.docs/reference/tools/perplexity.md +4 -4
- package/.docs/reference/tools/tavily.md +3 -3
- package/.docs/reference/voice/aws-nova-sonic.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +1 -1
- package/.docs/reference/voice/inworld-realtime.md +5 -5
- package/.docs/reference/voice/inworld.md +1 -1
- package/.docs/reference/voice/sarvam.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +7 -7
- package/.docs/reference/workspace/azure-blob-filesystem.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +7 -7
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +230 -0
- package/.docs/reference/workspace/vercel-microvm-sandbox.md +1 -1
- package/.docs/reference/workspace/vercel.md +2 -2
- package/.docs/reference/workspace/workspace-class.md +39 -3
- package/CHANGELOG.md +10 -0
- package/dist/chunk-GLPCVXXO.js +2075 -0
- package/dist/chunk-GLPCVXXO.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/stdio.js +1 -2070
- package/dist/stdio.js.map +1 -1
- package/package.json +5 -5
package/.docs/reference/index.md
CHANGED
|
@@ -92,6 +92,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
92
92
|
- [.listScorers()](https://mastra.ai/reference/core/listScorers)
|
|
93
93
|
- [.listVectors()](https://mastra.ai/reference/core/listVectors)
|
|
94
94
|
- [.listWorkflows()](https://mastra.ai/reference/core/listWorkflows)
|
|
95
|
+
- [.removeWorkspace()](https://mastra.ai/reference/core/removeWorkspace)
|
|
95
96
|
- [.setLogger()](https://mastra.ai/reference/core/setLogger)
|
|
96
97
|
- [.setStorage()](https://mastra.ai/reference/core/setStorage)
|
|
97
98
|
- [Cloudflare](https://mastra.ai/reference/deployer/cloudflare)
|
|
@@ -127,6 +128,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
127
128
|
- [Keyword Coverage Scorer](https://mastra.ai/reference/evals/keyword-coverage)
|
|
128
129
|
- [Noise Sensitivity Scorer](https://mastra.ai/reference/evals/noise-sensitivity)
|
|
129
130
|
- [Prompt Alignment Scorer](https://mastra.ai/reference/evals/prompt-alignment)
|
|
131
|
+
- [Rubric Scorer](https://mastra.ai/reference/evals/rubric)
|
|
130
132
|
- [Textual Difference Scorer](https://mastra.ai/reference/evals/textual-difference)
|
|
131
133
|
- [Tone Consistency Scorer](https://mastra.ai/reference/evals/tone-consistency)
|
|
132
134
|
- [Tool Call Accuracy Scorers](https://mastra.ai/reference/evals/tool-call-accuracy)
|
|
@@ -222,6 +224,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
222
224
|
- [Server Routes](https://mastra.ai/reference/server/routes)
|
|
223
225
|
- [createNotificationInboxTool()](https://mastra.ai/reference/signals/create-notification-inbox-tool)
|
|
224
226
|
- [SignalProvider](https://mastra.ai/reference/signals/signal-provider)
|
|
227
|
+
- [TaskSignalProvider](https://mastra.ai/reference/signals/task-signal-provider)
|
|
225
228
|
- [WebhookSignalProvider](https://mastra.ai/reference/signals/webhook-signal-provider)
|
|
226
229
|
- [Overview](https://mastra.ai/reference/storage/overview)
|
|
227
230
|
- [Aurora DSQL Storage](https://mastra.ai/reference/storage/dsql)
|
|
@@ -251,6 +254,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
251
254
|
- [.timeTravelStream()](https://mastra.ai/reference/streaming/workflows/timeTravelStream)
|
|
252
255
|
- [Overview](https://mastra.ai/reference/templates/overview)
|
|
253
256
|
- [Bright Data Tools](https://mastra.ai/reference/tools/brightdata)
|
|
257
|
+
- [createCodeMode()](https://mastra.ai/reference/tools/create-code-mode)
|
|
254
258
|
- [createDocumentChunkerTool()](https://mastra.ai/reference/tools/document-chunker-tool)
|
|
255
259
|
- [createGraphRAGTool()](https://mastra.ai/reference/tools/graph-rag-tool)
|
|
256
260
|
- [createTool()](https://mastra.ai/reference/tools/create-tool)
|
|
@@ -341,6 +345,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
341
345
|
- [LocalFilesystem](https://mastra.ai/reference/workspace/local-filesystem)
|
|
342
346
|
- [LocalSandbox](https://mastra.ai/reference/workspace/local-sandbox)
|
|
343
347
|
- [ModalSandbox](https://mastra.ai/reference/workspace/modal-sandbox)
|
|
348
|
+
- [RailwaySandbox](https://mastra.ai/reference/workspace/railway-sandbox)
|
|
344
349
|
- [S3Filesystem](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
345
350
|
- [SandboxProcessManager](https://mastra.ai/reference/workspace/process-manager)
|
|
346
351
|
- [VercelMicroVMSandbox](https://mastra.ai/reference/workspace/vercel-microvm-sandbox)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`SerializedMemoryConfig` is the JSON-serializable subset of [`Memory`](https://mastra.ai/reference/memory/memory-class) configuration that lives on a stored agent record. The runtime hydrates it back into a `Memory` instance by resolving the vector and embedder IDs against the configured `Mastra` instance.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It's the type used by [`BuilderAgentDefaults.memory`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by `EditorAgentNamespace.create({ memory })`.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ Two conditions must be true for a metric to reach storage:
|
|
|
15
15
|
1. `MastraStorageExporter` is configured as an exporter.
|
|
16
16
|
2. The storage backend supports metrics (ClickHouse or DuckDB).
|
|
17
17
|
|
|
18
|
-
If metrics aren't
|
|
18
|
+
If metrics aren't available, see [troubleshooting](#troubleshooting).
|
|
19
19
|
|
|
20
20
|
## Duration metrics
|
|
21
21
|
|
|
@@ -112,11 +112,11 @@ When you spot a spike in latency or token usage on the Metrics dashboard, correl
|
|
|
112
112
|
|
|
113
113
|
## Troubleshooting
|
|
114
114
|
|
|
115
|
-
### No metrics are
|
|
115
|
+
### No metrics are available
|
|
116
116
|
|
|
117
117
|
- **Observability is configured**: Verify that your `Mastra` instance has an `observability` config with at least one exporter.
|
|
118
118
|
- **`MastraStorageExporter` or `MastraPlatformExporter` is present**: Other exporters (Datadog, Langfuse, etc.) don't surface metrics in Mastra. `MastraStorageExporter` is required for the local Studio dashboard, and `MastraPlatformExporter` is required to view metrics in Mastra platform.
|
|
119
|
-
- **Storage supports metrics**: Metrics require an OLAP-capable store (ClickHouse or DuckDB). Row-oriented databases (PostgreSQL, LibSQL, MSSQL) and document stores (MongoDB)
|
|
119
|
+
- **Storage supports metrics**: Metrics require an OLAP-capable store (ClickHouse or DuckDB). Row-oriented databases (PostgreSQL, LibSQL, MSSQL) and document stores (MongoDB) aren't supported for metrics.
|
|
120
120
|
- **Sampling isn't 0%**: If sampling probability is `0` or strategy is `never`, all spans become no-ops and no metrics are extracted.
|
|
121
121
|
|
|
122
122
|
### Duration metrics are missing
|
|
@@ -121,7 +121,7 @@ new DatadogBridge({
|
|
|
121
121
|
})
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
Note: APM data
|
|
124
|
+
Note: APM data can't be sent in agentless mode. If you only need LLM Observability data without `dd-trace` APM, the [Datadog Exporter](https://mastra.ai/reference/observability/tracing/exporters/datadog) is a simpler choice.
|
|
125
125
|
|
|
126
126
|
### With Additional Exporters
|
|
127
127
|
|
|
@@ -104,7 +104,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
|
|
|
104
104
|
|
|
105
105
|
Processes metric signals for Cloud export.
|
|
106
106
|
|
|
107
|
-
Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint.
|
|
107
|
+
Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint. Additional filtering by metric subtype or status inside `CloudExporter` isn't performed; the exporter forwards every metric event it receives unless it's disabled.
|
|
108
108
|
|
|
109
109
|
**Returns:** `Promise<void>` after the metric event has been accepted for buffering.
|
|
110
110
|
|
|
@@ -116,7 +116,7 @@ async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
|
116
116
|
|
|
117
117
|
Processes score signals for Cloud export.
|
|
118
118
|
|
|
119
|
-
Every `ScoreEvent` passed to this handler is buffered and exported to the Cloud scores endpoint derived from the configured base endpoint.
|
|
119
|
+
Every `ScoreEvent` passed to this handler is buffered and exported to the Cloud scores endpoint derived from the configured base endpoint. No extra filtering at the exporter layer beyond the disabled-exporter check is performed, so all score events received by this method are forwarded.
|
|
120
120
|
|
|
121
121
|
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
|
128
128
|
|
|
129
129
|
Processes feedback signals for Cloud export.
|
|
130
130
|
|
|
131
|
-
Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint.
|
|
131
|
+
Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `CloudExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
|
|
132
132
|
|
|
133
133
|
**Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
|
|
134
134
|
|
|
@@ -132,7 +132,7 @@ Failed flushes are retried with exponential backoff:
|
|
|
132
132
|
- Maximum attempts: `maxRetries`
|
|
133
133
|
- Batch is dropped after all retries fail
|
|
134
134
|
|
|
135
|
-
When storage
|
|
135
|
+
When storage doesn't support a signal or retries are exhausted, `DefaultExporter` emits an `ObservabilityDropEvent` through `onDroppedEvent` handlers registered on exporters and bridges. The drop event includes the signal, reason, count, exporter name, storage name when known, and sanitized error details.
|
|
136
136
|
|
|
137
137
|
### Out-of-Order Handling
|
|
138
138
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
6
6
|
|
|
7
|
-
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it
|
|
7
|
+
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraPlatformExporter`.
|
|
8
8
|
|
|
9
9
|
## Constructor
|
|
10
10
|
|
|
@@ -106,7 +106,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
|
|
|
106
106
|
|
|
107
107
|
Processes metric signals for export.
|
|
108
108
|
|
|
109
|
-
Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint.
|
|
109
|
+
Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint. No additional filtering by metric subtype or status inside `MastraPlatformExporter` is performed; the exporter forwards every metric event it receives unless it's disabled.
|
|
110
110
|
|
|
111
111
|
**Returns:** `Promise<void>` after the metric event has been accepted for buffering.
|
|
112
112
|
|
|
@@ -118,7 +118,7 @@ async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
|
118
118
|
|
|
119
119
|
Processes score signals for export.
|
|
120
120
|
|
|
121
|
-
Every `ScoreEvent` passed to this handler is buffered and exported to the scores endpoint derived from the configured base endpoint.
|
|
121
|
+
Every `ScoreEvent` passed to this handler is buffered and exported to the scores endpoint derived from the configured base endpoint. No extra filtering at the exporter layer beyond the disabled-exporter check is performed, so all score events received by this method are forwarded.
|
|
122
122
|
|
|
123
123
|
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
124
124
|
|
|
@@ -130,7 +130,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
|
130
130
|
|
|
131
131
|
Processes feedback signals for export.
|
|
132
132
|
|
|
133
|
-
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint.
|
|
133
|
+
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `MastraPlatformExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
|
|
134
134
|
|
|
135
135
|
**Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
|
|
136
136
|
|
|
@@ -190,7 +190,7 @@ Errors raised by `MastraPlatformExporter` use the `MASTRA_PLATFORM_EXPORTER_*` `
|
|
|
190
190
|
|
|
191
191
|
## Span wire format
|
|
192
192
|
|
|
193
|
-
The shape of each span sent to Mastra platform is documented here for reference only — it
|
|
193
|
+
The shape of each span sent to Mastra platform is documented here for reference only — it's not exported from `@mastra/observability` and shouldn't be imported. The exporter spreads the original `AnyExportedSpan` (so the source field names are preserved) and layers a small set of platform-friendly aliases on top:
|
|
194
194
|
|
|
195
195
|
```typescript
|
|
196
196
|
type MastraPlatformSpanRecord = AnyExportedSpan & {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Persists traces to Mastra's configured storage with automatic batching and retry logic.
|
|
4
4
|
|
|
5
|
-
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it
|
|
5
|
+
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraStorageExporter`.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -161,7 +161,7 @@ const exporter = new OtelExporter({
|
|
|
161
161
|
|
|
162
162
|
## Protocol requirements
|
|
163
163
|
|
|
164
|
-
Different providers require different OTEL exporter packages. Trace and log export are independent: install only the trace package if you only need traces, or install both the trace and log packages for the chosen protocol if you also want log export. Zipkin
|
|
164
|
+
Different providers require different OTEL exporter packages. Trace and log export are independent: install only the trace package if you only need traces, or install both the trace and log packages for the chosen protocol if you also want log export. Zipkin doesn't support OTLP logs.
|
|
165
165
|
|
|
166
166
|
| Protocol | Trace package | Log package |
|
|
167
167
|
| ------------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
@@ -4,7 +4,7 @@ A SpanOutputProcessor that redacts sensitive information from span fields.
|
|
|
4
4
|
|
|
5
5
|
## Auto-applied by default
|
|
6
6
|
|
|
7
|
-
`Observability` automatically appends a `SensitiveDataFilter` to every configured instance's `spanOutputProcessors` so secrets are redacted before they reach exporters such as the Mastra cloud exporter. The filter runs last (after any user-provided processors) so that sensitive data introduced or surfaced by upstream processors is still redacted. You
|
|
7
|
+
`Observability` automatically appends a `SensitiveDataFilter` to every configured instance's `spanOutputProcessors` so secrets are redacted before they reach exporters such as the Mastra cloud exporter. The filter runs last (after any user-provided processors) so that sensitive data introduced or surfaced by upstream processors is still redacted. You don't need to add it manually unless you want to customize its options.
|
|
8
8
|
|
|
9
9
|
To opt out or customize the auto-applied filter, use the `sensitiveDataFilter` option on the [`Observability` registry config](https://mastra.ai/reference/observability/tracing/configuration):
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ new Observability({
|
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values
|
|
25
|
+
If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values aren't modified — add a `SensitiveDataFilter` to their processors yourself if needed.
|
|
26
26
|
|
|
27
27
|
## Constructor
|
|
28
28
|
|
|
@@ -103,10 +103,10 @@ When the `block` strategy is active (default), `CostGuardProcessor` calls `abort
|
|
|
103
103
|
| `resource` | Yes | `resourceId` + time window | `resourceId` in `RequestContext` |
|
|
104
104
|
| `thread` | Yes | `threadId` + time window | `threadId` in `RequestContext` |
|
|
105
105
|
|
|
106
|
-
All scopes require observability storage with `getMetricAggregate` support. If the Mastra instance
|
|
106
|
+
All scopes require observability storage with `getMetricAggregate` support. If the Mastra instance doesn't have observability storage configured, an error is thrown at registration time.
|
|
107
107
|
|
|
108
108
|
For `run` scope, the processor reads the trace ID from the current span's tracing context. If no tracing context is available, the check is skipped (fail-open).
|
|
109
109
|
|
|
110
110
|
For `resource` and `thread` scopes, if the required context ID is missing at runtime, the check is skipped. Observability query failures are handled with a fail-open strategy: if a query fails, cost is treated as zero.
|
|
111
111
|
|
|
112
|
-
> **Note on metric persistence delay.** The observability pipeline uses buffered exporters that flush metrics asynchronously.
|
|
112
|
+
> **Note on metric persistence delay.** The observability pipeline uses buffered exporters that flush metrics asynchronously. A short delay exists between when an LLM call completes and when its cost metrics are available for query. During high-frequency agent execution, the cost guard may not detect a limit breach until one or more steps after the actual cost exceeded the threshold.
|
|
@@ -369,7 +369,7 @@ System messages are **reset to their original values** at the start of each step
|
|
|
369
369
|
|
|
370
370
|
Processes the final LLM request after Mastra converts the `MessageList` into `LanguageModelV2Prompt` and before the provider call. Use this method for transient, model-aware rewrites that should affect only the current outbound request.
|
|
371
371
|
|
|
372
|
-
Returned prompt changes are forwarded to the model for the current call only. They
|
|
372
|
+
Returned prompt changes are forwarded to the model for the current call only. They're not persisted back to `MessageList`, memory, UI history, or later provider calls.
|
|
373
373
|
|
|
374
374
|
```typescript
|
|
375
375
|
processLLMRequest?(
|
|
@@ -892,8 +892,8 @@ export class WordCounter implements Processor {
|
|
|
892
892
|
|
|
893
893
|
Every processor receives a `state` object in `processLLMRequest`, `processLLMResponse`, `processOutputStream`, `processOutputStep`, `processOutputResult`, and `processAPIError`. State has three important properties:
|
|
894
894
|
|
|
895
|
-
- **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Two processors with different ids
|
|
896
|
-
- **Per-request**: A fresh state object is created at the start of every `agent.generate()` or `agent.stream()` call. State
|
|
895
|
+
- **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Two processors with different ids can't read or overwrite each other's state.
|
|
896
|
+
- **Per-request**: A fresh state object is created at the start of every `agent.generate()` or `agent.stream()` call. State doesn't leak between requests or between users.
|
|
897
897
|
- **Shared across methods**: Within one request, the same `state` object is passed to `processLLMRequest` (before the provider call), `processLLMResponse` (after the step completes), `processOutputStream` (for every chunk), `processOutputStep` (after every LLM step), `processOutputResult` (once at the end), and `processAPIError` (when an LLM call fails). For example, `processLLMRequest` can stash a cache key and `processLLMResponse` can read it back to write the response.
|
|
898
898
|
|
|
899
899
|
Initialize fields defensively on first access, because `state` starts as an empty object:
|
|
@@ -957,7 +957,7 @@ await writer.custom({
|
|
|
957
957
|
})
|
|
958
958
|
```
|
|
959
959
|
|
|
960
|
-
By default, processors
|
|
960
|
+
By default, processors **don't** see `data-*` chunks in `processOutputStream` so they don't accidentally process tool telemetry or their own output. Opt in by setting `processDataParts: true` on the processor:
|
|
961
961
|
|
|
962
962
|
```typescript
|
|
963
963
|
class ModerationCollector implements Processor {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model — i.e. _after_ memory has loaded and earlier input processors have transformed the prompt — so two users with different memory contexts produce different cache keys. Each step in an agentic tool loop is independently cached.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
No agent-level option for response caching exists; register `ResponseCache` explicitly on `inputProcessors`. Per-call overrides flow through `RequestContext` via [`ResponseCache.context()`](#static-helpers) and [`ResponseCache.applyContext()`](#static-helpers).
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -85,7 +85,7 @@ The shape passed to `ResponseCache.context()` / `ResponseCache.applyContext()`.
|
|
|
85
85
|
|
|
86
86
|
**bust** (`boolean`): Skip the cache read but still write on completion.
|
|
87
87
|
|
|
88
|
-
`cache`, `ttl`, and `agentId` are intentionally not overridable per call — they
|
|
88
|
+
`cache`, `ttl`, and `agentId` are intentionally not overridable per call — they're instance-level concerns that shouldn't vary per request.
|
|
89
89
|
|
|
90
90
|
## ResponseCacheKeyInputs
|
|
91
91
|
|
|
@@ -4,7 +4,7 @@ The `SkillSearchProcessor` is an **input processor** that enables on-demand skil
|
|
|
4
4
|
|
|
5
5
|
By default, when you attach only `SkillSearchProcessor` to an agent with a skill-enabled `Workspace`, the agent treats skills as on-demand:
|
|
6
6
|
|
|
7
|
-
- The default eager `SkillsProcessor`
|
|
7
|
+
- The default eager `SkillsProcessor` isn't auto-added.
|
|
8
8
|
- `search_skills` and `load_skill` are exposed for discovery and instruction loading.
|
|
9
9
|
- Overlapping `skill` and `skill_search` tools are hidden.
|
|
10
10
|
- `skill_read` remains available so the agent can read supporting skill files such as references, scripts, and assets.
|
|
@@ -90,11 +90,11 @@ The agent workflow is:
|
|
|
90
90
|
|
|
91
91
|
## Workspace file tools
|
|
92
92
|
|
|
93
|
-
`SkillSearchProcessor` loads skill instructions into the conversation. It
|
|
93
|
+
`SkillSearchProcessor` loads skill instructions into the conversation. It doesn't block workspace file tools from reading files.
|
|
94
94
|
|
|
95
95
|
Use `skill_read` for supporting files that belong to a loaded skill, such as files under `references/`, `scripts/`, or `assets/`.
|
|
96
96
|
|
|
97
|
-
Reserve workspace file tools such as `mastra_workspace_read_file` for explicit file inspection or editing workflows. During normal task execution, the agent
|
|
97
|
+
Reserve workspace file tools such as `mastra_workspace_read_file` for explicit file inspection or editing workflows. During normal task execution, the agent doesn't need to read the same `SKILL.md` file after `load_skill` succeeds.
|
|
98
98
|
|
|
99
99
|
## Compared to SkillsProcessor
|
|
100
100
|
|
|
@@ -27,13 +27,17 @@ const toolSearch = new ToolSearchProcessor({
|
|
|
27
27
|
|
|
28
28
|
**options.tools** (`Record<string, Tool>`): All tools that can be searched and loaded dynamically. These tools are not immediately available to the agent — they must be discovered via search and loaded on demand.
|
|
29
29
|
|
|
30
|
-
**options.search** (`{ topK?: number; minScore?: number }`): Configuration for the search behavior.
|
|
30
|
+
**options.search** (`{ topK?: number; minScore?: number; autoLoad?: boolean }`): Configuration for the search behavior.
|
|
31
31
|
|
|
32
32
|
**options.search.topK** (`number`): Maximum number of tools to return in search results.
|
|
33
33
|
|
|
34
34
|
**options.search.minScore** (`number`): Minimum relevance score (0-1) for including a tool in search results.
|
|
35
35
|
|
|
36
|
-
**options.
|
|
36
|
+
**options.search.autoLoad** (`boolean`): When true, tools returned by search\_tools are activated immediately as part of the search. The load\_tool meta-tool is not exposed, collapsing the two-step search then load flow into a single search step. Discovered tools become available on the next turn. Keep topK conservative since every match is activated.
|
|
37
|
+
|
|
38
|
+
**options.storage** (`'in-memory' | 'context'`): Where loaded-tool state lives. 'in-memory' (default) tracks loaded tools in an in-memory map per thread with TTL cleanup (see ttl); state is lost on restart and anonymous requests share a 'default' entry. 'context' derives loaded state from the conversation messages — a tool is loaded while a search\_tools/load\_tool result naming it remains in the messages; it is restart-safe, requires no memory, and de-loads automatically once that result is no longer present in the messages. The 'context' store is opt-in.
|
|
39
|
+
|
|
40
|
+
**options.ttl** (`number`): Time-to-live for in-memory thread state, in milliseconds. Only applies to the default storage: 'in-memory' store; after this duration of inactivity thread state is cleaned up. Set to 0 to disable cleanup. Ignored by the 'context' store.
|
|
37
41
|
|
|
38
42
|
**options.filter** (`(args: ToolSearchFilterArgs) => boolean | Promise<boolean>`): Optional request-aware hook for hiding tools from search results, blocking tool loading, or hiding already-loaded tools for the current request.
|
|
39
43
|
|
|
@@ -45,6 +49,48 @@ const toolSearch = new ToolSearchProcessor({
|
|
|
45
49
|
|
|
46
50
|
**processInputStep** (`(args: ProcessInputStepArgs) => Promise<ProcessInputStepResult>`): Processes each step to inject search/load meta-tools and any previously loaded tools into the agent's tool set.
|
|
47
51
|
|
|
52
|
+
## Methods
|
|
53
|
+
|
|
54
|
+
### State inspection (legacy `'in-memory'` store)
|
|
55
|
+
|
|
56
|
+
These methods operate on the default `'in-memory'` store only. They're no-ops for the `'context'` store, whose state lives in the conversation messages rather than an in-process map.
|
|
57
|
+
|
|
58
|
+
#### `clearState(threadId)`
|
|
59
|
+
|
|
60
|
+
Clears the loaded-tool state for a single thread.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
processor.clearState('thread-123')
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### `clearAllState()`
|
|
67
|
+
|
|
68
|
+
Clears loaded-tool state for every thread.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
processor.clearAllState()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### `getStateStats()`
|
|
75
|
+
|
|
76
|
+
Returns the number of tracked threads and the oldest access time, for debugging in-memory growth.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const { threadCount, oldestAccessTime } = processor.getStateStats()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Returns: `{ threadCount: number; oldestAccessTime: number | null }`
|
|
83
|
+
|
|
84
|
+
#### `cleanupNow()`
|
|
85
|
+
|
|
86
|
+
Immediately runs TTL cleanup instead of waiting for the scheduled sweep.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const cleaned = processor.cleanupNow()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Returns: `number` — the count of threads cleaned up.
|
|
93
|
+
|
|
48
94
|
## Request-aware filtering
|
|
49
95
|
|
|
50
96
|
Use `filter` to apply request-specific policy to dynamic tools. The hook receives the resolved tool ID as `toolName`, the tool, request context, and phase. `toolName` is the ID returned by `search_tools`, which may differ from the key used in the `tools` object.
|
|
@@ -70,9 +116,9 @@ The `phase` value describes where the filter is being applied:
|
|
|
70
116
|
|
|
71
117
|
- `search`: Filters results returned by `search_tools`.
|
|
72
118
|
- `load`: Blocks `load_tool` from loading disallowed tools.
|
|
73
|
-
- `active`: Hides already-loaded tools from the current request if they
|
|
119
|
+
- `active`: Hides already-loaded tools from the current request if they're no longer allowed.
|
|
74
120
|
|
|
75
|
-
If the hook throws or rejects, `ToolSearchProcessor` treats the tool as disallowed for that request. The hook may run for every matching search candidate, so keep async policy checks cheap or cached. The
|
|
121
|
+
If the hook throws or rejects, `ToolSearchProcessor` treats the tool as disallowed for that request. The hook may run for every matching search candidate, so keep async policy checks cheap or cached. The `search_tools` meta-tool is always available; `load_tool` is available unless `search.autoLoad` is enabled. Tools passed directly through the agent or `processInputStep` remain available unless you filter them outside `ToolSearchProcessor`.
|
|
76
122
|
|
|
77
123
|
## Extended usage example
|
|
78
124
|
|
|
@@ -114,6 +160,64 @@ The agent workflow is:
|
|
|
114
160
|
4. The loaded tool becomes available on the next turn
|
|
115
161
|
5. Agent uses the loaded tool normally
|
|
116
162
|
|
|
163
|
+
## Single-step discovery with `autoLoad`
|
|
164
|
+
|
|
165
|
+
Set `search.autoLoad` to `true` to skip the separate load step. The tools returned by `search_tools` are activated immediately, and the `load_tool` meta-tool isn't exposed. This removes one model turn per discovery, which lowers token usage and latency, and works the same across providers.
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
const toolSearch = new ToolSearchProcessor({
|
|
169
|
+
tools: allTools,
|
|
170
|
+
search: {
|
|
171
|
+
topK: 3,
|
|
172
|
+
autoLoad: true,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
With `autoLoad` the workflow becomes:
|
|
178
|
+
|
|
179
|
+
1. Agent receives a user message
|
|
180
|
+
2. Agent calls `search_tools` with keywords
|
|
181
|
+
3. The matching tools are activated automatically and become available on the next turn
|
|
182
|
+
4. Agent uses the tool normally
|
|
183
|
+
|
|
184
|
+
Every match is activated, so keep `topK` small (for example, `3`) to avoid adding tools the agent didn't need. Activated tools are appended after existing tools, which keeps the cached prompt prefix stable for providers that support prompt caching.
|
|
185
|
+
|
|
186
|
+
## Loaded-tool storage
|
|
187
|
+
|
|
188
|
+
The `storage` option controls where the set of loaded tools is tracked. The default is `'in-memory'`; the `'context'` store is opt-in.
|
|
189
|
+
|
|
190
|
+
### `'in-memory'` (default)
|
|
191
|
+
|
|
192
|
+
Loaded tools are tracked in an in-memory map per thread, with TTL-based cleanup controlled by the `ttl` option (default one hour). This is the original behavior:
|
|
193
|
+
|
|
194
|
+
- Requires no memory configuration.
|
|
195
|
+
- State is lost on process restart.
|
|
196
|
+
- Requests with no thread ID share a single `'default'` entry.
|
|
197
|
+
|
|
198
|
+
Use `clearState`, `clearAllState`, `getStateStats`, and `cleanupNow` to inspect or reset this store.
|
|
199
|
+
|
|
200
|
+
### `'context'`
|
|
201
|
+
|
|
202
|
+
Loaded state is derived from the conversation messages: a tool is loaded while a `search_tools` or `load_tool` result naming it remains in the messages. This mode:
|
|
203
|
+
|
|
204
|
+
- Requires no memory configuration.
|
|
205
|
+
- Is restart-safe — the durable record is the persisted message history.
|
|
206
|
+
- De-loads a tool automatically once that result is no longer present in the messages.
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { ToolSearchProcessor } from '@mastra/core/processors'
|
|
210
|
+
|
|
211
|
+
const toolSearch = new ToolSearchProcessor({
|
|
212
|
+
tools: allTools,
|
|
213
|
+
storage: 'context',
|
|
214
|
+
})
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Loading tools is cache-friendly in both modes: loads are append-only, so the cached prompt prefix stays stable for providers that support prompt caching.
|
|
218
|
+
|
|
219
|
+
Unloading a tool changes the tool definitions sent to the model, which shifts the cached prefix and causes the next turn to pay a cache write instead of a cache hit. In `'in-memory'` mode this happens when a thread's state is evicted by `ttl`. In `'context'` mode it happens when a tool's discovery result is no longer present in the messages (for example, when older messages are trimmed) — the tool de-loads and the model must search for it again before reuse. This is expected: removing an unused tool trades one cache write for a smaller prefix on later turns.
|
|
220
|
+
|
|
117
221
|
## Combining with other processors
|
|
118
222
|
|
|
119
223
|
```typescript
|
|
@@ -165,7 +165,7 @@ await pubsub.subscribeFromOffset('my-topic', 42, event => {
|
|
|
165
165
|
|
|
166
166
|
### `SubscribeBatchOptions`
|
|
167
167
|
|
|
168
|
-
Per-subscription batching policy. The callback signature
|
|
168
|
+
Per-subscription batching policy. The callback signature doesn't change; a batch of N events becomes N consecutive callback invocations in publish order.
|
|
169
169
|
|
|
170
170
|
**maxSize** (`number`): Maximum events held before forcing a flush.
|
|
171
171
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
Use it to build resumable streams on top of a transport that
|
|
5
|
+
Use it to build resumable streams on top of a transport that doesn't 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), don't need this wrapper.
|
|
6
6
|
|
|
7
|
-
`CachingPubSub` is transparent to batching: `subscribe()` forwards `options.batch` to the inner pub/sub, and `supportsNativeBatching` mirrors the inner's value. Wrapping an inner that
|
|
7
|
+
`CachingPubSub` is transparent to batching: `subscribe()` forwards `options.batch` to the inner pub/sub, and `supportsNativeBatching` mirrors the inner's value. Wrapping an inner that doesn't support batching results in unbatched delivery even when `options.batch` is passed.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
-
Because it
|
|
7
|
+
Because it's in-process, events aren't persisted and aren't shared with other processes. Wrap it in [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub) when you need replay for resumable streams.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
|
-
`EventEmitterPubSub` is used automatically when you
|
|
11
|
+
`EventEmitterPubSub` is used automatically when you don't configure a `pubsub` option, so most applications never construct it directly. Create one explicitly only when you want to configure or share it.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { Mastra } from '@mastra/core'
|
|
@@ -104,4 +104,4 @@ await pubsub.subscribe(
|
|
|
104
104
|
)
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
The buffer is in-memory and per-process, so batched state
|
|
107
|
+
The buffer is in-memory and per-process, so batched state isn't persisted and doesn't survive a restart. A flush triggered by `maxWaitMs` is best-effort: if a step such as a throwing `coalesce` fails, the error is surfaced through the configured `logger` rather than thrown. `flush()` drains every batched subscriber buffer before resolving.
|
|
@@ -57,7 +57,7 @@ export const mastra = new Mastra({
|
|
|
57
57
|
|
|
58
58
|
### `init(topicName, group?)`
|
|
59
59
|
|
|
60
|
-
Creates the topic and a subscription if they
|
|
60
|
+
Creates the topic and a subscription if they don't already exist, and returns the subscription. `subscribe` calls this internally, so you rarely call it directly.
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
await pubsub.init('workflow.events')
|
|
@@ -105,4 +105,4 @@ await pubsub.close()
|
|
|
105
105
|
|
|
106
106
|
## Redelivery and reclaim
|
|
107
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
|
|
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's 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`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
-
`UnixSocketPubSub` is a push transport: events arrive without a read loop, so Mastra
|
|
7
|
+
`UnixSocketPubSub` is a push transport: events arrive without a read loop, so Mastra doesn't run a pull worker for it.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `@mastra/nestjs` package provides a NestJS module for running Mastra with the Express-based NestJS platform.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It's intentionally Express-only for v1. If Nest is bootstrapped with a different HTTP adapter, `MastraModule` throws during startup instead of attempting a partial integration.
|
|
6
6
|
|
|
7
7
|
> **Info:** For general adapter concepts, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ import { mastra } from './mastra'
|
|
|
51
51
|
export class AppModule {}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> **Note:** `MastraModule` registers a catch-all controller (`@All('*')`). If it
|
|
54
|
+
> **Note:** `MastraModule` registers a catch-all controller (`@All('*')`). If it's imported before your app modules, it can intercept unrelated routes and return 404s. To avoid conflicts, import `MastraModule` last or mount it under a dedicated prefix (e.g., `/api/v1/mastra`).
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
57
|
import { NestFactory } from '@nestjs/core'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# TaskSignalProvider
|
|
2
|
+
|
|
3
|
+
Bundles the built-in task tools (`task_write`, `task_update`, `task_complete`, `task_check`) and the `TaskStateProcessor` behind a single agent registration. Use it to add a structured, durable task list to an agent without wiring the tools and processor separately.
|
|
4
|
+
|
|
5
|
+
Extends [`SignalProvider`](https://mastra.ai/reference/signals/signal-provider). The task list is stored in the thread-scoped `tasks` storage domain (the source of truth) and projected onto the agent state-signal lane by the processor, so it survives observational-memory truncation without invalidating the prompt cache.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
Register the provider on an agent that has `Memory` and a Mastra `storage`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from '@mastra/core/agent'
|
|
13
|
+
import { TaskSignalProvider } from '@mastra/core/signals'
|
|
14
|
+
|
|
15
|
+
const agent = new Agent({
|
|
16
|
+
name: 'coder',
|
|
17
|
+
instructions: '...',
|
|
18
|
+
model,
|
|
19
|
+
memory,
|
|
20
|
+
signals: [new TaskSignalProvider()],
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The Agent automatically merges the four task tools into its toolset and registers the processor on its input-processor chain. No other wiring is required.
|
|
25
|
+
|
|
26
|
+
Task tracking requires a memory-backed thread (`threadId` + `resourceId`). Without memory the task tools no-op and return a result explaining that task tracking requires agent memory. The `tasks` storage domain is wired in-memory by default, so task tracking works without configuring a storage backend.
|
|
27
|
+
|
|
28
|
+
## Constructor parameters
|
|
29
|
+
|
|
30
|
+
`TaskSignalProvider` takes no constructor arguments.
|
|
31
|
+
|
|
32
|
+
## Properties
|
|
33
|
+
|
|
34
|
+
**id** (`'task-signals'`): Stable identifier for the provider instance.
|
|
35
|
+
|
|
36
|
+
## Methods
|
|
37
|
+
|
|
38
|
+
### Agent integration
|
|
39
|
+
|
|
40
|
+
These methods are called automatically by the Agent when the provider is passed to `signals`. You normally do not call them directly.
|
|
41
|
+
|
|
42
|
+
#### `getTools()`
|
|
43
|
+
|
|
44
|
+
Returns the four task tools keyed by their tool ids (`task_write`, `task_update`, `task_complete`, `task_check`). The Agent merges these into its toolset.
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const tools = new TaskSignalProvider().getTools()
|
|
48
|
+
// { task_write, task_update, task_complete, task_check }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Returns: `Record<string, Tool>`
|
|
52
|
+
|
|
53
|
+
#### `getInputProcessors()`
|
|
54
|
+
|
|
55
|
+
Returns the provider's `TaskStateProcessor` instance. The Agent registers it on the input-processor chain, which propagates the Mastra instance so the processor can resolve the `tasks` store.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
const [processor] = new TaskSignalProvider().getInputProcessors()
|
|
59
|
+
// processor instanceof TaskStateProcessor
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Returns: `InputProcessorOrWorkflow[]`
|