@mastra/mcp-docs-server 1.0.0-beta.4 → 1.0.0-beta.6
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/organized/changelogs/%40internal%2Fstorage-test-utils.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +29 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +411 -211
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +52 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Freact.md +89 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
- package/.docs/organized/changelogs/create-mastra.md +201 -1
- package/.docs/organized/changelogs/mastra.md +201 -1
- package/.docs/organized/code-examples/agui.md +1 -0
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -0
- package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/organized/code-examples/server-app-access.md +342 -0
- package/.docs/raw/agents/adding-voice.mdx +7 -10
- package/.docs/raw/agents/agent-approval.mdx +189 -0
- package/.docs/raw/agents/guardrails.mdx +26 -23
- package/.docs/raw/agents/networks.mdx +2 -2
- package/.docs/raw/agents/overview.mdx +27 -62
- package/.docs/raw/agents/processors.mdx +279 -0
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
- package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
- package/.docs/raw/deployment/building-mastra.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +20 -27
- package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +19 -17
- package/.docs/raw/deployment/mastra-cloud/setting-up.mdx +1 -1
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/web-framework.mdx +5 -5
- package/.docs/raw/evals/custom-scorers.mdx +3 -5
- package/.docs/raw/evals/overview.mdx +2 -3
- package/.docs/raw/evals/running-in-ci.mdx +0 -2
- package/.docs/raw/{guides/guide → getting-started}/manual-install.mdx +2 -2
- package/.docs/raw/getting-started/project-structure.mdx +1 -1
- package/.docs/raw/getting-started/start.mdx +72 -0
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/{frameworks/agentic-uis/ai-sdk.mdx → guides/build-your-ui/ai-sdk-ui.mdx} +113 -11
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +23 -25
- package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +3 -4
- package/.docs/raw/guides/{quickstarts/nextjs.mdx → getting-started/next-js.mdx} +11 -11
- package/.docs/raw/guides/{quickstarts/standalone-server.mdx → getting-started/quickstart.mdx} +7 -7
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +23 -25
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +7 -7
- package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
- package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +2 -2
- package/.docs/raw/guides/guide/research-assistant.mdx +7 -8
- package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
- package/.docs/raw/guides/guide/web-search.mdx +12 -10
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
- package/.docs/raw/guides/index.mdx +3 -35
- package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +40 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +5 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +51 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mcp/overview.mdx +3 -5
- package/.docs/raw/memory/memory-processors.mdx +264 -79
- package/.docs/raw/memory/semantic-recall.mdx +7 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-pg.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +2 -4
- package/.docs/raw/memory/threads-and-resources.mdx +3 -3
- package/.docs/raw/memory/working-memory.mdx +14 -7
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +1 -1
- package/.docs/raw/observability/overview.mdx +2 -3
- package/.docs/raw/observability/tracing/bridges/otel.mdx +176 -0
- package/.docs/raw/observability/tracing/exporters/arize.mdx +17 -0
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +20 -0
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
- package/.docs/raw/observability/tracing/exporters/otel.mdx +25 -5
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +107 -0
- package/.docs/raw/observability/tracing/overview.mdx +74 -8
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +3 -2
- package/.docs/raw/rag/retrieval.mdx +43 -38
- package/.docs/raw/rag/vector-databases.mdx +93 -2
- package/.docs/raw/reference/agents/agent.mdx +7 -10
- package/.docs/raw/reference/agents/generate.mdx +55 -6
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +46 -3
- package/.docs/raw/reference/cli/mastra.mdx +2 -1
- package/.docs/raw/reference/client-js/agents.mdx +3 -3
- package/.docs/raw/reference/client-js/memory.mdx +43 -0
- package/.docs/raw/reference/client-js/workflows.mdx +92 -63
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +5 -19
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -2
- package/.docs/raw/reference/evals/answer-relevancy.mdx +28 -98
- package/.docs/raw/reference/evals/answer-similarity.mdx +12 -258
- package/.docs/raw/reference/evals/bias.mdx +29 -87
- package/.docs/raw/reference/evals/completeness.mdx +31 -90
- package/.docs/raw/reference/evals/content-similarity.mdx +28 -88
- package/.docs/raw/reference/evals/context-precision.mdx +28 -130
- package/.docs/raw/reference/evals/context-relevance.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +28 -101
- package/.docs/raw/reference/evals/hallucination.mdx +28 -103
- package/.docs/raw/reference/evals/keyword-coverage.mdx +28 -107
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +11 -11
- package/.docs/raw/reference/evals/prompt-alignment.mdx +15 -15
- package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +27 -100
- package/.docs/raw/reference/evals/tone-consistency.mdx +25 -98
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +7 -7
- package/.docs/raw/reference/evals/toxicity.mdx +29 -92
- package/.docs/raw/reference/index.mdx +1 -0
- package/.docs/raw/reference/memory/memory-class.mdx +5 -7
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +150 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +4 -0
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +6 -0
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
- package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +10 -3
- package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +12 -5
- package/.docs/raw/reference/processors/pii-detector.mdx +12 -5
- package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +10 -3
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +3 -4
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
- package/.docs/raw/reference/rag/embeddings.mdx +5 -5
- package/.docs/raw/reference/rag/rerank.mdx +1 -2
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -1
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
- package/.docs/raw/reference/storage/convex.mdx +164 -0
- package/.docs/raw/reference/storage/lance.mdx +33 -0
- package/.docs/raw/reference/storage/libsql.mdx +37 -0
- package/.docs/raw/reference/storage/mongodb.mdx +39 -0
- package/.docs/raw/reference/storage/mssql.mdx +37 -0
- package/.docs/raw/reference/storage/postgresql.mdx +37 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +64 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
- package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
- package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
- package/.docs/raw/reference/templates/overview.mdx +1 -4
- package/.docs/raw/reference/tools/client.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +132 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +5 -5
- package/.docs/raw/reference/tools/mcp-client.mdx +76 -21
- package/.docs/raw/reference/tools/mcp-server.mdx +1 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +14 -15
- package/.docs/raw/reference/vectors/chroma.mdx +81 -1
- package/.docs/raw/reference/vectors/convex.mdx +429 -0
- package/.docs/raw/reference/vectors/couchbase.mdx +24 -17
- package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
- package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
- package/.docs/raw/reference/vectors/lance.mdx +38 -22
- package/.docs/raw/reference/vectors/libsql.mdx +35 -2
- package/.docs/raw/reference/vectors/mongodb.mdx +35 -2
- package/.docs/raw/reference/vectors/opensearch.mdx +37 -16
- package/.docs/raw/reference/vectors/pg.mdx +43 -36
- package/.docs/raw/reference/vectors/pinecone.mdx +48 -1
- package/.docs/raw/reference/vectors/qdrant.mdx +36 -1
- package/.docs/raw/reference/vectors/turbopuffer.mdx +74 -0
- package/.docs/raw/reference/voice/google.mdx +159 -20
- package/.docs/raw/reference/voice/openai-realtime.mdx +2 -2
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +2 -3
- package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
- package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
- package/.docs/raw/reference/voice/voice.close.mdx +1 -1
- package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
- package/.docs/raw/reference/voice/voice.off.mdx +1 -1
- package/.docs/raw/reference/voice/voice.on.mdx +1 -1
- package/.docs/raw/reference/voice/voice.send.mdx +1 -1
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
- package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
- package/.docs/raw/reference/workflows/run.mdx +13 -5
- package/.docs/raw/reference/workflows/step.mdx +13 -0
- package/.docs/raw/reference/workflows/workflow.mdx +19 -0
- package/.docs/raw/server-db/mastra-client.mdx +1 -2
- package/.docs/raw/server-db/mastra-server.mdx +30 -1
- package/.docs/raw/server-db/request-context.mdx +0 -1
- package/.docs/raw/server-db/storage.mdx +11 -0
- package/.docs/raw/streaming/overview.mdx +26 -15
- package/.docs/raw/streaming/tool-streaming.mdx +48 -5
- package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
- package/.docs/raw/tools-mcp/advanced-usage.mdx +1 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +3 -5
- package/.docs/raw/voice/overview.mdx +21 -41
- package/.docs/raw/voice/speech-to-speech.mdx +4 -4
- package/.docs/raw/voice/speech-to-text.mdx +1 -2
- package/.docs/raw/voice/text-to-speech.mdx +1 -2
- package/.docs/raw/workflows/control-flow.mdx +180 -0
- package/.docs/raw/workflows/error-handling.mdx +1 -0
- package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
- package/.docs/raw/workflows/overview.mdx +56 -44
- package/.docs/raw/workflows/snapshots.mdx +1 -0
- package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
- package/.docs/raw/workflows/time-travel.mdx +313 -0
- package/.docs/raw/workflows/workflow-state.mdx +191 -0
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
- package/dist/prepare-docs/package-changes.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +7 -7
- package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -90
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -102
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
- package/.docs/raw/getting-started/quickstart.mdx +0 -27
- package/.docs/raw/getting-started/templates.mdx +0 -73
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +0 -0
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/copilotkit.mdx +0 -0
|
@@ -1,302 +1,502 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
-
## 1.0.0-beta.
|
|
3
|
+
## 1.0.0-beta.6
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- Improved provider metadata preservation across message transformations
|
|
9
|
-
- Optimized reasoning text storage to avoid duplication (using `details` instead of `reasoning` field)
|
|
10
|
-
- Fixed test snapshots for timestamp precision and metadata handling
|
|
7
|
+
- Changed `.branch()` result schema to make all branch output fields optional. ([#10693](https://github.com/mastra-ai/mastra/pull/10693))
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
**Breaking change**: Branch outputs are now optional since only one branch executes at runtime. Update your workflow schemas to handle optional branch results.
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
**Before:**
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
```typescript
|
|
14
|
+
const workflow = createWorkflow({...})
|
|
15
|
+
.branch([
|
|
16
|
+
[condition1, stepA], // outputSchema: { result: z.string() }
|
|
17
|
+
[condition2, stepB], // outputSchema: { data: z.number() }
|
|
18
|
+
])
|
|
19
|
+
.map({
|
|
20
|
+
finalResult: { step: stepA, path: 'result' } // Expected non-optional
|
|
21
|
+
});
|
|
22
|
+
```
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
**After:**
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
```typescript
|
|
27
|
+
const workflow = createWorkflow({...})
|
|
28
|
+
.branch([
|
|
29
|
+
[condition1, stepA],
|
|
30
|
+
[condition2, stepB],
|
|
31
|
+
])
|
|
32
|
+
.map({
|
|
33
|
+
finalResult: {
|
|
34
|
+
step: stepA,
|
|
35
|
+
path: 'result' // Now optional - provide fallback
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
```
|
|
21
39
|
|
|
22
|
-
|
|
40
|
+
**Why**: Branch conditionals execute only one path, so non-executed branches don't produce outputs. The type system now correctly reflects this runtime behavior.
|
|
23
41
|
|
|
24
|
-
|
|
42
|
+
Related issue: https://github.com/mastra-ai/mastra/issues/10642
|
|
25
43
|
|
|
26
|
-
|
|
27
|
-
import { CompositeVoice } from '@mastra/core/voice';
|
|
28
|
-
import { openai } from '@ai-sdk/openai';
|
|
29
|
-
import { elevenlabs } from '@ai-sdk/elevenlabs';
|
|
30
|
-
|
|
31
|
-
// Use AI SDK models directly with CompositeVoice
|
|
32
|
-
const voice = new CompositeVoice({
|
|
33
|
-
input: openai.transcription('whisper-1'), // AI SDK transcription model
|
|
34
|
-
output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech model
|
|
35
|
-
});
|
|
44
|
+
### Minor Changes
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
const audioStream = await voice.speak('Hello from AI SDK!');
|
|
46
|
+
- Memory system now uses processors. Memory processors (`MessageHistory`, `SemanticRecall`, `WorkingMemory`) are now exported from `@mastra/memory/processors` and automatically added to the agent pipeline based on your memory config. Core processors (`ToolCallFilter`, `TokenLimiter`) remain in `@mastra/core/processors`. ([#9254](https://github.com/mastra-ai/mastra/pull/9254))
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
const transcript = await voice.listen(audioStream);
|
|
42
|
-
console.log(transcript);
|
|
43
|
-
```
|
|
48
|
+
- Add reserved keys in RequestContext for secure resourceId/threadId setting from middleware ([#10657](https://github.com/mastra-ai/mastra/pull/10657))
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
This allows middleware to securely set `resourceId` and `threadId` via reserved keys in RequestContext (`MASTRA_RESOURCE_ID_KEY` and `MASTRA_THREAD_ID_KEY`), which take precedence over client-provided values for security.
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
- feat(workflows): add suspendData parameter to step execute function ([#10734](https://github.com/mastra-ai/mastra/pull/10734))
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
Adds a new `suspendData` parameter to workflow step execute functions that provides access to the data originally passed to `suspend()` when the step was suspended. This enables steps to access context about why they were suspended when they are later resumed.
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
**New Features:**
|
|
57
|
+
- `suspendData` parameter automatically populated in step execute function when resuming
|
|
58
|
+
- Type-safe access to suspend data matching the step's `suspendSchema`
|
|
59
|
+
- Backward compatible - existing workflows continue to work unchanged
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
52
62
|
|
|
53
63
|
```typescript
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
const step = createStep({
|
|
65
|
+
suspendSchema: z.object({ reason: z.string() }),
|
|
66
|
+
resumeSchema: z.object({ approved: z.boolean() }),
|
|
67
|
+
execute: async ({ suspend, suspendData, resumeData }) => {
|
|
68
|
+
if (!resumeData?.approved) {
|
|
69
|
+
return await suspend({ reason: 'Approval required' });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Access original suspend data when resuming
|
|
73
|
+
console.log(`Resuming after: ${suspendData?.reason}`);
|
|
74
|
+
return { result: 'Approved' };
|
|
63
75
|
},
|
|
64
76
|
});
|
|
65
77
|
```
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
- feat(storage): support querying messages from multiple threads ([#10663](https://github.com/mastra-ai/mastra/pull/10663))
|
|
80
|
+
- Fixed TypeScript errors where `threadId: string | string[]` was being passed to places expecting `Scalar` type
|
|
81
|
+
- Added proper multi-thread support for `listMessages` across all adapters when `threadId` is an array
|
|
82
|
+
- Updated `_getIncludedMessages` to look up message threadId by ID (since message IDs are globally unique)
|
|
83
|
+
- **upstash**: Added `msg-idx:{messageId}` index for O(1) message lookups (backwards compatible with fallback to scan for old messages, with automatic backfill)
|
|
68
84
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
- Adds trace tagging support to the BrainTrust and Langfuse tracing exporters. ([#10765](https://github.com/mastra-ai/mastra/pull/10765))
|
|
86
|
+
|
|
87
|
+
- Add `messageList` parameter to `processOutputStream` for accessing remembered messages during streaming ([#10608](https://github.com/mastra-ai/mastra/pull/10608))
|
|
88
|
+
|
|
89
|
+
- Unify transformScoreRow functions across storage adapters ([#10648](https://github.com/mastra-ai/mastra/pull/10648))
|
|
90
|
+
|
|
91
|
+
Added a unified `transformScoreRow` function in `@mastra/core/storage` that provides schema-driven row transformation for score data. This eliminates code duplication across 10 storage adapters while maintaining store-specific behavior through configurable options:
|
|
92
|
+
- `preferredTimestampFields`: Preferred source fields for timestamps (PostgreSQL, Cloudflare D1)
|
|
93
|
+
- `convertTimestamps`: Convert timestamp strings to Date objects (MSSQL, MongoDB, ClickHouse)
|
|
94
|
+
- `nullValuePattern`: Skip values matching pattern (ClickHouse's `'_null_'`)
|
|
95
|
+
- `fieldMappings`: Map source column names to schema fields (LibSQL's `additionalLLMContext`)
|
|
96
|
+
|
|
97
|
+
Each store adapter now uses the unified function with appropriate options, reducing ~200 lines of duplicate transformation logic while ensuring consistent behavior across all storage backends.
|
|
82
98
|
|
|
83
99
|
### Patch Changes
|
|
84
100
|
|
|
85
|
-
- dependencies updates: ([#
|
|
86
|
-
- Updated dependency [`hono@^
|
|
101
|
+
- dependencies updates: ([#10110](https://github.com/mastra-ai/mastra/pull/10110))
|
|
102
|
+
- Updated dependency [`hono-openapi@^1.1.1` ↗︎](https://www.npmjs.com/package/hono-openapi/v/1.1.1) (from `^0.4.8`, in `dependencies`)
|
|
103
|
+
|
|
104
|
+
- unexpected json parse issue, log error but dont fail ([#10241](https://github.com/mastra-ai/mastra/pull/10241))
|
|
105
|
+
|
|
106
|
+
- Fixed a bug in agent networks where sometimes the task name was empty ([#10629](https://github.com/mastra-ai/mastra/pull/10629))
|
|
107
|
+
|
|
108
|
+
- Adds `tool-result` and `tool-error` chunks to the processor.processOutputStream path. Processors now have access to these two chunks. ([#10645](https://github.com/mastra-ai/mastra/pull/10645))
|
|
109
|
+
|
|
110
|
+
- Include `.input` in workflow results for both engines and remove the option to omit them from Inngest workflows. ([#10688](https://github.com/mastra-ai/mastra/pull/10688))
|
|
111
|
+
|
|
112
|
+
- `getSpeakers` endpoint returns an empty array if voice is not configured on the agent and `getListeners` endpoint returns `{ enabled: false }` if voice is not figured on the agent. ([#10560](https://github.com/mastra-ai/mastra/pull/10560))
|
|
113
|
+
|
|
114
|
+
When no voice is set on agent don't throw error, by default set voice to undefined rather than DefaultVoice which throws errors when it is accessed.
|
|
115
|
+
|
|
116
|
+
- SimpleAuth and improved CloudAuth ([#10490](https://github.com/mastra-ai/mastra/pull/10490))
|
|
117
|
+
|
|
118
|
+
- When LLMs like Claude Sonnet 4.5 and Gemini 2.4 call tools with all-optional parameters, they send `args: undefined` instead of `args: {}`. This caused validation to fail with "root: Required". ([#10728](https://github.com/mastra-ai/mastra/pull/10728))
|
|
119
|
+
|
|
120
|
+
The fix normalizes `undefined`/`null` to `{}` for object schemas and `[]` for array schemas before validation.
|
|
121
|
+
|
|
122
|
+
- Fixed tool validation error messages so logs show Zod validation errors directly instead of hiding them inside structured JSON. ([#10579](https://github.com/mastra-ai/mastra/pull/10579))
|
|
123
|
+
|
|
124
|
+
- Fix error when spreading config objects in Mastra constructor ([#10718](https://github.com/mastra-ai/mastra/pull/10718))
|
|
87
125
|
|
|
88
|
-
|
|
126
|
+
Adds validation guards to handle undefined/null values that can occur when config objects are spread (`{ ...config }`). Previously, if getters or non-enumerable properties resulted in undefined values during spread, the constructor would throw cryptic errors when accessing `.id` or `.name` on undefined objects.
|
|
89
127
|
|
|
90
|
-
-
|
|
128
|
+
- Fix GPT-5/o3 reasoning models failing with "required reasoning item" errors when using memory with tools. Empty reasoning is now stored with providerMetadata to preserve OpenAI's item_reference. ([#10585](https://github.com/mastra-ai/mastra/pull/10585))
|
|
91
129
|
|
|
92
|
-
- Fix
|
|
130
|
+
- Fix generateTitle model type to accept AI SDK LanguageModelV2 ([#10541](https://github.com/mastra-ai/mastra/pull/10541))
|
|
93
131
|
|
|
94
|
-
|
|
132
|
+
Updated the `generateTitle.model` config option to accept `MastraModelConfig` instead of `MastraLanguageModel`. This allows users to pass raw AI SDK `LanguageModelV2` models (e.g., `anthropic.languageModel('claude-3-5-haiku-20241022')`) directly without type errors.
|
|
95
133
|
|
|
96
|
-
|
|
134
|
+
Previously, passing a standard `LanguageModelV2` would fail because `MastraLanguageModelV2` has different `doGenerate`/`doStream` return types. Now `MastraModelConfig` is used consistently across:
|
|
135
|
+
- `memory/types.ts` - `generateTitle.model` config
|
|
136
|
+
- `agent.ts` - `genTitle`, `generateTitleFromUserMessage`, `resolveTitleGenerationConfig`
|
|
137
|
+
- `agent-legacy.ts` - `AgentLegacyCapabilities` interface
|
|
97
138
|
|
|
98
|
-
-
|
|
139
|
+
- Fix message ordering when using toAISdkV5Messages or prepareStep ([#10686](https://github.com/mastra-ai/mastra/pull/10686))
|
|
99
140
|
|
|
100
|
-
|
|
141
|
+
Messages without `createdAt` timestamps were getting shuffled because they all received identical timestamps during conversion. Now messages are assigned monotonically increasing timestamps via `generateCreatedAt()`, preserving input order.
|
|
101
142
|
|
|
102
|
-
|
|
103
|
-
- Added new abstraction over LanguageModelV2
|
|
143
|
+
Before:
|
|
104
144
|
|
|
105
|
-
|
|
145
|
+
```
|
|
146
|
+
Input: [user: "hello", assistant: "Hi!", user: "bye"]
|
|
147
|
+
Output: [user: "bye", assistant: "Hi!", user: "hello"] // shuffled!
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
After:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Input: [user: "hello", assistant: "Hi!", user: "bye"]
|
|
154
|
+
Output: [user: "hello", assistant: "Hi!", user: "bye"] // correct order
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- Fix Scorer not using custom gateways registered with Mastra ([#10778](https://github.com/mastra-ai/mastra/pull/10778))
|
|
158
|
+
|
|
159
|
+
Scorers now have access to custom gateways when resolving models. Previously, calling `resolveModelConfig` in the scorer didn't pass the Mastra instance, so custom gateways were never available.
|
|
106
160
|
|
|
107
|
-
-
|
|
161
|
+
- Fix workflow run status not being updated from storage snapshot in createRun ([#10664](https://github.com/mastra-ai/mastra/pull/10664))
|
|
162
|
+
|
|
163
|
+
When createRun is called with an existing runId, it now correctly updates the run's status from the storage snapshot. This fixes the issue where different workflow instances (e.g., different API requests) would get a run with 'pending' status instead of the correct status from storage (e.g., 'suspended').
|
|
164
|
+
|
|
165
|
+
- Pass resourceId and threadId to network agent's subAgent when it has its own memory ([#10592](https://github.com/mastra-ai/mastra/pull/10592))
|
|
166
|
+
|
|
167
|
+
- use `agent.getMemory` to fetch the memory instance on the Agent class to make sure that storage gets set if memory doesn't set it itself. ([#10556](https://github.com/mastra-ai/mastra/pull/10556))
|
|
168
|
+
|
|
169
|
+
- Built-in processors that use internal agents (PromptInjectionDetector, ModerationProcessor, PIIDetector, LanguageDetector, StructuredOutputProcessor) now accept `providerOptions` to control model behavior. ([#10651](https://github.com/mastra-ai/mastra/pull/10651))
|
|
170
|
+
|
|
171
|
+
This lets you pass provider-specific settings like `reasoningEffort` for OpenAI thinking models:
|
|
108
172
|
|
|
109
173
|
```typescript
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
async fetchProviders(): Promise<Record<string, ProviderConfig>> {
|
|
120
|
-
return {
|
|
121
|
-
'my-provider': {
|
|
122
|
-
name: 'My Provider',
|
|
123
|
-
models: ['model-1', 'model-2'],
|
|
124
|
-
apiKeyEnvVar: 'MY_API_KEY',
|
|
125
|
-
gateway: this.id,
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
buildUrl(modelId: string, envVars?: Record<string, string>): string {
|
|
131
|
-
return 'https://api.my-provider.com/v1';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async getApiKey(modelId: string): Promise<string> {
|
|
135
|
-
const apiKey = process.env.MY_API_KEY;
|
|
136
|
-
if (!apiKey) throw new Error('MY_API_KEY not set');
|
|
137
|
-
return apiKey;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async resolveLanguageModel({
|
|
141
|
-
modelId,
|
|
142
|
-
providerId,
|
|
143
|
-
apiKey,
|
|
144
|
-
}: {
|
|
145
|
-
modelId: string;
|
|
146
|
-
providerId: string;
|
|
147
|
-
apiKey: string;
|
|
148
|
-
}): Promise<LanguageModelV2> {
|
|
149
|
-
const baseURL = this.buildUrl(`${providerId}/${modelId}`);
|
|
150
|
-
return createOpenAICompatible({
|
|
151
|
-
name: providerId,
|
|
152
|
-
apiKey,
|
|
153
|
-
baseURL,
|
|
154
|
-
}).chatModel(modelId);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
new Mastra({
|
|
159
|
-
gateways: {
|
|
160
|
-
myGateway: new MyCustomGateway(),
|
|
174
|
+
const processor = new PromptInjectionDetector({
|
|
175
|
+
model: 'openai/o1-mini',
|
|
176
|
+
threshold: 0.7,
|
|
177
|
+
strategy: 'block',
|
|
178
|
+
providerOptions: {
|
|
179
|
+
openai: {
|
|
180
|
+
reasoningEffort: 'low',
|
|
181
|
+
},
|
|
161
182
|
},
|
|
162
183
|
});
|
|
163
184
|
```
|
|
164
185
|
|
|
165
|
-
-
|
|
186
|
+
- Improved typing for `workflow.then` to allow the provided steps `inputSchema` to be a subset of the previous steps `outputSchema`. Also errors if the provided steps `inputSchema` is a superset of the previous steps outputSchema. ([#10763](https://github.com/mastra-ai/mastra/pull/10763))
|
|
166
187
|
|
|
167
|
-
-
|
|
168
|
-
Add status filter to `listWorkflowRuns`
|
|
169
|
-
Add automatic restart to restart active workflow runs when server starts
|
|
188
|
+
- Fix type issue with workflow `.parallel()` when passing multiple steps, one or more of which has a `resumeSchema` provided. ([#10708](https://github.com/mastra-ai/mastra/pull/10708))
|
|
170
189
|
|
|
171
|
-
-
|
|
190
|
+
- Adds bidirectional integration with otel tracing via a new @mastra/otel-bridge package. ([#10482](https://github.com/mastra-ai/mastra/pull/10482))
|
|
172
191
|
|
|
173
|
-
|
|
192
|
+
- Adds `processInputStep` method to the Processor interface. Unlike `processInput` which runs once at the start, this runs at each step of the agentic loop (including tool call continuations). ([#10650](https://github.com/mastra-ai/mastra/pull/10650))
|
|
174
193
|
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
194
|
+
```ts
|
|
195
|
+
const processor: Processor = {
|
|
196
|
+
id: 'my-processor',
|
|
197
|
+
processInputStep: async ({ messages, messageList, stepNumber, systemMessages }) => {
|
|
198
|
+
// Transform messages at each step before LLM call
|
|
199
|
+
return messageList;
|
|
200
|
+
},
|
|
201
|
+
};
|
|
181
202
|
```
|
|
182
203
|
|
|
183
|
-
-
|
|
184
|
-
|
|
185
|
-
|
|
204
|
+
- When using output processors with `agent.generate()`, `result.text` was returning the unprocessed LLM response instead of the processed text. ([#10735](https://github.com/mastra-ai/mastra/pull/10735))
|
|
205
|
+
|
|
206
|
+
**Before:**
|
|
186
207
|
|
|
187
|
-
|
|
208
|
+
```ts
|
|
209
|
+
const result = await agent.generate('hello');
|
|
210
|
+
result.text; // "hello world" (unprocessed)
|
|
211
|
+
result.response.messages[0].content[0].text; // "HELLO WORLD" (processed)
|
|
212
|
+
```
|
|
188
213
|
|
|
189
|
-
|
|
214
|
+
**After:**
|
|
190
215
|
|
|
191
216
|
```ts
|
|
192
|
-
const result = await
|
|
193
|
-
|
|
194
|
-
inputData: {
|
|
195
|
-
value: 'input',
|
|
196
|
-
},
|
|
197
|
-
});
|
|
217
|
+
const result = await agent.generate('hello');
|
|
218
|
+
result.text; // "HELLO WORLD" (processed)
|
|
198
219
|
```
|
|
199
220
|
|
|
200
|
-
|
|
221
|
+
The bug was caused by the `text` delayed promise being resolved twice - first correctly with the processed text, then overwritten with the unprocessed buffered text.
|
|
201
222
|
|
|
202
|
-
-
|
|
223
|
+
- Refactored default engine to fit durable execution better, and the inngest engine to match. ([#10627](https://github.com/mastra-ai/mastra/pull/10627))
|
|
224
|
+
Also fixes requestContext persistence by relying on inngest step memoization.
|
|
203
225
|
|
|
204
|
-
|
|
205
|
-
- @mastra/observability@1.0.0-beta.1
|
|
226
|
+
Unifies some of the stepResults and error formats in both engines.
|
|
206
227
|
|
|
207
|
-
|
|
228
|
+
- Allow direct access to server app handle directly from Mastra instance. ([#10598](https://github.com/mastra-ai/mastra/pull/10598))
|
|
208
229
|
|
|
209
|
-
|
|
230
|
+
```ts
|
|
231
|
+
// Before: HTTP request to localhost
|
|
232
|
+
const response = await fetch(`http://localhost:5000/api/tools`);
|
|
210
233
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
234
|
+
// After: Direct call via app.fetch()
|
|
235
|
+
const app = mastra.getServerApp<Hono>();
|
|
236
|
+
const response = await app.fetch(new Request('http://internal/api/tools'));
|
|
237
|
+
```
|
|
215
238
|
|
|
216
|
-
|
|
239
|
+
- Added `mastra.getServerApp<T>()` to access the underlying Hono/Express app
|
|
240
|
+
- Added `mastra.getMastraServer()` and `mastra.setMastraServer()` for adapter access
|
|
241
|
+
- Added `MastraServerBase` class in `@mastra/core/server` for adapter implementations
|
|
242
|
+
- Server adapters now auto-register with Mastra in their constructor
|
|
217
243
|
|
|
218
|
-
|
|
244
|
+
- Fix network agent not getting `text-delta` from subAgent when `.stream` is used ([#10533](https://github.com/mastra-ai/mastra/pull/10533))
|
|
219
245
|
|
|
220
|
-
-
|
|
246
|
+
- Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
|
|
221
247
|
|
|
222
|
-
-
|
|
248
|
+
- Fix writer.custom not working during workflow resume operations ([#10720](https://github.com/mastra-ai/mastra/pull/10720))
|
|
223
249
|
|
|
224
|
-
|
|
250
|
+
When a workflow step is resumed, the writer parameter was not being properly passed through, causing writer.custom() calls to fail. This fix ensures the writableStream parameter is correctly passed to both run.resume() and run.start() calls in the workflow execution engine, allowing custom events to be emitted properly during resume operations.
|
|
225
251
|
|
|
226
|
-
|
|
252
|
+
- Fix corrupted provider-registry.json file in global cache and regenerate corrupted files ([#10606](https://github.com/mastra-ai/mastra/pull/10606))
|
|
227
253
|
|
|
228
|
-
|
|
254
|
+
- Fix TypeScript error when using Zod schemas in `defaultOptions.structuredOutput` ([#10710](https://github.com/mastra-ai/mastra/pull/10710))
|
|
229
255
|
|
|
230
|
-
|
|
256
|
+
Previously, defining `structuredOutput.schema` in `defaultOptions` would cause a TypeScript error because the type only accepted `undefined`. Now any valid `OutputSchema` is correctly accepted.
|
|
231
257
|
|
|
232
|
-
-
|
|
233
|
-
- Scorer input/output types now use `MastraDBMessage[]` with nested `content` object structure
|
|
234
|
-
- Added `getTextContentFromMastraDBMessage()` helper function to extract text content from `MastraDBMessage` objects
|
|
235
|
-
- Added `createTestMessage()` helper function for creating `MastraDBMessage` objects in tests with optional tool invocations support
|
|
236
|
-
- Updated `extractToolCalls()` to access tool invocations from nested `content` structure
|
|
237
|
-
- Updated `getUserMessageFromRunInput()` and `getAssistantMessageFromRunOutput()` to use new message structure
|
|
238
|
-
- Removed `createUIMessage()`
|
|
258
|
+
- Add support for `providerOptions` when defining tools. This allows developers to specify provider-specific configurations (like Anthropic's `cacheControl`) per tool. ([#10649](https://github.com/mastra-ai/mastra/pull/10649))
|
|
239
259
|
|
|
240
|
-
|
|
260
|
+
```typescript
|
|
261
|
+
createTool({
|
|
262
|
+
id: 'my-tool',
|
|
263
|
+
providerOptions: {
|
|
264
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
265
|
+
},
|
|
266
|
+
// ...
|
|
267
|
+
});
|
|
268
|
+
```
|
|
241
269
|
|
|
242
|
-
|
|
270
|
+
- Fixed OpenAI reasoning message merging so distinct reasoning items are no longer dropped when they share a message ID. Prevents downstream errors where a function call is missing its required "reasoning" item. See #9005. ([#10614](https://github.com/mastra-ai/mastra/pull/10614))
|
|
243
271
|
|
|
244
|
-
-
|
|
272
|
+
- Updated dependencies [[`103586c`](https://github.com/mastra-ai/mastra/commit/103586cb23ebcd2466c7f68a71674d37cc10e263), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8)]:
|
|
273
|
+
- @mastra/observability@1.0.0-beta.2
|
|
274
|
+
- @mastra/schema-compat@1.0.0-beta.2
|
|
245
275
|
|
|
246
|
-
|
|
276
|
+
## 1.0.0-beta.5
|
|
247
277
|
|
|
248
|
-
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- Add Azure OpenAI gateway ([#9990](https://github.com/mastra-ai/mastra/pull/9990))
|
|
249
281
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
- Scores: `listScoresBySpan()`, `listScoresByRunId()`, `listScoresByExecutionId()`
|
|
255
|
-
- HTTP query parser accepts `"false"` string (e.g., `?perPage=false`)
|
|
282
|
+
The Azure OpenAI gateway supports three configuration modes:
|
|
283
|
+
1. **Static deployments**: Provide deployment names from Azure Portal
|
|
284
|
+
2. **Dynamic discovery**: Query Azure Management API for available deployments
|
|
285
|
+
3. **Manual**: Specify deployment names when creating agents
|
|
256
286
|
|
|
257
|
-
|
|
258
|
-
- `memory.query()` parameter type changed from `StorageGetMessagesArg` to `StorageListMessagesInput`
|
|
259
|
-
- Uses flat parameters (`page`, `perPage`, `include`, `filter`, `vectorSearchString`) instead of `selectBy` object
|
|
287
|
+
## Usage
|
|
260
288
|
|
|
261
|
-
|
|
262
|
-
|
|
289
|
+
```typescript
|
|
290
|
+
import { Mastra } from '@mastra/core';
|
|
291
|
+
import { AzureOpenAIGateway } from '@mastra/core/llm';
|
|
292
|
+
|
|
293
|
+
// Static mode (recommended)
|
|
294
|
+
export const mastra = new Mastra({
|
|
295
|
+
gateways: [
|
|
296
|
+
new AzureOpenAIGateway({
|
|
297
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
298
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
299
|
+
deployments: ['gpt-4-prod', 'gpt-35-turbo-dev'],
|
|
300
|
+
}),
|
|
301
|
+
],
|
|
302
|
+
});
|
|
263
303
|
|
|
264
|
-
|
|
304
|
+
// Dynamic discovery mode
|
|
305
|
+
export const mastra = new Mastra({
|
|
306
|
+
gateways: [
|
|
307
|
+
new AzureOpenAIGateway({
|
|
308
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
309
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
310
|
+
management: {
|
|
311
|
+
tenantId: process.env.AZURE_TENANT_ID!,
|
|
312
|
+
clientId: process.env.AZURE_CLIENT_ID!,
|
|
313
|
+
clientSecret: process.env.AZURE_CLIENT_SECRET!,
|
|
314
|
+
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
|
|
315
|
+
resourceGroup: 'my-resource-group',
|
|
316
|
+
},
|
|
317
|
+
}),
|
|
318
|
+
],
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// Use Azure OpenAI models
|
|
322
|
+
const agent = new Agent({
|
|
323
|
+
model: 'azure-openai/gpt-4-deployment',
|
|
324
|
+
instructions: 'You are a helpful assistant',
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
- - Fix tool suspension throwing error when `outputSchema` is passed to tool during creation ([#10444](https://github.com/mastra-ai/mastra/pull/10444))
|
|
329
|
+
- Pass `suspendSchema` and `resumeSchema` from tool into step created when creating step from tool
|
|
330
|
+
|
|
331
|
+
- Add `onOutput` hook for tools ([#10466](https://github.com/mastra-ai/mastra/pull/10466))
|
|
332
|
+
|
|
333
|
+
Tools now support an `onOutput` lifecycle hook that is invoked after successful tool execution. This complements the existing `onInputStart`, `onInputDelta`, and `onInputAvailable` hooks to provide complete visibility into the tool execution lifecycle.
|
|
334
|
+
|
|
335
|
+
The `onOutput` hook receives:
|
|
336
|
+
- `output`: The tool's return value (typed according to `outputSchema`)
|
|
337
|
+
- `toolCallId`: Unique identifier for the tool call
|
|
338
|
+
- `toolName`: The name of the tool that was executed
|
|
339
|
+
- `abortSignal`: Signal for detecting if the operation should be cancelled
|
|
340
|
+
|
|
341
|
+
Example usage:
|
|
265
342
|
|
|
266
343
|
```typescript
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
344
|
+
import { createTool } from '@mastra/core/tools';
|
|
345
|
+
import { z } from 'zod';
|
|
346
|
+
|
|
347
|
+
export const weatherTool = createTool({
|
|
348
|
+
id: 'weather-tool',
|
|
349
|
+
description: 'Get weather information',
|
|
350
|
+
outputSchema: z.object({
|
|
351
|
+
temperature: z.number(),
|
|
352
|
+
conditions: z.string(),
|
|
353
|
+
}),
|
|
354
|
+
execute: async input => {
|
|
355
|
+
return { temperature: 72, conditions: 'sunny' };
|
|
356
|
+
},
|
|
357
|
+
onOutput: ({ output, toolCallId, toolName }) => {
|
|
358
|
+
console.log(`${toolName} completed:`, output);
|
|
359
|
+
// output is fully typed based on outputSchema
|
|
360
|
+
},
|
|
361
|
+
});
|
|
279
362
|
```
|
|
280
363
|
|
|
281
|
-
|
|
364
|
+
Hook execution order:
|
|
365
|
+
1. `onInputStart` - Input streaming begins
|
|
366
|
+
2. `onInputDelta` - Input chunks arrive (called multiple times)
|
|
367
|
+
3. `onInputAvailable` - Complete input parsed and validated
|
|
368
|
+
4. Tool's `execute` function runs
|
|
369
|
+
5. `onOutput` - Tool completed successfully (NEW)
|
|
370
|
+
|
|
371
|
+
- Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
|
|
372
|
+
|
|
373
|
+
- Fix base64 encoded images with threads - issue #10480 ([#10483](https://github.com/mastra-ai/mastra/pull/10483))
|
|
374
|
+
|
|
375
|
+
Fixed "Invalid URL" error when using base64 encoded images (without `data:` prefix) in agent calls with threads and resources. Raw base64 strings are now automatically converted to proper data URIs before being processed.
|
|
376
|
+
|
|
377
|
+
**Changes:**
|
|
378
|
+
- Updated `attachments-to-parts.ts` to detect and convert raw base64 strings to data URIs
|
|
379
|
+
- Fixed `MessageList` image processing to handle raw base64 in two locations:
|
|
380
|
+
- Image part conversion in `aiV4CoreMessageToV1PromptMessage`
|
|
381
|
+
- File part to experimental_attachments conversion in `mastraDBMessageToAIV4UIMessage`
|
|
382
|
+
- Added comprehensive tests for base64 images, data URIs, and HTTP URLs with threads
|
|
383
|
+
|
|
384
|
+
**Breaking Change:** None - this is a bug fix that maintains backward compatibility while adding support for raw base64 strings.
|
|
385
|
+
|
|
386
|
+
- Fix message metadata not persisting when using simple message format. Previously, custom metadata passed in messages (e.g., `{role: 'user', content: 'text', metadata: {userId: '123'}}`) was not being saved to the database. This occurred because the CoreMessage conversion path didn't preserve metadata fields. ([#10488](https://github.com/mastra-ai/mastra/pull/10488))
|
|
387
|
+
|
|
388
|
+
Now metadata is properly preserved for all message input formats:
|
|
389
|
+
- Simple CoreMessage format: `{role, content, metadata}`
|
|
390
|
+
- Full UIMessage format: `{role, content, parts, metadata}`
|
|
391
|
+
- AI SDK v5 ModelMessage format with metadata
|
|
392
|
+
|
|
393
|
+
Fixes #8556
|
|
394
|
+
|
|
395
|
+
- feat: Composite auth implementation ([#10359](https://github.com/mastra-ai/mastra/pull/10359))
|
|
396
|
+
|
|
397
|
+
- Fix requireApproval property being ignored for tools passed via toolsets, clientTools, and memoryTools parameters. The requireApproval flag now correctly propagates through all tool conversion paths, ensuring tools requiring approval will properly request user approval before execution. ([#10464](https://github.com/mastra-ai/mastra/pull/10464))
|
|
282
398
|
|
|
283
|
-
|
|
399
|
+
- Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
|
|
284
400
|
|
|
285
|
-
|
|
401
|
+
- Fix Azure Foundry rate limit handling for -1 values ([#10409](https://github.com/mastra-ai/mastra/pull/10409))
|
|
286
402
|
|
|
287
|
-
|
|
403
|
+
- Fix model headers not being passed through gateway system ([#10465](https://github.com/mastra-ai/mastra/pull/10465))
|
|
288
404
|
|
|
289
|
-
|
|
405
|
+
Previously, custom headers specified in `MastraModelConfig` were not being passed through the gateway system to model providers. This affected:
|
|
406
|
+
- OpenRouter (preventing activity tracking with `HTTP-Referer` and `X-Title`)
|
|
407
|
+
- Custom providers using custom URLs (headers not passed to `createOpenAICompatible`)
|
|
408
|
+
- Custom gateway implementations (headers not available in `resolveLanguageModel`)
|
|
409
|
+
|
|
410
|
+
Now headers are correctly passed through the entire gateway system:
|
|
411
|
+
- Base `MastraModelGateway` interface updated to accept headers
|
|
412
|
+
- `ModelRouterLanguageModel` passes headers from config to all gateways
|
|
413
|
+
- OpenRouter receives headers for activity tracking
|
|
414
|
+
- Custom URL providers receive headers via `createOpenAICompatible`
|
|
415
|
+
- Custom gateways can access headers in their `resolveLanguageModel` implementation
|
|
416
|
+
|
|
417
|
+
Example usage:
|
|
290
418
|
|
|
291
419
|
```typescript
|
|
292
|
-
//
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
420
|
+
// Works with OpenRouter
|
|
421
|
+
const agent = new Agent({
|
|
422
|
+
name: 'my-agent',
|
|
423
|
+
instructions: 'You are a helpful assistant.',
|
|
424
|
+
model: {
|
|
425
|
+
id: 'openrouter/anthropic/claude-3-5-sonnet',
|
|
426
|
+
headers: {
|
|
427
|
+
'HTTP-Referer': 'https://myapp.com',
|
|
428
|
+
'X-Title': 'My Application',
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Also works with custom providers
|
|
434
|
+
const customAgent = new Agent({
|
|
435
|
+
name: 'custom-agent',
|
|
436
|
+
instructions: 'You are a helpful assistant.',
|
|
437
|
+
model: {
|
|
438
|
+
id: 'custom-provider/model',
|
|
439
|
+
url: 'https://api.custom.com/v1',
|
|
440
|
+
apiKey: 'key',
|
|
441
|
+
headers: {
|
|
442
|
+
'X-Custom-Header': 'custom-value',
|
|
443
|
+
},
|
|
444
|
+
},
|
|
300
445
|
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Fixes https://github.com/mastra-ai/mastra/issues/9760
|
|
449
|
+
|
|
450
|
+
- fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
451
|
+
|
|
452
|
+
Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
|
|
453
|
+
|
|
454
|
+
**Backend changes (@mastra/core):**
|
|
455
|
+
- Add assistant messages to messageList immediately after LLM execution
|
|
456
|
+
- Flush messages synchronously before suspension to persist state
|
|
457
|
+
- Create thread if it doesn't exist before flushing
|
|
458
|
+
- Add metadata helpers to persist and remove tool approval state
|
|
459
|
+
- Pass saveQueueManager and memory context through workflow for immediate persistence
|
|
460
|
+
|
|
461
|
+
**Frontend changes (@mastra/react):**
|
|
462
|
+
- Extract runId from pending approvals to enable resumption after refresh
|
|
463
|
+
- Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
|
|
464
|
+
- Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
|
|
465
|
+
- Change runId from hardcoded `agentId` to unique `uuid()`
|
|
466
|
+
|
|
467
|
+
**UI changes (@mastra/playground-ui):**
|
|
468
|
+
- Handle tool calls awaiting approval in message initialization
|
|
469
|
+
- Convert approval metadata format when loading initial messages
|
|
470
|
+
|
|
471
|
+
Fixes #9745, #9906
|
|
472
|
+
|
|
473
|
+
- Update MockMemory to work with new storage API changes. MockMemory now properly implements all abstract MastraMemory methods. This includes proper thread management, message saving with MessageList conversion, working memory operations with scope support, and resource listing. ([#10368](https://github.com/mastra-ai/mastra/pull/10368))
|
|
474
|
+
|
|
475
|
+
Add Zod v4 support for working memory schemas. Memory implementations now check for Zod v4's built-in `.toJsonSchema()` method before falling back to the `zodToJsonSchema` compatibility function, improving performance and forward compatibility while maintaining backward compatibility with Zod v3.
|
|
476
|
+
|
|
477
|
+
Add Gemini 3 Pro test coverage in agent-gemini.test.ts to validate the latest Gemini model integration.
|
|
478
|
+
|
|
479
|
+
- Fix race condition in parallel tool stream writes ([#10463](https://github.com/mastra-ai/mastra/pull/10463))
|
|
480
|
+
|
|
481
|
+
Introduces a write queue to ToolStream to serialize access to the underlying stream, preventing writer locked errors
|
|
482
|
+
|
|
483
|
+
- Remove unneeded console warning when flushing messages and no threadId or saveQueueManager is found. ([#10498](https://github.com/mastra-ai/mastra/pull/10498))
|
|
484
|
+
|
|
485
|
+
- Add optional includeRawChunks parameter to agent execution options, ([#10456](https://github.com/mastra-ai/mastra/pull/10456))
|
|
486
|
+
allowing users to include raw chunks in stream output where supported
|
|
487
|
+
by the model provider.
|
|
488
|
+
|
|
489
|
+
- When `mastra dev` runs, multiple processes can write to `provider-registry.json` concurrently (auto-refresh, syncGateways, syncGlobalCacheToLocal). This causes file corruption where the end of the JSON appears twice, making it unparseable. ([#10455](https://github.com/mastra-ai/mastra/pull/10455))
|
|
490
|
+
|
|
491
|
+
The fix uses atomic writes via the write-to-temp-then-rename pattern. Instead of:
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
We now do:
|
|
498
|
+
|
|
499
|
+
```ts
|
|
500
|
+
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;
|
|
301
501
|
|
|
302
|
-
...
|
|
502
|
+
... 5741 more lines hidden. See full changelog in package directory.
|