@mastra/mcp-docs-server 0.13.29-alpha.1 → 0.13.30-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
  3. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +23 -23
  5. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +21 -0
  6. package/.docs/organized/changelogs/%40mastra%2Fastra.md +16 -16
  7. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +16 -16
  8. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +16 -16
  9. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +21 -21
  10. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +16 -16
  11. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +16 -16
  12. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +16 -16
  13. package/.docs/organized/changelogs/%40mastra%2Fcore.md +78 -78
  14. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +16 -16
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +29 -29
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +25 -25
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +25 -25
  18. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +25 -25
  19. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +34 -34
  20. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +16 -16
  21. package/.docs/organized/changelogs/%40mastra%2Fevals.md +33 -33
  22. package/.docs/organized/changelogs/%40mastra%2Flance.md +16 -16
  23. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +16 -16
  24. package/.docs/organized/changelogs/%40mastra%2Floggers.md +16 -16
  25. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +16 -16
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +16 -16
  27. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +16 -16
  28. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +22 -22
  29. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +16 -16
  30. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +16 -16
  31. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +17 -17
  32. package/.docs/organized/changelogs/%40mastra%2Fpg.md +17 -17
  33. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +16 -16
  34. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +46 -46
  35. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
  36. package/.docs/organized/changelogs/%40mastra%2Frag.md +16 -16
  37. package/.docs/organized/changelogs/%40mastra%2Freact.md +24 -0
  38. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +15 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fserver.md +30 -30
  40. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +16 -16
  41. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +19 -19
  42. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +17 -17
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +18 -18
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +16 -16
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +16 -16
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +16 -16
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +16 -16
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +15 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +16 -16
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +16 -16
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +16 -16
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +16 -16
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +16 -16
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +16 -16
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +16 -16
  56. package/.docs/organized/changelogs/create-mastra.md +17 -17
  57. package/.docs/organized/changelogs/mastra.md +37 -37
  58. package/.docs/organized/code-examples/agent.md +26 -6
  59. package/.docs/organized/code-examples/agui.md +2 -2
  60. package/.docs/organized/code-examples/ai-elements.md +1 -1
  61. package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
  62. package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
  63. package/.docs/organized/code-examples/assistant-ui.md +2 -2
  64. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
  65. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +2 -2
  66. package/.docs/organized/code-examples/client-side-tools.md +2 -2
  67. package/.docs/organized/code-examples/crypto-chatbot.md +2 -2
  68. package/.docs/organized/code-examples/heads-up-game.md +2 -2
  69. package/.docs/organized/code-examples/openapi-spec-writer.md +2 -2
  70. package/.docs/raw/agents/networks.mdx +12 -6
  71. package/.docs/raw/agents/overview.mdx +7 -4
  72. package/.docs/raw/agents/runtime-context.mdx +3 -0
  73. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +6 -3
  74. package/.docs/raw/getting-started/installation.mdx +0 -47
  75. package/.docs/raw/reference/agents/generateLegacy.mdx +4 -4
  76. package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +9 -5
  77. package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +4 -4
  78. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +49 -0
  79. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +47 -0
  80. package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +7 -5
  81. package/.docs/raw/reference/streaming/workflows/stream.mdx +1 -1
  82. package/.docs/raw/streaming/workflow-streaming.mdx +23 -0
  83. package/CHANGELOG.md +15 -0
  84. package/package.json +6 -6
  85. package/.docs/raw/reference/agents/migration-guide.mdx +0 -291
@@ -21,10 +21,6 @@ Mastra also supports other LLM providers. For a full list of supported models an
21
21
 
22
22
  Our CLI is the fastest way to get started with Mastra. You can run `create mastra` anywhere on your machine.
23
23
 
