@mastra/core 1.3.0-alpha.2 → 1.4.0-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 (277) hide show
  1. package/CHANGELOG.md +522 -0
  2. package/datasets.d.ts +1 -0
  3. package/dist/agent/agent.d.ts +1 -1
  4. package/dist/agent/index.cjs +13 -13
  5. package/dist/agent/index.js +2 -2
  6. package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
  7. package/dist/agent/message-list/adapters/AIV5Adapter.d.ts.map +1 -1
  8. package/dist/agent/message-list/conversion/output-converter.d.ts +2 -1
  9. package/dist/agent/message-list/conversion/output-converter.d.ts.map +1 -1
  10. package/dist/agent/message-list/index.cjs +18 -18
  11. package/dist/agent/message-list/index.js +1 -1
  12. package/dist/agent/workflows/prepare-stream/index.d.ts +1 -1
  13. package/dist/{chunk-WL3AW3YA.js → chunk-3X3CZUXI.js} +4070 -3983
  14. package/dist/chunk-3X3CZUXI.js.map +1 -0
  15. package/dist/{chunk-2GWTJFVM.js → chunk-4EHGOATH.js} +46 -14
  16. package/dist/chunk-4EHGOATH.js.map +1 -0
  17. package/dist/{chunk-CGPH7CMG.cjs → chunk-4KFEMXTV.cjs} +46 -14
  18. package/dist/chunk-4KFEMXTV.cjs.map +1 -0
  19. package/dist/{chunk-ZRUTE56J.js → chunk-4X2YMIAC.js} +286 -48
  20. package/dist/chunk-4X2YMIAC.js.map +1 -0
  21. package/dist/{chunk-OOCEAC6U.cjs → chunk-65PHUUMF.cjs} +3 -3
  22. package/dist/{chunk-OOCEAC6U.cjs.map → chunk-65PHUUMF.cjs.map} +1 -1
  23. package/dist/{chunk-STKNQDVA.js → chunk-6BAACGEW.js} +4 -4
  24. package/dist/{chunk-STKNQDVA.js.map → chunk-6BAACGEW.js.map} +1 -1
  25. package/dist/{chunk-MOOJ3H3C.js → chunk-7NKUSQEV.js} +1094 -10
  26. package/dist/chunk-7NKUSQEV.js.map +1 -0
  27. package/dist/{chunk-ZHFM7HCQ.js → chunk-AXHBJ4GX.js} +3 -3
  28. package/dist/{chunk-ZHFM7HCQ.js.map → chunk-AXHBJ4GX.js.map} +1 -1
  29. package/dist/{chunk-ILQXPZCD.js → chunk-AY6DBRS3.js} +37 -21
  30. package/dist/chunk-AY6DBRS3.js.map +1 -0
  31. package/dist/{chunk-JU6K7UDX.cjs → chunk-BP7VYTOP.cjs} +1116 -21
  32. package/dist/chunk-BP7VYTOP.cjs.map +1 -0
  33. package/dist/{chunk-UE2G2LRP.cjs → chunk-CZ4NQANZ.cjs} +37 -21
  34. package/dist/chunk-CZ4NQANZ.cjs.map +1 -0
  35. package/dist/{chunk-6TZKQI4R.cjs → chunk-EFLVACWV.cjs} +8 -7
  36. package/dist/{chunk-6TZKQI4R.cjs.map → chunk-EFLVACWV.cjs.map} +1 -1
  37. package/dist/{chunk-BXLLXTT4.js → chunk-FLPEGTEK.js} +4 -4
  38. package/dist/{chunk-BXLLXTT4.js.map → chunk-FLPEGTEK.js.map} +1 -1
  39. package/dist/{chunk-ON2KVIUJ.cjs → chunk-HYRYTTMT.cjs} +7 -7
  40. package/dist/{chunk-ON2KVIUJ.cjs.map → chunk-HYRYTTMT.cjs.map} +1 -1
  41. package/dist/chunk-NY5XBRWW.cjs +1207 -0
  42. package/dist/chunk-NY5XBRWW.cjs.map +1 -0
  43. package/dist/{chunk-OV7OOUUR.js → chunk-PS5ONCXY.js} +109 -5
  44. package/dist/chunk-PS5ONCXY.js.map +1 -0
  45. package/dist/{chunk-KL2JPSRX.js → chunk-RNID4D45.js} +5 -5
  46. package/dist/{chunk-KL2JPSRX.js.map → chunk-RNID4D45.js.map} +1 -1
  47. package/dist/{chunk-VM25PDSW.js → chunk-RZ4CIIZR.js} +4 -4
  48. package/dist/{chunk-VM25PDSW.js.map → chunk-RZ4CIIZR.js.map} +1 -1
  49. package/dist/{chunk-VVD56FI4.js → chunk-SK72J5NQ.js} +16 -8
  50. package/dist/chunk-SK72J5NQ.js.map +1 -0
  51. package/dist/{chunk-GZD6443M.cjs → chunk-SU5APAM6.cjs} +123 -4
  52. package/dist/chunk-SU5APAM6.cjs.map +1 -0
  53. package/dist/{chunk-U2CABSMC.cjs → chunk-U4YBKYRI.cjs} +72 -53
  54. package/dist/{chunk-U2CABSMC.cjs.map → chunk-U4YBKYRI.cjs.map} +1 -1
  55. package/dist/{chunk-FLHFB23E.cjs → chunk-UQ4SRS66.cjs} +351 -113
  56. package/dist/chunk-UQ4SRS66.cjs.map +1 -0
  57. package/dist/chunk-UZYMZNKB.js +1196 -0
  58. package/dist/chunk-UZYMZNKB.js.map +1 -0
  59. package/dist/{chunk-GCTAD6B7.cjs → chunk-VD5YA6RH.cjs} +12 -12
  60. package/dist/{chunk-GCTAD6B7.cjs.map → chunk-VD5YA6RH.cjs.map} +1 -1
  61. package/dist/{chunk-XQVYEOI7.cjs → chunk-VJIWSASE.cjs} +7 -7
  62. package/dist/{chunk-XQVYEOI7.cjs.map → chunk-VJIWSASE.cjs.map} +1 -1
  63. package/dist/{chunk-D5JZT6EK.cjs → chunk-XXZUUDP4.cjs} +23 -15
  64. package/dist/chunk-XXZUUDP4.cjs.map +1 -0
  65. package/dist/{chunk-KAJNBNWP.cjs → chunk-YNNJLLFN.cjs} +4071 -3984
  66. package/dist/chunk-YNNJLLFN.cjs.map +1 -0
  67. package/dist/{chunk-JQNREL64.js → chunk-ZGSYSUIG.js} +24 -5
  68. package/dist/{chunk-JQNREL64.js.map → chunk-ZGSYSUIG.js.map} +1 -1
  69. package/dist/datasets/dataset.d.ts +153 -0
  70. package/dist/datasets/dataset.d.ts.map +1 -0
  71. package/dist/datasets/experiment/analytics/aggregate.d.ts +46 -0
  72. package/dist/datasets/experiment/analytics/aggregate.d.ts.map +1 -0
  73. package/dist/datasets/experiment/analytics/compare.d.ts +33 -0
  74. package/dist/datasets/experiment/analytics/compare.d.ts.map +1 -0
  75. package/dist/datasets/experiment/analytics/index.d.ts +9 -0
  76. package/dist/datasets/experiment/analytics/index.d.ts.map +1 -0
  77. package/dist/datasets/experiment/analytics/types.d.ts +103 -0
  78. package/dist/datasets/experiment/analytics/types.d.ts.map +1 -0
  79. package/dist/datasets/experiment/executor.d.ts +40 -0
  80. package/dist/datasets/experiment/executor.d.ts.map +1 -0
  81. package/dist/datasets/experiment/index.d.ts +31 -0
  82. package/dist/datasets/experiment/index.d.ts.map +1 -0
  83. package/dist/datasets/experiment/scorer.d.ts +21 -0
  84. package/dist/datasets/experiment/scorer.d.ts.map +1 -0
  85. package/dist/datasets/experiment/types.d.ts +140 -0
  86. package/dist/datasets/experiment/types.d.ts.map +1 -0
  87. package/dist/datasets/index.cjs +69 -0
  88. package/dist/datasets/index.cjs.map +1 -0
  89. package/dist/datasets/index.d.ts +6 -0
  90. package/dist/datasets/index.d.ts.map +1 -0
  91. package/dist/datasets/index.js +4 -0
  92. package/dist/datasets/index.js.map +1 -0
  93. package/dist/datasets/manager.d.ts +73 -0
  94. package/dist/datasets/manager.d.ts.map +1 -0
  95. package/dist/datasets/validation/errors.d.ts +44 -0
  96. package/dist/datasets/validation/errors.d.ts.map +1 -0
  97. package/dist/datasets/validation/index.d.ts +3 -0
  98. package/dist/datasets/validation/index.d.ts.map +1 -0
  99. package/dist/datasets/validation/validator.d.ts +24 -0
  100. package/dist/datasets/validation/validator.d.ts.map +1 -0
  101. package/dist/docs/SKILL.md +1 -3
  102. package/dist/docs/assets/SOURCE_MAP.json +436 -346
  103. package/dist/docs/references/docs-memory-observational-memory.md +86 -11
  104. package/dist/docs/references/docs-streaming-events.md +23 -0
  105. package/dist/docs/references/docs-workspace-filesystem.md +72 -1
  106. package/dist/docs/references/docs-workspace-overview.md +95 -12
  107. package/dist/docs/references/docs-workspace-sandbox.md +2 -0
  108. package/dist/docs/references/guides-agent-frameworks-ai-sdk.md +6 -2
  109. package/dist/docs/references/reference-ai-sdk-with-mastra.md +1 -1
  110. package/dist/docs/references/reference-memory-observational-memory.md +318 -9
  111. package/dist/docs/references/reference-streaming-workflows-stream.md +1 -0
  112. package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +30 -0
  113. package/dist/docs/references/reference.md +3 -0
  114. package/dist/editor/index.d.ts +1 -1
  115. package/dist/editor/index.d.ts.map +1 -1
  116. package/dist/editor/types.d.ts +21 -3
  117. package/dist/editor/types.d.ts.map +1 -1
  118. package/dist/evals/index.cjs +20 -20
  119. package/dist/evals/index.js +3 -3
  120. package/dist/evals/scoreTraces/index.cjs +5 -5
  121. package/dist/evals/scoreTraces/index.js +2 -2
  122. package/dist/features/index.cjs +1 -1
  123. package/dist/features/index.cjs.map +1 -1
  124. package/dist/features/index.d.ts.map +1 -1
  125. package/dist/features/index.js +1 -1
  126. package/dist/features/index.js.map +1 -1
  127. package/dist/index.cjs +2 -7
  128. package/dist/index.d.ts +0 -9
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +1 -2
  131. package/dist/llm/index.cjs +10 -10
  132. package/dist/llm/index.js +2 -2
  133. package/dist/llm/model/provider-types.generated.d.ts +1694 -1659
  134. package/dist/loop/index.cjs +12 -12
  135. package/dist/loop/index.js +1 -1
  136. package/dist/loop/network/index.d.ts +1 -1
  137. package/dist/loop/network/index.d.ts.map +1 -1
  138. package/dist/loop/network/validation.d.ts +8 -0
  139. package/dist/loop/network/validation.d.ts.map +1 -1
  140. package/dist/loop/workflows/agentic-execution/index.d.ts +1 -1
  141. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  142. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  143. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  144. package/dist/loop/workflows/agentic-loop/index.d.ts +1 -1
  145. package/dist/loop/workflows/errors.d.ts +4 -0
  146. package/dist/loop/workflows/errors.d.ts.map +1 -0
  147. package/dist/mastra/index.cjs +2 -2
  148. package/dist/mastra/index.d.ts +2 -0
  149. package/dist/mastra/index.d.ts.map +1 -1
  150. package/dist/mastra/index.js +1 -1
  151. package/dist/memory/index.cjs +14 -14
  152. package/dist/memory/index.js +1 -1
  153. package/dist/memory/memory.d.ts +5 -0
  154. package/dist/memory/memory.d.ts.map +1 -1
  155. package/dist/memory/types.d.ts +56 -0
  156. package/dist/memory/types.d.ts.map +1 -1
  157. package/dist/processors/index.cjs +41 -41
  158. package/dist/processors/index.js +1 -1
  159. package/dist/processors/processors/skills.d.ts +1 -1
  160. package/dist/processors/processors/skills.d.ts.map +1 -1
  161. package/dist/processors/runner.d.ts.map +1 -1
  162. package/dist/processors/trailing-assistant-guard.d.ts +34 -0
  163. package/dist/processors/trailing-assistant-guard.d.ts.map +1 -0
  164. package/dist/provider-registry-6LZAGQET.cjs +40 -0
  165. package/dist/{provider-registry-C6XCYX44.cjs.map → provider-registry-6LZAGQET.cjs.map} +1 -1
  166. package/dist/provider-registry-QUNT7S55.js +3 -0
  167. package/dist/{provider-registry-NWU4YFQW.js.map → provider-registry-QUNT7S55.js.map} +1 -1
  168. package/dist/provider-registry.json +4068 -3981
  169. package/dist/relevance/index.cjs +3 -3
  170. package/dist/relevance/index.js +1 -1
  171. package/dist/storage/base.d.ts +4 -1
  172. package/dist/storage/base.d.ts.map +1 -1
  173. package/dist/storage/constants.cjs +87 -27
  174. package/dist/storage/constants.d.ts +21 -2
  175. package/dist/storage/constants.d.ts.map +1 -1
  176. package/dist/storage/constants.js +1 -1
  177. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
  178. package/dist/storage/domains/datasets/base.d.ts +83 -0
  179. package/dist/storage/domains/datasets/base.d.ts.map +1 -0
  180. package/dist/storage/domains/datasets/index.d.ts +3 -0
  181. package/dist/storage/domains/datasets/index.d.ts.map +1 -0
  182. package/dist/storage/domains/datasets/inmemory.d.ts +40 -0
  183. package/dist/storage/domains/datasets/inmemory.d.ts.map +1 -0
  184. package/dist/storage/domains/experiments/base.d.ts +28 -0
  185. package/dist/storage/domains/experiments/base.d.ts.map +1 -0
  186. package/dist/storage/domains/experiments/index.d.ts +3 -0
  187. package/dist/storage/domains/experiments/index.d.ts.map +1 -0
  188. package/dist/storage/domains/experiments/inmemory.d.ts +28 -0
  189. package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -0
  190. package/dist/storage/domains/index.d.ts +3 -0
  191. package/dist/storage/domains/index.d.ts.map +1 -1
  192. package/dist/storage/domains/inmemory-db.d.ts +9 -1
  193. package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
  194. package/dist/storage/domains/mcp-clients/base.d.ts +47 -0
  195. package/dist/storage/domains/mcp-clients/base.d.ts.map +1 -0
  196. package/dist/storage/domains/mcp-clients/index.d.ts +3 -0
  197. package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -0
  198. package/dist/storage/domains/mcp-clients/inmemory.d.ts +31 -0
  199. package/dist/storage/domains/mcp-clients/inmemory.d.ts.map +1 -0
  200. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  201. package/dist/storage/index.cjs +201 -117
  202. package/dist/storage/index.js +2 -2
  203. package/dist/storage/mock.d.ts.map +1 -1
  204. package/dist/storage/types.d.ts +340 -5
  205. package/dist/storage/types.d.ts.map +1 -1
  206. package/dist/stream/base/output.d.ts.map +1 -1
  207. package/dist/stream/index.cjs +11 -11
  208. package/dist/stream/index.js +2 -2
  209. package/dist/stream/types.d.ts +15 -0
  210. package/dist/stream/types.d.ts.map +1 -1
  211. package/dist/test-utils/llm-mock.cjs +4 -4
  212. package/dist/test-utils/llm-mock.js +1 -1
  213. package/dist/tool-loop-agent/index.cjs +4 -4
  214. package/dist/tool-loop-agent/index.js +1 -1
  215. package/dist/tool-provider/index.cjs +4 -0
  216. package/dist/tool-provider/index.cjs.map +1 -0
  217. package/dist/tool-provider/index.d.ts +2 -0
  218. package/dist/tool-provider/index.d.ts.map +1 -0
  219. package/dist/tool-provider/index.js +3 -0
  220. package/dist/tool-provider/index.js.map +1 -0
  221. package/dist/tool-provider/types.d.ts +113 -0
  222. package/dist/tool-provider/types.d.ts.map +1 -0
  223. package/dist/utils.cjs +23 -23
  224. package/dist/utils.d.ts +1 -1
  225. package/dist/utils.d.ts.map +1 -1
  226. package/dist/utils.js +1 -1
  227. package/dist/vector/index.cjs +7 -7
  228. package/dist/vector/index.js +1 -1
  229. package/dist/workflows/evented/index.cjs +10 -10
  230. package/dist/workflows/evented/index.js +1 -1
  231. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  232. package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
  233. package/dist/workflows/index.cjs +25 -25
  234. package/dist/workflows/index.js +1 -1
  235. package/dist/workflows/workflow.d.ts +2 -2
  236. package/dist/workflows/workflow.d.ts.map +1 -1
  237. package/dist/workspace/filesystem/filesystem.d.ts +5 -15
  238. package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
  239. package/dist/workspace/filesystem/local-filesystem.d.ts +18 -2
  240. package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
  241. package/dist/workspace/filesystem/mastra-filesystem.d.ts +21 -1
  242. package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
  243. package/dist/workspace/index.cjs +41 -41
  244. package/dist/workspace/index.d.ts +1 -1
  245. package/dist/workspace/index.d.ts.map +1 -1
  246. package/dist/workspace/index.js +1 -1
  247. package/dist/workspace/lifecycle.d.ts +49 -53
  248. package/dist/workspace/lifecycle.d.ts.map +1 -1
  249. package/dist/workspace/sandbox/local-sandbox.d.ts +1 -1
  250. package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
  251. package/dist/workspace/sandbox/mastra-sandbox.d.ts +3 -2
  252. package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
  253. package/dist/workspace/sandbox/sandbox.d.ts +3 -4
  254. package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
  255. package/dist/workspace/workspace.d.ts +2 -15
  256. package/dist/workspace/workspace.d.ts.map +1 -1
  257. package/package.json +7 -7
  258. package/src/llm/model/provider-types.generated.d.ts +1694 -1659
  259. package/tool-provider.d.ts +1 -0
  260. package/dist/chunk-2GWTJFVM.js.map +0 -1
  261. package/dist/chunk-CGPH7CMG.cjs.map +0 -1
  262. package/dist/chunk-D5JZT6EK.cjs.map +0 -1
  263. package/dist/chunk-FLHFB23E.cjs.map +0 -1
  264. package/dist/chunk-GZD6443M.cjs.map +0 -1
  265. package/dist/chunk-ILQXPZCD.js.map +0 -1
  266. package/dist/chunk-JU6K7UDX.cjs.map +0 -1
  267. package/dist/chunk-KAJNBNWP.cjs.map +0 -1
  268. package/dist/chunk-MOOJ3H3C.js.map +0 -1
  269. package/dist/chunk-OV7OOUUR.js.map +0 -1
  270. package/dist/chunk-UE2G2LRP.cjs.map +0 -1
  271. package/dist/chunk-VVD56FI4.js.map +0 -1
  272. package/dist/chunk-WL3AW3YA.js.map +0 -1
  273. package/dist/chunk-ZRUTE56J.js.map +0 -1
  274. package/dist/docs/references/reference-cli-mastra.md +0 -336
  275. package/dist/docs/references/reference-deployer-cloudflare.md +0 -56
  276. package/dist/provider-registry-C6XCYX44.cjs +0 -40
  277. package/dist/provider-registry-NWU4YFQW.js +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,527 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 1.4.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added Datasets and Experiments to core. Datasets let you store and version collections of test inputs with JSON Schema validation. Experiments let you run AI outputs against dataset items with configurable scorers to track quality over time. ([#12747](https://github.com/mastra-ai/mastra/pull/12747))
8
+
9
+ **New exports from `@mastra/core/datasets`:**
10
+ - `DatasetsManager` — orchestrates dataset CRUD, item versioning (SCD-2), and experiment execution
11
+ - `Dataset` — single-dataset handle for adding items and running experiments
12
+
13
+ **New storage domains:**
14
+ - `DatasetsStorage` — abstract base class for dataset persistence (datasets, items, versions)
15
+ - `ExperimentsStorage` — abstract base class for experiment lifecycle and result tracking
16
+
17
+ **Example:**
18
+
19
+ ```ts
20
+ import { Mastra } from '@mastra/core';
21
+
22
+ const mastra = new Mastra({
23
+ /* ... */
24
+ });
25
+
26
+ const dataset = await mastra.datasets.create({ name: 'my-eval-set' });
27
+ await dataset.addItems([{ input: { query: 'What is 2+2?' }, groundTruth: { answer: '4' } }]);
28
+
29
+ const result = await dataset.runExperiment({
30
+ targetType: 'agent',
31
+ targetId: 'my-agent',
32
+ scorerIds: ['accuracy'],
33
+ });
34
+ ```
35
+
36
+ - Fix LocalFilesystem.resolvePath handling of absolute paths and improve filesystem info. ([#12971](https://github.com/mastra-ai/mastra/pull/12971))
37
+ - Fix absolute path resolution: paths were incorrectly stripped of leading slashes and resolved relative to basePath, causing PermissionError for valid paths (e.g. skills processor accessing project-local skills directories).
38
+ - Make `FilesystemInfo` generic (`FilesystemInfo<TMetadata>`) so providers can type their metadata.
39
+ - Move provider-specific fields (`basePath`, `contained`) to metadata in LocalFilesystem.getInfo().
40
+ - Update LocalFilesystem.getInstructions() for uncontained filesystems to warn agents against listing /.
41
+ - Use FilesystemInfo type in WorkspaceInfo instead of duplicated inline shape.
42
+
43
+ - Add `workflow-step-progress` stream event for foreach workflow steps. Each iteration emits a progress event with `completedCount`, `totalCount`, `currentIndex`, `iterationStatus` (`success` | `failed` | `suspended`), and optional `iterationOutput`. Both the default and evented execution engines emit these events. ([#12838](https://github.com/mastra-ai/mastra/pull/12838))
44
+
45
+ The Mastra Studio UI now renders a progress bar with an N/total counter on foreach nodes, updating in real time as iterations complete:
46
+
47
+ ```ts
48
+ // Consuming progress events from the workflow stream
49
+ const run = workflow.createRun();
50
+ const result = await run.start({ inputData });
51
+ const stream = result.stream;
52
+
53
+ for await (const chunk of stream) {
54
+ if (chunk.type === 'workflow-step-progress') {
55
+ console.log(`${chunk.payload.completedCount}/${chunk.payload.totalCount} - ${chunk.payload.iterationStatus}`);
56
+ }
57
+ }
58
+ ```
59
+
60
+ `@mastra/react`: The `mapWorkflowStreamChunkToWatchResult` reducer now accumulates `foreachProgress` from `workflow-step-progress` events into step state, making progress data available to React consumers via the existing workflow watch hooks.
61
+
62
+ - Added observational memory configuration support for stored agents. When creating or editing a stored agent in the playground, you can now enable observational memory and configure its settings including model provider/name, scope (thread or resource), share token budget, and detailed observer/reflector parameters like token limits, buffer settings, and blocking thresholds. The configuration is serialized as part of the agent's memory config and round-trips through storage. ([#12962](https://github.com/mastra-ai/mastra/pull/12962))
63
+
64
+ **Example usage in the playground:**
65
+
66
+ Enable the Observational Memory toggle in the Memory section, then configure:
67
+ - Top-level model (provider + model) used by both observer and reflector
68
+ - Scope: `thread` (per-conversation) or `resource` (shared across threads)
69
+ - Expand **Observer** or **Reflector** sections to override models and tune token budgets
70
+
71
+ **Programmatic usage via client SDK:**
72
+
73
+ ```ts
74
+ await client.createStoredAgent({
75
+ name: 'My Agent',
76
+ // ...other config
77
+ memory: {
78
+ observationalMemory: true, // enable with defaults
79
+ options: { lastMessages: 40 },
80
+ },
81
+ });
82
+
83
+ // Or with custom configuration:
84
+ await client.createStoredAgent({
85
+ name: 'My Agent',
86
+ memory: {
87
+ observationalMemory: {
88
+ model: 'google/gemini-2.5-flash',
89
+ scope: 'resource',
90
+ shareTokenBudget: true,
91
+ observation: { messageTokens: 50000 },
92
+ reflection: { observationTokens: 60000 },
93
+ },
94
+ options: { lastMessages: 40 },
95
+ },
96
+ });
97
+ ```
98
+
99
+ **Programmatic usage via editor:**
100
+
101
+ ```ts
102
+ await editor.agent.create({
103
+ name: 'My Agent',
104
+ // ...other config
105
+ memory: {
106
+ observationalMemory: true, // enable with defaults
107
+ options: { lastMessages: 40 },
108
+ },
109
+ });
110
+
111
+ // Or with custom configuration:
112
+ await editor.agent.create({
113
+ name: 'My Agent',
114
+ memory: {
115
+ observationalMemory: {
116
+ model: 'google/gemini-2.5-flash',
117
+ scope: 'resource',
118
+ shareTokenBudget: true,
119
+ observation: { messageTokens: 50000 },
120
+ reflection: { observationTokens: 60000 },
121
+ },
122
+ options: { lastMessages: 40 },
123
+ },
124
+ });
125
+ ```
126
+
127
+ - Added MCP client storage domain and ToolProvider interface for integrating external tool catalogs with stored agents. ([#12974](https://github.com/mastra-ai/mastra/pull/12974))
128
+
129
+ **MCP Client Storage**
130
+
131
+ New storage domain for persisting MCP client configurations with CRUD operations. Each MCP client can contain multiple servers with independent tool selection:
132
+
133
+ ```ts
134
+ // Store an MCP client with multiple servers
135
+ await storage.mcpClients.create({
136
+ id: 'my-mcp',
137
+ name: 'My MCP Client',
138
+ servers: {
139
+ 'github-server': { url: 'https://mcp.github.com/sse' },
140
+ 'slack-server': { url: 'https://mcp.slack.com/sse' },
141
+ },
142
+ });
143
+ ```
144
+
145
+ LibSQL, PostgreSQL, and MongoDB storage adapters all implement the new MCP client domain.
146
+
147
+ **ToolProvider Interface**
148
+
149
+ New `ToolProvider` interface at `@mastra/core/tool-provider` enables third-party tool catalog integration (e.g., Composio, Arcade AI):
150
+
151
+ ```ts
152
+ import type { ToolProvider } from '@mastra/core/tool-provider';
153
+
154
+ # Providers implement: listToolkits(), listTools(), getToolSchema(), resolveTools()
155
+ ```
156
+
157
+ `resolveTools()` receives `requestContext` from the current request, enabling per-user API keys and credentials in multi-tenant setups:
158
+
159
+ ```ts
160
+ const tools = await provider.resolveTools(slugs, configs, {
161
+ requestContext: { apiKey: 'user-specific-key', userId: 'tenant-123' },
162
+ });
163
+ ```
164
+
165
+ **Tool Selection Semantics**
166
+
167
+ Both `mcpClients` and `integrationTools` on stored agents follow consistent three-state selection:
168
+ - `{ tools: undefined }` — provider registered, no tools selected
169
+ - `{ tools: {} }` — all tools from provider included
170
+ - `{ tools: { 'TOOL_SLUG': { description: '...' } } }` — specific tools with optional overrides
171
+
172
+ - **Added** ([#12764](https://github.com/mastra-ai/mastra/pull/12764))
173
+ Added a `suppressFeedback` option to hide internal completion‑check messages from the stream. This keeps the conversation history clean while leaving existing behavior unchanged by default.
174
+
175
+ **Example**
176
+ Before:
177
+
178
+ ```ts
179
+ const agent = await mastra.createAgent({
180
+ completion: { validate: true },
181
+ });
182
+ ```
183
+
184
+ After:
185
+
186
+ ```ts
187
+ const agent = await mastra.createAgent({
188
+ completion: { validate: true, suppressFeedback: true },
189
+ });
190
+ ```
191
+
192
+ - **Split workspace lifecycle interfaces** ([#12978](https://github.com/mastra-ai/mastra/pull/12978))
193
+
194
+ The shared `Lifecycle` interface has been split into provider-specific types that match actual usage:
195
+ - `FilesystemLifecycle` — two-phase: `init()` → `destroy()`
196
+ - `SandboxLifecycle` — three-phase: `start()` → `stop()` → `destroy()`
197
+
198
+ The base `Lifecycle` type is still exported for backward compatibility.
199
+
200
+ **Added `onInit` / `onDestroy` callbacks to `MastraFilesystem`**
201
+
202
+ The `MastraFilesystem` base class now accepts optional lifecycle callbacks via `MastraFilesystemOptions`, matching the existing `onStart` / `onStop` / `onDestroy` callbacks on `MastraSandbox`.
203
+
204
+ ```ts
205
+ const fs = new LocalFilesystem({
206
+ basePath: './data',
207
+ onInit: ({ filesystem }) => {
208
+ console.log('Filesystem ready:', filesystem.status);
209
+ },
210
+ onDestroy: ({ filesystem }) => {
211
+ console.log('Cleaning up...');
212
+ },
213
+ });
214
+ ```
215
+
216
+ `onInit` fires after the filesystem reaches `ready` status (non-fatal on failure). `onDestroy` fires before the filesystem is torn down.
217
+
218
+ ### Patch Changes
219
+
220
+ - Update provider registry and model documentation with latest models and providers ([`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b))
221
+
222
+ - Fixed agent version storage to persist the requestContextSchema field. Previously, requestContextSchema was defined on the agent snapshot type but was not included in the database schema, INSERT statements, or row parsing logic, causing it to be silently dropped when saving and loading agent versions. ([#13003](https://github.com/mastra-ai/mastra/pull/13003))
223
+
224
+ - Fixed Anthropic API rejection errors caused by empty text content blocks in assistant messages. During streaming with web search citations, empty text parts could be persisted to the database and then rejected by Anthropic's API with 'text content blocks must be non-empty' errors. The fix filters out these empty text blocks before persistence, ensuring stored conversation history remains valid for Anthropic models. Fixes `#12553`. ([#12711](https://github.com/mastra-ai/mastra/pull/12711))
225
+
226
+ - Improve error messages when processor workflows or model fallback retries fail. ([#12970](https://github.com/mastra-ai/mastra/pull/12970))
227
+ - Include the last error message and cause when all fallback models are exhausted, instead of the generic "Exhausted all fallback models" message.
228
+ - Extract error details from failed workflow results and individual step failures when a processor workflow fails, instead of just reporting "failed with status: failed".
229
+
230
+ - Fixed tool-not-found errors crashing the agentic loop. When a model hallucinates a tool name (e.g., Gemini 3 Flash adding prefixes like `creating:view` instead of `view`), the error is now returned to the model as a tool result instead of throwing. This allows the model to self-correct and retry with the correct tool name on the next turn. The error message includes available tool names to help the model recover. Fixes #12895. ([#12961](https://github.com/mastra-ai/mastra/pull/12961))
231
+
232
+ - Fixed structured output failing with Anthropic models when memory is enabled. The error "assistant message in the final position" occurred because the prompt sent to Anthropic ended with an assistant-role message, which is not supported when using output format. Resolves https://github.com/mastra-ai/mastra/issues/12800 ([#12835](https://github.com/mastra-ai/mastra/pull/12835))
233
+
234
+ ## 1.3.0
235
+
236
+ ### Minor Changes
237
+
238
+ - Added mount support to workspaces, so you can combine multiple storage providers (S3, GCS, local disk, etc.) under a single directory tree. This lets agents access files from different sources through one unified filesystem. ([#12851](https://github.com/mastra-ai/mastra/pull/12851))
239
+
240
+ **Why:** Previously a workspace could only use one filesystem. With mounts, you can organize files from different providers under different paths — for example, S3 data at `/data` and GCS models at `/models` — without agents needing to know which provider backs each path.
241
+
242
+ **What's new:**
243
+ - Added `CompositeFilesystem` for combining multiple filesystems under one tree
244
+ - Added descriptive error types for sandbox and mount failures (e.g., `SandboxTimeoutError`, `MountError`)
245
+ - Improved `MastraFilesystem` and `MastraSandbox` base classes with safer concurrent lifecycle handling
246
+
247
+ ```ts
248
+ import { Workspace, CompositeFilesystem } from '@mastra/core/workspace';
249
+
250
+ // Mount multiple filesystems under one tree
251
+ const composite = new CompositeFilesystem({
252
+ mounts: {
253
+ '/data': s3Filesystem,
254
+ '/models': gcsFilesystem,
255
+ },
256
+ });
257
+
258
+ const workspace = new Workspace({
259
+ filesystem: composite,
260
+ sandbox: e2bSandbox,
261
+ });
262
+ ```
263
+
264
+ - Supporting work to allow for cloning agents via the client SDK ([#12796](https://github.com/mastra-ai/mastra/pull/12796))
265
+
266
+ - Added `requestContextSchema` and rule-based conditional fields for stored agents. ([#12896](https://github.com/mastra-ai/mastra/pull/12896))
267
+
268
+ Stored agent fields (`tools`, `model`, `workflows`, `agents`, `memory`, `scorers`, `inputProcessors`, `outputProcessors`, `defaultOptions`) can now be configured as conditional variants with rule groups that evaluate against request context at runtime. All matching variants accumulate — arrays are concatenated and objects are shallow-merged — so agents dynamically compose their configuration based on the incoming request context.
269
+
270
+ **New `requestContextSchema` field**
271
+
272
+ Stored agents now accept an optional `requestContextSchema` (JSON Schema) that is converted to a Zod schema and passed to the Agent constructor, enabling request context validation.
273
+
274
+ **Conditional field example**
275
+
276
+ ```ts
277
+ await agentsStore.create({
278
+ agent: {
279
+ id: 'my-agent',
280
+ name: 'My Agent',
281
+ instructions: 'You are a helpful assistant',
282
+ model: { provider: 'openai', name: 'gpt-4' },
283
+ tools: [
284
+ { value: { 'basic-tool': {} } },
285
+ {
286
+ value: { 'premium-tool': {} },
287
+ rules: {
288
+ operator: 'AND',
289
+ conditions: [{ field: 'tier', operator: 'equals', value: 'premium' }],
290
+ },
291
+ },
292
+ ],
293
+ requestContextSchema: {
294
+ type: 'object',
295
+ properties: { tier: { type: 'string' } },
296
+ },
297
+ },
298
+ });
299
+ ```
300
+
301
+ - Implement underlying storage changes to allow for dynamic instructions in stored agents (for `@mastra/editor`) ([#12776](https://github.com/mastra-ai/mastra/pull/12776))
302
+
303
+ - Add native `@ai-sdk/groq` support to model router. Groq models now use the official AI SDK package instead of falling back to OpenAI-compatible mode. ([#12741](https://github.com/mastra-ai/mastra/pull/12741))
304
+
305
+ - **Added stored scorer definitions, editor namespace pattern, and generic storage domains** ([#12846](https://github.com/mastra-ai/mastra/pull/12846))
306
+ - Added a new `scorer-definitions` storage domain for storing LLM-as-judge and preset scorer configurations in the database
307
+ - Introduced a `VersionedStorageDomain` generic base class that unifies `AgentsStorage`, `PromptBlocksStorage`, and `ScorerDefinitionsStorage` with shared CRUD methods (`create`, `getById`, `getByIdResolved`, `update`, `delete`, `list`, `listResolved`)
308
+ - Flattened stored scorer type system: replaced nested `preset`/`customLLMJudge` config with top-level `type`, `instructions`, `scoreRange`, and `presetConfig` fields
309
+ - Refactored `MastraEditor` to use a namespace pattern (`editor.agent.*`, `editor.scorer.*`, `editor.prompt.*`) backed by a `CrudEditorNamespace` base class with built-in caching and an `onCacheEvict` hook
310
+ - Added `rawConfig` support to `MastraBase` and `MastraScorer` via `toRawConfig()`, so hydrated primitives carry their stored configuration
311
+ - Added prompt block and scorer registration to the `Mastra` class (`addPromptBlock`, `removePromptBlock`, `addScorer`, `removeScorer`)
312
+
313
+ **Creating a stored scorer (LLM-as-judge):**
314
+
315
+ ```ts
316
+ const scorer = await editor.scorer.create({
317
+ id: 'my-scorer',
318
+ name: 'Response Quality',
319
+ type: 'llm-judge',
320
+ instructions: 'Evaluate the response for accuracy and helpfulness.',
321
+ model: { provider: 'openai', name: 'gpt-4o' },
322
+ scoreRange: { min: 0, max: 1 },
323
+ });
324
+ ```
325
+
326
+ **Retrieving and resolving a stored scorer:**
327
+
328
+ ```ts
329
+ // Fetch the stored definition from DB
330
+ const definition = await editor.scorer.getById('my-scorer');
331
+
332
+ // Resolve it into a runnable MastraScorer instance
333
+ const runnableScorer = editor.scorer.resolve(definition);
334
+
335
+ // Execute the scorer
336
+ const result = await runnableScorer.run({
337
+ input: 'What is the capital of France?',
338
+ output: 'The capital of France is Paris.',
339
+ });
340
+ ```
341
+
342
+ **Editor namespace pattern (before/after):**
343
+
344
+ ```ts
345
+ // Before
346
+ const agent = await editor.getStoredAgentById('abc');
347
+ const prompts = await editor.listPromptBlocks();
348
+
349
+ // After
350
+ const agent = await editor.agent.getById('abc');
351
+ const prompts = await editor.prompt.list();
352
+ ```
353
+
354
+ **Generic storage domain methods (before/after):**
355
+
356
+ ```ts
357
+ // Before
358
+ const store = storage.getStore('agents');
359
+ await store.createAgent({ agent: input });
360
+ await store.getAgentById({ id: 'abc' });
361
+ await store.deleteAgent({ id: 'abc' });
362
+
363
+ // After
364
+ const store = storage.getStore('agents');
365
+ await store.create({ agent: input });
366
+ await store.getById('abc');
367
+ await store.delete('abc');
368
+ ```
369
+
370
+ - Added mount status and error information to filesystem directory listings, so the UI can show whether each mount is healthy or has issues. Improved error handling when mount operations fail. Fixed tree formatter to use case-insensitive sorting to match native tree output. ([#12605](https://github.com/mastra-ai/mastra/pull/12605))
371
+
372
+ - Added workspace registration and tool context support. ([#12607](https://github.com/mastra-ai/mastra/pull/12607))
373
+
374
+ **Why** - Makes it easier to manage multiple workspaces at runtime and lets tools read/write files in the intended workspace.
375
+
376
+ **Workspace Registration** - Added a workspace registry so you can list and fetch workspaces by id with `addWorkspace()`, `getWorkspaceById()`, and `listWorkspaces()`. Agent workspaces are auto-registered when adding agents.
377
+
378
+ **Before**
379
+
380
+ ```typescript
381
+ const mastra = new Mastra({ workspace: myWorkspace });
382
+ // No way to look up workspaces by id or list all workspaces
383
+ ```
384
+
385
+ **After**
386
+
387
+ ```typescript
388
+ const mastra = new Mastra({ workspace: myWorkspace });
389
+
390
+ // Look up by id
391
+ const ws = mastra.getWorkspaceById('my-workspace');
392
+
393
+ // List all registered workspaces
394
+ const allWorkspaces = mastra.listWorkspaces();
395
+
396
+ // Register additional workspaces
397
+ mastra.addWorkspace(anotherWorkspace);
398
+ ```
399
+
400
+ **Tool Workspace Access** - Tools can access the workspace through `context.workspace` during execution, enabling filesystem and sandbox operations.
401
+
402
+ ```typescript
403
+ const myTool = createTool({
404
+ id: 'file-reader',
405
+ execute: async ({ context }) => {
406
+ const fs = context.workspace?.filesystem;
407
+ const content = await fs?.readFile('config.json');
408
+ return { content };
409
+ },
410
+ });
411
+ ```
412
+
413
+ **Dynamic Workspace Configuration** - Workspace can be configured dynamically via agent config functions. Dynamically created workspaces are auto-registered with Mastra, making them available via `listWorkspaces()`.
414
+
415
+ ```typescript
416
+ const agent = new Agent({
417
+ workspace: ({ mastra, requestContext }) => {
418
+ // Return workspace dynamically based on context
419
+ const workspaceId = requestContext?.get('workspaceId') || 'default';
420
+ return mastra.getWorkspaceById(workspaceId);
421
+ },
422
+ });
423
+ ```
424
+
425
+ - Add tool description overrides for stored agents: ([#12794](https://github.com/mastra-ai/mastra/pull/12794))
426
+ - Changed stored agent `tools` field from `string[]` to `Record<string, { description?: string }>` to allow per-tool description overrides
427
+ - When a stored agent specifies a custom `description` for a tool, the override is applied at resolution time
428
+ - Updated server API schemas, client SDK types, and editor resolution logic accordingly
429
+
430
+ - **Breaking:** Removed `cloneAgent()` from the `Agent` class. Agent cloning is now handled by the editor package via `editor.agent.clone()`. ([#12904](https://github.com/mastra-ai/mastra/pull/12904))
431
+
432
+ If you were calling `agent.cloneAgent()` directly, use the editor's agent namespace instead:
433
+
434
+ ```ts
435
+ // Before
436
+ const result = await agent.cloneAgent({ newId: 'my-clone' });
437
+
438
+ // After
439
+ const editor = mastra.getEditor();
440
+ const result = await editor.agent.clone(agent, { newId: 'my-clone' });
441
+ ```
442
+
443
+ **Why:** The `Agent` class should not be responsible for storage serialization. The editor package already handles converting between runtime agents and stored configurations, so cloning belongs there.
444
+
445
+ **Added** `getConfiguredProcessorIds()` to the `Agent` class, which returns raw input/output processor IDs for the agent's configuration.
446
+
447
+ ### Patch Changes
448
+
449
+ - Update provider registry and model documentation with latest models and providers ([`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004))
450
+
451
+ - Fixed observational memory progress bars resetting to zero after agent responses finish. ([#12934](https://github.com/mastra-ai/mastra/pull/12934))
452
+
453
+ - Fixed issues with stored agents ([#12790](https://github.com/mastra-ai/mastra/pull/12790))
454
+
455
+ - Fixed sub-agent tool approval and suspend events not being surfaced to the parent agent stream. This enables proper suspend/resume workflows and approval handling when nested agents require tool approvals. ([#12732](https://github.com/mastra-ai/mastra/pull/12732))
456
+
457
+ Related to issue #12552.
458
+
459
+ - Fixed stale agent data in CMS pages by adding removeAgent method to Mastra and updating clearStoredAgentCache to clear both Editor cache and Mastra registry when stored agents are updated or deleted ([#12693](https://github.com/mastra-ai/mastra/pull/12693))
460
+
461
+ - Fixed stored scorers not being registered on the Mastra instance. Scorers created via the editor are now automatically discoverable through `mastra.getScorer()` and `mastra.getScorerById()`, matching the existing behavior of stored agents. Previously, stored scorers could only be resolved inline but were invisible to the runtime registry, causing lookups to fail. ([#12903](https://github.com/mastra-ai/mastra/pull/12903))
462
+
463
+ - Fixed `generateTitle` running on every conversation turn instead of only the first, which caused redundant title generation calls. This happened when `lastMessages` was disabled or set to `false`. Titles are now correctly generated only on the first turn. ([#12890](https://github.com/mastra-ai/mastra/pull/12890))
464
+
465
+ - Fixed workflow step errors not being propagated to the configured Mastra logger. The execution engine now properly propagates the Mastra logger through the inheritance chain, and the evented step executor logs errors with structured MastraError context (matching the default engine behavior). Closes #12793 ([#12834](https://github.com/mastra-ai/mastra/pull/12834))
466
+
467
+ - Update memory config and exports: ([#12704](https://github.com/mastra-ai/mastra/pull/12704))
468
+ - Updated `SerializedMemoryConfig` to allow `embedder?: EmbeddingModelId | string` for flexibility
469
+ - Exported `EMBEDDING_MODELS` and `EmbeddingModelInfo` for use in server endpoints
470
+
471
+ - Fixed a catch-22 where third-party AI SDK providers (like `ollama-ai-provider-v2`) were rejected by both `stream()` and `streamLegacy()` due to unrecognized `specificationVersion` values. ([#12856](https://github.com/mastra-ai/mastra/pull/12856))
472
+
473
+ When a model has a `specificationVersion` that isn't `'v1'`, `'v2'`, or `'v3'` (e.g., from a third-party provider), two fixes now apply:
474
+ 1. **Auto-wrapping in `resolveModelConfig()`**: Models with unknown spec versions that have `doStream`/`doGenerate` methods are automatically wrapped as AI SDK v5 models, preventing the catch-22 entirely.
475
+ 2. **Improved error messages**: If a model still reaches the version check, error messages now show the actual unrecognized `specificationVersion` instead of creating circular suggestions between `stream()` and `streamLegacy()`.
476
+
477
+ - Fixed routing output so users only see the final answer when routing handles a request directly. Previously, an internal routing explanation appeared before the answer and was duplicated. Fixes #12545. ([#12786](https://github.com/mastra-ai/mastra/pull/12786))
478
+
479
+ - Supporting changes for async buffering in observational memory, including new config options, streaming events, and UI markers. ([#12891](https://github.com/mastra-ai/mastra/pull/12891))
480
+
481
+ - Fixed an issue where processor retry (via `abort({ retry: true })` in `processOutputStep`) would send the rejected assistant response back to the LLM on retry. This confused models and often caused empty text responses. The rejected response is now removed from the message list before the retry iteration. ([#12799](https://github.com/mastra-ai/mastra/pull/12799))
482
+
483
+ - Fixed Moonshot AI (moonshotai and moonshotai-cn) models using the wrong base URL. The Anthropic-compatible endpoint was not being applied, causing API calls to fail with an upstream LLM error. ([#12750](https://github.com/mastra-ai/mastra/pull/12750))
484
+
485
+ - Fixed messages not being persisted to the database when using the stream-legacy endpoint. The thread is now saved to the database immediately when created, preventing a race condition where storage backends like PostgreSQL would reject message inserts because the thread didn't exist yet. Fixes #12566. ([#12774](https://github.com/mastra-ai/mastra/pull/12774))
486
+
487
+ - When calling `mastra.setLogger()`, memory instances were not being updated with the new logger. This caused memory-related errors to be logged via the default ConsoleLogger instead of the configured logger. ([#12905](https://github.com/mastra-ai/mastra/pull/12905))
488
+
489
+ - Fixed tool input validation failing when LLMs return stringified JSON for array or object parameters. Some models (e.g., GLM4.7) send `"[\"file.py\"]"` instead of `["file.py"]` for array fields, which caused Zod validation to reject the input. The validation pipeline now automatically detects and parses stringified JSON values when the schema expects an array or object. (GitHub #12757) ([#12771](https://github.com/mastra-ai/mastra/pull/12771))
490
+
491
+ - Fixed working memory tools being injected when no thread or resource context is provided. Made working memory tool execute scope-aware: thread-scoped requires threadId, resource-scoped requires resourceId (previously both were always required regardless of scope). ([#12831](https://github.com/mastra-ai/mastra/pull/12831))
492
+
493
+ - Fixed a crash when using agent workflows that have no input schema. Input now passes through on first invocation, so workflows run instead of failing. (#12739) ([#12785](https://github.com/mastra-ai/mastra/pull/12785))
494
+
495
+ - Fixes issue where client tools could not be used with agent.network(). Client tools configured in an agent's defaultOptions will now be available during network execution. ([#12821](https://github.com/mastra-ai/mastra/pull/12821))
496
+
497
+ Fixes #12752
498
+
499
+ - Steps now support an optional `metadata` property for storing arbitrary key-value data. This metadata is preserved through step serialization and is available in the workflow graph, enabling use cases like UI annotations or custom step categorization. ([#12861](https://github.com/mastra-ai/mastra/pull/12861))
500
+
501
+ ```diff
502
+ import { createStep } from "@mastra/core/workflows";
503
+ import { z } from "zod";
504
+
505
+ const step = createStep({
506
+ //...step information
507
+ + metadata: {
508
+ + category: "orders",
509
+ + priority: "high",
510
+ + version: "1.0.0",
511
+ + },
512
+ });
513
+ ```
514
+
515
+ Metadata values must be serializable (no functions or circular references).
516
+
517
+ - Fixed: You can now pass workflows with a `requestContextSchema` to the Mastra constructor without a type error. Related: #12773. ([#12857](https://github.com/mastra-ai/mastra/pull/12857))
518
+
519
+ - Fixed TypeScript type errors when using `.optional().default()` in workflow input schemas. Workflows with default values in their schemas no longer produce false type errors when chaining steps with `.then()`. Fixes #12634 ([#12778](https://github.com/mastra-ai/mastra/pull/12778))
520
+
521
+ - Fix setLogger to update workflow loggers ([#12889](https://github.com/mastra-ai/mastra/pull/12889))
522
+
523
+ When calling `mastra.setLogger()`, workflows were not being updated with the new logger. This caused workflow errors to be logged via the default ConsoleLogger instead of the configured logger (e.g., PinoLogger with HttpTransport), resulting in missing error logs in Cloud deployments.
524
+
3
525
  ## 1.3.0-alpha.2
4
526
 
5
527
  ### Patch Changes
package/datasets.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/datasets';
@@ -79,7 +79,7 @@ export declare class Agent<TAgentId extends string = string, TTools extends Tool
79
79
  * ```
80
80
  */
81
81
  constructor(config: AgentConfig<TAgentId, TTools, TOutput, TRequestContext>);
82
- getMastraInstance(): Mastra<Record<string, Agent<any, ToolsInput, undefined, unknown>>, Record<string, AnyWorkflow>, Record<string, import("..").MastraVectorProvider<any>>, Record<string, import("../tts").MastraTTS>, import("..").Logger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, MastraScorer<any, any, any, any>>, Record<string, import("..").ToolAction<any, any, any, any, any, any, unknown>>, Record<string, Processor<any, unknown>>, Record<string, MastraMemory>> | undefined;
82
+ getMastraInstance(): Mastra<Record<string, Agent<any, ToolsInput, undefined, unknown>>, Record<string, AnyWorkflow>, Record<string, import("../vector").MastraVector<any>>, Record<string, import("../tts").MastraTTS>, import("../logger").IMastraLogger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, MastraScorer<any, any, any, any>>, Record<string, import("../tools").ToolAction<any, any, any, any, any, any, unknown>>, Record<string, Processor<any, unknown>>, Record<string, MastraMemory>> | undefined;
83
83
  /**
84
84
  * Gets the skills processors to add to input processors when workspace has skills.
85
85
  * @internal
@@ -1,53 +1,53 @@
1
1
  'use strict';
2
2
 
3
- var chunkFLHFB23E_cjs = require('../chunk-FLHFB23E.cjs');
4
- var chunkUE2G2LRP_cjs = require('../chunk-UE2G2LRP.cjs');
3
+ var chunkUQ4SRS66_cjs = require('../chunk-UQ4SRS66.cjs');
4
+ var chunkCZ4NQANZ_cjs = require('../chunk-CZ4NQANZ.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Agent", {
9
9
  enumerable: true,
10
- get: function () { return chunkFLHFB23E_cjs.Agent; }
10
+ get: function () { return chunkUQ4SRS66_cjs.Agent; }
11
11
  });
12
12
  Object.defineProperty(exports, "TripWire", {
13
13
  enumerable: true,
14
- get: function () { return chunkFLHFB23E_cjs.TripWire; }
14
+ get: function () { return chunkUQ4SRS66_cjs.TripWire; }
15
15
  });
16
16
  Object.defineProperty(exports, "isSupportedLanguageModel", {
17
17
  enumerable: true,
18
- get: function () { return chunkFLHFB23E_cjs.isSupportedLanguageModel; }
18
+ get: function () { return chunkUQ4SRS66_cjs.isSupportedLanguageModel; }
19
19
  });
20
20
  Object.defineProperty(exports, "resolveThreadIdFromArgs", {
21
21
  enumerable: true,
22
- get: function () { return chunkFLHFB23E_cjs.resolveThreadIdFromArgs; }
22
+ get: function () { return chunkUQ4SRS66_cjs.resolveThreadIdFromArgs; }
23
23
  });
24
24
  Object.defineProperty(exports, "supportedLanguageModelSpecifications", {
25
25
  enumerable: true,
26
- get: function () { return chunkFLHFB23E_cjs.supportedLanguageModelSpecifications; }
26
+ get: function () { return chunkUQ4SRS66_cjs.supportedLanguageModelSpecifications; }
27
27
  });
28
28
  Object.defineProperty(exports, "tryGenerateWithJsonFallback", {
29
29
  enumerable: true,
30
- get: function () { return chunkFLHFB23E_cjs.tryGenerateWithJsonFallback; }
30
+ get: function () { return chunkUQ4SRS66_cjs.tryGenerateWithJsonFallback; }
31
31
  });
32
32
  Object.defineProperty(exports, "tryStreamWithJsonFallback", {
33
33
  enumerable: true,
34
- get: function () { return chunkFLHFB23E_cjs.tryStreamWithJsonFallback; }
34
+ get: function () { return chunkUQ4SRS66_cjs.tryStreamWithJsonFallback; }
35
35
  });
36
36
  Object.defineProperty(exports, "MessageList", {
37
37
  enumerable: true,
38
- get: function () { return chunkUE2G2LRP_cjs.MessageList; }
38
+ get: function () { return chunkCZ4NQANZ_cjs.MessageList; }
39
39
  });
40
40
  Object.defineProperty(exports, "TypeDetector", {
41
41
  enumerable: true,
42
- get: function () { return chunkUE2G2LRP_cjs.TypeDetector; }
42
+ get: function () { return chunkCZ4NQANZ_cjs.TypeDetector; }
43
43
  });
44
44
  Object.defineProperty(exports, "aiV5ModelMessageToV2PromptMessage", {
45
45
  enumerable: true,
46
- get: function () { return chunkUE2G2LRP_cjs.aiV5ModelMessageToV2PromptMessage; }
46
+ get: function () { return chunkCZ4NQANZ_cjs.aiV5ModelMessageToV2PromptMessage; }
47
47
  });
48
48
  Object.defineProperty(exports, "convertMessages", {
49
49
  enumerable: true,
50
- get: function () { return chunkUE2G2LRP_cjs.convertMessages; }
50
+ get: function () { return chunkCZ4NQANZ_cjs.convertMessages; }
51
51
  });
52
52
  //# sourceMappingURL=index.cjs.map
53
53
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-ZRUTE56J.js';
2
- export { MessageList, TypeDetector, aiV5ModelMessageToV2PromptMessage, convertMessages } from '../chunk-ILQXPZCD.js';
1
+ export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-4X2YMIAC.js';
2
+ export { MessageList, TypeDetector, aiV5ModelMessageToV2PromptMessage, convertMessages } from '../chunk-AY6DBRS3.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AIV4Adapter.d.ts","sourceRoot":"","sources":["../../../../src/agent/message-list/adapters/AIV4Adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,IAAI,WAAW,EACxB,WAAW,IAAI,aAAa,EAE7B,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EACV,eAAe,EAIf,aAAa,EACb,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAYxB,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,IAAI,MAAM,CAAC;IACvB,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvE,mDAAmD;IACnD,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,GAAG,qBAAqB;IAiJ7D;;OAEG;IACH,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EAC5C,GAAG,EAAE,kBAAkB,EACvB,aAAa,EAAE,aAAa,GAC3B,eAAe;IA8BlB;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,WAAW,EAAE,aAAa,EAC1B,GAAG,EAAE,kBAAkB,EACvB,aAAa,EAAE,aAAa,GAC3B,eAAe;CAkPnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AIV5Adapter.d.ts","sourceRoot":"","sources":["../../../../src/agent/message-list/adapters/AIV5Adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAA0B,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAmCzC,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,IAAI,MAAM,CAAC;IACxB,iBAAiB,CAAC,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACzE;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAAC,SAAS;IA8N9D;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,GAAG,eAAe;IAgMhE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAyC5C;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,aAAa,GAAG,eAAe;CAkM1G"}
1
+ {"version":3,"file":"AIV5Adapter.d.ts","sourceRoot":"","sources":["../../../../src/agent/message-list/adapters/AIV5Adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAA6C,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAqDzC,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,IAAI,MAAM,CAAC;IACxB,iBAAiB,CAAC,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACzE;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAAC,SAAS;IA8N9D;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,GAAG,eAAe;IAmMhE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAyC5C;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,aAAa,GAAG,eAAe;CAoL1G"}
@@ -8,7 +8,8 @@ import type { AIV5Type } from '../types.js';
8
8
  */
9
9
  export declare function sanitizeAIV4UIMessages(messages: UIMessageV4[]): UIMessageV4[];
10
10
  /**
11
- * Sanitizes AIV5 UI messages by filtering out streaming states, data-* parts, and optionally incomplete tool calls.
11
+ * Sanitizes AIV5 UI messages by filtering out streaming states, data-* parts, empty text parts, and optionally incomplete tool calls.
12
+ * Handles legacy data by filtering empty text parts that may exist in pre-existing DB records.
12
13
  */
13
14
  export declare function sanitizeV5UIMessages(messages: AIV5Type.UIMessage[], filterIncompleteToolCalls?: boolean): AIV5Type.UIMessage[];
14
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"output-converter.d.ts","sourceRoot":"","sources":["../../../../src/ag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