@mastra/core 1.0.0-beta.1 → 1.0.0-beta.11

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 (576) hide show
  1. package/CHANGELOG.md +1218 -0
  2. package/dist/agent/agent-legacy.d.ts +35 -30
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent-types.test-d.d.ts +2 -0
  5. package/dist/agent/agent-types.test-d.d.ts.map +1 -0
  6. package/dist/agent/agent.d.ts +24 -9
  7. package/dist/agent/agent.d.ts.map +1 -1
  8. package/dist/agent/agent.types.d.ts +17 -9
  9. package/dist/agent/agent.types.d.ts.map +1 -1
  10. package/dist/agent/index.cjs +9 -9
  11. package/dist/agent/index.js +2 -2
  12. package/dist/agent/message-list/index.cjs +3 -3
  13. package/dist/agent/message-list/index.d.ts +61 -3
  14. package/dist/agent/message-list/index.d.ts.map +1 -1
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts.map +1 -1
  17. package/dist/agent/message-list/prompt/convert-file.d.ts +1 -1
  18. package/dist/agent/message-list/prompt/convert-file.d.ts.map +1 -1
  19. package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
  20. package/dist/agent/save-queue/index.d.ts +3 -1
  21. package/dist/agent/save-queue/index.d.ts.map +1 -1
  22. package/dist/agent/test-utils.d.ts +37 -0
  23. package/dist/agent/test-utils.d.ts.map +1 -1
  24. package/dist/agent/trip-wire.d.ts +38 -4
  25. package/dist/agent/trip-wire.d.ts.map +1 -1
  26. package/dist/agent/types.d.ts +46 -14
  27. package/dist/agent/types.d.ts.map +1 -1
  28. package/dist/agent/utils.d.ts +4 -5
  29. package/dist/agent/utils.d.ts.map +1 -1
  30. package/dist/agent/workflows/prepare-stream/index.d.ts +37 -13
  31. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  32. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +3 -3
  33. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  34. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +34 -11
  35. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  36. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +2 -1
  37. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  38. package/dist/agent/workflows/prepare-stream/schema.d.ts +38 -15
  39. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  40. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +11 -1
  41. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  42. package/dist/base.cjs +2 -2
  43. package/dist/base.js +1 -1
  44. package/dist/bundler/index.cjs +2 -2
  45. package/dist/bundler/index.js +1 -1
  46. package/dist/cache/index.cjs +3 -3
  47. package/dist/cache/index.js +1 -1
  48. package/dist/{chunk-JUBFO5J3.js → chunk-2ULLRN4Y.js} +16333 -11839
  49. package/dist/chunk-2ULLRN4Y.js.map +1 -0
  50. package/dist/{chunk-OJNJA5ZI.js → chunk-3CKZSDTQ.js} +3 -3
  51. package/dist/{chunk-OJNJA5ZI.js.map → chunk-3CKZSDTQ.js.map} +1 -1
  52. package/dist/chunk-3E3ILV6T.cjs +518 -0
  53. package/dist/chunk-3E3ILV6T.cjs.map +1 -0
  54. package/dist/{chunk-TQTAMPSC.js → chunk-3N3QE4ZK.js} +3 -3
  55. package/dist/chunk-3N3QE4ZK.js.map +1 -0
  56. package/dist/{chunk-QUKUN6NR.cjs → chunk-4JKEUSCC.cjs} +107 -7
  57. package/dist/chunk-4JKEUSCC.cjs.map +1 -0
  58. package/dist/{chunk-MSWTA73A.cjs → chunk-52RSUALV.cjs} +16490 -11957
  59. package/dist/chunk-52RSUALV.cjs.map +1 -0
  60. package/dist/chunk-5PAEYE3Q.js +513 -0
  61. package/dist/chunk-5PAEYE3Q.js.map +1 -0
  62. package/dist/{chunk-ECFXGXWO.cjs → chunk-5Q6WAYEY.cjs} +695 -375
  63. package/dist/chunk-5Q6WAYEY.cjs.map +1 -0
  64. package/dist/{chunk-CBAB7GOD.cjs → chunk-6BJ7XHRH.cjs} +2 -2
  65. package/dist/{chunk-CBAB7GOD.cjs.map → chunk-6BJ7XHRH.cjs.map} +1 -1
  66. package/dist/{chunk-GRBGQ2GE.js → chunk-6TBWJV35.js} +5 -3
  67. package/dist/chunk-6TBWJV35.js.map +1 -0
  68. package/dist/chunk-6XCINXZ7.cjs +194 -0
  69. package/dist/chunk-6XCINXZ7.cjs.map +1 -0
  70. package/dist/{chunk-E7K4FTLN.cjs → chunk-72YCRTEX.cjs} +18 -2
  71. package/dist/chunk-72YCRTEX.cjs.map +1 -0
  72. package/dist/{chunk-W7UH2PWL.js → chunk-7P6BNIJH.js} +1142 -331
  73. package/dist/chunk-7P6BNIJH.js.map +1 -0
  74. package/dist/{chunk-76K3IYWM.js → chunk-ADADLFDR.js} +3 -3
  75. package/dist/{chunk-76K3IYWM.js.map → chunk-ADADLFDR.js.map} +1 -1
  76. package/dist/{chunk-DSNPWVIG.cjs → chunk-AF74UXR5.cjs} +4 -3
  77. package/dist/chunk-AF74UXR5.cjs.map +1 -0
  78. package/dist/{chunk-GGYKYORQ.cjs → chunk-BJXKH4LG.cjs} +407 -22
  79. package/dist/chunk-BJXKH4LG.cjs.map +1 -0
  80. package/dist/{chunk-2ZVKF4HP.cjs → chunk-BUKY6CTR.cjs} +1147 -334
  81. package/dist/chunk-BUKY6CTR.cjs.map +1 -0
  82. package/dist/chunk-BWYU7D33.js +192 -0
  83. package/dist/chunk-BWYU7D33.js.map +1 -0
  84. package/dist/{chunk-XEVG546F.js → chunk-C36YRTZ6.js} +178 -12
  85. package/dist/chunk-C36YRTZ6.js.map +1 -0
  86. package/dist/{chunk-CB575O6L.cjs → chunk-CZEJQSWB.cjs} +473 -124
  87. package/dist/chunk-CZEJQSWB.cjs.map +1 -0
  88. package/dist/chunk-DD2VNRQM.js +62 -0
  89. package/dist/chunk-DD2VNRQM.js.map +1 -0
  90. package/dist/{chunk-KEXGB7FK.cjs → chunk-DGV2FWB4.cjs} +7 -7
  91. package/dist/{chunk-KEXGB7FK.cjs.map → chunk-DGV2FWB4.cjs.map} +1 -1
  92. package/dist/{chunk-Y63IFHEZ.cjs → chunk-EOPEDKLG.cjs} +4 -4
  93. package/dist/chunk-EOPEDKLG.cjs.map +1 -0
  94. package/dist/{chunk-UIZSWUKP.js → chunk-F2GAJSBI.js} +105 -7
  95. package/dist/chunk-F2GAJSBI.js.map +1 -0
  96. package/dist/{chunk-4CDL2QJT.js → chunk-IVV5TOMD.js} +122 -37
  97. package/dist/chunk-IVV5TOMD.js.map +1 -0
  98. package/dist/{chunk-MV7KHWUT.js → chunk-JIGDJK2O.js} +391 -15
  99. package/dist/chunk-JIGDJK2O.js.map +1 -0
  100. package/dist/chunk-KJBMTK5B.cjs +64 -0
  101. package/dist/chunk-KJBMTK5B.cjs.map +1 -0
  102. package/dist/{chunk-S6URFGCZ.js → chunk-LSHPJWM5.js} +3 -3
  103. package/dist/{chunk-S6URFGCZ.js.map → chunk-LSHPJWM5.js.map} +1 -1
  104. package/dist/chunk-MGCGWPQJ.cjs +275 -0
  105. package/dist/chunk-MGCGWPQJ.cjs.map +1 -0
  106. package/dist/chunk-MRFUISXC.cjs +4981 -0
  107. package/dist/chunk-MRFUISXC.cjs.map +1 -0
  108. package/dist/{chunk-KJ2SW6VA.js → chunk-NRUZYMHE.js} +4 -3
  109. package/dist/chunk-NRUZYMHE.js.map +1 -0
  110. package/dist/{chunk-CINNK34N.js → chunk-O2BJW7YA.js} +26 -11
  111. package/dist/chunk-O2BJW7YA.js.map +1 -0
  112. package/dist/chunk-OEIVMCWX.js +4959 -0
  113. package/dist/chunk-OEIVMCWX.js.map +1 -0
  114. package/dist/{chunk-WM6CK2F3.cjs → chunk-PG5H6QIO.cjs} +131 -49
  115. package/dist/chunk-PG5H6QIO.cjs.map +1 -0
  116. package/dist/{chunk-JPGVRWWL.js → chunk-PK2A5WBG.js} +472 -125
  117. package/dist/chunk-PK2A5WBG.js.map +1 -0
  118. package/dist/{chunk-X7JMA3IY.js → chunk-PSCMWPLC.js} +2 -2
  119. package/dist/{chunk-X7JMA3IY.js.map → chunk-PSCMWPLC.js.map} +1 -1
  120. package/dist/{chunk-VOY2RXOC.cjs → chunk-S73Z3PBJ.cjs} +182 -15
  121. package/dist/chunk-S73Z3PBJ.cjs.map +1 -0
  122. package/dist/{chunk-MA7TEM62.cjs → chunk-SCUWP4II.cjs} +769 -27
  123. package/dist/chunk-SCUWP4II.cjs.map +1 -0
  124. package/dist/{chunk-JV2KH24V.js → chunk-SXNQRJQD.js} +695 -375
  125. package/dist/chunk-SXNQRJQD.js.map +1 -0
  126. package/dist/{chunk-BMAFVZ2D.cjs → chunk-T2VLUFGG.cjs} +4 -4
  127. package/dist/{chunk-BMAFVZ2D.cjs.map → chunk-T2VLUFGG.cjs.map} +1 -1
  128. package/dist/chunk-THZTRBFS.js +268 -0
  129. package/dist/chunk-THZTRBFS.js.map +1 -0
  130. package/dist/{chunk-VOQ3ULMT.js → chunk-U3XOLEPX.js} +759 -17
  131. package/dist/chunk-U3XOLEPX.js.map +1 -0
  132. package/dist/{chunk-Y6ROD72V.cjs → chunk-UIGRFDO6.cjs} +4 -4
  133. package/dist/{chunk-Y6ROD72V.cjs.map → chunk-UIGRFDO6.cjs.map} +1 -1
  134. package/dist/{chunk-H6CZGPZD.js → chunk-US2U7ECW.js} +179 -38
  135. package/dist/chunk-US2U7ECW.js.map +1 -0
  136. package/dist/{chunk-J7O6WENZ.cjs → chunk-UVHSM2GU.cjs} +6 -2
  137. package/dist/chunk-UVHSM2GU.cjs.map +1 -0
  138. package/dist/{chunk-CD56CXVE.cjs → chunk-WTSZBHIZ.cjs} +32 -17
  139. package/dist/chunk-WTSZBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-KIZIOFZC.js → chunk-Y36Y5MTD.js} +17 -3
  141. package/dist/chunk-Y36Y5MTD.js.map +1 -0
  142. package/dist/{chunk-DNEURYF3.cjs → chunk-YC6PJEPH.cjs} +206 -65
  143. package/dist/chunk-YC6PJEPH.cjs.map +1 -0
  144. package/dist/{chunk-IQO7ANVS.cjs → chunk-YWMMBIOM.cjs} +21 -20
  145. package/dist/chunk-YWMMBIOM.cjs.map +1 -0
  146. package/dist/{chunk-I4CXL4SR.js → chunk-Z57R5WS4.js} +16 -15
  147. package/dist/chunk-Z57R5WS4.js.map +1 -0
  148. package/dist/deployer/index.cjs +2 -2
  149. package/dist/deployer/index.js +1 -1
  150. package/dist/di/index.cjs +10 -2
  151. package/dist/di/index.d.ts +1 -1
  152. package/dist/di/index.d.ts.map +1 -1
  153. package/dist/di/index.js +1 -1
  154. package/dist/evals/base.d.ts +10 -2
  155. package/dist/evals/base.d.ts.map +1 -1
  156. package/dist/evals/base.test-utils.d.ts +25 -25
  157. package/dist/evals/index.cjs +9 -9
  158. package/dist/evals/index.js +2 -2
  159. package/dist/evals/scoreTraces/index.cjs +7 -6
  160. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  161. package/dist/evals/scoreTraces/index.js +4 -3
  162. package/dist/evals/scoreTraces/index.js.map +1 -1
  163. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  164. package/dist/evals/types.d.ts +25 -24
  165. package/dist/evals/types.d.ts.map +1 -1
  166. package/dist/index.cjs +2 -2
  167. package/dist/index.js +1 -1
  168. package/dist/integration/index.cjs +2 -2
  169. package/dist/integration/index.js +1 -1
  170. package/dist/llm/index.cjs +30 -10
  171. package/dist/llm/index.d.ts +2 -0
  172. package/dist/llm/index.d.ts.map +1 -1
  173. package/dist/llm/index.js +5 -1
  174. package/dist/llm/model/aisdk/v5/model.d.ts +47 -0
  175. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -0
  176. package/dist/llm/model/base.types.d.ts +2 -2
  177. package/dist/llm/model/base.types.d.ts.map +1 -1
  178. package/dist/llm/model/gateway-resolver.d.ts.map +1 -1
  179. package/dist/llm/model/gateways/azure.d.ts +36 -0
  180. package/dist/llm/model/gateways/azure.d.ts.map +1 -0
  181. package/dist/llm/model/gateways/base.d.ts +9 -4
  182. package/dist/llm/model/gateways/base.d.ts.map +1 -1
  183. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  184. package/dist/llm/model/gateways/index.d.ts +4 -1
  185. package/dist/llm/model/gateways/index.d.ts.map +1 -1
  186. package/dist/llm/model/gateways/models-dev.d.ts +3 -2
  187. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  188. package/dist/llm/model/gateways/netlify.d.ts +4 -3
  189. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  190. package/dist/llm/model/is-v2-model.d.ts +3 -0
  191. package/dist/llm/model/is-v2-model.d.ts.map +1 -0
  192. package/dist/llm/model/model-method-from-agent.d.ts +4 -0
  193. package/dist/llm/model/model-method-from-agent.d.ts.map +1 -0
  194. package/dist/llm/model/model.d.ts.map +1 -1
  195. package/dist/llm/model/model.loop.d.ts +2 -2
  196. package/dist/llm/model/model.loop.d.ts.map +1 -1
  197. package/dist/llm/model/model.loop.types.d.ts +4 -2
  198. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  199. package/dist/llm/model/provider-options.d.ts +4 -1
  200. package/dist/llm/model/provider-options.d.ts.map +1 -1
  201. package/dist/llm/model/provider-registry.d.ts +11 -1
  202. package/dist/llm/model/provider-registry.d.ts.map +1 -1
  203. package/dist/llm/model/provider-types.generated.d.ts +489 -27
  204. package/dist/llm/model/registry-generator.d.ts +12 -0
  205. package/dist/llm/model/registry-generator.d.ts.map +1 -1
  206. package/dist/llm/model/resolve-model.d.ts +1 -1
  207. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  208. package/dist/llm/model/router.d.ts +12 -5
  209. package/dist/llm/model/router.d.ts.map +1 -1
  210. package/dist/llm/model/shared.types.d.ts +17 -6
  211. package/dist/llm/model/shared.types.d.ts.map +1 -1
  212. package/dist/logger/constants.d.ts +1 -0
  213. package/dist/logger/constants.d.ts.map +1 -1
  214. package/dist/logger/index.cjs +11 -11
  215. package/dist/logger/index.js +2 -2
  216. package/dist/logger/transport.d.ts +1 -1
  217. package/dist/logger/transport.d.ts.map +1 -1
  218. package/dist/loop/index.cjs +2 -2
  219. package/dist/loop/index.js +1 -1
  220. package/dist/loop/loop.d.ts.map +1 -1
  221. package/dist/loop/network/index.d.ts.map +1 -1
  222. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +37 -0
  223. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -0
  224. package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
  225. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  226. package/dist/loop/test-utils/options.d.ts.map +1 -1
  227. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  228. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  229. package/dist/loop/test-utils/textStream.d.ts.map +1 -1
  230. package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
  231. package/dist/loop/test-utils/tools.d.ts.map +1 -1
  232. package/dist/loop/test-utils/utils.d.ts +1 -1
  233. package/dist/loop/test-utils/utils.d.ts.map +1 -1
  234. package/dist/loop/types.d.ts +42 -20
  235. package/dist/loop/types.d.ts.map +1 -1
  236. package/dist/loop/workflows/agentic-execution/index.d.ts +60 -42
  237. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  238. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +41 -29
  239. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  240. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +20 -14
  241. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  242. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  243. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  244. package/dist/loop/workflows/agentic-loop/index.d.ts +62 -43
  245. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  246. package/dist/loop/workflows/run-state.d.ts +2 -2
  247. package/dist/loop/workflows/run-state.d.ts.map +1 -1
  248. package/dist/loop/workflows/schema.d.ts +32 -15
  249. package/dist/loop/workflows/schema.d.ts.map +1 -1
  250. package/dist/loop/workflows/stream.d.ts +1 -1
  251. package/dist/loop/workflows/stream.d.ts.map +1 -1
  252. package/dist/mastra/index.cjs +2 -2
  253. package/dist/mastra/index.d.ts +377 -12
  254. package/dist/mastra/index.d.ts.map +1 -1
  255. package/dist/mastra/index.js +1 -1
  256. package/dist/mcp/index.cjs +4 -4
  257. package/dist/mcp/index.cjs.map +1 -1
  258. package/dist/mcp/index.d.ts +4 -4
  259. package/dist/mcp/index.d.ts.map +1 -1
  260. package/dist/mcp/index.js +2 -2
  261. package/dist/mcp/index.js.map +1 -1
  262. package/dist/mcp/types.d.ts +2 -2
  263. package/dist/mcp/types.d.ts.map +1 -1
  264. package/dist/memory/index.cjs +21 -327
  265. package/dist/memory/index.cjs.map +1 -1
  266. package/dist/memory/index.js +1 -327
  267. package/dist/memory/index.js.map +1 -1
  268. package/dist/memory/memory.d.ts +28 -18
  269. package/dist/memory/memory.d.ts.map +1 -1
  270. package/dist/memory/mock.d.ts +15 -14
  271. package/dist/memory/mock.d.ts.map +1 -1
  272. package/dist/memory/types.d.ts +69 -11
  273. package/dist/memory/types.d.ts.map +1 -1
  274. package/dist/models-dev-23RN2WHG.js +3 -0
  275. package/dist/{models-dev-DNBKXHT4.js.map → models-dev-23RN2WHG.js.map} +1 -1
  276. package/dist/models-dev-EO3SUIY2.cjs +12 -0
  277. package/dist/{models-dev-YBEEQIX6.cjs.map → models-dev-EO3SUIY2.cjs.map} +1 -1
  278. package/dist/netlify-GXJ5D5DD.js +3 -0
  279. package/dist/{netlify-7G2L5VSH.js.map → netlify-GXJ5D5DD.js.map} +1 -1
  280. package/dist/netlify-KJLY3GFS.cjs +12 -0
  281. package/dist/{netlify-GWNGSIRZ.cjs.map → netlify-KJLY3GFS.cjs.map} +1 -1
  282. package/dist/observability/index.cjs +16 -8
  283. package/dist/observability/index.js +1 -1
  284. package/dist/observability/types/tracing.d.ts +236 -13
  285. package/dist/observability/types/tracing.d.ts.map +1 -1
  286. package/dist/observability/utils.d.ts +47 -1
  287. package/dist/observability/utils.d.ts.map +1 -1
  288. package/dist/processors/index.cjs +115 -11
  289. package/dist/processors/index.d.ts +246 -26
  290. package/dist/processors/index.d.ts.map +1 -1
  291. package/dist/processors/index.js +1 -1
  292. package/dist/processors/memory/index.d.ts +7 -0
  293. package/dist/processors/memory/index.d.ts.map +1 -0
  294. package/dist/processors/memory/message-history.d.ts +43 -0
  295. package/dist/processors/memory/message-history.d.ts.map +1 -0
  296. package/dist/processors/memory/semantic-recall.d.ts +152 -0
  297. package/dist/processors/memory/semantic-recall.d.ts.map +1 -0
  298. package/dist/processors/memory/working-memory.d.ts +65 -0
  299. package/dist/processors/memory/working-memory.d.ts.map +1 -0
  300. package/dist/processors/processors/batch-parts.d.ts +1 -1
  301. package/dist/processors/processors/batch-parts.d.ts.map +1 -1
  302. package/dist/processors/processors/index.d.ts +2 -1
  303. package/dist/processors/processors/index.d.ts.map +1 -1
  304. package/dist/processors/processors/language-detector.d.ts +15 -1
  305. package/dist/processors/processors/language-detector.d.ts.map +1 -1
  306. package/dist/processors/processors/moderation.d.ts +15 -1
  307. package/dist/processors/processors/moderation.d.ts.map +1 -1
  308. package/dist/processors/processors/pii-detector.d.ts +15 -1
  309. package/dist/processors/processors/pii-detector.d.ts.map +1 -1
  310. package/dist/processors/processors/prepare-step.d.ts +12 -0
  311. package/dist/processors/processors/prepare-step.d.ts.map +1 -0
  312. package/dist/processors/processors/prompt-injection-detector.d.ts +15 -1
  313. package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
  314. package/dist/processors/processors/structured-output.d.ts +7 -5
  315. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  316. package/dist/processors/processors/system-prompt-scrubber.d.ts +1 -1
  317. package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
  318. package/dist/processors/processors/token-limiter.d.ts +22 -12
  319. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  320. package/dist/processors/processors/tool-call-filter.d.ts +28 -0
  321. package/dist/processors/processors/tool-call-filter.d.ts.map +1 -0
  322. package/dist/processors/processors/unicode-normalizer.d.ts +1 -1
  323. package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
  324. package/dist/processors/runner.d.ts +83 -9
  325. package/dist/processors/runner.d.ts.map +1 -1
  326. package/dist/processors/step-schema.d.ts +49731 -0
  327. package/dist/processors/step-schema.d.ts.map +1 -0
  328. package/dist/provider-registry-3TG2KUD2.cjs +40 -0
  329. package/dist/provider-registry-3TG2KUD2.cjs.map +1 -0
  330. package/dist/provider-registry-F67Y6OF2.js +3 -0
  331. package/dist/provider-registry-F67Y6OF2.js.map +1 -0
  332. package/dist/provider-registry.json +1056 -61
  333. package/dist/{registry-generator-MK63POJO.cjs → registry-generator-34SC4TAU.cjs} +23 -6
  334. package/dist/registry-generator-34SC4TAU.cjs.map +1 -0
  335. package/dist/{registry-generator-H4YNODDH.js → registry-generator-UMTNPBJX.js} +23 -7
  336. package/dist/registry-generator-UMTNPBJX.js.map +1 -0
  337. package/dist/relevance/index.cjs +2 -2
  338. package/dist/relevance/index.js +1 -1
  339. package/dist/request-context/index.cjs +10 -2
  340. package/dist/request-context/index.d.ts +26 -0
  341. package/dist/request-context/index.d.ts.map +1 -1
  342. package/dist/request-context/index.js +1 -1
  343. package/dist/server/auth.d.ts +11 -0
  344. package/dist/server/auth.d.ts.map +1 -1
  345. package/dist/server/base.d.ts +51 -0
  346. package/dist/server/base.d.ts.map +1 -0
  347. package/dist/server/composite-auth.d.ts +9 -0
  348. package/dist/server/composite-auth.d.ts.map +1 -0
  349. package/dist/server/index.cjs +124 -3
  350. package/dist/server/index.cjs.map +1 -1
  351. package/dist/server/index.d.ts +8 -0
  352. package/dist/server/index.d.ts.map +1 -1
  353. package/dist/server/index.js +121 -3
  354. package/dist/server/index.js.map +1 -1
  355. package/dist/server/simple-auth.d.ts +27 -0
  356. package/dist/server/simple-auth.d.ts.map +1 -0
  357. package/dist/server/types.d.ts +6 -0
  358. package/dist/server/types.d.ts.map +1 -1
  359. package/dist/storage/base.d.ts +76 -3
  360. package/dist/storage/base.d.ts.map +1 -1
  361. package/dist/storage/constants.d.ts +3 -1
  362. package/dist/storage/constants.d.ts.map +1 -1
  363. package/dist/storage/domains/agents/base.d.ts +49 -0
  364. package/dist/storage/domains/agents/base.d.ts.map +1 -0
  365. package/dist/storage/domains/agents/index.d.ts +3 -0
  366. package/dist/storage/domains/agents/index.d.ts.map +1 -0
  367. package/dist/storage/domains/agents/inmemory.d.ts +22 -0
  368. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -0
  369. package/dist/storage/domains/index.d.ts +1 -0
  370. package/dist/storage/domains/index.d.ts.map +1 -1
  371. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  372. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  373. package/dist/storage/domains/scores/base.d.ts +2 -2
  374. package/dist/storage/domains/scores/base.d.ts.map +1 -1
  375. package/dist/storage/domains/scores/inmemory.d.ts +2 -2
  376. package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
  377. package/dist/storage/domains/workflows/base.d.ts +4 -0
  378. package/dist/storage/domains/workflows/base.d.ts.map +1 -1
  379. package/dist/storage/domains/workflows/inmemory.d.ts +5 -1
  380. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  381. package/dist/storage/index.cjs +65 -29
  382. package/dist/storage/index.js +1 -1
  383. package/dist/storage/mock.d.ts +7 -2
  384. package/dist/storage/mock.d.ts.map +1 -1
  385. package/dist/storage/storageWithInit.d.ts.map +1 -1
  386. package/dist/storage/types.d.ts +88 -5
  387. package/dist/storage/types.d.ts.map +1 -1
  388. package/dist/storage/utils.d.ts +82 -0
  389. package/dist/storage/utils.d.ts.map +1 -1
  390. package/dist/stream/MastraAgentNetworkStream.d.ts +2 -2
  391. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  392. package/dist/stream/MastraWorkflowStream.d.ts +2 -2
  393. package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
  394. package/dist/stream/RunOutput.d.ts +2 -2
  395. package/dist/stream/RunOutput.d.ts.map +1 -1
  396. package/dist/stream/aisdk/v4/transform.d.ts.map +1 -1
  397. package/dist/stream/aisdk/v4/usage.d.ts +19 -0
  398. package/dist/stream/aisdk/v4/usage.d.ts.map +1 -0
  399. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  400. package/dist/stream/aisdk/v5/execute.d.ts +9 -5
  401. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  402. package/dist/stream/aisdk/v5/input.d.ts +4 -1
  403. package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
  404. package/dist/stream/aisdk/v5/output-helpers.d.ts +5 -1
  405. package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -1
  406. package/dist/stream/aisdk/v5/output.d.ts +11 -13
  407. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  408. package/dist/stream/aisdk/v5/transform.d.ts +2 -1
  409. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  410. package/dist/stream/base/base.d.ts +1 -1
  411. package/dist/stream/base/base.d.ts.map +1 -1
  412. package/dist/stream/base/input.d.ts +1 -1
  413. package/dist/stream/base/output-format-handlers.d.ts +14 -1
  414. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  415. package/dist/stream/base/output.d.ts +9 -14
  416. package/dist/stream/base/output.d.ts.map +1 -1
  417. package/dist/stream/index.cjs +15 -11
  418. package/dist/stream/index.d.ts +2 -2
  419. package/dist/stream/index.d.ts.map +1 -1
  420. package/dist/stream/index.js +2 -2
  421. package/dist/stream/types.d.ts +97 -32
  422. package/dist/stream/types.d.ts.map +1 -1
  423. package/dist/test-utils/llm-mock.cjs +101 -30
  424. package/dist/test-utils/llm-mock.cjs.map +1 -1
  425. package/dist/test-utils/llm-mock.d.ts +7 -2
  426. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  427. package/dist/test-utils/llm-mock.js +97 -30
  428. package/dist/test-utils/llm-mock.js.map +1 -1
  429. package/dist/tools/index.cjs +6 -6
  430. package/dist/tools/index.js +2 -2
  431. package/dist/tools/is-vercel-tool.cjs +2 -2
  432. package/dist/tools/is-vercel-tool.js +1 -1
  433. package/dist/tools/stream.d.ts +10 -4
  434. package/dist/tools/stream.d.ts.map +1 -1
  435. package/dist/tools/tool-builder/builder.d.ts +2 -0
  436. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  437. package/dist/tools/tool-stream-types.test-d.d.ts +2 -0
  438. package/dist/tools/tool-stream-types.test-d.d.ts.map +1 -0
  439. package/dist/tools/tool.d.ts +21 -8
  440. package/dist/tools/tool.d.ts.map +1 -1
  441. package/dist/tools/types.d.ts +33 -6
  442. package/dist/tools/types.d.ts.map +1 -1
  443. package/dist/tools/validation.d.ts +25 -1
  444. package/dist/tools/validation.d.ts.map +1 -1
  445. package/dist/tts/index.cjs +2 -2
  446. package/dist/tts/index.js +1 -1
  447. package/dist/types/zod-compat.d.ts +14 -1
  448. package/dist/types/zod-compat.d.ts.map +1 -1
  449. package/dist/utils.cjs +25 -21
  450. package/dist/utils.d.ts +9 -4
  451. package/dist/utils.d.ts.map +1 -1
  452. package/dist/utils.js +1 -1
  453. package/dist/vector/filter/index.cjs +7 -189
  454. package/dist/vector/filter/index.cjs.map +1 -1
  455. package/dist/vector/filter/index.js +1 -190
  456. package/dist/vector/filter/index.js.map +1 -1
  457. package/dist/vector/index.cjs +7 -2
  458. package/dist/vector/index.cjs.map +1 -1
  459. package/dist/vector/index.d.ts +1 -0
  460. package/dist/vector/index.d.ts.map +1 -1
  461. package/dist/vector/index.js +2 -1
  462. package/dist/vector/index.js.map +1 -1
  463. package/dist/vector/types.d.ts +86 -3
  464. package/dist/vector/types.d.ts.map +1 -1
  465. package/dist/vector/vector.d.ts +39 -2
  466. package/dist/vector/vector.d.ts.map +1 -1
  467. package/dist/voice/aisdk/index.d.ts +3 -0
  468. package/dist/voice/aisdk/index.d.ts.map +1 -0
  469. package/dist/voice/aisdk/speech.d.ts +23 -0
  470. package/dist/voice/aisdk/speech.d.ts.map +1 -0
  471. package/dist/voice/aisdk/transcription.d.ts +22 -0
  472. package/dist/voice/aisdk/transcription.d.ts.map +1 -0
  473. package/dist/voice/composite-voice.d.ts +4 -3
  474. package/dist/voice/composite-voice.d.ts.map +1 -1
  475. package/dist/voice/index.cjs +12 -4
  476. package/dist/voice/index.d.ts +1 -0
  477. package/dist/voice/index.d.ts.map +1 -1
  478. package/dist/voice/index.js +1 -1
  479. package/dist/workflows/default.d.ts +180 -270
  480. package/dist/workflows/default.d.ts.map +1 -1
  481. package/dist/workflows/evented/execution-engine.d.ts +3 -1
  482. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  483. package/dist/workflows/evented/index.cjs +10 -10
  484. package/dist/workflows/evented/index.js +1 -1
  485. package/dist/workflows/evented/step-executor.d.ts +1 -1
  486. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  487. package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -4
  488. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  489. package/dist/workflows/evented/workflow-event-processor/loop.d.ts +1 -1
  490. package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
  491. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
  492. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts.map +1 -1
  493. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
  494. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts.map +1 -1
  495. package/dist/workflows/evented/workflow.d.ts +2 -1
  496. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  497. package/dist/workflows/execution-engine.d.ts +8 -6
  498. package/dist/workflows/execution-engine.d.ts.map +1 -1
  499. package/dist/workflows/handlers/control-flow.d.ts +133 -0
  500. package/dist/workflows/handlers/control-flow.d.ts.map +1 -0
  501. package/dist/workflows/handlers/entry.d.ts +43 -0
  502. package/dist/workflows/handlers/entry.d.ts.map +1 -0
  503. package/dist/workflows/handlers/sleep.d.ts +60 -0
  504. package/dist/workflows/handlers/sleep.d.ts.map +1 -0
  505. package/dist/workflows/handlers/step.d.ts +58 -0
  506. package/dist/workflows/handlers/step.d.ts.map +1 -0
  507. package/dist/workflows/index.cjs +40 -16
  508. package/dist/workflows/index.js +1 -1
  509. package/dist/workflows/step.d.ts +8 -6
  510. package/dist/workflows/step.d.ts.map +1 -1
  511. package/dist/workflows/types.d.ts +257 -10
  512. package/dist/workflows/types.d.ts.map +1 -1
  513. package/dist/workflows/utils.d.ts +36 -0
  514. package/dist/workflows/utils.d.ts.map +1 -1
  515. package/dist/workflows/workflow.d.ts +146 -55
  516. package/dist/workflows/workflow.d.ts.map +1 -1
  517. package/package.json +26 -30
  518. package/src/llm/model/provider-types.generated.d.ts +489 -27
  519. package/dist/chunk-2ZVKF4HP.cjs.map +0 -1
  520. package/dist/chunk-436FFEF6.js +0 -34
  521. package/dist/chunk-436FFEF6.js.map +0 -1
  522. package/dist/chunk-4CDL2QJT.js.map +0 -1
  523. package/dist/chunk-7AHYOMHJ.js +0 -149
  524. package/dist/chunk-7AHYOMHJ.js.map +0 -1
  525. package/dist/chunk-CB575O6L.cjs.map +0 -1
  526. package/dist/chunk-CD56CXVE.cjs.map +0 -1
  527. package/dist/chunk-CINNK34N.js.map +0 -1
  528. package/dist/chunk-DNEURYF3.cjs.map +0 -1
  529. package/dist/chunk-DSNPWVIG.cjs.map +0 -1
  530. package/dist/chunk-E7K4FTLN.cjs.map +0 -1
  531. package/dist/chunk-ECFXGXWO.cjs.map +0 -1
  532. package/dist/chunk-ET6UOTTU.cjs +0 -154
  533. package/dist/chunk-ET6UOTTU.cjs.map +0 -1
  534. package/dist/chunk-GGYKYORQ.cjs.map +0 -1
  535. package/dist/chunk-GRBGQ2GE.js.map +0 -1
  536. package/dist/chunk-H6CZGPZD.js.map +0 -1
  537. package/dist/chunk-HDJFSJCK.js +0 -2237
  538. package/dist/chunk-HDJFSJCK.js.map +0 -1
  539. package/dist/chunk-HGNRQ3OG.js +0 -58
  540. package/dist/chunk-HGNRQ3OG.js.map +0 -1
  541. package/dist/chunk-I4CXL4SR.js.map +0 -1
  542. package/dist/chunk-IQO7ANVS.cjs.map +0 -1
  543. package/dist/chunk-J7O6WENZ.cjs.map +0 -1
  544. package/dist/chunk-JPGVRWWL.js.map +0 -1
  545. package/dist/chunk-JUBFO5J3.js.map +0 -1
  546. package/dist/chunk-JV2KH24V.js.map +0 -1
  547. package/dist/chunk-KIZIOFZC.js.map +0 -1
  548. package/dist/chunk-KJ2SW6VA.js.map +0 -1
  549. package/dist/chunk-LJFJTTZQ.cjs +0 -4
  550. package/dist/chunk-LJFJTTZQ.cjs.map +0 -1
  551. package/dist/chunk-LRSB62Z6.cjs +0 -60
  552. package/dist/chunk-LRSB62Z6.cjs.map +0 -1
  553. package/dist/chunk-LWBQ4P4N.cjs +0 -2240
  554. package/dist/chunk-LWBQ4P4N.cjs.map +0 -1
  555. package/dist/chunk-MA7TEM62.cjs.map +0 -1
  556. package/dist/chunk-MSWTA73A.cjs.map +0 -1
  557. package/dist/chunk-MV7KHWUT.js.map +0 -1
  558. package/dist/chunk-QUKUN6NR.cjs.map +0 -1
  559. package/dist/chunk-TQTAMPSC.js.map +0 -1
  560. package/dist/chunk-UIZSWUKP.js.map +0 -1
  561. package/dist/chunk-V3VLOOSW.cjs +0 -36
  562. package/dist/chunk-V3VLOOSW.cjs.map +0 -1
  563. package/dist/chunk-VOQ3ULMT.js.map +0 -1
  564. package/dist/chunk-VOY2RXOC.cjs.map +0 -1
  565. package/dist/chunk-W7UH2PWL.js.map +0 -1
  566. package/dist/chunk-WM6CK2F3.cjs.map +0 -1
  567. package/dist/chunk-XEVG546F.js.map +0 -1
  568. package/dist/chunk-Y63IFHEZ.cjs.map +0 -1
  569. package/dist/chunk-ZV5CC35D.js +0 -3
  570. package/dist/chunk-ZV5CC35D.js.map +0 -1
  571. package/dist/models-dev-DNBKXHT4.js +0 -3
  572. package/dist/models-dev-YBEEQIX6.cjs +0 -12
  573. package/dist/netlify-7G2L5VSH.js +0 -3
  574. package/dist/netlify-GWNGSIRZ.cjs +0 -12
  575. package/dist/registry-generator-H4YNODDH.js.map +0 -1
  576. package/dist/registry-generator-MK63POJO.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,1221 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 1.0.0-beta.11