24
- <Callout type="warning">
25
- The CLI currently generates projects that are only compatible with `ai-sdk v4`. Please refer to [ai-sdk v5 compatibility](#ai-sdk-v5-compatibility) if you wish to use `ai-sdk v5`.
26
- </Callout>
27
-
28
24
  <Steps>
29
25
 
30
26
  ## Start the CLI wizard
@@ -372,49 +368,6 @@ To install Mastra in an existing project, use the `mastra init` command.
372
368
 
373
369
  > See [mastra init](/reference/cli/init) for more information.
374
370
 
375
- ## ai-sdk v5 compatibility
376
-
377
- By default, Mastra projects are only compatible with `ai-sdk v4`, if you wish to use `ai-sdk v5`, please make the following changes to the generated project.
378
-
379
- Install the latest version to the `@ai-sdk/openai` package:
380
- <Tabs items={["npm", "pnpm", "yarn", "bun"]}>
381
-
382
- <Tab>
383
- ```bash copy
384
- npm install @ai-sdk/openai@latest
385
- ```
386
-
387
- </Tab>
388
- <Tab>
389
- ```bash copy
390
- pnpm add @ai-sdk/openai@latest
391
- ```
392
-
393
- </Tab>
394
- <Tab>
395
- ```bash copy
396
- yarn add @ai-sdk/openai@latest
397
- ```
398
-
399
- </Tab>
400
- <Tab>
401
- ```bash copy
402
- bun add @ai-sdk/openai@latest
403
- ```
404
-
405
- </Tab>
406
- </Tabs>
407
-
408
- Update the `planActivities` step in `src/mastra/workflows/weather-workflow.ts` as follows:
409
- ```ts filename="src/mastra/workflows/weather-workflow.ts" showLineNumbers{150} copy
410
- const response = await agent.stream([
411
- {
412
- role: 'user',
413
- content: prompt,
414
- },
415
- ]);
416
- ```
417
-
418
371
  ## Next steps
419
372
 
420
373
  - [Local Development](/docs/server-db/local-dev-playground)
@@ -8,7 +8,7 @@ import { Callout } from 'nextra/components';
8
8
  # Agent.generateLegacy() (Legacy)
9
9
 
10
10
  <Callout type="warning">
11
- **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.generate()`](./generate.mdx) method instead. See the [migration guide](./migration-guide.mdx) for details on upgrading.
11
+ **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.generate()`](./generate.mdx) method instead. See the [migration guide](../../guides/migrations/vnext-to-standard-apis) for details on upgrading.
12
12
  </Callout>
13
13
 
14
14
  The `.generateLegacy()` method is the legacy version of the agent generation API, used to interact with V1 model agents to produce text or structured responses. This method accepts messages and optional generation options.
@@ -442,7 +442,7 @@ await agent.generateLegacy("message for agent");
442
442
  ## Migration to New API
443
443
 
444
444
  <Callout type="info">
445
- The new `.generate()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved streaming support. See the [migration guide](./migration-guide.mdx) for detailed migration instructions.
445
+ The new `.generate()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved streaming support. See the [migration guide](../../guides/migrations/vnext-to-standard-apis) for detailed migration instructions.
446
446
  </Callout>
447
447
 
448
448
  ### Quick Migration Example
