@mastra/mcp-docs-server 1.0.0-beta.3 → 1.0.0-beta.5
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%2Fauth.md +6 -0
- 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%2Fcore.md +370 -170
- 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%2Fdynamodb.md +201 -1
- 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 +80 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +36 -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/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +55 -9
- package/.docs/raw/agents/guardrails.mdx +19 -20
- package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +6 -5
- package/.docs/raw/agents/networks.mdx +1 -2
- package/.docs/raw/agents/overview.mdx +5 -5
- 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 +1 -1
- 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/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} +105 -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/{guide → getting-started}/manual-install.mdx +1 -1
- 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/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 +29 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +5 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +22 -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 +1 -2
- 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 +4 -5
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +1 -1
- package/.docs/raw/observability/overview.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/otel.mdx +21 -2
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +107 -0
- package/.docs/raw/observability/tracing/overview.mdx +3 -2
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +3 -2
- package/.docs/raw/rag/retrieval.mdx +20 -32
- package/.docs/raw/reference/agents/agent.mdx +7 -10
- package/.docs/raw/reference/agents/generate.mdx +11 -92
- 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 +5 -88
- package/.docs/raw/reference/cli/mastra.mdx +2 -1
- package/.docs/raw/reference/client-js/agents.mdx +3 -3
- 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/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/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/memory/memory-class.mdx +5 -7
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +2 -2
- package/.docs/raw/reference/processors/pii-detector.mdx +2 -2
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -3
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- 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/streaming/agents/stream.mdx +11 -93
- 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 +2 -4
- 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/couchbase.mdx +24 -17
- 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/composite-voice.mdx +71 -28
- 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.listen.mdx +86 -52
- 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.speak.mdx +75 -40
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/server-db/mastra-client.mdx +1 -2
- package/.docs/raw/streaming/overview.mdx +20 -9
- package/.docs/raw/streaming/tool-streaming.mdx +47 -4
- 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 +87 -40
- 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/overview.mdx +1 -1
- package/CHANGELOG.md +17 -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/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/{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,5 +1,374 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add Azure OpenAI gateway ([#9990](https://github.com/mastra-ai/mastra/pull/9990))
|
|
8
|
+
|
|
9
|
+
The Azure OpenAI gateway supports three configuration modes:
|
|
10
|
+
1. **Static deployments**: Provide deployment names from Azure Portal
|
|
11
|
+
2. **Dynamic discovery**: Query Azure Management API for available deployments
|
|
12
|
+
3. **Manual**: Specify deployment names when creating agents
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { Mastra } from '@mastra/core';
|
|
18
|
+
import { AzureOpenAIGateway } from '@mastra/core/llm';
|
|
19
|
+
|
|
20
|
+
// Static mode (recommended)
|
|
21
|
+
export const mastra = new Mastra({
|
|
22
|
+
gateways: [
|
|
23
|
+
new AzureOpenAIGateway({
|
|
24
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
25
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
26
|
+
deployments: ['gpt-4-prod', 'gpt-35-turbo-dev'],
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Dynamic discovery mode
|
|
32
|
+
export const mastra = new Mastra({
|
|
33
|
+
gateways: [
|
|
34
|
+
new AzureOpenAIGateway({
|
|
35
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
36
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
37
|
+
management: {
|
|
38
|
+
tenantId: process.env.AZURE_TENANT_ID!,
|
|
39
|
+
clientId: process.env.AZURE_CLIENT_ID!,
|
|
40
|
+
clientSecret: process.env.AZURE_CLIENT_SECRET!,
|
|
41
|
+
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
|
|
42
|
+
resourceGroup: 'my-resource-group',
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Use Azure OpenAI models
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
model: 'azure-openai/gpt-4-deployment',
|
|
51
|
+
instructions: 'You are a helpful assistant',
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- - Fix tool suspension throwing error when `outputSchema` is passed to tool during creation ([#10444](https://github.com/mastra-ai/mastra/pull/10444))
|
|
56
|
+
- Pass `suspendSchema` and `resumeSchema` from tool into step created when creating step from tool
|
|
57
|
+
|
|
58
|
+
- Add `onOutput` hook for tools ([#10466](https://github.com/mastra-ai/mastra/pull/10466))
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
The `onOutput` hook receives:
|
|
63
|
+
- `output`: The tool's return value (typed according to `outputSchema`)
|
|
64
|
+
- `toolCallId`: Unique identifier for the tool call
|
|
65
|
+
- `toolName`: The name of the tool that was executed
|
|
66
|
+
- `abortSignal`: Signal for detecting if the operation should be cancelled
|
|
67
|
+
|
|
68
|
+
Example usage:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { createTool } from '@mastra/core/tools';
|
|
72
|
+
import { z } from 'zod';
|
|
73
|
+
|
|
74
|
+
export const weatherTool = createTool({
|
|
75
|
+
id: 'weather-tool',
|
|
76
|
+
description: 'Get weather information',
|
|
77
|
+
outputSchema: z.object({
|
|
78
|
+
temperature: z.number(),
|
|
79
|
+
conditions: z.string(),
|
|
80
|
+
}),
|
|
81
|
+
execute: async input => {
|
|
82
|
+
return { temperature: 72, conditions: 'sunny' };
|
|
83
|
+
},
|
|
84
|
+
onOutput: ({ output, toolCallId, toolName }) => {
|
|
85
|
+
console.log(`${toolName} completed:`, output);
|
|
86
|
+
// output is fully typed based on outputSchema
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Hook execution order:
|
|
92
|
+
1. `onInputStart` - Input streaming begins
|
|
93
|
+
2. `onInputDelta` - Input chunks arrive (called multiple times)
|
|
94
|
+
3. `onInputAvailable` - Complete input parsed and validated
|
|
95
|
+
4. Tool's `execute` function runs
|
|
96
|
+
5. `onOutput` - Tool completed successfully (NEW)
|
|
97
|
+
|
|
98
|
+
- Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
|
|
99
|
+
|
|
100
|
+
- Fix base64 encoded images with threads - issue #10480 ([#10483](https://github.com/mastra-ai/mastra/pull/10483))
|
|
101
|
+
|
|
102
|
+
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.
|
|
103
|
+
|
|
104
|
+
**Changes:**
|
|
105
|
+
- Updated `attachments-to-parts.ts` to detect and convert raw base64 strings to data URIs
|
|
106
|
+
- Fixed `MessageList` image processing to handle raw base64 in two locations:
|
|
107
|
+
- Image part conversion in `aiV4CoreMessageToV1PromptMessage`
|
|
108
|
+
- File part to experimental_attachments conversion in `mastraDBMessageToAIV4UIMessage`
|
|
109
|
+
- Added comprehensive tests for base64 images, data URIs, and HTTP URLs with threads
|
|
110
|
+
|
|
111
|
+
**Breaking Change:** None - this is a bug fix that maintains backward compatibility while adding support for raw base64 strings.
|
|
112
|
+
|
|
113
|
+
- 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))
|
|
114
|
+
|
|
115
|
+
Now metadata is properly preserved for all message input formats:
|
|
116
|
+
- Simple CoreMessage format: `{role, content, metadata}`
|
|
117
|
+
- Full UIMessage format: `{role, content, parts, metadata}`
|
|
118
|
+
- AI SDK v5 ModelMessage format with metadata
|
|
119
|
+
|
|
120
|
+
Fixes #8556
|
|
121
|
+
|
|
122
|
+
- feat: Composite auth implementation ([#10359](https://github.com/mastra-ai/mastra/pull/10359))
|
|
123
|
+
|
|
124
|
+
- 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))
|
|
125
|
+
|
|
126
|
+
- Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
|
|
127
|
+
|
|
128
|
+
- Fix Azure Foundry rate limit handling for -1 values ([#10409](https://github.com/mastra-ai/mastra/pull/10409))
|
|
129
|
+
|
|
130
|
+
- Fix model headers not being passed through gateway system ([#10465](https://github.com/mastra-ai/mastra/pull/10465))
|
|
131
|
+
|
|
132
|
+
Previously, custom headers specified in `MastraModelConfig` were not being passed through the gateway system to model providers. This affected:
|
|
133
|
+
- OpenRouter (preventing activity tracking with `HTTP-Referer` and `X-Title`)
|
|
134
|
+
- Custom providers using custom URLs (headers not passed to `createOpenAICompatible`)
|
|
135
|
+
- Custom gateway implementations (headers not available in `resolveLanguageModel`)
|
|
136
|
+
|
|
137
|
+
Now headers are correctly passed through the entire gateway system:
|
|
138
|
+
- Base `MastraModelGateway` interface updated to accept headers
|
|
139
|
+
- `ModelRouterLanguageModel` passes headers from config to all gateways
|
|
140
|
+
- OpenRouter receives headers for activity tracking
|
|
141
|
+
- Custom URL providers receive headers via `createOpenAICompatible`
|
|
142
|
+
- Custom gateways can access headers in their `resolveLanguageModel` implementation
|
|
143
|
+
|
|
144
|
+
Example usage:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// Works with OpenRouter
|
|
148
|
+
const agent = new Agent({
|
|
149
|
+
name: 'my-agent',
|
|
150
|
+
instructions: 'You are a helpful assistant.',
|
|
151
|
+
model: {
|
|
152
|
+
id: 'openrouter/anthropic/claude-3-5-sonnet',
|
|
153
|
+
headers: {
|
|
154
|
+
'HTTP-Referer': 'https://myapp.com',
|
|
155
|
+
'X-Title': 'My Application',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Also works with custom providers
|
|
161
|
+
const customAgent = new Agent({
|
|
162
|
+
name: 'custom-agent',
|
|
163
|
+
instructions: 'You are a helpful assistant.',
|
|
164
|
+
model: {
|
|
165
|
+
id: 'custom-provider/model',
|
|
166
|
+
url: 'https://api.custom.com/v1',
|
|
167
|
+
apiKey: 'key',
|
|
168
|
+
headers: {
|
|
169
|
+
'X-Custom-Header': 'custom-value',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Fixes https://github.com/mastra-ai/mastra/issues/9760
|
|
176
|
+
|
|
177
|
+
- fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
178
|
+
|
|
179
|
+
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.
|
|
180
|
+
|
|
181
|
+
**Backend changes (@mastra/core):**
|
|
182
|
+
- Add assistant messages to messageList immediately after LLM execution
|
|
183
|
+
- Flush messages synchronously before suspension to persist state
|
|
184
|
+
- Create thread if it doesn't exist before flushing
|
|
185
|
+
- Add metadata helpers to persist and remove tool approval state
|
|
186
|
+
- Pass saveQueueManager and memory context through workflow for immediate persistence
|
|
187
|
+
|
|
188
|
+
**Frontend changes (@mastra/react):**
|
|
189
|
+
- Extract runId from pending approvals to enable resumption after refresh
|
|
190
|
+
- Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
|
|
191
|
+
- Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
|
|
192
|
+
- Change runId from hardcoded `agentId` to unique `uuid()`
|
|
193
|
+
|
|
194
|
+
**UI changes (@mastra/playground-ui):**
|
|
195
|
+
- Handle tool calls awaiting approval in message initialization
|
|
196
|
+
- Convert approval metadata format when loading initial messages
|
|
197
|
+
|
|
198
|
+
Fixes #9745, #9906
|
|
199
|
+
|
|
200
|
+
- 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))
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
Add Gemini 3 Pro test coverage in agent-gemini.test.ts to validate the latest Gemini model integration.
|
|
205
|
+
|
|
206
|
+
- Fix race condition in parallel tool stream writes ([#10463](https://github.com/mastra-ai/mastra/pull/10463))
|
|
207
|
+
|
|
208
|
+
Introduces a write queue to ToolStream to serialize access to the underlying stream, preventing writer locked errors
|
|
209
|
+
|
|
210
|
+
- Remove unneeded console warning when flushing messages and no threadId or saveQueueManager is found. ([#10498](https://github.com/mastra-ai/mastra/pull/10498))
|
|
211
|
+
|
|
212
|
+
- Add optional includeRawChunks parameter to agent execution options, ([#10456](https://github.com/mastra-ai/mastra/pull/10456))
|
|
213
|
+
allowing users to include raw chunks in stream output where supported
|
|
214
|
+
by the model provider.
|
|
215
|
+
|
|
216
|
+
- 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))
|
|
217
|
+
|
|
218
|
+
The fix uses atomic writes via the write-to-temp-then-rename pattern. Instead of:
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
We now do:
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;
|
|
228
|
+
fs.writeFileSync(tempPath, content, 'utf-8');
|
|
229
|
+
fs.renameSync(tempPath, filePath); // atomic on POSIX
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
`fs.rename()` is atomic on POSIX systems when both paths are on the same filesystem, so concurrent writes will each complete fully rather than interleaving.
|
|
233
|
+
|
|
234
|
+
- Fix .map when placed at the beginning of a workflow or nested workflow ([#10457](https://github.com/mastra-ai/mastra/pull/10457))
|
|
235
|
+
|
|
236
|
+
- Ensures that data chunks written via `writer.custom()` always bubble up directly to the top-level stream, even when nested in sub-agents. This allows tools to emit custom progress updates, metrics, and other data that can be consumed at any level of the agent hierarchy. ([#10309](https://github.com/mastra-ai/mastra/pull/10309))
|
|
237
|
+
- **Added bubbling logic in sub-agent execution**: When sub-agents execute, data chunks (chunks with type starting with `data-`) are detected and written via `writer.custom()` instead of `writer.write()`, ensuring they bubble up directly without being wrapped in `tool-output` chunks.
|
|
238
|
+
- **Added comprehensive tests**:
|
|
239
|
+
- Test for `writer.custom()` with direct tool execution
|
|
240
|
+
- Test for `writer.custom()` with sub-agent tools (nested execution)
|
|
241
|
+
- Test for mixed usage of `writer.write()` and `writer.custom()` in the same tool
|
|
242
|
+
|
|
243
|
+
When a sub-agent's tool uses `writer.custom()` to write data chunks, those chunks appear in the sub-agent's stream. The parent agent's execution logic now detects these chunks and uses `writer.custom()` to bubble them up directly, preserving their structure and making them accessible at the top level.
|
|
244
|
+
|
|
245
|
+
This ensures that:
|
|
246
|
+
- Data chunks from tools always appear directly in the stream (not wrapped)
|
|
247
|
+
- Data chunks bubble up correctly through nested agent hierarchies
|
|
248
|
+
- Regular chunks continue to be wrapped in `tool-output` as expected
|
|
249
|
+
|
|
250
|
+
- Update agent workflow and sub-agent tool transformations to accept more input arguments. ([#10278](https://github.com/mastra-ai/mastra/pull/10278))
|
|
251
|
+
|
|
252
|
+
These tools now accept the following
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
workflowTool.execute({ inputData, initialState }, context)
|
|
256
|
+
|
|
257
|
+
agentTool.execute({ prompt, threadId, resourceId, instructions, maxSteps }, context)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Workflow tools now also properly return errors when the workflow run fails
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
const workflowResult = await workflowTool.execute({ inputData, initialState }, context)
|
|
264
|
+
|
|
265
|
+
console.log(workflowResult.error) // error msg if error
|
|
266
|
+
console.log(workflowResult.result) // result of the workflow if success
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Workflows passed to agents do not properly handle suspend/resume`, they only handle success or error.
|
|
270
|
+
|
|
271
|
+
- Fixed OpenAI schema compatibility when using `agent.generate()` or `agent.stream()` with `structuredOutput`. ([#10366](https://github.com/mastra-ai/mastra/pull/10366))
|
|
272
|
+
|
|
273
|
+
## Changes
|
|
274
|
+
- **Automatic transformation**: Zod schemas are now automatically transformed for OpenAI strict mode compatibility when using OpenAI models (including reasoning models like o1, o3, o4)
|
|
275
|
+
- **Optional field handling**: `.optional()` fields are converted to `.nullable()` with a transform that converts `null` → `undefined`, preserving optional semantics while satisfying OpenAI's strict mode requirements
|
|
276
|
+
- **Preserves nullable fields**: Intentionally `.nullable()` fields remain unchanged
|
|
277
|
+
- **Deep transformation**: Handles `.optional()` fields at any nesting level (objects, arrays, unions, etc.)
|
|
278
|
+
- **JSON Schema objects**: Not transformed, only Zod schemas
|
|
279
|
+
|
|
280
|
+
## Example
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
const agent = new Agent({
|
|
284
|
+
name: 'data-extractor',
|
|
285
|
+
model: { provider: 'openai', modelId: 'gpt-4o' },
|
|
286
|
+
instructions: 'Extract user information',
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const schema = z.object({
|
|
290
|
+
name: z.string(),
|
|
291
|
+
age: z.number().optional(),
|
|
292
|
+
deletedAt: z.date().nullable(),
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Schema is automatically transformed for OpenAI compatibility
|
|
296
|
+
const result = await agent.generate('Extract: John, deleted yesterday', {
|
|
297
|
+
structuredOutput: { schema },
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Result: { name: 'John', age: undefined, deletedAt: null }
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- Fix network data step formatting in AI SDK stream transformation ([#10432](https://github.com/mastra-ai/mastra/pull/10432))
|
|
304
|
+
|
|
305
|
+
Previously, network execution steps were not being tracked correctly in the AI SDK stream transformation. Steps were being duplicated rather than updated, and critical metadata like step IDs, iterations, and task information was missing or incorrectly structured.
|
|
306
|
+
|
|
307
|
+
**Changes:**
|
|
308
|
+
- Enhanced step tracking in `AgentNetworkToAISDKTransformer` to properly maintain step state throughout execution lifecycle
|
|
309
|
+
- Steps are now identified by unique IDs and updated in place rather than creating duplicates
|
|
310
|
+
- Added proper iteration and task metadata to each step in the network execution flow
|
|
311
|
+
- Fixed agent, workflow, and tool execution events to correctly populate step data
|
|
312
|
+
- Updated network stream event types to include `networkId`, `workflowId`, and consistent `runId` tracking
|
|
313
|
+
- Added test coverage for network custom data chunks with comprehensive validation
|
|
314
|
+
|
|
315
|
+
This ensures the AI SDK correctly represents the full execution flow of agent networks with accurate step sequencing and metadata.
|
|
316
|
+
|
|
317
|
+
- Fix generating provider-registry.json ([#10392](https://github.com/mastra-ai/mastra/pull/10392))
|
|
318
|
+
|
|
319
|
+
- Adds type inference for `mastra.get*ById` functions. Only those registered at the top level mastra instance will get inferred. MCP and tool id's do not get inferred yet, those need additional changes. ([#10199](https://github.com/mastra-ai/mastra/pull/10199))
|
|
320
|
+
|
|
321
|
+
- Fix working memory zod to json schema conversion to use schema-compat zodtoJsonSchema fn. ([#10391](https://github.com/mastra-ai/mastra/pull/10391))
|
|
322
|
+
|
|
323
|
+
- Fixes parallel tool call issue with Gemini 3 Pro by preventing step-start parts from being inserted between consecutive tool parts in the `addStartStepPartsForAIV5` function. This ensures that the AI SDK's `convertToModelMessages` correctly preserves the order of parallel tool calls and maintains the `thought_signature` on the first tool call as required by Gemini's API. ([#10372](https://github.com/mastra-ai/mastra/pull/10372))
|
|
324
|
+
|
|
325
|
+
- Updated dependencies [[`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013)]:
|
|
326
|
+
- @mastra/schema-compat@1.0.0-beta.1
|
|
327
|
+
|
|
328
|
+
## 1.0.0-beta.4
|
|
329
|
+
|
|
330
|
+
### Patch Changes
|
|
331
|
+
|
|
332
|
+
- Fix message list provider metadata handling and reasoning text optimization ([#10281](https://github.com/mastra-ai/mastra/pull/10281))
|
|
333
|
+
- Improved provider metadata preservation across message transformations
|
|
334
|
+
- Optimized reasoning text storage to avoid duplication (using `details` instead of `reasoning` field)
|
|
335
|
+
- Fixed test snapshots for timestamp precision and metadata handling
|
|
336
|
+
|
|
337
|
+
- Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
|
|
338
|
+
|
|
339
|
+
- Fix deprecation warning when agent network executes workflows by using `.fullStream` instead of iterating `WorkflowRunOutput` directly ([#10285](https://github.com/mastra-ai/mastra/pull/10285))
|
|
340
|
+
|
|
341
|
+
- Fix generate toolResults and mismatch in provider tool names ([#10282](https://github.com/mastra-ai/mastra/pull/10282))
|
|
342
|
+
|
|
343
|
+
- Support AI SDK voice models ([#10304](https://github.com/mastra-ai/mastra/pull/10304))
|
|
344
|
+
|
|
345
|
+
Mastra now supports AI SDK's transcription and speech models directly in `CompositeVoice`, enabling seamless integration with a wide range of voice providers through the AI SDK ecosystem. This allows you to use models from OpenAI, ElevenLabs, Groq, Deepgram, LMNT, Hume, and many more for both speech-to-text (transcription) and text-to-speech capabilities.
|
|
346
|
+
|
|
347
|
+
AI SDK models are automatically wrapped when passed to `CompositeVoice`, so you can mix and match AI SDK models with existing Mastra voice providers for maximum flexibility.
|
|
348
|
+
|
|
349
|
+
## Usage Example
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
import { CompositeVoice } from '@mastra/core/voice';
|
|
353
|
+
import { openai } from '@ai-sdk/openai';
|
|
354
|
+
import { elevenlabs } from '@ai-sdk/elevenlabs';
|
|
355
|
+
|
|
356
|
+
// Use AI SDK models directly with CompositeVoice
|
|
357
|
+
const voice = new CompositeVoice({
|
|
358
|
+
input: openai.transcription('whisper-1'), // AI SDK transcription model
|
|
359
|
+
output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech model
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
// Convert text to speech
|
|
363
|
+
const audioStream = await voice.speak('Hello from AI SDK!');
|
|
364
|
+
|
|
365
|
+
// Convert speech to text
|
|
366
|
+
const transcript = await voice.listen(audioStream);
|
|
367
|
+
console.log(transcript);
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Fixes #9947
|
|
371
|
+
|
|
3
372
|
## 1.0.0-beta.3
|
|
4
373
|
|
|
5
374
|
### Major Changes
|
|
@@ -129,174 +498,5 @@
|
|
|
129
498
|
For workflows whose schemas and step schemas you don't want validated, do this
|
|
130
499
|
|
|
131
500
|
```diff
|
|
132
|
-
createWorkflow({
|
|
133
|
-
+ options: {
|
|
134
|
-
+ validateInputs: false
|
|
135
|
-
+ }
|
|
136
|
-
})
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
- Fix inngest parallel workflow ([#10169](https://github.com/mastra-ai/mastra/pull/10169))
|
|
140
|
-
Fix tool as step in inngest
|
|
141
|
-
Fix inngest nested workflow
|
|
142
|
-
|
|
143
|
-
- Add timeTravel to workflows. This makes it possible to start a workflow run from a particular step in the workflow ([#9994](https://github.com/mastra-ai/mastra/pull/9994))
|
|
144
|
-
|
|
145
|
-
Example code:
|
|
146
|
-
|
|
147
|
-
```ts
|
|
148
|
-
const result = await run.timeTravel({
|
|
149
|
-
step: 'step2',
|
|
150
|
-
inputData: {
|
|
151
|
-
value: 'input',
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
- Fixes assets not being downloaded when available ([#10079](https://github.com/mastra-ai/mastra/pull/10079))
|
|
157
|
-
|
|
158
|
-
- Remove unused dependencies ([#10019](https://github.com/mastra-ai/mastra/pull/10019))
|
|
159
|
-
|
|
160
|
-
- Updated dependencies [[`a64d16a`](https://github.com/mastra-ai/mastra/commit/a64d16aedafe57ee5707bdcc25f96e07fa1a0233)]:
|
|
161
|
-
- @mastra/observability@1.0.0-beta.1
|
|
162
|
-
|
|
163
|
-
## 1.0.0-beta.2
|
|
164
|
-
|
|
165
|
-
### Patch Changes
|
|
166
|
-
|
|
167
|
-
- Make suspendPayload optional when calling `suspend()` ([#9926](https://github.com/mastra-ai/mastra/pull/9926))
|
|
168
|
-
Save value returned as `suspendOutput` if user returns data still after calling `suspend()`
|
|
169
|
-
Automatically call `commit()` on uncommitted workflows when registering in Mastra instance
|
|
170
|
-
Show actual suspendPayload on Studio in suspend/resume flow
|
|
171
|
-
|
|
172
|
-
## 1.0.0-beta.1
|
|
173
|
-
|
|
174
|
-
### Patch Changes
|
|
175
|
-
|
|
176
|
-
- Set correct peer dependency range for `@mastra/observability` ([#9908](https://github.com/mastra-ai/mastra/pull/9908))
|
|
177
|
-
|
|
178
|
-
- Add visual styles and labels for more workflow node types ([#9777](https://github.com/mastra-ai/mastra/pull/9777))
|
|
179
|
-
|
|
180
|
-
- `registerApiRoute` now accepts a `requiresAuth` option, so custom endpoints can opt in/out of Mastra auth without mutating the returned route object.
|
|
181
|
-
|
|
182
|
-
## 1.0.0-beta.0
|
|
183
|
-
|
|
184
|
-
### Major Changes
|
|
185
|
-
|
|
186
|
-
- Moving scorers under the eval domain, api method consistency, prebuilt evals, scorers require ids. ([#9589](https://github.com/mastra-ai/mastra/pull/9589))
|
|
187
|
-
|
|
188
|
-
- **BREAKING CHANGE**: Scorers for Agents will now use `MastraDBMessage` instead of `UIMessage` ([#9702](https://github.com/mastra-ai/mastra/pull/9702))
|
|
189
|
-
- Scorer input/output types now use `MastraDBMessage[]` with nested `content` object structure
|
|
190
|
-
- Added `getTextContentFromMastraDBMessage()` helper function to extract text content from `MastraDBMessage` objects
|
|
191
|
-
- Added `createTestMessage()` helper function for creating `MastraDBMessage` objects in tests with optional tool invocations support
|
|
192
|
-
- Updated `extractToolCalls()` to access tool invocations from nested `content` structure
|
|
193
|
-
- Updated `getUserMessageFromRunInput()` and `getAssistantMessageFromRunOutput()` to use new message structure
|
|
194
|
-
- Removed `createUIMessage()`
|
|
195
|
-
|
|
196
|
-
- Every Mastra primitive (agent, MCPServer, workflow, tool, processor, scorer, and vector) now has a get, list, and add method associated with it. Each primitive also now requires an id to be set. ([#9675](https://github.com/mastra-ai/mastra/pull/9675))
|
|
197
|
-
|
|
198
|
-
Primitives that are added to other primitives are also automatically added to the Mastra instance
|
|
199
|
-
|
|
200
|
-
- Update handlers to use `listWorkflowRuns` instead of `getWorkflowRuns`. Fix type names from `StoragelistThreadsByResourceIdInput/Output` to `StorageListThreadsByResourceIdInput/Output`. ([#9507](https://github.com/mastra-ai/mastra/pull/9507))
|
|
201
|
-
|
|
202
|
-
- **BREAKING:** Remove `getMessagesPaginated()` and add `perPage: false` support ([#9670](https://github.com/mastra-ai/mastra/pull/9670))
|
|
203
|
-
|
|
204
|
-
Removes deprecated `getMessagesPaginated()` method. The `listMessages()` API and score handlers now support `perPage: false` to fetch all records without pagination limits.
|
|
205
|
-
|
|
206
|
-
**Storage changes:**
|
|
207
|
-
- `StoragePagination.perPage` type changed from `number` to `number | false`
|
|
208
|
-
- All storage implementations support `perPage: false`:
|
|
209
|
-
- Memory: `listMessages()`
|
|
210
|
-
- Scores: `listScoresBySpan()`, `listScoresByRunId()`, `listScoresByExecutionId()`
|
|
211
|
-
- HTTP query parser accepts `"false"` string (e.g., `?perPage=false`)
|
|
212
|
-
|
|
213
|
-
**Memory changes:**
|
|
214
|
-
- `memory.query()` parameter type changed from `StorageGetMessagesArg` to `StorageListMessagesInput`
|
|
215
|
-
- Uses flat parameters (`page`, `perPage`, `include`, `filter`, `vectorSearchString`) instead of `selectBy` object
|
|
216
|
-
|
|
217
|
-
**Stricter validation:**
|
|
218
|
-
- `listMessages()` requires non-empty, non-whitespace `threadId` (throws error instead of returning empty results)
|
|
219
|
-
|
|
220
|
-
**Migration:**
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
// Storage/Memory: Replace getMessagesPaginated with listMessages
|
|
224
|
-
- storage.getMessagesPaginated({ threadId, selectBy: { pagination: { page: 0, perPage: 20 } } })
|
|
225
|
-
+ storage.listMessages({ threadId, page: 0, perPage: 20 })
|
|
226
|
-
+ storage.listMessages({ threadId, page: 0, perPage: false }) // Fetch all
|
|
227
|
-
|
|
228
|
-
// Memory: Replace selectBy with flat parameters
|
|
229
|
-
- memory.query({ threadId, selectBy: { last: 20, include: [...] } })
|
|
230
|
-
+ memory.query({ threadId, perPage: 20, include: [...] })
|
|
231
|
-
|
|
232
|
-
// Client SDK
|
|
233
|
-
- thread.getMessagesPaginated({ selectBy: { pagination: { page: 0 } } })
|
|
234
|
-
+ thread.listMessages({ page: 0, perPage: 20 })
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
- # Major Changes ([#9695](https://github.com/mastra-ai/mastra/pull/9695))
|
|
238
|
-
|
|
239
|
-
## Storage Layer
|
|
240
|
-
|
|
241
|
-
### BREAKING: Removed `storage.getMessages()`
|
|
242
|
-
|
|
243
|
-
The `getMessages()` method has been removed from all storage implementations. Use `listMessages()` instead, which provides pagination support.
|
|
244
|
-
|
|
245
|
-
**Migration:**
|
|
246
|
-
|
|
247
|
-
```typescript
|
|
248
|
-
// Before
|
|
249
|
-
const messages = await storage.getMessages({ threadId: 'thread-1' });
|
|
250
|
-
|
|
251
|
-
// After
|
|
252
|
-
const result = await storage.listMessages({
|
|
253
|
-
threadId: 'thread-1',
|
|
254
|
-
page: 0,
|
|
255
|
-
perPage: 50,
|
|
256
|
-
});
|
|
257
|
-
const messages = result.messages; // Access messages array
|
|
258
|
-
console.log(result.total); // Total count
|
|
259
|
-
console.log(result.hasMore); // Whether more pages exist
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Message ordering default
|
|
263
|
-
|
|
264
|
-
`listMessages()` defaults to ASC (oldest first) ordering by `createdAt`, matching the previous `getMessages()` behavior.
|
|
265
|
-
|
|
266
|
-
**To use DESC ordering (newest first):**
|
|
267
|
-
|
|
268
|
-
```typescript
|
|
269
|
-
const result = await storage.listMessages({
|
|
270
|
-
threadId: 'thread-1',
|
|
271
|
-
orderBy: { field: 'createdAt', direction: 'DESC' },
|
|
272
|
-
});
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Client SDK
|
|
276
|
-
|
|
277
|
-
### BREAKING: Renamed `client.getThreadMessages()` → `client.listThreadMessages()`
|
|
278
|
-
|
|
279
|
-
**Migration:**
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
// Before
|
|
283
|
-
const response = await client.getThreadMessages(threadId, { agentId });
|
|
284
|
-
|
|
285
|
-
// After
|
|
286
|
-
const response = await client.listThreadMessages(threadId, { agentId });
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
The response format remains the same.
|
|
290
|
-
|
|
291
|
-
## Type Changes
|
|
292
|
-
|
|
293
|
-
### BREAKING: Removed `StorageGetMessagesArg` type
|
|
294
|
-
|
|
295
|
-
Use `StorageListMessagesInput` instead:
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
// Before
|
|
299
|
-
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
300
|
-
|
|
301
501
|
|
|
302
|
-
...
|
|
502
|
+
... 5468 more lines hidden. See full changelog in package directory.
|