@mastra/core 1.2.1-alpha.0 → 1.3.0-alpha.2

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 (403) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2093 -262
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent.d.ts +12 -3
  5. package/dist/agent/agent.d.ts.map +1 -1
  6. package/dist/agent/index.cjs +13 -13
  7. package/dist/agent/index.js +2 -2
  8. package/dist/agent/message-list/index.cjs +18 -18
  9. package/dist/agent/message-list/index.js +1 -1
  10. package/dist/agent/message-list/message-list.d.ts.map +1 -1
  11. package/dist/agent/types.d.ts +6 -1
  12. package/dist/agent/types.d.ts.map +1 -1
  13. package/dist/agent/workflows/prepare-stream/index.d.ts +3 -1
  14. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  15. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  16. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
  17. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  18. package/dist/base.cjs +2 -2
  19. package/dist/base.d.ts +13 -1
  20. package/dist/base.d.ts.map +1 -1
  21. package/dist/base.js +1 -1
  22. package/dist/bundler/index.cjs +2 -2
  23. package/dist/bundler/index.js +1 -1
  24. package/dist/cache/index.cjs +3 -3
  25. package/dist/cache/index.js +1 -1
  26. package/dist/{chunk-ENCTSDWC.js → chunk-2GWTJFVM.js} +2410 -1402
  27. package/dist/chunk-2GWTJFVM.js.map +1 -0
  28. package/dist/{chunk-OB4V67IX.cjs → chunk-2K5PNW2U.cjs} +4 -4
  29. package/dist/{chunk-OB4V67IX.cjs.map → chunk-2K5PNW2U.cjs.map} +1 -1
  30. package/dist/{chunk-VZXYBFCX.cjs → chunk-2P6DD7M5.cjs} +10 -10
  31. package/dist/{chunk-VZXYBFCX.cjs.map → chunk-2P6DD7M5.cjs.map} +1 -1
  32. package/dist/{chunk-Q2D7LERO.cjs → chunk-2VD5OGOT.cjs} +4 -4
  33. package/dist/{chunk-Q2D7LERO.cjs.map → chunk-2VD5OGOT.cjs.map} +1 -1
  34. package/dist/{chunk-2DMSFLJY.cjs → chunk-6TZKQI4R.cjs} +8 -8
  35. package/dist/chunk-6TZKQI4R.cjs.map +1 -0
  36. package/dist/{chunk-4NG7CKEG.js → chunk-6VGCVSP4.js} +3 -3
  37. package/dist/{chunk-4NG7CKEG.js.map → chunk-6VGCVSP4.js.map} +1 -1
  38. package/dist/{chunk-IIZF4W7B.cjs → chunk-7UWHFWST.cjs} +52 -5
  39. package/dist/chunk-7UWHFWST.cjs.map +1 -0
  40. package/dist/{chunk-VW7YQWDW.cjs → chunk-BFIOQFGF.cjs} +28 -2
  41. package/dist/chunk-BFIOQFGF.cjs.map +1 -0
  42. package/dist/{chunk-E3VFKTIA.js → chunk-BXLLXTT4.js} +2245 -179
  43. package/dist/chunk-BXLLXTT4.js.map +1 -0
  44. package/dist/{chunk-HMCXNOF6.cjs → chunk-CGPH7CMG.cjs} +2431 -1417
  45. package/dist/chunk-CGPH7CMG.cjs.map +1 -0
  46. package/dist/{chunk-GVLPTDJA.cjs → chunk-D5JZT6EK.cjs} +236 -63
  47. package/dist/chunk-D5JZT6EK.cjs.map +1 -0
  48. package/dist/{chunk-5SOS47PH.cjs → chunk-FLHFB23E.cjs} +454 -222
  49. package/dist/chunk-FLHFB23E.cjs.map +1 -0
  50. package/dist/{chunk-XCPEEIHI.cjs → chunk-GCTAD6B7.cjs} +3012 -927
  51. package/dist/chunk-GCTAD6B7.cjs.map +1 -0
  52. package/dist/{chunk-W3AQUG66.js → chunk-GIY5BINT.js} +4 -4
  53. package/dist/{chunk-W3AQUG66.js.map → chunk-GIY5BINT.js.map} +1 -1
  54. package/dist/{chunk-M6VFJX5A.js → chunk-GMSAGYTB.js} +3 -3
  55. package/dist/{chunk-M6VFJX5A.js.map → chunk-GMSAGYTB.js.map} +1 -1
  56. package/dist/{chunk-JRJJ5VQE.cjs → chunk-GZD6443M.cjs} +99 -55
  57. package/dist/chunk-GZD6443M.cjs.map +1 -0
  58. package/dist/{chunk-Z6NRYYOH.js → chunk-ILQXPZCD.js} +9 -4
  59. package/dist/chunk-ILQXPZCD.js.map +1 -0
  60. package/dist/{chunk-5YVR7B4R.js → chunk-JQNREL64.js} +29 -9
  61. package/dist/chunk-JQNREL64.js.map +1 -0
  62. package/dist/{chunk-QOFI2WBM.cjs → chunk-JU6K7UDX.cjs} +991 -229
  63. package/dist/chunk-JU6K7UDX.cjs.map +1 -0
  64. package/dist/{chunk-HN2MSTR6.cjs → chunk-KAJNBNWP.cjs} +283 -38
  65. package/dist/chunk-KAJNBNWP.cjs.map +1 -0
  66. package/dist/{chunk-MSWXEOZC.js → chunk-KL2JPSRX.js} +5 -5
  67. package/dist/chunk-KL2JPSRX.js.map +1 -0
  68. package/dist/{chunk-MQB7XFXP.js → chunk-LHRHOPUC.js} +3 -3
  69. package/dist/{chunk-MQB7XFXP.js.map → chunk-LHRHOPUC.js.map} +1 -1
  70. package/dist/{chunk-VX7UA3SO.js → chunk-MOOJ3H3C.js} +974 -217
  71. package/dist/chunk-MOOJ3H3C.js.map +1 -0
  72. package/dist/{chunk-HU2ONA2W.cjs → chunk-ON2KVIUJ.cjs} +17 -17
  73. package/dist/{chunk-HU2ONA2W.cjs.map → chunk-ON2KVIUJ.cjs.map} +1 -1
  74. package/dist/{chunk-I66TMZJ3.cjs → chunk-OOCEAC6U.cjs} +21 -18
  75. package/dist/chunk-OOCEAC6U.cjs.map +1 -0
  76. package/dist/{chunk-MNWW2R3U.js → chunk-OV7OOUUR.js} +90 -54
  77. package/dist/chunk-OV7OOUUR.js.map +1 -0
  78. package/dist/{chunk-C4WWWQHT.cjs → chunk-RO47SMI7.cjs} +23 -3
  79. package/dist/chunk-RO47SMI7.cjs.map +1 -0
  80. package/dist/{chunk-6FG6FU5Y.cjs → chunk-RQ56ZSIR.cjs} +4 -4
  81. package/dist/{chunk-6FG6FU5Y.cjs.map → chunk-RQ56ZSIR.cjs.map} +1 -1
  82. package/dist/{chunk-IW3BNL7A.js → chunk-RS6CZXGA.js} +50 -3
  83. package/dist/chunk-RS6CZXGA.js.map +1 -0
  84. package/dist/{chunk-AIJLACR2.js → chunk-S53FKKVL.js} +27 -3
  85. package/dist/chunk-S53FKKVL.js.map +1 -0
  86. package/dist/{chunk-G6E3QNJC.js → chunk-SBPPGJL6.js} +4078 -4333
  87. package/dist/chunk-SBPPGJL6.js.map +1 -0
  88. package/dist/{chunk-UZL4H5P2.cjs → chunk-SH4PCZ3X.cjs} +5375 -5648
  89. package/dist/chunk-SH4PCZ3X.cjs.map +1 -0
  90. package/dist/{chunk-ZWM2CAIM.js → chunk-STKNQDVA.js} +4 -4
  91. package/dist/{chunk-ZWM2CAIM.js.map → chunk-STKNQDVA.js.map} +1 -1
  92. package/dist/{chunk-A5QFWX67.cjs → chunk-U2CABSMC.cjs} +79 -59
  93. package/dist/chunk-U2CABSMC.cjs.map +1 -0
  94. package/dist/{chunk-7MDVYPWX.cjs → chunk-UE2G2LRP.cjs} +9 -4
  95. package/dist/chunk-UE2G2LRP.cjs.map +1 -0
  96. package/dist/{chunk-AUF6U2BL.js → chunk-VM25PDSW.js} +5 -5
  97. package/dist/{chunk-AUF6U2BL.js.map → chunk-VM25PDSW.js.map} +1 -1
  98. package/dist/{chunk-RXD5EGQF.js → chunk-VVD56FI4.js} +228 -55
  99. package/dist/chunk-VVD56FI4.js.map +1 -0
  100. package/dist/{chunk-JIT2OY3X.js → chunk-WCAFTXGK.js} +23 -3
  101. package/dist/chunk-WCAFTXGK.js.map +1 -0
  102. package/dist/{chunk-P62OJXQ4.js → chunk-WL3AW3YA.js} +282 -37
  103. package/dist/chunk-WL3AW3YA.js.map +1 -0
  104. package/dist/{chunk-YLODOPYM.cjs → chunk-XDD5V446.cjs} +4163 -5352
  105. package/dist/chunk-XDD5V446.cjs.map +1 -0
  106. package/dist/{chunk-B4M33FCS.cjs → chunk-XQVYEOI7.cjs} +7 -7
  107. package/dist/{chunk-B4M33FCS.cjs.map → chunk-XQVYEOI7.cjs.map} +1 -1
  108. package/dist/{chunk-BP2TSCBW.js → chunk-ZATLLPIH.js} +4391 -5561
  109. package/dist/chunk-ZATLLPIH.js.map +1 -0
  110. package/dist/{chunk-T6PRRKMW.js → chunk-ZHFM7HCQ.js} +9 -6
  111. package/dist/chunk-ZHFM7HCQ.js.map +1 -0
  112. package/dist/{chunk-WFUNLRQX.js → chunk-ZRUTE56J.js} +366 -134
  113. package/dist/chunk-ZRUTE56J.js.map +1 -0
  114. package/dist/deployer/index.cjs +2 -2
  115. package/dist/deployer/index.js +1 -1
  116. package/dist/docs/SKILL.md +2 -9
  117. package/dist/docs/assets/SOURCE_MAP.json +399 -342
  118. package/dist/docs/references/docs-agents-agent-memory.md +45 -1
  119. package/dist/docs/references/docs-agents-network-approval.md +1 -1
  120. package/dist/docs/references/docs-agents-networks.md +3 -3
  121. package/dist/docs/references/docs-agents-overview.md +8 -0
  122. package/dist/docs/references/docs-agents-using-tools.md +82 -72
  123. package/dist/docs/references/docs-memory-observational-memory.md +11 -8
  124. package/dist/docs/references/docs-observability-overview.md +1 -1
  125. package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +70 -0
  126. package/dist/docs/references/docs-observability-tracing-overview.md +1 -1
  127. package/dist/docs/references/docs-server-middleware.md +0 -2
  128. package/dist/docs/references/docs-server-request-context.md +17 -0
  129. package/dist/docs/references/docs-workflows-agents-and-tools.md +2 -2
  130. package/dist/docs/references/docs-workflows-overview.md +1 -1
  131. package/dist/docs/references/docs-workspace-filesystem.md +2 -0
  132. package/dist/docs/references/docs-workspace-overview.md +3 -1
  133. package/dist/docs/references/docs-workspace-sandbox.md +2 -0
  134. package/dist/docs/references/docs-workspace-search.md +2 -0
  135. package/dist/docs/references/docs-workspace-skills.md +3 -1
  136. package/dist/docs/references/reference-agents-getTools.md +1 -6
  137. package/dist/docs/references/reference-agents-listAgents.md +1 -1
  138. package/dist/docs/references/reference-agents-network.md +0 -2
  139. package/dist/docs/references/reference-cli-mastra.md +29 -4
  140. package/dist/docs/references/reference-client-js-agents.md +1 -1
  141. package/dist/docs/references/reference-configuration.md +1 -1
  142. package/dist/docs/references/reference-core-getStoredAgentById.md +2 -2
  143. package/dist/docs/references/reference-core-listStoredAgents.md +1 -1
  144. package/dist/docs/references/reference-memory-observational-memory.md +2 -0
  145. package/dist/docs/references/reference-tools-mcp-client.md +0 -2
  146. package/dist/docs/references/reference-workflows-step.md +2 -0
  147. package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
  148. package/dist/docs/references/reference-workspace-filesystem.md +2 -0
  149. package/dist/docs/references/reference-workspace-local-filesystem.md +2 -0
  150. package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
  151. package/dist/docs/references/reference-workspace-sandbox.md +2 -0
  152. package/dist/docs/references/reference-workspace-workspace-class.md +2 -0
  153. package/dist/docs/references/reference.md +7 -2
  154. package/dist/editor/index.d.ts +1 -1
  155. package/dist/editor/index.d.ts.map +1 -1
  156. package/dist/editor/types.d.ts +53 -48
  157. package/dist/editor/types.d.ts.map +1 -1
  158. package/dist/evals/base.d.ts +15 -0
  159. package/dist/evals/base.d.ts.map +1 -1
  160. package/dist/evals/index.cjs +20 -20
  161. package/dist/evals/index.js +3 -3
  162. package/dist/evals/run/index.d.ts +3 -3
  163. package/dist/evals/run/index.d.ts.map +1 -1
  164. package/dist/evals/scoreTraces/index.cjs +5 -5
  165. package/dist/evals/scoreTraces/index.js +2 -2
  166. package/dist/features/index.cjs +1 -1
  167. package/dist/features/index.cjs.map +1 -1
  168. package/dist/features/index.d.ts.map +1 -1
  169. package/dist/features/index.js +1 -1
  170. package/dist/features/index.js.map +1 -1
  171. package/dist/index.cjs +4 -4
  172. package/dist/index.d.ts +3 -3
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +2 -2
  175. package/dist/integration/index.cjs +2 -2
  176. package/dist/integration/index.js +1 -1
  177. package/dist/llm/index.cjs +16 -16
  178. package/dist/llm/index.js +5 -5
  179. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  180. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  181. package/dist/llm/model/model.loop.d.ts +1 -1
  182. package/dist/llm/model/model.loop.d.ts.map +1 -1
  183. package/dist/llm/model/provider-types.generated.d.ts +128 -10
  184. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  185. package/dist/loop/index.cjs +12 -12
  186. package/dist/loop/index.js +1 -1
  187. package/dist/loop/network/index.d.ts +3 -3
  188. package/dist/loop/network/index.d.ts.map +1 -1
  189. package/dist/loop/network/run-command-tool.d.ts +1 -1
  190. package/dist/loop/types.d.ts +13 -0
  191. package/dist/loop/types.d.ts.map +1 -1
  192. package/dist/loop/workflows/agentic-execution/index.d.ts +9 -9
  193. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +7 -7
  194. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  195. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +3 -3
  196. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  197. package/dist/loop/workflows/agentic-loop/index.d.ts +9 -9
  198. package/dist/loop/workflows/schema.d.ts +12 -12
  199. package/dist/mastra/index.cjs +2 -2
  200. package/dist/mastra/index.d.ts +91 -5
  201. package/dist/mastra/index.d.ts.map +1 -1
  202. package/dist/mastra/index.js +1 -1
  203. package/dist/mcp/index.cjs +2 -2
  204. package/dist/mcp/index.js +1 -1
  205. package/dist/memory/index.cjs +14 -14
  206. package/dist/memory/index.js +1 -1
  207. package/dist/memory/mock.d.ts.map +1 -1
  208. package/dist/memory/types.d.ts +128 -0
  209. package/dist/memory/types.d.ts.map +1 -1
  210. package/dist/models-dev-FQVUTQ7L.js +3 -0
  211. package/dist/{models-dev-Z45JSLWD.js.map → models-dev-FQVUTQ7L.js.map} +1 -1
  212. package/dist/models-dev-PPIXUUCU.cjs +12 -0
  213. package/dist/{models-dev-OQKVMEIT.cjs.map → models-dev-PPIXUUCU.cjs.map} +1 -1
  214. package/dist/netlify-4RIKF7Y3.js +3 -0
  215. package/dist/{netlify-SSWMYSAX.js.map → netlify-4RIKF7Y3.js.map} +1 -1
  216. package/dist/netlify-V5F7JEJH.cjs +12 -0
  217. package/dist/{netlify-TXZZCT6N.cjs.map → netlify-V5F7JEJH.cjs.map} +1 -1
  218. package/dist/processors/index.cjs +41 -41
  219. package/dist/processors/index.js +1 -1
  220. package/dist/processors/step-schema.d.ts +44 -44
  221. package/dist/provider-registry-C6XCYX44.cjs +40 -0
  222. package/dist/{provider-registry-NR7FXV2Q.cjs.map → provider-registry-C6XCYX44.cjs.map} +1 -1
  223. package/dist/provider-registry-NWU4YFQW.js +3 -0
  224. package/dist/{provider-registry-RPOTQNHI.js.map → provider-registry-NWU4YFQW.js.map} +1 -1
  225. package/dist/provider-registry.json +278 -33
  226. package/dist/relevance/index.cjs +3 -3
  227. package/dist/relevance/index.js +1 -1
  228. package/dist/server/index.cjs +3 -3
  229. package/dist/server/index.js +1 -1
  230. package/dist/storage/base.d.ts +3 -1
  231. package/dist/storage/base.d.ts.map +1 -1
  232. package/dist/storage/constants.cjs +51 -19
  233. package/dist/storage/constants.d.ts +10 -2
  234. package/dist/storage/constants.d.ts.map +1 -1
  235. package/dist/storage/constants.js +1 -1
  236. package/dist/storage/domains/agents/base.d.ts +13 -164
  237. package/dist/storage/domains/agents/base.d.ts.map +1 -1
  238. package/dist/storage/domains/agents/index.d.ts +0 -1
  239. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  240. package/dist/storage/domains/agents/inmemory.d.ts +6 -10
  241. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
  242. package/dist/storage/domains/index.d.ts +3 -0
  243. package/dist/storage/domains/index.d.ts.map +1 -1
  244. package/dist/storage/domains/inmemory-db.d.ts +7 -1
  245. package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
  246. package/dist/storage/domains/memory/base.d.ts +45 -5
  247. package/dist/storage/domains/memory/base.d.ts.map +1 -1
  248. package/dist/storage/domains/memory/inmemory.d.ts +7 -7
  249. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  250. package/dist/storage/domains/observability/types.d.ts +62 -62
  251. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  252. package/dist/storage/domains/prompt-blocks/base.d.ts +47 -0
  253. package/dist/storage/domains/prompt-blocks/base.d.ts.map +1 -0
  254. package/dist/storage/domains/prompt-blocks/index.d.ts +3 -0
  255. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
  256. package/dist/storage/domains/prompt-blocks/inmemory.d.ts +31 -0
  257. package/dist/storage/domains/prompt-blocks/inmemory.d.ts.map +1 -0
  258. package/dist/storage/domains/scorer-definitions/base.d.ts +47 -0
  259. package/dist/storage/domains/scorer-definitions/base.d.ts.map +1 -0
  260. package/dist/storage/domains/scorer-definitions/index.d.ts +3 -0
  261. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
  262. package/dist/storage/domains/scorer-definitions/inmemory.d.ts +31 -0
  263. package/dist/storage/domains/scorer-definitions/inmemory.d.ts.map +1 -0
  264. package/dist/storage/domains/versioned.d.ts +136 -0
  265. package/dist/storage/domains/versioned.d.ts.map +1 -0
  266. package/dist/storage/index.cjs +156 -104
  267. package/dist/storage/index.js +2 -2
  268. package/dist/storage/mock.d.ts.map +1 -1
  269. package/dist/storage/types.d.ts +481 -27
  270. package/dist/storage/types.d.ts.map +1 -1
  271. package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
  272. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  273. package/dist/stream/RunOutput.d.ts +1 -1
  274. package/dist/stream/RunOutput.d.ts.map +1 -1
  275. package/dist/stream/base/output.d.ts +4 -0
  276. package/dist/stream/base/output.d.ts.map +1 -1
  277. package/dist/stream/index.cjs +11 -11
  278. package/dist/stream/index.js +2 -2
  279. package/dist/test-utils/llm-mock.cjs +4 -4
  280. package/dist/test-utils/llm-mock.js +1 -1
  281. package/dist/tool-loop-agent/index.cjs +4 -4
  282. package/dist/tool-loop-agent/index.js +1 -1
  283. package/dist/tools/index.cjs +4 -4
  284. package/dist/tools/index.js +1 -1
  285. package/dist/tools/is-vercel-tool.cjs +2 -2
  286. package/dist/tools/is-vercel-tool.js +1 -1
  287. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  288. package/dist/tools/types.d.ts +15 -0
  289. package/dist/tools/types.d.ts.map +1 -1
  290. package/dist/tools/validation.d.ts.map +1 -1
  291. package/dist/tts/index.cjs +2 -2
  292. package/dist/tts/index.js +1 -1
  293. package/dist/types/zod-compat.d.ts +2 -2
  294. package/dist/types/zod-compat.d.ts.map +1 -1
  295. package/dist/utils/zod-utils.d.ts +19 -0
  296. package/dist/utils/zod-utils.d.ts.map +1 -1
  297. package/dist/utils.cjs +28 -28
  298. package/dist/utils.d.ts +7 -1
  299. package/dist/utils.d.ts.map +1 -1
  300. package/dist/utils.js +2 -2
  301. package/dist/vector/index.cjs +9 -9
  302. package/dist/vector/index.js +2 -2
  303. package/dist/voice/index.cjs +6 -6
  304. package/dist/voice/index.js +1 -1
  305. package/dist/workflows/evented/index.cjs +10 -10
  306. package/dist/workflows/evented/index.js +1 -1
  307. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  308. package/dist/workflows/evented/workflow.d.ts +3 -1
  309. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  310. package/dist/workflows/execution-engine.d.ts.map +1 -1
  311. package/dist/workflows/index.cjs +25 -25
  312. package/dist/workflows/index.js +1 -1
  313. package/dist/workflows/step.d.ts +4 -3
  314. package/dist/workflows/step.d.ts.map +1 -1
  315. package/dist/workflows/types.d.ts +2 -1
  316. package/dist/workflows/types.d.ts.map +1 -1
  317. package/dist/workflows/workflow.d.ts +12 -4
  318. package/dist/workflows/workflow.d.ts.map +1 -1
  319. package/dist/workspace/errors.d.ts +6 -0
  320. package/dist/workspace/errors.d.ts.map +1 -1
  321. package/dist/workspace/filesystem/composite-filesystem.d.ts +93 -0
  322. package/dist/workspace/filesystem/composite-filesystem.d.ts.map +1 -0
  323. package/dist/workspace/filesystem/filesystem.d.ts +35 -0
  324. package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
  325. package/dist/workspace/filesystem/index.d.ts +2 -0
  326. package/dist/workspace/filesystem/index.d.ts.map +1 -1
  327. package/dist/workspace/filesystem/local-filesystem.d.ts +9 -1
  328. package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
  329. package/dist/workspace/filesystem/mastra-filesystem.d.ts +92 -3
  330. package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
  331. package/dist/workspace/filesystem/mount.d.ts +34 -0
  332. package/dist/workspace/filesystem/mount.d.ts.map +1 -0
  333. package/dist/workspace/index.cjs +62 -34
  334. package/dist/workspace/index.d.ts +6 -2
  335. package/dist/workspace/index.d.ts.map +1 -1
  336. package/dist/workspace/index.js +1 -1
  337. package/dist/workspace/lifecycle.d.ts +29 -0
  338. package/dist/workspace/lifecycle.d.ts.map +1 -1
  339. package/dist/workspace/sandbox/errors.d.ts +50 -0
  340. package/dist/workspace/sandbox/errors.d.ts.map +1 -0
  341. package/dist/workspace/sandbox/index.d.ts +3 -0
  342. package/dist/workspace/sandbox/index.d.ts.map +1 -1
  343. package/dist/workspace/sandbox/local-sandbox.d.ts +17 -2
  344. package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
  345. package/dist/workspace/sandbox/mastra-sandbox.d.ts +153 -6
  346. package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
  347. package/dist/workspace/sandbox/mount-manager.d.ts +195 -0
  348. package/dist/workspace/sandbox/mount-manager.d.ts.map +1 -0
  349. package/dist/workspace/sandbox/sandbox.d.ts +37 -84
  350. package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
  351. package/dist/workspace/sandbox/types.d.ts +92 -0
  352. package/dist/workspace/sandbox/types.d.ts.map +1 -0
  353. package/dist/workspace/tools/tools.d.ts.map +1 -1
  354. package/dist/workspace/tools/tree-formatter.d.ts.map +1 -1
  355. package/dist/workspace/workspace.d.ts +73 -3
  356. package/dist/workspace/workspace.d.ts.map +1 -1
  357. package/package.json +16 -16
  358. package/src/llm/model/provider-types.generated.d.ts +128 -10
  359. package/dist/chunk-2DMSFLJY.cjs.map +0 -1
  360. package/dist/chunk-5SOS47PH.cjs.map +0 -1
  361. package/dist/chunk-5YVR7B4R.js.map +0 -1
  362. package/dist/chunk-7MDVYPWX.cjs.map +0 -1
  363. package/dist/chunk-A5QFWX67.cjs.map +0 -1
  364. package/dist/chunk-AIJLACR2.js.map +0 -1
  365. package/dist/chunk-BP2TSCBW.js.map +0 -1
  366. package/dist/chunk-C4WWWQHT.cjs.map +0 -1
  367. package/dist/chunk-E3VFKTIA.js.map +0 -1
  368. package/dist/chunk-ENCTSDWC.js.map +0 -1
  369. package/dist/chunk-G6E3QNJC.js.map +0 -1
  370. package/dist/chunk-GVLPTDJA.cjs.map +0 -1
  371. package/dist/chunk-HMCXNOF6.cjs.map +0 -1
  372. package/dist/chunk-HN2MSTR6.cjs.map +0 -1
  373. package/dist/chunk-I66TMZJ3.cjs.map +0 -1
  374. package/dist/chunk-IIZF4W7B.cjs.map +0 -1
  375. package/dist/chunk-IW3BNL7A.js.map +0 -1
  376. package/dist/chunk-JIT2OY3X.js.map +0 -1
  377. package/dist/chunk-JRJJ5VQE.cjs.map +0 -1
  378. package/dist/chunk-MNWW2R3U.js.map +0 -1
  379. package/dist/chunk-MSWXEOZC.js.map +0 -1
  380. package/dist/chunk-P62OJXQ4.js.map +0 -1
  381. package/dist/chunk-QOFI2WBM.cjs.map +0 -1
  382. package/dist/chunk-RXD5EGQF.js.map +0 -1
  383. package/dist/chunk-T6PRRKMW.js.map +0 -1
  384. package/dist/chunk-UZL4H5P2.cjs.map +0 -1
  385. package/dist/chunk-VW7YQWDW.cjs.map +0 -1
  386. package/dist/chunk-VX7UA3SO.js.map +0 -1
  387. package/dist/chunk-WFUNLRQX.js.map +0 -1
  388. package/dist/chunk-XCPEEIHI.cjs.map +0 -1
  389. package/dist/chunk-YLODOPYM.cjs.map +0 -1
  390. package/dist/chunk-Z6NRYYOH.js.map +0 -1
  391. package/dist/docs/references/docs-tools-mcp-advanced-usage.md +0 -143
  392. package/dist/docs/references/docs-tools-mcp-mcp-overview.md +0 -383
  393. package/dist/docs/references/docs-tools-mcp-overview.md +0 -78
  394. package/dist/docs/references/docs-workflows-input-data-mapping.md +0 -102
  395. package/dist/docs/references/reference-deployer-netlify.md +0 -14
  396. package/dist/docs/references/reference-deployer-vercel.md +0 -39
  397. package/dist/docs/references/reference-tools-client.md +0 -228
  398. package/dist/models-dev-OQKVMEIT.cjs +0 -12
  399. package/dist/models-dev-Z45JSLWD.js +0 -3
  400. package/dist/netlify-SSWMYSAX.js +0 -3
  401. package/dist/netlify-TXZZCT6N.cjs +0 -12
  402. package/dist/provider-registry-NR7FXV2Q.cjs +0 -40
  403. package/dist/provider-registry-RPOTQNHI.js +0 -3
