@mastra/core 0.24.0 → 1.0.0-beta.0

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