4
+
5
+ ### Minor Changes
6
+
7
+ - Respect structured outputs for v2 models so tool schemas aren’t stripped ([#11038](https://github.com/mastra-ai/mastra/pull/11038))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fix type safety for message ordering - restrict `orderBy` to only accept `'createdAt'` field ([#11069](https://github.com/mastra-ai/mastra/pull/11069))
12
+
13
+ Messages don't have an `updatedAt` field, but the previous type allowed ordering by it, which would return empty results. This change adds compile-time type safety by making `StorageOrderBy` generic and restricting `StorageListMessagesInput.orderBy` to only accept `'createdAt'`. The API validation schemas have also been updated to reject invalid orderBy values at runtime.
14
+
15
+ - Loosen tools types in processInputStep / prepareStep. ([#11071](https://github.com/mastra-ai/mastra/pull/11071))
16
+
17
+ - Added the ability to provide a base path for Mastra Studio. ([#10441](https://github.com/mastra-ai/mastra/pull/10441))
18
+
19
+ ```ts
20
+ import { Mastra } from '@mastra/core';
21
+
22
+ export const mastra = new Mastra({
23
+ server: {
24
+ studioBase: '/my-mastra-studio',
25
+ },
26
+ });
27
+ ```
28
+
29
+ This will make Mastra Studio available at `http://localhost:4111/my-mastra-studio`.
30
+
31
+ - Expand `processInputStep` processor method and integrate `prepareStep` as a processor ([#10774](https://github.com/mastra-ai/mastra/pull/10774))
32
+
33
+ **New Features:**
34
+ - `prepareStep` callback now runs through the standard `processInputStep` pipeline
35
+ - Processors can now modify per-step: `model`, `tools`, `toolChoice`, `activeTools`, `messages`, `systemMessages`, `providerOptions`, `modelSettings`, and `structuredOutput`
36
+ - Processor chaining: each processor receives accumulated state from previous processors
37
+ - System messages are isolated per-step (reset at start of each step)
38
+
39
+ **Breaking Change:**
40
+ - `prepareStep` messages format changed from AI SDK v5 model messages to `MastraDBMessage` format
41
+ - Migration: Use `messageList.get.all.aiV5.model()` if you need the old format
42
+
43
+ - Multiple Processor improvements including: ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
44
+ - Workflows can now return tripwires, they bubble up from agents that return tripwires in a step
45
+ - You can write processors as workflows using the existing Workflow primitive, every processor flow is now a workflow.
46
+ - tripwires that you throw can now return additional information including ability to retry the step
47
+ - New processor method `processOutputStep` added which runs after every step.
48
+
49
+ **What's new:**
50
+
51
+ **1. Retry mechanism with LLM feedback** - Processors can now request retries with feedback that gets sent back to the LLM:
52
+
53
+ ```typescript
54
+ processOutputStep: async ({ text, abort, retryCount }) => {
55
+ if (isLowQuality(text)) {
56
+ abort('Response quality too low', { retry: true, metadata: { score: 0.6 } });
57
+ }
58
+ return [];
59
+ };
60
+ ```
61
+
62
+ Configure with `maxProcessorRetries` (default: 3). Rejected steps are preserved in `result.steps[n].tripwire`. Retries are only available in `processOutputStep` and `processInputStep`. It will replay the step with additional context added.
63
+
64
+ **2. Workflow orchestration for processors** - Processors can now be composed using workflow primitives:
65
+
66
+ ```typescript
67
+ import { createStep, createWorkflow } from '@mastra/core/workflows';
68
+ import {
69
+ ProcessorStepSchema,
70
+ } from '@mastra/core/processors';
71
+
72
+ const moderationWorkflow = createWorkflow({ id: 'moderation', inputSchema: ProcessorStepSchema, outputSchema: ProcessorStepSchema })
73
+ .then(createStep(new lengthValidator({...})))
74
+ .parallel([createStep(new piiDetector({...}), createStep(new toxicityChecker({...}))])
75
+ .commit();
76
+
77
+ const agent = new Agent({ inputProcessors: [moderationWorkflow] });
78
+ ```
79
+
80
+ Every processor array that gets passed to an agent gets added as a workflow
81
+ <img width="614" height="673" alt="image" src="https://github.com/user-attachments/assets/0d79f1fd-8fca-4d86-8b45-22fddea984a8" />
82
+
83
+ **3. Extended tripwire API** - `abort()` now accepts options for retry control and typed metadata:
84
+
85
+ ```typescript
86
+ abort('reason', { retry: true, metadata: { score: 0.8, category: 'quality' } });
87
+ ```
88
+
89
+ **4. New `processOutputStep` method** - Per-step output processing with access to step number, finish reason, tool calls, and retry count.
90
+
91
+ **5. Workflow tripwire status** - Workflows now have a `'tripwire'` status distinct from `'failed'`, properly bubbling up processor rejections.
92
+
93
+ ## 1.0.0-beta.10
94
+
95
+ ### Patch Changes
96
+
97
+ - Add support for typed structured output in agent workflow steps ([#11014](https://github.com/mastra-ai/mastra/pull/11014))
98
+
99
+ When wrapping an agent with `createStep()` and providing a `structuredOutput.schema`, the step's `outputSchema` is now correctly inferred from the provided schema instead of defaulting to `{ text: string }`.
100
+
101
+ This enables type-safe chaining of agent steps with structured output to subsequent steps:
102
+
103
+ ```typescript
104
+ const articleSchema = z.object({
105
+ title: z.string(),
106
+ summary: z.string(),
107
+ tags: z.array(z.string()),
108
+ });
109
+
110
+ // Agent step with structured output - outputSchema is now articleSchema
111
+ const agentStep = createStep(agent, {
112
+ structuredOutput: { schema: articleSchema },
113
+ });
114
+
115
+ // Next step can receive the structured output directly
116
+ const processStep = createStep({
117
+ id: 'process',
118
+ inputSchema: articleSchema, // Matches agent's outputSchema
119
+ outputSchema: z.object({ tagCount: z.number() }),
120
+ execute: async ({ inputData }) => ({
121
+ tagCount: inputData.tags.length, // Fully typed!
122
+ }),
123
+ });
124
+
125
+ workflow.then(agentStep).then(processStep).commit();
126
+ ```
127
+
128
+ When `structuredOutput` is not provided, the agent step continues to use the default `{ text: string }` output schema.
129
+
130
+ - Fixed a bug where multiple tools streaming output simultaneously could fail with "WritableStreamDefaultWriter is locked" errors. Tool streaming now works reliably during concurrent tool executions. ([#10830](https://github.com/mastra-ai/mastra/pull/10830))
131
+
132
+ - Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
133
+
134
+ ```typescript
135
+ await workflow.deleteWorkflowRunById(runId);
136
+ ```
137
+
138
+ - Fixed CachedToken tracking in all Observability Exporters. Also fixed TimeToFirstToken in Langfuse, Braintrust, PostHog exporters. Fixed trace formatting in Posthog Exporter. ([#11029](https://github.com/mastra-ai/mastra/pull/11029))
139
+
140
+ - fix: persist data-\* chunks from writer.custom() to memory storage ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
141
+ - Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools
142
+ - Data chunks are now saved to message storage so they survive page refreshes
143
+ - Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
144
+ - Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
145
+ - Update related `@assistant-ui/*` packages for compatibility
146
+
147
+ - Fixed double validation bug that prevented Zod transforms from working correctly in tool schemas. ([#11025](https://github.com/mastra-ai/mastra/pull/11025))
148
+
149
+ When tools with Zod `.transform()` or `.pipe()` in their `outputSchema` were executed through the Agent pipeline, validation was happening twice - once in Tool.execute() (correct) and again in CoreToolBuilder (incorrect). The second validation received already-transformed data but expected pre-transform data, causing validation errors.
150
+
151
+ This fix enables proper use of Zod transforms in both `inputSchema` (for normalizing/cleaning input data) and `outputSchema` (for transforming output data to be LLM-friendly).
152
+
153
+ - Updated dependencies [[`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932)]:
154
+ - @mastra/observability@1.0.0-beta.4
155
+
156
+ ## 1.0.0-beta.9
157
+
158
+ ### Minor Changes
159
+
160
+ - Add stored agents support ([#10953](https://github.com/mastra-ai/mastra/pull/10953))
161
+
162
+ Agents can now be stored in the database and loaded at runtime. This lets you persist agent configurations and dynamically create executable Agent instances from storage.
163
+
164
+ ```typescript
165
+ import { Mastra } from '@mastra/core';
166
+ import { LibSQLStore } from '@mastra/libsql';
167
+
168
+ const mastra = new Mastra({
169
+ storage: new LibSQLStore({ url: ':memory:' }),
170
+ tools: { myTool },
171
+ scorers: { myScorer },
172
+ });
173
+
174
+ // Create agent in storage via API or directly
175
+ await mastra.getStorage().createAgent({
176
+ agent: {
177
+ id: 'my-agent',
178
+ name: 'My Agent',
179
+ instructions: 'You are helpful',
180
+ model: { provider: 'openai', name: 'gpt-4' },
181
+ tools: { myTool: {} },
182
+ scorers: { myScorer: { sampling: { type: 'ratio', rate: 0.5 } } },
183
+ },
184
+ });
185
+
186
+ // Load and use the agent
187
+ const agent = await mastra.getStoredAgentById('my-agent');
188
+ const response = await agent.generate({ messages: 'Hello!' });
189
+
190
+ // List all stored agents with pagination
191
+ const { agents, total, hasMore } = await mastra.listStoredAgents({
192
+ page: 0,
193
+ perPage: 10,
194
+ });
195
+ ```
196
+
197
+ Also adds a memory registry to Mastra so stored agents can reference memory instances by key.
198
+
199
+ ### Patch Changes
200
+
201
+ - Add agentId and agentName attributes to MODEL_GENERATION spans. This allows users to correlate gen_ai.usage metrics with specific agents when analyzing LLM operation spans. The attributes are exported as gen_ai.agent.id and gen_ai.agent.name in the OtelExporter. ([#10984](https://github.com/mastra-ai/mastra/pull/10984))
202
+
203
+ - Fix JSON parsing errors when LLMs output unescaped newlines in structured output strings ([#10965](https://github.com/mastra-ai/mastra/pull/10965))
204
+
205
+ Some LLMs (particularly when not using native JSON mode) output actual newline characters inside JSON string values instead of properly escaped `\n` sequences. This breaks JSON parsing and causes structured output to fail.
206
+
207
+ This change adds preprocessing to escape unescaped control characters (`\n`, `\r`, `\t`) within JSON string values before parsing, making structured output more robust across different LLM providers.
208
+
209
+ - Fix toolCallId propagation in agent network tool execution. The toolCallId property was undefined at runtime despite being required by TypeScript type definitions in AgentToolExecutionContext. Now properly passes the toolCallId through to the tool's context during network tool execution. ([#10951](https://github.com/mastra-ai/mastra/pull/10951))
210
+
211
+ - Exports `convertFullStreamChunkToMastra` from the stream module for AI SDK stream chunk transformations. ([#10911](https://github.com/mastra-ai/mastra/pull/10911))
212
+
213
+ ## 1.0.0-beta.8
214
+
215
+ ### Patch Changes
216
+
217
+ - Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
218
+
219
+ **What Changed**
220
+ - saveScore now correctly returns scores that can be retrieved with getScoreById
221
+ - Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
222
+
223
+ **Impact**
224
+ 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.
225
+
226
+ - `setState` is now async ([#10944](https://github.com/mastra-ai/mastra/pull/10944))
227
+ - `setState` must now be awaited: `await setState({ key: value })`
228
+ - State updates are merged automatically—no need to spread the previous state
229
+ - State data is validated against the step's `stateSchema` when `validateInputs` is enabled (default: `true`)
230
+
231
+ - Add human-in-the-loop support for workflows used in agent ([#10871](https://github.com/mastra-ai/mastra/pull/10871))
232
+
233
+ ## 1.0.0-beta.7
234
+
235
+ ### Minor Changes
236
+
237
+ - Add `disableInit` option to all storage adapters ([#10851](https://github.com/mastra-ai/mastra/pull/10851))
238
+
239
+ Adds a new `disableInit` config option to all storage providers that allows users to disable automatic table creation/migrations at runtime. This is useful for CI/CD pipelines where you want to run migrations during deployment with elevated credentials, then run the application with `disableInit: true` so it doesn't attempt schema changes at runtime.
240
+
241
+ ```typescript
242
+ // CI/CD script - run migrations
243
+ const storage = new PostgresStore({
244
+ connectionString: DATABASE_URL,
245
+ id: 'pg-storage',
246
+ });
247
+ await storage.init();
248
+
249
+ // Runtime - skip auto-init
250
+ const storage = new PostgresStore({
251
+ connectionString: DATABASE_URL,
252
+ id: 'pg-storage',
253
+ disableInit: true,
254
+ });
255
+ ```
256
+
257
+ ### Patch Changes
258
+
259
+ - Add time-to-first-token (TTFT) support for Langfuse integration ([#10781](https://github.com/mastra-ai/mastra/pull/10781))
260
+
261
+ Adds `completionStartTime` to model generation spans, which Langfuse uses to calculate TTFT metrics. The timestamp is automatically captured when the first content chunk arrives during streaming.
262
+
263
+ ```typescript
264
+ // completionStartTime is now automatically captured and sent to Langfuse
265
+ // enabling TTFT metrics in your Langfuse dashboard
266
+ const result = await agent.stream('Hello');
267
+ ```
268
+
269
+ - Updated OtelExporters, Bridge, and Arize packages to better implement GenAI v1.38.0 Otel Semantic Conventions. See: ([#10591](https://github.com/mastra-ai/mastra/pull/10591))
270
+ https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/README.md
271
+
272
+ - Standardize error IDs across all storage and vector stores using centralized helper functions (`createStorageErrorId` and `createVectorErrorId`). This ensures consistent error ID patterns (`MASTRA_STORAGE_{STORE}_{OPERATION}_{STATUS}` and `MASTRA_VECTOR_{STORE}_{OPERATION}_{STATUS}`) across the codebase for better error tracking and debugging. ([#10913](https://github.com/mastra-ai/mastra/pull/10913))
273
+
274
+ - fix: generate unique text IDs for Anthropic/Google providers ([#10740](https://github.com/mastra-ai/mastra/pull/10740))
275
+
276
+ Workaround for duplicate text-start/text-end IDs in multi-step agentic flows.
277
+
278
+ The `@ai-sdk/anthropic` and `@ai-sdk/google` providers use numeric indices ("0", "1", etc.) for text block IDs that reset for each LLM call. This caused duplicate IDs when an agent does TEXT → TOOL → TEXT, breaking message ordering and storage.
279
+
280
+ The fix replaces numeric IDs with UUIDs, maintaining a map per step so text-start, text-delta, and text-end chunks for the same block share the same UUID. OpenAI's UUIDs pass through unchanged.
281
+
282
+ Related: #9909
283
+
284
+ - Fix sub-agent requestContext propagation in listAgentTools ([#10844](https://github.com/mastra-ai/mastra/pull/10844))
285
+
286
+ Sub-agents with dynamic model configurations were broken because `requestContext` was not being passed to `getModel()` when creating agent tools. This caused sub-agents using function-based model configurations to receive an empty context instead of the parent's context.
287
+
288
+ No code changes required for consumers - this fix restores expected behavior for dynamic model configurations in sub-agents.
289
+
290
+ - Fix ToolStream type error when piping streams with different types ([#10845](https://github.com/mastra-ai/mastra/pull/10845))
291
+
292
+ Changes `ToolStream` to extend `WritableStream<unknown>` instead of `WritableStream<T>`. This fixes the TypeScript error when piping `objectStream` or `fullStream` to `writer` in workflow steps.
293
+
294
+ Before:
295
+
296
+ ```typescript
297
+ // TypeError: ToolStream<ChunkType> is not assignable to WritableStream<Partial<StoryPlan>>
298
+ await response.objectStream.pipeTo(writer);
299
+ ```
300
+
301
+ After:
302
+
303
+ ```typescript
304
+ // Works without type errors
305
+ await response.objectStream.pipeTo(writer);
306
+ ```
307
+
308
+ - feat: add native Perplexity provider support ([#10885](https://github.com/mastra-ai/mastra/pull/10885))
309
+
310
+ - When sending the first message to a new thread with PostgresStore, users would get a "Thread not found" error. This happened because the thread was created in memory but not persisted to the database before the MessageHistory output processor tried to save messages. ([#10881](https://github.com/mastra-ai/mastra/pull/10881))
311
+
312
+ **Before:**
313
+
314
+ ```ts
315
+ threadObject = await memory.createThread({
316
+ // ...
317
+ saveThread: false, // thread not in DB yet
318
+ });
319
+ // Later: MessageHistory calls saveMessages() -> PostgresStore throws "Thread not found"
320
+ ```
321
+
322
+ **After:**
323
+
324
+ ```ts
325
+ threadObject = await memory.createThread({
326
+ // ...
327
+ saveThread: true, // thread persisted immediately
328
+ });
329
+ // MessageHistory can now save messages without error
330
+ ```
331
+
332
+ - Emit error chunk and call onError when agent workflow step fails ([#10907](https://github.com/mastra-ai/mastra/pull/10907))
333
+
334
+ When a workflow step fails (e.g., tool not found), the error is now properly emitted as an error chunk to the stream and the onError callback is called. This fixes the issue where agent.generate() would throw "promise 'text' was not resolved or rejected" instead of the actual error message.
335
+
336
+ - fix(core): use agent description when converting agent to tool ([#10879](https://github.com/mastra-ai/mastra/pull/10879))
337
+
338
+ - Adds native @ai-sdk/deepseek provider support instead of using the OpenAI-compatible fallback. ([#10822](https://github.com/mastra-ai/mastra/pull/10822))
339
+
340
+ ```typescript
341
+ const agent = new Agent({
342
+ model: 'deepseek/deepseek-reasoner',
343
+ });
344
+
345
+ // With provider options for reasoning
346
+ const response = await agent.generate('Solve this problem', {
347
+ providerOptions: {
348
+ deepseek: {
349
+ thinking: { type: 'enabled' },
350
+ },
351
+ },
352
+ });
353
+ ```
354
+
355
+ Also updates the doc generation scripts so DeepSeek provider options show up in the generated docs.
356
+
357
+ - Return state too if `includeState: true` is in `outputOptions` and workflow run is not successful ([#10806](https://github.com/mastra-ai/mastra/pull/10806))
358
+
359
+ - feat: Add partial response support for agent and workflow list endpoints ([#10886](https://github.com/mastra-ai/mastra/pull/10886))
360
+
361
+ Add optional `partial` query parameter to `/api/agents` and `/api/workflows` endpoints to return minimal data without schemas, reducing payload size for list views:
362
+ - When `partial=true`: tool schemas (inputSchema, outputSchema) are omitted
363
+ - When `partial=true`: workflow steps are replaced with stepCount integer
364
+ - When `partial=true`: workflow root schemas (inputSchema, outputSchema) are omitted
365
+ - Maintains backward compatibility when partial parameter is not provided
366
+
367
+ ## Server Endpoint Usage
368
+
369
+ ```http
370
+ # Get partial agent data (no tool schemas)
371
+ GET /api/agents?partial=true
372
+
373
+ # Get full agent data (default behavior)
374
+ GET /api/agents
375
+
376
+ # Get partial workflow data (stepCount instead of steps, no schemas)
377
+ GET /api/workflows?partial=true
378
+
379
+ # Get full workflow data (default behavior)
380
+ GET /api/workflows
381
+ ```
382
+
383
+ ## Client SDK Usage
384
+
385
+ ```typescript
386
+ import { MastraClient } from '@mastra/client-js';
387
+
388
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
389
+
390
+ // Get partial agent list (smaller payload)
391
+ const partialAgents = await client.listAgents({ partial: true });
392
+
393
+ // Get full agent list with tool schemas
394
+ const fullAgents = await client.listAgents();
395
+
396
+ // Get partial workflow list (smaller payload)
397
+ const partialWorkflows = await client.listWorkflows({ partial: true });
398
+
399
+ // Get full workflow list with steps and schemas
400
+ const fullWorkflows = await client.listWorkflows();
401
+ ```
402
+
403
+ - Fix processInputStep so it runs correctly. ([#10909](https://github.com/mastra-ai/mastra/pull/10909))
404
+
405
+ - Updated dependencies [[`6c59a40`](https://github.com/mastra-ai/mastra/commit/6c59a40e0ad160467bd13d63a8a287028d75b02d), [`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`0bada2f`](https://github.com/mastra-ai/mastra/commit/0bada2f2c1234932cf30c1c47a719ffb64b801c5), [`cc60ff6`](https://github.com/mastra-ai/mastra/commit/cc60ff616541a3b0fb531a7e469bf9ae7bb90528)]:
406
+ - @mastra/observability@1.0.0-beta.3
407
+
408
+ ## 1.0.0-beta.6
409
+
410
+ ### Major Changes
411
+
412
+ - Changed `.branch()` result schema to make all branch output fields optional. ([#10693](https://github.com/mastra-ai/mastra/pull/10693))
413
+
414
+ **Breaking change**: Branch outputs are now optional since only one branch executes at runtime. Update your workflow schemas to handle optional branch results.
415
+
416
+ **Before:**
417
+
418
+ ```typescript
419
+ const workflow = createWorkflow({...})
420
+ .branch([
421
+ [condition1, stepA], // outputSchema: { result: z.string() }
422
+ [condition2, stepB], // outputSchema: { data: z.number() }
423
+ ])
424
+ .map({
425
+ finalResult: { step: stepA, path: 'result' } // Expected non-optional
426
+ });
427
+ ```
428
+
429
+ **After:**
430
+
431
+ ```typescript
432
+ const workflow = createWorkflow({...})
433
+ .branch([
434
+ [condition1, stepA],
435
+ [condition2, stepB],
436
+ ])
437
+ .map({
438
+ finalResult: {
439
+ step: stepA,
440
+ path: 'result' // Now optional - provide fallback
441
+ }
442
+ });
443
+ ```
444
+
445
+ **Why**: Branch conditionals execute only one path, so non-executed branches don't produce outputs. The type system now correctly reflects this runtime behavior.
446
+
447
+ Related issue: https://github.com/mastra-ai/mastra/issues/10642
448
+
449
+ ### Minor Changes
450
+
451
+ - Memory system now uses processors. Memory processors (`MessageHistory`, `SemanticRecall`, `WorkingMemory`) are now exported from `@mastra/memory/processors` and automatically added to the agent pipeline based on your memory config. Core processors (`ToolCallFilter`, `TokenLimiter`) remain in `@mastra/core/processors`. ([#9254](https://github.com/mastra-ai/mastra/pull/9254))
452
+
453
+ - Add reserved keys in RequestContext for secure resourceId/threadId setting from middleware ([#10657](https://github.com/mastra-ai/mastra/pull/10657))
454
+
455
+ This allows middleware to securely set `resourceId` and `threadId` via reserved keys in RequestContext (`MASTRA_RESOURCE_ID_KEY` and `MASTRA_THREAD_ID_KEY`), which take precedence over client-provided values for security.
456
+
457
+ - feat(workflows): add suspendData parameter to step execute function ([#10734](https://github.com/mastra-ai/mastra/pull/10734))
458
+
459
+ Adds a new `suspendData` parameter to workflow step execute functions that provides access to the data originally passed to `suspend()` when the step was suspended. This enables steps to access context about why they were suspended when they are later resumed.
460
+
461
+ **New Features:**
462
+ - `suspendData` parameter automatically populated in step execute function when resuming
463
+ - Type-safe access to suspend data matching the step's `suspendSchema`
464
+ - Backward compatible - existing workflows continue to work unchanged
465
+
466
+ **Example:**
467
+
468
+ ```typescript
469
+ const step = createStep({
470
+ suspendSchema: z.object({ reason: z.string() }),
471
+ resumeSchema: z.object({ approved: z.boolean() }),
472
+ execute: async ({ suspend, suspendData, resumeData }) => {
473
+ if (!resumeData?.approved) {
474
+ return await suspend({ reason: 'Approval required' });
475
+ }
476
+
477
+ // Access original suspend data when resuming
478
+ console.log(`Resuming after: ${suspendData?.reason}`);
479
+ return { result: 'Approved' };
480
+ },
481
+ });
482
+ ```
483
+
484
+ - feat(storage): support querying messages from multiple threads ([#10663](https://github.com/mastra-ai/mastra/pull/10663))
485
+ - Fixed TypeScript errors where `threadId: string | string[]` was being passed to places expecting `Scalar` type
486
+ - Added proper multi-thread support for `listMessages` across all adapters when `threadId` is an array
487
+ - Updated `_getIncludedMessages` to look up message threadId by ID (since message IDs are globally unique)
488
+ - **upstash**: Added `msg-idx:{messageId}` index for O(1) message lookups (backwards compatible with fallback to scan for old messages, with automatic backfill)
489
+
490
+ - Adds trace tagging support to the BrainTrust and Langfuse tracing exporters. ([#10765](https://github.com/mastra-ai/mastra/pull/10765))
491
+
492
+ - Add `messageList` parameter to `processOutputStream` for accessing remembered messages during streaming ([#10608](https://github.com/mastra-ai/mastra/pull/10608))
493
+
494
+ - Unify transformScoreRow functions across storage adapters ([#10648](https://github.com/mastra-ai/mastra/pull/10648))
495
+
496
+ Added a unified `transformScoreRow` function in `@mastra/core/storage` that provides schema-driven row transformation for score data. This eliminates code duplication across 10 storage adapters while maintaining store-specific behavior through configurable options:
497
+ - `preferredTimestampFields`: Preferred source fields for timestamps (PostgreSQL, Cloudflare D1)
498
+ - `convertTimestamps`: Convert timestamp strings to Date objects (MSSQL, MongoDB, ClickHouse)
499
+ - `nullValuePattern`: Skip values matching pattern (ClickHouse's `'_null_'`)
500
+ - `fieldMappings`: Map source column names to schema fields (LibSQL's `additionalLLMContext`)
501
+
502
+ Each store adapter now uses the unified function with appropriate options, reducing ~200 lines of duplicate transformation logic while ensuring consistent behavior across all storage backends.
503
+
504
+ ### Patch Changes
505
+
506
+ - dependencies updates: ([#10110](https://github.com/mastra-ai/mastra/pull/10110))
507
+ - Updated dependency [`hono-openapi@^1.1.1` ↗︎](https://www.npmjs.com/package/hono-openapi/v/1.1.1) (from `^0.4.8`, in `dependencies`)
508
+
509
+ - unexpected json parse issue, log error but dont fail ([#10241](https://github.com/mastra-ai/mastra/pull/10241))
510
+
511
+ - Fixed a bug in agent networks where sometimes the task name was empty ([#10629](https://github.com/mastra-ai/mastra/pull/10629))
512
+
513
+ - Adds `tool-result` and `tool-error` chunks to the processor.processOutputStream path. Processors now have access to these two chunks. ([#10645](https://github.com/mastra-ai/mastra/pull/10645))
514
+
515
+ - Include `.input` in workflow results for both engines and remove the option to omit them from Inngest workflows. ([#10688](https://github.com/mastra-ai/mastra/pull/10688))
516
+
517
+ - `getSpeakers` endpoint returns an empty array if voice is not configured on the agent and `getListeners` endpoint returns `{ enabled: false }` if voice is not figured on the agent. ([#10560](https://github.com/mastra-ai/mastra/pull/10560))
518
+
519
+ When no voice is set on agent don't throw error, by default set voice to undefined rather than DefaultVoice which throws errors when it is accessed.
520
+
521
+ - SimpleAuth and improved CloudAuth ([#10490](https://github.com/mastra-ai/mastra/pull/10490))
522
+
523
+ - When LLMs like Claude Sonnet 4.5 and Gemini 2.4 call tools with all-optional parameters, they send `args: undefined` instead of `args: {}`. This caused validation to fail with "root: Required". ([#10728](https://github.com/mastra-ai/mastra/pull/10728))
524
+
525
+ The fix normalizes `undefined`/`null` to `{}` for object schemas and `[]` for array schemas before validation.
526
+
527
+ - Fixed tool validation error messages so logs show Zod validation errors directly instead of hiding them inside structured JSON. ([#10579](https://github.com/mastra-ai/mastra/pull/10579))
528
+
529
+ - Fix error when spreading config objects in Mastra constructor ([#10718](https://github.com/mastra-ai/mastra/pull/10718))
530
+
531
+ Adds validation guards to handle undefined/null values that can occur when config objects are spread (`{ ...config }`). Previously, if getters or non-enumerable properties resulted in undefined values during spread, the constructor would throw cryptic errors when accessing `.id` or `.name` on undefined objects.
532
+
533
+ - Fix GPT-5/o3 reasoning models failing with "required reasoning item" errors when using memory with tools. Empty reasoning is now stored with providerMetadata to preserve OpenAI's item_reference. ([#10585](https://github.com/mastra-ai/mastra/pull/10585))
534
+
535
+ - Fix generateTitle model type to accept AI SDK LanguageModelV2 ([#10541](https://github.com/mastra-ai/mastra/pull/10541))
536
+
537
+ Updated the `generateTitle.model` config option to accept `MastraModelConfig` instead of `MastraLanguageModel`. This allows users to pass raw AI SDK `LanguageModelV2` models (e.g., `anthropic.languageModel('claude-3-5-haiku-20241022')`) directly without type errors.
538
+
539
+ Previously, passing a standard `LanguageModelV2` would fail because `MastraLanguageModelV2` has different `doGenerate`/`doStream` return types. Now `MastraModelConfig` is used consistently across:
540
+ - `memory/types.ts` - `generateTitle.model` config
541
+ - `agent.ts` - `genTitle`, `generateTitleFromUserMessage`, `resolveTitleGenerationConfig`
542
+ - `agent-legacy.ts` - `AgentLegacyCapabilities` interface
543
+
544
+ - Fix message ordering when using toAISdkV5Messages or prepareStep ([#10686](https://github.com/mastra-ai/mastra/pull/10686))
545
+
546
+ Messages without `createdAt` timestamps were getting shuffled because they all received identical timestamps during conversion. Now messages are assigned monotonically increasing timestamps via `generateCreatedAt()`, preserving input order.
547
+
548
+ Before:
549
+
550
+ ```
551
+ Input: [user: "hello", assistant: "Hi!", user: "bye"]
552
+ Output: [user: "bye", assistant: "Hi!", user: "hello"] // shuffled!
553
+ ```
554
+
555
+ After:
556
+
557
+ ```
558
+ Input: [user: "hello", assistant: "Hi!", user: "bye"]
559
+ Output: [user: "hello", assistant: "Hi!", user: "bye"] // correct order
560
+ ```
561
+
562
+ - Fix Scorer not using custom gateways registered with Mastra ([#10778](https://github.com/mastra-ai/mastra/pull/10778))
563
+
564
+ Scorers now have access to custom gateways when resolving models. Previously, calling `resolveModelConfig` in the scorer didn't pass the Mastra instance, so custom gateways were never available.
565
+
566
+ - Fix workflow run status not being updated from storage snapshot in createRun ([#10664](https://github.com/mastra-ai/mastra/pull/10664))
567
+
568
+ When createRun is called with an existing runId, it now correctly updates the run's status from the storage snapshot. This fixes the issue where different workflow instances (e.g., different API requests) would get a run with 'pending' status instead of the correct status from storage (e.g., 'suspended').
569
+
570
+ - Pass resourceId and threadId to network agent's subAgent when it has its own memory ([#10592](https://github.com/mastra-ai/mastra/pull/10592))
571
+
572
+ - use `agent.getMemory` to fetch the memory instance on the Agent class to make sure that storage gets set if memory doesn't set it itself. ([#10556](https://github.com/mastra-ai/mastra/pull/10556))
573
+
574
+ - Built-in processors that use internal agents (PromptInjectionDetector, ModerationProcessor, PIIDetector, LanguageDetector, StructuredOutputProcessor) now accept `providerOptions` to control model behavior. ([#10651](https://github.com/mastra-ai/mastra/pull/10651))
575
+
576
+ This lets you pass provider-specific settings like `reasoningEffort` for OpenAI thinking models:
577
+
578
+ ```typescript
579
+ const processor = new PromptInjectionDetector({
580
+ model: 'openai/o1-mini',
581
+ threshold: 0.7,
582
+ strategy: 'block',
583
+ providerOptions: {
584
+ openai: {
585
+ reasoningEffort: 'low',
586
+ },
587
+ },
588
+ });
589
+ ```
590
+
591
+ - Improved typing for `workflow.then` to allow the provided steps `inputSchema` to be a subset of the previous steps `outputSchema`. Also errors if the provided steps `inputSchema` is a superset of the previous steps outputSchema. ([#10763](https://github.com/mastra-ai/mastra/pull/10763))
592
+
593
+ - Fix type issue with workflow `.parallel()` when passing multiple steps, one or more of which has a `resumeSchema` provided. ([#10708](https://github.com/mastra-ai/mastra/pull/10708))
594
+
595
+ - Adds bidirectional integration with otel tracing via a new @mastra/otel-bridge package. ([#10482](https://github.com/mastra-ai/mastra/pull/10482))
596
+
597
+ - Adds `processInputStep` method to the Processor interface. Unlike `processInput` which runs once at the start, this runs at each step of the agentic loop (including tool call continuations). ([#10650](https://github.com/mastra-ai/mastra/pull/10650))
598
+
599
+ ```ts
600
+ const processor: Processor = {
601
+ id: 'my-processor',
602
+ processInputStep: async ({ messages, messageList, stepNumber, systemMessages }) => {
603
+ // Transform messages at each step before LLM call
604
+ return messageList;
605
+ },
606
+ };
607
+ ```
608
+
609
+ - When using output processors with `agent.generate()`, `result.text` was returning the unprocessed LLM response instead of the processed text. ([#10735](https://github.com/mastra-ai/mastra/pull/10735))
610
+
611
+ **Before:**
612
+
613
+ ```ts
614
+ const result = await agent.generate('hello');
615
+ result.text; // "hello world" (unprocessed)
616
+ result.response.messages[0].content[0].text; // "HELLO WORLD" (processed)
617
+ ```
618
+
619
+ **After:**
620
+
621
+ ```ts
622
+ const result = await agent.generate('hello');
623
+ result.text; // "HELLO WORLD" (processed)
624
+ ```
625
+
626
+ The bug was caused by the `text` delayed promise being resolved twice - first correctly with the processed text, then overwritten with the unprocessed buffered text.
627
+
628
+ - Refactored default engine to fit durable execution better, and the inngest engine to match. ([#10627](https://github.com/mastra-ai/mastra/pull/10627))
629
+ Also fixes requestContext persistence by relying on inngest step memoization.
630
+
631
+ Unifies some of the stepResults and error formats in both engines.
632
+
633
+ - Allow direct access to server app handle directly from Mastra instance. ([#10598](https://github.com/mastra-ai/mastra/pull/10598))
634
+
635
+ ```ts
636
+ // Before: HTTP request to localhost
637
+ const response = await fetch(`http://localhost:5000/api/tools`);
638
+
639
+ // After: Direct call via app.fetch()
640
+ const app = mastra.getServerApp<Hono>();
641
+ const response = await app.fetch(new Request('http://internal/api/tools'));
642
+ ```
643
+
644
+ - Added `mastra.getServerApp<T>()` to access the underlying Hono/Express app
645
+ - Added `mastra.getMastraServer()` and `mastra.setMastraServer()` for adapter access
646
+ - Added `MastraServerBase` class in `@mastra/core/server` for adapter implementations
647
+ - Server adapters now auto-register with Mastra in their constructor
648
+
649
+ - Fix network agent not getting `text-delta` from subAgent when `.stream` is used ([#10533](https://github.com/mastra-ai/mastra/pull/10533))
650
+
651
+ - Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
652
+
653
+ - Fix writer.custom not working during workflow resume operations ([#10720](https://github.com/mastra-ai/mastra/pull/10720))
654
+
655
+ When a workflow step is resumed, the writer parameter was not being properly passed through, causing writer.custom() calls to fail. This fix ensures the writableStream parameter is correctly passed to both run.resume() and run.start() calls in the workflow execution engine, allowing custom events to be emitted properly during resume operations.
656
+
657
+ - Fix corrupted provider-registry.json file in global cache and regenerate corrupted files ([#10606](https://github.com/mastra-ai/mastra/pull/10606))
658
+
659
+ - Fix TypeScript error when using Zod schemas in `defaultOptions.structuredOutput` ([#10710](https://github.com/mastra-ai/mastra/pull/10710))
660
+
661
+ Previously, defining `structuredOutput.schema` in `defaultOptions` would cause a TypeScript error because the type only accepted `undefined`. Now any valid `OutputSchema` is correctly accepted.
662
+
663
+ - Add support for `providerOptions` when defining tools. This allows developers to specify provider-specific configurations (like Anthropic's `cacheControl`) per tool. ([#10649](https://github.com/mastra-ai/mastra/pull/10649))
664
+
665
+ ```typescript
666
+ createTool({
667
+ id: 'my-tool',
668
+ providerOptions: {
669
+ anthropic: { cacheControl: { type: 'ephemeral' } },
670
+ },
671
+ // ...
672
+ });
673
+ ```
674
+
675
+ - Fixed OpenAI reasoning message merging so distinct reasoning items are no longer dropped when they share a message ID. Prevents downstream errors where a function call is missing its required "reasoning" item. See #9005. ([#10614](https://github.com/mastra-ai/mastra/pull/10614))
676
+
677
+ - Updated dependencies [[`103586c`](https://github.com/mastra-ai/mastra/commit/103586cb23ebcd2466c7f68a71674d37cc10e263), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8)]:
678
+ - @mastra/observability@1.0.0-beta.2
679
+ - @mastra/schema-compat@1.0.0-beta.2
680
+
681
+ ## 1.0.0-beta.5
682
+
683
+ ### Patch Changes
684
+
685
+ - Add Azure OpenAI gateway ([#9990](https://github.com/mastra-ai/mastra/pull/9990))
686
+
687
+ The Azure OpenAI gateway supports three configuration modes:
688
+ 1. **Static deployments**: Provide deployment names from Azure Portal
689
+ 2. **Dynamic discovery**: Query Azure Management API for available deployments
690
+ 3. **Manual**: Specify deployment names when creating agents
691
+
692
+ ## Usage
693
+
694
+ ```typescript
695
+ import { Mastra } from '@mastra/core';
696
+ import { AzureOpenAIGateway } from '@mastra/core/llm';
697
+
698
+ // Static mode (recommended)
699
+ export const mastra = new Mastra({
700
+ gateways: [
701
+ new AzureOpenAIGateway({
702
+ resourceName: process.env.AZURE_RESOURCE_NAME!,
703
+ apiKey: process.env.AZURE_API_KEY!,
704
+ deployments: ['gpt-4-prod', 'gpt-35-turbo-dev'],
705
+ }),
706
+ ],
707
+ });
708
+
709
+ // Dynamic discovery mode
710
+ export const mastra = new Mastra({
711
+ gateways: [
712
+ new AzureOpenAIGateway({
713
+ resourceName: process.env.AZURE_RESOURCE_NAME!,
714
+ apiKey: process.env.AZURE_API_KEY!,
715
+ management: {
716
+ tenantId: process.env.AZURE_TENANT_ID!,
717
+ clientId: process.env.AZURE_CLIENT_ID!,
718
+ clientSecret: process.env.AZURE_CLIENT_SECRET!,
719
+ subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
720
+ resourceGroup: 'my-resource-group',
721
+ },
722
+ }),
723
+ ],
724
+ });
725
+
726
+ // Use Azure OpenAI models
727
+ const agent = new Agent({
728
+ model: 'azure-openai/gpt-4-deployment',
729
+ instructions: 'You are a helpful assistant',
730
+ });
731
+ ```
732
+
733
+ - - Fix tool suspension throwing error when `outputSchema` is passed to tool during creation ([#10444](https://github.com/mastra-ai/mastra/pull/10444))
734
+ - Pass `suspendSchema` and `resumeSchema` from tool into step created when creating step from tool
735
+
736
+ - Add `onOutput` hook for tools ([#10466](https://github.com/mastra-ai/mastra/pull/10466))
737
+
738
+ Tools now support an `onOutput` lifecycle hook that is invoked after successful tool execution. This complements the existing `onInputStart`, `onInputDelta`, and `onInputAvailable` hooks to provide complete visibility into the tool execution lifecycle.
739
+
740
+ The `onOutput` hook receives:
741
+ - `output`: The tool's return value (typed according to `outputSchema`)
742
+ - `toolCallId`: Unique identifier for the tool call
743
+ - `toolName`: The name of the tool that was executed
744
+ - `abortSignal`: Signal for detecting if the operation should be cancelled
745
+
746
+ Example usage:
747
+
748
+ ```typescript
749
+ import { createTool } from '@mastra/core/tools';
750
+ import { z } from 'zod';
751
+
752
+ export const weatherTool = createTool({
753
+ id: 'weather-tool',
754
+ description: 'Get weather information',
755
+ outputSchema: z.object({
756
+ temperature: z.number(),
757
+ conditions: z.string(),
758
+ }),
759
+ execute: async input => {
760
+ return { temperature: 72, conditions: 'sunny' };
761
+ },
762
+ onOutput: ({ output, toolCallId, toolName }) => {
763
+ console.log(`${toolName} completed:`, output);
764
+ // output is fully typed based on outputSchema
765
+ },
766
+ });
767
+ ```
768
+
769
+ Hook execution order:
770
+ 1. `onInputStart` - Input streaming begins
771
+ 2. `onInputDelta` - Input chunks arrive (called multiple times)
772
+ 3. `onInputAvailable` - Complete input parsed and validated
773
+ 4. Tool's `execute` function runs
774
+ 5. `onOutput` - Tool completed successfully (NEW)
775
+
776
+ - Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
777
+
778
+ - Fix base64 encoded images with threads - issue #10480 ([#10483](https://github.com/mastra-ai/mastra/pull/10483))
779
+
780
+ Fixed "Invalid URL" error when using base64 encoded images (without `data:` prefix) in agent calls with threads and resources. Raw base64 strings are now automatically converted to proper data URIs before being processed.
781
+
782
+ **Changes:**
783
+ - Updated `attachments-to-parts.ts` to detect and convert raw base64 strings to data URIs
784
+ - Fixed `MessageList` image processing to handle raw base64 in two locations:
785
+ - Image part conversion in `aiV4CoreMessageToV1PromptMessage`
786
+ - File part to experimental_attachments conversion in `mastraDBMessageToAIV4UIMessage`
787
+ - Added comprehensive tests for base64 images, data URIs, and HTTP URLs with threads
788
+
789
+ **Breaking Change:** None - this is a bug fix that maintains backward compatibility while adding support for raw base64 strings.
790
+
791
+ - Fix message metadata not persisting when using simple message format. Previously, custom metadata passed in messages (e.g., `{role: 'user', content: 'text', metadata: {userId: '123'}}`) was not being saved to the database. This occurred because the CoreMessage conversion path didn't preserve metadata fields. ([#10488](https://github.com/mastra-ai/mastra/pull/10488))
792
+
793
+ Now metadata is properly preserved for all message input formats:
794
+ - Simple CoreMessage format: `{role, content, metadata}`
795
+ - Full UIMessage format: `{role, content, parts, metadata}`
796
+ - AI SDK v5 ModelMessage format with metadata
797
+
798
+ Fixes #8556
799
+
800
+ - feat: Composite auth implementation ([#10359](https://github.com/mastra-ai/mastra/pull/10359))
801
+
802
+ - Fix requireApproval property being ignored for tools passed via toolsets, clientTools, and memoryTools parameters. The requireApproval flag now correctly propagates through all tool conversion paths, ensuring tools requiring approval will properly request user approval before execution. ([#10464](https://github.com/mastra-ai/mastra/pull/10464))
803
+
804
+ - Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
805
+
806
+ - Fix Azure Foundry rate limit handling for -1 values ([#10409](https://github.com/mastra-ai/mastra/pull/10409))
807
+
808
+ - Fix model headers not being passed through gateway system ([#10465](https://github.com/mastra-ai/mastra/pull/10465))
809
+
810
+ Previously, custom headers specified in `MastraModelConfig` were not being passed through the gateway system to model providers. This affected:
811
+ - OpenRouter (preventing activity tracking with `HTTP-Referer` and `X-Title`)
812
+ - Custom providers using custom URLs (headers not passed to `createOpenAICompatible`)
813
+ - Custom gateway implementations (headers not available in `resolveLanguageModel`)
814
+
815
+ Now headers are correctly passed through the entire gateway system:
816
+ - Base `MastraModelGateway` interface updated to accept headers
817
+ - `ModelRouterLanguageModel` passes headers from config to all gateways
818
+ - OpenRouter receives headers for activity tracking
819
+ - Custom URL providers receive headers via `createOpenAICompatible`
820
+ - Custom gateways can access headers in their `resolveLanguageModel` implementation
821
+
822
+ Example usage:
823
+
824
+ ```typescript
825
+ // Works with OpenRouter
826
+ const agent = new Agent({
827
+ name: 'my-agent',
828
+ instructions: 'You are a helpful assistant.',
829
+ model: {
830
+ id: 'openrouter/anthropic/claude-3-5-sonnet',
831
+ headers: {
832
+ 'HTTP-Referer': 'https://myapp.com',
833
+ 'X-Title': 'My Application',
834
+ },
835
+ },
836
+ });
837
+
838
+ // Also works with custom providers
839
+ const customAgent = new Agent({
840
+ name: 'custom-agent',
841
+ instructions: 'You are a helpful assistant.',
842
+ model: {
843
+ id: 'custom-provider/model',
844
+ url: 'https://api.custom.com/v1',
845
+ apiKey: 'key',
846
+ headers: {
847
+ 'X-Custom-Header': 'custom-value',
848
+ },
849
+ },
850
+ });
851
+ ```
852
+
853
+ Fixes https://github.com/mastra-ai/mastra/issues/9760
854
+
855
+ - fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
856
+
857
+ Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
858
+
859
+ **Backend changes (@mastra/core):**
860
+ - Add assistant messages to messageList immediately after LLM execution
861
+ - Flush messages synchronously before suspension to persist state
862
+ - Create thread if it doesn't exist before flushing
863
+ - Add metadata helpers to persist and remove tool approval state
864
+ - Pass saveQueueManager and memory context through workflow for immediate persistence
865
+
866
+ **Frontend changes (@mastra/react):**
867
+ - Extract runId from pending approvals to enable resumption after refresh
868
+ - Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
869
+ - Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
870
+ - Change runId from hardcoded `agentId` to unique `uuid()`
871
+
872
+ **UI changes (@mastra/playground-ui):**
873
+ - Handle tool calls awaiting approval in message initialization
874
+ - Convert approval metadata format when loading initial messages
875
+
876
+ Fixes #9745, #9906
877
+
878
+ - Update MockMemory to work with new storage API changes. MockMemory now properly implements all abstract MastraMemory methods. This includes proper thread management, message saving with MessageList conversion, working memory operations with scope support, and resource listing. ([#10368](https://github.com/mastra-ai/mastra/pull/10368))
879
+
880
+ Add Zod v4 support for working memory schemas. Memory implementations now check for Zod v4's built-in `.toJsonSchema()` method before falling back to the `zodToJsonSchema` compatibility function, improving performance and forward compatibility while maintaining backward compatibility with Zod v3.
881
+
882
+ Add Gemini 3 Pro test coverage in agent-gemini.test.ts to validate the latest Gemini model integration.
883
+
884
+ - Fix race condition in parallel tool stream writes ([#10463](https://github.com/mastra-ai/mastra/pull/10463))
885
+
886
+ Introduces a write queue to ToolStream to serialize access to the underlying stream, preventing writer locked errors
887
+
888
+ - Remove unneeded console warning when flushing messages and no threadId or saveQueueManager is found. ([#10498](https://github.com/mastra-ai/mastra/pull/10498))
889
+
890
+ - Add optional includeRawChunks parameter to agent execution options, ([#10456](https://github.com/mastra-ai/mastra/pull/10456))
891
+ allowing users to include raw chunks in stream output where supported
892
+ by the model provider.
893
+
894
+ - When `mastra dev` runs, multiple processes can write to `provider-registry.json` concurrently (auto-refresh, syncGateways, syncGlobalCacheToLocal). This causes file corruption where the end of the JSON appears twice, making it unparseable. ([#10455](https://github.com/mastra-ai/mastra/pull/10455))
895
+
896
+ The fix uses atomic writes via the write-to-temp-then-rename pattern. Instead of:
897
+
898
+ ```ts
899
+ fs.writeFileSync(filePath, content, 'utf-8');
900
+ ```
901
+
902
+ We now do:
903
+
904
+ ```ts
905
+ const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;
906
+ fs.writeFileSync(tempPath, content, 'utf-8');
907
+ fs.renameSync(tempPath, filePath); // atomic on POSIX
908
+ ```
909
+
910
+ `fs.rename()` is atomic on POSIX systems when both paths are on the same filesystem, so concurrent writes will each complete fully rather than interleaving.
911
+
912
+ - Fix .map when placed at the beginning of a workflow or nested workflow ([#10457](https://github.com/mastra-ai/mastra/pull/10457))
913
+
914
+ - Ensures that data chunks written via `writer.custom()` always bubble up directly to the top-level stream, even when nested in sub-agents. This allows tools to emit custom progress updates, metrics, and other data that can be consumed at any level of the agent hierarchy. ([#10309](https://github.com/mastra-ai/mastra/pull/10309))
915
+ - **Added bubbling logic in sub-agent execution**: When sub-agents execute, data chunks (chunks with type starting with `data-`) are detected and written via `writer.custom()` instead of `writer.write()`, ensuring they bubble up directly without being wrapped in `tool-output` chunks.
916
+ - **Added comprehensive tests**:
917
+ - Test for `writer.custom()` with direct tool execution
918
+ - Test for `writer.custom()` with sub-agent tools (nested execution)
919
+ - Test for mixed usage of `writer.write()` and `writer.custom()` in the same tool
920
+
921
+ When a sub-agent's tool uses `writer.custom()` to write data chunks, those chunks appear in the sub-agent's stream. The parent agent's execution logic now detects these chunks and uses `writer.custom()` to bubble them up directly, preserving their structure and making them accessible at the top level.
922
+
923
+ This ensures that:
924
+ - Data chunks from tools always appear directly in the stream (not wrapped)
925
+ - Data chunks bubble up correctly through nested agent hierarchies
926
+ - Regular chunks continue to be wrapped in `tool-output` as expected
927
+
928
+ - Update agent workflow and sub-agent tool transformations to accept more input arguments. ([#10278](https://github.com/mastra-ai/mastra/pull/10278))
929
+
930
+ These tools now accept the following
931
+
932
+ ```
933
+ workflowTool.execute({ inputData, initialState }, context)
934
+
935
+ agentTool.execute({ prompt, threadId, resourceId, instructions, maxSteps }, context)
936
+ ```
937
+
938
+ Workflow tools now also properly return errors when the workflow run fails
939
+
940
+ ```
941
+ const workflowResult = await workflowTool.execute({ inputData, initialState }, context)
942
+
943
+ console.log(workflowResult.error) // error msg if error
944
+ console.log(workflowResult.result) // result of the workflow if success
945
+ ```
946
+
947
+ Workflows passed to agents do not properly handle suspend/resume`, they only handle success or error.
948
+
949
+ - Fixed OpenAI schema compatibility when using `agent.generate()` or `agent.stream()` with `structuredOutput`. ([#10366](https://github.com/mastra-ai/mastra/pull/10366))
950
+
951
+ ## Changes
952
+ - **Automatic transformation**: Zod schemas are now automatically transformed for OpenAI strict mode compatibility when using OpenAI models (including reasoning models like o1, o3, o4)
953
+ - **Optional field handling**: `.optional()` fields are converted to `.nullable()` with a transform that converts `null` → `undefined`, preserving optional semantics while satisfying OpenAI's strict mode requirements
954
+ - **Preserves nullable fields**: Intentionally `.nullable()` fields remain unchanged
955
+ - **Deep transformation**: Handles `.optional()` fields at any nesting level (objects, arrays, unions, etc.)
956
+ - **JSON Schema objects**: Not transformed, only Zod schemas
957
+
958
+ ## Example
959
+
960
+ ```typescript
961
+ const agent = new Agent({
962
+ name: 'data-extractor',
963
+ model: { provider: 'openai', modelId: 'gpt-4o' },
964
+ instructions: 'Extract user information',
965
+ });
966
+
967
+ const schema = z.object({
968
+ name: z.string(),
969
+ age: z.number().optional(),
970
+ deletedAt: z.date().nullable(),
971
+ });
972
+
973
+ // Schema is automatically transformed for OpenAI compatibility
974
+ const result = await agent.generate('Extract: John, deleted yesterday', {
975
+ structuredOutput: { schema },
976
+ });
977
+
978
+ // Result: { name: 'John', age: undefined, deletedAt: null }
979
+ ```
980
+
981
+ - Fix network data step formatting in AI SDK stream transformation ([#10432](https://github.com/mastra-ai/mastra/pull/10432))
982
+
983
+ Previously, network execution steps were not being tracked correctly in the AI SDK stream transformation. Steps were being duplicated rather than updated, and critical metadata like step IDs, iterations, and task information was missing or incorrectly structured.
984
+
985
+ **Changes:**
986
+ - Enhanced step tracking in `AgentNetworkToAISDKTransformer` to properly maintain step state throughout execution lifecycle
987
+ - Steps are now identified by unique IDs and updated in place rather than creating duplicates
988
+ - Added proper iteration and task metadata to each step in the network execution flow
989
+ - Fixed agent, workflow, and tool execution events to correctly populate step data
990
+ - Updated network stream event types to include `networkId`, `workflowId`, and consistent `runId` tracking
991
+ - Added test coverage for network custom data chunks with comprehensive validation
992
+
993
+ This ensures the AI SDK correctly represents the full execution flow of agent networks with accurate step sequencing and metadata.
994
+
995
+ - Fix generating provider-registry.json ([#10392](https://github.com/mastra-ai/mastra/pull/10392))
996
+
997
+ - Adds type inference for `mastra.get*ById` functions. Only those registered at the top level mastra instance will get inferred. MCP and tool id's do not get inferred yet, those need additional changes. ([#10199](https://github.com/mastra-ai/mastra/pull/10199))
998
+
999
+ - Fix working memory zod to json schema conversion to use schema-compat zodtoJsonSchema fn. ([#10391](https://github.com/mastra-ai/mastra/pull/10391))
1000
+
1001
+ - Fixes parallel tool call issue with Gemini 3 Pro by preventing step-start parts from being inserted between consecutive tool parts in the `addStartStepPartsForAIV5` function. This ensures that the AI SDK's `convertToModelMessages` correctly preserves the order of parallel tool calls and maintains the `thought_signature` on the first tool call as required by Gemini's API. ([#10372](https://github.com/mastra-ai/mastra/pull/10372))
1002
+
1003
+ - Updated dependencies [[`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013)]:
1004
+ - @mastra/schema-compat@1.0.0-beta.1
1005
+
1006
+ ## 1.0.0-beta.4
1007
+
1008
+ ### Patch Changes
1009
+
1010
+ - Fix message list provider metadata handling and reasoning text optimization ([#10281](https://github.com/mastra-ai/mastra/pull/10281))
1011
+ - Improved provider metadata preservation across message transformations
1012
+ - Optimized reasoning text storage to avoid duplication (using `details` instead of `reasoning` field)
1013
+ - Fixed test snapshots for timestamp precision and metadata handling
1014
+
1015
+ - Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
1016
+
1017
+ - Fix deprecation warning when agent network executes workflows by using `.fullStream` instead of iterating `WorkflowRunOutput` directly ([#10285](https://github.com/mastra-ai/mastra/pull/10285))
1018
+
1019
+ - Fix generate toolResults and mismatch in provider tool names ([#10282](https://github.com/mastra-ai/mastra/pull/10282))
1020
+
1021
+ - Support AI SDK voice models ([#10304](https://github.com/mastra-ai/mastra/pull/10304))
1022
+
1023
+ Mastra now supports AI SDK's transcription and speech models directly in `CompositeVoice`, enabling seamless integration with a wide range of voice providers through the AI SDK ecosystem. This allows you to use models from OpenAI, ElevenLabs, Groq, Deepgram, LMNT, Hume, and many more for both speech-to-text (transcription) and text-to-speech capabilities.
1024
+
1025
+ AI SDK models are automatically wrapped when passed to `CompositeVoice`, so you can mix and match AI SDK models with existing Mastra voice providers for maximum flexibility.
1026
+
1027
+ ## Usage Example
1028
+
1029
+ ```typescript
1030
+ import { CompositeVoice } from '@mastra/core/voice';
1031
+ import { openai } from '@ai-sdk/openai';
1032
+ import { elevenlabs } from '@ai-sdk/elevenlabs';
1033
+
1034
+ // Use AI SDK models directly with CompositeVoice
1035
+ const voice = new CompositeVoice({
1036
+ input: openai.transcription('whisper-1'), // AI SDK transcription model
1037
+ output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech model
1038
+ });
1039
+
1040
+ // Convert text to speech
1041
+ const audioStream = await voice.speak('Hello from AI SDK!');
1042
+
1043
+ // Convert speech to text
1044
+ const transcript = await voice.listen(audioStream);
1045
+ console.log(transcript);
1046
+ ```
1047
+
1048
+ Fixes #9947
1049
+
1050
+ ## 1.0.0-beta.3
1051
+
1052
+ ### Major Changes
1053
+
1054
+ - Use tool's outputSchema to validate results and return an error object if schema does not match output results. ([#9664](https://github.com/mastra-ai/mastra/pull/9664))
1055
+
1056
+ ```typescript
1057
+ const getUserTool = createTool({
1058
+ id: 'get-user',
1059
+ outputSchema: z.object({
1060
+ id: z.string(),
1061
+ name: z.string(),
1062
+ email: z.string().email(),
1063
+ }),
1064
+ execute: async inputData => {
1065
+ return { id: '123', name: 'John' };
1066
+ },
1067
+ });
1068
+ ```
1069
+
1070
+ When validation fails, the tool returns a `ValidationError`:
1071
+
1072
+ ```typescript
1073
+ // Before v1 - invalid output would silently pass through
1074
+ await getUserTool.execute({});
1075
+ // { id: "123", name: "John" } - missing email
1076
+
1077
+ // After v1 - validation error is returned
1078
+ await getUserTool.execute({});
1079
+ // {
1080
+ // error: true,
1081
+ // message: "Tool output validation failed for get-user. The tool returned invalid output:\n- email: Required\n\nReturned output: {...}",
1082
+ // validationErrors: { ... }
1083
+ // }
1084
+ ```
1085
+
1086
+ ### Patch Changes
1087
+
1088
+ - dependencies updates: ([#10131](https://github.com/mastra-ai/mastra/pull/10131))
1089
+ - Updated dependency [`hono@^4.10.5` ↗︎](https://www.npmjs.com/package/hono/v/4.10.5) (from `^4.9.7`, in `dependencies`)
1090
+
1091
+ - Only handle download image asset transformation if needed ([#10122](https://github.com/mastra-ai/mastra/pull/10122))
1092
+
1093
+ - Add serializedStepGraph to runExecutionResult response ([#10004](https://github.com/mastra-ai/mastra/pull/10004))
1094
+
1095
+ - Fix tool outputSchema validation to allow unsupported Zod types like ZodTuple. The outputSchema is only used for internal validation and never sent to the LLM, so model compatibility checks are not needed. ([#9409](https://github.com/mastra-ai/mastra/pull/9409))
1096
+
1097
+ - Fix vector definition to fix pinecone ([#10150](https://github.com/mastra-ai/mastra/pull/10150))
1098
+
1099
+ - fix resumeStream type to use resumeSchema ([#10202](https://github.com/mastra-ai/mastra/pull/10202))
1100
+
1101
+ - Add type bailed to workflowRunStatus ([#10091](https://github.com/mastra-ai/mastra/pull/10091))
1102
+
1103
+ - default validate inputs to true in Workflow execute ([#10222](https://github.com/mastra-ai/mastra/pull/10222))
1104
+
1105
+ - Add support for doGenerate in LanguageModelV2. This change fixes issues with OpenAI stream permissions. ([#10239](https://github.com/mastra-ai/mastra/pull/10239))
1106
+ - Added new abstraction over LanguageModelV2
1107
+
1108
+ - Fix input tool validation when no inputSchema is provided ([#9941](https://github.com/mastra-ai/mastra/pull/9941))
1109
+
1110
+ - Adds ability to create custom `MastraModelGateway`'s that can be added to the `Mastra` class instance under the `gateways` property. Giving you typescript autocompletion in any model picker string. ([#10180](https://github.com/mastra-ai/mastra/pull/10180))
1111
+
1112
+ ```typescript
1113
+ import { MastraModelGateway, type ProviderConfig } from '@mastra/core/llm';
1114
+ import { createOpenAICompatible } from '@ai-sdk/openai-compatible-v5';
1115
+ import type { LanguageModelV2 } from '@ai-sdk/provider-v5';
1116
+
1117
+ class MyCustomGateway extends MastraModelGateway {
1118
+ readonly id = 'my-custom-gateway';
1119
+ readonly name = 'My Custom Gateway';
1120
+ readonly prefix = 'custom';
1121
+
1122
+ async fetchProviders(): Promise<Record<string, ProviderConfig>> {
1123
+ return {
1124
+ 'my-provider': {
1125
+ name: 'My Provider',
1126
+ models: ['model-1', 'model-2'],
1127
+ apiKeyEnvVar: 'MY_API_KEY',
1128
+ gateway: this.id,
1129
+ },
1130
+ };
1131
+ }
1132
+
1133
+ buildUrl(modelId: string, envVars?: Record<string, string>): string {
1134
+ return 'https://api.my-provider.com/v1';
1135
+ }
1136
+
1137
+ async getApiKey(modelId: string): Promise<string> {
1138
+ const apiKey = process.env.MY_API_KEY;
1139
+ if (!apiKey) throw new Error('MY_API_KEY not set');
1140
+ return apiKey;
1141
+ }
1142
+
1143
+ async resolveLanguageModel({
1144
+ modelId,
1145
+ providerId,
1146
+ apiKey,
1147
+ }: {
1148
+ modelId: string;
1149
+ providerId: string;
1150
+ apiKey: string;
1151
+ }): Promise<LanguageModelV2> {
1152
+ const baseURL = this.buildUrl(`${providerId}/${modelId}`);
1153
+ return createOpenAICompatible({
1154
+ name: providerId,
1155
+ apiKey,
1156
+ baseURL,
1157
+ }).chatModel(modelId);
1158
+ }
1159
+ }
1160
+
1161
+ new Mastra({
1162
+ gateways: {
1163
+ myGateway: new MyCustomGateway(),
1164
+ },
1165
+ });
1166
+ ```
1167
+
1168
+ - Add an additional check to determine whether the model natively supports specific file types. Only download the file if the model does not support it natively. ([#9790](https://github.com/mastra-ai/mastra/pull/9790))
1169
+
1170
+ - Add restart method to workflow run that allows restarting an active workflow run ([#9750](https://github.com/mastra-ai/mastra/pull/9750))
1171
+ Add status filter to `listWorkflowRuns`
1172
+ Add automatic restart to restart active workflow runs when server starts
1173
+
1174
+ - Validate schemas by default in workflow. Previously, if you want schemas in the workflow to be validated, you'd have to add `validateInputs` option, now, this will be done by default but can be disabled. ([#10186](https://github.com/mastra-ai/mastra/pull/10186))
1175
+
1176
+ For workflows whose schemas and step schemas you don't want validated, do this
1177
+
1178
+ ```diff
1179
+ createWorkflow({
1180
+ + options: {
1181
+ + validateInputs: false
1182
+ + }
1183
+ })
1184
+ ```
1185
+
1186
+ - Fix inngest parallel workflow ([#10169](https://github.com/mastra-ai/mastra/pull/10169))
1187
+ Fix tool as step in inngest
1188
+ Fix inngest nested workflow
1189
+
1190
+ - Add timeTravel to workflows. This makes it possible to start a workflow run from a particular step in the workflow ([#9994](https://github.com/mastra-ai/mastra/pull/9994))
1191
+
1192
+ Example code:
1193
+
1194
+ ```ts
1195
+ const result = await run.timeTravel({
1196
+ step: 'step2',
1197
+ inputData: {
1198
+ value: 'input',
1199
+ },
1200
+ });
1201
+ ```
1202
+
1203
+ - Fixes assets not being downloaded when available ([#10079](https://github.com/mastra-ai/mastra/pull/10079))
1204
+
1205
+ - Remove unused dependencies ([#10019](https://github.com/mastra-ai/mastra/pull/10019))
1206
+
1207
+ - Updated dependencies [[`a64d16a`](https://github.com/mastra-ai/mastra/commit/a64d16aedafe57ee5707bdcc25f96e07fa1a0233)]:
1208
+ - @mastra/observability@1.0.0-beta.1
1209
+
1210
+ ## 1.0.0-beta.2
1211
+
1212
+ ### Patch Changes
1213
+
1214
+ - Make suspendPayload optional when calling `suspend()` ([#9926](https://github.com/mastra-ai/mastra/pull/9926))
1215
+ Save value returned as `suspendOutput` if user returns data still after calling `suspend()`
1216
+ Automatically call `commit()` on uncommitted workflows when registering in Mastra instance
1217
+ Show actual suspendPayload on Studio in suspend/resume flow
1218
+
3
1219
  ## 1.0.0-beta.1
4
1220
 
5
1221
  ### Patch Changes
@@ -8,6 +1224,8 @@
8
1224
 
9
1225
  - Add visual styles and labels for more workflow node types ([#9777](https://github.com/mastra-ai/mastra/pull/9777))
10
1226
 
1227
+ - `registerApiRoute` now accepts a `requiresAuth` option, so custom endpoints can opt in/out of Mastra auth without mutating the returned route object.
1228
+
11
1229
  ## 1.0.0-beta.0
12
1230
 
13
1231
  ### Major Changes