@@ -522,7 +522,7 @@ await agent.generateLegacy(
522
522
 
523
523
  ## Related
524
524
 
525
- - [Migration Guide](./migration-guide.mdx)
525
+ - [Migration Guide](../../guides/migrations/vnext-to-standard-apis)
526
526
  - [New .generate() method](./generate.mdx)
527
527
  - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
528
- - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
528
+ - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
@@ -218,11 +218,14 @@ console.log(fullText);
218
218
 
219
219
  ```typescript
220
220
  const stream = await agent.stream("Generate user data", {
221
- output: z.object({
222
- name: z.string(),
223
- age: z.number(),
224
- email: z.string()
225
- })
221
+ structuredOutput: {
222
+ schema: z.object({
223
+ name: z.string(),
224
+ age: z.number(),
225
+ email: z.string()
226
+ })
227
+ },
228
+ maxSteps: 1
226
229
  });
227
230
 
228
231
  // Stream partial objects
@@ -234,6 +237,7 @@ for await (const partial of stream.objectStream) {
234
237
  const user = await stream.object;
235
238
  console.log("Final:", user); // { name: "John", age: 30, email: "john@example.com" }
236
239
  ```
240
+ ```
237
241
 
238
242
  ### Tool Calls and Results
239
243
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Reference: Agent.streamLegacy() (Legacy) | Agents | Mastra Docs"
2
+ title: "Reference: Agent.streamLegacy() (Legacy) | Agents | Mastra Docs"
3
3
  description: "Documentation for the legacy `Agent.streamLegacy()` method in Mastra agents. This method is deprecated and will be removed in a future version."
4
4
  ---
5
5
 
@@ -8,7 +8,7 @@ import { Callout } from 'nextra/components';
8
8
  # Agent.streamLegacy() (Legacy)
9
9
 
10
10
  <Callout type="warning">
11
- **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.stream()`](./stream.mdx) method instead. See the [migration guide](../../agents/migration-guide.mdx) for details on upgrading.
11
+ **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.stream()`](./stream.mdx) method instead. See the [migration guide](../../../guides/migrations/vnext-to-standard-apis) for details on upgrading.
12
12
  </Callout>
13
13
 
14
14
  The `.streamLegacy()` method is the legacy version of the agent streaming API, used for real-time streaming of responses from V1 model agents. This method accepts messages and optional streaming options.
@@ -482,7 +482,7 @@ await agent.streamLegacy("message for agent", {
482
482
  ## Migration to New API
483
483
 
484
484
  <Callout type="info">
485
- The new `.stream()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved callback system. See the [migration guide](../../agents/migration-guide.mdx) for detailed migration instructions.
485
+ The new `.stream()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved callback system. See the [migration guide](../../../guides/migrations/vnext-to-standard-apis) for detailed migration instructions.
486
486
  </Callout>
487
487
 
488
488
  ### Quick Migration Example
@@ -509,7 +509,7 @@ const result = await agent.stream("message", {
509
509
 
510
510
  ## Related
511
511
 
512
- - [Migration Guide](../../agents/migration-guide.mdx)
512
+ - [Migration Guide](../../../guides/migrations/vnext-to-standard-apis)
513
513
  - [New .stream() method](./stream.mdx)
514
514
  - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
515
515
  - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
@@ -0,0 +1,49 @@
1
+ ---
2
+ title: "Reference: Run.observeStream() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Run.observeStream()` method in workflows, which enables reopening the stream of an already active workflow run.
4
+ ---
5
+
6
+ # Run.observeStream()
7
+
8
+ The `.observeStream()` method opens a new `ReadableStream` to a workflow run that is currently running, allowing you to observe the stream of events if the original stream is no longer available.
9
+
10
+ ## Usage example
11
+
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRunAsync();
14
+
15
+ run.stream({
16
+ inputData: {
17
+ value: "initial data",
18
+ },
19
+ });
20
+
21
+ const { stream } = await run.observeStream();
22
+
23
+ for await (const chunk of stream) {
24
+ console.log(chunk);
25
+ }
26
+ ```
27
+
28
+ ## Returns
29
+
30
+ `ReadableStream<ChunkType>`
31
+
32
+ ## Stream Events
33
+
34
+ The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
35
+
36
+ - **`start`**: Workflow execution begins
37
+ - **`step-start`**: A step begins execution
38
+ - **`tool-call`**: A tool call is initiated
39
+ - **`tool-call-streaming-start`**: Tool call streaming begins
40
+ - **`tool-call-delta`**: Incremental tool output updates
41
+ - **`step-result`**: A step completes with results
42
+ - **`step-finish`**: A step finishes execution
43
+ - **`finish`**: Workflow execution completes
44
+
45
+ ## Related
46
+
47
+ - [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
48
+ - [Workflow.createRunAsync()](../../../reference/workflows/workflow-methods/create-run.mdx)
49
+ - [Run.stream()](./stream.mdx)
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: "Reference: Run.observeStreamVNext() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Run.observeStreamVNext()` method in workflows, which enables reopening the stream of an already active workflow run.
4
+ ---
5
+
6
+ # Run.observeStreamVNext() (Experimental)
7
+
8
+ The `.observeStreamVNext()` method opens a new `ReadableStream` to a workflow run that is currently running, allowing you to observe the stream of events if the original stream is no longer available.
9
+
10
+ ## Usage example
11
+
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRunAsync();
14
+
15
+ run.streamVNext({
16
+ inputData: {
17
+ value: "initial data",
18
+ },
19
+ });
20
+
21
+ const stream = await run.observeStreamVNext();
22
+
23
+ for await (const chunk of stream) {
24
+ console.log(chunk);
25
+ }
26
+ ```
27
+
28
+ ## Returns
29
+
30
+ `ReadableStream<ChunkType>`
31
+
32
+ ## Stream Events
33
+
34
+ The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
35
+
36
+ - **`workflow-start`**: Workflow execution begins
37
+ - **`workflow-step-start`**: A step begins execution
38
+ - **`workflow-step-output`**: Custom output from a step
39
+ - **`workflow-step-result`**: A step completes with results
40
+ - **`workflow-finish`**: Workflow execution completes with usage statistics
41
+
42
+ ## Related
43
+
44
+ - [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
45
+ - [Workflow.createRunAsync()](../../../reference/workflows/workflow-methods/create-run.mdx)
46
+ - [Run.streamVNext()](./streamVNext.mdx)
47
+ - [Run.resumeStreamVNext()](./resumeStreamVNext.mdx)
@@ -18,15 +18,17 @@ const run = await workflow.createRunAsync();
18
18
 
19
19
  const stream = run.streamVNext({
20
20
  inputData: {
21
- value: "initial data",
22
- },
21
+ value: "initial data"
22
+ }
23
23
  });
24
24
 
25
-
26
25
  const result = await stream.result;
27
- if (result.status === "suspended") {
26
+
27
+ if (result!.status === "suspended") {
28
28
  const resumedStream = await run.resumeStreamVNext({
29
- resumeData: { value: "resume data" }
29
+ resumeData: {
30
+ value: "resume data"
31
+ }
30
32
  });
31
33
  }
32
34
  ```
