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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (576) hide show
  1. package/CHANGELOG.md +1218 -0
  2. package/dist/agent/agent-legacy.d.ts +35 -30
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent-types.test-d.d.ts +2 -0
  5. package/dist/agent/agent-types.test-d.d.ts.map +1 -0
  6. package/dist/agent/agent.d.ts +24 -9
  7. package/dist/agent/agent.d.ts.map +1 -1
  8. package/dist/agent/agent.types.d.ts +17 -9
  9. package/dist/agent/agent.types.d.ts.map +1 -1
  10. package/dist/agent/index.cjs +9 -9
  11. package/dist/agent/index.js +2 -2
  12. package/dist/agent/message-list/index.cjs +3 -3
  13. package/dist/agent/message-list/index.d.ts +61 -3
  14. package/dist/agent/message-list/index.d.ts.map +1 -1
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts.map +1 -1
  17. package/dist/agent/message-list/prompt/convert-file.d.ts +1 -1
  18. package/dist/agent/message-list/prompt/convert-file.d.ts.map +1 -1
  19. package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
  20. package/dist/agent/save-queue/index.d.ts +3 -1
  21. package/dist/agent/save-queue/index.d.ts.map +1 -1
  22. package/dist/agent/test-utils.d.ts +37 -0
  23. package/dist/agent/test-utils.d.ts.map +1 -1
  24. package/dist/agent/trip-wire.d.ts +38 -4
  25. package/dist/agent/trip-wire.d.ts.map +1 -1
  26. package/dist/agent/types.d.ts +46 -14
  27. package/dist/agent/types.d.ts.map +1 -1
  28. package/dist/agent/utils.d.ts +4 -5
  29. package/dist/agent/utils.d.ts.map +1 -1
  30. package/dist/agent/workflows/prepare-stream/index.d.ts +37 -13
  31. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  32. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +3 -3
  33. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  34. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +34 -11
  35. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  36. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +2 -1
  37. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  38. package/dist/agent/workflows/prepare-stream/schema.d.ts +38 -15
  39. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  40. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +11 -1
  41. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  42. package/dist/base.cjs +2 -2
  43. package/dist/base.js +1 -1
  44. package/dist/bundler/index.cjs +2 -2
  45. package/dist/bundler/index.js +1 -1
  46. package/dist/cache/index.cjs +3 -3
  47. package/dist/cache/index.js +1 -1
  48. package/dist/{chunk-JUBFO5J3.js → chunk-2ULLRN4Y.js} +16333 -11839
  49. package/dist/chunk-2ULLRN4Y.js.map +1 -0
  50. package/dist/{chunk-OJNJA5ZI.js → chunk-3CKZSDTQ.js} +3 -3
  51. package/dist/{chunk-OJNJA5ZI.js.map → chunk-3CKZSDTQ.js.map} +1 -1
  52. package/dist/chunk-3E3ILV6T.cjs +518 -0
  53. package/dist/chunk-3E3ILV6T.cjs.map +1 -0
  54. package/dist/{chunk-TQTAMPSC.js → chunk-3N3QE4ZK.js} +3 -3
  55. package/dist/chunk-3N3QE4ZK.js.map +1 -0
  56. package/dist/{chunk-QUKUN6NR.cjs → chunk-4JKEUSCC.cjs} +107 -7
  57. package/dist/chunk-4JKEUSCC.cjs.map +1 -0
  58. package/dist/{chunk-MSWTA73A.cjs → chunk-52RSUALV.cjs} +16490 -11957
  59. package/dist/chunk-52RSUALV.cjs.map +1 -0
  60. package/dist/chunk-5PAEYE3Q.js +513 -0
  61. package/dist/chunk-5PAEYE3Q.js.map +1 -0
  62. package/dist/{chunk-ECFXGXWO.cjs → chunk-5Q6WAYEY.cjs} +695 -375
  63. package/dist/chunk-5Q6WAYEY.cjs.map +1 -0
  64. package/dist/{chunk-CBAB7GOD.cjs → chunk-6BJ7XHRH.cjs} +2 -2
  65. package/dist/{chunk-CBAB7GOD.cjs.map → chunk-6BJ7XHRH.cjs.map} +1 -1
  66. package/dist/{chunk-GRBGQ2GE.js → chunk-6TBWJV35.js} +5 -3
  67. package/dist/chunk-6TBWJV35.js.map +1 -0
  68. package/dist/chunk-6XCINXZ7.cjs +194 -0
  69. package/dist/chunk-6XCINXZ7.cjs.map +1 -0
  70. package/dist/{chunk-E7K4FTLN.cjs → chunk-72YCRTEX.cjs} +18 -2
  71. package/dist/chunk-72YCRTEX.cjs.map +1 -0
  72. package/dist/{chunk-W7UH2PWL.js → chunk-7P6BNIJH.js} +1142 -331
  73. package/dist/chunk-7P6BNIJH.js.map +1 -0
  74. package/dist/{chunk-76K3IYWM.js → chunk-ADADLFDR.js} +3 -3
  75. package/dist/{chunk-76K3IYWM.js.map → chunk-ADADLFDR.js.map} +1 -1
  76. package/dist/{chunk-DSNPWVIG.cjs → chunk-AF74UXR5.cjs} +4 -3
  77. package/dist/chunk-AF74UXR5.cjs.map +1 -0
  78. package/dist/{chunk-GGYKYORQ.cjs → chunk-BJXKH4LG.cjs} +407 -22
  79. package/dist/chunk-BJXKH4LG.cjs.map +1 -0
  80. package/dist/{chunk-2ZVKF4HP.cjs → chunk-BUKY6CTR.cjs} +1147 -334
  81. package/dist/chunk-BUKY6CTR.cjs.map +1 -0
  82. package/dist/chunk-BWYU7D33.js +192 -0
  83. package/dist/chunk-BWYU7D33.js.map +1 -0
  84. package/dist/{chunk-XEVG546F.js → chunk-C36YRTZ6.js} +178 -12
  85. package/dist/chunk-C36YRTZ6.js.map +1 -0
  86. package/dist/{chunk-CB575O6L.cjs → chunk-CZEJQSWB.cjs} +473 -124
  87. package/dist/chunk-CZEJQSWB.cjs.map +1 -0
  88. package/dist/chunk-DD2VNRQM.js +62 -0
  89. package/dist/chunk-DD2VNRQM.js.map +1 -0
  90. package/dist/{chunk-KEXGB7FK.cjs → chunk-DGV2FWB4.cjs} +7 -7
  91. package/dist/{chunk-KEXGB7FK.cjs.map → chunk-DGV2FWB4.cjs.map} +1 -1
  92. package/dist/{chunk-Y63IFHEZ.cjs → chunk-EOPEDKLG.cjs} +4 -4
  93. package/dist/chunk-EOPEDKLG.cjs.map +1 -0
  94. package/dist/{chunk-UIZSWUKP.js → chunk-F2GAJSBI.js} +105 -7
  95. package/dist/chunk-F2GAJSBI.js.map +1 -0
  96. package/dist/{chunk-4CDL2QJT.js → chunk-IVV5TOMD.js} +122 -37
  97. package/dist/chunk-IVV5TOMD.js.map +1 -0
  98. package/dist/{chunk-MV7KHWUT.js → chunk-JIGDJK2O.js} +391 -15
  99. package/dist/chunk-JIGDJK2O.js.map +1 -0
  100. package/dist/chunk-KJBMTK5B.cjs +64 -0
  101. package/dist/chunk-KJBMTK5B.cjs.map +1 -0
  102. package/dist/{chunk-S6URFGCZ.js → chunk-LSHPJWM5.js} +3 -3
  103. package/dist/{chunk-S6URFGCZ.js.map → chunk-LSHPJWM5.js.map} +1 -1
  104. package/dist/chunk-MGCGWPQJ.cjs +275 -0
  105. package/dist/chunk-MGCGWPQJ.cjs.map +1 -0
  106. package/dist/chunk-MRFUISXC.cjs +4981 -0
  107. package/dist/chunk-MRFUISXC.cjs.map +1 -0
  108. package/dist/{chunk-KJ2SW6VA.js → chunk-NRUZYMHE.js} +4 -3
  109. package/dist/chunk-NRUZYMHE.js.map +1 -0
  110. package/dist/{chunk-CINNK34N.js → chunk-O2BJW7YA.js} +26 -11
  111. package/dist/chunk-O2BJW7YA.js.map +1 -0
  112. package/dist/chunk-OEIVMCWX.js +4959 -0
  113. package/dist/chunk-OEIVMCWX.js.map +1 -0
  114. package/dist/{chunk-WM6CK2F3.cjs → chunk-PG5H6QIO.cjs} +131 -49
  115. package/dist/chunk-PG5H6QIO.cjs.map +1 -0
  116. package/dist/{chunk-JPGVRWWL.js → chunk-PK2A5WBG.js} +472 -125
  117. package/dist/chunk-PK2A5WBG.js.map +1 -0
  118. package/dist/{chunk-X7JMA3IY.js → chunk-PSCMWPLC.js} +2 -2
  119. package/dist/{chunk-X7JMA3IY.js.map → chunk-PSCMWPLC.js.map} +1 -1
  120. package/dist/{chunk-VOY2RXOC.cjs → chunk-S73Z3PBJ.cjs} +182 -15
  121. package/dist/chunk-S73Z3PBJ.cjs.map +1 -0
  122. package/dist/{chunk-MA7TEM62.cjs → chunk-SCUWP4II.cjs} +769 -27
  123. package/dist/chunk-SCUWP4II.cjs.map +1 -0
  124. package/dist/{chunk-JV2KH24V.js → chunk-SXNQRJQD.js} +695 -375
  125. package/dist/chunk-SXNQRJQD.js.map +1 -0
  126. package/dist/{chunk-BMAFVZ2D.cjs → chunk-T2VLUFGG.cjs} +4 -4
  127. package/dist/{chunk-BMAFVZ2D.cjs.map → chunk-T2VLUFGG.cjs.map} +1 -1
  128. package/dist/chunk-THZTRBFS.js +268 -0
  129. package/dist/chunk-THZTRBFS.js.map +1 -0
  130. package/dist/{chunk-VOQ3ULMT.js → chunk-U3XOLEPX.js} +759 -17
  131. package/dist/chunk-U3XOLEPX.js.map +1 -0
  132. package/dist/{chunk-Y6ROD72V.cjs → chunk-UIGRFDO6.cjs} +4 -4
  133. package/dist/{chunk-Y6ROD72V.cjs.map → chunk-UIGRFDO6.cjs.map} +1 -1
  134. package/dist/{chunk-H6CZGPZD.js → chunk-US2U7ECW.js} +179 -38
  135. package/dist/chunk-US2U7ECW.js.map +1 -0
  136. package/dist/{chunk-J7O6WENZ.cjs → chunk-UVHSM2GU.cjs} +6 -2
  137. package/dist/chunk-UVHSM2GU.cjs.map +1 -0
  138. package/dist/{chunk-CD56CXVE.cjs → chunk-WTSZBHIZ.cjs} +32 -17
  139. package/dist/chunk-WTSZBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-KIZIOFZC.js → chunk-Y36Y5MTD.js} +17 -3
  141. package/dist/chunk-Y36Y5MTD.js.map +1 -0
  142. package/dist/{chunk-DNEURYF3.cjs → chunk-YC6PJEPH.cjs} +206 -65
  143. package/dist/chunk-YC6PJEPH.cjs.map +1 -0
  144. package/dist/{chunk-IQO7ANVS.cjs → chunk-YWMMBIOM.cjs} +21 -20
  145. package/dist/chunk-YWMMBIOM.cjs.map +1 -0
  146. package/dist/{chunk-I4CXL4SR.js → chunk-Z57R5WS4.js} +16 -15
  147. package/dist/chunk-Z57R5WS4.js.map +1 -0
  148. package/dist/deployer/index.cjs +2 -2
  149. package/dist/deployer/index.js +1 -1
  150. package/dist/di/index.cjs +10 -2
  151. package/dist/di/index.d.ts +1 -1
  152. package/dist/di/index.d.ts.map +1 -1
  153. package/dist/di/index.js +1 -1
  154. package/dist/evals/base.d.ts +10 -2
  155. package/dist/evals/base.d.ts.map +1 -1
  156. package/dist/evals/base.test-utils.d.ts +25 -25
  157. package/dist/evals/index.cjs +9 -9
  158. package/dist/evals/index.js +2 -2
  159. package/dist/evals/scoreTraces/index.cjs +7 -6
  160. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  161. package/dist/evals/scoreTraces/index.js +4 -3
  162. package/dist/evals/scoreTraces/index.js.map +1 -1
  163. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  164. package/dist/evals/types.d.ts +25 -24
  165. package/dist/evals/types.d.ts.map +1 -1
  166. package/dist/index.cjs +2 -2
  167. package/dist/index.js +1 -1
  168. package/dist/integration/index.cjs +2 -2
  169. package/dist/integration/index.js +1 -1
  170. package/dist/llm/index.cjs +30 -10
  171. package/dist/llm/index.d.ts +2 -0
  172. package/dist/llm/index.d.ts.map +1 -1
  173. package/dist/llm/index.js +5 -1
  174. package/dist/llm/model/aisdk/v5/model.d.ts +47 -0
  175. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -0
  176. package/dist/llm/model/base.types.d.ts +2 -2
  177. package/dist/llm/model/base.types.d.ts.map +1 -1
  178. package/dist/llm/model/gateway-resolver.d.ts.map +1 -1
  179. package/dist/llm/model/gateways/azure.d.ts +36 -0
  180. package/dist/llm/model/gateways/azure.d.ts.map +1 -0
  181. package/dist/llm/model/gateways/base.d.ts +9 -4
  182. package/dist/llm/model/gateways/base.d.ts.map +1 -1
  183. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  184. package/dist/llm/model/gateways/index.d.ts +4 -1
  185. package/dist/llm/model/gateways/index.d.ts.map +1 -1
  186. package/dist/llm/model/gateways/models-dev.d.ts +3 -2
  187. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  188. package/dist/llm/model/gateways/netlify.d.ts +4 -3
  189. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  190. package/dist/llm/model/is-v2-model.d.ts +3 -0
  191. package/dist/llm/model/is-v2-model.d.ts.map +1 -0
  192. package/dist/llm/model/model-method-from-agent.d.ts +4 -0
  193. package/dist/llm/model/model-method-from-agent.d.ts.map +1 -0
  194. package/dist/llm/model/model.d.ts.map +1 -1
  195. package/dist/llm/model/model.loop.d.ts +2 -2
  196. package/dist/llm/model/model.loop.d.ts.map +1 -1
  197. package/dist/llm/model/model.loop.types.d.ts +4 -2
  198. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  199. package/dist/llm/model/provider-options.d.ts +4 -1
  200. package/dist/llm/model/provider-options.d.ts.map +1 -1
  201. package/dist/llm/model/provider-registry.d.ts +11 -1
  202. package/dist/llm/model/provider-registry.d.ts.map +1 -1
  203. package/dist/llm/model/provider-types.generated.d.ts +489 -27
  204. package/dist/llm/model/registry-generator.d.ts +12 -0
  205. package/dist/llm/model/registry-generator.d.ts.map +1 -1
  206. package/dist/llm/model/resolve-model.d.ts +1 -1
  207. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  208. package/dist/llm/model/router.d.ts +12 -5
  209. package/dist/llm/model/router.d.ts.map +1 -1
  210. package/dist/llm/model/shared.types.d.ts +17 -6
  211. package/dist/llm/model/shared.types.d.ts.map +1 -1
  212. package/dist/logger/constants.d.ts +1 -0
  213. package/dist/logger/constants.d.ts.map +1 -1
  214. package/dist/logger/index.cjs +11 -11
  215. package/dist/logger/index.js +2 -2
  216. package/dist/logger/transport.d.ts +1 -1
  217. package/dist/logger/transport.d.ts.map +1 -1
  218. package/dist/loop/index.cjs +2 -2
  219. package/dist/loop/index.js +1 -1
  220. package/dist/loop/loop.d.ts.map +1 -1
  221. package/dist/loop/network/index.d.ts.map +1 -1
  222. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +37 -0
  223. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -0
  224. package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
  225. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  226. package/dist/loop/test-utils/options.d.ts.map +1 -1
  227. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  228. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  229. package/dist/loop/test-utils/textStream.d.ts.map +1 -1
  230. package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
  231. package/dist/loop/test-utils/tools.d.ts.map +1 -1
  232. package/dist/loop/test-utils/utils.d.ts +1 -1
  233. package/dist/loop/test-utils/utils.d.ts.map +1 -1
  234. package/dist/loop/types.d.ts +42 -20
  235. package/dist/loop/types.d.ts.map +1 -1
  236. package/dist/loop/workflows/agentic-execution/index.d.ts +60 -42
  237. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  238. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +41 -29
  239. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  240. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +20 -14
  241. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  242. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  243. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  244. package/dist/loop/workflows/agentic-loop/index.d.ts +62 -43
  245. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  246. package/dist/loop/workflows/run-state.d.ts +2 -2
  247. package/dist/loop/workflows/run-state.d.ts.map +1 -1
  248. package/dist/loop/workflows/schema.d.ts +32 -15
  249. package/dist/loop/workflows/schema.d.ts.map +1 -1
  250. package/dist/loop/workflows/stream.d.ts +1 -1
  251. package/dist/loop/workflows/stream.d.ts.map +1 -1
  252. package/dist/mastra/index.cjs +2 -2
  253. package/dist/mastra/index.d.ts +377 -12
  254. package/dist/mastra/index.d.ts.map +1 -1
  255. package/dist/mastra/index.js +1 -1
  256. package/dist/mcp/index.cjs +4 -4
  257. package/dist/mcp/index.cjs.map +1 -1
  258. package/dist/mcp/index.d.ts +4 -4
  259. package/dist/mcp/index.d.ts.map +1 -1
  260. package/dist/mcp/index.js +2 -2
  261. package/dist/mcp/index.js.map +1 -1
  262. package/dist/mcp/types.d.ts +2 -2
  263. package/dist/mcp/types.d.ts.map +1 -1
  264. package/dist/memory/index.cjs +21 -327
  265. package/dist/memory/index.cjs.map +1 -1
  266. package/dist/memory/index.js +1 -327
  267. package/dist/memory/index.js.map +1 -1
  268. package/dist/memory/memory.d.ts +28 -18
  269. package/dist/memory/memory.d.ts.map +1 -1
  270. package/dist/memory/mock.d.ts +15 -14
  271. package/dist/memory/mock.d.ts.map +1 -1
  272. package/dist/memory/types.d.ts +69 -11
  273. package/dist/memory/types.d.ts.map +1 -1
  274. package/dist/models-dev-23RN2WHG.js +3 -0
  275. package/dist/{models-dev-DNBKXHT4.js.map → models-dev-23RN2WHG.js.map} +1 -1
  276. package/dist/models-dev-EO3SUIY2.cjs +12 -0
  277. package/dist/{models-dev-YBEEQIX6.cjs.map → models-dev-EO3SUIY2.cjs.map} +1 -1
  278. package/dist/netlify-GXJ5D5DD.js +3 -0
  279. package/dist/{netlify-7G2L5VSH.js.map → netlify-GXJ5D5DD.js.map} +1 -1
  280. package/dist/netlify-KJLY3GFS.cjs +12 -0
  281. package/dist/{netlify-GWNGSIRZ.cjs.map → netlify-KJLY3GFS.cjs.map} +1 -1
  282. package/dist/observability/index.cjs +16 -8
  283. package/dist/observability/index.js +1 -1
  284. package/dist/observability/types/tracing.d.ts +236 -13
  285. package/dist/observability/types/tracing.d.ts.map +1 -1
  286. package/dist/observability/utils.d.ts +47 -1
  287. package/dist/observability/utils.d.ts.map +1 -1
  288. package/dist/processors/index.cjs +115 -11
  289. package/dist/processors/index.d.ts +246 -26
  290. package/dist/processors/index.d.ts.map +1 -1
  291. package/dist/processors/index.js +1 -1
  292. package/dist/processors/memory/index.d.ts +7 -0
  293. package/dist/processors/memory/index.d.ts.map +1 -0
  294. package/dist/processors/memory/message-history.d.ts +43 -0
  295. package/dist/processors/memory/message-history.d.ts.map +1 -0
  296. package/dist/processors/memory/semantic-recall.d.ts +152 -0
  297. package/dist/processors/memory/semantic-recall.d.ts.map +1 -0
  298. package/dist/processors/memory/working-memory.d.ts +65 -0
  299. package/dist/processors/memory/working-memory.d.ts.map +1 -0
  300. package/dist/processors/processors/batch-parts.d.ts +1 -1
  301. package/dist/processors/processors/batch-parts.d.ts.map +1 -1
  302. package/dist/processors/processors/index.d.ts +2 -1
  303. package/dist/processors/processors/index.d.ts.map +1 -1
  304. package/dist/processors/processors/language-detector.d.ts +15 -1
  305. package/dist/processors/processors/language-detector.d.ts.map +1 -1
  306. package/dist/processors/processors/moderation.d.ts +15 -1
  307. package/dist/processors/processors/moderation.d.ts.map +1 -1
  308. package/dist/processors/processors/pii-detector.d.ts +15 -1
  309. package/dist/processors/processors/pii-detector.d.ts.map +1 -1
  310. package/dist/processors/processors/prepare-step.d.ts +12 -0
  311. package/dist/processors/processors/prepare-step.d.ts.map +1 -0
  312. package/dist/processors/processors/prompt-injection-detector.d.ts +15 -1
  313. package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
  314. package/dist/processors/processors/structured-output.d.ts +7 -5
  315. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  316. package/dist/processors/processors/system-prompt-scrubber.d.ts +1 -1
  317. package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
  318. package/dist/processors/processors/token-limiter.d.ts +22 -12
  319. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  320. package/dist/processors/processors/tool-call-filter.d.ts +28 -0
  321. package/dist/processors/processors/tool-call-filter.d.ts.map +1 -0
  322. package/dist/processors/processors/unicode-normalizer.d.ts +1 -1
  323. package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
  324. package/dist/processors/runner.d.ts +83 -9
  325. package/dist/processors/runner.d.ts.map +1 -1
  326. package/dist/processors/step-schema.d.ts +49731 -0
  327. package/dist/processors/step-schema.d.ts.map +1 -0
  328. package/dist/provider-registry-3TG2KUD2.cjs +40 -0
  329. package/dist/provider-registry-3TG2KUD2.cjs.map +1 -0
  330. package/dist/provider-registry-F67Y6OF2.js +3 -0
  331. package/dist/provider-registry-F67Y6OF2.js.map +1 -0
  332. package/dist/provider-registry.json +1056 -61
  333. package/dist/{registry-generator-MK63POJO.cjs → registry-generator-34SC4TAU.cjs} +23 -6
  334. package/dist/registry-generator-34SC4TAU.cjs.map +1 -0
  335. package/dist/{registry-generator-H4YNODDH.js → registry-generator-UMTNPBJX.js} +23 -7
  336. package/dist/registry-generator-UMTNPBJX.js.map +1 -0
  337. package/dist/relevance/index.cjs +2 -2
  338. package/dist/relevance/index.js +1 -1
  339. package/dist/request-context/index.cjs +10 -2
  340. package/dist/request-context/index.d.ts +26 -0
  341. package/dist/request-context/index.d.ts.map +1 -1
  342. package/dist/request-context/index.js +1 -1
  343. package/dist/server/auth.d.ts +11 -0
  344. package/dist/server/auth.d.ts.map +1 -1
  345. package/dist/server/base.d.ts +51 -0
  346. package/dist/server/base.d.ts.map +1 -0
  347. package/dist/server/composite-auth.d.ts +9 -0
  348. package/dist/server/composite-auth.d.ts.map +1 -0
  349. package/dist/server/index.cjs +124 -3
  350. package/dist/server/index.cjs.map +1 -1
  351. package/dist/server/index.d.ts +8 -0
  352. package/dist/server/index.d.ts.map +1 -1
  353. package/dist/server/index.js +121 -3
  354. package/dist/server/index.js.map +1 -1
  355. package/dist/server/simple-auth.d.ts +27 -0
  356. package/dist/server/simple-auth.d.ts.map +1 -0
  357. package/dist/server/types.d.ts +6 -0
  358. package/dist/server/types.d.ts.map +1 -1
  359. package/dist/storage/base.d.ts +76 -3
  360. package/dist/storage/base.d.ts.map +1 -1
  361. package/dist/storage/constants.d.ts +3 -1
  362. package/dist/storage/constants.d.ts.map +1 -1
  363. package/dist/storage/domains/agents/base.d.ts +49 -0
  364. package/dist/storage/domains/agents/base.d.ts.map +1 -0
  365. package/dist/storage/domains/agents/index.d.ts +3 -0
  366. package/dist/storage/domains/agents/index.d.ts.map +1 -0
  367. package/dist/storage/domains/agents/inmemory.d.ts +22 -0
  368. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -0
  369. package/dist/storage/domains/index.d.ts +1 -0
  370. package/dist/storage/domains/index.d.ts.map +1 -1
  371. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  372. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  373. package/dist/storage/domains/scores/base.d.ts +2 -2
  374. package/dist/storage/domains/scores/base.d.ts.map +1 -1
  375. package/dist/storage/domains/scores/inmemory.d.ts +2 -2
  376. package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
  377. package/dist/storage/domains/workflows/base.d.ts +4 -0
  378. package/dist/storage/domains/workflows/base.d.ts.map +1 -1
  379. package/dist/storage/domains/workflows/inmemory.d.ts +5 -1
  380. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  381. package/dist/storage/index.cjs +65 -29
  382. package/dist/storage/index.js +1 -1
  383. package/dist/storage/mock.d.ts +7 -2
  384. package/dist/storage/mock.d.ts.map +1 -1
  385. package/dist/storage/storageWithInit.d.ts.map +1 -1
  386. package/dist/storage/types.d.ts +88 -5
  387. package/dist/storage/types.d.ts.map +1 -1
  388. package/dist/storage/utils.d.ts +82 -0
  389. package/dist/storage/utils.d.ts.map +1 -1
  390. package/dist/stream/MastraAgentNetworkStream.d.ts +2 -2
  391. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  392. package/dist/stream/MastraWorkflowStream.d.ts +2 -2
  393. package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
  394. package/dist/stream/RunOutput.d.ts +2 -2
  395. package/dist/stream/RunOutput.d.ts.map +1 -1
  396. package/dist/stream/aisdk/v4/transform.d.ts.map +1 -1
  397. package/dist/stream/aisdk/v4/usage.d.ts +19 -0
  398. package/dist/stream/aisdk/v4/usage.d.ts.map +1 -0
  399. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  400. package/dist/stream/aisdk/v5/execute.d.ts +9 -5
  401. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  402. package/dist/stream/aisdk/v5/input.d.ts +4 -1
  403. package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
  404. package/dist/stream/aisdk/v5/output-helpers.d.ts +5 -1
  405. package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -1
  406. package/dist/stream/aisdk/v5/output.d.ts +11 -13
  407. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  408. package/dist/stream/aisdk/v5/transform.d.ts +2 -1
  409. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  410. package/dist/stream/base/base.d.ts +1 -1
  411. package/dist/stream/base/base.d.ts.map +1 -1
  412. package/dist/stream/base/input.d.ts +1 -1
  413. package/dist/stream/base/output-format-handlers.d.ts +14 -1
  414. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  415. package/dist/stream/base/output.d.ts +9 -14
  416. package/dist/stream/base/output.d.ts.map +1 -1
  417. package/dist/stream/index.cjs +15 -11
  418. package/dist/stream/index.d.ts +2 -2
  419. package/dist/stream/index.d.ts.map +1 -1
  420. package/dist/stream/index.js +2 -2
  421. package/dist/stream/types.d.ts +97 -32
  422. package/dist/stream/types.d.ts.map +1 -1
  423. package/dist/test-utils/llm-mock.cjs +101 -30
  424. package/dist/test-utils/llm-mock.cjs.map +1 -1
  425. package/dist/test-utils/llm-mock.d.ts +7 -2
  426. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  427. package/dist/test-utils/llm-mock.js +97 -30
  428. package/dist/test-utils/llm-mock.js.map +1 -1
  429. package/dist/tools/index.cjs +6 -6
  430. package/dist/tools/index.js +2 -2
  431. package/dist/tools/is-vercel-tool.cjs +2 -2
  432. package/dist/tools/is-vercel-tool.js +1 -1
  433. package/dist/tools/stream.d.ts +10 -4
  434. package/dist/tools/stream.d.ts.map +1 -1
  435. package/dist/tools/tool-builder/builder.d.ts +2 -0
  436. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  437. package/dist/tools/tool-stream-types.test-d.d.ts +2 -0
  438. package/dist/tools/tool-stream-types.test-d.d.ts.map +1 -0
  439. package/dist/tools/tool.d.ts +21 -8
  440. package/dist/tools/tool.d.ts.map +1 -1
  441. package/dist/tools/types.d.ts +33 -6
  442. package/dist/tools/types.d.ts.map +1 -1
  443. package/dist/tools/validation.d.ts +25 -1
  444. package/dist/tools/validation.d.ts.map +1 -1
  445. package/dist/tts/index.cjs +2 -2
  446. package/dist/tts/index.js +1 -1
  447. package/dist/types/zod-compat.d.ts +14 -1
  448. package/dist/types/zod-compat.d.ts.map +1 -1
  449. package/dist/utils.cjs +25 -21
  450. package/dist/utils.d.ts +9 -4
  451. package/dist/utils.d.ts.map +1 -1
  452. package/dist/utils.js +1 -1
  453. package/dist/vector/filter/index.cjs +7 -189
  454. package/dist/vector/filter/index.cjs.map +1 -1
  455. package/dist/vector/filter/index.js +1 -190
  456. package/dist/vector/filter/index.js.map +1 -1
  457. package/dist/vector/index.cjs +7 -2
  458. package/dist/vector/index.cjs.map +1 -1
  459. package/dist/vector/index.d.ts +1 -0
  460. package/dist/vector/index.d.ts.map +1 -1
  461. package/dist/vector/index.js +2 -1
  462. package/dist/vector/index.js.map +1 -1
  463. package/dist/vector/types.d.ts +86 -3
  464. package/dist/vector/types.d.ts.map +1 -1
  465. package/dist/vector/vector.d.ts +39 -2
  466. package/dist/vector/vector.d.ts.map +1 -1
  467. package/dist/voice/aisdk/index.d.ts +3 -0
  468. package/dist/voice/aisdk/index.d.ts.map +1 -0
  469. package/dist/voice/aisdk/speech.d.ts +23 -0
  470. package/dist/voice/aisdk/speech.d.ts.map +1 -0
  471. package/dist/voice/aisdk/transcription.d.ts +22 -0
  472. package/dist/voice/aisdk/transcription.d.ts.map +1 -0
  473. package/dist/voice/composite-voice.d.ts +4 -3
  474. package/dist/voice/composite-voice.d.ts.map +1 -1
  475. package/dist/voice/index.cjs +12 -4
  476. package/dist/voice/index.d.ts +1 -0
  477. package/dist/voice/index.d.ts.map +1 -1
  478. package/dist/voice/index.js +1 -1
  479. package/dist/workflows/default.d.ts +180 -270
  480. package/dist/workflows/default.d.ts.map +1 -1
  481. package/dist/workflows/evented/execution-engine.d.ts +3 -1
  482. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  483. package/dist/workflows/evented/index.cjs +10 -10
  484. package/dist/workflows/evented/index.js +1 -1
  485. package/dist/workflows/evented/step-executor.d.ts +1 -1
  486. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  487. package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -4
  488. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  489. package/dist/workflows/evented/workflow-event-processor/loop.d.ts +1 -1
  490. package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
  491. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
  492. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts.map +1 -1
  493. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
  494. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts.map +1 -1
  495. package/dist/workflows/evented/workflow.d.ts +2 -1
  496. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  497. package/dist/workflows/execution-engine.d.ts +8 -6
  498. package/dist/workflows/execution-engine.d.ts.map +1 -1
  499. package/dist/workflows/handlers/control-flow.d.ts +133 -0
  500. package/dist/workflows/handlers/control-flow.d.ts.map +1 -0
  501. package/dist/workflows/handlers/entry.d.ts +43 -0
  502. package/dist/workflows/handlers/entry.d.ts.map +1 -0
  503. package/dist/workflows/handlers/sleep.d.ts +60 -0
  504. package/dist/workflows/handlers/sleep.d.ts.map +1 -0
  505. package/dist/workflows/handlers/step.d.ts +58 -0
  506. package/dist/workflows/handlers/step.d.ts.map +1 -0
  507. package/dist/workflows/index.cjs +40 -16
  508. package/dist/workflows/index.js +1 -1
  509. package/dist/workflows/step.d.ts +8 -6
  510. package/dist/workflows/step.d.ts.map +1 -1
  511. package/dist/workflows/types.d.ts +257 -10
  512. package/dist/workflows/types.d.ts.map +1 -1
  513. package/dist/workflows/utils.d.ts +36 -0
  514. package/dist/workflows/utils.d.ts.map +1 -1
  515. package/dist/workflows/workflow.d.ts +146 -55
  516. package/dist/workflows/workflow.d.ts.map +1 -1
  517. package/package.json +26 -30
  518. package/src/llm/model/provider-types.generated.d.ts +489 -27
  519. package/dist/chunk-2ZVKF4HP.cjs.map +0 -1
  520. package/dist/chunk-436FFEF6.js +0 -34
  521. package/dist/chunk-436FFEF6.js.map +0 -1
  522. package/dist/chunk-4CDL2QJT.js.map +0 -1
  523. package/dist/chunk-7AHYOMHJ.js +0 -149
  524. package/dist/chunk-7AHYOMHJ.js.map +0 -1
  525. package/dist/chunk-CB575O6L.cjs.map +0 -1
  526. package/dist/chunk-CD56CXVE.cjs.map +0 -1
  527. package/dist/chunk-CINNK34N.js.map +0 -1
  528. package/dist/chunk-DNEURYF3.cjs.map +0 -1
  529. package/dist/chunk-DSNPWVIG.cjs.map +0 -1
  530. package/dist/chunk-E7K4FTLN.cjs.map +0 -1
  531. package/dist/chunk-ECFXGXWO.cjs.map +0 -1
  532. package/dist/chunk-ET6UOTTU.cjs +0 -154
  533. package/dist/chunk-ET6UOTTU.cjs.map +0 -1
  534. package/dist/chunk-GGYKYORQ.cjs.map +0 -1
  535. package/dist/chunk-GRBGQ2GE.js.map +0 -1
  536. package/dist/chunk-H6CZGPZD.js.map +0 -1
  537. package/dist/chunk-HDJFSJCK.js +0 -2237
  538. package/dist/chunk-HDJFSJCK.js.map +0 -1
  539. package/dist/chunk-HGNRQ3OG.js +0 -58
  540. package/dist/chunk-HGNRQ3OG.js.map +0 -1
  541. package/dist/chunk-I4CXL4SR.js.map +0 -1
  542. package/dist/chunk-IQO7ANVS.cjs.map +0 -1
  543. package/dist/chunk-J7O6WENZ.cjs.map +0 -1
  544. package/dist/chunk-JPGVRWWL.js.map +0 -1
  545. package/dist/chunk-JUBFO5J3.js.map +0 -1
  546. package/dist/chunk-JV2KH24V.js.map +0 -1
  547. package/dist/chunk-KIZIOFZC.js.map +0 -1
  548. package/dist/chunk-KJ2SW6VA.js.map +0 -1
  549. package/dist/chunk-LJFJTTZQ.cjs +0 -4
  550. package/dist/chunk-LJFJTTZQ.cjs.map +0 -1
  551. package/dist/chunk-LRSB62Z6.cjs +0 -60
  552. package/dist/chunk-LRSB62Z6.cjs.map +0 -1
  553. package/dist/chunk-LWBQ4P4N.cjs +0 -2240
  554. package/dist/chunk-LWBQ4P4N.cjs.map +0 -1
  555. package/dist/chunk-MA7TEM62.cjs.map +0 -1
  556. package/dist/chunk-MSWTA73A.cjs.map +0 -1
  557. package/dist/chunk-MV7KHWUT.js.map +0 -1
  558. package/dist/chunk-QUKUN6NR.cjs.map +0 -1
  559. package/dist/chunk-TQTAMPSC.js.map +0 -1
  560. package/dist/chunk-UIZSWUKP.js.map +0 -1
  561. package/dist/chunk-V3VLOOSW.cjs +0 -36
  562. package/dist/chunk-V3VLOOSW.cjs.map +0 -1
  563. package/dist/chunk-VOQ3ULMT.js.map +0 -1
  564. package/dist/chunk-VOY2RXOC.cjs.map +0 -1
  565. package/dist/chunk-W7UH2PWL.js.map +0 -1
  566. package/dist/chunk-WM6CK2F3.cjs.map +0 -1
  567. package/dist/chunk-XEVG546F.js.map +0 -1
  568. package/dist/chunk-Y63IFHEZ.cjs.map +0 -1
  569. package/dist/chunk-ZV5CC35D.js +0 -3
  570. package/dist/chunk-ZV5CC35D.js.map +0 -1
  571. package/dist/models-dev-DNBKXHT4.js +0 -3
  572. package/dist/models-dev-YBEEQIX6.cjs +0 -12
  573. package/dist/netlify-7G2L5VSH.js +0 -3
  574. package/dist/netlify-GWNGSIRZ.cjs +0 -12
  575. package/dist/registry-generator-H4YNODDH.js.map +0 -1
  576. package/dist/registry-generator-MK63POJO.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mcp/index.ts"],"names":["MastraBase","MastraError","RegisteredLogger","slugify","randomUUID"],"mappings":";;;;;;;;;;;;AA2BO,IAAe,aAAA,GAAf,cAAqCA,4BAAA,CAAW;AAAA;AAAA,EAE7C,QAAA,GAAW,KAAA;AAAA;AAAA,EAEH,IAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAER,GAAA;AAAA;AAAA,EAEQ,WAAA;AAAA;AAAA,EAEA,UAAA;AAAA;AAAA,EAEA,WAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,gBAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAET,cAAA;AAAA;AAAA,EAEA,MAAA;AAAA;AAAA,EAEY,MAAA;AAAA;AAAA,EAEA,SAAA;AAAA;AAAA,EAEA,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,IAAW,EAAA,GAAa;AACtB,IAAA,OAAO,IAAA,CAAK,GAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAA,GAAoD;AAClD,IAAA,OAAO,IAAA,CAAK,cAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,EAAA,EAAY;AAChB,IAAA,IAAI,KAAK,QAAA,EAAU;AACjB,MAAA;AAAA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AAK,cAAc,MAAA,CAAO,WAAA;AAC1B,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,cAAc,MAAA,CAAO,WAAA,IAAA,iBAAe,IAAI,IAAA,IAAO,WAAA,EAAY;AAChE,IAAA,IAAA,CAAK,QAAA,GAAW,MAAA,CAAO,QAAA,KAAa,MAAA,GAAY,OAAO,MAAA,CAAO,QAAA;AAC9D,IAAA,IAAA,CAAK,mBAAmB,MAAA,CAAO,gBAAA;AAC/B,IAAA,IAAA,CAAK,WAAW,MAAA,CAAO,QAAA;AACvB,IAAA,IAAA,CAAK,UAAU,MAAA,CAAO,OAAA;AACtB,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,YAAY,MAAA,CAAO,SAAA;AACxB,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,KAAA;AAC5B,IAAA,IAAA,CAAK,cAAA,GAAiB,KAAK,YAAA,CAAa,MAAA,CAAO,OAAO,MAAA,CAAO,MAAA,EAAQ,OAAO,SAAS,CAAA;AAAA,EACvF;AA6EF","file":"index.cjs","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport slugify from '@sindresorhus/slugify';\nimport type { ToolsInput } from '../agent';\nimport { MastraBase } from '../base';\nimport { MastraError } from '../error';\nimport { RegisteredLogger } from '../logger';\nimport type { Mastra } from '../mastra';\nimport type { InternalCoreTool, MCPToolType, ToolAction, ToolExecutionContext } from '../tools';\nimport type {\n MCPServerConfig,\n MCPServerHonoSSEOptions,\n MCPServerHTTPOptions,\n MCPServerSSEOptions,\n PackageInfo,\n RemoteInfo,\n Repository,\n ServerDetailInfo,\n ServerInfo,\n} from './types';\nexport * from './types';\nexport type { MCPToolType } from '../tools';\n\n/**\n * Abstract base class for MCP server implementations.\n * This provides a common interface and shared functionality for all MCP servers\n * that can be registered with Mastra, including handling of server metadata.\n */\nexport abstract class MCPServerBase extends MastraBase {\n /** Tracks if the server ID has been definitively set. */\n private idWasSet = false;\n /** The display name of the MCP server. */\n public readonly name: string;\n /** The semantic version of the MCP server. */\n public readonly version: string;\n /** Internal storage for the server's unique ID. */\n private _id: string;\n /** A description of what the MCP server does. */\n public readonly description?: string;\n /** Repository information for the server's source code. */\n public readonly repository?: Repository;\n /** The release date of this server version (ISO 8601 string). */\n public readonly releaseDate: string;\n /** Indicates if this version is the latest available. */\n public readonly isLatest: boolean;\n /** The canonical packaging format (e.g., \"npm\", \"docker\"), if applicable. */\n public readonly packageCanonical?: MCPServerConfig['packageCanonical'];\n /** Information about installable packages for this server. */\n public readonly packages?: PackageInfo[];\n /** Information about remote access points for this server. */\n public readonly remotes?: RemoteInfo[];\n /** The tools registered with and converted by this MCP server. */\n public convertedTools: Record<string, InternalCoreTool>;\n /** Reference to the Mastra instance if this server is registered with one. */\n public mastra: Mastra | undefined;\n /** Agents to be exposed as tools. */\n protected readonly agents?: MCPServerConfig['agents'];\n /** Workflows to be exposed as tools. */\n protected readonly workflows?: MCPServerConfig['workflows'];\n /** Original tools configuration for re-conversion when Mastra instance is registered. */\n protected readonly originalTools: ToolsInput;\n\n /**\n * Public getter for the server's unique ID.\n * The ID is set at construction or by Mastra and is read-only afterwards.\n */\n public get id(): string {\n return this._id;\n }\n\n /**\n * Gets a read-only view of the registered tools.\n * @returns A readonly record of converted tools.\n */\n tools(): Readonly<Record<string, InternalCoreTool>> {\n return this.convertedTools;\n }\n\n /**\n * Sets the server's unique ID. This method is typically called by Mastra when\n * registering the server, using the key provided in the Mastra configuration.\n * It ensures the ID is set only once.\n * If an ID was already provided in the MCPServerConfig, this method will be a no-op.\n * @param id The unique ID to assign to the server.\n */\n setId(id: string) {\n if (this.idWasSet) {\n return;\n }\n this._id = id;\n this.idWasSet = true;\n }\n\n /**\n * Abstract method to convert and validate tool definitions provided to the server.\n * This method will also handle agents passed in the config.\n * @param tools Tool definitions to convert.\n * @param agents Agent definitions to convert to tools.\n * @param workflows Workflow definitions to convert to tools.\n * @returns A record of converted and validated tools.\n */\n public abstract convertTools(\n tools: ToolsInput,\n agents?: MCPServerConfig['agents'],\n workflows?: MCPServerConfig['workflows'],\n ): Record<string, InternalCoreTool>;\n\n /**\n * Internal method used by Mastra to register itself with the server.\n * @param mastra The Mastra instance.\n * @internal\n */\n __registerMastra(mastra: Mastra): void {\n this.mastra = mastra;\n // Re-convert tools now that we have the Mastra instance to populate MCP tools execute with mastra instance\n this.convertedTools = this.convertTools(this.originalTools, this.agents, this.workflows);\n\n // Auto-register tools with the Mastra instance\n if (this.originalTools && typeof this.originalTools === 'object') {\n Object.entries(this.originalTools).forEach(([key, tool]) => {\n try {\n // Only add tools that have an id property (ToolAction type)\n if (tool && typeof tool === 'object' && 'id' in tool) {\n // Use tool's intrinsic ID to avoid collisions across MCP servers\n const toolKey = typeof (tool as any).id === 'string' ? (tool as any).id : key;\n mastra.addTool(tool as ToolAction<any, any, any, any, ToolExecutionContext<any, any>>, toolKey);\n }\n } catch (error) {\n // Tool might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_TOOL_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register agents with the Mastra instance\n if (this.agents && typeof this.agents === 'object') {\n Object.entries(this.agents).forEach(([key, agent]) => {\n try {\n mastra.addAgent(agent, key);\n } catch (error) {\n // Agent might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_AGENT_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register workflows with the Mastra instance\n if (this.workflows && typeof this.workflows === 'object') {\n Object.entries(this.workflows).forEach(([key, workflow]) => {\n try {\n mastra.addWorkflow(workflow, key);\n } catch (error) {\n // Workflow might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_WORKFLOW_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n }\n\n /**\n * Constructor for the MCPServerBase.\n * @param config Configuration options for the MCP server, including metadata.\n */\n constructor(config: MCPServerConfig) {\n super({ component: RegisteredLogger.MCP_SERVER, name: config.name });\n this.name = config.name;\n this.version = config.version;\n\n // If user does not provide an ID, we will use the key from the Mastra config, but if user does not pass MCPServer\n // to Mastra, we will generate a random UUID as a backup.\n if (config.id) {\n this._id = slugify(config.id);\n this.idWasSet = true;\n } else {\n this._id = this.mastra?.generateId() || randomUUID();\n }\n\n this.description = config.description;\n this.repository = config.repository;\n this.releaseDate = config.releaseDate || new Date().toISOString();\n this.isLatest = config.isLatest === undefined ? true : config.isLatest;\n this.packageCanonical = config.packageCanonical;\n this.packages = config.packages;\n this.remotes = config.remotes;\n this.agents = config.agents;\n this.workflows = config.workflows;\n this.originalTools = config.tools;\n this.convertedTools = this.convertTools(config.tools, config.agents, config.workflows);\n }\n\n /**\n * Start the MCP server using stdio transport\n * This is typically used for Windsurf integration\n */\n public abstract startStdio(): Promise<void>;\n\n /**\n * Start the MCP server using SSE transport\n * This is typically used for web integration\n * @param options Options for the SSE transport\n */\n public abstract startSSE(options: MCPServerSSEOptions): Promise<void>;\n\n /**\n * Start the MCP server using Hono SSE transport\n * Used for Hono servers\n * @param options Options for the SSE transport\n */\n public abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;\n\n /**\n * Start the MCP server using HTTP transport\n * @param options Options for the HTTP transport\n */\n public abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;\n\n /**\n * Close the MCP server and all its connections\n */\n public abstract close(): Promise<void>;\n\n /**\n * Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.\n * This information is suitable for listing multiple servers.\n * @returns ServerInfo object containing basic server metadata.\n */\n public abstract getServerInfo(): ServerInfo;\n\n /**\n * Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.\n * This includes all information from `getServerInfo` plus package and remote details.\n * @returns ServerDetailInfo object containing comprehensive server metadata.\n */\n public abstract getServerDetail(): ServerDetailInfo;\n\n /**\n * Gets a list of tools provided by this MCP server, including their schemas.\n * @returns An object containing an array of tool information.\n */\n public abstract getToolListInfo(): {\n tools: Array<{ name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType }>;\n };\n\n /**\n * Gets information for a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to retrieve.\n * @returns Tool information (name, description, inputSchema) or undefined if not found.\n */\n public abstract getToolInfo(\n toolId: string,\n ): { name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType } | undefined;\n\n /**\n * Executes a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to execute.\n * @param args The arguments to pass to the tool's execute function.\n * @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).\n * @returns A promise that resolves to the result of the tool execution.\n * @throws Error if the tool is not found, or if execution fails.\n */\n public abstract executeTool(\n toolId: string,\n args: any,\n executionContext?: { messages?: any[]; toolCallId?: string },\n ): Promise<any>;\n}\n"]}
1
+ {"version":3,"sources":["../../src/mcp/index.ts"],"names":["MastraBase","MastraError","RegisteredLogger","slugify","randomUUID"],"mappings":";;;;;;;;;;;;AA2BO,IAAe,aAAA,GAAf,cAAkEA,4BAAA,CAAW;AAAA;AAAA,EAE1E,QAAA,GAAW,KAAA;AAAA;AAAA,EAEH,IAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAER,GAAA;AAAA;AAAA,EAEQ,WAAA;AAAA;AAAA,EAEA,UAAA;AAAA;AAAA,EAEA,WAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,gBAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAET,cAAA;AAAA;AAAA,EAEA,MAAA;AAAA;AAAA,EAEY,MAAA;AAAA;AAAA,EAEA,SAAA;AAAA;AAAA,EAEA,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,IAAW,EAAA,GAAU;AACnB,IAAA,OAAO,IAAA,CAAK,GAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAA,GAAoD;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A,CAAK,QAAA,GAAW,IAAA;AAAA,IAClB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,GAAA,GAAO,IAAA,CAAK,MAAA,EAAQ,UAAA,MAAgBC,iBAAA,EAAW;AAAA,IACtD;AAEA,IAAA,IAAA,CAAK,cAAc,MAAA,CAAO,WAAA;AAC1B,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,cAAc,MAAA,CAAO,WAAA,IAAA,iBAAe,IAAI,IAAA,IAAO,WAAA,EAAY;AAChE,IAAA,IAAA,CAAK,QAAA,GAAW,MAAA,CAAO,QAAA,KAAa,MAAA,GAAY,OAAO,MAAA,CAAO,QAAA;AAC9D,IAAA,IAAA,CAAK,mBAAmB,MAAA,CAAO,gBAAA;AAC/B,IAAA,IAAA,CAAK,WAAW,MAAA,CAAO,QAAA;AACvB,IAAA,IAAA,CAAK,UAAU,MAAA,CAAO,OAAA;AACtB,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,YAAY,MAAA,CAAO,SAAA;AACxB,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,KAAA;AAC5B,IAAA,IAAA,CAAK,cAAA,GAAiB,KAAK,YAAA,CAAa,MAAA,CAAO,OAAO,MAAA,CAAO,MAAA,EAAQ,OAAO,SAAS,CAAA;AAAA,EACvF;AA6EF","file":"index.cjs","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport slugify from '@sindresorhus/slugify';\nimport type { ToolsInput } from '../agent';\nimport { MastraBase } from '../base';\nimport { MastraError } from '../error';\nimport { RegisteredLogger } from '../logger';\nimport type { Mastra } from '../mastra';\nimport type { InternalCoreTool, MCPToolType, ToolAction, ToolExecutionContext } from '../tools';\nimport type {\n MCPServerConfig,\n MCPServerHonoSSEOptions,\n MCPServerHTTPOptions,\n MCPServerSSEOptions,\n PackageInfo,\n RemoteInfo,\n Repository,\n ServerDetailInfo,\n ServerInfo,\n} from './types';\nexport * from './types';\nexport type { MCPToolType } from '../tools';\n\n/**\n * Abstract base class for MCP server implementations.\n * This provides a common interface and shared functionality for all MCP servers\n * that can be registered with Mastra, including handling of server metadata.\n */\nexport abstract class MCPServerBase<TId extends string = string> extends MastraBase {\n /** Tracks if the server ID has been definitively set. */\n private idWasSet = false;\n /** The display name of the MCP server. */\n public readonly name: string;\n /** The semantic version of the MCP server. */\n public readonly version: string;\n /** Internal storage for the server's unique ID. */\n private _id: TId;\n /** A description of what the MCP server does. */\n public readonly description?: string;\n /** Repository information for the server's source code. */\n public readonly repository?: Repository;\n /** The release date of this server version (ISO 8601 string). */\n public readonly releaseDate: string;\n /** Indicates if this version is the latest available. */\n public readonly isLatest: boolean;\n /** The canonical packaging format (e.g., \"npm\", \"docker\"), if applicable. */\n public readonly packageCanonical?: MCPServerConfig['packageCanonical'];\n /** Information about installable packages for this server. */\n public readonly packages?: PackageInfo[];\n /** Information about remote access points for this server. */\n public readonly remotes?: RemoteInfo[];\n /** The tools registered with and converted by this MCP server. */\n public convertedTools: Record<string, InternalCoreTool>;\n /** Reference to the Mastra instance if this server is registered with one. */\n public mastra: Mastra | undefined;\n /** Agents to be exposed as tools. */\n protected readonly agents?: MCPServerConfig['agents'];\n /** Workflows to be exposed as tools. */\n protected readonly workflows?: MCPServerConfig['workflows'];\n /** Original tools configuration for re-conversion when Mastra instance is registered. */\n protected readonly originalTools: ToolsInput;\n\n /**\n * Public getter for the server's unique ID.\n * The ID is set at construction or by Mastra and is read-only afterwards.\n */\n public get id(): TId {\n return this._id;\n }\n\n /**\n * Gets a read-only view of the registered tools.\n * @returns A readonly record of converted tools.\n */\n tools(): Readonly<Record<string, InternalCoreTool>> {\n return this.convertedTools;\n }\n\n /**\n * Sets the server's unique ID. This method is typically called by Mastra when\n * registering the server, using the key provided in the Mastra configuration.\n * It ensures the ID is set only once.\n * If an ID was already provided in the MCPServerConfig, this method will be a no-op.\n * @param id The unique ID to assign to the server.\n */\n setId(id: TId) {\n if (this.idWasSet) {\n return;\n }\n this._id = id;\n this.idWasSet = true;\n }\n\n /**\n * Abstract method to convert and validate tool definitions provided to the server.\n * This method will also handle agents passed in the config.\n * @param tools Tool definitions to convert.\n * @param agents Agent definitions to convert to tools.\n * @param workflows Workflow definitions to convert to tools.\n * @returns A record of converted and validated tools.\n */\n public abstract convertTools(\n tools: ToolsInput,\n agents?: MCPServerConfig['agents'],\n workflows?: MCPServerConfig['workflows'],\n ): Record<string, InternalCoreTool>;\n\n /**\n * Internal method used by Mastra to register itself with the server.\n * @param mastra The Mastra instance.\n * @internal\n */\n __registerMastra(mastra: Mastra): void {\n this.mastra = mastra;\n // Re-convert tools now that we have the Mastra instance to populate MCP tools execute with mastra instance\n this.convertedTools = this.convertTools(this.originalTools, this.agents, this.workflows);\n\n // Auto-register tools with the Mastra instance\n if (this.originalTools && typeof this.originalTools === 'object') {\n Object.entries(this.originalTools).forEach(([key, tool]) => {\n try {\n // Only add tools that have an id property (ToolAction type)\n if (tool && typeof tool === 'object' && 'id' in tool) {\n // Use tool's intrinsic ID to avoid collisions across MCP servers\n const toolKey = typeof (tool as any).id === 'string' ? (tool as any).id : key;\n mastra.addTool(tool as ToolAction<any, any, any, any, ToolExecutionContext<any, any>>, toolKey);\n }\n } catch (error) {\n // Tool might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_TOOL_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register agents with the Mastra instance\n if (this.agents && typeof this.agents === 'object') {\n Object.entries(this.agents).forEach(([key, agent]) => {\n try {\n mastra.addAgent(agent, key);\n } catch (error) {\n // Agent might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_AGENT_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register workflows with the Mastra instance\n if (this.workflows && typeof this.workflows === 'object') {\n Object.entries(this.workflows).forEach(([key, workflow]) => {\n try {\n mastra.addWorkflow(workflow, key);\n } catch (error) {\n // Workflow might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_WORKFLOW_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n }\n\n /**\n * Constructor for the MCPServerBase.\n * @param config Configuration options for the MCP server, including metadata.\n */\n constructor(config: MCPServerConfig<TId>) {\n super({ component: RegisteredLogger.MCP_SERVER, name: config.name });\n this.name = config.name;\n this.version = config.version;\n\n // If user does not provide an ID, we will use the key from the Mastra config, but if user does not pass MCPServer\n // to Mastra, we will generate a random UUID as a backup.\n if (config.id) {\n this._id = slugify(config.id) as TId;\n this.idWasSet = true;\n } else {\n this._id = (this.mastra?.generateId() || randomUUID()) as TId;\n }\n\n this.description = config.description;\n this.repository = config.repository;\n this.releaseDate = config.releaseDate || new Date().toISOString();\n this.isLatest = config.isLatest === undefined ? true : config.isLatest;\n this.packageCanonical = config.packageCanonical;\n this.packages = config.packages;\n this.remotes = config.remotes;\n this.agents = config.agents;\n this.workflows = config.workflows;\n this.originalTools = config.tools;\n this.convertedTools = this.convertTools(config.tools, config.agents, config.workflows);\n }\n\n /**\n * Start the MCP server using stdio transport\n * This is typically used for Windsurf integration\n */\n public abstract startStdio(): Promise<void>;\n\n /**\n * Start the MCP server using SSE transport\n * This is typically used for web integration\n * @param options Options for the SSE transport\n */\n public abstract startSSE(options: MCPServerSSEOptions): Promise<void>;\n\n /**\n * Start the MCP server using Hono SSE transport\n * Used for Hono servers\n * @param options Options for the SSE transport\n */\n public abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;\n\n /**\n * Start the MCP server using HTTP transport\n * @param options Options for the HTTP transport\n */\n public abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;\n\n /**\n * Close the MCP server and all its connections\n */\n public abstract close(): Promise<void>;\n\n /**\n * Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.\n * This information is suitable for listing multiple servers.\n * @returns ServerInfo object containing basic server metadata.\n */\n public abstract getServerInfo(): ServerInfo;\n\n /**\n * Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.\n * This includes all information from `getServerInfo` plus package and remote details.\n * @returns ServerDetailInfo object containing comprehensive server metadata.\n */\n public abstract getServerDetail(): ServerDetailInfo;\n\n /**\n * Gets a list of tools provided by this MCP server, including their schemas.\n * @returns An object containing an array of tool information.\n */\n public abstract getToolListInfo(): {\n tools: Array<{ name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType }>;\n };\n\n /**\n * Gets information for a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to retrieve.\n * @returns Tool information (name, description, inputSchema) or undefined if not found.\n */\n public abstract getToolInfo(\n toolId: string,\n ): { name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType } | undefined;\n\n /**\n * Executes a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to execute.\n * @param args The arguments to pass to the tool's execute function.\n * @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).\n * @returns A promise that resolves to the result of the tool execution.\n * @throws Error if the tool is not found, or if execution fails.\n */\n public abstract executeTool(\n toolId: string,\n args: any,\n executionContext?: { messages?: any[]; toolCallId?: string },\n ): Promise<any>;\n}\n"]}
@@ -10,7 +10,7 @@ export type { MCPToolType } from '../tools/index.js';
10
10
  * This provides a common interface and shared functionality for all MCP servers
11
11
  * that can be registered with Mastra, including handling of server metadata.
12
12
  */
13
- export declare abstract class MCPServerBase extends MastraBase {
13
+ export declare abstract class MCPServerBase<TId extends string = string> extends MastraBase {
14
14
  /** Tracks if the server ID has been definitively set. */
15
15
  private idWasSet;
16
16
  /** The display name of the MCP server. */
@@ -47,7 +47,7 @@ export declare abstract class MCPServerBase extends MastraBase {
47
47
  * Public getter for the server's unique ID.
48
48
  * The ID is set at construction or by Mastra and is read-only afterwards.
49
49
  */
50
- get id(): string;
50
+ get id(): TId;
51
51
  /**
52
52
  * Gets a read-only view of the registered tools.
53
53
  * @returns A readonly record of converted tools.
@@ -60,7 +60,7 @@ export declare abstract class MCPServerBase extends MastraBase {
60
60
  * If an ID was already provided in the MCPServerConfig, this method will be a no-op.
61
61
  * @param id The unique ID to assign to the server.
62
62
  */
63
- setId(id: string): void;
63
+ setId(id: TId): void;
64
64
  /**
65
65
  * Abstract method to convert and validate tool definitions provided to the server.
66
66
  * This method will also handle agents passed in the config.
@@ -80,7 +80,7 @@ export declare abstract class MCPServerBase extends MastraBase {
80
80
  * Constructor for the MCPServerBase.
81
81
  * @param config Configuration options for the MCP server, including metadata.
82
82
  */
83
- constructor(config: MCPServerConfig);
83
+ constructor(config: MCPServerConfig<TId>);
84
84
  /**
85
85
  * Start the MCP server using stdio transport
86
86
  * This is typically used for Windsurf integration
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAoC,MAAM,UAAU,CAAC;AAChG,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;GAIG;AACH,8BAAsB,aAAc,SAAQ,UAAU;IACpD,yDAAyD;IACzD,OAAO,CAAC,QAAQ,CAAS;IACzB,0CAA0C;IAC1C,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,8CAA8C;IAC9C,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,mDAAmD;IACnD,OAAO,CAAC,GAAG,CAAS;IACpB,iDAAiD;IACjD,SAAg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,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvE;;OAEG;aACa,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtC;;;;OAIG;aACa,aAAa,IAAI,UAAU;IAE3C;;;;OAIG;aACa,eAAe,IAAI,gBAAgB;IAEnD;;;OAGG;aACa,eAAe,IAAI;QACjC,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,GAAG,CAAC;YAAC,YAAY,CAAC,EAAE,GAAG,CAAC;YAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KACpH;IAED;;;;OAIG;aACa,WAAW,CACzB,MAAM,EAAE,MAAM,GACb;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,GAAG,CAAC;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC;QAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,SAAS;IAEnH;;;;;;;OAOG;aACa,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EACT,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D,OAAO,CAAC,GAAG,CAAC;CAChB"}
package/dist/mcp/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MastraError } from '../chunk-JJ5O45LH.js';
2
- import { MastraBase } from '../chunk-S6URFGCZ.js';
3
- import { RegisteredLogger } from '../chunk-KJ2SW6VA.js';
2
+ import { MastraBase } from '../chunk-LSHPJWM5.js';
3
+ import { RegisteredLogger } from '../chunk-NRUZYMHE.js';
4
4
  import { randomUUID } from 'crypto';
5
5
  import slugify from '@sindresorhus/slugify';
6
6
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../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MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,YAAY,MAAA,CAAO,SAAA;AACxB,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,KAAA;AAC5B,IAAA,IAAA,CAAK,cAAA,GAAiB,KAAK,YAAA,CAAa,MAAA,CAAO,OAAO,MAAA,CAAO,MAAA,EAAQ,OAAO,SAAS,CAAA;AAAA,EACvF;AA6EF","file":"index.js","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport slugify from '@sindresorhus/slugify';\nimport type { ToolsInput } from '../agent';\nimport { MastraBase } from '../base';\nimport { MastraError } from '../error';\nimport { RegisteredLogger } from '../logger';\nimport type { Mastra } from '../mastra';\nimport type { InternalCoreTool, MCPToolType, ToolAction, ToolExecutionContext } from '../tools';\nimport type {\n MCPServerConfig,\n MCPServerHonoSSEOptions,\n MCPServerHTTPOptions,\n MCPServerSSEOptions,\n PackageInfo,\n RemoteInfo,\n Repository,\n ServerDetailInfo,\n ServerInfo,\n} from './types';\nexport * from './types';\nexport type { MCPToolType } from '../tools';\n\n/**\n * Abstract base class for MCP server implementations.\n * This provides a common interface and shared functionality for all MCP servers\n * that can be registered with Mastra, including handling of server metadata.\n */\nexport abstract class MCPServerBase extends MastraBase {\n /** Tracks if the server ID has been definitively set. */\n private idWasSet = false;\n /** The display name of the MCP server. */\n public readonly name: string;\n /** The semantic version of the MCP server. */\n public readonly version: string;\n /** Internal storage for the server's unique ID. */\n private _id: string;\n /** A description of what the MCP server does. */\n public readonly description?: string;\n /** Repository information for the server's source code. */\n public readonly repository?: Repository;\n /** The release date of this server version (ISO 8601 string). */\n public readonly releaseDate: string;\n /** Indicates if this version is the latest available. */\n public readonly isLatest: boolean;\n /** The canonical packaging format (e.g., \"npm\", \"docker\"), if applicable. */\n public readonly packageCanonical?: MCPServerConfig['packageCanonical'];\n /** Information about installable packages for this server. */\n public readonly packages?: PackageInfo[];\n /** Information about remote access points for this server. */\n public readonly remotes?: RemoteInfo[];\n /** The tools registered with and converted by this MCP server. */\n public convertedTools: Record<string, InternalCoreTool>;\n /** Reference to the Mastra instance if this server is registered with one. */\n public mastra: Mastra | undefined;\n /** Agents to be exposed as tools. */\n protected readonly agents?: MCPServerConfig['agents'];\n /** Workflows to be exposed as tools. */\n protected readonly workflows?: MCPServerConfig['workflows'];\n /** Original tools configuration for re-conversion when Mastra instance is registered. */\n protected readonly originalTools: ToolsInput;\n\n /**\n * Public getter for the server's unique ID.\n * The ID is set at construction or by Mastra and is read-only afterwards.\n */\n public get id(): string {\n return this._id;\n }\n\n /**\n * Gets a read-only view of the registered tools.\n * @returns A readonly record of converted tools.\n */\n tools(): Readonly<Record<string, InternalCoreTool>> {\n return this.convertedTools;\n }\n\n /**\n * Sets the server's unique ID. This method is typically called by Mastra when\n * registering the server, using the key provided in the Mastra configuration.\n * It ensures the ID is set only once.\n * If an ID was already provided in the MCPServerConfig, this method will be a no-op.\n * @param id The unique ID to assign to the server.\n */\n setId(id: string) {\n if (this.idWasSet) {\n return;\n }\n this._id = id;\n this.idWasSet = true;\n }\n\n /**\n * Abstract method to convert and validate tool definitions provided to the server.\n * This method will also handle agents passed in the config.\n * @param tools Tool definitions to convert.\n * @param agents Agent definitions to convert to tools.\n * @param workflows Workflow definitions to convert to tools.\n * @returns A record of converted and validated tools.\n */\n public abstract convertTools(\n tools: ToolsInput,\n agents?: MCPServerConfig['agents'],\n workflows?: MCPServerConfig['workflows'],\n ): Record<string, InternalCoreTool>;\n\n /**\n * Internal method used by Mastra to register itself with the server.\n * @param mastra The Mastra instance.\n * @internal\n */\n __registerMastra(mastra: Mastra): void {\n this.mastra = mastra;\n // Re-convert tools now that we have the Mastra instance to populate MCP tools execute with mastra instance\n this.convertedTools = this.convertTools(this.originalTools, this.agents, this.workflows);\n\n // Auto-register tools with the Mastra instance\n if (this.originalTools && typeof this.originalTools === 'object') {\n Object.entries(this.originalTools).forEach(([key, tool]) => {\n try {\n // Only add tools that have an id property (ToolAction type)\n if (tool && typeof tool === 'object' && 'id' in tool) {\n // Use tool's intrinsic ID to avoid collisions across MCP servers\n const toolKey = typeof (tool as any).id === 'string' ? (tool as any).id : key;\n mastra.addTool(tool as ToolAction<any, any, any, any, ToolExecutionContext<any, any>>, toolKey);\n }\n } catch (error) {\n // Tool might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_TOOL_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register agents with the Mastra instance\n if (this.agents && typeof this.agents === 'object') {\n Object.entries(this.agents).forEach(([key, agent]) => {\n try {\n mastra.addAgent(agent, key);\n } catch (error) {\n // Agent might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_AGENT_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register workflows with the Mastra instance\n if (this.workflows && typeof this.workflows === 'object') {\n Object.entries(this.workflows).forEach(([key, workflow]) => {\n try {\n mastra.addWorkflow(workflow, key);\n } catch (error) {\n // Workflow might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_WORKFLOW_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n }\n\n /**\n * Constructor for the MCPServerBase.\n * @param config Configuration options for the MCP server, including metadata.\n */\n constructor(config: MCPServerConfig) {\n super({ component: RegisteredLogger.MCP_SERVER, name: config.name });\n this.name = config.name;\n this.version = config.version;\n\n // If user does not provide an ID, we will use the key from the Mastra config, but if user does not pass MCPServer\n // to Mastra, we will generate a random UUID as a backup.\n if (config.id) {\n this._id = slugify(config.id);\n this.idWasSet = true;\n } else {\n this._id = this.mastra?.generateId() || randomUUID();\n }\n\n this.description = config.description;\n this.repository = config.repository;\n this.releaseDate = config.releaseDate || new Date().toISOString();\n this.isLatest = config.isLatest === undefined ? true : config.isLatest;\n this.packageCanonical = config.packageCanonical;\n this.packages = config.packages;\n this.remotes = config.remotes;\n this.agents = config.agents;\n this.workflows = config.workflows;\n this.originalTools = config.tools;\n this.convertedTools = this.convertTools(config.tools, config.agents, config.workflows);\n }\n\n /**\n * Start the MCP server using stdio transport\n * This is typically used for Windsurf integration\n */\n public abstract startStdio(): Promise<void>;\n\n /**\n * Start the MCP server using SSE transport\n * This is typically used for web integration\n * @param options Options for the SSE transport\n */\n public abstract startSSE(options: MCPServerSSEOptions): Promise<void>;\n\n /**\n * Start the MCP server using Hono SSE transport\n * Used for Hono servers\n * @param options Options for the SSE transport\n */\n public abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;\n\n /**\n * Start the MCP server using HTTP transport\n * @param options Options for the HTTP transport\n */\n public abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;\n\n /**\n * Close the MCP server and all its connections\n */\n public abstract close(): Promise<void>;\n\n /**\n * Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.\n * This information is suitable for listing multiple servers.\n * @returns ServerInfo object containing basic server metadata.\n */\n public abstract getServerInfo(): ServerInfo;\n\n /**\n * Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.\n * This includes all information from `getServerInfo` plus package and remote details.\n * @returns ServerDetailInfo object containing comprehensive server metadata.\n */\n public abstract getServerDetail(): ServerDetailInfo;\n\n /**\n * Gets a list of tools provided by this MCP server, including their schemas.\n * @returns An object containing an array of tool information.\n */\n public abstract getToolListInfo(): {\n tools: Array<{ name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType }>;\n };\n\n /**\n * Gets information for a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to retrieve.\n * @returns Tool information (name, description, inputSchema) or undefined if not found.\n */\n public abstract getToolInfo(\n toolId: string,\n ): { name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType } | undefined;\n\n /**\n * Executes a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to execute.\n * @param args The arguments to pass to the tool's execute function.\n * @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).\n * @returns A promise that resolves to the result of the tool execution.\n * @throws Error if the tool is not found, or if execution fails.\n */\n public abstract executeTool(\n toolId: string,\n args: any,\n executionContext?: { messages?: any[]; toolCallId?: string },\n ): Promise<any>;\n}\n"]}
1
+ {"version":3,"sources":["../../src/mcp/index.ts"],"names":[],"mappings":";;;;;;AA2BO,IAAe,aAAA,GAAf,cAAkE,UAAA,CAAW;AAAA;AAAA,EAE1E,QAAA,GAAW,KAAA;AAAA;AAAA,EAEH,IAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAER,GAAA;AAAA;AAAA,EAEQ,WAAA;AAAA;AAAA,EAEA,UAAA;AAAA;AAAA,EAEA,WAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,gBAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,OAAA;AAAA;AAAA,EAET,cAAA;AAAA;AAAA,EAEA,MAAA;AAAA;AAAA,EAEY,MAAA;AAAA;AAAA,EAEA,SAAA;AAAA;AAAA,EAEA,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,IAAW,EAAA,GAAU;AACnB,IAAA,OAAO,IAAA,CAAK,GAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAA,GAAoD;AAClD,IAAA,OAAO,IAAA,CAAK,cAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,EAAA,EAAS;AACb,IAAA,IAAI,KAAK,QAAA,EAAU;AACjB,MAAA;AAAA,IACF;AACA,IAAA,IAAA,CAAK,GAAA,GAAM,EAAA;AACX,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,iBAAiB,MAAA,EAAsB;AACrC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAEd,IAAA,IAAA,CAAK,cAAA,GAAiB,KAAK,YAAA,CAAa,IAAA,CAAK,eAAe,IAAA,CAAK,MAAA,EAAQ,KAAK,SAAS,CAAA;A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CAAK,WAAW,MAAA,CAAO,QAAA;AACvB,IAAA,IAAA,CAAK,UAAU,MAAA,CAAO,OAAA;AACtB,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,YAAY,MAAA,CAAO,SAAA;AACxB,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,KAAA;AAC5B,IAAA,IAAA,CAAK,cAAA,GAAiB,KAAK,YAAA,CAAa,MAAA,CAAO,OAAO,MAAA,CAAO,MAAA,EAAQ,OAAO,SAAS,CAAA;AAAA,EACvF;AA6EF","file":"index.js","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport slugify from '@sindresorhus/slugify';\nimport type { ToolsInput } from '../agent';\nimport { MastraBase } from '../base';\nimport { MastraError } from '../error';\nimport { RegisteredLogger } from '../logger';\nimport type { Mastra } from '../mastra';\nimport type { InternalCoreTool, MCPToolType, ToolAction, ToolExecutionContext } from '../tools';\nimport type {\n MCPServerConfig,\n MCPServerHonoSSEOptions,\n MCPServerHTTPOptions,\n MCPServerSSEOptions,\n PackageInfo,\n RemoteInfo,\n Repository,\n ServerDetailInfo,\n ServerInfo,\n} from './types';\nexport * from './types';\nexport type { MCPToolType } from '../tools';\n\n/**\n * Abstract base class for MCP server implementations.\n * This provides a common interface and shared functionality for all MCP servers\n * that can be registered with Mastra, including handling of server metadata.\n */\nexport abstract class MCPServerBase<TId extends string = string> extends MastraBase {\n /** Tracks if the server ID has been definitively set. */\n private idWasSet = false;\n /** The display name of the MCP server. */\n public readonly name: string;\n /** The semantic version of the MCP server. */\n public readonly version: string;\n /** Internal storage for the server's unique ID. */\n private _id: TId;\n /** A description of what the MCP server does. */\n public readonly description?: string;\n /** Repository information for the server's source code. */\n public readonly repository?: Repository;\n /** The release date of this server version (ISO 8601 string). */\n public readonly releaseDate: string;\n /** Indicates if this version is the latest available. */\n public readonly isLatest: boolean;\n /** The canonical packaging format (e.g., \"npm\", \"docker\"), if applicable. */\n public readonly packageCanonical?: MCPServerConfig['packageCanonical'];\n /** Information about installable packages for this server. */\n public readonly packages?: PackageInfo[];\n /** Information about remote access points for this server. */\n public readonly remotes?: RemoteInfo[];\n /** The tools registered with and converted by this MCP server. */\n public convertedTools: Record<string, InternalCoreTool>;\n /** Reference to the Mastra instance if this server is registered with one. */\n public mastra: Mastra | undefined;\n /** Agents to be exposed as tools. */\n protected readonly agents?: MCPServerConfig['agents'];\n /** Workflows to be exposed as tools. */\n protected readonly workflows?: MCPServerConfig['workflows'];\n /** Original tools configuration for re-conversion when Mastra instance is registered. */\n protected readonly originalTools: ToolsInput;\n\n /**\n * Public getter for the server's unique ID.\n * The ID is set at construction or by Mastra and is read-only afterwards.\n */\n public get id(): TId {\n return this._id;\n }\n\n /**\n * Gets a read-only view of the registered tools.\n * @returns A readonly record of converted tools.\n */\n tools(): Readonly<Record<string, InternalCoreTool>> {\n return this.convertedTools;\n }\n\n /**\n * Sets the server's unique ID. This method is typically called by Mastra when\n * registering the server, using the key provided in the Mastra configuration.\n * It ensures the ID is set only once.\n * If an ID was already provided in the MCPServerConfig, this method will be a no-op.\n * @param id The unique ID to assign to the server.\n */\n setId(id: TId) {\n if (this.idWasSet) {\n return;\n }\n this._id = id;\n this.idWasSet = true;\n }\n\n /**\n * Abstract method to convert and validate tool definitions provided to the server.\n * This method will also handle agents passed in the config.\n * @param tools Tool definitions to convert.\n * @param agents Agent definitions to convert to tools.\n * @param workflows Workflow definitions to convert to tools.\n * @returns A record of converted and validated tools.\n */\n public abstract convertTools(\n tools: ToolsInput,\n agents?: MCPServerConfig['agents'],\n workflows?: MCPServerConfig['workflows'],\n ): Record<string, InternalCoreTool>;\n\n /**\n * Internal method used by Mastra to register itself with the server.\n * @param mastra The Mastra instance.\n * @internal\n */\n __registerMastra(mastra: Mastra): void {\n this.mastra = mastra;\n // Re-convert tools now that we have the Mastra instance to populate MCP tools execute with mastra instance\n this.convertedTools = this.convertTools(this.originalTools, this.agents, this.workflows);\n\n // Auto-register tools with the Mastra instance\n if (this.originalTools && typeof this.originalTools === 'object') {\n Object.entries(this.originalTools).forEach(([key, tool]) => {\n try {\n // Only add tools that have an id property (ToolAction type)\n if (tool && typeof tool === 'object' && 'id' in tool) {\n // Use tool's intrinsic ID to avoid collisions across MCP servers\n const toolKey = typeof (tool as any).id === 'string' ? (tool as any).id : key;\n mastra.addTool(tool as ToolAction<any, any, any, any, ToolExecutionContext<any, any>>, toolKey);\n }\n } catch (error) {\n // Tool might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_TOOL_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register agents with the Mastra instance\n if (this.agents && typeof this.agents === 'object') {\n Object.entries(this.agents).forEach(([key, agent]) => {\n try {\n mastra.addAgent(agent, key);\n } catch (error) {\n // Agent might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_AGENT_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n\n // Auto-register workflows with the Mastra instance\n if (this.workflows && typeof this.workflows === 'object') {\n Object.entries(this.workflows).forEach(([key, workflow]) => {\n try {\n mastra.addWorkflow(workflow, key);\n } catch (error) {\n // Workflow might already be registered, that's okay\n if (!(error instanceof MastraError) || error.id !== 'MASTRA_ADD_WORKFLOW_DUPLICATE_KEY') {\n throw error;\n }\n }\n });\n }\n }\n\n /**\n * Constructor for the MCPServerBase.\n * @param config Configuration options for the MCP server, including metadata.\n */\n constructor(config: MCPServerConfig<TId>) {\n super({ component: RegisteredLogger.MCP_SERVER, name: config.name });\n this.name = config.name;\n this.version = config.version;\n\n // If user does not provide an ID, we will use the key from the Mastra config, but if user does not pass MCPServer\n // to Mastra, we will generate a random UUID as a backup.\n if (config.id) {\n this._id = slugify(config.id) as TId;\n this.idWasSet = true;\n } else {\n this._id = (this.mastra?.generateId() || randomUUID()) as TId;\n }\n\n this.description = config.description;\n this.repository = config.repository;\n this.releaseDate = config.releaseDate || new Date().toISOString();\n this.isLatest = config.isLatest === undefined ? true : config.isLatest;\n this.packageCanonical = config.packageCanonical;\n this.packages = config.packages;\n this.remotes = config.remotes;\n this.agents = config.agents;\n this.workflows = config.workflows;\n this.originalTools = config.tools;\n this.convertedTools = this.convertTools(config.tools, config.agents, config.workflows);\n }\n\n /**\n * Start the MCP server using stdio transport\n * This is typically used for Windsurf integration\n */\n public abstract startStdio(): Promise<void>;\n\n /**\n * Start the MCP server using SSE transport\n * This is typically used for web integration\n * @param options Options for the SSE transport\n */\n public abstract startSSE(options: MCPServerSSEOptions): Promise<void>;\n\n /**\n * Start the MCP server using Hono SSE transport\n * Used for Hono servers\n * @param options Options for the SSE transport\n */\n public abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;\n\n /**\n * Start the MCP server using HTTP transport\n * @param options Options for the HTTP transport\n */\n public abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;\n\n /**\n * Close the MCP server and all its connections\n */\n public abstract close(): Promise<void>;\n\n /**\n * Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.\n * This information is suitable for listing multiple servers.\n * @returns ServerInfo object containing basic server metadata.\n */\n public abstract getServerInfo(): ServerInfo;\n\n /**\n * Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.\n * This includes all information from `getServerInfo` plus package and remote details.\n * @returns ServerDetailInfo object containing comprehensive server metadata.\n */\n public abstract getServerDetail(): ServerDetailInfo;\n\n /**\n * Gets a list of tools provided by this MCP server, including their schemas.\n * @returns An object containing an array of tool information.\n */\n public abstract getToolListInfo(): {\n tools: Array<{ name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType }>;\n };\n\n /**\n * Gets information for a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to retrieve.\n * @returns Tool information (name, description, inputSchema) or undefined if not found.\n */\n public abstract getToolInfo(\n toolId: string,\n ): { name: string; description?: string; inputSchema: any; outputSchema?: any; toolType?: MCPToolType } | undefined;\n\n /**\n * Executes a specific tool provided by this MCP server.\n * @param toolId The ID/name of the tool to execute.\n * @param args The arguments to pass to the tool's execute function.\n * @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).\n * @returns A promise that resolves to the result of the tool execution.\n * @throws Error if the tool is not found, or if execution fails.\n */\n public abstract executeTool(\n toolId: string,\n args: any,\n executionContext?: { messages?: any[]; toolCallId?: string },\n ): Promise<any>;\n}\n"]}
@@ -167,7 +167,7 @@ export interface RemoteInfo {
167
167
  url: string;
168
168
  }
169
169
  /** Configuration options for creating an MCPServer instance. */
170
- export interface MCPServerConfig {
170
+ export interface MCPServerConfig<TId extends string = string> {
171
171
  /** The display name of the MCP server. */
172
172
  name: string;
173
173
  /** The semantic version of the MCP server. */
@@ -189,7 +189,7 @@ export interface MCPServerConfig {
189
189
  * If not provided, a UUID will be generated.
190
190
  * If provided, this ID is considered final and cannot be changed by Mastra.
191
191
  */
192
- id?: string;
192
+ id?: TId;
193
193
  /** Optional description of the MCP server. */
194
194
  description?: string;
195
195
  /** Optional repository information for the server's source code. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,UAAU,uBAAuB;IAC/B;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE;;OAEG;IACH,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC;IAE1B;;OAEG;IACH,GAAG,EAAE,IAAI,CAAC,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AM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjE,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAGD,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oCAAoC;IACpC,cAAc,EAAE,aAAa,CAAC;CAC/B;AAED,sGAAsG;AACtG,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACxD,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB"}
@@ -1,334 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunkGGYKYORQ_cjs = require('../chunk-GGYKYORQ.cjs');
4
- var chunkV3VLOOSW_cjs = require('../chunk-V3VLOOSW.cjs');
5
- var chunkECFXGXWO_cjs = require('../chunk-ECFXGXWO.cjs');
6
- var chunk2ZVKF4HP_cjs = require('../chunk-2ZVKF4HP.cjs');
7
- var chunkWM6CK2F3_cjs = require('../chunk-WM6CK2F3.cjs');
8
- var chunkKEXGB7FK_cjs = require('../chunk-KEXGB7FK.cjs');
3
+ var chunk52RSUALV_cjs = require('../chunk-52RSUALV.cjs');
9
4
 
10
- // src/memory/memory.ts
11
- var MemoryProcessor = class extends chunkKEXGB7FK_cjs.MastraBase {
12
- /**
13
- * Process a list of messages and return a filtered or transformed list.
14
- * @param messages The messages to process
15
- * @returns The processed messages
16
- */
17
- process(messages, _opts) {
18
- return messages;
19
- }
20
- };
21
- var memoryDefaultOptions = {
22
- lastMessages: 10,
23
- semanticRecall: false,
24
- generateTitle: false,
25
- workingMemory: {
26
- enabled: false,
27
- template: `
28
- # User Information
29
- - **First Name**:
30
- - **Last Name**:
31
- - **Location**:
32
- - **Occupation**:
33
- - **Interests**:
34
- - **Goals**:
35
- - **Events**:
36
- - **Facts**:
37
- - **Projects**:
38
- `
39
- }
40
- };
41
- var MastraMemory = class extends chunkKEXGB7FK_cjs.MastraBase {
42
- MAX_CONTEXT_TOKENS;
43
- _storage;
44
- vector;
45
- embedder;
46
- processors = [];
47
- threadConfig = { ...memoryDefaultOptions };
48
- #mastra;
49
- constructor(config) {
50
- super({ component: "MEMORY", name: config.name });
51
- if (config.options) this.threadConfig = this.getMergedThreadConfig(config.options);
52
- if (config.processors) this.processors = config.processors;
53
- if (config.storage) {
54
- this._storage = chunkV3VLOOSW_cjs.augmentWithInit(config.storage);
55
- this._hasOwnStorage = true;
56
- }
57
- if (this.threadConfig.semanticRecall) {
58
- if (!config.vector) {
59
- throw new Error(
60
- `Semantic recall requires a vector store to be configured.
61
5
 
62
- https://mastra.ai/en/docs/memory/semantic-recall`
63
- );
64
- }
65
- this.vector = config.vector;
66
- if (!config.embedder) {
67
- throw new Error(
68
- `Semantic recall requires an embedder to be configured.
69
6
 
70
- https://mastra.ai/en/docs/memory/semantic-recall`
71
- );
72
- }
73
- if (typeof config.embedder === "string") {
74
- this.embedder = new chunk2ZVKF4HP_cjs.ModelRouterEmbeddingModel(config.embedder);
75
- } else {
76
- this.embedder = config.embedder;
77
- }
78
- }
79
- }
80
- /**
81
- * Internal method used by Mastra to register itself with the memory.
82
- * @param mastra The Mastra instance.
83
- * @internal
84
- */
85
- __registerMastra(mastra) {
86
- this.#mastra = mastra;
87
- }
88
- _hasOwnStorage = false;
89
- get hasOwnStorage() {
90
- return this._hasOwnStorage;
91
- }
92
- get storage() {
93
- if (!this._storage) {
94
- throw new Error(
95
- `Memory requires a storage provider to function. Add a storage configuration to Memory or to your Mastra instance.
96
-
97
- https://mastra.ai/en/docs/memory/overview`
98
- );
99
- }
100
- return this._storage;
101
- }
102
- setStorage(storage) {
103
- this._storage = chunkV3VLOOSW_cjs.augmentWithInit(storage);
104
- }
105
- setVector(vector) {
106
- this.vector = vector;
107
- }
108
- setEmbedder(embedder) {
109
- this.embedder = embedder;
110
- }
111
- /**
112
- * Get a system message to inject into the conversation.
113
- * This will be called before each conversation turn.
114
- * Implementations can override this to inject custom system messages.
115
- */
116
- async getSystemMessage(_input) {
117
- return null;
118
- }
119
- /**
120
- * Get tools that should be available to the agent.
121
- * This will be called when converting tools for the agent.
122
- * Implementations can override this to provide additional tools.
123
- */
124
- listTools(_config) {
125
- return {};
126
- }
127
- async createEmbeddingIndex(dimensions, config) {
128
- const defaultDimensions = 1536;
129
- const isDefault = dimensions === defaultDimensions;
130
- const usedDimensions = dimensions ?? defaultDimensions;
131
- const separator = this.vector?.indexSeparator ?? "_";
132
- const indexName = isDefault ? `memory${separator}messages` : `memory${separator}messages${separator}${usedDimensions}`;
133
- if (typeof this.vector === `undefined`) {
134
- throw new Error(`Tried to create embedding index but no vector db is attached to this Memory instance.`);
135
- }
136
- const semanticConfig = typeof config?.semanticRecall === "object" ? config.semanticRecall : void 0;
137
- const indexConfig = semanticConfig?.indexConfig;
138
- const createParams = {
139
- indexName,
140
- dimension: usedDimensions,
141
- ...indexConfig?.metric && { metric: indexConfig.metric }
142
- };
143
- if (indexConfig && (indexConfig.type || indexConfig.ivf || indexConfig.hnsw)) {
144
- createParams.indexConfig = {};
145
- if (indexConfig.type) createParams.indexConfig.type = indexConfig.type;
146
- if (indexConfig.ivf) createParams.indexConfig.ivf = indexConfig.ivf;
147
- if (indexConfig.hnsw) createParams.indexConfig.hnsw = indexConfig.hnsw;
148
- }
149
- await this.vector.createIndex(createParams);
150
- return { indexName };
151
- }
152
- getMergedThreadConfig(config) {
153
- if (config?.workingMemory && "use" in config.workingMemory) {
154
- throw new Error("The workingMemory.use option has been removed. Working memory always uses tool-call mode.");
155
- }
156
- if (config?.threads?.generateTitle !== void 0) {
157
- throw new Error(
158
- "The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
159
- );
160
- }
161
- const mergedConfig = chunkWM6CK2F3_cjs.deepMerge(this.threadConfig, config || {});
162
- if (config?.workingMemory?.schema) {
163
- if (mergedConfig.workingMemory) {
164
- mergedConfig.workingMemory.schema = config.workingMemory.schema;
165
- }
166
- }
167
- return mergedConfig;
168
- }
169
- /**
170
- * Apply all configured message processors to a list of messages.
171
- * @param messages The messages to process
172
- * @returns The processed messages
173
- */
174
- async applyProcessors(messages, opts) {
175
- const processors = opts.processors || this.processors;
176
- if (!processors || processors.length === 0) {
177
- return messages;
178
- }
179
- let processedMessages = [...messages];
180
- for (const processor of processors) {
181
- processedMessages = await processor.process(processedMessages, {
182
- systemMessage: opts.systemMessage,
183
- newMessages: opts.newMessages,
184
- memorySystemMessage: opts.memorySystemMessage
185
- });
186
- }
187
- return processedMessages;
188
- }
189
- processMessages({
190
- messages,
191
- processors,
192
- ...opts
193
- }) {
194
- return this.applyProcessors(messages, { processors: processors || this.processors, ...opts });
195
- }
196
- estimateTokens(text) {
197
- return Math.ceil(text.split(" ").length * 1.3);
198
- }
199
- /**
200
- * Helper method to create a new thread
201
- * @param title - Optional title for the thread
202
- * @param metadata - Optional metadata for the thread
203
- * @returns Promise resolving to the created thread
204
- */
205
- async createThread({
206
- threadId,
207
- resourceId,
208
- title,
209
- metadata,
210
- memoryConfig,
211
- saveThread = true
212
- }) {
213
- const thread = {
214
- id: threadId || this.generateId(),
215
- title: title || `New Thread ${(/* @__PURE__ */ new Date()).toISOString()}`,
216
- resourceId,
217
- createdAt: /* @__PURE__ */ new Date(),
218
- updatedAt: /* @__PURE__ */ new Date(),
219
- metadata
220
- };
221
- return saveThread ? this.saveThread({ thread, memoryConfig }) : thread;
222
- }
223
- /**
224
- * Helper method to add a single message to a thread
225
- * @param threadId - The thread to add the message to
226
- * @param content - The message content
227
- * @param role - The role of the message sender
228
- * @param type - The type of the message
229
- * @param toolNames - Optional array of tool names that were called
230
- * @param toolCallArgs - Optional array of tool call arguments
231
- * @param toolCallIds - Optional array of tool call ids
232
- * @returns Promise resolving to the saved message
233
- * @deprecated use saveMessages instead
234
- */
235
- async addMessage(_params) {
236
- throw new Error("addMessage is deprecated. Please use saveMessages instead.");
237
- }
238
- /**
239
- * Generates a unique identifier
240
- * @returns A unique string ID
241
- */
242
- generateId() {
243
- return this.#mastra?.generateId() || crypto.randomUUID();
244
- }
245
- };
246
-
247
- // src/memory/mock.ts
248
- var MockMemory = class extends MastraMemory {
249
- threads = {};
250
- constructor({ storage } = {}) {
251
- super({ name: "mock", storage: storage || new chunkGGYKYORQ_cjs.InMemoryStore() });
252
- this._hasOwnStorage = true;
253
- }
254
- async getThreadById({ threadId }) {
255
- return this.storage.getThreadById({ threadId });
256
- }
257
- async saveThread({ thread }) {
258
- return this.storage.saveThread({ thread });
259
- }
260
- async saveMessages({
261
- messages
262
- }) {
263
- const dbMessages = new chunkECFXGXWO_cjs.MessageList({
264
- generateMessageId: () => this.generateId()
265
- }).add(messages, "memory").get.all.db();
266
- return this.storage.saveMessages({ messages: dbMessages });
267
- }
268
- async listThreadsByResourceId(args) {
269
- return this.storage.listThreadsByResourceId(args);
270
- }
271
- async recall(args) {
272
- const result = await this.storage.listMessages({
273
- threadId: args.threadId,
274
- resourceId: args.resourceId,
275
- perPage: args.perPage,
276
- page: args.page,
277
- orderBy: args.orderBy,
278
- filter: args.filter,
279
- include: args.include
280
- });
281
- return result;
282
- }
283
- async deleteThread(threadId) {
284
- return this.storage.deleteThread({ threadId });
285
- }
286
- async deleteMessages(messageIds) {
287
- const ids = Array.isArray(messageIds) ? messageIds?.map((item) => typeof item === "string" ? item : item.id) : [messageIds];
288
- return this.storage.deleteMessages(ids);
289
- }
290
- // Add missing method implementations
291
- async getWorkingMemory({
292
- threadId: _threadId,
293
- resourceId: _resourceId,
294
- memoryConfig: _memoryConfig
295
- }) {
296
- return null;
297
- }
298
- async getWorkingMemoryTemplate({
299
- memoryConfig: _memoryConfig
300
- } = {}) {
301
- return null;
302
- }
303
- getMergedThreadConfig(config) {
304
- return config || {};
305
- }
306
- async updateWorkingMemory({
307
- threadId: _threadId,
308
- resourceId: _resourceId,
309
- workingMemory: _workingMemory,
310
- memoryConfig: _memoryConfig
311
- }) {
312
- return;
313
- }
314
- async __experimental_updateWorkingMemoryVNext({
315
- threadId: _threadId,
316
- resourceId: _resourceId,
317
- workingMemory: _workingMemory,
318
- searchString: _searchString,
319
- memoryConfig: _memoryConfig
320
- }) {
321
- return { success: true, reason: "Mock implementation" };
322
- }
323
- async updateMessages({ messages }) {
324
- const result = await this.saveMessages({ messages });
325
- return result.messages;
326
- }
327
- };
328
-
329
- exports.MastraMemory = MastraMemory;
330
- exports.MemoryProcessor = MemoryProcessor;
331
- exports.MockMemory = MockMemory;
332
- exports.memoryDefaultOptions = memoryDefaultOptions;
7
+ Object.defineProperty(exports, "MastraMemory", {
8
+ enumerable: true,
9
+ get: function () { return chunk52RSUALV_cjs.MastraMemory; }
10
+ });
11
+ Object.defineProperty(exports, "MemoryProcessor", {
12
+ enumerable: true,
13
+ get: function () { return chunk52RSUALV_cjs.MemoryProcessor; }
14
+ });
15
+ Object.defineProperty(exports, "MockMemory", {
16
+ enumerable: true,
17
+ get: function () { return chunk52RSUALV_cjs.MockMemory; }
18
+ });
19
+ Object.defineProperty(exports, "memoryDefaultOptions", {
20
+ enumerable: true,
21
+ get: function () { return chunk52RSUALV_cjs.memoryDefaultOptions; }
22
+ });
23
+ Object.defineProperty(exports, "parseMemoryRequestContext", {
24
+ enumerable: true,
25
+ get: function () { return chunk52RSUALV_cjs.parseMemoryRequestContext; }
26
+ });
333
27
  //# sourceMappingURL=index.cjs.map
334
28
  //# sourceMappingURL=index.cjs.map