@@ -1,12 +1,12 @@
1
- import { WorkflowEventProcessor } from './chunk-5YVR7B4R.js';
2
- import { isToolLoopAgentLike, toolLoopAgentToMastraAgent } from './chunk-ZWM2CAIM.js';
3
- import { createOnScorerHook } from './chunk-MSWXEOZC.js';
4
- import { EventEmitterPubSub, augmentWithInit } from './chunk-WFUNLRQX.js';
1
+ import { WorkflowEventProcessor } from './chunk-JQNREL64.js';
2
+ import { isToolLoopAgentLike, toolLoopAgentToMastraAgent } from './chunk-STKNQDVA.js';
3
+ import { createOnScorerHook } from './chunk-KL2JPSRX.js';
4
+ import { EventEmitterPubSub, augmentWithInit } from './chunk-ZRUTE56J.js';
5
5
  import { noopLogger } from './chunk-PSCMWPLC.js';
6
6
  import { registerHook } from './chunk-L54GIUCB.js';
7
7
  import { NoOpObservability } from './chunk-Y3TQ52UE.js';
8
8
  import { MastraError } from './chunk-FJEVLHJT.js';
9
- import { InMemoryServerCache } from './chunk-M6VFJX5A.js';
9
+ import { InMemoryServerCache } from './chunk-GMSAGYTB.js';
10
10
  import { ConsoleLogger, LogLevel } from './chunk-X2WMFSPB.js';
