@mastra/core 0.24.0 → 1.0.0-beta.1

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 (812) hide show
  1. package/CHANGELOG.md +484 -139
  2. package/README.md +2 -3
  3. package/agent/message-list.d.ts +1 -0
  4. package/dist/action/index.d.ts +0 -2
  5. package/dist/action/index.d.ts.map +1 -1
  6. package/dist/agent/__tests__/mock-model.d.ts +3 -1
  7. package/dist/agent/__tests__/mock-model.d.ts.map +1 -1
  8. package/dist/agent/agent-legacy.d.ts +176 -0
  9. package/dist/agent/agent-legacy.d.ts.map +1 -0
  10. package/dist/agent/agent.d.ts +83 -229
  11. package/dist/agent/agent.d.ts.map +1 -1
  12. package/dist/agent/agent.types.d.ts +10 -25
  13. package/dist/agent/agent.types.d.ts.map +1 -1
  14. package/dist/agent/index.cjs +10 -26
  15. package/dist/agent/index.d.ts +1 -2
  16. package/dist/agent/index.d.ts.map +1 -1
  17. package/dist/agent/index.js +2 -2
  18. package/dist/agent/message-list/index.cjs +16 -0
  19. package/dist/agent/message-list/index.d.ts +77 -87
  20. package/dist/agent/message-list/index.d.ts.map +1 -1
  21. package/dist/agent/message-list/index.js +3 -0
  22. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts +2 -2
  23. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts.map +1 -1
  24. package/dist/agent/message-list/prompt/convert-to-mastra-v1.d.ts +2 -2
  25. package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
  26. package/dist/agent/message-list/prompt/invalid-content-error.d.ts +1 -1
  27. package/dist/agent/message-list/prompt/invalid-content-error.d.ts.map +1 -1
  28. package/dist/agent/message-list/types.d.ts +2 -1
  29. package/dist/agent/message-list/types.d.ts.map +1 -1
  30. package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts +3 -2
  31. package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts.map +1 -1
  32. package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts +3 -2
  33. package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts.map +1 -1
  34. package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts +1 -1
  35. package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts.map +1 -1
  36. package/dist/agent/message-list/utils/convert-messages.d.ts +4 -4
  37. package/dist/agent/message-list/utils/convert-messages.d.ts.map +1 -1
  38. package/dist/agent/test-utils.d.ts +2 -79
  39. package/dist/agent/test-utils.d.ts.map +1 -1
  40. package/dist/agent/trip-wire.d.ts +1 -1
  41. package/dist/agent/trip-wire.d.ts.map +1 -1
  42. package/dist/agent/types.d.ts +23 -37
  43. package/dist/agent/types.d.ts.map +1 -1
  44. package/dist/agent/utils.d.ts +15 -64
  45. package/dist/agent/utils.d.ts.map +1 -1
  46. package/dist/agent/workflows/prepare-stream/index.d.ts +16 -20
  47. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  48. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +5 -7
  49. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  50. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +14 -18
  51. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  52. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +6 -6
  53. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  54. package/dist/agent/workflows/prepare-stream/schema.d.ts +10 -12
  55. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  56. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -7
  57. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  58. package/dist/ai-sdk.types.d.ts +4705 -0
  59. package/dist/base.cjs +2 -2
  60. package/dist/base.d.ts +0 -16
  61. package/dist/base.d.ts.map +1 -1
  62. package/dist/base.js +1 -1
  63. package/dist/bundler/index.cjs +2 -2
  64. package/dist/bundler/index.d.ts +2 -1
  65. package/dist/bundler/index.d.ts.map +1 -1
  66. package/dist/bundler/index.js +1 -1
  67. package/dist/cache/index.cjs +3 -3
  68. package/dist/cache/index.js +1 -1
  69. package/dist/{chunk-7J3XX4AO.cjs → chunk-2ZVKF4HP.cjs} +199 -66
  70. package/dist/chunk-2ZVKF4HP.cjs.map +1 -0
  71. package/dist/chunk-4CDL2QJT.js +649 -0
  72. package/dist/chunk-4CDL2QJT.js.map +1 -0
  73. package/dist/chunk-5WRI5ZAA.js +29 -0
  74. package/dist/{chunk-3HXBPDKN.js.map → chunk-5WRI5ZAA.js.map} +1 -1
  75. package/dist/{chunk-KAEQISOW.js → chunk-76K3IYWM.js} +5 -5
  76. package/dist/chunk-76K3IYWM.js.map +1 -0
  77. package/dist/chunk-7AHYOMHJ.js +149 -0
  78. package/dist/chunk-7AHYOMHJ.js.map +1 -0
  79. package/dist/{chunk-UZKIGB7M.cjs → chunk-BMAFVZ2D.cjs} +5 -5
  80. package/dist/chunk-BMAFVZ2D.cjs.map +1 -0
  81. package/dist/chunk-CB575O6L.cjs +12432 -0
  82. package/dist/chunk-CB575O6L.cjs.map +1 -0
  83. package/dist/{chunk-6TEQIYXV.cjs → chunk-CBAB7GOD.cjs} +15 -15
  84. package/dist/chunk-CBAB7GOD.cjs.map +1 -0
  85. package/dist/{chunk-ROS5CMJS.cjs → chunk-CD56CXVE.cjs} +63 -50
  86. package/dist/chunk-CD56CXVE.cjs.map +1 -0
  87. package/dist/{chunk-Z4RIRDU3.js → chunk-CINNK34N.js} +45 -32
  88. package/dist/chunk-CINNK34N.js.map +1 -0
  89. package/dist/{chunk-77JHIM4E.cjs → chunk-DNEURYF3.cjs} +348 -424
  90. package/dist/chunk-DNEURYF3.cjs.map +1 -0
  91. package/dist/{chunk-A5KDVZDL.cjs → chunk-DSNPWVIG.cjs} +9 -9
  92. package/dist/chunk-DSNPWVIG.cjs.map +1 -0
  93. package/dist/chunk-DZUJEN5N.cjs +32 -0
  94. package/dist/{chunk-EBVYYC2Q.cjs.map → chunk-DZUJEN5N.cjs.map} +1 -1
  95. package/dist/chunk-E7K4FTLN.cjs +273 -0
  96. package/dist/chunk-E7K4FTLN.cjs.map +1 -0
  97. package/dist/{chunk-MJMID7LX.cjs → chunk-ECFXGXWO.cjs} +609 -644
  98. package/dist/chunk-ECFXGXWO.cjs.map +1 -0
  99. package/dist/chunk-ET6UOTTU.cjs +154 -0
  100. package/dist/chunk-ET6UOTTU.cjs.map +1 -0
  101. package/dist/chunk-GGYKYORQ.cjs +2060 -0
  102. package/dist/chunk-GGYKYORQ.cjs.map +1 -0
  103. package/dist/{chunk-HLRWYUFN.js → chunk-GRBGQ2GE.js} +5 -5
  104. package/dist/{chunk-HLRWYUFN.js.map → chunk-GRBGQ2GE.js.map} +1 -1
  105. package/dist/{chunk-3VXXCPKX.js → chunk-H6CZGPZD.js} +334 -410
  106. package/dist/chunk-H6CZGPZD.js.map +1 -0
  107. package/dist/chunk-HDJFSJCK.js +2237 -0
  108. package/dist/chunk-HDJFSJCK.js.map +1 -0
  109. package/dist/{chunk-34ZCWSUA.js → chunk-I4CXL4SR.js} +6 -9
  110. package/dist/chunk-I4CXL4SR.js.map +1 -0
  111. package/dist/{chunk-3JX2Y3WH.cjs → chunk-IQO7ANVS.cjs} +18 -21
  112. package/dist/chunk-IQO7ANVS.cjs.map +1 -0
  113. package/dist/{chunk-GPWMM745.cjs → chunk-J7O6WENZ.cjs} +5 -5
  114. package/dist/{chunk-GPWMM745.cjs.map → chunk-J7O6WENZ.cjs.map} +1 -1
  115. package/dist/{chunk-PZUZNPFM.js → chunk-JJ5O45LH.js} +3 -4
  116. package/dist/chunk-JJ5O45LH.js.map +1 -0
  117. package/dist/chunk-JPGVRWWL.js +12385 -0
  118. package/dist/chunk-JPGVRWWL.js.map +1 -0
  119. package/dist/chunk-JUBFO5J3.js +15761 -0
  120. package/dist/chunk-JUBFO5J3.js.map +1 -0
  121. package/dist/{chunk-E3PG7G6E.js → chunk-JV2KH24V.js} +599 -633
  122. package/dist/chunk-JV2KH24V.js.map +1 -0
  123. package/dist/chunk-KEXGB7FK.cjs +29 -0
  124. package/dist/chunk-KEXGB7FK.cjs.map +1 -0
  125. package/dist/chunk-KIZIOFZC.js +265 -0
  126. package/dist/chunk-KIZIOFZC.js.map +1 -0
  127. package/dist/{chunk-UXG7PYML.js → chunk-KJ2SW6VA.js} +9 -9
  128. package/dist/chunk-KJ2SW6VA.js.map +1 -0
  129. package/dist/{chunk-TTELJD4F.js → chunk-L54GIUCB.js} +2 -2
  130. package/dist/chunk-L54GIUCB.js.map +1 -0
  131. package/dist/chunk-LWBQ4P4N.cjs +2240 -0
  132. package/dist/chunk-LWBQ4P4N.cjs.map +1 -0
  133. package/dist/{chunk-ABZOBBLL.cjs → chunk-MA7TEM62.cjs} +735 -562
  134. package/dist/chunk-MA7TEM62.cjs.map +1 -0
  135. package/dist/{chunk-TSNDVBUU.cjs → chunk-MR7ZWBL6.cjs} +2 -2
  136. package/dist/chunk-MR7ZWBL6.cjs.map +1 -0
  137. package/dist/chunk-MSWTA73A.cjs +15825 -0
  138. package/dist/chunk-MSWTA73A.cjs.map +1 -0
  139. package/dist/chunk-MV7KHWUT.js +2031 -0
  140. package/dist/chunk-MV7KHWUT.js.map +1 -0
  141. package/dist/{chunk-3NTOFNIU.js → chunk-OJNJA5ZI.js} +3 -3
  142. package/dist/{chunk-3NTOFNIU.js.map → chunk-OJNJA5ZI.js.map} +1 -1
  143. package/dist/chunk-QM5SRDJX.js +9022 -0
  144. package/dist/chunk-QM5SRDJX.js.map +1 -0
  145. package/dist/{chunk-WBAXXG34.cjs → chunk-QUKUN6NR.cjs} +32 -66
  146. package/dist/chunk-QUKUN6NR.cjs.map +1 -0
  147. package/dist/chunk-S6URFGCZ.js +27 -0
  148. package/dist/chunk-S6URFGCZ.js.map +1 -0
  149. package/dist/chunk-SVLMF4UZ.cjs +9033 -0
  150. package/dist/chunk-SVLMF4UZ.cjs.map +1 -0
  151. package/dist/{chunk-ZMELUU72.js → chunk-TQTAMPSC.js} +3 -3
  152. package/dist/chunk-TQTAMPSC.js.map +1 -0
  153. package/dist/{chunk-5NTO7S5I.cjs → chunk-TWH4PTDG.cjs} +2 -4
  154. package/dist/chunk-TWH4PTDG.cjs.map +1 -0
  155. package/dist/{chunk-WCHE6FJ7.js → chunk-UIZSWUKP.js} +15 -50
  156. package/dist/chunk-UIZSWUKP.js.map +1 -0
  157. package/dist/{chunk-BWGXM3D4.js → chunk-VOQ3ULMT.js} +712 -541
  158. package/dist/chunk-VOQ3ULMT.js.map +1 -0
  159. package/dist/{chunk-MCASUJWY.cjs → chunk-VOY2RXOC.cjs} +36 -59
  160. package/dist/chunk-VOY2RXOC.cjs.map +1 -0
  161. package/dist/{chunk-FHVFGVIO.js → chunk-W7UH2PWL.js} +189 -56
  162. package/dist/chunk-W7UH2PWL.js.map +1 -0
  163. package/dist/chunk-WM6CK2F3.cjs +674 -0
  164. package/dist/chunk-WM6CK2F3.cjs.map +1 -0
  165. package/dist/{chunk-PFXXH2RP.js → chunk-X7JMA3IY.js} +15 -15
  166. package/dist/chunk-X7JMA3IY.js.map +1 -0
  167. package/dist/{chunk-NR77P3TK.js → chunk-XEVG546F.js} +14 -37
  168. package/dist/chunk-XEVG546F.js.map +1 -0
  169. package/dist/{chunk-QFF5JUKT.cjs → chunk-Y63IFHEZ.cjs} +4 -4
  170. package/dist/chunk-Y63IFHEZ.cjs.map +1 -0
  171. package/dist/{chunk-B7V6NYWH.cjs → chunk-Y6ROD72V.cjs} +4 -4
  172. package/dist/{chunk-B7V6NYWH.cjs.map → chunk-Y6ROD72V.cjs.map} +1 -1
  173. package/dist/deployer/index.cjs +8 -6
  174. package/dist/deployer/index.cjs.map +1 -1
  175. package/dist/deployer/index.js +10 -1
  176. package/dist/deployer/index.js.map +1 -1
  177. package/dist/di/index.cjs +3 -3
  178. package/dist/di/index.d.ts +1 -1
  179. package/dist/di/index.js +1 -1
  180. package/dist/error/index.cjs +6 -6
  181. package/dist/error/index.d.ts +0 -1
  182. package/dist/error/index.d.ts.map +1 -1
  183. package/dist/error/index.js +1 -1
  184. package/dist/{scores → evals}/base.d.ts +20 -18
  185. package/dist/evals/base.d.ts.map +1 -0
  186. package/dist/{scores → evals}/base.test-utils.d.ts +25 -25
  187. package/dist/evals/base.test-utils.d.ts.map +1 -0
  188. package/dist/{scores → evals}/hooks.d.ts +3 -3
  189. package/dist/evals/hooks.d.ts.map +1 -0
  190. package/dist/evals/index.cjs +37 -0
  191. package/dist/evals/index.d.ts +4 -0
  192. package/dist/evals/index.d.ts.map +1 -0
  193. package/dist/evals/index.js +4 -0
  194. package/dist/{scores/run-experiment → evals/run}/index.d.ts +18 -18
  195. package/dist/evals/run/index.d.ts.map +1 -0
  196. package/dist/evals/run/scorerAccumulator.d.ts.map +1 -0
  197. package/dist/{scores → evals}/scoreTraces/index.cjs +79 -99
  198. package/dist/evals/scoreTraces/index.cjs.map +1 -0
  199. package/dist/evals/scoreTraces/index.d.ts.map +1 -0
  200. package/dist/{scores → evals}/scoreTraces/index.js +72 -92
  201. package/dist/evals/scoreTraces/index.js.map +1 -0
  202. package/dist/{scores → evals}/scoreTraces/scoreTraces.d.ts +2 -2
  203. package/dist/evals/scoreTraces/scoreTraces.d.ts.map +1 -0
  204. package/dist/{scores → evals}/scoreTraces/scoreTracesWorkflow.d.ts +11 -11
  205. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -0
  206. package/dist/{scores → evals}/scoreTraces/utils.d.ts +7 -7
  207. package/dist/evals/scoreTraces/utils.d.ts.map +1 -0
  208. package/dist/{scores → evals}/types.d.ts +22 -22
  209. package/dist/evals/types.d.ts.map +1 -0
  210. package/dist/features/index.cjs +8 -0
  211. package/dist/features/index.cjs.map +1 -0
  212. package/dist/features/index.d.ts +17 -0
  213. package/dist/features/index.d.ts.map +1 -0
  214. package/dist/features/index.js +6 -0
  215. package/dist/features/index.js.map +1 -0
  216. package/dist/hooks/index.cjs +4 -4
  217. package/dist/hooks/index.d.ts +1 -27
  218. package/dist/hooks/index.d.ts.map +1 -1
  219. package/dist/hooks/index.js +1 -1
  220. package/dist/index.cjs +2 -340
  221. package/dist/index.cjs.map +1 -1
  222. package/dist/index.d.ts +1 -18
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +1 -113
  225. package/dist/index.js.map +1 -1
  226. package/dist/integration/index.cjs +87 -10
  227. package/dist/integration/index.cjs.map +1 -1
  228. package/dist/integration/index.js +88 -1
  229. package/dist/integration/index.js.map +1 -1
  230. package/dist/integration/integration.d.ts +3 -3
  231. package/dist/integration/integration.d.ts.map +1 -1
  232. package/dist/llm/index.cjs +7 -7
  233. package/dist/llm/index.d.ts +5 -6
  234. package/dist/llm/index.d.ts.map +1 -1
  235. package/dist/llm/index.js +1 -1
  236. package/dist/llm/model/base.types.d.ts +6 -7
  237. package/dist/llm/model/base.types.d.ts.map +1 -1
  238. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  239. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  240. package/dist/llm/model/model.d.ts +7 -7
  241. package/dist/llm/model/model.d.ts.map +1 -1
  242. package/dist/llm/model/model.loop.d.ts +1 -1
  243. package/dist/llm/model/model.loop.d.ts.map +1 -1
  244. package/dist/llm/model/model.loop.types.d.ts +3 -3
  245. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  246. package/dist/llm/model/provider-types.generated.d.ts +80 -17
  247. package/dist/llm/model/resolve-model.d.ts +8 -8
  248. package/dist/llm/model/shared.types.d.ts +2 -2
  249. package/dist/llm/model/shared.types.d.ts.map +1 -1
  250. package/dist/logger/constants.d.ts +1 -1
  251. package/dist/logger/default-logger.d.ts +2 -2
  252. package/dist/logger/default-logger.d.ts.map +1 -1
  253. package/dist/logger/index.cjs +11 -11
  254. package/dist/logger/index.js +2 -2
  255. package/dist/logger/logger.d.ts +4 -4
  256. package/dist/logger/logger.d.ts.map +1 -1
  257. package/dist/logger/multi-logger.d.ts +2 -2
  258. package/dist/logger/multi-logger.d.ts.map +1 -1
  259. package/dist/logger/transport.d.ts +3 -3
  260. package/dist/logger/transport.d.ts.map +1 -1
  261. package/dist/loop/index.cjs +2 -2
  262. package/dist/loop/index.js +1 -1
  263. package/dist/loop/loop.d.ts +1 -1
  264. package/dist/loop/loop.d.ts.map +1 -1
  265. package/dist/loop/network/index.d.ts +15 -15
  266. package/dist/loop/network/index.d.ts.map +1 -1
  267. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  268. package/dist/loop/test-utils/options.d.ts.map +1 -1
  269. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  270. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  271. package/dist/loop/types.d.ts +4 -7
  272. package/dist/loop/types.d.ts.map +1 -1
  273. package/dist/loop/workflows/agentic-execution/index.d.ts +55 -55
  274. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  275. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +38 -38
  276. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  277. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +20 -20
  278. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  279. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +2 -2
  280. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  281. package/dist/loop/workflows/agentic-loop/index.d.ts +55 -55
  282. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  283. package/dist/loop/workflows/schema.d.ts +19 -20
  284. package/dist/loop/workflows/schema.d.ts.map +1 -1
  285. package/dist/loop/workflows/stream.d.ts +1 -1
  286. package/dist/loop/workflows/stream.d.ts.map +1 -1
  287. package/dist/mastra/hooks.d.ts +2 -2
  288. package/dist/mastra/hooks.d.ts.map +1 -1
  289. package/dist/mastra/index.cjs +2 -2
  290. package/dist/mastra/index.d.ts +389 -180
  291. package/dist/mastra/index.d.ts.map +1 -1
  292. package/dist/mastra/index.js +1 -1
  293. package/dist/mcp/index.cjs +41 -4
  294. package/dist/mcp/index.cjs.map +1 -1
  295. package/dist/mcp/index.d.ts +6 -4
  296. package/dist/mcp/index.d.ts.map +1 -1
  297. package/dist/mcp/index.js +39 -2
  298. package/dist/mcp/index.js.map +1 -1
  299. package/dist/mcp/types.d.ts +0 -15
  300. package/dist/mcp/types.d.ts.map +1 -1
  301. package/dist/memory/index.cjs +327 -13
  302. package/dist/memory/index.cjs.map +1 -1
  303. package/dist/memory/index.d.ts +1 -0
  304. package/dist/memory/index.d.ts.map +1 -1
  305. package/dist/memory/index.js +327 -1
  306. package/dist/memory/index.js.map +1 -1
  307. package/dist/memory/memory.d.ts +33 -57
  308. package/dist/memory/memory.d.ts.map +1 -1
  309. package/dist/memory/mock.d.ts +61 -0
  310. package/dist/memory/mock.d.ts.map +1 -0
  311. package/dist/memory/types.d.ts +48 -45
  312. package/dist/memory/types.d.ts.map +1 -1
  313. package/dist/models-dev-DNBKXHT4.js +3 -0
  314. package/dist/{models-dev-4VGIWYS3.js.map → models-dev-DNBKXHT4.js.map} +1 -1
  315. package/dist/models-dev-YBEEQIX6.cjs +12 -0
  316. package/dist/{models-dev-AXZASLL2.cjs.map → models-dev-YBEEQIX6.cjs.map} +1 -1
  317. package/dist/netlify-7G2L5VSH.js +3 -0
  318. package/dist/{netlify-VJXBII33.js.map → netlify-7G2L5VSH.js.map} +1 -1
  319. package/dist/netlify-GWNGSIRZ.cjs +12 -0
  320. package/dist/{netlify-TX6V7SJJ.cjs.map → netlify-GWNGSIRZ.cjs.map} +1 -1
  321. package/dist/{ai-tracing → observability}/context.d.ts +5 -5
  322. package/dist/observability/context.d.ts.map +1 -0
  323. package/dist/observability/index.cjs +36 -0
  324. package/dist/observability/index.d.ts +11 -0
  325. package/dist/observability/index.d.ts.map +1 -0
  326. package/dist/observability/index.js +3 -0
  327. package/dist/observability/no-op.d.ts +22 -0
  328. package/dist/observability/no-op.d.ts.map +1 -0
  329. package/dist/observability/types/index.d.ts +2 -0
  330. package/dist/observability/types/index.d.ts.map +1 -0
  331. package/dist/{ai-tracing/types.d.ts → observability/types/tracing.d.ts} +161 -107
  332. package/dist/observability/types/tracing.d.ts.map +1 -0
  333. package/dist/observability/utils.d.ts +12 -0
  334. package/dist/observability/utils.d.ts.map +1 -0
  335. package/dist/processors/index.cjs +11 -11
  336. package/dist/processors/index.d.ts +10 -9
  337. package/dist/processors/index.d.ts.map +1 -1
  338. package/dist/processors/index.js +1 -1
  339. package/dist/processors/processors/batch-parts.d.ts +2 -1
  340. package/dist/processors/processors/batch-parts.d.ts.map +1 -1
  341. package/dist/processors/processors/language-detector.d.ts +6 -5
  342. package/dist/processors/processors/language-detector.d.ts.map +1 -1
  343. package/dist/processors/processors/moderation.d.ts +8 -7
  344. package/dist/processors/processors/moderation.d.ts.map +1 -1
  345. package/dist/processors/processors/pii-detector.d.ts +8 -7
  346. package/dist/processors/processors/pii-detector.d.ts.map +1 -1
  347. package/dist/processors/processors/prompt-injection-detector.d.ts +6 -5
  348. package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
  349. package/dist/processors/processors/structured-output.d.ts +3 -2
  350. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  351. package/dist/processors/processors/system-prompt-scrubber.d.ts +6 -5
  352. package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
  353. package/dist/processors/processors/token-limiter.d.ts +5 -4
  354. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  355. package/dist/processors/processors/unicode-normalizer.d.ts +5 -4
  356. package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
  357. package/dist/processors/runner.d.ts +5 -5
  358. package/dist/processors/runner.d.ts.map +1 -1
  359. package/dist/provider-registry.json +175 -42
  360. package/dist/{registry-generator-DXRSYYYT.js → registry-generator-H4YNODDH.js} +2 -2
  361. package/dist/{registry-generator-DXRSYYYT.js.map → registry-generator-H4YNODDH.js.map} +1 -1
  362. package/dist/{registry-generator-6WVOHM2L.cjs → registry-generator-MK63POJO.cjs} +2 -2
  363. package/dist/{registry-generator-6WVOHM2L.cjs.map → registry-generator-MK63POJO.cjs.map} +1 -1
  364. package/dist/relevance/index.cjs +47 -13
  365. package/dist/relevance/index.cjs.map +1 -1
  366. package/dist/relevance/index.d.ts +0 -1
  367. package/dist/relevance/index.d.ts.map +1 -1
  368. package/dist/relevance/index.js +49 -1
  369. package/dist/relevance/index.js.map +1 -1
  370. package/dist/relevance/mastra-agent/index.d.ts.map +1 -1
  371. package/dist/request-context/index.cjs +12 -0
  372. package/dist/{runtime-context → request-context}/index.d.ts +1 -1
  373. package/dist/{runtime-context → request-context}/index.d.ts.map +1 -1
  374. package/dist/request-context/index.js +3 -0
  375. package/dist/server/auth.d.ts.map +1 -1
  376. package/dist/server/index.cjs +9 -25
  377. package/dist/server/index.cjs.map +1 -1
  378. package/dist/server/index.js +4 -21
  379. package/dist/server/index.js.map +1 -1
  380. package/dist/server/types.d.ts +3 -3
  381. package/dist/server/types.d.ts.map +1 -1
  382. package/dist/storage/base.d.ts +75 -143
  383. package/dist/storage/base.d.ts.map +1 -1
  384. package/dist/storage/constants.d.ts +3 -4
  385. package/dist/storage/constants.d.ts.map +1 -1
  386. package/dist/storage/domains/index.d.ts +0 -2
  387. package/dist/storage/domains/index.d.ts.map +1 -1
  388. package/dist/storage/domains/memory/base.d.ts +19 -56
  389. package/dist/storage/domains/memory/base.d.ts.map +1 -1
  390. package/dist/storage/domains/memory/inmemory.d.ts +15 -35
  391. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  392. package/dist/storage/domains/observability/base.d.ts +24 -24
  393. package/dist/storage/domains/observability/base.d.ts.map +1 -1
  394. package/dist/storage/domains/observability/inmemory.d.ts +18 -18
  395. package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
  396. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  397. package/dist/storage/domains/scores/base.d.ts +5 -5
  398. package/dist/storage/domains/scores/base.d.ts.map +1 -1
  399. package/dist/storage/domains/scores/inmemory.d.ts +5 -5
  400. package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
  401. package/dist/storage/domains/workflows/base.d.ts +4 -11
  402. package/dist/storage/domains/workflows/base.d.ts.map +1 -1
  403. package/dist/storage/domains/workflows/inmemory.d.ts +4 -11
  404. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  405. package/dist/storage/index.cjs +74 -1775
  406. package/dist/storage/index.cjs.map +1 -1
  407. package/dist/storage/index.js +1 -1744
  408. package/dist/storage/index.js.map +1 -1
  409. package/dist/storage/mock.d.ts +35 -92
  410. package/dist/storage/mock.d.ts.map +1 -1
  411. package/dist/storage/types.d.ts +77 -75
  412. package/dist/storage/types.d.ts.map +1 -1
  413. package/dist/stream/MastraAgentNetworkStream.d.ts +4 -2
  414. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  415. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  416. package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
  417. package/dist/stream/RunOutput.d.ts +1 -0
  418. package/dist/stream/RunOutput.d.ts.map +1 -1
  419. package/dist/stream/aisdk/v4/input.d.ts +1 -1
  420. package/dist/stream/aisdk/v4/input.d.ts.map +1 -1
  421. package/dist/stream/aisdk/v5/execute.d.ts +4 -11
  422. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  423. package/dist/stream/aisdk/v5/output.d.ts +1 -1
  424. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  425. package/dist/stream/base/output.d.ts +1 -1
  426. package/dist/stream/base/output.d.ts.map +1 -1
  427. package/dist/stream/index.cjs +11 -11
  428. package/dist/stream/index.d.ts +1 -1
  429. package/dist/stream/index.d.ts.map +1 -1
  430. package/dist/stream/index.js +2 -2
  431. package/dist/stream/types.d.ts +2 -6
  432. package/dist/stream/types.d.ts.map +1 -1
  433. package/dist/test-utils/llm-mock.cjs +8 -8
  434. package/dist/test-utils/llm-mock.cjs.map +1 -1
  435. package/dist/test-utils/llm-mock.d.ts +1 -1
  436. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  437. package/dist/test-utils/llm-mock.js +3 -3
  438. package/dist/test-utils/llm-mock.js.map +1 -1
  439. package/dist/tools/index.cjs +4 -4
  440. package/dist/tools/index.js +1 -1
  441. package/dist/tools/is-vercel-tool.cjs +2 -2
  442. package/dist/tools/is-vercel-tool.js +1 -1
  443. package/dist/tools/tool-builder/builder.d.ts +3 -71
  444. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  445. package/dist/tools/tool.d.ts +25 -25
  446. package/dist/tools/tool.d.ts.map +1 -1
  447. package/dist/tools/types.d.ts +102 -11
  448. package/dist/tools/types.d.ts.map +1 -1
  449. package/dist/tools/validation.d.ts +4 -3
  450. package/dist/tools/validation.d.ts.map +1 -1
  451. package/dist/tts/index.cjs +12 -6
  452. package/dist/tts/index.cjs.map +1 -1
  453. package/dist/tts/index.d.ts +0 -1
  454. package/dist/tts/index.d.ts.map +1 -1
  455. package/dist/tts/index.js +14 -1
  456. package/dist/tts/index.js.map +1 -1
  457. package/dist/types/dynamic-argument.d.ts +3 -3
  458. package/dist/utils/fetchWithRetry.d.ts +9 -0
  459. package/dist/utils/fetchWithRetry.d.ts.map +1 -0
  460. package/dist/utils.cjs +33 -17
  461. package/dist/utils.d.ts +39 -6
  462. package/dist/utils.d.ts.map +1 -1
  463. package/dist/utils.js +1 -1
  464. package/dist/vector/embed.d.ts +1 -1
  465. package/dist/vector/embed.d.ts.map +1 -1
  466. package/dist/vector/index.cjs +80 -8
  467. package/dist/vector/index.cjs.map +1 -1
  468. package/dist/vector/index.js +80 -1
  469. package/dist/vector/index.js.map +1 -1
  470. package/dist/vector/vector.d.ts +5 -2
  471. package/dist/vector/vector.d.ts.map +1 -1
  472. package/dist/voice/composite-voice.d.ts +1 -7
  473. package/dist/voice/composite-voice.d.ts.map +1 -1
  474. package/dist/voice/index.cjs +4 -4
  475. package/dist/voice/index.js +1 -1
  476. package/dist/voice/voice.d.ts +0 -1
  477. package/dist/voice/voice.d.ts.map +1 -1
  478. package/dist/workflows/default.d.ts +35 -43
  479. package/dist/workflows/default.d.ts.map +1 -1
  480. package/dist/workflows/evented/execution-engine.d.ts +5 -3
  481. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  482. package/dist/workflows/evented/index.cjs +10 -10
  483. package/dist/workflows/evented/index.js +1 -1
  484. package/dist/workflows/evented/step-executor.d.ts +15 -13
  485. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  486. package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -5
  487. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  488. package/dist/workflows/evented/workflow-event-processor/loop.d.ts +3 -3
  489. package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
  490. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
  491. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
  492. package/dist/workflows/evented/workflow-event-processor/utils.d.ts +2 -7
  493. package/dist/workflows/evented/workflow-event-processor/utils.d.ts.map +1 -1
  494. package/dist/workflows/evented/workflow.d.ts +11 -14
  495. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  496. package/dist/workflows/execution-engine.d.ts +6 -6
  497. package/dist/workflows/execution-engine.d.ts.map +1 -1
  498. package/dist/workflows/index.cjs +22 -14
  499. package/dist/workflows/index.js +1 -1
  500. package/dist/workflows/step.d.ts +5 -5
  501. package/dist/workflows/step.d.ts.map +1 -1
  502. package/dist/workflows/types.d.ts +21 -44
  503. package/dist/workflows/types.d.ts.map +1 -1
  504. package/dist/workflows/utils.d.ts +14 -0
  505. package/dist/workflows/utils.d.ts.map +1 -1
  506. package/dist/workflows/workflow.d.ts +74 -64
  507. package/dist/workflows/workflow.d.ts.map +1 -1
  508. package/evals/scoreTraces.d.ts +1 -0
  509. package/evals.d.ts +1 -0
  510. package/features.d.ts +1 -0
  511. package/observability.d.ts +1 -0
  512. package/package.json +49 -64
  513. package/request-context.d.ts +1 -0
  514. package/src/_types/ai-sdk.types.d.ts +4705 -0
  515. package/src/llm/model/provider-types.generated.d.ts +80 -17
  516. package/agent/input-processor/processors.d.ts +0 -1
  517. package/ai-tracing.d.ts +0 -1
  518. package/dist/agent/index.warning.d.ts +0 -13
  519. package/dist/agent/index.warning.d.ts.map +0 -1
  520. package/dist/agent/input-processor/index.cjs +0 -28
  521. package/dist/agent/input-processor/index.d.ts +0 -10
  522. package/dist/agent/input-processor/index.d.ts.map +0 -1
  523. package/dist/agent/input-processor/index.js +0 -3
  524. package/dist/agent/input-processor/processors/index.d.ts +0 -6
  525. package/dist/agent/input-processor/processors/index.d.ts.map +0 -1
  526. package/dist/agent/input-processor/processors/language-detector.d.ts +0 -18
  527. package/dist/agent/input-processor/processors/language-detector.d.ts.map +0 -1
  528. package/dist/agent/input-processor/processors/moderation.d.ts +0 -18
  529. package/dist/agent/input-processor/processors/moderation.d.ts.map +0 -1
  530. package/dist/agent/input-processor/processors/pii-detector.d.ts +0 -18
  531. package/dist/agent/input-processor/processors/pii-detector.d.ts.map +0 -1
  532. package/dist/agent/input-processor/processors/prompt-injection-detector.d.ts +0 -18
  533. package/dist/agent/input-processor/processors/prompt-injection-detector.d.ts.map +0 -1
  534. package/dist/agent/input-processor/processors/unicode-normalizer.d.ts +0 -18
  535. package/dist/agent/input-processor/processors/unicode-normalizer.d.ts.map +0 -1
  536. package/dist/ai-tracing/context.d.ts.map +0 -1
  537. package/dist/ai-tracing/exporters/base.d.ts +0 -111
  538. package/dist/ai-tracing/exporters/base.d.ts.map +0 -1
  539. package/dist/ai-tracing/exporters/cloud.d.ts +0 -30
  540. package/dist/ai-tracing/exporters/cloud.d.ts.map +0 -1
  541. package/dist/ai-tracing/exporters/console.d.ts +0 -10
  542. package/dist/ai-tracing/exporters/console.d.ts.map +0 -1
  543. package/dist/ai-tracing/exporters/default.d.ts +0 -98
  544. package/dist/ai-tracing/exporters/default.d.ts.map +0 -1
  545. package/dist/ai-tracing/exporters/index.d.ts +0 -9
  546. package/dist/ai-tracing/exporters/index.d.ts.map +0 -1
  547. package/dist/ai-tracing/index.cjs +0 -148
  548. package/dist/ai-tracing/index.d.ts +0 -13
  549. package/dist/ai-tracing/index.d.ts.map +0 -1
  550. package/dist/ai-tracing/index.js +0 -3
  551. package/dist/ai-tracing/model-tracing.d.ts +0 -63
  552. package/dist/ai-tracing/model-tracing.d.ts.map +0 -1
  553. package/dist/ai-tracing/registry.d.ts +0 -51
  554. package/dist/ai-tracing/registry.d.ts.map +0 -1
  555. package/dist/ai-tracing/span_processors/index.d.ts +0 -5
  556. package/dist/ai-tracing/span_processors/index.d.ts.map +0 -1
  557. package/dist/ai-tracing/span_processors/sensitive-data-filter.d.ts +0 -85
  558. package/dist/ai-tracing/span_processors/sensitive-data-filter.d.ts.map +0 -1
  559. package/dist/ai-tracing/spans/base.d.ts +0 -65
  560. package/dist/ai-tracing/spans/base.d.ts.map +0 -1
  561. package/dist/ai-tracing/spans/default.d.ts +0 -13
  562. package/dist/ai-tracing/spans/default.d.ts.map +0 -1
  563. package/dist/ai-tracing/spans/index.d.ts +0 -7
  564. package/dist/ai-tracing/spans/index.d.ts.map +0 -1
  565. package/dist/ai-tracing/spans/no-op.d.ts +0 -15
  566. package/dist/ai-tracing/spans/no-op.d.ts.map +0 -1
  567. package/dist/ai-tracing/tracers/base.d.ts +0 -105
  568. package/dist/ai-tracing/tracers/base.d.ts.map +0 -1
  569. package/dist/ai-tracing/tracers/default.d.ts +0 -7
  570. package/dist/ai-tracing/tracers/default.d.ts.map +0 -1
  571. package/dist/ai-tracing/tracers/index.d.ts +0 -6
  572. package/dist/ai-tracing/tracers/index.d.ts.map +0 -1
  573. package/dist/ai-tracing/types.d.ts.map +0 -1
  574. package/dist/ai-tracing/utils.d.ts +0 -68
  575. package/dist/ai-tracing/utils.d.ts.map +0 -1
  576. package/dist/base.warning.d.ts +0 -9
  577. package/dist/base.warning.d.ts.map +0 -1
  578. package/dist/bundler/index.warning.d.ts +0 -9
  579. package/dist/bundler/index.warning.d.ts.map +0 -1
  580. package/dist/chunk-253FBVD4.cjs +0 -1303
  581. package/dist/chunk-253FBVD4.cjs.map +0 -1
  582. package/dist/chunk-2B3VLGTH.js +0 -87
  583. package/dist/chunk-2B3VLGTH.js.map +0 -1
  584. package/dist/chunk-34ZCWSUA.js.map +0 -1
  585. package/dist/chunk-3HXBPDKN.js +0 -105
  586. package/dist/chunk-3JX2Y3WH.cjs.map +0 -1
  587. package/dist/chunk-3VXXCPKX.js.map +0 -1
  588. package/dist/chunk-4R2TBRS7.cjs +0 -191
  589. package/dist/chunk-4R2TBRS7.cjs.map +0 -1
  590. package/dist/chunk-5NTO7S5I.cjs.map +0 -1
  591. package/dist/chunk-6C7VGVK4.js +0 -267
  592. package/dist/chunk-6C7VGVK4.js.map +0 -1
  593. package/dist/chunk-6KOL2B3A.cjs +0 -75
  594. package/dist/chunk-6KOL2B3A.cjs.map +0 -1
  595. package/dist/chunk-6TEQIYXV.cjs.map +0 -1
  596. package/dist/chunk-6VOPKVYH.cjs +0 -57
  597. package/dist/chunk-6VOPKVYH.cjs.map +0 -1
  598. package/dist/chunk-77JHIM4E.cjs.map +0 -1
  599. package/dist/chunk-7J3XX4AO.cjs.map +0 -1
  600. package/dist/chunk-A5KDVZDL.cjs.map +0 -1
  601. package/dist/chunk-ABZOBBLL.cjs.map +0 -1
  602. package/dist/chunk-AQGLVU53.cjs +0 -603
  603. package/dist/chunk-AQGLVU53.cjs.map +0 -1
  604. package/dist/chunk-BLUDYAPI.js +0 -596
  605. package/dist/chunk-BLUDYAPI.js.map +0 -1
  606. package/dist/chunk-BWGXM3D4.js.map +0 -1
  607. package/dist/chunk-C7OVZMPW.cjs +0 -91
  608. package/dist/chunk-C7OVZMPW.cjs.map +0 -1
  609. package/dist/chunk-DMBN72QF.cjs +0 -39
  610. package/dist/chunk-DMBN72QF.cjs.map +0 -1
  611. package/dist/chunk-DTTOVV72.js +0 -2880
  612. package/dist/chunk-DTTOVV72.js.map +0 -1
  613. package/dist/chunk-E3PG7G6E.js.map +0 -1
  614. package/dist/chunk-EBVYYC2Q.cjs +0 -111
  615. package/dist/chunk-FHVFGVIO.js.map +0 -1
  616. package/dist/chunk-GB5BIA4V.js +0 -167
  617. package/dist/chunk-GB5BIA4V.js.map +0 -1
  618. package/dist/chunk-HEQTUMUA.cjs +0 -271
  619. package/dist/chunk-HEQTUMUA.cjs.map +0 -1
  620. package/dist/chunk-HF3GZRFP.cjs +0 -9
  621. package/dist/chunk-HF3GZRFP.cjs.map +0 -1
  622. package/dist/chunk-JVV5LREI.js +0 -431
  623. package/dist/chunk-JVV5LREI.js.map +0 -1
  624. package/dist/chunk-KAEQISOW.js.map +0 -1
  625. package/dist/chunk-KDX3ZMQ2.js +0 -12
  626. package/dist/chunk-KDX3ZMQ2.js.map +0 -1
  627. package/dist/chunk-LG5B3KIW.js +0 -1215
  628. package/dist/chunk-LG5B3KIW.js.map +0 -1
  629. package/dist/chunk-LZUSZT7R.cjs +0 -170
  630. package/dist/chunk-LZUSZT7R.cjs.map +0 -1
  631. package/dist/chunk-MCASUJWY.cjs.map +0 -1
  632. package/dist/chunk-MJMID7LX.cjs.map +0 -1
  633. package/dist/chunk-MKCC5K77.js +0 -90
  634. package/dist/chunk-MKCC5K77.js.map +0 -1
  635. package/dist/chunk-NPNGPMT2.js +0 -39
  636. package/dist/chunk-NPNGPMT2.js.map +0 -1
  637. package/dist/chunk-NR77P3TK.js.map +0 -1
  638. package/dist/chunk-NUAURT4I.cjs +0 -82
  639. package/dist/chunk-NUAURT4I.cjs.map +0 -1
  640. package/dist/chunk-OIT3PCWA.js +0 -72
  641. package/dist/chunk-OIT3PCWA.js.map +0 -1
  642. package/dist/chunk-P35FNLTQ.cjs +0 -2936
  643. package/dist/chunk-P35FNLTQ.cjs.map +0 -1
  644. package/dist/chunk-PFXXH2RP.js.map +0 -1
  645. package/dist/chunk-PZUZNPFM.js.map +0 -1
  646. package/dist/chunk-QFF5JUKT.cjs.map +0 -1
  647. package/dist/chunk-RKXWLG33.js +0 -7
  648. package/dist/chunk-RKXWLG33.js.map +0 -1
  649. package/dist/chunk-ROS5CMJS.cjs.map +0 -1
  650. package/dist/chunk-SJMKDSRF.js +0 -179
  651. package/dist/chunk-SJMKDSRF.js.map +0 -1
  652. package/dist/chunk-SSULK22X.cjs +0 -14
  653. package/dist/chunk-SSULK22X.cjs.map +0 -1
  654. package/dist/chunk-TSNDVBUU.cjs.map +0 -1
  655. package/dist/chunk-TTELJD4F.js.map +0 -1
  656. package/dist/chunk-TX4TTPYJ.cjs +0 -436
  657. package/dist/chunk-TX4TTPYJ.cjs.map +0 -1
  658. package/dist/chunk-UXG7PYML.js.map +0 -1
  659. package/dist/chunk-UZKIGB7M.cjs.map +0 -1
  660. package/dist/chunk-VF676YCO.cjs +0 -150
  661. package/dist/chunk-VF676YCO.cjs.map +0 -1
  662. package/dist/chunk-VQASQG5D.js +0 -55
  663. package/dist/chunk-VQASQG5D.js.map +0 -1
  664. package/dist/chunk-WBAXXG34.cjs.map +0 -1
  665. package/dist/chunk-WCHE6FJ7.js.map +0 -1
  666. package/dist/chunk-WM4RO23J.js +0 -145
  667. package/dist/chunk-WM4RO23J.js.map +0 -1
  668. package/dist/chunk-Z4RIRDU3.js.map +0 -1
  669. package/dist/chunk-ZABG3SZ2.cjs +0 -93
  670. package/dist/chunk-ZABG3SZ2.cjs.map +0 -1
  671. package/dist/chunk-ZISECZZO.js +0 -72
  672. package/dist/chunk-ZISECZZO.js.map +0 -1
  673. package/dist/chunk-ZMELUU72.js.map +0 -1
  674. package/dist/deployer/index.warning.d.ts +0 -9
  675. package/dist/deployer/index.warning.d.ts.map +0 -1
  676. package/dist/eval/evaluation.d.ts +0 -14
  677. package/dist/eval/evaluation.d.ts.map +0 -1
  678. package/dist/eval/index.cjs +0 -16
  679. package/dist/eval/index.d.ts +0 -4
  680. package/dist/eval/index.d.ts.map +0 -1
  681. package/dist/eval/index.js +0 -3
  682. package/dist/eval/metric.d.ts +0 -8
  683. package/dist/eval/metric.d.ts.map +0 -1
  684. package/dist/eval/types.d.ts +0 -9
  685. package/dist/eval/types.d.ts.map +0 -1
  686. package/dist/integration/index.warning.d.ts +0 -3
  687. package/dist/integration/index.warning.d.ts.map +0 -1
  688. package/dist/integration/integration.warning.d.ts +0 -5
  689. package/dist/integration/integration.warning.d.ts.map +0 -1
  690. package/dist/integration/openapi-toolset.warning.d.ts +0 -5
  691. package/dist/integration/openapi-toolset.warning.d.ts.map +0 -1
  692. package/dist/loop/telemetry/index.d.ts +0 -36
  693. package/dist/loop/telemetry/index.d.ts.map +0 -1
  694. package/dist/loop/telemetry/noop.d.ts +0 -3
  695. package/dist/loop/telemetry/noop.d.ts.map +0 -1
  696. package/dist/loop/test-utils/mockTracer.d.ts +0 -47
  697. package/dist/loop/test-utils/mockTracer.d.ts.map +0 -1
  698. package/dist/loop/test-utils/telemetry.d.ts +0 -6
  699. package/dist/loop/test-utils/telemetry.d.ts.map +0 -1
  700. package/dist/memory/index.warning.d.ts +0 -6
  701. package/dist/memory/index.warning.d.ts.map +0 -1
  702. package/dist/models-dev-4VGIWYS3.js +0 -3
  703. package/dist/models-dev-AXZASLL2.cjs +0 -12
  704. package/dist/netlify-TX6V7SJJ.cjs +0 -12
  705. package/dist/netlify-VJXBII33.js +0 -3
  706. package/dist/relevance/cohere/index.d.ts +0 -9
  707. package/dist/relevance/cohere/index.d.ts.map +0 -1
  708. package/dist/runtime-context/index.cjs +0 -12
  709. package/dist/runtime-context/index.js +0 -3
  710. package/dist/scores/base.d.ts.map +0 -1
  711. package/dist/scores/base.test-utils.d.ts.map +0 -1
  712. package/dist/scores/hooks.d.ts.map +0 -1
  713. package/dist/scores/index.cjs +0 -37
  714. package/dist/scores/index.cjs.map +0 -1
  715. package/dist/scores/index.d.ts +0 -4
  716. package/dist/scores/index.d.ts.map +0 -1
  717. package/dist/scores/index.js +0 -4
  718. package/dist/scores/index.js.map +0 -1
  719. package/dist/scores/run-experiment/index.d.ts.map +0 -1
  720. package/dist/scores/run-experiment/scorerAccumulator.d.ts.map +0 -1
  721. package/dist/scores/scoreTraces/index.cjs.map +0 -1
  722. package/dist/scores/scoreTraces/index.d.ts.map +0 -1
  723. package/dist/scores/scoreTraces/index.js.map +0 -1
  724. package/dist/scores/scoreTraces/scoreTraces.d.ts.map +0 -1
  725. package/dist/scores/scoreTraces/scoreTracesWorkflow.d.ts.map +0 -1
  726. package/dist/scores/scoreTraces/utils.d.ts.map +0 -1
  727. package/dist/scores/types.d.ts.map +0 -1
  728. package/dist/storage/base.warning.d.ts +0 -8
  729. package/dist/storage/base.warning.d.ts.map +0 -1
  730. package/dist/storage/domains/legacy-evals/base.d.ts +0 -13
  731. package/dist/storage/domains/legacy-evals/base.d.ts.map +0 -1
  732. package/dist/storage/domains/legacy-evals/index.d.ts +0 -2
  733. package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
  734. package/dist/storage/domains/legacy-evals/inmemory.d.ts +0 -17
  735. package/dist/storage/domains/legacy-evals/inmemory.d.ts.map +0 -1
  736. package/dist/storage/domains/traces/base.d.ts +0 -14
  737. package/dist/storage/domains/traces/base.d.ts.map +0 -1
  738. package/dist/storage/domains/traces/index.d.ts +0 -3
  739. package/dist/storage/domains/traces/index.d.ts.map +0 -1
  740. package/dist/storage/domains/traces/inmemory.d.ts +0 -22
  741. package/dist/storage/domains/traces/inmemory.d.ts.map +0 -1
  742. package/dist/storage/index.warning.d.ts +0 -3
  743. package/dist/storage/index.warning.d.ts.map +0 -1
  744. package/dist/telemetry/composite-exporter.d.ts +0 -10
  745. package/dist/telemetry/composite-exporter.d.ts.map +0 -1
  746. package/dist/telemetry/index.cjs +0 -32
  747. package/dist/telemetry/index.cjs.map +0 -1
  748. package/dist/telemetry/index.d.ts +0 -6
  749. package/dist/telemetry/index.d.ts.map +0 -1
  750. package/dist/telemetry/index.js +0 -3
  751. package/dist/telemetry/index.js.map +0 -1
  752. package/dist/telemetry/otel-vendor.cjs +0 -105
  753. package/dist/telemetry/otel-vendor.cjs.map +0 -1
  754. package/dist/telemetry/otel-vendor.d.ts +0 -11
  755. package/dist/telemetry/otel-vendor.d.ts.map +0 -1
  756. package/dist/telemetry/otel-vendor.js +0 -59
  757. package/dist/telemetry/otel-vendor.js.map +0 -1
  758. package/dist/telemetry/storage-exporter.d.ts +0 -21
  759. package/dist/telemetry/storage-exporter.d.ts.map +0 -1
  760. package/dist/telemetry/telemetry.d.ts +0 -59
  761. package/dist/telemetry/telemetry.d.ts.map +0 -1
  762. package/dist/telemetry/telemetry.decorators.d.ts +0 -15
  763. package/dist/telemetry/telemetry.decorators.d.ts.map +0 -1
  764. package/dist/telemetry/types.d.ts +0 -74
  765. package/dist/telemetry/types.d.ts.map +0 -1
  766. package/dist/telemetry/utility.d.ts +0 -15
  767. package/dist/telemetry/utility.d.ts.map +0 -1
  768. package/dist/tools/index.warning.d.ts +0 -8
  769. package/dist/tools/index.warning.d.ts.map +0 -1
  770. package/dist/tts/index.warning.d.ts +0 -7
  771. package/dist/tts/index.warning.d.ts.map +0 -1
  772. package/dist/vector/index.warning.d.ts +0 -6
  773. package/dist/vector/index.warning.d.ts.map +0 -1
  774. package/dist/workflows/index.warning.d.ts +0 -6
  775. package/dist/workflows/index.warning.d.ts.map +0 -1
  776. package/dist/workflows/legacy/index.cjs +0 -92
  777. package/dist/workflows/legacy/index.cjs.map +0 -1
  778. package/dist/workflows/legacy/index.d.ts +0 -5
  779. package/dist/workflows/legacy/index.d.ts.map +0 -1
  780. package/dist/workflows/legacy/index.js +0 -3
  781. package/dist/workflows/legacy/index.js.map +0 -1
  782. package/dist/workflows/legacy/machine.d.ts +0 -386
  783. package/dist/workflows/legacy/machine.d.ts.map +0 -1
  784. package/dist/workflows/legacy/step.d.ts +0 -15
  785. package/dist/workflows/legacy/step.d.ts.map +0 -1
  786. package/dist/workflows/legacy/types.d.ts +0 -397
  787. package/dist/workflows/legacy/types.d.ts.map +0 -1
  788. package/dist/workflows/legacy/utils.d.ts +0 -68
  789. package/dist/workflows/legacy/utils.d.ts.map +0 -1
  790. package/dist/workflows/legacy/workflow-instance.d.ts +0 -97
  791. package/dist/workflows/legacy/workflow-instance.d.ts.map +0 -1
  792. package/dist/workflows/legacy/workflow.d.ts +0 -109
  793. package/dist/workflows/legacy/workflow.d.ts.map +0 -1
  794. package/dist/workflows/workflow.warning.d.ts +0 -9
  795. package/dist/workflows/workflow.warning.d.ts.map +0 -1
  796. package/eval.d.ts +0 -1
  797. package/runtime-context.d.ts +0 -1
  798. package/scores/scoreTraces.d.ts +0 -1
  799. package/scores.d.ts +0 -1
  800. package/telemetry/otel-vendor.d.ts +0 -1
  801. package/telemetry.d.ts +0 -1
  802. package/workflows/legacy.d.ts +0 -1
  803. /package/dist/agent/{input-processor → message-list}/index.cjs.map +0 -0
  804. /package/dist/agent/{input-processor → message-list}/index.js.map +0 -0
  805. /package/dist/{ai-tracing → evals}/index.cjs.map +0 -0
  806. /package/dist/{ai-tracing → evals}/index.js.map +0 -0
  807. /package/dist/{scores/run-experiment → evals/run}/scorerAccumulator.d.ts +0 -0
  808. /package/dist/{scores → evals}/scoreTraces/index.d.ts +0 -0
  809. /package/dist/{eval → observability}/index.cjs.map +0 -0
  810. /package/dist/{eval → observability}/index.js.map +0 -0
  811. /package/dist/{runtime-context → request-context}/index.cjs.map +0 -0
  812. /package/dist/{runtime-context → request-context}/index.js.map +0 -0