@@ -12,7 +12,7 @@ The `.stream()` method allows you to monitor the execution of a workflow run, pr
12
12
  ```typescript showLineNumbers copy
13
13
  const run = await workflow.createRunAsync();
14
14
 
15
- const stream = await run.stream({
15
+ const { stream } = await run.stream({
16
16
  inputData: {
17
17
  value: "initial data",
18
18
  },
@@ -69,6 +69,29 @@ const stream = await run.stream({
69
69
  for await (const chunk of stream) {
70
70
  console.log(chunk);
71
71
  }
72
+
73
+ if (result!.status === "suspended") {
74
+ // if the workflow is suspended, we can resume it with the resumeStreamVNext method
75
+ const resumedStream = await run.resumeStreamVNext({
76
+ resumeData: { value: "resume data" }
77
+ });
78
+
79
+ for await (const chunk of resumedStream) {
80
+ console.log(chunk);
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Resuming an interrupted workflow stream
86
+
87
+ If a workflow stream is closed or interrupted for any reason, you can resume it with the `resumeStreamVNext` method. This will return a new `ReadableStream` that you can use to observe the workflow events.
88
+
89
+ ```typescript showLineNumbers copy
90
+ const newStream = await run.resumeStreamVNext();
91
+
92
+ for await (const chunk of newStream) {
93
+ console.log(chunk);
94
+ }
72
95
  ```
73
96
 
74
97
  ## Workflow using an agent
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.30-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`2ddb851`](https://github.com/mastra-ai/mastra/commit/2ddb8519c4b6f1d31be10ffd33b41d2b649a04ff), [`7b1ef57`](https://github.com/mastra-ai/mastra/commit/7b1ef57fc071c2aa2a2e32905b18cd88719c5a39), [`228228b`](https://github.com/mastra-ai/mastra/commit/228228b0b1de9291cb8887587f5cea1a8757ebad), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`ee68e82`](https://github.com/mastra-ai/mastra/commit/ee68e8289ea4408d29849e899bc6e78b3bd4e843), [`228228b`](https://github.com/mastra-ai/mastra/commit/228228b0b1de9291cb8887587f5cea1a8757ebad), [`ea33930`](https://github.com/mastra-ai/mastra/commit/ea339301e82d6318257720d811b043014ee44064), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`7b1ef57`](https://github.com/mastra-ai/mastra/commit/7b1ef57fc071c2aa2a2e32905b18cd88719c5a39), [`135d6f2`](https://github.com/mastra-ai/mastra/commit/135d6f22a326ed1dffff858700669dff09d2c9eb), [`59d036d`](https://github.com/mastra-ai/mastra/commit/59d036d4c2706b430b0e3f1f1e0ee853ce16ca04)]:
8
+ - @mastra/core@0.21.0-alpha.0
9
+ - @mastra/mcp@0.13.5-alpha.0
10
+
11
+ ## 0.13.29
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`07eaf25`](https://github.com/mastra-ai/mastra/commit/07eaf25aada9e42235dbf905854de53da4d8121b), [`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372), [`68b1111`](https://github.com/mastra-ai/mastra/commit/68b11118a1303f93e9c0c157850c0751309304c5)]:
16
+ - @mastra/core@0.20.2
17
+
3
18
  ## 0.13.29-alpha.1
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.29-alpha.1",
3
+ "version": "0.13.30-alpha.0",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,8 +33,8 @@
33
33
  "uuid": "^11.1.0",
34
34
  "zod": "^3.25.76",
35
35
  "zod-to-json-schema": "^3.24.6",
36
- "@mastra/core": "0.20.2-alpha.1",
37
- "@mastra/mcp": "^0.13.4"
36
+ "@mastra/core": "0.21.0-alpha.0",
37
+ "@mastra/mcp": "^0.13.5-alpha.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hono/node-server": "^1.19.5",
@@ -43,14 +43,14 @@
43
43
  "@types/turndown": "^5.0.5",
44
44
  "@wong2/mcp-cli": "^1.10.0",
45
45
  "cross-env": "^7.0.3",
46
- "eslint": "^9.35.0",
46
+ "eslint": "^9.36.0",
47
47
  "hono": "^4.9.7",
48
48
  "tsup": "^8.5.0",
49
49
  "tsx": "^4.19.4",
50
50
  "typescript": "^5.8.3",
51
51
  "vitest": "^3.2.4",
52
- "@internal/lint": "0.0.47",
53
- "@mastra/core": "0.20.2-alpha.1"
52
+ "@internal/lint": "0.0.48",
53
+ "@mastra/core": "0.21.0-alpha.0"
54
54
  },