11
11
  import { randomUUID } from 'crypto';
12
12
 
@@ -37,6 +37,7 @@ var Mastra = class {
37
37
  #processorConfigurations = /* @__PURE__ */ new Map();
38
38
  #memory;
39
39
  #workspace;
40
+ #workspaces = {};
40
41
  #server;
41
42
  #serverAdapter;
42
43
  #mcpServers;
@@ -50,6 +51,10 @@ var Mastra = class {
50
51
  #serverCache;
51
52
  // Cache for stored agents to allow in-memory modifications (like model changes) to persist across requests
52
53
  #storedAgentsCache = /* @__PURE__ */ new Map();
54
+ // Cache for stored scorers to allow in-memory modifications to persist across requests
55
+ #storedScorersCache = /* @__PURE__ */ new Map();
56
+ // Registry for prompt blocks (stored or code-defined)
57
+ #promptBlocks = {};
53
58
  // Editor instance for handling agent instantiation and configuration
54
59
  #editor;
55
60
  get pubsub() {
@@ -92,6 +97,13 @@ var Mastra = class {
92
97
  getStoredAgentCache() {
93
98
  return this.#storedAgentsCache;
94
99
  }
100
+ /**
101
+ * Gets the stored scorers cache
102
+ * @internal
103
+ */
104
+ getStoredScorerCache() {
105
+ return this.#storedScorersCache;
106
+ }
95
107
  /**
96
108
  * Generates a unique identifier using the configured generator or defaults to `crypto.randomUUID()`.
97
109
  *
@@ -283,6 +295,7 @@ var Mastra = class {
283
295
  }
284
296
  if (config?.workspace) {
285
297
  this.#workspace = config.workspace;
298
+ this.addWorkspace(config.workspace);
286
299
  }
287
300
  if (config?.scorers) {
288
301
  Object.entries(config.scorers).forEach(([key, scorer]) => {
@@ -505,6 +518,22 @@ var Mastra = class {
505
518
  }).catch((err) => {
506
519
  this.#logger?.debug(`Failed to register processor workflows for agent ${agentKey}:`, err);
507
520
  });
521
+ if (mastraAgent.hasOwnWorkspace?.()) {
522
+ Promise.resolve(mastraAgent.getWorkspace?.()).then((workspace) => {
523
+ if (workspace) {
524
+ this.addWorkspace(workspace);
525
+ }
526
+ }).catch((err) => {
527
+ this.#logger?.debug(`Failed to register workspace for agent ${agentKey}:`, err);
528
+ });
529
+ }
530
+ mastraAgent.listScorers().then((scorers) => {
531
+ for (const [, entry] of Object.entries(scorers || {})) {
532
+ this.addScorer(entry.scorer);
533
+ }
534
+ }).catch((err) => {
535
+ this.#logger?.debug(`Failed to register scorers from agent ${agentKey}:`, err);
536
+ });
508
537
  }
509
538
  /**
510
539
  * Removes an agent from the Mastra instance by its key or ID.
@@ -747,6 +776,78 @@ var Mastra = class {
747
776
  getWorkspace() {
748
777
  return this.#workspace;
749
778
  }
779
+ /**
780
+ * Retrieves a registered workspace by its ID.
781
+ *
782
+ * @throws {MastraError} When the workspace with the specified ID is not found
783
+ *
784
+ * @example
785
+ * ```typescript
786
+ * const workspace = mastra.getWorkspaceById('workspace-123');
787
+ * const files = await workspace.filesystem.readdir('/');
788
+ * ```
789
+ */
790
+ getWorkspaceById(id) {
791
+ const workspace = this.#workspaces[id];
792
+ if (!workspace) {
793
+ const error = new MastraError({
794
+ id: "MASTRA_GET_WORKSPACE_BY_ID_NOT_FOUND",
795
+ domain: "MASTRA" /* MASTRA */,
796
+ category: "USER" /* USER */,
797
+ text: `Workspace with id ${id} not found`,
798
+ details: {
799
+ status: 404,
800
+ workspaceId: id,
801
+ availableIds: Object.keys(this.#workspaces).join(", ")
802
+ }
803
+ });
804
+ this.#logger?.trackException(error);
805
+ throw error;
806
+ }
807
+ return workspace;
808
+ }
809
+ /**
810
+ * Returns all registered workspaces as a record keyed by their IDs.
811
+ *
812
+ * @example
813
+ * ```typescript
814
+ * const workspaces = mastra.listWorkspaces();
815
+ * for (const [id, workspace] of Object.entries(workspaces)) {
816
+ * console.log(`Workspace ${id}: ${workspace.name}`);
817
+ * }
818
+ * ```
819
+ */
820
+ listWorkspaces() {
821
+ return { ...this.#workspaces };
822
+ }
823
+ /**
824
+ * Adds a new workspace to the Mastra instance.
825
+ *
826
+ * This method allows dynamic registration of workspaces after the Mastra instance
827
+ * has been created. Workspaces are keyed by their ID.
828
+ *
829
+ * @example
830
+ * ```typescript
831
+ * const workspace = new Workspace({
832
+ * id: 'project-workspace',
833
+ * name: 'Project Workspace',
834
+ * filesystem: new LocalFilesystem({ rootPath: './workspace' })
835
+ * });
836
+ * mastra.addWorkspace(workspace);
837
+ * ```
838
+ */
839
+ addWorkspace(workspace, key) {
840
+ if (!workspace) {
841
+ throw createUndefinedPrimitiveError("workspace", workspace, key);
842
+ }
843
+ const workspaceKey = key || workspace.id;
844
+ if (this.#workspaces[workspaceKey]) {
845
+ const logger = this.getLogger();
846
+ logger.debug(`Workspace with key ${workspaceKey} already exists. Skipping addition.`);
847
+ return;
848
+ }
849
+ this.#workspaces[workspaceKey] = workspace;
850
+ }
750
851
  /**
751
852
  * Retrieves a registered workflow by its ID.
752
853
  *
@@ -961,7 +1062,7 @@ var Mastra = class {
961
1062
  * mastra.addScorer(newScorer, 'customKey'); // Uses custom key
962
1063
  * ```
963
1064
  */
964
- addScorer(scorer, key) {
1065
+ addScorer(scorer, key, options) {
965
1066
  if (!scorer) {
966
1067
  throw createUndefinedPrimitiveError("scorer", scorer, key);
967
1068
  }
@@ -973,6 +1074,9 @@ var Mastra = class {
973
1074
  return;
974
1075
  }
975
1076
  scorer.__registerMastra(this);
1077
+ if (options?.source) {
1078
+ scorer.source = options.source;
1079
+ }
976
1080
  scorers[scorerKey] = scorer;
977
1081
  }
978
1082
  /**
@@ -1067,52 +1171,111 @@ var Mastra = class {
1067
1171
  this.#logger?.trackException(error);
1068
1172
  throw error;
1069
1173
  }
1070
- // NOTE: Stored scorer methods are commented out until the storage infrastructure is added in PR2
1071
- // /**
1072
- // * Retrieves a stored scorer by its ID from the database.
1073
- // */
1074
- // public async getStoredScorerById(id: string): Promise<StoredScorerType | null> {
1075
- // // Implementation will be added in PR2
1076
- // throw new Error('Stored scorers not yet implemented');
1077
- // }
1078
- // /**
1079
- // * Lists all stored scorers from the database with optional pagination.
1080
- // */
1081
- // public async listStoredScorers(args?: {
1082
- // page?: number;
1083
- // perPage?: number | false;
1084
- // orderBy?: { field: 'createdAt' | 'updatedAt'; direction: 'ASC' | 'DESC' };
1085
- // }): Promise<{
1086
- // scorers: StoredScorerType[];
1087
- // total: number;
1088
- // page: number;
1089
- // perPage: number | false;
1090
- // hasMore: boolean;
1091
- // }> {
1092
- // // Implementation will be added in PR2
1093
- // throw new Error('Stored scorers not yet implemented');
1094
- // }
1095
- // /**
1096
- // * Retrieves and resolves a stored scorer from the database into an executable MastraScorer.
1097
- // */
1098
- // public async resolveStoredScorer(id: string): Promise<MastraScorer | null> {
1099
- // // Implementation will be added in PR2
1100
- // return null;
1101
- // }
1102
- // /**
1103
- // * Unified method to get a scorer by ID, checking code-defined scorers first,
1104
- // * then falling back to stored scorers from the database.
1105
- // */
1106
- // public async getScorerUnified(id: string): Promise<MastraScorer | null> {
1107
- // // First, try to find in code-defined scorers
1108
- // try {
1109
- // const scorer = this.getScorerById(id);
1110
- // return scorer;
1111
- // } catch {
1112
- // // Stored scorers will be added in PR2
1113
- // return null;
1114
- // }
1115
- // }
1174
+ /**
1175
+ * Removes a scorer from the Mastra instance by its key or ID.
1176
+ *
1177
+ * @param keyOrId - The scorer key or ID to remove
1178
+ * @returns true if a scorer was removed, false if no scorer was found
1179
+ */
1180
+ removeScorer(keyOrId) {
1181
+ const scorers = this.#scorers;
1182
+ if (!scorers) return false;
1183
+ if (scorers[keyOrId]) {
1184
+ const scorerId = scorers[keyOrId]?.id;
1185
+ delete scorers[keyOrId];
1186
+ if (scorerId) {
1187
+ this.#storedScorersCache.delete(scorerId);
1188
+ }
1189
+ return true;
1190
+ }
1191
+ const key = Object.keys(scorers).find((k) => scorers[k]?.id === keyOrId || scorers[k]?.name === keyOrId);
1192
+ if (key) {
1193
+ const scorerId = scorers[key]?.id;
1194
+ delete scorers[key];
1195
+ if (scorerId) {
1196
+ this.#storedScorersCache.delete(scorerId);
1197
+ }
1198
+ return true;
1199
+ }
1200
+ return false;
1201
+ }
1202
+ // =========================================================================
1203
+ // Prompt Blocks
1204
+ // =========================================================================
1205
+ /**
1206
+ * Returns all registered prompt blocks.
1207
+ */
1208
+ listPromptBlocks() {
1209
+ return this.#promptBlocks;
1210
+ }
1211
+ /**
1212
+ * Registers a prompt block in the Mastra instance's runtime registry.
1213
+ *
1214
+ * @param promptBlock - The resolved prompt block to register
1215
+ * @param key - Optional registration key (defaults to promptBlock.id)
1216
+ */
1217
+ addPromptBlock(promptBlock, key) {
1218
+ const blockKey = key || promptBlock.id;
1219
+ if (this.#promptBlocks[blockKey]) {
1220
+ const logger = this.getLogger();
1221
+ logger.debug(`Prompt block with key ${blockKey} already exists. Skipping addition.`);
1222
+ return;
1223
+ }
1224
+ this.#promptBlocks[blockKey] = promptBlock;
1225
+ }
1226
+ /**
1227
+ * Retrieves a registered prompt block by its key.
1228
+ *
1229
+ * @throws {MastraError} When the prompt block with the specified key is not found
1230
+ */
1231
+ getPromptBlock(key) {
1232
+ const block = this.#promptBlocks[key];
1233
+ if (!block) {
1234
+ throw new MastraError({
1235
+ id: "MASTRA_GET_PROMPT_BLOCK_NOT_FOUND",
1236
+ domain: "MASTRA" /* MASTRA */,
1237
+ category: "USER" /* USER */,
1238
+ text: `Prompt block with key ${key} not found`
1239
+ });
1240
+ }
1241
+ return block;
1242
+ }
1243
+ /**
1244
+ * Retrieves a registered prompt block by its ID.
1245
+ *
1246
+ * @throws {MastraError} When no prompt block is found with the specified ID
1247
+ */
1248
+ getPromptBlockById(id) {
1249
+ for (const [, block] of Object.entries(this.#promptBlocks)) {
1250
+ if (block.id === id) {
1251
+ return block;
1252
+ }
1253
+ }
1254
+ throw new MastraError({
1255
+ id: "MASTRA_GET_PROMPT_BLOCK_BY_ID_NOT_FOUND",
1256
+ domain: "MASTRA" /* MASTRA */,
1257
+ category: "USER" /* USER */,
1258
+ text: `Prompt block with id ${id} not found`
1259
+ });
1260
+ }
1261
+ /**
1262
+ * Removes a prompt block from the Mastra instance by its key or ID.
1263
+ *
1264
+ * @param keyOrId - The prompt block key or ID to remove
1265
+ * @returns true if a prompt block was removed, false if not found
1266
+ */
1267
+ removePromptBlock(keyOrId) {
1268
+ if (this.#promptBlocks[keyOrId]) {
1269
+ delete this.#promptBlocks[keyOrId];
1270
+ return true;
1271
+ }
1272
+ const key = Object.keys(this.#promptBlocks).find((k) => this.#promptBlocks[k]?.id === keyOrId);
1273
+ if (key) {
1274
+ delete this.#promptBlocks[key];
1275
+ return true;
1276
+ }
1277
+ return false;
1278
+ }
1116
1279
  /**
1117
1280
  * Retrieves a specific tool by registration key.
1118
1281
  *
@@ -1679,12 +1842,22 @@ var Mastra = class {
1679
1842
  this.#mcpServers?.[key]?.__setLogger(this.#logger);
1680
1843
  });
1681
1844
  }
1845
+ if (this.#workflows) {
1846
+ Object.keys(this.#workflows).forEach((key) => {
1847
+ this.#workflows?.[key]?.__setLogger(this.#logger);
1848
+ });
1849
+ }
1682
1850
  if (this.#serverAdapter) {
1683
1851
  this.#serverAdapter.__setLogger(this.#logger);
1684
1852
  }
1685
1853
  if (this.#workspace) {
1686
1854
  this.#workspace.__setLogger(this.#logger);
1687
1855
  }
1856
+ if (this.#memory) {
1857
+ Object.keys(this.#memory).forEach((key) => {
1858
+ this.#memory?.[key]?.__setLogger(this.#logger);
1859
+ });
1860
+ }
1688
1861
  this.#observability.setLogger({ logger: this.#logger });
1689
1862
  }
1690
1863
  /**
@@ -2314,7 +2487,7 @@ var Mastra = class {
2314
2487
  if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") {
2315
2488
  return;
2316
2489
  }
2317
- import('./provider-registry-RPOTQNHI.js').then(async ({ GatewayRegistry }) => {
2490
+ import('./provider-registry-NWU4YFQW.js').then(async ({ GatewayRegistry }) => {
2318
2491
  const registry = GatewayRegistry.getInstance();
2319
2492
  const customGateways = Object.values(this.#gateways || {});
2320
2493
  registry.registerCustomGateways(customGateways);
@@ -2368,5 +2541,5 @@ var Mastra = class {
2368
2541
  };
2369
2542
 
2370
2543
  export { Mastra };
2371
- //# sourceMappingURL=chunk-RXD5EGQF.js.map
2372
- //# sourceMappingURL=chunk-RXD5EGQF.js.map
2544
+ //# sourceMappingURL=chunk-VVD56FI4.js.map
2545
+ //# sourceMappingURL=chunk-VVD56FI4.js.map