@@ -1,1821 +1,120 @@
1
1
  'use strict';
2
2
 
3
- var chunkTX4TTPYJ_cjs = require('../chunk-TX4TTPYJ.cjs');
4
- var chunk4R2TBRS7_cjs = require('../chunk-4R2TBRS7.cjs');
5
- var chunkMJMID7LX_cjs = require('../chunk-MJMID7LX.cjs');
6
- var chunk5NTO7S5I_cjs = require('../chunk-5NTO7S5I.cjs');
7
- var chunk6VOPKVYH_cjs = require('../chunk-6VOPKVYH.cjs');
3
+ var chunkGGYKYORQ_cjs = require('../chunk-GGYKYORQ.cjs');
8
4
 
9
- // src/storage/domains/legacy-evals/base.ts
10
- var LegacyEvalsStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
11
- constructor() {
12
- super({
13
- component: "STORAGE",
14
- name: "LEGACY_EVALS"
15
- });
16
- }
17
- };
18
5
 
19
- // src/storage/domains/legacy-evals/inmemory.ts
20
- var InMemoryLegacyEvals = class extends LegacyEvalsStorage {
21
- collection;
22
- constructor({ collection }) {
23
- super();
24
- this.collection = collection;
25
- }
26
- async getEvals(options) {
27
- this.logger.debug(`MockStore: getEvals called`, options);
28
- let evals = Array.from(this.collection.values());
29
- if (options.agentName) {
30
- evals = evals.filter((evalR) => evalR.agent_name === options.agentName);
31
- }
32
- if (options.type === "test") {
33
- evals = evals.filter((evalR) => evalR.test_info && evalR.test_info.testPath);
34
- } else if (options.type === "live") {
35
- evals = evals.filter((evalR) => !evalR.test_info || !evalR.test_info.testPath);
36
- }
37
- if (options.dateRange?.start) {
38
- evals = evals.filter((evalR) => new Date(evalR.created_at) >= options.dateRange.start);
39
- }
40
- if (options.dateRange?.end) {
41
- evals = evals.filter((evalR) => new Date(evalR.created_at) <= options.dateRange.end);
42
- }
43
- evals.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
44
- const total = evals.length;
45
- const page = options.page || 0;
46
- const perPage = options.perPage || 100;
47
- const start = page * perPage;
48
- const end = start + perPage;
49
- return {
50
- evals: evals.slice(start, end).map((e) => ({
51
- agentName: e.agent_name,
52
- input: e.input,
53
- output: e.output,
54
- instructions: e.instructions,
55
- result: e.result,
56
- createdAt: e.created_at.toISOString(),
57
- testInfo: e.test_info,
58
- metricName: e.metric_name,
59
- runId: e.run_id,
60
- globalRunId: e.global_run_id
61
- })),
62
- total,
63
- page,
64
- perPage,
65
- hasMore: total > end
66
- };
67
- }
68
- async getEvalsByAgentName(agentName, type) {
69
- this.logger.debug(`MockStore: getEvalsByAgentName called for ${agentName}`);
70
- let evals = Array.from(this.collection.values()).filter((e) => e.agent_name === agentName);
71
- if (type === "test") {
72
- evals = evals.filter((e) => e.test_info && e.test_info.testPath);
73
- } else if (type === "live") {
74
- evals = evals.filter((e) => !e.test_info || !e.test_info.testPath);
75
- }
76
- return evals.sort(
77
- (a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
78
- ).map((e) => ({
79
- agentName: e.agent_name,
80
- input: e.input,
81
- output: e.output,
82
- instructions: e.instructions,
83
- result: e.result,
84
- createdAt: e.created_at.toISOString(),
85
- metricName: e.metric_name,
86
- runId: e.run_id,
87
- testInfo: e.test_info,
88
- globalRunId: e.global_run_id
89
- }));
90
- }
91
- };
92
-
93
- // src/storage/domains/memory/base.ts
94
- var MemoryStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
95
- constructor() {
96
- super({
97
- component: "STORAGE",
98
- name: "MEMORY"
99
- });
100
- }
101
- async deleteMessages(_messageIds) {
102
- throw new Error(
103
- `Message deletion is not supported by this storage adapter (${this.constructor.name}). The deleteMessages method needs to be implemented in the storage adapter.`
104
- );
105
- }
106
- async getResourceById(_) {
107
- throw new Error(
108
- `Resource working memory is not supported by this storage adapter (${this.constructor.name}). Supported storage adapters: LibSQL (@mastra/libsql), PostgreSQL (@mastra/pg), Upstash (@mastra/upstash). To use per-resource working memory, switch to one of these supported storage adapters.`
109
- );
110
- }
111
- async saveResource(_) {
112
- throw new Error(
113
- `Resource working memory is not supported by this storage adapter (${this.constructor.name}). Supported storage adapters: LibSQL (@mastra/libsql), PostgreSQL (@mastra/pg), Upstash (@mastra/upstash). To use per-resource working memory, switch to one of these supported storage adapters.`
114
- );
115
- }
116
- async updateResource(_) {
117
- throw new Error(
118
- `Resource working memory is not supported by this storage adapter (${this.constructor.name}). Supported storage adapters: LibSQL (@mastra/libsql), PostgreSQL (@mastra/pg), Upstash (@mastra/upstash). To use per-resource working memory, switch to one of these supported storage adapters.`
119
- );
120
- }
121
- castThreadOrderBy(v) {
122
- return v in THREAD_ORDER_BY_SET ? v : "createdAt";
123
- }
124
- castThreadSortDirection(v) {
125
- return v in THREAD_THREAD_SORT_DIRECTION_SET ? v : "DESC";
126
- }
127
- };
128
- var THREAD_ORDER_BY_SET = {
129
- createdAt: true,
130
- updatedAt: true
131
- };
132
- var THREAD_THREAD_SORT_DIRECTION_SET = {
133
- ASC: true,
134
- DESC: true
135
- };
136
-
137
- // src/storage/domains/memory/inmemory.ts
138
- var InMemoryMemory = class extends MemoryStorage {
139
- collection;
140
- operations;
141
- constructor({
142
- collection,
143
- operations
144
- }) {
145
- super();
146
- this.collection = collection;
147
- this.operations = operations;
148
- }
149
- async getThreadById({ threadId }) {
150
- this.logger.debug(`MockStore: getThreadById called for ${threadId}`);
151
- const thread = this.collection.threads.get(threadId);
152
- return thread ? { ...thread, metadata: thread.metadata ? { ...thread.metadata } : thread.metadata } : null;
153
- }
154
- async getThreadsByResourceId({
155
- resourceId,
156
- orderBy,
157
- sortDirection
158
- }) {
159
- this.logger.debug(`MockStore: getThreadsByResourceId called for ${resourceId}`);
160
- const threads = Array.from(this.collection.threads.values()).filter((t) => t.resourceId === resourceId);
161
- const sortedThreads = this.sortThreads(
162
- threads,
163
- this.castThreadOrderBy(orderBy),
164
- this.castThreadSortDirection(sortDirection)
165
- );
166
- return sortedThreads.map((thread) => ({
167
- ...thread,
168
- metadata: thread.metadata ? { ...thread.metadata } : thread.metadata
169
- }));
170
- }
171
- async saveThread({ thread }) {
172
- this.logger.debug(`MockStore: saveThread called for ${thread.id}`);
173
- const key = thread.id;
174
- this.collection.threads.set(key, thread);
175
- return thread;
176
- }
177
- async updateThread({
178
- id,
179
- title,
180
- metadata
181
- }) {
182
- this.logger.debug(`MockStore: updateThread called for ${id}`);
183
- const thread = this.collection.threads.get(id);
184
- if (!thread) {
185
- throw new Error(`Thread with id ${id} not found`);
186
- }
187
- if (thread) {
188
- thread.title = title;
189
- thread.metadata = { ...thread.metadata, ...metadata };
190
- thread.updatedAt = /* @__PURE__ */ new Date();
191
- }
192
- return thread;
193
- }
194
- async deleteThread({ threadId }) {
195
- this.logger.debug(`MockStore: deleteThread called for ${threadId}`);
196
- this.collection.threads.delete(threadId);
197
- this.collection.messages.forEach((msg, key) => {
198
- if (msg.thread_id === threadId) {
199
- this.collection.messages.delete(key);
200
- }
201
- });
202
- }
203
- async getMessages({ threadId, selectBy }) {
204
- this.logger.debug(`MockStore: getMessages called for thread ${threadId}`);
205
- if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
206
- const messages = [];
207
- if (selectBy?.include && selectBy.include.length > 0) {
208
- for (const includeItem of selectBy.include) {
209
- const targetMessage = this.collection.messages.get(includeItem.id);
210
- if (targetMessage) {
211
- const convertedMessage = {
212
- id: targetMessage.id,
213
- threadId: targetMessage.thread_id,
214
- content: typeof targetMessage.content === "string" ? JSON.parse(targetMessage.content) : targetMessage.content,
215
- role: targetMessage.role,
216
- type: targetMessage.type,
217
- createdAt: targetMessage.createdAt,
218
- resourceId: targetMessage.resourceId
219
- };
220
- messages.push(convertedMessage);
221
- if (includeItem.withPreviousMessages) {
222
- const allThreadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === includeItem.threadId).sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
223
- const targetIndex = allThreadMessages.findIndex((msg) => msg.id === includeItem.id);
224
- if (targetIndex !== -1) {
225
- const startIndex = Math.max(0, targetIndex - (includeItem.withPreviousMessages || 0));
226
- for (let i = startIndex; i < targetIndex; i++) {
227
- const message = allThreadMessages[i];
228
- if (message && !messages.some((m) => m.id === message.id)) {
229
- const convertedPrevMessage = {
230
- id: message.id,
231
- threadId: message.thread_id,
232
- content: typeof message.content === "string" ? JSON.parse(message.content) : message.content,
233
- role: message.role,
234
- type: message.type,
235
- createdAt: message.createdAt,
236
- resourceId: message.resourceId
237
- };
238
- messages.push(convertedPrevMessage);
239
- }
240
- }
241
- }
242
- }
243
- if (includeItem.withNextMessages) {
244
- const allThreadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === includeItem.threadId).sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
245
- const targetIndex = allThreadMessages.findIndex((msg) => msg.id === includeItem.id);
246
- if (targetIndex !== -1) {
247
- const endIndex = Math.min(
248
- allThreadMessages.length,
249
- targetIndex + (includeItem.withNextMessages || 0) + 1
250
- );
251
- for (let i = targetIndex + 1; i < endIndex; i++) {
252
- const message = allThreadMessages[i];
253
- if (message && !messages.some((m) => m.id === message.id)) {
254
- const convertedNextMessage = {
255
- id: message.id,
256
- threadId: message.thread_id,
257
- content: typeof message.content === "string" ? JSON.parse(message.content) : message.content,
258
- role: message.role,
259
- type: message.type,
260
- createdAt: message.createdAt,
261
- resourceId: message.resourceId
262
- };
263
- messages.push(convertedNextMessage);
264
- }
265
- }
266
- }
267
- }
268
- }
269
- }
270
- }
271
- if (!selectBy?.include || selectBy.include.length === 0 || selectBy?.last) {
272
- let threadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === threadId).filter((msg) => !messages.some((m) => m.id === msg.id));
273
- if (selectBy?.last) {
274
- threadMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
275
- const lastMessages = threadMessages.slice(-selectBy.last);
276
- for (const msg of lastMessages) {
277
- const convertedMessage = {
278
- id: msg.id,
279
- threadId: msg.thread_id,
280
- content: typeof msg.content === "string" ? JSON.parse(msg.content) : msg.content,
281
- role: msg.role,
282
- type: msg.type,
283
- createdAt: msg.createdAt,
284
- resourceId: msg.resourceId
285
- };
286
- messages.push(convertedMessage);
287
- }
288
- } else if (!selectBy?.include || selectBy.include.length === 0) {
289
- for (const msg of threadMessages) {
290
- const convertedMessage = this.parseStoredMessage(msg);
291
- messages.push(convertedMessage);
292
- }
293
- }
294
- }
295
- messages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
296
- return messages;
297
- }
298
- parseStoredMessage(message) {
299
- const { resourceId, content, role, thread_id, ...rest } = message;
300
- return {
301
- ...rest,
302
- threadId: thread_id,
303
- ...message.resourceId && { resourceId: message.resourceId },
304
- content: typeof content === "string" ? content : JSON.parse(content),
305
- role
306
- };
307
- }
308
- async getMessagesById({
309
- messageIds,
310
- format
311
- }) {
312
- this.logger.debug(`MockStore: getMessagesById called`);
313
- const rawMessages = messageIds.map((id) => this.collection.messages.get(id)).filter((message) => !!message);
314
- const list = new chunkMJMID7LX_cjs.MessageList().add(rawMessages.map(this.parseStoredMessage), "memory");
315
- if (format === "v1") return list.get.all.v1();
316
- return list.get.all.v2();
317
- }
318
- async saveMessages(args) {
319
- const { messages, format = "v1" } = args;
320
- this.logger.debug(`MockStore: saveMessages called with ${messages.length} messages`);
321
- if (messages.some((msg) => msg.id === "error-message" || msg.resourceId === null)) {
322
- throw new Error("Simulated error for testing");
323
- }
324
- const threadIds = new Set(messages.map((msg) => msg.threadId).filter((id) => Boolean(id)));
325
- for (const threadId of threadIds) {
326
- const thread = this.collection.threads.get(threadId);
327
- if (thread) {
328
- thread.updatedAt = /* @__PURE__ */ new Date();
329
- }
330
- }
331
- for (const message of messages) {
332
- const key = message.id;
333
- const storageMessage = {
334
- id: message.id,
335
- thread_id: message.threadId || "",
336
- content: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
337
- role: message.role || "user",
338
- type: message.type || "text",
339
- createdAt: message.createdAt,
340
- resourceId: message.resourceId || null
341
- };
342
- this.collection.messages.set(key, storageMessage);
343
- }
344
- const list = new chunkMJMID7LX_cjs.MessageList().add(messages, "memory");
345
- if (format === `v2`) return list.get.all.v2();
346
- return list.get.all.v1();
347
- }
348
- async updateMessages(args) {
349
- const updatedMessages = [];
350
- for (const update of args.messages) {
351
- const storageMsg = this.collection.messages.get(update.id);
352
- if (!storageMsg) continue;
353
- const oldThreadId = storageMsg.thread_id;
354
- const newThreadId = update.threadId || oldThreadId;
355
- let threadIdChanged = false;
356
- if (update.threadId && update.threadId !== oldThreadId) {
357
- threadIdChanged = true;
358
- }
359
- if (update.role !== void 0) storageMsg.role = update.role;
360
- if (update.type !== void 0) storageMsg.type = update.type;
361
- if (update.createdAt !== void 0) storageMsg.createdAt = update.createdAt;
362
- if (update.resourceId !== void 0) storageMsg.resourceId = update.resourceId;
363
- if (update.content !== void 0) {
364
- let oldContent = typeof storageMsg.content === "string" ? JSON.parse(storageMsg.content) : storageMsg.content;
365
- let newContent = update.content;
366
- if (typeof newContent === "object" && typeof oldContent === "object") {
367
- newContent = { ...oldContent, ...newContent };
368
- if (oldContent.metadata && newContent.metadata) {
369
- newContent.metadata = { ...oldContent.metadata, ...newContent.metadata };
370
- }
371
- }
372
- storageMsg.content = JSON.stringify(newContent);
373
- }
374
- if (threadIdChanged) {
375
- storageMsg.thread_id = newThreadId;
376
- const base = Date.now();
377
- let oldThreadNewTime;
378
- const oldThread = this.collection.threads.get(oldThreadId);
379
- if (oldThread) {
380
- const prev = new Date(oldThread.updatedAt).getTime();
381
- oldThreadNewTime = Math.max(base, prev + 1);
382
- oldThread.updatedAt = new Date(oldThreadNewTime);
383
- }
384
- const newThread = this.collection.threads.get(newThreadId);
385
- if (newThread) {
386
- const prev = new Date(newThread.updatedAt).getTime();
387
- let newThreadNewTime = Math.max(base + 1, prev + 1);
388
- if (oldThreadNewTime !== void 0 && newThreadNewTime <= oldThreadNewTime) {
389
- newThreadNewTime = oldThreadNewTime + 1;
390
- }
391
- newThread.updatedAt = new Date(newThreadNewTime);
392
- }
393
- } else {
394
- const thread = this.collection.threads.get(oldThreadId);
395
- if (thread) {
396
- const prev = new Date(thread.updatedAt).getTime();
397
- let newTime = Date.now();
398
- if (newTime <= prev) newTime = prev + 1;
399
- thread.updatedAt = new Date(newTime);
400
- }
401
- }
402
- this.collection.messages.set(update.id, storageMsg);
403
- updatedMessages.push({
404
- id: storageMsg.id,
405
- threadId: storageMsg.thread_id,
406
- content: typeof storageMsg.content === "string" ? JSON.parse(storageMsg.content) : storageMsg.content,
407
- role: storageMsg.role === "user" || storageMsg.role === "assistant" ? storageMsg.role : "user",
408
- type: storageMsg.type,
409
- createdAt: storageMsg.createdAt,
410
- resourceId: storageMsg.resourceId === null ? void 0 : storageMsg.resourceId
411
- });
412
- }
413
- return updatedMessages;
414
- }
415
- async deleteMessages(messageIds) {
416
- if (!messageIds || messageIds.length === 0) {
417
- return;
418
- }
419
- this.logger.debug(`MockStore: deleteMessages called for ${messageIds.length} messages`);
420
- const threadIds = /* @__PURE__ */ new Set();
421
- for (const messageId of messageIds) {
422
- const message = this.collection.messages.get(messageId);
423
- if (message && message.thread_id) {
424
- threadIds.add(message.thread_id);
425
- }
426
- this.collection.messages.delete(messageId);
427
- }
428
- const now = /* @__PURE__ */ new Date();
429
- for (const threadId of threadIds) {
430
- const thread = this.collection.threads.get(threadId);
431
- if (thread) {
432
- thread.updatedAt = now;
433
- }
434
- }
435
- }
436
- async getThreadsByResourceIdPaginated(args) {
437
- const { resourceId, page, perPage, orderBy, sortDirection } = args;
438
- this.logger.debug(`MockStore: getThreadsByResourceIdPaginated called for ${resourceId}`);
439
- const threads = Array.from(this.collection.threads.values()).filter((t) => t.resourceId === resourceId);
440
- const sortedThreads = this.sortThreads(
441
- threads,
442
- this.castThreadOrderBy(orderBy),
443
- this.castThreadSortDirection(sortDirection)
444
- );
445
- const clonedThreads = sortedThreads.map((thread) => ({
446
- ...thread,
447
- metadata: thread.metadata ? { ...thread.metadata } : thread.metadata
448
- }));
449
- return {
450
- threads: clonedThreads.slice(page * perPage, (page + 1) * perPage),
451
- total: clonedThreads.length,
452
- page,
453
- perPage,
454
- hasMore: clonedThreads.length > (page + 1) * perPage
455
- };
456
- }
457
- async getMessagesPaginated({
458
- threadId,
459
- selectBy
460
- }) {
461
- this.logger.debug(`MockStore: getMessagesPaginated called for thread ${threadId}`);
462
- if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
463
- const { page = 0, perPage = 40 } = selectBy?.pagination || {};
464
- const messages = [];
465
- if (selectBy?.include && selectBy.include.length > 0) {
466
- for (const includeItem of selectBy.include) {
467
- const targetMessage = this.collection.messages.get(includeItem.id);
468
- if (targetMessage) {
469
- const convertedMessage = {
470
- id: targetMessage.id,
471
- threadId: targetMessage.thread_id,
472
- content: typeof targetMessage.content === "string" ? JSON.parse(targetMessage.content) : targetMessage.content,
473
- role: targetMessage.role,
474
- type: targetMessage.type,
475
- createdAt: targetMessage.createdAt,
476
- resourceId: targetMessage.resourceId
477
- };
478
- messages.push(convertedMessage);
479
- if (includeItem.withPreviousMessages) {
480
- const allThreadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === includeItem.threadId).sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
481
- const targetIndex = allThreadMessages.findIndex((msg) => msg.id === includeItem.id);
482
- if (targetIndex !== -1) {
483
- const startIndex = Math.max(0, targetIndex - (includeItem.withPreviousMessages || 0));
484
- for (let i = startIndex; i < targetIndex; i++) {
485
- const message = allThreadMessages[i];
486
- if (message && !messages.some((m) => m.id === message.id)) {
487
- const convertedPrevMessage = {
488
- id: message.id,
489
- threadId: message.thread_id,
490
- content: typeof message.content === "string" ? JSON.parse(message.content) : message.content,
491
- role: message.role,
492
- type: message.type,
493
- createdAt: message.createdAt,
494
- resourceId: message.resourceId
495
- };
496
- messages.push(convertedPrevMessage);
497
- }
498
- }
499
- }
500
- }
501
- if (includeItem.withNextMessages) {
502
- const allThreadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === includeItem.threadId).sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
503
- const targetIndex = allThreadMessages.findIndex((msg) => msg.id === includeItem.id);
504
- if (targetIndex !== -1) {
505
- const endIndex = Math.min(
506
- allThreadMessages.length,
507
- targetIndex + (includeItem.withNextMessages || 0) + 1
508
- );
509
- for (let i = targetIndex + 1; i < endIndex; i++) {
510
- const message = allThreadMessages[i];
511
- if (message && !messages.some((m) => m.id === message.id)) {
512
- const convertedNextMessage = {
513
- id: message.id,
514
- threadId: message.thread_id,
515
- content: typeof message.content === "string" ? JSON.parse(message.content) : message.content,
516
- role: message.role,
517
- type: message.type,
518
- createdAt: message.createdAt,
519
- resourceId: message.resourceId
520
- };
521
- messages.push(convertedNextMessage);
522
- }
523
- }
524
- }
525
- }
526
- }
527
- }
528
- }
529
- if (!selectBy?.include || selectBy.include.length === 0 || selectBy?.last) {
530
- let threadMessages = Array.from(this.collection.messages.values()).filter((msg) => msg.thread_id === threadId).filter((msg) => !messages.some((m) => m.id === msg.id));
531
- if (selectBy?.pagination?.dateRange) {
532
- const { start: from, end: to } = selectBy.pagination.dateRange;
533
- threadMessages = threadMessages.filter((msg) => {
534
- const msgDate = new Date(msg.createdAt);
535
- const fromDate = from ? new Date(from) : null;
536
- const toDate = to ? new Date(to) : null;
537
- if (fromDate && msgDate < fromDate) return false;
538
- if (toDate && msgDate > toDate) return false;
539
- return true;
540
- });
541
- }
542
- if (selectBy?.last) {
543
- threadMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
544
- const lastMessages = threadMessages.slice(-selectBy.last);
545
- for (const msg of lastMessages) {
546
- const convertedMessage = {
547
- id: msg.id,
548
- threadId: msg.thread_id,
549
- content: typeof msg.content === "string" ? JSON.parse(msg.content) : msg.content,
550
- role: msg.role,
551
- type: msg.type,
552
- createdAt: msg.createdAt,
553
- resourceId: msg.resourceId
554
- };
555
- messages.push(convertedMessage);
556
- }
557
- } else if (!selectBy?.include || selectBy.include.length === 0) {
558
- for (const msg of threadMessages) {
559
- const convertedMessage = {
560
- id: msg.id,
561
- threadId: msg.thread_id,
562
- content: typeof msg.content === "string" ? JSON.parse(msg.content) : msg.content,
563
- role: msg.role,
564
- type: msg.type,
565
- createdAt: msg.createdAt,
566
- resourceId: msg.resourceId
567
- };
568
- messages.push(convertedMessage);
569
- }
570
- }
571
- }
572
- messages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
573
- const start = page * perPage;
574
- const end = start + perPage;
575
- return {
576
- messages: messages.slice(start, end),
577
- total: messages.length,
578
- page,
579
- perPage,
580
- hasMore: messages.length > end
581
- };
582
- }
583
- async getResourceById({ resourceId }) {
584
- this.logger.debug(`MockStore: getResourceById called for ${resourceId}`);
585
- const resource = this.collection.resources.get(resourceId);
586
- return resource ? { ...resource, metadata: resource.metadata ? { ...resource.metadata } : resource.metadata } : null;
587
- }
588
- async saveResource({ resource }) {
589
- this.logger.debug(`MockStore: saveResource called for ${resource.id}`);
590
- this.collection.resources.set(resource.id, resource);
591
- return resource;
592
- }
593
- async updateResource({
594
- resourceId,
595
- workingMemory,
596
- metadata
597
- }) {
598
- this.logger.debug(`MockStore: updateResource called for ${resourceId}`);
599
- let resource = this.collection.resources.get(resourceId);
600
- if (!resource) {
601
- resource = {
602
- id: resourceId,
603
- workingMemory,
604
- metadata: metadata || {},
605
- createdAt: /* @__PURE__ */ new Date(),
606
- updatedAt: /* @__PURE__ */ new Date()
607
- };
608
- } else {
609
- resource = {
610
- ...resource,
611
- workingMemory: workingMemory !== void 0 ? workingMemory : resource.workingMemory,
612
- metadata: {
613
- ...resource.metadata,
614
- ...metadata
615
- },
616
- updatedAt: /* @__PURE__ */ new Date()
617
- };
618
- }
619
- this.collection.resources.set(resourceId, resource);
620
- return resource;
621
- }
622
- sortThreads(threads, orderBy, sortDirection) {
623
- return threads.sort((a, b) => {
624
- const aValue = new Date(a[orderBy]).getTime();
625
- const bValue = new Date(b[orderBy]).getTime();
626
- if (sortDirection === "ASC") {
627
- return aValue - bValue;
628
- } else {
629
- return bValue - aValue;
630
- }
631
- });
632
- }
633
- };
634
-
635
- // src/storage/domains/observability/base.ts
636
- var ObservabilityStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
637
- constructor() {
638
- super({
639
- component: "STORAGE",
640
- name: "OBSERVABILITY"
641
- });
642
- }
643
- /**
644
- * Provides hints for AI tracing strategy selection by the DefaultExporter.
645
- * Storage adapters can override this to specify their preferred and supported strategies.
646
- */
647
- get aiTracingStrategy() {
648
- return {
649
- preferred: "batch-with-updates",
650
- // Default for most SQL stores
651
- supported: ["realtime", "batch-with-updates", "insert-only"]
652
- };
653
- }
654
- /**
655
- * Creates a single AI span record in the storage provider.
656
- */
657
- createAISpan(_span) {
658
- throw new chunk5NTO7S5I_cjs.MastraError({
659
- id: "OBSERVABILITY_CREATE_AI_SPAN_NOT_IMPLEMENTED",
660
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
661
- category: "SYSTEM" /* SYSTEM */,
662
- text: "This storage provider does not support creating AI spans"
663
- });
664
- }
665
- /**
666
- * Updates a single AI span with partial data. Primarily used for realtime trace creation.
667
- */
668
- updateAISpan(_params) {
669
- throw new chunk5NTO7S5I_cjs.MastraError({
670
- id: "OBSERVABILITY_STORAGE_UPDATE_AI_SPAN_NOT_IMPLEMENTED",
671
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
672
- category: "SYSTEM" /* SYSTEM */,
673
- text: "This storage provider does not support updating AI spans"
674
- });
675
- }
676
- /**
677
- * Retrieves a single AI trace with all its associated spans.
678
- */
679
- getAITrace(_traceId) {
680
- throw new chunk5NTO7S5I_cjs.MastraError({
681
- id: "OBSERVABILITY_STORAGE_GET_AI_TRACE_NOT_IMPLEMENTED",
682
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
683
- category: "SYSTEM" /* SYSTEM */,
684
- text: "This storage provider does not support getting AI traces"
685
- });
686
- }
687
- /**
688
- * Retrieves a paginated list of AI traces with optional filtering.
689
- */
690
- getAITracesPaginated(_args) {
691
- throw new chunk5NTO7S5I_cjs.MastraError({
692
- id: "OBSERVABILITY_STORAGE_GET_AI_TRACES_PAGINATED_NOT_IMPLEMENTED",
693
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
694
- category: "SYSTEM" /* SYSTEM */,
695
- text: "This storage provider does not support getting AI traces paginated"
696
- });
697
- }
698
- /**
699
- * Creates multiple AI spans in a single batch.
700
- */
701
- batchCreateAISpans(_args) {
702
- throw new chunk5NTO7S5I_cjs.MastraError({
703
- id: "OBSERVABILITY_STORAGE_BATCH_CREATE_AI_SPAN_NOT_IMPLEMENTED",
704
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
705
- category: "SYSTEM" /* SYSTEM */,
706
- text: "This storage provider does not support batch creating AI spans"
707
- });
708
- }
709
- /**
710
- * Updates multiple AI spans in a single batch.
711
- */
712
- batchUpdateAISpans(_args) {
713
- throw new chunk5NTO7S5I_cjs.MastraError({
714
- id: "OBSERVABILITY_STORAGE_BATCH_UPDATE_AI_SPAN_NOT_IMPLEMENTED",
715
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
716
- category: "SYSTEM" /* SYSTEM */,
717
- text: "This storage provider does not support batch updating AI spans"
718
- });
719
- }
720
- /**
721
- * Deletes multiple AI traces and all their associated spans in a single batch operation.
722
- */
723
- batchDeleteAITraces(_args) {
724
- throw new chunk5NTO7S5I_cjs.MastraError({
725
- id: "OBSERVABILITY_STORAGE_BATCH_DELETE_AI_SPAN_NOT_IMPLEMENTED",
726
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
727
- category: "SYSTEM" /* SYSTEM */,
728
- text: "This storage provider does not support batch deleting AI traces"
729
- });
730
- }
731
- };
732
-
733
- // src/storage/domains/observability/inmemory.ts
734
- var ObservabilityInMemory = class extends ObservabilityStorage {
735
- operations;
736
- collection;
737
- constructor({ collection, operations }) {
738
- super();
739
- this.collection = collection;
740
- this.operations = operations;
741
- }
742
- get aiTracingStrategy() {
743
- return {
744
- preferred: "realtime",
745
- supported: ["realtime", "batch-with-updates", "insert-only"]
746
- };
747
- }
748
- async createAISpan(span) {
749
- this.validateCreateAISpan(span);
750
- const id = this.generateId(span);
751
- const record = span;
752
- record.createdAt = /* @__PURE__ */ new Date();
753
- record.updatedAt = record.createdAt;
754
- this.collection.set(id, record);
755
- }
756
- async batchCreateAISpans(args) {
757
- for (const record of args.records) {
758
- await this.createAISpan(record);
759
- }
760
- }
761
- validateCreateAISpan(record) {
762
- if (!record.spanId) {
763
- throw new chunk5NTO7S5I_cjs.MastraError({
764
- id: "OBSERVABILITY_SPAN_ID_REQUIRED",
765
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
766
- category: "SYSTEM" /* SYSTEM */,
767
- text: "Span ID is required for creating a span"
768
- });
769
- }
770
- if (!record.traceId) {
771
- throw new chunk5NTO7S5I_cjs.MastraError({
772
- id: "OBSERVABILITY_TRACE_ID_REQUIRED",
773
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
774
- category: "SYSTEM" /* SYSTEM */,
775
- text: "Trace ID is required for creating a span"
776
- });
777
- }
778
- }
779
- generateId({ traceId, spanId }) {
780
- return `${traceId}-${spanId}`;
781
- }
782
- async getAITrace(traceId) {
783
- const spans = Array.from(this.collection.values()).filter((span) => span.traceId === traceId);
784
- if (spans.length === 0) {
785
- return null;
786
- }
787
- spans.sort((a, b) => a.startedAt.getTime() - b.startedAt.getTime());
788
- return {
789
- traceId,
790
- spans
791
- };
792
- }
793
- async getAITracesPaginated({
794
- filters,
795
- pagination
796
- }) {
797
- const allRootSpans = this.filterForRootSpans(Array.from(this.collection.values()));
798
- const filteredRootSpans = this.filterSpansByFilter(allRootSpans, filters);
799
- const startDate = pagination?.dateRange?.start;
800
- const endDate = pagination?.dateRange?.end;
801
- const filteredRootSpansByDate = this.filterSpansByDate(filteredRootSpans, startDate, endDate);
802
- const total = filteredRootSpansByDate.length;
803
- const page = pagination?.page ?? 0;
804
- const perPage = pagination?.perPage ?? 10;
805
- const start = page * perPage;
806
- const end = start + perPage;
807
- const paged = this.filterSpansByPagination(filteredRootSpansByDate, pagination);
808
- return {
809
- spans: paged,
810
- pagination: { total, page, perPage, hasMore: end < total }
811
- };
812
- }
813
- filterForRootSpans(spans) {
814
- return spans.filter((span) => span.parentSpanId === null);
815
- }
816
- filterSpansByDate(spans, startDate, endDate) {
817
- return spans.filter((span) => {
818
- if (startDate && span.startedAt < startDate) return false;
819
- if (endDate && span.startedAt > endDate) return false;
820
- return true;
821
- });
822
- }
823
- filterSpansByFilter(spans, filter) {
824
- return spans.filter((span) => {
825
- if (filter?.name && span.name !== filter.name) return false;
826
- if (filter?.spanType && span.spanType !== filter.spanType) return false;
827
- if (filter?.entityType === "agent" && filter.entityId !== span.attributes?.agentId) return false;
828
- if (filter?.entityType === "workflow" && filter.entityId !== span.attributes?.workflowId) return false;
829
- return true;
830
- });
831
- }
832
- filterSpansByPagination(spans, pagination) {
833
- const page = pagination?.page ?? 0;
834
- const perPage = pagination?.perPage ?? 10;
835
- const start = page * perPage;
836
- const end = start + perPage;
837
- return spans.slice(start, end);
838
- }
839
- async updateAISpan(params) {
840
- const id = this.generateId(params);
841
- const span = this.collection.get(id);
842
- if (!span) {
843
- throw new chunk5NTO7S5I_cjs.MastraError({
844
- id: "OBSERVABILITY_UPDATE_AI_SPAN_NOT_FOUND",
845
- domain: "MASTRA_OBSERVABILITY" /* MASTRA_OBSERVABILITY */,
846
- category: "SYSTEM" /* SYSTEM */,
847
- text: "Span not found for update"
848
- });
849
- }
850
- this.collection.set(id, { ...span, ...params.updates, updatedAt: /* @__PURE__ */ new Date() });
851
- }
852
- async batchUpdateAISpans(args) {
853
- for (const record of args.records) {
854
- await this.updateAISpan(record);
855
- }
856
- }
857
- async batchDeleteAITraces(args) {
858
- for (const traceId of args.traceIds) {
859
- const spans = Array.from(this.collection.values()).filter((span) => span.traceId === traceId);
860
- for (const span of spans) {
861
- this.collection.delete(this.generateId(span));
862
- }
863
- }
864
- }
865
- };
866
-
867
- // src/storage/domains/operations/base.ts
868
- var StoreOperations = class extends chunk6VOPKVYH_cjs.MastraBase {
869
- constructor() {
870
- super({
871
- component: "STORAGE",
872
- name: "OPERATIONS"
873
- });
874
- }
875
- getSqlType(type) {
876
- switch (type) {
877
- case "text":
878
- return "TEXT";
879
- case "timestamp":
880
- return "TIMESTAMP";
881
- case "float":
882
- return "FLOAT";
883
- case "integer":
884
- return "INTEGER";
885
- case "bigint":
886
- return "BIGINT";
887
- case "jsonb":
888
- return "JSONB";
889
- default:
890
- return "TEXT";
891
- }
892
- }
893
- getDefaultValue(type) {
894
- switch (type) {
895
- case "text":
896
- case "uuid":
897
- return "DEFAULT ''";
898
- case "timestamp":
899
- return "DEFAULT '1970-01-01 00:00:00'";
900
- case "integer":
901
- case "bigint":
902
- case "float":
903
- return "DEFAULT 0";
904
- case "jsonb":
905
- return "DEFAULT '{}'";
906
- default:
907
- return "DEFAULT ''";
908
- }
909
- }
910
- /**
911
- * DATABASE INDEX MANAGEMENT
912
- * Optional methods for database index management.
913
- * Storage adapters can override these to provide index management capabilities.
914
- */
915
- /**
916
- * Creates a database index on specified columns
917
- * @throws {MastraError} if not supported by the storage adapter
918
- */
919
- async createIndex(_options) {
920
- throw new chunk5NTO7S5I_cjs.MastraError({
921
- id: "MASTRA_STORAGE_CREATE_INDEX_NOT_SUPPORTED",
922
- domain: "STORAGE" /* STORAGE */,
923
- category: "SYSTEM" /* SYSTEM */,
924
- text: `Index management is not supported by this storage adapter`
925
- });
926
- }
927
- /**
928
- * Drops a database index by name
929
- * @throws {MastraError} if not supported by the storage adapter
930
- */
931
- async dropIndex(_indexName) {
932
- throw new chunk5NTO7S5I_cjs.MastraError({
933
- id: "MASTRA_STORAGE_DROP_INDEX_NOT_SUPPORTED",
934
- domain: "STORAGE" /* STORAGE */,
935
- category: "SYSTEM" /* SYSTEM */,
936
- text: `Index management is not supported by this storage adapter`
937
- });
938
- }
939
- /**
940
- * Lists database indexes for a table or all tables
941
- * @throws {MastraError} if not supported by the storage adapter
942
- */
943
- async listIndexes(_tableName) {
944
- throw new chunk5NTO7S5I_cjs.MastraError({
945
- id: "MASTRA_STORAGE_LIST_INDEXES_NOT_SUPPORTED",
946
- domain: "STORAGE" /* STORAGE */,
947
- category: "SYSTEM" /* SYSTEM */,
948
- text: `Index management is not supported by this storage adapter`
949
- });
950
- }
951
- /**
952
- * Gets detailed statistics for a specific index
953
- * @throws {MastraError} if not supported by the storage adapter
954
- */
955
- async describeIndex(_indexName) {
956
- throw new chunk5NTO7S5I_cjs.MastraError({
957
- id: "MASTRA_STORAGE_DESCRIBE_INDEX_NOT_SUPPORTED",
958
- domain: "STORAGE" /* STORAGE */,
959
- category: "SYSTEM" /* SYSTEM */,
960
- text: `Index management is not supported by this storage adapter`
961
- });
962
- }
963
- /**
964
- * Returns definitions for automatic performance indexes
965
- * Storage adapters can override this to define indexes that should be created during initialization
966
- * @returns Array of index definitions to create automatically
967
- */
968
- getAutomaticIndexDefinitions() {
969
- return [];
970
- }
971
- };
972
-
973
- // src/storage/domains/operations/inmemory.ts
974
- var StoreOperationsInMemory = class extends StoreOperations {
975
- data;
976
- constructor() {
977
- super();
978
- this.data = {
979
- mastra_workflow_snapshot: /* @__PURE__ */ new Map(),
980
- mastra_evals: /* @__PURE__ */ new Map(),
981
- mastra_messages: /* @__PURE__ */ new Map(),
982
- mastra_threads: /* @__PURE__ */ new Map(),
983
- mastra_traces: /* @__PURE__ */ new Map(),
984
- mastra_resources: /* @__PURE__ */ new Map(),
985
- mastra_scorers: /* @__PURE__ */ new Map(),
986
- mastra_ai_spans: /* @__PURE__ */ new Map()
987
- };
988
- }
989
- getDatabase() {
990
- return this.data;
991
- }
992
- async insert({ tableName, record }) {
993
- const table = this.data[tableName];
994
- let key = record.id;
995
- if ([chunk4R2TBRS7_cjs.TABLE_WORKFLOW_SNAPSHOT, chunk4R2TBRS7_cjs.TABLE_EVALS].includes(tableName) && !record.id && record.run_id) {
996
- key = record.workflow_name ? `${record.workflow_name}-${record.run_id}` : record.run_id;
997
- record.id = key;
998
- } else if (!record.id) {
999
- key = `auto-${Date.now()}-${Math.random()}`;
1000
- record.id = key;
1001
- }
1002
- table.set(key, record);
1003
- }
1004
- async batchInsert({ tableName, records }) {
1005
- const table = this.data[tableName];
1006
- for (const record of records) {
1007
- let key = record.id;
1008
- if ([chunk4R2TBRS7_cjs.TABLE_WORKFLOW_SNAPSHOT, chunk4R2TBRS7_cjs.TABLE_EVALS].includes(tableName) && !record.id && record.run_id) {
1009
- key = record.run_id;
1010
- record.id = key;
1011
- } else if (!record.id) {
1012
- key = `auto-${Date.now()}-${Math.random()}`;
1013
- record.id = key;
1014
- }
1015
- table.set(key, record);
1016
- }
1017
- }
1018
- async load({ tableName, keys }) {
1019
- this.logger.debug(`MockStore: load called for ${tableName} with keys`, keys);
1020
- const table = this.data[tableName];
1021
- const records = Array.from(table.values());
1022
- return records.filter((record) => Object.keys(keys).every((key) => record[key] === keys[key]))?.[0];
1023
- }
1024
- async createTable({
1025
- tableName,
1026
- schema
1027
- }) {
1028
- this.logger.debug(`MockStore: createTable called for ${tableName} with schema`, schema);
1029
- this.data[tableName] = /* @__PURE__ */ new Map();
1030
- }
1031
- async clearTable({ tableName }) {
1032
- this.logger.debug(`MockStore: clearTable called for ${tableName}`);
1033
- this.data[tableName].clear();
1034
- }
1035
- async dropTable({ tableName }) {
1036
- this.logger.debug(`MockStore: dropTable called for ${tableName}`);
1037
- this.data[tableName].clear();
1038
- }
1039
- async alterTable({
1040
- tableName,
1041
- schema
1042
- }) {
1043
- this.logger.debug(`MockStore: alterTable called for ${tableName} with schema`, schema);
1044
- }
1045
- async hasColumn(table, column) {
1046
- this.logger.debug(`MockStore: hasColumn called for ${table} with column ${column}`);
1047
- return true;
1048
- }
1049
- };
1050
-
1051
- // src/storage/domains/scores/base.ts
1052
- var ScoresStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
1053
- constructor() {
1054
- super({
1055
- component: "STORAGE",
1056
- name: "SCORES"
1057
- });
1058
- }
1059
- async getScoresBySpan({
1060
- traceId,
1061
- spanId,
1062
- pagination: _pagination
1063
- }) {
1064
- throw new chunk5NTO7S5I_cjs.MastraError({
1065
- id: "SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED",
1066
- domain: "STORAGE" /* STORAGE */,
1067
- category: "SYSTEM" /* SYSTEM */,
1068
- details: { traceId, spanId }
1069
- });
1070
- }
1071
- };
1072
-
1073
- // src/storage/domains/scores/inmemory.ts
1074
- var ScoresInMemory = class extends ScoresStorage {
1075
- scores;
1076
- constructor({ collection }) {
1077
- super();
1078
- this.scores = collection;
1079
- }
1080
- async getScoreById({ id }) {
1081
- return this.scores.get(id) ?? null;
1082
- }
1083
- async saveScore(score) {
1084
- const newScore = { id: crypto.randomUUID(), createdAt: /* @__PURE__ */ new Date(), updatedAt: /* @__PURE__ */ new Date(), ...score };
1085
- this.scores.set(newScore.id, newScore);
1086
- return { score: newScore };
1087
- }
1088
- async getScoresByScorerId({
1089
- scorerId,
1090
- pagination,
1091
- entityId,
1092
- entityType,
1093
- source
1094
- }) {
1095
- const scores = Array.from(this.scores.values()).filter((score) => {
1096
- let baseFilter = score.scorerId === scorerId;
1097
- if (entityId) {
1098
- baseFilter = baseFilter && score.entityId === entityId;
1099
- }
1100
- if (entityType) {
1101
- baseFilter = baseFilter && score.entityType === entityType;
1102
- }
1103
- if (source) {
1104
- baseFilter = baseFilter && score.source === source;
1105
- }
1106
- return baseFilter;
1107
- });
1108
- return {
1109
- scores: scores.slice(pagination.page * pagination.perPage, (pagination.page + 1) * pagination.perPage),
1110
- pagination: {
1111
- total: scores.length,
1112
- page: pagination.page,
1113
- perPage: pagination.perPage,
1114
- hasMore: scores.length > (pagination.page + 1) * pagination.perPage
1115
- }
1116
- };
1117
- }
1118
- async getScoresByRunId({
1119
- runId,
1120
- pagination
1121
- }) {
1122
- const scores = Array.from(this.scores.values()).filter((score) => score.runId === runId);
1123
- return {
1124
- scores: scores.slice(pagination.page * pagination.perPage, (pagination.page + 1) * pagination.perPage),
1125
- pagination: {
1126
- total: scores.length,
1127
- page: pagination.page,
1128
- perPage: pagination.perPage,
1129
- hasMore: scores.length > (pagination.page + 1) * pagination.perPage
1130
- }
1131
- };
1132
- }
1133
- async getScoresByEntityId({
1134
- entityId,
1135
- entityType,
1136
- pagination
1137
- }) {
1138
- const scores = Array.from(this.scores.values()).filter((score) => {
1139
- const baseFilter = score.entityId === entityId && score.entityType === entityType;
1140
- return baseFilter;
1141
- });
1142
- return {
1143
- scores: scores.slice(pagination.page * pagination.perPage, (pagination.page + 1) * pagination.perPage),
1144
- pagination: {
1145
- total: scores.length,
1146
- page: pagination.page,
1147
- perPage: pagination.perPage,
1148
- hasMore: scores.length > (pagination.page + 1) * pagination.perPage
1149
- }
1150
- };
1151
- }
1152
- async getScoresBySpan({
1153
- traceId,
1154
- spanId,
1155
- pagination
1156
- }) {
1157
- const scores = Array.from(this.scores.values()).filter(
1158
- (score) => score.traceId === traceId && score.spanId === spanId
1159
- );
1160
- scores.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
1161
- return {
1162
- scores: scores.slice(pagination.page * pagination.perPage, (pagination.page + 1) * pagination.perPage),
1163
- pagination: {
1164
- total: scores.length,
1165
- page: pagination.page,
1166
- perPage: pagination.perPage,
1167
- hasMore: scores.length > (pagination.page + 1) * pagination.perPage
1168
- }
1169
- };
1170
- }
1171
- };
1172
-
1173
- // src/storage/domains/traces/base.ts
1174
- var TracesStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
1175
- constructor() {
1176
- super({
1177
- component: "STORAGE",
1178
- name: "TRACES"
1179
- });
1180
- }
1181
- };
1182
-
1183
- // src/storage/domains/traces/inmemory.ts
1184
- var TracesInMemory = class extends TracesStorage {
1185
- traces;
1186
- operations;
1187
- collection;
1188
- constructor({ collection, operations }) {
1189
- super();
1190
- this.collection = collection;
1191
- this.traces = collection;
1192
- this.operations = operations;
1193
- }
1194
- async getTraces({
1195
- name,
1196
- scope,
1197
- page,
1198
- perPage,
1199
- attributes,
1200
- filters,
1201
- fromDate,
1202
- toDate
1203
- }) {
1204
- this.logger.debug(`MockStore: getTraces called`);
1205
- let traces = Array.from(this.collection.values());
1206
- if (name) traces = traces.filter((t) => t.name?.startsWith(name));
1207
- if (scope) traces = traces.filter((t) => t.scope === scope);
1208
- if (attributes) {
1209
- traces = traces.filter(
1210
- (t) => Object.entries(attributes).every(([key, value]) => t.attributes?.[key] === value)
1211
- );
1212
- }
1213
- if (filters) {
1214
- traces = traces.filter((t) => Object.entries(filters).every(([key, value]) => t[key] === value));
1215
- }
1216
- if (fromDate) traces = traces.filter((t) => new Date(t.createdAt) >= fromDate);
1217
- if (toDate) traces = traces.filter((t) => new Date(t.createdAt) <= toDate);
1218
- traces.sort((a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime());
1219
- const start = page * perPage;
1220
- const end = start + perPage;
1221
- return traces.slice(start, end);
1222
- }
1223
- async getTracesPaginated({
1224
- name,
1225
- scope,
1226
- attributes,
1227
- page = 0,
1228
- perPage = 10,
1229
- dateRange
1230
- }) {
1231
- this.logger.debug(`MockStore: getTracesPaginated called`);
1232
- let traces = Array.from(this.collection.values());
1233
- if (name) traces = traces.filter((t) => t.name?.startsWith(name));
1234
- if (scope) traces = traces.filter((t) => t.scope === scope);
1235
- if (attributes) {
1236
- traces = traces.filter(
1237
- (t) => Object.entries(attributes).every(([key, value]) => t.attributes?.[key] === value)
1238
- );
1239
- }
1240
- if (dateRange?.start) traces = traces.filter((t) => new Date(t.createdAt) >= dateRange.start);
1241
- if (dateRange?.end) traces = traces.filter((t) => new Date(t.createdAt) <= dateRange.end);
1242
- traces.sort((a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime());
1243
- const start = page * perPage;
1244
- const end = start + perPage;
1245
- return {
1246
- traces: traces.slice(start, end),
1247
- total: traces.length,
1248
- page,
1249
- perPage,
1250
- hasMore: traces.length > end
1251
- };
1252
- }
1253
- async batchTraceInsert({ records }) {
1254
- this.logger.debug("Batch inserting traces", { count: records.length });
1255
- await this.operations.batchInsert({
1256
- tableName: chunk4R2TBRS7_cjs.TABLE_TRACES,
1257
- records
1258
- });
1259
- }
1260
- };
1261
-
1262
- // src/storage/domains/workflows/base.ts
1263
- var WorkflowsStorage = class extends chunk6VOPKVYH_cjs.MastraBase {
1264
- constructor() {
1265
- super({
1266
- component: "STORAGE",
1267
- name: "WORKFLOWS"
1268
- });
1269
- }
1270
- };
1271
-
1272
- // src/storage/domains/workflows/inmemory.ts
1273
- var WorkflowsInMemory = class extends WorkflowsStorage {
1274
- operations;
1275
- collection;
1276
- constructor({ collection, operations }) {
1277
- super();
1278
- this.collection = collection;
1279
- this.operations = operations;
1280
- }
1281
- async updateWorkflowResults({
1282
- workflowName,
1283
- runId,
1284
- stepId,
1285
- result,
1286
- runtimeContext
1287
- }) {
1288
- this.logger.debug(`MockStore: updateWorkflowResults called for ${workflowName} ${runId} ${stepId}`, result);
1289
- const run = this.collection.get(`${workflowName}-${runId}`);
1290
- if (!run) {
1291
- return {};
1292
- }
1293
- let snapshot;
1294
- if (!run.snapshot) {
1295
- snapshot = {
1296
- context: {},
1297
- activePaths: [],
1298
- timestamp: Date.now(),
1299
- suspendedPaths: {},
1300
- resumeLabels: {},
1301
- serializedStepGraph: [],
1302
- value: {},
1303
- waitingPaths: {},
1304
- status: "pending",
1305
- runId: run.run_id
1306
- };
1307
- this.collection.set(`${workflowName}-${runId}`, {
1308
- ...run,
1309
- snapshot
1310
- });
1311
- }
1312
- snapshot = typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : run.snapshot;
1313
- if (!snapshot || !snapshot?.context) {
1314
- throw new Error(`Snapshot not found for runId ${runId}`);
1315
- }
1316
- snapshot.context[stepId] = result;
1317
- snapshot.runtimeContext = { ...snapshot.runtimeContext, ...runtimeContext };
1318
- this.collection.set(`${workflowName}-${runId}`, {
1319
- ...run,
1320
- snapshot
1321
- });
1322
- return JSON.parse(JSON.stringify(snapshot.context));
1323
- }
1324
- async updateWorkflowState({
1325
- workflowName,
1326
- runId,
1327
- opts
1328
- }) {
1329
- const run = this.collection.get(`${workflowName}-${runId}`);
1330
- if (!run) {
1331
- return;
1332
- }
1333
- let snapshot;
1334
- if (!run.snapshot) {
1335
- snapshot = {
1336
- context: {},
1337
- activePaths: [],
1338
- timestamp: Date.now(),
1339
- suspendedPaths: {},
1340
- resumeLabels: {},
1341
- serializedStepGraph: [],
1342
- value: {},
1343
- waitingPaths: {},
1344
- status: "pending",
1345
- runId: run.run_id
1346
- };
1347
- this.collection.set(`${workflowName}-${runId}`, {
1348
- ...run,
1349
- snapshot
1350
- });
1351
- } else {
1352
- snapshot = typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : run.snapshot;
1353
- }
1354
- if (!snapshot || !snapshot?.context) {
1355
- throw new Error(`Snapshot not found for runId ${runId}`);
1356
- }
1357
- snapshot = { ...snapshot, ...opts };
1358
- this.collection.set(`${workflowName}-${runId}`, {
1359
- ...run,
1360
- snapshot
1361
- });
1362
- return snapshot;
1363
- }
1364
- async persistWorkflowSnapshot({
1365
- workflowName,
1366
- runId,
1367
- resourceId,
1368
- snapshot
1369
- }) {
1370
- const data = {
1371
- workflow_name: workflowName,
1372
- run_id: runId,
1373
- resourceId,
1374
- snapshot,
1375
- createdAt: /* @__PURE__ */ new Date(),
1376
- updatedAt: /* @__PURE__ */ new Date()
1377
- };
1378
- await this.operations.insert({
1379
- tableName: chunk4R2TBRS7_cjs.TABLE_WORKFLOW_SNAPSHOT,
1380
- record: data
1381
- });
1382
- }
1383
- async loadWorkflowSnapshot({
1384
- workflowName,
1385
- runId
1386
- }) {
1387
- this.logger.debug("Loading workflow snapshot", { workflowName, runId });
1388
- const d = await this.operations.load({
1389
- tableName: chunk4R2TBRS7_cjs.TABLE_WORKFLOW_SNAPSHOT,
1390
- keys: { workflow_name: workflowName, run_id: runId }
1391
- });
1392
- return d ? JSON.parse(JSON.stringify(d.snapshot)) : null;
1393
- }
1394
- async getWorkflowRuns({
1395
- workflowName,
1396
- fromDate,
1397
- toDate,
1398
- limit,
1399
- offset,
1400
- resourceId
1401
- } = {}) {
1402
- let runs = Array.from(this.collection.values());
1403
- if (workflowName) runs = runs.filter((run) => run.workflow_name === workflowName);
1404
- if (fromDate && toDate) {
1405
- runs = runs.filter(
1406
- (run) => new Date(run.createdAt).getTime() >= fromDate.getTime() && new Date(run.createdAt).getTime() <= toDate.getTime()
1407
- );
1408
- } else if (fromDate) {
1409
- runs = runs.filter((run) => new Date(run.createdAt).getTime() >= fromDate.getTime());
1410
- } else if (toDate) {
1411
- runs = runs.filter((run) => new Date(run.createdAt).getTime() <= toDate.getTime());
1412
- }
1413
- if (resourceId) runs = runs.filter((run) => run.resourceId === resourceId);
1414
- const total = runs.length;
1415
- runs.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
1416
- if (limit !== void 0 && offset !== void 0) {
1417
- const start = offset;
1418
- const end = start + limit;
1419
- runs = runs.slice(start, end);
1420
- }
1421
- const parsedRuns = runs.map((run) => ({
1422
- ...run,
1423
- snapshot: typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : JSON.parse(JSON.stringify(run.snapshot)),
1424
- createdAt: new Date(run.createdAt),
1425
- updatedAt: new Date(run.updatedAt),
1426
- runId: run.run_id,
1427
- workflowName: run.workflow_name,
1428
- resourceId: run.resourceId
1429
- }));
1430
- return { runs: parsedRuns, total };
1431
- }
1432
- async getWorkflowRunById({
1433
- runId,
1434
- workflowName
1435
- }) {
1436
- const runs = Array.from(this.collection.values()).filter((r) => r.run_id === runId);
1437
- let run = runs.find((r) => r.workflow_name === workflowName);
1438
- if (!run) return null;
1439
- const parsedRun = {
1440
- ...run,
1441
- snapshot: typeof run.snapshot === "string" ? JSON.parse(run.snapshot) : JSON.parse(JSON.stringify(run.snapshot)),
1442
- createdAt: new Date(run.createdAt),
1443
- updatedAt: new Date(run.updatedAt),
1444
- runId: run.run_id,
1445
- workflowName: run.workflow_name,
1446
- resourceId: run.resourceId
1447
- };
1448
- return parsedRun;
1449
- }
1450
- };
1451
-
1452
- // src/storage/mock.ts
1453
- var InMemoryStore = class extends chunkTX4TTPYJ_cjs.MastraStorage {
1454
- stores;
1455
- constructor() {
1456
- super({ name: "InMemoryStorage" });
1457
- this.hasInitialized = Promise.resolve(true);
1458
- const operationsStorage = new StoreOperationsInMemory();
1459
- const database = operationsStorage.getDatabase();
1460
- const scoresStorage = new ScoresInMemory({
1461
- collection: database.mastra_scorers
1462
- });
1463
- const workflowsStorage = new WorkflowsInMemory({
1464
- collection: database.mastra_workflow_snapshot,
1465
- operations: operationsStorage
1466
- });
1467
- const tracesStorage = new TracesInMemory({
1468
- collection: database.mastra_traces,
1469
- operations: operationsStorage
1470
- });
1471
- const memoryStorage = new InMemoryMemory({
1472
- collection: {
1473
- threads: database.mastra_threads,
1474
- resources: database.mastra_resources,
1475
- messages: database.mastra_messages
1476
- },
1477
- operations: operationsStorage
1478
- });
1479
- const legacyEvalsStorage = new InMemoryLegacyEvals({
1480
- collection: database.mastra_evals
1481
- });
1482
- const observabilityStorage = new ObservabilityInMemory({
1483
- collection: database.mastra_ai_spans,
1484
- operations: operationsStorage
1485
- });
1486
- this.stores = {
1487
- legacyEvals: legacyEvalsStorage,
1488
- operations: operationsStorage,
1489
- workflows: workflowsStorage,
1490
- traces: tracesStorage,
1491
- scores: scoresStorage,
1492
- memory: memoryStorage,
1493
- observability: observabilityStorage
1494
- };
1495
- }
1496
- get supports() {
1497
- return {
1498
- selectByIncludeResourceScope: false,
1499
- resourceWorkingMemory: false,
1500
- hasColumn: false,
1501
- createTable: false,
1502
- deleteMessages: true,
1503
- aiTracing: true,
1504
- indexManagement: false,
1505
- getScoresBySpan: true
1506
- };
1507
- }
1508
- async persistWorkflowSnapshot({
1509
- workflowName,
1510
- runId,
1511
- resourceId,
1512
- snapshot
1513
- }) {
1514
- await this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
1515
- }
1516
- async loadWorkflowSnapshot({
1517
- workflowName,
1518
- runId
1519
- }) {
1520
- return this.stores.workflows.loadWorkflowSnapshot({ workflowName, runId });
1521
- }
1522
- async createTable({
1523
- tableName,
1524
- schema
1525
- }) {
1526
- await this.stores.operations.createTable({ tableName, schema });
1527
- }
1528
- async alterTable({
1529
- tableName,
1530
- schema,
1531
- ifNotExists
1532
- }) {
1533
- await this.stores.operations.alterTable({ tableName, schema, ifNotExists });
1534
- }
1535
- async clearTable({ tableName }) {
1536
- await this.stores.operations.clearTable({ tableName });
1537
- }
1538
- async dropTable({ tableName }) {
1539
- await this.stores.operations.dropTable({ tableName });
1540
- }
1541
- async insert({ tableName, record }) {
1542
- await this.stores.operations.insert({ tableName, record });
1543
- }
1544
- async updateWorkflowResults({
1545
- workflowName,
1546
- runId,
1547
- stepId,
1548
- result,
1549
- runtimeContext
1550
- }) {
1551
- return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
1552
- }
1553
- async updateWorkflowState({
1554
- workflowName,
1555
- runId,
1556
- opts
1557
- }) {
1558
- return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
1559
- }
1560
- async batchInsert({ tableName, records }) {
1561
- await this.stores.operations.batchInsert({ tableName, records });
1562
- }
1563
- async load({ tableName, keys }) {
1564
- return this.stores.operations.load({ tableName, keys });
1565
- }
1566
- async getThreadById({ threadId }) {
1567
- return this.stores.memory.getThreadById({ threadId });
1568
- }
1569
- async getThreadsByResourceId({
1570
- resourceId,
1571
- orderBy,
1572
- sortDirection
1573
- }) {
1574
- return this.stores.memory.getThreadsByResourceId({ resourceId, orderBy, sortDirection });
1575
- }
1576
- async saveThread({ thread }) {
1577
- return this.stores.memory.saveThread({ thread });
1578
- }
1579
- async updateThread({
1580
- id,
1581
- title,
1582
- metadata
1583
- }) {
1584
- return this.stores.memory.updateThread({ id, title, metadata });
1585
- }
1586
- async deleteThread({ threadId }) {
1587
- return this.stores.memory.deleteThread({ threadId });
1588
- }
1589
- async getResourceById({ resourceId }) {
1590
- return this.stores.memory.getResourceById({ resourceId });
1591
- }
1592
- async saveResource({ resource }) {
1593
- return this.stores.memory.saveResource({ resource });
1594
- }
1595
- async updateResource({
1596
- resourceId,
1597
- workingMemory,
1598
- metadata
1599
- }) {
1600
- return this.stores.memory.updateResource({ resourceId, workingMemory, metadata });
1601
- }
1602
- async getMessages({
1603
- threadId,
1604
- resourceId,
1605
- selectBy,
1606
- format
1607
- }) {
1608
- return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format });
1609
- }
1610
- async getMessagesById({
1611
- messageIds,
1612
- format
1613
- }) {
1614
- return this.stores.memory.getMessagesById({ messageIds, format });
1615
- }
1616
- async saveMessages(args) {
1617
- return this.stores.memory.saveMessages(args);
1618
- }
1619
- async updateMessages(args) {
1620
- return this.stores.memory.updateMessages(args);
1621
- }
1622
- async deleteMessages(messageIds) {
1623
- return this.stores.memory.deleteMessages(messageIds);
1624
- }
1625
- async getThreadsByResourceIdPaginated(args) {
1626
- return this.stores.memory.getThreadsByResourceIdPaginated(args);
1627
- }
1628
- async getMessagesPaginated({
1629
- threadId,
1630
- selectBy
1631
- }) {
1632
- return this.stores.memory.getMessagesPaginated({ threadId, selectBy });
1633
- }
1634
- async getTraces({
1635
- name,
1636
- scope,
1637
- page,
1638
- perPage,
1639
- attributes,
1640
- filters,
1641
- fromDate,
1642
- toDate
1643
- }) {
1644
- return this.stores.traces.getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate });
1645
- }
1646
- async getTracesPaginated(args) {
1647
- return this.stores.traces.getTracesPaginated(args);
1648
- }
1649
- async batchTraceInsert(args) {
1650
- return this.stores.traces.batchTraceInsert(args);
1651
- }
1652
- async getScoreById({ id }) {
1653
- return this.stores.scores.getScoreById({ id });
1654
- }
1655
- async saveScore(score) {
1656
- return this.stores.scores.saveScore(score);
1657
- }
1658
- async getScoresByScorerId({
1659
- scorerId,
1660
- entityId,
1661
- entityType,
1662
- source,
1663
- pagination
1664
- }) {
1665
- return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, source, pagination });
1666
- }
1667
- async getScoresByRunId({
1668
- runId,
1669
- pagination
1670
- }) {
1671
- return this.stores.scores.getScoresByRunId({ runId, pagination });
1672
- }
1673
- async getScoresByEntityId({
1674
- entityId,
1675
- entityType,
1676
- pagination
1677
- }) {
1678
- return this.stores.scores.getScoresByEntityId({ entityId, entityType, pagination });
1679
- }
1680
- async getScoresBySpan({
1681
- traceId,
1682
- spanId,
1683
- pagination
1684
- }) {
1685
- return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
1686
- }
1687
- async getEvals(options) {
1688
- return this.stores.legacyEvals.getEvals(options);
1689
- }
1690
- async getEvalsByAgentName(agentName, type) {
1691
- return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
1692
- }
1693
- async getWorkflowRuns({
1694
- workflowName,
1695
- fromDate,
1696
- toDate,
1697
- limit,
1698
- offset,
1699
- resourceId
1700
- } = {}) {
1701
- return this.stores.workflows.getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId });
1702
- }
1703
- async getWorkflowRunById({
1704
- runId,
1705
- workflowName
1706
- }) {
1707
- return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
1708
- }
1709
- async createAISpan(span) {
1710
- return this.stores.observability.createAISpan(span);
1711
- }
1712
- async updateAISpan(params) {
1713
- return this.stores.observability.updateAISpan(params);
1714
- }
1715
- async getAITrace(traceId) {
1716
- return this.stores.observability.getAITrace(traceId);
1717
- }
1718
- async batchCreateAISpans(args) {
1719
- return this.stores.observability.batchCreateAISpans(args);
1720
- }
1721
- async batchUpdateAISpans(args) {
1722
- return this.stores.observability.batchUpdateAISpans(args);
1723
- }
1724
- async batchDeleteAITraces(args) {
1725
- return this.stores.observability.batchDeleteAITraces(args);
1726
- }
1727
- };
1728
- var MockStore = InMemoryStore;
1729
-
1730
- // src/storage/utils.ts
1731
- function safelyParseJSON(input) {
1732
- if (input && typeof input === "object") return input;
1733
- if (input == null) return {};
1734
- if (typeof input === "string") {
1735
- try {
1736
- return JSON.parse(input);
1737
- } catch {
1738
- return input;
1739
- }
1740
- }
1741
- return {};
1742
- }
1743
6
 
