@mastra/mcp-docs-server 1.0.0-beta.25 → 1.0.0-beta.26

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 (35) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fplayground.md +10 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +59 -59
  3. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +34 -34
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +34 -34
  6. package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +6 -0
  7. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +42 -42
  8. package/.docs/organized/changelogs/%40mastra%2Fcore.md +35 -35
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +9 -9
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +9 -9
  11. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +34 -34
  12. package/.docs/organized/changelogs/%40mastra%2Flance.md +34 -34
  13. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +59 -59
  14. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
  15. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +59 -59
  16. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +59 -59
  17. package/.docs/organized/changelogs/%40mastra%2Fpg.md +59 -59
  18. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +13 -13
  19. package/.docs/organized/changelogs/%40mastra%2Freact.md +11 -11
  20. package/.docs/organized/changelogs/%40mastra%2Fserver.md +10 -10
  21. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +34 -34
  22. package/.docs/organized/changelogs/create-mastra.md +3 -3
  23. package/.docs/organized/changelogs/mastra.md +25 -25
  24. package/.docs/raw/guides/migrations/upgrade-to-v1/cli.mdx +15 -1
  25. package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +88 -4
  26. package/.docs/raw/memory/storage.mdx +3 -3
  27. package/.docs/raw/reference/cli/mastra.mdx +20 -4
  28. package/.docs/raw/reference/configuration.mdx +1 -1
  29. package/.docs/raw/reference/core/getStorage.mdx +1 -1
  30. package/.docs/raw/reference/core/mastra-class.mdx +1 -1
  31. package/.docs/raw/reference/core/setStorage.mdx +2 -2
  32. package/.docs/raw/reference/memory/memory-class.mdx +1 -1
  33. package/.docs/raw/reference/storage/composite.mdx +16 -16
  34. package/CHANGELOG.md +7 -0
  35. package/package.json +3 -3
