@mastra/core 1.0.0-beta.4 → 1.0.0-beta.6

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 (464) hide show
  1. package/CHANGELOG.md +598 -0
  2. package/dist/agent/agent-legacy.d.ts +17 -20
  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 +6 -6
  7. package/dist/agent/agent.d.ts.map +1 -1
  8. package/dist/agent/agent.types.d.ts +3 -1
  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 +49 -0
  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/save-queue/index.d.ts +3 -1
  18. package/dist/agent/save-queue/index.d.ts.map +1 -1
  19. package/dist/agent/test-utils.d.ts +37 -0
  20. package/dist/agent/test-utils.d.ts.map +1 -1
  21. package/dist/agent/trip-wire.d.ts.map +1 -1
  22. package/dist/agent/types.d.ts +20 -6
  23. package/dist/agent/types.d.ts.map +1 -1
  24. package/dist/agent/utils.d.ts.map +1 -1
  25. package/dist/agent/workflows/prepare-stream/index.d.ts +10 -10
  26. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  27. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +1 -3
  28. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  29. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +4 -4
  30. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  31. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +4 -4
  32. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  33. package/dist/agent/workflows/prepare-stream/schema.d.ts +12 -13
  34. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  35. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +8 -1
  36. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  37. package/dist/base.cjs +2 -2
  38. package/dist/base.js +1 -1
  39. package/dist/bundler/index.cjs +2 -2
  40. package/dist/bundler/index.js +1 -1
  41. package/dist/cache/index.cjs +3 -3
  42. package/dist/cache/index.js +1 -1
  43. package/dist/{chunk-OJNJA5ZI.js → chunk-3CKZSDTQ.js} +3 -3
  44. package/dist/{chunk-OJNJA5ZI.js.map → chunk-3CKZSDTQ.js.map} +1 -1
  45. package/dist/{chunk-TQTAMPSC.js → chunk-3N3QE4ZK.js} +3 -3
  46. package/dist/chunk-3N3QE4ZK.js.map +1 -0
  47. package/dist/{chunk-WQSGX6XA.cjs → chunk-3TKNXJES.cjs} +56 -15
  48. package/dist/chunk-3TKNXJES.cjs.map +1 -0
  49. package/dist/{chunk-XXBWX7DT.js → chunk-45NA5ZD3.js} +11673 -9468
  50. package/dist/chunk-45NA5ZD3.js.map +1 -0
  51. package/dist/{chunk-KEURQGCQ.js → chunk-4F6RAJFU.js} +105 -21
  52. package/dist/chunk-4F6RAJFU.js.map +1 -0
  53. package/dist/{chunk-ISMGVGUM.cjs → chunk-4JKEUSCC.cjs} +4 -4
  54. package/dist/{chunk-ISMGVGUM.cjs.map → chunk-4JKEUSCC.cjs.map} +1 -1
  55. package/dist/{chunk-CYVNOIXS.cjs → chunk-4KUOSXJ7.cjs} +30 -16
  56. package/dist/chunk-4KUOSXJ7.cjs.map +1 -0
  57. package/dist/{chunk-CBAB7GOD.cjs → chunk-6BJ7XHRH.cjs} +2 -2
  58. package/dist/{chunk-CBAB7GOD.cjs.map → chunk-6BJ7XHRH.cjs.map} +1 -1
  59. package/dist/{chunk-3RW5EMSB.js → chunk-6GOLI2EY.js} +22 -9
  60. package/dist/chunk-6GOLI2EY.js.map +1 -0
  61. package/dist/{chunk-4RXG622P.cjs → chunk-6J4NRNT2.cjs} +600 -37
  62. package/dist/chunk-6J4NRNT2.cjs.map +1 -0
  63. package/dist/{chunk-J7O6WENZ.cjs → chunk-6TBWJV35.js} +5 -5
  64. package/dist/chunk-6TBWJV35.js.map +1 -0
  65. package/dist/chunk-6XCINXZ7.cjs +194 -0
  66. package/dist/chunk-6XCINXZ7.cjs.map +1 -0
  67. package/dist/{chunk-MDKPL2R2.js → chunk-7ZADRRDW.js} +5 -4
  68. package/dist/chunk-7ZADRRDW.js.map +1 -0
  69. package/dist/{chunk-DSNPWVIG.cjs → chunk-AF74UXR5.cjs} +4 -3
  70. package/dist/chunk-AF74UXR5.cjs.map +1 -0
  71. package/dist/{chunk-W3DD3XP5.js → chunk-APMPOYPI.js} +334 -138
  72. package/dist/chunk-APMPOYPI.js.map +1 -0
  73. package/dist/{chunk-LRSB62Z6.cjs → chunk-AQAIS7FH.cjs} +15 -8
  74. package/dist/chunk-AQAIS7FH.cjs.map +1 -0
  75. package/dist/chunk-BWYU7D33.js +192 -0
  76. package/dist/chunk-BWYU7D33.js.map +1 -0
  77. package/dist/{chunk-KEXGB7FK.cjs → chunk-DGV2FWB4.cjs} +7 -7
  78. package/dist/{chunk-KEXGB7FK.cjs.map → chunk-DGV2FWB4.cjs.map} +1 -1
  79. package/dist/{chunk-WTYNK7Q4.js → chunk-DXMSVGJ6.js} +599 -36
  80. package/dist/chunk-DXMSVGJ6.js.map +1 -0
  81. package/dist/{chunk-Y63IFHEZ.cjs → chunk-EOPEDKLG.cjs} +4 -4
  82. package/dist/chunk-EOPEDKLG.cjs.map +1 -0
  83. package/dist/{chunk-NZAXAFI3.js → chunk-F2GAJSBI.js} +3 -3
  84. package/dist/{chunk-NZAXAFI3.js.map → chunk-F2GAJSBI.js.map} +1 -1
  85. package/dist/{chunk-KIZIOFZC.js → chunk-FYP3AT6W.js} +17 -3
  86. package/dist/chunk-FYP3AT6W.js.map +1 -0
  87. package/dist/{chunk-ZCVTH3CH.cjs → chunk-HNHZGFZY.cjs} +5 -4
  88. package/dist/chunk-HNHZGFZY.cjs.map +1 -0
  89. package/dist/{chunk-BMAFVZ2D.cjs → chunk-IWTMMUQY.cjs} +4 -4
  90. package/dist/{chunk-BMAFVZ2D.cjs.map → chunk-IWTMMUQY.cjs.map} +1 -1
  91. package/dist/{chunk-D6EDHNGV.js → chunk-KZLP6TPJ.js} +69 -28
  92. package/dist/chunk-KZLP6TPJ.js.map +1 -0
  93. package/dist/{chunk-5WXEYDFI.cjs → chunk-LDWBLENZ.cjs} +51 -38
  94. package/dist/chunk-LDWBLENZ.cjs.map +1 -0
  95. package/dist/{chunk-HGNRQ3OG.js → chunk-LEZIKVRQ.js} +15 -8
  96. package/dist/chunk-LEZIKVRQ.js.map +1 -0
  97. package/dist/{chunk-S6URFGCZ.js → chunk-LSHPJWM5.js} +3 -3
  98. package/dist/{chunk-S6URFGCZ.js.map → chunk-LSHPJWM5.js.map} +1 -1
  99. package/dist/{chunk-E7K4FTLN.cjs → chunk-NHNXIYDG.cjs} +18 -2
  100. package/dist/chunk-NHNXIYDG.cjs.map +1 -0
  101. package/dist/{chunk-U7VECK2G.js → chunk-NIUEWICQ.js} +145 -19
  102. package/dist/chunk-NIUEWICQ.js.map +1 -0
  103. package/dist/{chunk-2NVBZKZI.cjs → chunk-NN3NOFRU.cjs} +11744 -9526
  104. package/dist/chunk-NN3NOFRU.cjs.map +1 -0
  105. package/dist/{chunk-KJ2SW6VA.js → chunk-NRUZYMHE.js} +4 -3
  106. package/dist/chunk-NRUZYMHE.js.map +1 -0
  107. package/dist/{chunk-IWB65P37.cjs → chunk-OIMB2SNZ.cjs} +155 -29
  108. package/dist/chunk-OIMB2SNZ.cjs.map +1 -0
  109. package/dist/{chunk-IWQDBVJK.js → chunk-OPALPWAM.js} +47 -8
  110. package/dist/chunk-OPALPWAM.js.map +1 -0
  111. package/dist/{chunk-X7JMA3IY.js → chunk-PSCMWPLC.js} +2 -2
  112. package/dist/{chunk-X7JMA3IY.js.map → chunk-PSCMWPLC.js.map} +1 -1
  113. package/dist/{chunk-S6OEQHEI.cjs → chunk-QGWNF2QJ.cjs} +59 -50
  114. package/dist/chunk-QGWNF2QJ.cjs.map +1 -0
  115. package/dist/{chunk-VZC4BWWH.cjs → chunk-RHTV5C5D.cjs} +19 -19
  116. package/dist/chunk-RHTV5C5D.cjs.map +1 -0
  117. package/dist/{chunk-HBJPYQRN.cjs → chunk-RTROJFEU.cjs} +78 -41
  118. package/dist/chunk-RTROJFEU.cjs.map +1 -0
  119. package/dist/chunk-S5FPOCQF.cjs +518 -0
  120. package/dist/chunk-S5FPOCQF.cjs.map +1 -0
  121. package/dist/{chunk-O6NA3Z43.cjs → chunk-SQAX4OW6.cjs} +167 -12
  122. package/dist/chunk-SQAX4OW6.cjs.map +1 -0
  123. package/dist/{chunk-IHJDOC3A.js → chunk-T2UNO766.js} +16 -7
  124. package/dist/chunk-T2UNO766.js.map +1 -0
  125. package/dist/{chunk-FVNT7VTO.js → chunk-TARWUQG6.js} +243 -166
  126. package/dist/chunk-TARWUQG6.js.map +1 -0
  127. package/dist/{chunk-76K3IYWM.js → chunk-TS7B26US.js} +3 -3
  128. package/dist/{chunk-76K3IYWM.js.map → chunk-TS7B26US.js.map} +1 -1
  129. package/dist/{chunk-Y6ROD72V.cjs → chunk-UIGRFDO6.cjs} +4 -4
  130. package/dist/{chunk-Y6ROD72V.cjs.map → chunk-UIGRFDO6.cjs.map} +1 -1
  131. package/dist/{chunk-GRBGQ2GE.js → chunk-UVHSM2GU.cjs} +9 -3
  132. package/dist/chunk-UVHSM2GU.cjs.map +1 -0
  133. package/dist/{chunk-VSM3NLUX.cjs → chunk-VRFSEZBA.cjs} +334 -138
  134. package/dist/chunk-VRFSEZBA.cjs.map +1 -0
  135. package/dist/{chunk-JXESKY4A.js → chunk-WDRA4WKG.js} +163 -9
  136. package/dist/chunk-WDRA4WKG.js.map +1 -0
  137. package/dist/{chunk-RXDJL5QT.js → chunk-WMAMOYRR.js} +14 -14
  138. package/dist/chunk-WMAMOYRR.js.map +1 -0
  139. package/dist/{chunk-2OTDXX73.js → chunk-XY337TTF.js} +24 -10
  140. package/dist/chunk-XY337TTF.js.map +1 -0
  141. package/dist/{chunk-4IKJAKCD.cjs → chunk-Y24HI6ND.cjs} +108 -23
  142. package/dist/chunk-Y24HI6ND.cjs.map +1 -0
  143. package/dist/deployer/index.cjs +2 -2
  144. package/dist/deployer/index.js +1 -1
  145. package/dist/di/index.cjs +10 -2
  146. package/dist/di/index.d.ts +1 -1
  147. package/dist/di/index.d.ts.map +1 -1
  148. package/dist/di/index.js +1 -1
  149. package/dist/evals/base.d.ts +10 -2
  150. package/dist/evals/base.d.ts.map +1 -1
  151. package/dist/evals/base.test-utils.d.ts +25 -25
  152. package/dist/evals/index.cjs +9 -9
  153. package/dist/evals/index.js +2 -2
  154. package/dist/evals/scoreTraces/index.cjs +5 -5
  155. package/dist/evals/scoreTraces/index.js +2 -2
  156. package/dist/evals/types.d.ts +8 -8
  157. package/dist/index.cjs +2 -2
  158. package/dist/index.js +1 -1
  159. package/dist/integration/index.cjs +2 -2
  160. package/dist/integration/index.js +1 -1
  161. package/dist/llm/index.cjs +18 -14
  162. package/dist/llm/index.d.ts +2 -1
  163. package/dist/llm/index.d.ts.map +1 -1
  164. package/dist/llm/index.js +5 -5
  165. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -1
  166. package/dist/llm/model/gateway-resolver.d.ts.map +1 -1
  167. package/dist/llm/model/gateways/azure.d.ts +36 -0
  168. package/dist/llm/model/gateways/azure.d.ts.map +1 -0
  169. package/dist/llm/model/gateways/base.d.ts +3 -6
  170. package/dist/llm/model/gateways/base.d.ts.map +1 -1
  171. package/dist/llm/model/gateways/index.d.ts +4 -1
  172. package/dist/llm/model/gateways/index.d.ts.map +1 -1
  173. package/dist/llm/model/gateways/models-dev.d.ts +2 -2
  174. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  175. package/dist/llm/model/gateways/netlify.d.ts +2 -2
  176. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  177. package/dist/llm/model/model.d.ts.map +1 -1
  178. package/dist/llm/model/model.loop.d.ts +1 -1
  179. package/dist/llm/model/model.loop.d.ts.map +1 -1
  180. package/dist/llm/model/provider-registry.d.ts.map +1 -1
  181. package/dist/llm/model/provider-types.generated.d.ts +245 -12
  182. package/dist/llm/model/registry-generator.d.ts +12 -0
  183. package/dist/llm/model/registry-generator.d.ts.map +1 -1
  184. package/dist/llm/model/router.d.ts.map +1 -1
  185. package/dist/logger/constants.d.ts +1 -0
  186. package/dist/logger/constants.d.ts.map +1 -1
  187. package/dist/logger/index.cjs +11 -11
  188. package/dist/logger/index.js +2 -2
  189. package/dist/logger/transport.d.ts +1 -1
  190. package/dist/logger/transport.d.ts.map +1 -1
  191. package/dist/loop/index.cjs +2 -2
  192. package/dist/loop/index.js +1 -1
  193. package/dist/loop/loop.d.ts.map +1 -1
  194. package/dist/loop/network/index.d.ts +2 -2
  195. package/dist/loop/network/index.d.ts.map +1 -1
  196. package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
  197. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  198. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  199. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  200. package/dist/loop/types.d.ts +13 -2
  201. package/dist/loop/types.d.ts.map +1 -1
  202. package/dist/loop/workflows/agentic-execution/index.d.ts +96 -96
  203. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  204. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +65 -65
  205. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  206. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +32 -32
  207. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  208. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  209. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  210. package/dist/loop/workflows/agentic-loop/index.d.ts +97 -97
  211. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  212. package/dist/loop/workflows/schema.d.ts +32 -32
  213. package/dist/loop/workflows/stream.d.ts +1 -1
  214. package/dist/loop/workflows/stream.d.ts.map +1 -1
  215. package/dist/mastra/index.cjs +2 -2
  216. package/dist/mastra/index.d.ts +64 -9
  217. package/dist/mastra/index.d.ts.map +1 -1
  218. package/dist/mastra/index.js +1 -1
  219. package/dist/mcp/index.cjs +4 -4
  220. package/dist/mcp/index.cjs.map +1 -1
  221. package/dist/mcp/index.d.ts +4 -4
  222. package/dist/mcp/index.d.ts.map +1 -1
  223. package/dist/mcp/index.js +2 -2
  224. package/dist/mcp/index.js.map +1 -1
  225. package/dist/mcp/types.d.ts +2 -2
  226. package/dist/mcp/types.d.ts.map +1 -1
  227. package/dist/memory/index.cjs +21 -327
  228. package/dist/memory/index.cjs.map +1 -1
  229. package/dist/memory/index.js +1 -327
  230. package/dist/memory/index.js.map +1 -1
  231. package/dist/memory/memory.d.ts +22 -18
  232. package/dist/memory/memory.d.ts.map +1 -1
  233. package/dist/memory/mock.d.ts +15 -14
  234. package/dist/memory/mock.d.ts.map +1 -1
  235. package/dist/memory/types.d.ts +69 -11
  236. package/dist/memory/types.d.ts.map +1 -1
  237. package/dist/models-dev-F6MTIYTO.js +3 -0
  238. package/dist/{models-dev-6PRLJKVZ.js.map → models-dev-F6MTIYTO.js.map} +1 -1
  239. package/dist/models-dev-XIVR5EJV.cjs +12 -0
  240. package/dist/{models-dev-WHMI5G6Y.cjs.map → models-dev-XIVR5EJV.cjs.map} +1 -1
  241. package/dist/netlify-C2YBIK7A.js +3 -0
  242. package/dist/{netlify-EBQ6YUC6.js.map → netlify-C2YBIK7A.js.map} +1 -1
  243. package/dist/netlify-XWROOTP4.cjs +12 -0
  244. package/dist/{netlify-46I3SNNV.cjs.map → netlify-XWROOTP4.cjs.map} +1 -1
  245. package/dist/observability/index.cjs +16 -8
  246. package/dist/observability/index.js +1 -1
  247. package/dist/observability/types/tracing.d.ts +165 -3
  248. package/dist/observability/types/tracing.d.ts.map +1 -1
  249. package/dist/observability/utils.d.ts +47 -1
  250. package/dist/observability/utils.d.ts.map +1 -1
  251. package/dist/processors/index.cjs +35 -11
  252. package/dist/processors/index.d.ts +101 -23
  253. package/dist/processors/index.d.ts.map +1 -1
  254. package/dist/processors/index.js +1 -1
  255. package/dist/processors/memory/index.d.ts +7 -0
  256. package/dist/processors/memory/index.d.ts.map +1 -0
  257. package/dist/processors/memory/message-history.d.ts +43 -0
  258. package/dist/processors/memory/message-history.d.ts.map +1 -0
  259. package/dist/processors/memory/semantic-recall.d.ts +152 -0
  260. package/dist/processors/memory/semantic-recall.d.ts.map +1 -0
  261. package/dist/processors/memory/working-memory.d.ts +65 -0
  262. package/dist/processors/memory/working-memory.d.ts.map +1 -0
  263. package/dist/processors/processors/batch-parts.d.ts +1 -1
  264. package/dist/processors/processors/batch-parts.d.ts.map +1 -1
  265. package/dist/processors/processors/index.d.ts +2 -1
  266. package/dist/processors/processors/index.d.ts.map +1 -1
  267. package/dist/processors/processors/language-detector.d.ts +15 -1
  268. package/dist/processors/processors/language-detector.d.ts.map +1 -1
  269. package/dist/processors/processors/moderation.d.ts +15 -1
  270. package/dist/processors/processors/moderation.d.ts.map +1 -1
  271. package/dist/processors/processors/pii-detector.d.ts +15 -1
  272. package/dist/processors/processors/pii-detector.d.ts.map +1 -1
  273. package/dist/processors/processors/prompt-injection-detector.d.ts +15 -1
  274. package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
  275. package/dist/processors/processors/structured-output.d.ts +3 -2
  276. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  277. package/dist/processors/processors/system-prompt-scrubber.d.ts +1 -1
  278. package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
  279. package/dist/processors/processors/token-limiter.d.ts +22 -12
  280. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  281. package/dist/processors/processors/tool-call-filter.d.ts +28 -0
  282. package/dist/processors/processors/tool-call-filter.d.ts.map +1 -0
  283. package/dist/processors/processors/unicode-normalizer.d.ts +1 -1
  284. package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
  285. package/dist/processors/runner.d.ts +35 -4
  286. package/dist/processors/runner.d.ts.map +1 -1
  287. package/dist/provider-registry-BXX7CA3H.cjs +40 -0
  288. package/dist/{provider-registry-RP2W4B24.cjs.map → provider-registry-BXX7CA3H.cjs.map} +1 -1
  289. package/dist/provider-registry-GRYJWVEM.js +3 -0
  290. package/dist/{provider-registry-HDG6UMUC.js.map → provider-registry-GRYJWVEM.js.map} +1 -1
  291. package/dist/provider-registry.json +547 -25
  292. package/dist/{registry-generator-JPCV47SC.cjs → registry-generator-34SC4TAU.cjs} +21 -6
  293. package/dist/registry-generator-34SC4TAU.cjs.map +1 -0
  294. package/dist/{registry-generator-XD4FPZTU.js → registry-generator-UMTNPBJX.js} +21 -7
  295. package/dist/registry-generator-UMTNPBJX.js.map +1 -0
  296. package/dist/relevance/index.cjs +2 -2
  297. package/dist/relevance/index.js +1 -1
  298. package/dist/request-context/index.cjs +10 -2
  299. package/dist/request-context/index.d.ts +26 -0
  300. package/dist/request-context/index.d.ts.map +1 -1
  301. package/dist/request-context/index.js +1 -1
  302. package/dist/server/base.d.ts +51 -0
  303. package/dist/server/base.d.ts.map +1 -0
  304. package/dist/server/composite-auth.d.ts +9 -0
  305. package/dist/server/composite-auth.d.ts.map +1 -0
  306. package/dist/server/index.cjs +112 -2
  307. package/dist/server/index.cjs.map +1 -1
  308. package/dist/server/index.d.ts +4 -0
  309. package/dist/server/index.d.ts.map +1 -1
  310. package/dist/server/index.js +109 -2
  311. package/dist/server/index.js.map +1 -1
  312. package/dist/server/simple-auth.d.ts +27 -0
  313. package/dist/server/simple-auth.d.ts.map +1 -0
  314. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  315. package/dist/storage/index.cjs +37 -29
  316. package/dist/storage/index.js +1 -1
  317. package/dist/storage/types.d.ts +1 -1
  318. package/dist/storage/types.d.ts.map +1 -1
  319. package/dist/storage/utils.d.ts +44 -0
  320. package/dist/storage/utils.d.ts.map +1 -1
  321. package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
  322. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  323. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  324. package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
  325. package/dist/stream/RunOutput.d.ts +2 -2
  326. package/dist/stream/RunOutput.d.ts.map +1 -1
  327. package/dist/stream/aisdk/v5/output.d.ts +1 -1
  328. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  329. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  330. package/dist/stream/base/base.d.ts +1 -1
  331. package/dist/stream/base/base.d.ts.map +1 -1
  332. package/dist/stream/base/output-format-handlers.d.ts +1 -1
  333. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  334. package/dist/stream/base/output.d.ts +1 -1
  335. package/dist/stream/base/output.d.ts.map +1 -1
  336. package/dist/stream/index.cjs +11 -11
  337. package/dist/stream/index.js +2 -2
  338. package/dist/stream/types.d.ts +9 -2
  339. package/dist/stream/types.d.ts.map +1 -1
  340. package/dist/test-utils/llm-mock.cjs +36 -2
  341. package/dist/test-utils/llm-mock.cjs.map +1 -1
  342. package/dist/test-utils/llm-mock.d.ts +3 -0
  343. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  344. package/dist/test-utils/llm-mock.js +32 -2
  345. package/dist/test-utils/llm-mock.js.map +1 -1
  346. package/dist/tools/index.cjs +6 -6
  347. package/dist/tools/index.js +2 -2
  348. package/dist/tools/is-vercel-tool.cjs +2 -2
  349. package/dist/tools/is-vercel-tool.js +1 -1
  350. package/dist/tools/stream.d.ts +2 -1
  351. package/dist/tools/stream.d.ts.map +1 -1
  352. package/dist/tools/tool-builder/builder.d.ts +2 -0
  353. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  354. package/dist/tools/tool.d.ts +19 -6
  355. package/dist/tools/tool.d.ts.map +1 -1
  356. package/dist/tools/types.d.ts +28 -3
  357. package/dist/tools/types.d.ts.map +1 -1
  358. package/dist/tools/validation.d.ts +14 -2
  359. package/dist/tools/validation.d.ts.map +1 -1
  360. package/dist/tts/index.cjs +2 -2
  361. package/dist/tts/index.js +1 -1
  362. package/dist/utils.cjs +22 -22
  363. package/dist/utils.d.ts +2 -2
  364. package/dist/utils.d.ts.map +1 -1
  365. package/dist/utils.js +1 -1
  366. package/dist/vector/filter/index.cjs +7 -189
  367. package/dist/vector/filter/index.cjs.map +1 -1
  368. package/dist/vector/filter/index.js +1 -190
  369. package/dist/vector/filter/index.js.map +1 -1
  370. package/dist/vector/index.cjs +7 -2
  371. package/dist/vector/index.cjs.map +1 -1
  372. package/dist/vector/index.d.ts +1 -0
  373. package/dist/vector/index.d.ts.map +1 -1
  374. package/dist/vector/index.js +2 -1
  375. package/dist/vector/index.js.map +1 -1
  376. package/dist/vector/types.d.ts +86 -3
  377. package/dist/vector/types.d.ts.map +1 -1
  378. package/dist/vector/vector.d.ts +39 -2
  379. package/dist/vector/vector.d.ts.map +1 -1
  380. package/dist/voice/index.cjs +6 -6
  381. package/dist/voice/index.js +1 -1
  382. package/dist/workflows/default.d.ts +176 -281
  383. package/dist/workflows/default.d.ts.map +1 -1
  384. package/dist/workflows/evented/index.cjs +10 -10
  385. package/dist/workflows/evented/index.js +1 -1
  386. package/dist/workflows/evented/step-executor.d.ts +1 -1
  387. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  388. package/dist/workflows/execution-engine.d.ts +4 -2
  389. package/dist/workflows/execution-engine.d.ts.map +1 -1
  390. package/dist/workflows/handlers/control-flow.d.ts +135 -0
  391. package/dist/workflows/handlers/control-flow.d.ts.map +1 -0
  392. package/dist/workflows/handlers/entry.d.ts +45 -0
  393. package/dist/workflows/handlers/entry.d.ts.map +1 -0
  394. package/dist/workflows/handlers/sleep.d.ts +62 -0
  395. package/dist/workflows/handlers/sleep.d.ts.map +1 -0
  396. package/dist/workflows/handlers/step.d.ts +60 -0
  397. package/dist/workflows/handlers/step.d.ts.map +1 -0
  398. package/dist/workflows/index.cjs +23 -19
  399. package/dist/workflows/index.js +1 -1
  400. package/dist/workflows/step.d.ts +1 -0
  401. package/dist/workflows/step.d.ts.map +1 -1
  402. package/dist/workflows/types.d.ts +159 -5
  403. package/dist/workflows/types.d.ts.map +1 -1
  404. package/dist/workflows/utils.d.ts +7 -0
  405. package/dist/workflows/utils.d.ts.map +1 -1
  406. package/dist/workflows/workflow.d.ts +12 -8
  407. package/dist/workflows/workflow.d.ts.map +1 -1
  408. package/package.json +12 -10
  409. package/src/llm/model/provider-types.generated.d.ts +245 -12
  410. package/dist/chunk-2NVBZKZI.cjs.map +0 -1
  411. package/dist/chunk-2OTDXX73.js.map +0 -1
  412. package/dist/chunk-3PSWNGBF.js +0 -3
  413. package/dist/chunk-3PSWNGBF.js.map +0 -1
  414. package/dist/chunk-3RW5EMSB.js.map +0 -1
  415. package/dist/chunk-3W5RQCCY.cjs +0 -440
  416. package/dist/chunk-3W5RQCCY.cjs.map +0 -1
  417. package/dist/chunk-436FFEF6.js +0 -34
  418. package/dist/chunk-436FFEF6.js.map +0 -1
  419. package/dist/chunk-4IKJAKCD.cjs.map +0 -1
  420. package/dist/chunk-4RXG622P.cjs.map +0 -1
  421. package/dist/chunk-5WXEYDFI.cjs.map +0 -1
  422. package/dist/chunk-CYVNOIXS.cjs.map +0 -1
  423. package/dist/chunk-D6EDHNGV.js.map +0 -1
  424. package/dist/chunk-DSNPWVIG.cjs.map +0 -1
  425. package/dist/chunk-E7K4FTLN.cjs.map +0 -1
  426. package/dist/chunk-FVNT7VTO.js.map +0 -1
  427. package/dist/chunk-GRBGQ2GE.js.map +0 -1
  428. package/dist/chunk-HBJPYQRN.cjs.map +0 -1
  429. package/dist/chunk-HGNRQ3OG.js.map +0 -1
  430. package/dist/chunk-IHJDOC3A.js.map +0 -1
  431. package/dist/chunk-IWB65P37.cjs.map +0 -1
  432. package/dist/chunk-IWQDBVJK.js.map +0 -1
  433. package/dist/chunk-J7O6WENZ.cjs.map +0 -1
  434. package/dist/chunk-JXESKY4A.js.map +0 -1
  435. package/dist/chunk-KEURQGCQ.js.map +0 -1
  436. package/dist/chunk-KIZIOFZC.js.map +0 -1
  437. package/dist/chunk-KJ2SW6VA.js.map +0 -1
  438. package/dist/chunk-LRSB62Z6.cjs.map +0 -1
  439. package/dist/chunk-MDKPL2R2.js.map +0 -1
  440. package/dist/chunk-O6NA3Z43.cjs.map +0 -1
  441. package/dist/chunk-PE3V7GUL.cjs +0 -4
  442. package/dist/chunk-PE3V7GUL.cjs.map +0 -1
  443. package/dist/chunk-RXDJL5QT.js.map +0 -1
  444. package/dist/chunk-S6OEQHEI.cjs.map +0 -1
  445. package/dist/chunk-TQTAMPSC.js.map +0 -1
  446. package/dist/chunk-U7VECK2G.js.map +0 -1
  447. package/dist/chunk-V3VLOOSW.cjs +0 -36
  448. package/dist/chunk-V3VLOOSW.cjs.map +0 -1
  449. package/dist/chunk-VSM3NLUX.cjs.map +0 -1
  450. package/dist/chunk-VZC4BWWH.cjs.map +0 -1
  451. package/dist/chunk-W3DD3XP5.js.map +0 -1
  452. package/dist/chunk-WQSGX6XA.cjs.map +0 -1
  453. package/dist/chunk-WTYNK7Q4.js.map +0 -1
  454. package/dist/chunk-XXBWX7DT.js.map +0 -1
  455. package/dist/chunk-Y63IFHEZ.cjs.map +0 -1
  456. package/dist/chunk-ZCVTH3CH.cjs.map +0 -1
  457. package/dist/models-dev-6PRLJKVZ.js +0 -3
  458. package/dist/models-dev-WHMI5G6Y.cjs +0 -12
  459. package/dist/netlify-46I3SNNV.cjs +0 -12
  460. package/dist/netlify-EBQ6YUC6.js +0 -3
  461. package/dist/provider-registry-HDG6UMUC.js +0 -3
  462. package/dist/provider-registry-RP2W4B24.cjs +0 -40
  463. package/dist/registry-generator-JPCV47SC.cjs.map +0 -1
  464. package/dist/registry-generator-XD4FPZTU.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,603 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 1.0.0-beta.6