7
+ Object.defineProperty(exports, "InMemoryMemory", {
8
+ enumerable: true,
9
+ get: function () { return chunkGGYKYORQ_cjs.InMemoryMemory; }
10
+ });
11
+ Object.defineProperty(exports, "InMemoryStore", {
12
+ enumerable: true,
13
+ get: function () { return chunkGGYKYORQ_cjs.InMemoryStore; }
14
+ });
1744
15
  Object.defineProperty(exports, "MastraStorage", {
1745
16
  enumerable: true,
1746
- get: function () { return chunkTX4TTPYJ_cjs.MastraStorage; }
17
+ get: function () { return chunkGGYKYORQ_cjs.MastraStorage; }
1747
18
  });
1748
- Object.defineProperty(exports, "ensureDate", {
19
+ Object.defineProperty(exports, "MemoryStorage", {
1749
20
  enumerable: true,
1750
- get: function () { return chunkTX4TTPYJ_cjs.ensureDate; }
21
+ get: function () { return chunkGGYKYORQ_cjs.MemoryStorage; }
1751
22
  });
1752
- Object.defineProperty(exports, "resolveMessageLimit", {
23
+ Object.defineProperty(exports, "MockStore", {
1753
24
  enumerable: true,
1754
- get: function () { return chunkTX4TTPYJ_cjs.resolveMessageLimit; }
25
+ get: function () { return chunkGGYKYORQ_cjs.MockStore; }
1755
26
  });
1756
- Object.defineProperty(exports, "serializeDate", {
27
+ Object.defineProperty(exports, "ObservabilityInMemory", {
1757
28
  enumerable: true,
1758
- get: function () { return chunkTX4TTPYJ_cjs.serializeDate; }
29
+ get: function () { return chunkGGYKYORQ_cjs.ObservabilityInMemory; }
1759
30
  });
1760
- Object.defineProperty(exports, "AI_SPAN_SCHEMA", {
31
+ Object.defineProperty(exports, "ObservabilityStorage", {
1761
32
  enumerable: true,
1762
- get: function () { return chunk4R2TBRS7_cjs.AI_SPAN_SCHEMA; }
33
+ get: function () { return chunkGGYKYORQ_cjs.ObservabilityStorage; }
1763
34
  });
1764
35
  Object.defineProperty(exports, "SCORERS_SCHEMA", {
1765
36
  enumerable: true,
1766
- get: function () { return chunk4R2TBRS7_cjs.SCORERS_SCHEMA; }
37
+ get: function () { return chunkGGYKYORQ_cjs.SCORERS_SCHEMA; }
38
+ });
39
+ Object.defineProperty(exports, "SPAN_SCHEMA", {
40
+ enumerable: true,
41
+ get: function () { return chunkGGYKYORQ_cjs.SPAN_SCHEMA; }
1767
42
  });
1768
- Object.defineProperty(exports, "TABLE_AI_SPANS", {
43
+ Object.defineProperty(exports, "ScoresInMemory", {
1769
44
  enumerable: true,
1770
- get: function () { return chunk4R2TBRS7_cjs.TABLE_AI_SPANS; }
45
+ get: function () { return chunkGGYKYORQ_cjs.ScoresInMemory; }
1771
46
  });
1772
- Object.defineProperty(exports, "TABLE_EVALS", {
47
+ Object.defineProperty(exports, "ScoresStorage", {
1773
48
  enumerable: true,
1774
- get: function () { return chunk4R2TBRS7_cjs.TABLE_EVALS; }
49
+ get: function () { return chunkGGYKYORQ_cjs.ScoresStorage; }
50
+ });
51
+ Object.defineProperty(exports, "StoreOperations", {
52
+ enumerable: true,
53
+ get: function () { return chunkGGYKYORQ_cjs.StoreOperations; }
54
+ });
55
+ Object.defineProperty(exports, "StoreOperationsInMemory", {
56
+ enumerable: true,
57
+ get: function () { return chunkGGYKYORQ_cjs.StoreOperationsInMemory; }
1775
58
  });
1776
59
  Object.defineProperty(exports, "TABLE_MESSAGES", {
1777
60
  enumerable: true,
1778
- get: function () { return chunk4R2TBRS7_cjs.TABLE_MESSAGES; }
61
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_MESSAGES; }
1779
62
  });
1780
63
  Object.defineProperty(exports, "TABLE_RESOURCES", {
1781
64
  enumerable: true,
1782
- get: function () { return chunk4R2TBRS7_cjs.TABLE_RESOURCES; }
65
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_RESOURCES; }
1783
66
  });
1784
67
  Object.defineProperty(exports, "TABLE_SCHEMAS", {
1785
68
  enumerable: true,
1786
- get: function () { return chunk4R2TBRS7_cjs.TABLE_SCHEMAS; }
69
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_SCHEMAS; }
1787
70
  });
1788
71
  Object.defineProperty(exports, "TABLE_SCORERS", {
1789
72
  enumerable: true,
1790
- get: function () { return chunk4R2TBRS7_cjs.TABLE_SCORERS; }
73
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_SCORERS; }
74
+ });
75
+ Object.defineProperty(exports, "TABLE_SPANS", {
76
+ enumerable: true,
77
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_SPANS; }
1791
78
  });
1792
79
  Object.defineProperty(exports, "TABLE_THREADS", {
1793
80
  enumerable: true,
1794
- get: function () { return chunk4R2TBRS7_cjs.TABLE_THREADS; }
81
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_THREADS; }
1795
82
  });
1796
83
  Object.defineProperty(exports, "TABLE_TRACES", {
1797
84
  enumerable: true,
1798
- get: function () { return chunk4R2TBRS7_cjs.TABLE_TRACES; }
85
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_TRACES; }
1799
86
  });
1800
87
  Object.defineProperty(exports, "TABLE_WORKFLOW_SNAPSHOT", {
1801
88
  enumerable: true,
1802
- get: function () { return chunk4R2TBRS7_cjs.TABLE_WORKFLOW_SNAPSHOT; }
89
+ get: function () { return chunkGGYKYORQ_cjs.TABLE_WORKFLOW_SNAPSHOT; }
90
+ });
91
+ Object.defineProperty(exports, "WorkflowsInMemory", {
92
+ enumerable: true,
93
+ get: function () { return chunkGGYKYORQ_cjs.WorkflowsInMemory; }
94
+ });
95
+ Object.defineProperty(exports, "WorkflowsStorage", {
96
+ enumerable: true,
97
+ get: function () { return chunkGGYKYORQ_cjs.WorkflowsStorage; }
98
+ });
99
+ Object.defineProperty(exports, "calculatePagination", {
100
+ enumerable: true,
101
+ get: function () { return chunkGGYKYORQ_cjs.calculatePagination; }
102
+ });
103
+ Object.defineProperty(exports, "ensureDate", {
104
+ enumerable: true,
105
+ get: function () { return chunkGGYKYORQ_cjs.ensureDate; }
106
+ });
107
+ Object.defineProperty(exports, "normalizePerPage", {
108
+ enumerable: true,
109
+ get: function () { return chunkGGYKYORQ_cjs.normalizePerPage; }
110
+ });
111
+ Object.defineProperty(exports, "safelyParseJSON", {
112
+ enumerable: true,
113
+ get: function () { return chunkGGYKYORQ_cjs.safelyParseJSON; }
114
+ });
115
+ Object.defineProperty(exports, "serializeDate", {
116
+ enumerable: true,
117
+ get: function () { return chunkGGYKYORQ_cjs.serializeDate; }
1803
118
  });
1804
- exports.InMemoryMemory = InMemoryMemory;
1805
- exports.InMemoryStore = InMemoryStore;
1806
- exports.LegacyEvalsStorage = LegacyEvalsStorage;
1807
- exports.MemoryStorage = MemoryStorage;
1808
- exports.MockStore = MockStore;
1809
- exports.ObservabilityInMemory = ObservabilityInMemory;
1810
- exports.ObservabilityStorage = ObservabilityStorage;
1811
- exports.ScoresInMemory = ScoresInMemory;
1812
- exports.ScoresStorage = ScoresStorage;
1813
- exports.StoreOperations = StoreOperations;
1814
- exports.StoreOperationsInMemory = StoreOperationsInMemory;
1815
- exports.TracesInMemory = TracesInMemory;
1816
- exports.TracesStorage = TracesStorage;
1817
- exports.WorkflowsInMemory = WorkflowsInMemory;
1818
- exports.WorkflowsStorage = WorkflowsStorage;
1819
- exports.safelyParseJSON = safelyParseJSON;
1820
119
  //# sourceMappingURL=index.cjs.map
1821
120
  //# sourceMappingURL=index.cjs.map