@@ -1,5 +1,63 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.0.0-beta.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed duplicate spans migration issue across all storage backends. When upgrading from older versions, existing duplicate (traceId, spanId) combinations in the spans table could prevent the unique constraint from being created. The migration deduplicates spans before adding the constraint. ([#12073](https://github.com/mastra-ai/mastra/pull/12073))
8
+
9
+ **Deduplication rules (in priority order):**
10
+ 1. Keep completed spans (those with `endedAt` set) over incomplete spans
11
+ 2. Among spans with the same completion status, keep the one with the newest `updatedAt`
12
+ 3. Use `createdAt` as the final tiebreaker
13
+
14
+ **What changed:**
15
+ - Added `migrateSpans()` method to observability stores for manual migration
16
+ - Added `checkSpansMigrationStatus()` method to check if migration is needed
17
+ - All stores use optimized single-query deduplication to avoid memory issues on large tables
18
+
19
+ **Usage example:**
20
+
21
+ ```typescript
22
+ const observability = await storage.getStore('observability');
23
+ const status = await observability.checkSpansMigrationStatus();
24
+ if (status.needsMigration) {
25
+ const result = await observability.migrateSpans();
26
+ console.log(`Migration complete: ${result.duplicatesRemoved} duplicates removed`);
27
+ }
28
+ ```
29
+
30
+ Fixes #11840
31
+
32
+ - Renamed MastraStorage to MastraCompositeStore for better clarity. The old MastraStorage name remains available as a deprecated alias for backward compatibility, but will be removed in a future version. ([#12093](https://github.com/mastra-ai/mastra/pull/12093))
33
+
34
+ **Migration:**
35
+
36
+ Update your imports and usage:
37
+
38
+ ```typescript
39
+ // Before
40
+ import { MastraStorage } from '@mastra/core/storage';
41
+
42
+ const storage = new MastraStorage({
43
+ id: 'composite',
44
+ domains: { ... }
45
+ });
46
+
47
+ // After
48
+ import { MastraCompositeStore } from '@mastra/core/storage';
49
+
50
+ const storage = new MastraCompositeStore({
51
+ id: 'composite',
52
+ domains: { ... }
53
+ });
54
+ ```
55
+
56
+ The new name better reflects that this is a composite storage implementation that routes different domains (workflows, traces, messages) to different underlying stores, avoiding confusion with the general "Mastra Storage" concept.
57
+
58
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`ffa553a`](https://github.com/mastra-ai/mastra/commit/ffa553a3edc1bd17d73669fba66d6b6f4ac10897)]:
59
+ - @mastra/core@1.0.0-beta.26
60
+
3
61
  ## 1.0.0-beta.14
4
62
 
5
63
  ### Patch Changes
@@ -440,63 +498,5 @@
440
498
  await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
441
499
 
442
500
  const observability = await storage.getStore('observability');
443
- await observability?.createSpan(span);
444
- ```
445
-
446
- ### Available Domains
447
- - **`memory`**: Thread and message operations (`getThreadById`, `saveThread`, `saveMessages`, etc.)
448
- - **`workflows`**: Workflow state persistence (`persistWorkflowSnapshot`, `loadWorkflowSnapshot`, `getWorkflowRunById`, etc.)
449
- - **`scores`**: Evaluation scores (`saveScore`, `listScoresByScorerId`, etc.)
450
- - **`observability`**: Tracing and spans (`createSpan`, `updateSpan`, `getTrace`, etc.)
451
- - **`agents`**: Stored agent configurations (`createAgent`, `getAgentById`, `listAgents`, etc.)
452
-
453
- ### Breaking Changes
454
- - Passthrough methods have been removed from `MastraStorage` base class
455
- - All storage adapters now require accessing domains via `getStore()`
456
- - The `stores` property on storage instances is now the canonical way to access domain storage
457
-
458
- ### Internal Changes
459
- - Each storage adapter now initializes domain-specific stores in its constructor
460
- - Domain stores share database connections and handle their own table initialization
461
-
462
- - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
463
-
464
- ## What changed
465
-
466
- Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
467
-
468
- **Before:**
469
-
470
- ```typescript
471
- // Old span structure
472
- span.agentId; // 'my-agent'
473
- span.toolId; // undefined
474
- span.workflowId; // undefined
475
- ```
476
-
477
- **After:**
478
-
479
- ```typescript
480
- // New span structure
481
- span.entityType; // EntityType.AGENT
482
- span.entityId; // 'my-agent'
483
- span.entityName; // 'My Agent'
484
- ```
485
-
486
- ## New `listTraces()` API
487
-
488
- Query traces with filtering, pagination, and sorting:
489
-
490
- ```typescript
491
- const { spans, pagination } = await storage.listTraces({
492
- filters: {
493
- entityType: EntityType.AGENT,
494
- entityId: 'my-agent',
495
- userId: 'user-123',
496
- environment: 'production',
497
- status: TraceStatus.SUCCESS,
498
- startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
499
- },
500
- pagination: { page: 0, perPage: 50 },
501
501
 
502
- ... 3421 more lines hidden. See full changelog in package directory.
502
+ ... 3479 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,17 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 7.0.0-beta.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed scorer eligibility check in observability to also check span.entityType field ([#12078](https://github.com/mastra-ai/mastra/pull/12078))
8
+
9
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`ffa553a`](https://github.com/mastra-ai/mastra/commit/ffa553a3edc1bd17d73669fba66d6b6f4ac10897)]:
10
+ - @mastra/client-js@1.0.0-beta.26
11
+ - @mastra/core@1.0.0-beta.26
12
+ - @mastra/react@0.1.0-beta.26
13
+ - @mastra/ai-sdk@1.0.0-beta.16
14
+
3
15
  ## 7.0.0-beta.25
4
16
 
5
17
  ### Patch Changes
@@ -487,16 +499,4 @@
487
499
  - @mastra/client-js@1.0.0-beta.14
488
500
  - @mastra/react@0.1.0-beta.14
489
501
 
490
- ## 7.0.0-beta.13
491
-
492
- ### Patch Changes
493
-
494
- - Updated dependencies [[`919a22b`](https://github.com/mastra-ai/mastra/commit/919a22b25876f9ed5891efe5facbe682c30ff497)]:
495
- - @mastra/core@1.0.0-beta.13
496
- - @mastra/client-js@1.0.0-beta.13
497
- - @mastra/react@0.1.0-beta.13
498
-
499
- ## 7.0.0-beta.12
500
-
501
-
502
- ... 4777 more lines hidden. See full changelog in package directory.
502
+ ... 4789 more lines hidden. See full changelog in package directory.
@@ -1,6 +1,13 @@
1
- # @mastra/react-hooks
1
+ # @mastra/react
2
2
 
3
- ## 1.0.0-beta.25
3
+ ## 0.1.0-beta.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac)]:
8
+ - @mastra/client-js@1.0.0-beta.26
9
+
10
+ ## 0.1.0-beta.25
4
11
 
5
12
  ### Minor Changes
6
13
 
@@ -57,7 +64,7 @@
57
64
  - Updated dependencies [[`ed3e3dd`](https://github.com/mastra-ai/mastra/commit/ed3e3ddec69d564fe2b125e083437f76331f1283), [`47b1c16`](https://github.com/mastra-ai/mastra/commit/47b1c16a01c7ffb6765fe1e499b49092f8b7eba3), [`9312dcd`](https://github.com/mastra-ai/mastra/commit/9312dcd1c6f5b321929e7d382e763d95fdc030f5)]:
58
65
  - @mastra/client-js@1.0.0-beta.25
59
66
 
60
- ## 1.0.0-beta.24
67
+ ## 0.1.0-beta.23
61
68
 
62
69
  ### Major Changes
63
70
 
@@ -491,12 +498,5 @@
491
498
  - Updated dependencies []:
492
499
  - @mastra/client-js@0.16.4
493
500
 
494
- ## 0.0.10-alpha.0
495
-
496
- ### Patch Changes
497
-
498
- - Updated dependencies []:
499
- - @mastra/client-js@0.16.4-alpha.0
500
-
501
501
 
502
- ... 286 more lines hidden. See full changelog in package directory.
502
+ ... 293 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,14 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.0.0-beta.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Improve type handling with Zod ([#12091](https://github.com/mastra-ai/mastra/pull/12091))
8
+
9
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`ffa553a`](https://github.com/mastra-ai/mastra/commit/ffa553a3edc1bd17d73669fba66d6b6f4ac10897)]:
10
+ - @mastra/core@1.0.0-beta.26
11
+
3
12
  ## 1.0.0-beta.25
4
13
 
5
14
  ### Minor Changes
@@ -489,14 +498,5 @@
489
498
 
490
499
  **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
491
500
 
492
- **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
493
-
494
- ### Patch Changes
495
-
496
- - Refactor storage architecture to use domain-specific stores via `getStore()` pattern ([#11361](https://github.com/mastra-ai/mastra/pull/11361))
497
-
498
- ### Summary
499
-
500
- This release introduces a new storage architecture that replaces passthrough methods on `MastraStorage` with domain-specific storage interfaces accessed via `getStore()`. This change reduces code duplication across storage adapters and provides a cleaner, more modular API.
501
501
 
502
- ... 4961 more lines hidden. See full changelog in package directory.
502
+ ... 4970 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,38 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 1.0.0-beta.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Renamed MastraStorage to MastraCompositeStore for better clarity. The old MastraStorage name remains available as a deprecated alias for backward compatibility, but will be removed in a future version. ([#12093](https://github.com/mastra-ai/mastra/pull/12093))
8
+
9
+ **Migration:**
10
+
11
+ Update your imports and usage:
12
+
13
+ ```typescript
14
+ // Before
15
+ import { MastraStorage } from '@mastra/core/storage';
16
+
17
+ const storage = new MastraStorage({
18
+ id: 'composite',
19
+ domains: { ... }
20
+ });
21
+
22
+ // After
23
+ import { MastraCompositeStore } from '@mastra/core/storage';
24
+
25
+ const storage = new MastraCompositeStore({
26
+ id: 'composite',
27
+ domains: { ... }
28
+ });
29
+ ```
30
+
31
+ The new name better reflects that this is a composite storage implementation that routes different domains (workflows, traces, messages) to different underlying stores, avoiding confusion with the general "Mastra Storage" concept.
32
+
33
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`ffa553a`](https://github.com/mastra-ai/mastra/commit/ffa553a3edc1bd17d73669fba66d6b6f4ac10897)]:
34
+ - @mastra/core@1.0.0-beta.26
35
+
3
36
  ## 1.0.0-beta.12
4
37
 
5
38
  ### Patch Changes
@@ -466,37 +499,4 @@
466
499
 
467
500
  **Type change:** `WorkflowState.error` and `WorkflowRunState.error` types changed from `string | Error` to `SerializedError`.
468
501
 
469
- Other changes:
470
- - Added `UpdateWorkflowStateOptions` type for workflow state updates
471
-
472
- - Updated dependencies [[`d5ed981`](https://github.com/mastra-ai/mastra/commit/d5ed981c8701c1b8a27a5f35a9a2f7d9244e695f), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd), [`b760b73`](https://github.com/mastra-ai/mastra/commit/b760b731aca7c8a3f041f61d57a7f125ae9cb215), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`2b459f4`](https://github.com/mastra-ai/mastra/commit/2b459f466fd91688eeb2a44801dc23f7f8a887ab), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`24b76d8`](https://github.com/mastra-ai/mastra/commit/24b76d8e17656269c8ed09a0c038adb9cc2ae95a), [`243a823`](https://github.com/mastra-ai/mastra/commit/243a8239c5906f5c94e4f78b54676793f7510ae3), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`c61fac3`](https://github.com/mastra-ai/mastra/commit/c61fac3add96f0dcce0208c07415279e2537eb62), [`6f14f70`](https://github.com/mastra-ai/mastra/commit/6f14f706ccaaf81b69544b6c1b75ab66a41e5317), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f), [`2a53598`](https://github.com/mastra-ai/mastra/commit/2a53598c6d8cfeb904a7fc74e57e526d751c8fa6), [`c7cd3c7`](https://github.com/mastra-ai/mastra/commit/c7cd3c7a187d7aaf79e2ca139de328bf609a14b4), [`847c212`](https://github.com/mastra-ai/mastra/commit/847c212caba7df0d6f2fc756b494ac3c75c3720d), [`6f941c4`](https://github.com/mastra-ai/mastra/commit/6f941c438ca5f578619788acc7608fc2e23bd176)]:
473
- - @mastra/core@1.0.0-beta.12
474
-
475
- ## 1.0.0-beta.6
476
-
477
- ### Patch Changes
478
-
479
- - Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
480
-
481
- ```typescript
482
- await workflow.deleteWorkflowRunById(runId);
483
- ```
484
-
485
- - Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
486
- - @mastra/core@1.0.0-beta.10
487
-
488
- ## 1.0.0-beta.5
489
-
490
- ### Patch Changes
491
-
492
- - Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
493
-
494
- **What Changed**
495
- - saveScore now correctly returns scores that can be retrieved with getScoreById
496
- - Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
497
-
498
- **Impact**
499
- Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
500
-
501
-
502
- ... 2783 more lines hidden. See full changelog in package directory.
502
+ ... 2816 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,7 @@
1
1
  # create-mastra
2
2
 
3
+ ## 1.0.0-beta.18
4
+
3
5
  ## 1.0.0-beta.17
4
6
 
5
7
  ## 1.0.0-beta.16
@@ -496,7 +498,5 @@
496
498
 
497
499
  - Fix getting tool link path from agent in playground ui tools page ([#8135](https://github.com/mastra-ai/mastra/pull/8135))
498
500
 
499
- ## 0.13.2-alpha.3
500
-
501
501
 
502
- ... 1747 more lines hidden. See full changelog in package directory.
502
+ ... 1749 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,29 @@
1
1
  # mastra
2
2
 
3
+ ## 1.0.0-beta.18
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `mastra migrate` CLI command to manually run storage migrations. This command bundles and executes the migration script against your configured storage backend, deduplicating spans and adding unique constraints. Useful when upgrading from older versions that may have duplicate (traceId, spanId) entries. ([#12073](https://github.com/mastra-ai/mastra/pull/12073))
8
+
9
+ **Usage:**
10
+
11
+ ```bash
12
+ npx mastra migrate
13
+ ```
14
+
15
+ **Options:**
16
+ - `-d, --dir <path>` - Path to your Mastra folder (default: `src/mastra`)
17
+ - `-r, --root <path>` - Path to your root folder
18
+ - `-e, --env <env>` - Custom env file to include
19
+ - `--debug` - Enable debug logs
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`026b848`](https://github.com/mastra-ai/mastra/commit/026b8483fbf5b6d977be8f7e6aac8d15c75558ac), [`ffa553a`](https://github.com/mastra-ai/mastra/commit/ffa553a3edc1bd17d73669fba66d6b6f4ac10897)]:
24
+ - @mastra/core@1.0.0-beta.26
25
+ - @mastra/deployer@1.0.0-beta.26
26
+
3
27
  ## 1.0.0-beta.17
4
28
 
5
29
  ### Patch Changes
@@ -475,28 +499,4 @@
475
499
 
476
500
  ## 0.17.2-alpha.0
477
501
 
478
- ### Patch Changes
479
-
480
- - Fix a bug where `mastra init` didn't work correctly when core dependencies were missing in the project ([#9070](https://github.com/mastra-ai/mastra/pull/9070))
481
-
482
- - Updated dependencies [[`69ff5d5`](https://github.com/mastra-ai/mastra/commit/69ff5d58e4bc4054ce76bbb25a8fa5d3177c49ea)]:
483
- - @mastra/deployer@0.22.1-alpha.0
484
- - @mastra/core@0.22.1-alpha.0
485
-
486
- ## 0.17.1
487
-
488
- ### Patch Changes
489
-
490
- - Add scorers to the default weather agent in the create command. ([#9042](https://github.com/mastra-ai/mastra/pull/9042))
491
-
492
- - Fix tool result in playground ([#9087](https://github.com/mastra-ai/mastra/pull/9087))
493
-
494
- - Use newer model id for anthropic during `create-mastra` ([#8996](https://github.com/mastra-ai/mastra/pull/8996))
495
-
496
- - Update peerdeps to 0.23.0-0 ([#9043](https://github.com/mastra-ai/mastra/pull/9043))
497
-
498
- - Updated dependencies [[`25305a2`](https://github.com/mastra-ai/mastra/commit/25305a2af1acf77cc2ac9237774ecd7d3caa31a1), [`c67ca32`](https://github.com/mastra-ai/mastra/commit/c67ca32e3c2cf69bfc146580770c720220ca44ac), [`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`dbc9e12`](https://github.com/mastra-ai/mastra/commit/dbc9e1216ba575ba59ead4afb727a01215f7de4f), [`99e41b9`](https://github.com/mastra-ai/mastra/commit/99e41b94957cdd25137d3ac12e94e8b21aa01b68), [`c28833c`](https://github.com/mastra-ai/mastra/commit/c28833c5b6d8e10eeffd7f7d39129d53b8bca240), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`f053e89`](https://github.com/mastra-ai/mastra/commit/f053e89160dbd0bd3333fc3492f68231b5c7c349), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`1eb156a`](https://github.com/mastra-ai/mastra/commit/1eb156ace499b34ab48bf23fb16f1affe6bb9c1c), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`9a1a485`](https://github.com/mastra-ai/mastra/commit/9a1a4859b855e37239f652bf14b1ecd1029b8c4e), [`9257233`](https://github.com/mastra-ai/mastra/commit/9257233c4ffce09b2bedc2a9adbd70d7a83fa8e2), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`0f1a4c9`](https://github.com/mastra-ai/mastra/commit/0f1a4c984fb4b104b2f0b63ba18c9fa77f567700), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`084afad`](https://github.com/mastra-ai/mastra/commit/084afadff49b168d8b6104b43c77cecc96c48ac2), [`2db6160`](https://github.com/mastra-ai/mastra/commit/2db6160e2022ff8827c15d30157e684683b934b5), [`8aeea37`](https://github.com/mastra-ai/mastra/commit/8aeea37efdde347c635a67fed56794943b7f74ec), [`02fe153`](https://github.com/mastra-ai/mastra/commit/02fe15351d6021d214da48ec982a0e9e4150bcee), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`74567b3`](https://github.com/mastra-ai/mastra/commit/74567b3d237ae3915cd0bca3cf55fa0a64e4e4a4), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb), [`15a1733`](https://github.com/mastra-ai/mastra/commit/15a1733074cee8bd37370e1af34cd818e89fa7ac), [`fc2a774`](https://github.com/mastra-ai/mastra/commit/fc2a77468981aaddc3e77f83f0c4ad4a4af140da), [`4e08933`](https://github.com/mastra-ai/mastra/commit/4e08933625464dfde178347af5b6278fcf34188e), [`10188d6`](https://github.com/mastra-ai/mastra/commit/10188d632a729010441f9c7e2a41eab60afccb23)]:
499
- - @mastra/deployer@0.22.0
500
- - @mastra/core@0.22.0
501
-
502
- ... 6543 more lines hidden. See full changelog in package directory.
502
+ ... 6567 more lines hidden. See full changelog in package directory.
@@ -5,7 +5,21 @@ description: "Learn how to migrate CLI changes when upgrading to v1."
5
5
 
6
6
  # CLI
7
7
 
8
- The CLI has been simplified by removing deployment commands, configuration flags, and starter files.
8
+ The CLI has been simplified by removing deployment commands, configuration flags, and starter files. A new migration command has been added to help with database schema upgrades.
9
+
10
+ ## Added
11
+
12
+ ### `mastra migrate` command
13
+
14
+ A new `mastra migrate` command helps run database migrations when upgrading Mastra versions. This is particularly useful when upgrading from older versions that may have data incompatibilities.
15
+
16
+ ```bash
17
+ npx mastra migrate
18
+ ```
19
+
20
+ The command bundles your project, connects to your configured storage, and runs any necessary migrations. Currently supports migrating duplicate spans entries that may prevent unique constraint creation.
21
+
22
+ See the [Storage migration guide](/guides/v1/migrations/upgrade-to-v1/storage#duplicate-spans-migration) for details on when this migration is needed.
9
23
 
10
24
  ## Removed
11
25
 
@@ -30,6 +30,60 @@ UPDATE mastra_scorers SET "requestContext" = "runtimeContext" WHERE "runtimeCont
30
30
  ALTER TABLE mastra_scorers DROP COLUMN "runtimeContext";
31
31
  ```
32
32
 
33
+ ### Duplicate spans migration
34
+
35
+ If you're upgrading from an older version of Mastra, you may have duplicate `(traceId, spanId)` entries in your `mastra_spans` table. V1 adds a unique constraint on these columns to ensure data integrity, but this constraint cannot be added if duplicates exist.
36
+
37
+ :::note[Who needs this migration]
38
+ Only if you have existing spans data from Mastra versions prior to v1 and encounter errors about duplicate key violations or constraint creation failures.
39
+ :::
40
+
41
+ :::important[What breaks without it]
42
+ The storage initialization may fail when trying to add the unique constraint, or you may see errors like "duplicate key value violates unique constraint".
43
+ :::
44
+
45
+ **Option 1: Use the CLI (Recommended)**
46
+
47
+ Run the migration command which automatically deduplicates spans and adds the constraint:
48
+
49
+ ```bash
50
+ npx mastra migrate
51
+ ```
52
+
53
+ The CLI bundles your project, connects to your configured storage, and runs the migration. It keeps the most complete record (based on `endTime` and attributes) when removing duplicates.
54
+
55
+ **Option 2: Manual SQL (PostgreSQL)**
56
+
57
+ If you prefer to run the migration manually:
58
+
59
+ ```sql
60
+ -- Remove duplicates, keeping the most complete record
61
+ DELETE FROM mastra_spans a USING mastra_spans b
62
+ WHERE a.ctid < b.ctid
63
+ AND a."traceId" = b."traceId"
64
+ AND a."spanId" = b."spanId";
65
+
66
+ -- Add the unique constraint
67
+ ALTER TABLE mastra_spans ADD CONSTRAINT mastra_spans_trace_span_unique UNIQUE ("traceId", "spanId");
68
+ ```
69
+
70
+ **Option 3: Manual migration (Other databases)**
71
+
72
+ For ClickHouse, LibSQL, MongoDB, or MSSQL, use the programmatic API:
73
+
74
+ ```typescript
75
+ const storage = mastra.getStorage();
76
+ const observabilityStore = await storage.getStore('observability');
77
+
78
+ // Check if migration is needed
79
+ const status = await observabilityStore?.checkSpansMigrationStatus();
80
+ console.log(status);
81
+
82
+ // Run the migration
83
+ const result = await observabilityStore?.migrateSpans();
84
+ console.log(result);
85
+ ```
86
+
33
87
  ### JSON columns (TEXT → JSONB)
34
88
 
35
89
  **PostgreSQL only.** The `metadata` column in `mastra_threads` and `snapshot` column in `mastra_workflow_snapshot` changed from TEXT to JSONB.
@@ -50,19 +104,19 @@ USING snapshot::jsonb;
50
104
 
51
105
  ## Added
52
106
 
53
- ### Storage composition in MastraStorage
107
+ ### Storage composition in MastraCompositeStore
54
108
 
55
- `MastraStorage` can now compose storage domains from different adapters. Use it when you need different databases for different purposes - for example, PostgreSQL for memory and workflows, but a specialized database for observability.
109
+ `MastraCompositeStore` can now compose storage domains from different adapters. Use it when you need different databases for different purposes - for example, PostgreSQL for memory and workflows, but a specialized database for observability.
56
110
 
57
111
  ```typescript
58
- import { MastraStorage } from "@mastra/core/storage";
112
+ import { MastraCompositeStore } from "@mastra/core/storage";
59
113
  import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
60
114
  import { MemoryLibSQL } from "@mastra/libsql";
61
115
  import { Mastra } from "@mastra/core";
62
116
 
63
117
  // Compose domains from different stores
64
118
  const mastra = new Mastra({
65
- storage: new MastraStorage({
119
+ storage: new MastraCompositeStore({
66
120
  id: "composite",
67
121
  domains: {
68
122
  memory: new MemoryLibSQL({ url: "file:./local.db" }),
@@ -77,6 +131,36 @@ See the [Storage Composition reference](/reference/v1/storage/composite) for mor
77
131
 
78
132
  ## Changed
79
133
 
134
+ ### `MastraStorage` renamed to `MastraCompositeStore`
135
+
136
+ The `MastraStorage` class has been renamed to `MastraCompositeStore` to better reflect its role as a composite storage implementation that routes different domains to different underlying stores. This avoids confusion with the general "Mastra Storage" concept (the `storage` property on the Mastra instance).
137
+
138
+ The old `MastraStorage` name remains available as a deprecated alias for backward compatibility, but will be removed in a future version.
139
+
140
+ To migrate, update your imports and instantiation:
141
+
142
+ ```diff
143
+ - import { MastraStorage } from "@mastra/core/storage";
144
+ + import { MastraCompositeStore } from "@mastra/core/storage";
145
+ import { MemoryLibSQL } from "@mastra/libsql";
146
+ import { WorkflowsPG } from "@mastra/pg";
147
+
148
+ export const mastra = new Mastra({
149
+ - storage: new MastraStorage({
150
+ + storage: new MastraCompositeStore({
151
+ id: "composite",
152
+ domains: {
153
+ memory: new MemoryLibSQL({ url: "file:./memory.db" }),
154
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
155
+ },
156
+ }),
157
+ });
158
+ ```
159
+
160
+ :::note
161
+ If you're using a single store implementation (like `PostgresStore` or `LibSQLStore`) directly, no changes are needed. This only affects code that explicitly uses `MastraStorage` for composite storage.
162
+ :::
163
+
80
164
  ### Required `id` property for storage instances
81
165
 
82
166
  Storage instances now require an `id` property. This unique identifier is used for tracking and managing storage instances within Mastra. The `id` should be a descriptive, unique string for each storage instance in your application.
@@ -74,17 +74,17 @@ This is useful when all primitives share the same storage backend and have simil
74
74
 
75
75
  #### Composite storage
76
76
 
77
- Add storage to your Mastra instance using `MastraStorage` and configure individual storage domains to use different storage providers.
77
+ Add storage to your Mastra instance using `MastraCompositeStore` and configure individual storage domains to use different storage providers.
78
78
 
79
79
  ```typescript title="src/mastra/index.ts"
80
80
  import { Mastra } from "@mastra/core";
81
- import { MastraStorage } from "@mastra/core/storage";
81
+ import { MastraCompositeStore } from "@mastra/core/storage";
82
82
  import { MemoryLibSQL } from "@mastra/libsql";
83
83
  import { WorkflowsPG } from "@mastra/pg";
84
84
  import { ObservabilityStorageClickhouse } from "@mastra/clickhouse";
85
85
 
86
86
  export const mastra = new Mastra({
87
- storage: new MastraStorage({
87
+ storage: new MastraCompositeStore({
88
88
  id: "composite",
89
89
  domains: {
90
90
  memory: new MemoryLibSQL({ url: "file:./memory.db" }),
@@ -228,29 +228,45 @@ Do not include example code. Useful when using the `--default` flag.
228
228
 
229
229
  Configure your code editor with Mastra's MCP server. Choose from: `"cursor" | "cursor-global" | "windsurf" | "vscode"`.
230
230
 
231
+ ## `mastra migrate`
232
+
233
+ Runs database migrations to update your storage schema. This command is useful when upgrading Mastra versions that include storage schema changes.
234
+
235
+ The command bundles your project, connects to your configured storage backend, and executes any pending migrations. Currently supports:
236
+
237
+ - **Duplicate spans migration**: Removes duplicate `(traceId, spanId)` entries and adds a unique constraint to ensure data integrity.
238
+
239
+ ```bash
240
+ mastra migrate
241
+ ```
242
+
243
+ See the [Storage migration guide](/guides/v1/migrations/upgrade-to-v1/storage#duplicate-spans-migration) for details on when migrations are needed.
244
+
245
+ It accepts [common flags][common-flags].
246
+
231
247
  ## Common flags
232
248
 
233
249
  ### `--dir`
234
250
 
235
- **Available in:** `dev`, `build`, `lint`
251
+ **Available in:** `dev`, `build`, `lint`, `migrate`
236
252
 
237
253
  The path to your Mastra folder. Defaults to `src/mastra`.
238
254
 
239
255
  ### `--debug`
240
256
 
241
- **Available in:** `dev`, `build`
257
+ **Available in:** `dev`, `build`, `migrate`
242
258
 
243
259
  Enable verbose logging for Mastra's internals. Defaults to `false`.
244
260
 
245
261
  ### `--env`
246
262
 
247
- **Available in:** `dev`, `start`, `studio`
263
+ **Available in:** `dev`, `start`, `studio`, `migrate`
248
264
 
249
265
  Custom environment variables file to include. By default, includes `.env.development`, `.env.local`, and `.env`.
250
266
 
251
267
  ### `--root`
252
268
 
253
- **Available in:** `dev`, `build`, `lint`
269
+ **Available in:** `dev`, `build`, `lint`, `migrate`
254
270
 
255
271
  Path to your root folder. Defaults to `process.cwd()`.
256
272
 
@@ -307,7 +307,7 @@ export const mastra = new Mastra({
307
307
 
308
308
  ### storage
309
309
 
310
- **Type:** `MastraStorage`
310
+ **Type:** `MastraCompositeStore`
311
311
 
312
312
  Storage provider for persisting application data. Used by memory, workflows, traces, and other components that require persistence. Mastra supports multiple database backends including PostgreSQL, MongoDB, libSQL, and more.
313
313
 
@@ -25,7 +25,7 @@ This method does not accept any parameters.
25
25
  content={[
26
26
  {
27
27
  name: "storage",
28
- type: "MastraStorage | undefined",
28
+ type: "MastraCompositeStore | undefined",
29
29
  description:
30
30
  "The configured storage instance, or undefined if no storage has been configured.",
31
31
  },
@@ -59,7 +59,7 @@ Visit the [Configuration reference](/reference/v1/configuration) for detailed do
59
59
  },
60
60
  {
61
61
  name: "storage",
62
- type: "MastraStorage",
62
+ type: "MastraCompositeStore",
63
63
  description: "Storage engine instance for persisting data",
64
64
  isOptional: true,
65
65
  },
@@ -7,7 +7,7 @@ packages:
7
7
 
8
8
  # Mastra.setStorage()
9
9
 
10
- The `.setStorage()` method is used to set the storage instance for the Mastra instance. This method accepts a single `MastraStorage` parameter.
10
+ The `.setStorage()` method is used to set the storage instance for the Mastra instance. This method accepts a single `MastraCompositeStore` parameter.
11
11
 
12
12
  ## Usage example
13
13
 
@@ -26,7 +26,7 @@ mastra.setStorage(
26
26
  content={[
27
27
  {
28
28
  name: "storage",
29
- type: "MastraStorage",
29
+ type: "MastraCompositeStore",
30
30
  description: "The storage instance to set for the Mastra instance.",
31
31
  },
32
32
  ]}