4
+
5
+ ### Major Changes
6
+
7
+ - Changed `.branch()` result schema to make all branch output fields optional. ([#10693](https://github.com/mastra-ai/mastra/pull/10693))
8
+
9
+ **Breaking change**: Branch outputs are now optional since only one branch executes at runtime. Update your workflow schemas to handle optional branch results.
10
+
11
+ **Before:**
12
+
13
+ ```typescript
14
+ const workflow = createWorkflow({...})
15
+ .branch([
16
+ [condition1, stepA], // outputSchema: { result: z.string() }
17
+ [condition2, stepB], // outputSchema: { data: z.number() }
18
+ ])
19
+ .map({
20
+ finalResult: { step: stepA, path: 'result' } // Expected non-optional
21
+ });
22
+ ```
23
+
24
+ **After:**
25
+
26
+ ```typescript
27
+ const workflow = createWorkflow({...})
28
+ .branch([
29
+ [condition1, stepA],
30
+ [condition2, stepB],
31
+ ])
32
+ .map({
33
+ finalResult: {
34
+ step: stepA,
35
+ path: 'result' // Now optional - provide fallback
36
+ }
37
+ });
38
+ ```
39
+
40
+ **Why**: Branch conditionals execute only one path, so non-executed branches don't produce outputs. The type system now correctly reflects this runtime behavior.
41
+
42
+ Related issue: https://github.com/mastra-ai/mastra/issues/10642
43
+
44
+ ### Minor Changes
45
+
46
+ - 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))
47
+
48
+ - Add reserved keys in RequestContext for secure resourceId/threadId setting from middleware ([#10657](https://github.com/mastra-ai/mastra/pull/10657))
49
+
50
+ 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.
51
+
52
+ - feat(workflows): add suspendData parameter to step execute function ([#10734](https://github.com/mastra-ai/mastra/pull/10734))
53
+
54
+ 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.
55
+
56
+ **New Features:**
57
+ - `suspendData` parameter automatically populated in step execute function when resuming
58
+ - Type-safe access to suspend data matching the step's `suspendSchema`
59
+ - Backward compatible - existing workflows continue to work unchanged
60
+
61
+ **Example:**
62
+
63
+ ```typescript
64
+ const step = createStep({
65
+ suspendSchema: z.object({ reason: z.string() }),
66
+ resumeSchema: z.object({ approved: z.boolean() }),
67
+ execute: async ({ suspend, suspendData, resumeData }) => {
68
+ if (!resumeData?.approved) {
69
+ return await suspend({ reason: 'Approval required' });
70
+ }
71
+
72
+ // Access original suspend data when resuming
73
+ console.log(`Resuming after: ${suspendData?.reason}`);
74
+ return { result: 'Approved' };
75
+ },
76
+ });
77
+ ```
78
+
79
+ - feat(storage): support querying messages from multiple threads ([#10663](https://github.com/mastra-ai/mastra/pull/10663))
80
+ - Fixed TypeScript errors where `threadId: string | string[]` was being passed to places expecting `Scalar` type
81
+ - Added proper multi-thread support for `listMessages` across all adapters when `threadId` is an array
82
+ - Updated `_getIncludedMessages` to look up message threadId by ID (since message IDs are globally unique)
83
+ - **upstash**: Added `msg-idx:{messageId}` index for O(1) message lookups (backwards compatible with fallback to scan for old messages, with automatic backfill)
84
+
85
+ - Adds trace tagging support to the BrainTrust and Langfuse tracing exporters. ([#10765](https://github.com/mastra-ai/mastra/pull/10765))
86
+
87
+ - Add `messageList` parameter to `processOutputStream` for accessing remembered messages during streaming ([#10608](https://github.com/mastra-ai/mastra/pull/10608))
88
+
89
+ - Unify transformScoreRow functions across storage adapters ([#10648](https://github.com/mastra-ai/mastra/pull/10648))
90
+
91
+ 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:
92
+ - `preferredTimestampFields`: Preferred source fields for timestamps (PostgreSQL, Cloudflare D1)
93
+ - `convertTimestamps`: Convert timestamp strings to Date objects (MSSQL, MongoDB, ClickHouse)
94
+ - `nullValuePattern`: Skip values matching pattern (ClickHouse's `'_null_'`)
95
+ - `fieldMappings`: Map source column names to schema fields (LibSQL's `additionalLLMContext`)
96
+
97
+ 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.
98
+
99
+ ### Patch Changes
100
+
101
+ - dependencies updates: ([#10110](https://github.com/mastra-ai/mastra/pull/10110))
102
+ - Updated dependency [`hono-openapi@^1.1.1` ↗︎](https://www.npmjs.com/package/hono-openapi/v/1.1.1) (from `^0.4.8`, in `dependencies`)
103
+
104
+ - unexpected json parse issue, log error but dont fail ([#10241](https://github.com/mastra-ai/mastra/pull/10241))
105
+
106
+ - Fixed a bug in agent networks where sometimes the task name was empty ([#10629](https://github.com/mastra-ai/mastra/pull/10629))
107
+
108
+ - 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))
109
+
110
+ - 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))
111
+
112
+ - `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))
113
+
114
+ 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.
115
+
116
+ - SimpleAuth and improved CloudAuth ([#10490](https://github.com/mastra-ai/mastra/pull/10490))
117
+
118
+ - 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))
119
+
120
+ The fix normalizes `undefined`/`null` to `{}` for object schemas and `[]` for array schemas before validation.
121
+
122
+ - 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))
123
+
124
+ - Fix error when spreading config objects in Mastra constructor ([#10718](https://github.com/mastra-ai/mastra/pull/10718))
125
+
126
+ 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.
127
+
128
+ - 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))
129
+
130
+ - Fix generateTitle model type to accept AI SDK LanguageModelV2 ([#10541](https://github.com/mastra-ai/mastra/pull/10541))
131
+
132
+ 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.
133
+
134
+ Previously, passing a standard `LanguageModelV2` would fail because `MastraLanguageModelV2` has different `doGenerate`/`doStream` return types. Now `MastraModelConfig` is used consistently across:
135
+ - `memory/types.ts` - `generateTitle.model` config
136
+ - `agent.ts` - `genTitle`, `generateTitleFromUserMessage`, `resolveTitleGenerationConfig`
137
+ - `agent-legacy.ts` - `AgentLegacyCapabilities` interface
138
+
139
+ - Fix message ordering when using toAISdkV5Messages or prepareStep ([#10686](https://github.com/mastra-ai/mastra/pull/10686))
140
+
141
+ 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.
142
+
143
+ Before:
144
+
145
+ ```
146
+ Input: [user: "hello", assistant: "Hi!", user: "bye"]
147
+ Output: [user: "bye", assistant: "Hi!", user: "hello"] // shuffled!
148
+ ```
149
+
150
+ After:
151
+
152
+ ```
153
+ Input: [user: "hello", assistant: "Hi!", user: "bye"]
154
+ Output: [user: "hello", assistant: "Hi!", user: "bye"] // correct order
155
+ ```
156
+
157
+ - Fix Scorer not using custom gateways registered with Mastra ([#10778](https://github.com/mastra-ai/mastra/pull/10778))
158
+
159
+ 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.
160
+
161
+ - Fix workflow run status not being updated from storage snapshot in createRun ([#10664](https://github.com/mastra-ai/mastra/pull/10664))
162
+
163
+ 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').
164
+
165
+ - Pass resourceId and threadId to network agent's subAgent when it has its own memory ([#10592](https://github.com/mastra-ai/mastra/pull/10592))
166
+
167
+ - 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))
168
+
169
+ - 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))
170
+
171
+ This lets you pass provider-specific settings like `reasoningEffort` for OpenAI thinking models:
172
+
173
+ ```typescript
174
+ const processor = new PromptInjectionDetector({
175
+ model: 'openai/o1-mini',
176
+ threshold: 0.7,
177
+ strategy: 'block',
178
+ providerOptions: {
179
+ openai: {
180
+ reasoningEffort: 'low',
181
+ },
182
+ },
183
+ });
184
+ ```
185
+
186
+ - 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))
187
+
188
+ - 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))
189
+
190
+ - Adds bidirectional integration with otel tracing via a new @mastra/otel-bridge package. ([#10482](https://github.com/mastra-ai/mastra/pull/10482))
191
+
192
+ - 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))
193
+
194
+ ```ts
195
+ const processor: Processor = {
196
+ id: 'my-processor',
197
+ processInputStep: async ({ messages, messageList, stepNumber, systemMessages }) => {
198
+ // Transform messages at each step before LLM call
199
+ return messageList;
200
+ },
201
+ };
202
+ ```
203
+
204
+ - 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))
205
+
206
+ **Before:**
207
+
208
+ ```ts
209
+ const result = await agent.generate('hello');
210
+ result.text; // "hello world" (unprocessed)
211
+ result.response.messages[0].content[0].text; // "HELLO WORLD" (processed)
212
+ ```
213
+
214
+ **After:**
215
+
216
+ ```ts
217
+ const result = await agent.generate('hello');
218
+ result.text; // "HELLO WORLD" (processed)
219
+ ```
220
+
221
+ 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.
222
+
223
+ - Refactored default engine to fit durable execution better, and the inngest engine to match. ([#10627](https://github.com/mastra-ai/mastra/pull/10627))
224
+ Also fixes requestContext persistence by relying on inngest step memoization.
225
+
226
+ Unifies some of the stepResults and error formats in both engines.
227
+
228
+ - Allow direct access to server app handle directly from Mastra instance. ([#10598](https://github.com/mastra-ai/mastra/pull/10598))
229
+
230
+ ```ts
231
+ // Before: HTTP request to localhost
232
+ const response = await fetch(`http://localhost:5000/api/tools`);
233
+
234
+ // After: Direct call via app.fetch()
235
+ const app = mastra.getServerApp<Hono>();
236
+ const response = await app.fetch(new Request('http://internal/api/tools'));
237
+ ```
238
+
239
+ - Added `mastra.getServerApp<T>()` to access the underlying Hono/Express app
240
+ - Added `mastra.getMastraServer()` and `mastra.setMastraServer()` for adapter access
241
+ - Added `MastraServerBase` class in `@mastra/core/server` for adapter implementations
242
+ - Server adapters now auto-register with Mastra in their constructor
243
+
244
+ - Fix network agent not getting `text-delta` from subAgent when `.stream` is used ([#10533](https://github.com/mastra-ai/mastra/pull/10533))
245
+
246
+ - Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
247
+
248
+ - Fix writer.custom not working during workflow resume operations ([#10720](https://github.com/mastra-ai/mastra/pull/10720))
249
+
250
+ 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.
251
+
252
+ - Fix corrupted provider-registry.json file in global cache and regenerate corrupted files ([#10606](https://github.com/mastra-ai/mastra/pull/10606))
253
+
254
+ - Fix TypeScript error when using Zod schemas in `defaultOptions.structuredOutput` ([#10710](https://github.com/mastra-ai/mastra/pull/10710))
255
+
256
+ Previously, defining `structuredOutput.schema` in `defaultOptions` would cause a TypeScript error because the type only accepted `undefined`. Now any valid `OutputSchema` is correctly accepted.
257
+
258
+ - 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))
259
+
260
+ ```typescript
261
+ createTool({
262
+ id: 'my-tool',
263
+ providerOptions: {
264
+ anthropic: { cacheControl: { type: 'ephemeral' } },
265
+ },
266
+ // ...
267
+ });
268
+ ```
269
+
270
+ - 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))
271
+
272
+ - 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)]:
273
+ - @mastra/observability@1.0.0-beta.2
274
+ - @mastra/schema-compat@1.0.0-beta.2
275
+
276
+ ## 1.0.0-beta.5
277
+
278
+ ### Patch Changes
279
+
280
+ - Add Azure OpenAI gateway ([#9990](https://github.com/mastra-ai/mastra/pull/9990))
281
+
282
+ The Azure OpenAI gateway supports three configuration modes:
283
+ 1. **Static deployments**: Provide deployment names from Azure Portal
284
+ 2. **Dynamic discovery**: Query Azure Management API for available deployments
285
+ 3. **Manual**: Specify deployment names when creating agents
286
+
287
+ ## Usage
288
+
289
+ ```typescript
290
+ import { Mastra } from '@mastra/core';
291
+ import { AzureOpenAIGateway } from '@mastra/core/llm';
292
+
293
+ // Static mode (recommended)
294
+ export const mastra = new Mastra({
295
+ gateways: [
296
+ new AzureOpenAIGateway({
297
+ resourceName: process.env.AZURE_RESOURCE_NAME!,
298
+ apiKey: process.env.AZURE_API_KEY!,
299
+ deployments: ['gpt-4-prod', 'gpt-35-turbo-dev'],
300
+ }),
301
+ ],
302
+ });
303
+
304
+ // Dynamic discovery mode
305
+ export const mastra = new Mastra({
306
+ gateways: [
307
+ new AzureOpenAIGateway({
308
+ resourceName: process.env.AZURE_RESOURCE_NAME!,
309
+ apiKey: process.env.AZURE_API_KEY!,
310
+ management: {
311
+ tenantId: process.env.AZURE_TENANT_ID!,
312
+ clientId: process.env.AZURE_CLIENT_ID!,
313
+ clientSecret: process.env.AZURE_CLIENT_SECRET!,
314
+ subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
315
+ resourceGroup: 'my-resource-group',
316
+ },
317
+ }),
318
+ ],
319
+ });
320
+
321
+ // Use Azure OpenAI models
322
+ const agent = new Agent({
323
+ model: 'azure-openai/gpt-4-deployment',
324
+ instructions: 'You are a helpful assistant',
325
+ });
326
+ ```
327
+
328
+ - - Fix tool suspension throwing error when `outputSchema` is passed to tool during creation ([#10444](https://github.com/mastra-ai/mastra/pull/10444))
329
+ - Pass `suspendSchema` and `resumeSchema` from tool into step created when creating step from tool
330
+
331
+ - Add `onOutput` hook for tools ([#10466](https://github.com/mastra-ai/mastra/pull/10466))
332
+
333
+ 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.
334
+
335
+ The `onOutput` hook receives:
336
+ - `output`: The tool's return value (typed according to `outputSchema`)
337
+ - `toolCallId`: Unique identifier for the tool call
338
+ - `toolName`: The name of the tool that was executed
339
+ - `abortSignal`: Signal for detecting if the operation should be cancelled
340
+
341
+ Example usage:
342
+
343
+ ```typescript
344
+ import { createTool } from '@mastra/core/tools';
345
+ import { z } from 'zod';
346
+
347
+ export const weatherTool = createTool({
348
+ id: 'weather-tool',
349
+ description: 'Get weather information',
350
+ outputSchema: z.object({
351
+ temperature: z.number(),
352
+ conditions: z.string(),
353
+ }),
354
+ execute: async input => {
355
+ return { temperature: 72, conditions: 'sunny' };
356
+ },
357
+ onOutput: ({ output, toolCallId, toolName }) => {
358
+ console.log(`${toolName} completed:`, output);
359
+ // output is fully typed based on outputSchema
360
+ },
361
+ });
362
+ ```
363
+
364
+ Hook execution order:
365
+ 1. `onInputStart` - Input streaming begins
366
+ 2. `onInputDelta` - Input chunks arrive (called multiple times)
367
+ 3. `onInputAvailable` - Complete input parsed and validated
368
+ 4. Tool's `execute` function runs
369
+ 5. `onOutput` - Tool completed successfully (NEW)
370
+
371
+ - Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
372
+
373
+ - Fix base64 encoded images with threads - issue #10480 ([#10483](https://github.com/mastra-ai/mastra/pull/10483))
374
+
375
+ 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.
376
+
377
+ **Changes:**
378
+ - Updated `attachments-to-parts.ts` to detect and convert raw base64 strings to data URIs
379
+ - Fixed `MessageList` image processing to handle raw base64 in two locations:
380
+ - Image part conversion in `aiV4CoreMessageToV1PromptMessage`
381
+ - File part to experimental_attachments conversion in `mastraDBMessageToAIV4UIMessage`
382
+ - Added comprehensive tests for base64 images, data URIs, and HTTP URLs with threads
383
+
384
+ **Breaking Change:** None - this is a bug fix that maintains backward compatibility while adding support for raw base64 strings.
385
+
386
+ - 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))
387
+
388
+ Now metadata is properly preserved for all message input formats:
389
+ - Simple CoreMessage format: `{role, content, metadata}`
390
+ - Full UIMessage format: `{role, content, parts, metadata}`
391
+ - AI SDK v5 ModelMessage format with metadata
392
+
393
+ Fixes #8556
394
+
395
+ - feat: Composite auth implementation ([#10359](https://github.com/mastra-ai/mastra/pull/10359))
396
+
397
+ - 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))
398
+
399
+ - Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
400
+
401
+ - Fix Azure Foundry rate limit handling for -1 values ([#10409](https://github.com/mastra-ai/mastra/pull/10409))
402
+
403
+ - Fix model headers not being passed through gateway system ([#10465](https://github.com/mastra-ai/mastra/pull/10465))
404
+
405
+ Previously, custom headers specified in `MastraModelConfig` were not being passed through the gateway system to model providers. This affected:
406
+ - OpenRouter (preventing activity tracking with `HTTP-Referer` and `X-Title`)
407
+ - Custom providers using custom URLs (headers not passed to `createOpenAICompatible`)
408
+ - Custom gateway implementations (headers not available in `resolveLanguageModel`)
409
+
410
+ Now headers are correctly passed through the entire gateway system:
411
+ - Base `MastraModelGateway` interface updated to accept headers
412
+ - `ModelRouterLanguageModel` passes headers from config to all gateways
413
+ - OpenRouter receives headers for activity tracking
414
+ - Custom URL providers receive headers via `createOpenAICompatible`
415
+ - Custom gateways can access headers in their `resolveLanguageModel` implementation
416
+
417
+ Example usage:
418
+
419
+ ```typescript
420
+ // Works with OpenRouter
421
+ const agent = new Agent({
422
+ name: 'my-agent',
423
+ instructions: 'You are a helpful assistant.',
424
+ model: {
425
+ id: 'openrouter/anthropic/claude-3-5-sonnet',
426
+ headers: {
427
+ 'HTTP-Referer': 'https://myapp.com',
428
+ 'X-Title': 'My Application',
429
+ },
430
+ },
431
+ });
432
+
433
+ // Also works with custom providers
434
+ const customAgent = new Agent({
435
+ name: 'custom-agent',
436
+ instructions: 'You are a helpful assistant.',
437
+ model: {
438
+ id: 'custom-provider/model',
439
+ url: 'https://api.custom.com/v1',
440
+ apiKey: 'key',
441
+ headers: {
442
+ 'X-Custom-Header': 'custom-value',
443
+ },
444
+ },
445
+ });
446
+ ```
447
+
448
+ Fixes https://github.com/mastra-ai/mastra/issues/9760
449
+
450
+ - fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
451
+
452
+ 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.
453
+
454
+ **Backend changes (@mastra/core):**
455
+ - Add assistant messages to messageList immediately after LLM execution
456
+ - Flush messages synchronously before suspension to persist state
457
+ - Create thread if it doesn't exist before flushing
458
+ - Add metadata helpers to persist and remove tool approval state
459
+ - Pass saveQueueManager and memory context through workflow for immediate persistence
460
+
461
+ **Frontend changes (@mastra/react):**
462
+ - Extract runId from pending approvals to enable resumption after refresh
463
+ - Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
464
+ - Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
465
+ - Change runId from hardcoded `agentId` to unique `uuid()`
466
+
467
+ **UI changes (@mastra/playground-ui):**
468
+ - Handle tool calls awaiting approval in message initialization
469
+ - Convert approval metadata format when loading initial messages
470
+
471
+ Fixes #9745, #9906
472
+
473
+ - 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))
474
+
475
+ 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.
476
+
477
+ Add Gemini 3 Pro test coverage in agent-gemini.test.ts to validate the latest Gemini model integration.
478
+
479
+ - Fix race condition in parallel tool stream writes ([#10463](https://github.com/mastra-ai/mastra/pull/10463))
480
+
481
+ Introduces a write queue to ToolStream to serialize access to the underlying stream, preventing writer locked errors
482
+
483
+ - Remove unneeded console warning when flushing messages and no threadId or saveQueueManager is found. ([#10498](https://github.com/mastra-ai/mastra/pull/10498))
484
+
485
+ - Add optional includeRawChunks parameter to agent execution options, ([#10456](https://github.com/mastra-ai/mastra/pull/10456))
486
+ allowing users to include raw chunks in stream output where supported
487
+ by the model provider.
488
+
489
+ - 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))
490
+
491
+ The fix uses atomic writes via the write-to-temp-then-rename pattern. Instead of:
492
+
493
+ ```ts
494
+ fs.writeFileSync(filePath, content, 'utf-8');
495
+ ```
496
+
497
+ We now do:
498
+
499
+ ```ts
500
+ const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;
501
+ fs.writeFileSync(tempPath, content, 'utf-8');
502
+ fs.renameSync(tempPath, filePath); // atomic on POSIX
503
+ ```
504
+
505
+ `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.
506
+
507
+ - Fix .map when placed at the beginning of a workflow or nested workflow ([#10457](https://github.com/mastra-ai/mastra/pull/10457))
508
+
509
+ - 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))
510
+ - **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.
511
+ - **Added comprehensive tests**:
512
+ - Test for `writer.custom()` with direct tool execution
513
+ - Test for `writer.custom()` with sub-agent tools (nested execution)
514
+ - Test for mixed usage of `writer.write()` and `writer.custom()` in the same tool
515
+
516
+ 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.
517
+
518
+ This ensures that:
519
+ - Data chunks from tools always appear directly in the stream (not wrapped)
520
+ - Data chunks bubble up correctly through nested agent hierarchies
521
+ - Regular chunks continue to be wrapped in `tool-output` as expected
522
+
523
+ - Update agent workflow and sub-agent tool transformations to accept more input arguments. ([#10278](https://github.com/mastra-ai/mastra/pull/10278))
524
+
525
+ These tools now accept the following
526
+
527
+ ```
528
+ workflowTool.execute({ inputData, initialState }, context)
529
+
530
+ agentTool.execute({ prompt, threadId, resourceId, instructions, maxSteps }, context)
531
+ ```
532
+
533
+ Workflow tools now also properly return errors when the workflow run fails
534
+
535
+ ```
536
+ const workflowResult = await workflowTool.execute({ inputData, initialState }, context)
537
+
538
+ console.log(workflowResult.error) // error msg if error
539
+ console.log(workflowResult.result) // result of the workflow if success
540
+ ```
541
+
542
+ Workflows passed to agents do not properly handle suspend/resume`, they only handle success or error.
543
+
544
+ - Fixed OpenAI schema compatibility when using `agent.generate()` or `agent.stream()` with `structuredOutput`. ([#10366](https://github.com/mastra-ai/mastra/pull/10366))
545
+
546
+ ## Changes
547
+ - **Automatic transformation**: Zod schemas are now automatically transformed for OpenAI strict mode compatibility when using OpenAI models (including reasoning models like o1, o3, o4)
548
+ - **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
549
+ - **Preserves nullable fields**: Intentionally `.nullable()` fields remain unchanged
550
+ - **Deep transformation**: Handles `.optional()` fields at any nesting level (objects, arrays, unions, etc.)
551
+ - **JSON Schema objects**: Not transformed, only Zod schemas
552
+
553
+ ## Example
554
+
555
+ ```typescript
556
+ const agent = new Agent({
557
+ name: 'data-extractor',
558
+ model: { provider: 'openai', modelId: 'gpt-4o' },
559
+ instructions: 'Extract user information',
560
+ });
561
+
562
+ const schema = z.object({
563
+ name: z.string(),
564
+ age: z.number().optional(),
565
+ deletedAt: z.date().nullable(),
566
+ });
567
+
568
+ // Schema is automatically transformed for OpenAI compatibility
569
+ const result = await agent.generate('Extract: John, deleted yesterday', {
570
+ structuredOutput: { schema },
571
+ });
572
+
573
+ // Result: { name: 'John', age: undefined, deletedAt: null }
574
+ ```
575
+
576
+ - Fix network data step formatting in AI SDK stream transformation ([#10432](https://github.com/mastra-ai/mastra/pull/10432))
577
+
578
+ 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.
579
+
580
+ **Changes:**
581
+ - Enhanced step tracking in `AgentNetworkToAISDKTransformer` to properly maintain step state throughout execution lifecycle
582
+ - Steps are now identified by unique IDs and updated in place rather than creating duplicates
583
+ - Added proper iteration and task metadata to each step in the network execution flow
584
+ - Fixed agent, workflow, and tool execution events to correctly populate step data
585
+ - Updated network stream event types to include `networkId`, `workflowId`, and consistent `runId` tracking
586
+ - Added test coverage for network custom data chunks with comprehensive validation
587
+
588
+ This ensures the AI SDK correctly represents the full execution flow of agent networks with accurate step sequencing and metadata.
589
+
590
+ - Fix generating provider-registry.json ([#10392](https://github.com/mastra-ai/mastra/pull/10392))
591
+
592
+ - 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))
593
+
594
+ - Fix working memory zod to json schema conversion to use schema-compat zodtoJsonSchema fn. ([#10391](https://github.com/mastra-ai/mastra/pull/10391))
595
+
596
+ - 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))
597
+
598
+ - Updated dependencies [[`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013)]:
599
+ - @mastra/schema-compat@1.0.0-beta.1
600
+
3
601
  ## 1.0.0-beta.4
4
602
 
5
603
  ### Patch Changes