55
55
  "homepage": "https://mastra.ai",
56
56
  "repository": {
@@ -1,291 +0,0 @@
1
- # Migration Guide: VNext to Standard APIs
2
-
3
- ## Overview
4
-
5
- As of `v 0.20.00`, the `streamVNext()` and `generateVNext()` methods in Mastra agents have been renamed to `stream()` and `generate()` respectively. These are now the standard APIs with full AI SDK v5 compatibility. The original `stream()` and `generate()` methods have been renamed to `streamLegacy()` and `generateLegacy()` to maintain backward compatibility with AI SDK v4.
6
-
7
- ### Continue using AI SDK v4 models
8
- - Rename all your `stream()` and `generate()` calls to `streamLegacy()` and `generateLegacy()` respectively. No other change is needed.
9
-
10
- ### Continue using AI SDK v5 models
11
- - Rename all your `streamVNext()` and `generateVNext()` calls to `stream()` and `generate()` respectively. No other change is needed.
12
-
13
- ### Upgrade from AI SDK v4 models to v5 models
14
-
15
- First bump all your model provider packages by a major version. This will ensure that they are all v5 models now. Follow the guide below to understand the differences.
16
-
17
- ## Key Differences
18
-
19
- ### 1. Model version support
20
-
21
- - **Legacy APIs (`generateLegacy`, `streamLegacy`)**: Only support AI SDK v4 models (specificationVersion: 'v1')
22
- - **Current APIs (`generate`, `stream`)**: Only support AI SDK v5 models (specificationVersion: 'v2')
23
- - This is enforced at runtime with clear error messages
24
-
25
- ### 2. Return types
26
-
27
- #### Legacy methods return AI SDK v4 types
28
-
29
- - **`generateLegacy()`**:
30
- - `GenerateTextResult` or `GenerateObjectResult`
31
-
32
- - **`streamLegacy()`**:
33
- - `StreamTextResult` or `StreamObjectResult`
34
-
35
- #### New stream methods return Mastra/AI SDK v5 types
36
-
37
- - **`generate()`**:
38
- - When `format: 'mastra'` (default): Returns `MastraModelOutput.getFullOutput()` result
39
- - When `format: 'aisdk'`: Returns `AISDKV5OutputStream.getFullOutput()` result (AI SDK v5 compatible)
40
- - Internally calls `stream()` and awaits `getFullOutput()`
41
-
42
- - **`stream()`**:
43
- - When `format: 'mastra'` (default): Returns `MastraModelOutput<OUTPUT>`
44
- - When `format: 'aisdk'`: Returns `AISDKV5OutputStream<OUTPUT>` (AI SDK v5 compatible)
45
-
46
- #### Format Control
47
-
48
- - **Legacy**: No format control, always returns AI SDK v4 types
49
- - **New stream**: Can choose format via `format` option ('mastra' or 'aisdk')
50
-
51
- ```typescript
52
- // Mastra native format (default)
53
- const result = await agent.stream(messages, {
54
- format: 'mastra'
55
- });
56
-
57
- // AI SDK v5 compatibility
58
- const result = await agent.stream(messages, {
59
- format: 'aisdk'
60
- });
61
- ```
62
-
63
- ### 3. New Options in Non-Legacy APIs
64
-
65
- The following options are available in `stream()` and `generate()` but NOT in their legacy counterparts:
66
-
67
- 1. **`format`** - Choose between 'mastra' or 'aisdk' output format
68
-
69
- ```typescript
70
- const result = await agent.stream(messages, {
71
- format: 'aisdk' // or 'mastra' (default)
72
- });
73
- ```
74
-
75
- 2. **`system`** - Custom system message (separate from instructions)
76
-
77
- ```typescript
78
- const result = await agent.stream(messages, {
79
- system: 'You are a helpful assistant'
80
- });
81
- ```
82
-
83
- 3. **`structuredOutput`** - Enhanced structured output with model override and custom options
84
-
85
- - If no model is added it will use the agent's default model.
86
- - Error strategy when the object does not conform to the schema is `warn` (log a warning), `error` (throw an error), or `fallback` (return a default fallback value of your choice).
87
-
88
- ```typescript
89
- const result = await agent.generate(messages, {
90
- structuredOutput: {
91
- schema: z.object({
92
- name: z.string(),
93
- age: z.number()
94
- }),
95
- model: openai('gpt-4o-mini'), // Optional model override for structuring
96
- errorStrategy: 'fallback',
97
- fallbackValue: { name: 'unknown', age: 0 },
98
- instructions: 'Extract user information' // Override default structuring instructions
99
- }
100
- });
101
- ```
102
-
103
- 4. **`stopWhen`** - Flexible stop conditions (step count, token limit, etc.)
104
-
105
- ```typescript
106
- const result = await agent.stream(messages, {
107
- stopWhen: ({ steps, totalTokens }) => steps >= 5 || totalTokens >= 10000
108
- });
109
- ```
110
-
111
- 5. **`providerOptions`** - Provider-specific options (e.g., OpenAI-specific settings)
112
-
113
- ```typescript
114
- const result = await agent.stream(messages, {
115
- providerOptions: {
116
- openai: {
117
- store: true,
118
- metadata: { userId: '123' }
119
- }
120
- }
121
- });
122
- ```
123
-
124
- 6. **`onChunk`** - Callback for each streaming chunk
125
-
126
- ```typescript
127
- const result = await agent.stream(messages, {
128
- onChunk: (chunk) => {
129
- console.log('Received chunk:', chunk);
130
- }
131
- });
132
- ```
133
-
134
- 7. **`onError`** - Error callback
135
-
136
- ```typescript
137
- const result = await agent.stream(messages, {
138
- onError: (error) => {
139
- console.error('Stream error:', error);
140
- }
141
- });
142
- ```
143
-
144
- 8. **`onAbort`** - Abort callback
145
-
146
- ```typescript
147
- const result = await agent.stream(messages, {
148
- onAbort: () => {
149
- console.log('Stream aborted');
150
- }
151
- });
152
- ```
153
-
154
- 9. **`activeTools`** - Specify which tools are active for this execution
155
-
156
- ```typescript
157
- const result = await agent.stream(messages, {
158
- activeTools: ['search', 'calculator'] // Only these tools will be available
159
- });
160
- ```
161
-
162
- 10. **`abortSignal`** - AbortSignal for cancellation
163
-
164
- ```typescript
165
- const controller = new AbortController();
166
- const result = await agent.stream(messages, {
167
- abortSignal: controller.signal
168
- });
169
-
170
- // Later: controller.abort();
171
- ```
172
-
173
- 11. **`prepareStep`** - Callback before each step in multi-step execution
174
-
175
- ```typescript
176
- const result = await agent.stream(messages, {
177
- prepareStep: ({ step, state }) => {
178
- console.log('About to execute step:', step);
179
- return { /* modified state */ };
180
- }
181
- });
182
- ```
183
-
184
- 12. **`requireToolApproval`** - Require approval for all tool calls
185
-
186
- ```typescript
187
- const result = await agent.stream(messages, {
188
- requireToolApproval: true
189
- });
190
- ```
191
-
192
- ### 4. Options That Still Exist But Have Been Moved
193
-
194
- #### `temperature` and Other Model Settings
195
-
196
- Unified in `modelSettings`
197
-
198
- ```typescript
199
- const result = await agent.stream(messages, {
200
- modelSettings: {
201
- temperature: 0.7,
202
- maxTokens: 1000,
203
- topP: 0.9
204
- }
205
- });
206
- ```
207
-
208
- #### `resourceId` and `threadId`
209
-
210
- Moved to memory object.
211
-
212
- ```typescript
213
- const result = await agent.stream(messages, {
214
- memory: {
215
- resource: 'user-123',
216
- thread: 'thread-456'
217
- }
218
- });
219
- ```
220
-
221
- ### 5. Options That Are Deprecated or Removed
222
-
223
- #### `experimental_output`
224
-
225
- Use `structuredOutput` instead to allow for tool calls and an object return.
226
-
227
- ```typescript
228
- const result = await agent.generate(messages, {
229
- structuredOutput: {
230
- schema: z.object({
231
- summary: z.string()
232
- })
233
- }
234
- });
235
- ```
236
-
237
- #### `output`
238
-
239
- The `output` property is deprecated in favor of `structuredOutput`, to achieve the same results use maxSteps 1 with `structuredOutput`.
240
-
241
- ```typescript
242
- const result = await agent.generate(messages, {
243
- structuredOutput: {
244
- schema: {
245
- z.object({
246
- name: z.string()
247
- })
248
- }
249
- },
250
- maxSteps: 1
251
- });
252
- ```
253
-
254
- #### `memoryOptions` was removed
255
-
256
- Use `memory` instead
257
- ```typescript
258
- const result = await agent.generate(messages, {
259
- memory: {
260
- ...
261
- }
262
- });
263
- ```
264
-
265
- ### 6. Type Changes
266
-
267
- #### `context`
268
-
269
- - **Legacy**: `CoreMessage[]`
270
- - **New format**: `ModelMessage[]`
271
-
272
- #### `toolChoice` uses the AI SDK v5 `ToolChoice` type
273
-
274
- ```typescript
275
- type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' | 'none' | 'required' | {
276
- type: 'tool';
277
- toolName: Extract<keyof TOOLS, string>;
278
- };
279
- ```
280
-
281
-
282
- ## Migration Checklist
283
-
284
- ### If you're already using `streamVNext` and `generateVNext`
285
-
286
- Just find/replace the methods to `stream` and `generate` respectively.
287
-
288
- ### If you're using the old `stream` and `generate`
289
-
290
- Decide whether you want to upgrade or not. If you don't, just find/replace to `streamLegacy` and `generateLegacy`.
291
-