@mastra/server 0.0.0-bundle-recursion-20251030002519 → 0.0.0-bundle-studio-cloud-20251222034739

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 (376) hide show
  1. package/CHANGELOG.md +1341 -3
  2. package/README.md +2 -2
  3. package/dist/chunk-3BXS37TQ.js +1105 -0
  4. package/dist/chunk-3BXS37TQ.js.map +1 -0
  5. package/dist/chunk-3OAAPDGI.js +27529 -0
  6. package/dist/chunk-3OAAPDGI.js.map +1 -0
  7. package/dist/chunk-3SFLFUKY.js +116 -0
  8. package/dist/chunk-3SFLFUKY.js.map +1 -0
  9. package/dist/{chunk-KIHM7IDM.cjs → chunk-3XI22UQR.cjs} +31 -17
  10. package/dist/chunk-3XI22UQR.cjs.map +1 -0
  11. package/dist/chunk-5W4RPVTK.cjs +49 -0
  12. package/dist/chunk-5W4RPVTK.cjs.map +1 -0
  13. package/dist/{chunk-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
  14. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  15. package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
  16. package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
  17. package/dist/chunk-6V57U52D.js +196 -0
  18. package/dist/chunk-6V57U52D.js.map +1 -0
  19. package/dist/chunk-7KOS32XA.cjs +928 -0
  20. package/dist/chunk-7KOS32XA.cjs.map +1 -0
  21. package/dist/chunk-AZIH2QEC.js +83 -0
  22. package/dist/chunk-AZIH2QEC.js.map +1 -0
  23. package/dist/{chunk-LPM6BBAX.cjs → chunk-BMLUV4BH.cjs} +2 -53
  24. package/dist/chunk-BMLUV4BH.cjs.map +1 -0
  25. package/dist/chunk-BMYZ4DO6.cjs +269 -0
  26. package/dist/chunk-BMYZ4DO6.cjs.map +1 -0
  27. package/dist/chunk-BNGT3NIC.cjs +211 -0
  28. package/dist/chunk-BNGT3NIC.cjs.map +1 -0
  29. package/dist/chunk-C3UIIRAT.cjs +920 -0
  30. package/dist/chunk-C3UIIRAT.cjs.map +1 -0
  31. package/dist/chunk-DRUNNM4C.js +328 -0
  32. package/dist/chunk-DRUNNM4C.js.map +1 -0
  33. package/dist/{chunk-SHWNNZBL.js → chunk-DVSCJECS.js} +13 -17
  34. package/dist/chunk-DVSCJECS.js.map +1 -0
  35. package/dist/chunk-DW3WE4M4.js +250 -0
  36. package/dist/chunk-DW3WE4M4.js.map +1 -0
  37. package/dist/{chunk-RQK4FQUD.js → chunk-E646Y4FQ.js} +3 -45
  38. package/dist/chunk-E646Y4FQ.js.map +1 -0
  39. package/dist/chunk-EUBTCHQC.js +83 -0
  40. package/dist/chunk-EUBTCHQC.js.map +1 -0
  41. package/dist/chunk-FWSKVWS7.cjs +88 -0
  42. package/dist/chunk-FWSKVWS7.cjs.map +1 -0
  43. package/dist/chunk-FYY54HZC.js +310 -0
  44. package/dist/chunk-FYY54HZC.js.map +1 -0
  45. package/dist/chunk-GFF2I6UD.js +354 -0
  46. package/dist/chunk-GFF2I6UD.js.map +1 -0
  47. package/dist/{chunk-LZKJT7QP.cjs → chunk-GU4EWMZB.cjs} +34 -64
  48. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  49. package/dist/chunk-H2RMXG2Q.cjs +167 -0
  50. package/dist/chunk-H2RMXG2Q.cjs.map +1 -0
  51. package/dist/chunk-HAJOEDNB.js +274 -0
  52. package/dist/chunk-HAJOEDNB.js.map +1 -0
  53. package/dist/chunk-HT4LP3BO.js +75 -0
  54. package/dist/chunk-HT4LP3BO.js.map +1 -0
  55. package/dist/chunk-I6LR6CPC.cjs +125 -0
  56. package/dist/chunk-I6LR6CPC.cjs.map +1 -0
  57. package/dist/chunk-IEYXQTUW.cjs +284 -0
  58. package/dist/chunk-IEYXQTUW.cjs.map +1 -0
  59. package/dist/{chunk-X3G3KC47.cjs → chunk-JUYWLFVT.cjs} +239 -35
  60. package/dist/chunk-JUYWLFVT.cjs.map +1 -0
  61. package/dist/{chunk-2PLXW4ZX.cjs → chunk-K73YS7YB.cjs} +74 -74
  62. package/dist/{chunk-2PLXW4ZX.cjs.map → chunk-K73YS7YB.cjs.map} +1 -1
  63. package/dist/chunk-KPSSRYGH.js +234 -0
  64. package/dist/chunk-KPSSRYGH.js.map +1 -0
  65. package/dist/{chunk-GQRJOUV7.js → chunk-LF2ZLOFP.js} +34 -64
  66. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  67. package/dist/{chunk-QU6N55W6.cjs → chunk-LKTCAPBD.cjs} +17 -21
  68. package/dist/chunk-LKTCAPBD.cjs.map +1 -0
  69. package/dist/chunk-LQSZ4FJJ.cjs +205 -0
  70. package/dist/chunk-LQSZ4FJJ.cjs.map +1 -0
  71. package/dist/chunk-LXXDQQSW.cjs +27571 -0
  72. package/dist/chunk-LXXDQQSW.cjs.map +1 -0
  73. package/dist/chunk-MCYD5LW7.cjs +90 -0
  74. package/dist/chunk-MCYD5LW7.cjs.map +1 -0
  75. package/dist/chunk-MQLS6Z7A.js +891 -0
  76. package/dist/chunk-MQLS6Z7A.js.map +1 -0
  77. package/dist/chunk-P3H4AZKI.cjs +252 -0
  78. package/dist/chunk-P3H4AZKI.cjs.map +1 -0
  79. package/dist/chunk-P6S2HIVE.cjs +1149 -0
  80. package/dist/chunk-P6S2HIVE.cjs.map +1 -0
  81. package/dist/chunk-PUFCKXFW.cjs +312 -0
  82. package/dist/chunk-PUFCKXFW.cjs.map +1 -0
  83. package/dist/chunk-Q7NPRJRV.cjs +88 -0
  84. package/dist/chunk-Q7NPRJRV.cjs.map +1 -0
  85. package/dist/chunk-S3TIWWQL.cjs +322 -0
  86. package/dist/chunk-S3TIWWQL.cjs.map +1 -0
  87. package/dist/{chunk-THWIEXQQ.js → chunk-S5XBFHJL.js} +233 -35
  88. package/dist/chunk-S5XBFHJL.js.map +1 -0
  89. package/dist/chunk-SRQY5IWD.js +204 -0
  90. package/dist/chunk-SRQY5IWD.js.map +1 -0
  91. package/dist/{chunk-ZULZ2752.js → chunk-SV4AUWGY.js} +3 -3
  92. package/dist/{chunk-ZULZ2752.js.map → chunk-SV4AUWGY.js.map} +1 -1
  93. package/dist/chunk-SXVANU23.js +164 -0
  94. package/dist/chunk-SXVANU23.js.map +1 -0
  95. package/dist/chunk-TYZ6ZISQ.cjs +368 -0
  96. package/dist/chunk-TYZ6ZISQ.cjs.map +1 -0
  97. package/dist/chunk-UWRAKVAJ.js +903 -0
  98. package/dist/chunk-UWRAKVAJ.js.map +1 -0
  99. package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
  100. package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
  101. package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
  102. package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
  103. package/dist/{chunk-AQCEVRZV.js → chunk-WBLT2HL3.js} +22 -8
  104. package/dist/chunk-WBLT2HL3.js.map +1 -0
  105. package/dist/chunk-X43DWDXB.cjs +346 -0
  106. package/dist/chunk-X43DWDXB.cjs.map +1 -0
  107. package/dist/chunk-XW2HXQDO.js +302 -0
  108. package/dist/chunk-XW2HXQDO.js.map +1 -0
  109. package/dist/chunk-XWGAT2DA.js +44 -0
  110. package/dist/chunk-XWGAT2DA.js.map +1 -0
  111. package/dist/dist-2J26LQO2.cjs +16 -0
  112. package/dist/{dist-P4MXBQ3U.cjs.map → dist-2J26LQO2.cjs.map} +1 -1
  113. package/dist/{dist-X7XR3M3Z.js → dist-4CMHRWC4.js} +3 -3
  114. package/dist/{dist-X7XR3M3Z.js.map → dist-4CMHRWC4.js.map} +1 -1
  115. package/dist/{dist-PQZUVLPC.js → dist-AEJONJSS.js} +3 -3
  116. package/dist/{dist-PQZUVLPC.js.map → dist-AEJONJSS.js.map} +1 -1
  117. package/dist/{dist-G2BYZJOC.cjs → dist-AF7EUPXA.cjs} +28 -28
  118. package/dist/{dist-G2BYZJOC.cjs.map → dist-AF7EUPXA.cjs.map} +1 -1
  119. package/dist/dist-MEN73GGI.js +3 -0
  120. package/dist/{dist-YREX2TJT.js.map → dist-MEN73GGI.js.map} +1 -1
  121. package/dist/{dist-FZYCV3VB.cjs → dist-NVXXJWBO.cjs} +26 -26
  122. package/dist/{dist-FZYCV3VB.cjs.map → dist-NVXXJWBO.cjs.map} +1 -1
  123. package/dist/{dist-RFMYFILX.cjs → dist-Q2ST4SUQ.cjs} +30 -30
  124. package/dist/{dist-RFMYFILX.cjs.map → dist-Q2ST4SUQ.cjs.map} +1 -1
  125. package/dist/{dist-XVBSOGFK.js → dist-TE7XRSWH.js} +3 -3
  126. package/dist/{dist-XVBSOGFK.js.map → dist-TE7XRSWH.js.map} +1 -1
  127. package/dist/{dist-R7WYX6LC.js → dist-VPYZNWNG.js} +3 -3
  128. package/dist/{dist-R7WYX6LC.js.map → dist-VPYZNWNG.js.map} +1 -1
  129. package/dist/{dist-4MVGNSRL.cjs → dist-Y5SYUVLY.cjs} +20 -20
  130. package/dist/{dist-4MVGNSRL.cjs.map → dist-Y5SYUVLY.cjs.map} +1 -1
  131. package/dist/server/auth/defaults.d.ts +3 -0
  132. package/dist/server/auth/defaults.d.ts.map +1 -0
  133. package/dist/server/auth/helpers.d.ts +14 -0
  134. package/dist/server/auth/helpers.d.ts.map +1 -0
  135. package/dist/server/auth/index.cjs +137 -0
  136. package/dist/server/auth/index.cjs.map +1 -0
  137. package/dist/server/auth/index.d.ts +3 -0
  138. package/dist/server/auth/index.d.ts.map +1 -0
  139. package/dist/server/auth/index.js +127 -0
  140. package/dist/server/auth/index.js.map +1 -0
  141. package/dist/server/handlers/a2a.cjs +15 -7
  142. package/dist/server/handlers/a2a.d.ts +492 -10
  143. package/dist/server/handlers/a2a.d.ts.map +1 -1
  144. package/dist/server/handlers/a2a.js +1 -1
  145. package/dist/server/handlers/agent-builder.cjs +37 -45
  146. package/dist/server/handlers/agent-builder.d.ts +631 -99
  147. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  148. package/dist/server/handlers/agent-builder.js +1 -1
  149. package/dist/server/handlers/agents.cjs +55 -39
  150. package/dist/server/handlers/agents.d.ts +3302 -151
  151. package/dist/server/handlers/agents.d.ts.map +1 -1
  152. package/dist/server/handlers/agents.js +1 -1
  153. package/dist/server/handlers/error.cjs +2 -2
  154. package/dist/server/handlers/error.js +1 -1
  155. package/dist/server/handlers/logs.cjs +7 -7
  156. package/dist/server/handlers/logs.d.ts +135 -27
  157. package/dist/server/handlers/logs.d.ts.map +1 -1
  158. package/dist/server/handlers/logs.js +1 -1
  159. package/dist/server/handlers/mcp.cjs +40 -0
  160. package/dist/server/handlers/mcp.cjs.map +1 -0
  161. package/dist/server/handlers/mcp.d.ts +110 -0
  162. package/dist/server/handlers/mcp.d.ts.map +1 -0
  163. package/dist/server/handlers/mcp.js +3 -0
  164. package/dist/server/handlers/mcp.js.map +1 -0
  165. package/dist/server/handlers/memory.cjs +63 -31
  166. package/dist/server/handlers/memory.d.ts +934 -103
  167. package/dist/server/handlers/memory.d.ts.map +1 -1
  168. package/dist/server/handlers/memory.js +1 -1
  169. package/dist/server/handlers/observability.cjs +24 -8
  170. package/dist/server/handlers/observability.d.ts +128 -21
  171. package/dist/server/handlers/observability.d.ts.map +1 -1
  172. package/dist/server/handlers/observability.js +1 -1
  173. package/dist/server/handlers/scores.cjs +13 -13
  174. package/dist/server/handlers/scores.d.ts +110 -141
  175. package/dist/server/handlers/scores.d.ts.map +1 -1
  176. package/dist/server/handlers/scores.js +1 -1
  177. package/dist/server/handlers/stored-agents.cjs +28 -0
  178. package/dist/server/handlers/stored-agents.cjs.map +1 -0
  179. package/dist/server/handlers/stored-agents.d.ts +289 -0
  180. package/dist/server/handlers/stored-agents.d.ts.map +1 -0
  181. package/dist/server/handlers/stored-agents.js +3 -0
  182. package/dist/server/handlers/stored-agents.js.map +1 -0
  183. package/dist/server/handlers/test-utils.cjs +15 -0
  184. package/dist/server/handlers/test-utils.cjs.map +1 -0
  185. package/dist/server/handlers/test-utils.d.ts +6 -0
  186. package/dist/server/handlers/test-utils.d.ts.map +1 -0
  187. package/dist/server/handlers/test-utils.js +13 -0
  188. package/dist/server/handlers/test-utils.js.map +1 -0
  189. package/dist/server/handlers/tools.cjs +11 -11
  190. package/dist/server/handlers/tools.d.ts +69 -23
  191. package/dist/server/handlers/tools.d.ts.map +1 -1
  192. package/dist/server/handlers/tools.js +1 -1
  193. package/dist/server/handlers/utils.cjs +11 -3
  194. package/dist/server/handlers/utils.d.ts +5 -0
  195. package/dist/server/handlers/utils.d.ts.map +1 -1
  196. package/dist/server/handlers/utils.js +1 -1
  197. package/dist/server/handlers/vector.cjs +31 -7
  198. package/dist/server/handlers/vector.d.ts +93 -9
  199. package/dist/server/handlers/vector.d.ts.map +1 -1
  200. package/dist/server/handlers/vector.js +1 -1
  201. package/dist/server/handlers/voice.cjs +21 -9
  202. package/dist/server/handlers/voice.d.ts +81 -40
  203. package/dist/server/handlers/voice.d.ts.map +1 -1
  204. package/dist/server/handlers/voice.js +1 -1
  205. package/dist/server/handlers/workflows.cjs +65 -41
  206. package/dist/server/handlers/workflows.d.ts +998 -87
  207. package/dist/server/handlers/workflows.d.ts.map +1 -1
  208. package/dist/server/handlers/workflows.js +1 -1
  209. package/dist/server/handlers.cjs +33 -33
  210. package/dist/server/handlers.d.ts +1 -1
  211. package/dist/server/handlers.d.ts.map +1 -1
  212. package/dist/server/handlers.js +12 -12
  213. package/dist/server/http-exception.d.ts +0 -5
  214. package/dist/server/http-exception.d.ts.map +1 -1
  215. package/dist/server/schemas/a2a.d.ts +786 -0
  216. package/dist/server/schemas/a2a.d.ts.map +1 -0
  217. package/dist/server/schemas/agent-builder.d.ts +213 -0
  218. package/dist/server/schemas/agent-builder.d.ts.map +1 -0
  219. package/dist/server/schemas/agents.d.ts +1401 -0
  220. package/dist/server/schemas/agents.d.ts.map +1 -0
  221. package/dist/server/schemas/common.d.ts +179 -0
  222. package/dist/server/schemas/common.d.ts.map +1 -0
  223. package/dist/server/schemas/logs.d.ts +124 -0
  224. package/dist/server/schemas/logs.d.ts.map +1 -0
  225. package/dist/server/schemas/mcp.d.ts +299 -0
  226. package/dist/server/schemas/mcp.d.ts.map +1 -0
  227. package/dist/server/schemas/memory.d.ts +998 -0
  228. package/dist/server/schemas/memory.d.ts.map +1 -0
  229. package/dist/server/schemas/observability.d.ts +402 -0
  230. package/dist/server/schemas/observability.d.ts.map +1 -0
  231. package/dist/server/schemas/scores.d.ts +259 -0
  232. package/dist/server/schemas/scores.d.ts.map +1 -0
  233. package/dist/server/schemas/stored-agents.d.ts +792 -0
  234. package/dist/server/schemas/stored-agents.d.ts.map +1 -0
  235. package/dist/server/schemas/vectors.d.ts +107 -0
  236. package/dist/server/schemas/vectors.d.ts.map +1 -0
  237. package/dist/server/schemas/workflows.d.ts +668 -0
  238. package/dist/server/schemas/workflows.d.ts.map +1 -0
  239. package/dist/server/server-adapter/index.cjs +485 -0
  240. package/dist/server/server-adapter/index.cjs.map +1 -0
  241. package/dist/server/server-adapter/index.d.ts +91 -0
  242. package/dist/server/server-adapter/index.d.ts.map +1 -0
  243. package/dist/server/server-adapter/index.js +470 -0
  244. package/dist/server/server-adapter/index.js.map +1 -0
  245. package/dist/server/server-adapter/openapi-utils.d.ts +59 -0
  246. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -0
  247. package/dist/server/server-adapter/redact.d.ts +26 -0
  248. package/dist/server/server-adapter/redact.d.ts.map +1 -0
  249. package/dist/server/server-adapter/routes/a2a.d.ts +3 -0
  250. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -0
  251. package/dist/server/server-adapter/routes/agent-builder.d.ts +3 -0
  252. package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -0
  253. package/dist/server/server-adapter/routes/agents.d.ts +3 -0
  254. package/dist/server/server-adapter/routes/agents.d.ts.map +1 -0
  255. package/dist/server/server-adapter/routes/index.d.ts +50 -0
  256. package/dist/server/server-adapter/routes/index.d.ts.map +1 -0
  257. package/dist/server/server-adapter/routes/legacy.d.ts +7 -0
  258. package/dist/server/server-adapter/routes/legacy.d.ts.map +1 -0
  259. package/dist/server/server-adapter/routes/logs.d.ts +3 -0
  260. package/dist/server/server-adapter/routes/logs.d.ts.map +1 -0
  261. package/dist/server/server-adapter/routes/mcp.d.ts +9 -0
  262. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -0
  263. package/dist/server/server-adapter/routes/memory.d.ts +3 -0
  264. package/dist/server/server-adapter/routes/memory.d.ts.map +1 -0
  265. package/dist/server/server-adapter/routes/observability.d.ts +3 -0
  266. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -0
  267. package/dist/server/server-adapter/routes/route-builder.d.ts +52 -0
  268. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -0
  269. package/dist/server/server-adapter/routes/scorers.d.ts +3 -0
  270. package/dist/server/server-adapter/routes/scorers.d.ts.map +1 -0
  271. package/dist/server/server-adapter/routes/stored-agents.d.ts +8 -0
  272. package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -0
  273. package/dist/server/server-adapter/routes/stream-types.d.ts +10 -0
  274. package/dist/server/server-adapter/routes/stream-types.d.ts.map +1 -0
  275. package/dist/server/server-adapter/routes/tools.d.ts +3 -0
  276. package/dist/server/server-adapter/routes/tools.d.ts.map +1 -0
  277. package/dist/server/server-adapter/routes/vectors.d.ts +3 -0
  278. package/dist/server/server-adapter/routes/vectors.d.ts.map +1 -0
  279. package/dist/server/server-adapter/routes/workflows.d.ts +3 -0
  280. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -0
  281. package/dist/server/utils.d.ts +4 -3
  282. package/dist/server/utils.d.ts.map +1 -1
  283. package/dist/{token-375W3LEI.cjs → token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs} +11 -12
  284. package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +1 -0
  285. package/dist/{token-C3IMNCC4.js → token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js} +8 -9
  286. package/dist/token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js.map +1 -0
  287. package/dist/token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs +63 -0
  288. package/dist/token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs.map +1 -0
  289. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js +61 -0
  290. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +1 -0
  291. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +10 -0
  292. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map +1 -0
  293. package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js +8 -0
  294. package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js.map +1 -0
  295. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +8 -0
  296. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map +1 -0
  297. package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs +10 -0
  298. package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs.map +1 -0
  299. package/package.json +36 -9
  300. package/dist/chunk-2P4VRXBT.js +0 -533
  301. package/dist/chunk-2P4VRXBT.js.map +0 -1
  302. package/dist/chunk-2S4IMB6E.cjs +0 -130
  303. package/dist/chunk-2S4IMB6E.cjs.map +0 -1
  304. package/dist/chunk-3PXWQX3J.js +0 -692
  305. package/dist/chunk-3PXWQX3J.js.map +0 -1
  306. package/dist/chunk-3SNGNFUJ.cjs +0 -128
  307. package/dist/chunk-3SNGNFUJ.cjs.map +0 -1
  308. package/dist/chunk-4AKQUEI2.js +0 -698
  309. package/dist/chunk-4AKQUEI2.js.map +0 -1
  310. package/dist/chunk-4APSL4XM.cjs +0 -713
  311. package/dist/chunk-4APSL4XM.cjs.map +0 -1
  312. package/dist/chunk-4QCXUEAT.js +0 -25
  313. package/dist/chunk-4QCXUEAT.js.map +0 -1
  314. package/dist/chunk-ABRFV4XP.js +0 -83
  315. package/dist/chunk-ABRFV4XP.js.map +0 -1
  316. package/dist/chunk-AQCEVRZV.js.map +0 -1
  317. package/dist/chunk-AW5BU3RQ.js +0 -192
  318. package/dist/chunk-AW5BU3RQ.js.map +0 -1
  319. package/dist/chunk-BATEJLED.js +0 -124
  320. package/dist/chunk-BATEJLED.js.map +0 -1
  321. package/dist/chunk-EP3JQDPD.cjs +0 -131
  322. package/dist/chunk-EP3JQDPD.cjs.map +0 -1
  323. package/dist/chunk-EVI5NLZG.js +0 -323
  324. package/dist/chunk-EVI5NLZG.js.map +0 -1
  325. package/dist/chunk-FTBY7JHX.js +0 -19460
  326. package/dist/chunk-FTBY7JHX.js.map +0 -1
  327. package/dist/chunk-G4PUALCE.cjs +0 -28
  328. package/dist/chunk-G4PUALCE.cjs.map +0 -1
  329. package/dist/chunk-GDUKGVFI.cjs +0 -550
  330. package/dist/chunk-GDUKGVFI.cjs.map +0 -1
  331. package/dist/chunk-GQRJOUV7.js.map +0 -1
  332. package/dist/chunk-HQYKLJHG.cjs +0 -19501
  333. package/dist/chunk-HQYKLJHG.cjs.map +0 -1
  334. package/dist/chunk-KIHM7IDM.cjs.map +0 -1
  335. package/dist/chunk-LPM6BBAX.cjs.map +0 -1
  336. package/dist/chunk-LZKJT7QP.cjs.map +0 -1
  337. package/dist/chunk-MMROOK5J.js.map +0 -1
  338. package/dist/chunk-MYR4PVGN.js +0 -123
  339. package/dist/chunk-MYR4PVGN.js.map +0 -1
  340. package/dist/chunk-QQXMIP6C.js +0 -122
  341. package/dist/chunk-QQXMIP6C.js.map +0 -1
  342. package/dist/chunk-QU6N55W6.cjs.map +0 -1
  343. package/dist/chunk-RC5UZM7H.js +0 -160
  344. package/dist/chunk-RC5UZM7H.js.map +0 -1
  345. package/dist/chunk-RQK4FQUD.js.map +0 -1
  346. package/dist/chunk-SHWNNZBL.js.map +0 -1
  347. package/dist/chunk-SPRRK3P7.cjs +0 -200
  348. package/dist/chunk-SPRRK3P7.cjs.map +0 -1
  349. package/dist/chunk-THWIEXQQ.js.map +0 -1
  350. package/dist/chunk-TOCYBDP2.js +0 -46
  351. package/dist/chunk-TOCYBDP2.js.map +0 -1
  352. package/dist/chunk-X3G3KC47.cjs.map +0 -1
  353. package/dist/chunk-X6C7BUWN.cjs +0 -48
  354. package/dist/chunk-X6C7BUWN.cjs.map +0 -1
  355. package/dist/chunk-XN74I6VW.cjs +0 -88
  356. package/dist/chunk-XN74I6VW.cjs.map +0 -1
  357. package/dist/chunk-XUOE3PBE.cjs +0 -720
  358. package/dist/chunk-XUOE3PBE.cjs.map +0 -1
  359. package/dist/chunk-YAYIYIMS.cjs +0 -335
  360. package/dist/chunk-YAYIYIMS.cjs.map +0 -1
  361. package/dist/chunk-YYXITBYY.cjs +0 -167
  362. package/dist/chunk-YYXITBYY.cjs.map +0 -1
  363. package/dist/dist-P4MXBQ3U.cjs +0 -16
  364. package/dist/dist-YREX2TJT.js +0 -3
  365. package/dist/server/handlers/legacyWorkflows.cjs +0 -48
  366. package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
  367. package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
  368. package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
  369. package/dist/server/handlers/legacyWorkflows.js +0 -3
  370. package/dist/server/handlers/legacyWorkflows.js.map +0 -1
  371. package/dist/token-375W3LEI.cjs.map +0 -1
  372. package/dist/token-C3IMNCC4.js.map +0 -1
  373. package/dist/token-util-CV3RRG6K.cjs +0 -9
  374. package/dist/token-util-CV3RRG6K.cjs.map +0 -1
  375. package/dist/token-util-E5QO2RCL.js +0 -7
  376. package/dist/token-util-E5QO2RCL.js.map +0 -1
@@ -1,698 +0,0 @@
1
- import { getWorkflowInfo, WorkflowRegistry } from './chunk-AQCEVRZV.js';
2
- import { handleError } from './chunk-CY4TP3FK.js';
3
- import { HTTPException } from './chunk-MMROOK5J.js';
4
- import { __export } from './chunk-PR4QN5HX.js';
5
- import { ReadableStream, TransformStream } from 'stream/web';
6
-
7
- // src/server/handlers/workflows.ts
8
- var workflows_exports = {};
9
- __export(workflows_exports, {
10
- cancelWorkflowRunHandler: () => cancelWorkflowRunHandler,
11
- createWorkflowRunHandler: () => createWorkflowRunHandler,
12
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
13
- getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
14
- getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
15
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
16
- getWorkflowsHandler: () => getWorkflowsHandler,
17
- observeStreamLegacyWorkflowHandler: () => observeStreamLegacyWorkflowHandler,
18
- observeStreamVNextWorkflowHandler: () => observeStreamVNextWorkflowHandler,
19
- observeStreamWorkflowHandler: () => observeStreamWorkflowHandler,
20
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
21
- resumeStreamWorkflowHandler: () => resumeStreamWorkflowHandler,
22
- resumeWorkflowHandler: () => resumeWorkflowHandler,
23
- sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
24
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
25
- startWorkflowRunHandler: () => startWorkflowRunHandler,
26
- streamLegacyWorkflowHandler: () => streamLegacyWorkflowHandler,
27
- streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
28
- streamWorkflowHandler: () => streamWorkflowHandler,
29
- watchWorkflowHandler: () => watchWorkflowHandler
30
- });
31
- async function getWorkflowsHandler({ mastra }) {
32
- try {
33
- const workflows = mastra.getWorkflows({ serialized: false });
34
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
35
- acc[key] = getWorkflowInfo(workflow);
36
- return acc;
37
- }, {});
38
- return _workflows;
39
- } catch (error) {
40
- return handleError(error, "Error getting workflows");
41
- }
42
- }
43
- async function getWorkflowsFromSystem({ mastra, workflowId }) {
44
- const logger = mastra.getLogger();
45
- if (!workflowId) {
46
- throw new HTTPException(400, { message: "Workflow ID is required" });
47
- }
48
- let workflow;
49
- workflow = WorkflowRegistry.getWorkflow(workflowId);
50
- if (!workflow) {
51
- try {
52
- workflow = mastra.getWorkflow(workflowId);
53
- } catch (error) {
54
- logger.debug("Error getting workflow, searching agents for workflow", error);
55
- }
56
- }
57
- if (!workflow) {
58
- logger.debug("Workflow not found, searching agents for workflow", { workflowId });
59
- const agents = mastra.getAgents();
60
- if (Object.keys(agents || {}).length) {
61
- for (const [_, agent] of Object.entries(agents)) {
62
- try {
63
- const workflows = await agent.getWorkflows();
64
- if (workflows[workflowId]) {
65
- workflow = workflows[workflowId];
66
- break;
67
- }
68
- break;
69
- } catch (error) {
70
- logger.debug("Error getting workflow from agent", error);
71
- }
72
- }
73
- }
74
- }
75
- if (!workflow) {
76
- throw new HTTPException(404, { message: "Workflow not found" });
77
- }
78
- return { workflow };
79
- }
80
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
81
- try {
82
- if (!workflowId) {
83
- throw new HTTPException(400, { message: "Workflow ID is required" });
84
- }
85
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
86
- if (!workflow) {
87
- throw new HTTPException(404, { message: "Workflow not found" });
88
- }
89
- return getWorkflowInfo(workflow);
90
- } catch (error) {
91
- return handleError(error, "Error getting workflow");
92
- }
93
- }
94
- async function getWorkflowRunByIdHandler({
95
- mastra,
96
- workflowId,
97
- runId
98
- }) {
99
- try {
100
- if (!workflowId) {
101
- throw new HTTPException(400, { message: "Workflow ID is required" });
102
- }
103
- if (!runId) {
104
- throw new HTTPException(400, { message: "Run ID is required" });
105
- }
106
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
107
- if (!workflow) {
108
- throw new HTTPException(404, { message: "Workflow not found" });
109
- }
110
- const run = await workflow.getWorkflowRunById(runId);
111
- if (!run) {
112
- throw new HTTPException(404, { message: "Workflow run not found" });
113
- }
114
- return run;
115
- } catch (error) {
116
- return handleError(error, "Error getting workflow run");
117
- }
118
- }
119
- async function getWorkflowRunExecutionResultHandler({
120
- mastra,
121
- workflowId,
122
- runId
123
- }) {
124
- try {
125
- if (!workflowId) {
126
- throw new HTTPException(400, { message: "Workflow ID is required" });
127
- }
128
- if (!runId) {
129
- throw new HTTPException(400, { message: "Run ID is required" });
130
- }
131
- const workflow = mastra.getWorkflow(workflowId);
132
- if (!workflow) {
133
- throw new HTTPException(404, { message: "Workflow not found" });
134
- }
135
- const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
136
- if (!executionResult) {
137
- throw new HTTPException(404, { message: "Workflow run execution result not found" });
138
- }
139
- return executionResult;
140
- } catch (error) {
141
- return handleError(error, "Error getting workflow run execution result");
142
- }
143
- }
144
- async function createWorkflowRunHandler({
145
- mastra,
146
- workflowId,
147
- runId: prevRunId
148
- }) {
149
- try {
150
- if (!workflowId) {
151
- throw new HTTPException(400, { message: "Workflow ID is required" });
152
- }
153
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
154
- if (!workflow) {
155
- throw new HTTPException(404, { message: "Workflow not found" });
156
- }
157
- const run = await workflow.createRunAsync({ runId: prevRunId });
158
- return { runId: run.runId };
159
- } catch (error) {
160
- return handleError(error, "Error creating workflow run");
161
- }
162
- }
163
- async function startAsyncWorkflowHandler({
164
- mastra,
165
- runtimeContext,
166
- workflowId,
167
- runId,
168
- inputData,
169
- tracingOptions
170
- }) {
171
- try {
172
- if (!workflowId) {
173
- throw new HTTPException(400, { message: "Workflow ID is required" });
174
- }
175
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
176
- if (!workflow) {
177
- throw new HTTPException(404, { message: "Workflow not found" });
178
- }
179
- const _run = await workflow.createRunAsync({ runId });
180
- const result = await _run.start({
181
- inputData,
182
- runtimeContext,
183
- tracingOptions
184
- });
185
- return result;
186
- } catch (error) {
187
- return handleError(error, "Error starting async workflow");
188
- }
189
- }
190
- async function startWorkflowRunHandler({
191
- mastra,
192
- runtimeContext,
193
- workflowId,
194
- runId,
195
- inputData,
196
- tracingOptions
197
- }) {
198
- try {
199
- if (!workflowId) {
200
- throw new HTTPException(400, { message: "Workflow ID is required" });
201
- }
202
- if (!runId) {
203
- throw new HTTPException(400, { message: "runId required to start run" });
204
- }
205
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
206
- if (!workflow) {
207
- throw new HTTPException(404, { message: "Workflow not found" });
208
- }
209
- const run = await workflow.getWorkflowRunById(runId);
210
- if (!run) {
211
- throw new HTTPException(404, { message: "Workflow run not found" });
212
- }
213
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
214
- void _run.start({
215
- inputData,
216
- runtimeContext,
217
- tracingOptions
218
- });
219
- return { message: "Workflow run started" };
220
- } catch (e) {
221
- return handleError(e, "Error starting workflow run");
222
- }
223
- }
224
- async function watchWorkflowHandler({
225
- mastra,
226
- workflowId,
227
- runId,
228
- eventType = "watch"
229
- }) {
230
- try {
231
- if (!workflowId) {
232
- throw new HTTPException(400, { message: "Workflow ID is required" });
233
- }
234
- if (!runId) {
235
- throw new HTTPException(400, { message: "runId required to watch workflow" });
236
- }
237
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
238
- if (!workflow) {
239
- throw new HTTPException(404, { message: "Workflow not found" });
240
- }
241
- const run = await workflow.getWorkflowRunById(runId);
242
- if (!run) {
243
- throw new HTTPException(404, { message: "Workflow run not found" });
244
- }
245
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
246
- let unwatch;
247
- let asyncRef = null;
248
- const stream = new ReadableStream({
249
- start(controller) {
250
- if (eventType === "watch") {
251
- unwatch = _run.watch((event) => {
252
- const { type, payload, eventTimestamp } = event;
253
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
254
- if (asyncRef) {
255
- clearImmediate(asyncRef);
256
- asyncRef = null;
257
- }
258
- asyncRef = setImmediate(async () => {
259
- const runDone = payload.workflowState?.status !== "running";
260
- if (runDone) {
261
- controller.close();
262
- unwatch?.();
263
- }
264
- });
265
- }, eventType);
266
- } else {
267
- unwatch = _run.watch((event) => {
268
- const { type, payload } = event;
269
- controller.enqueue(JSON.stringify({ type, payload, runId }));
270
- if (asyncRef) {
271
- clearImmediate(asyncRef);
272
- asyncRef = null;
273
- }
274
- asyncRef = setImmediate(async () => {
275
- const runDone = type === "workflow-finish";
276
- if (runDone) {
277
- controller.close();
278
- unwatch?.();
279
- }
280
- });
281
- }, eventType);
282
- }
283
- },
284
- cancel() {
285
- if (asyncRef) {
286
- clearImmediate(asyncRef);
287
- asyncRef = null;
288
- }
289
- unwatch?.();
290
- }
291
- });
292
- return stream;
293
- } catch (error) {
294
- return handleError(error, "Error watching workflow");
295
- }
296
- }
297
- async function streamWorkflowHandler({
298
- mastra,
299
- runtimeContext,
300
- workflowId,
301
- runId,
302
- inputData,
303
- tracingOptions
304
- }) {
305
- return streamVNextWorkflowHandler({ mastra, workflowId, runId, inputData, runtimeContext, tracingOptions });
306
- }
307
- async function streamLegacyWorkflowHandler({
308
- mastra,
309
- runtimeContext,
310
- workflowId,
311
- runId,
312
- inputData,
313
- tracingOptions
314
- }) {
315
- try {
316
- if (!workflowId) {
317
- throw new HTTPException(400, { message: "Workflow ID is required" });
318
- }
319
- if (!runId) {
320
- throw new HTTPException(400, { message: "runId required to resume workflow" });
321
- }
322
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
323
- if (!workflow) {
324
- throw new HTTPException(404, { message: "Workflow not found" });
325
- }
326
- const serverCache = mastra.getServerCache();
327
- const run = await workflow.createRunAsync({ runId });
328
- const result = run.streamLegacy({
329
- inputData,
330
- runtimeContext,
331
- onChunk: async (chunk) => {
332
- if (serverCache) {
333
- const cacheKey = runId;
334
- await serverCache.listPush(cacheKey, chunk);
335
- }
336
- },
337
- tracingOptions
338
- });
339
- return result;
340
- } catch (error) {
341
- return handleError(error, "Error executing workflow");
342
- }
343
- }
344
- async function observeStreamLegacyWorkflowHandler({
345
- mastra,
346
- workflowId,
347
- runId
348
- }) {
349
- try {
350
- if (!workflowId) {
351
- throw new HTTPException(400, { message: "Workflow ID is required" });
352
- }
353
- if (!runId) {
354
- throw new HTTPException(400, { message: "runId required to observe workflow stream" });
355
- }
356
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
357
- if (!workflow) {
358
- throw new HTTPException(404, { message: "Workflow not found" });
359
- }
360
- const run = await workflow.getWorkflowRunById(runId);
361
- if (!run) {
362
- throw new HTTPException(404, { message: "Workflow run not found" });
363
- }
364
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
365
- const serverCache = mastra.getServerCache();
366
- if (!serverCache) {
367
- throw new HTTPException(500, { message: "Server cache not found" });
368
- }
369
- const transformStream = new TransformStream();
370
- const writer = transformStream.writable.getWriter();
371
- const cachedRunChunks = await serverCache.listFromTo(runId, 0);
372
- for (const chunk of cachedRunChunks) {
373
- await writer.write(chunk);
374
- }
375
- writer.releaseLock();
376
- const result = _run.observeStreamLegacy();
377
- return result.stream?.pipeThrough(transformStream);
378
- } catch (error) {
379
- return handleError(error, "Error observing workflow stream");
380
- }
381
- }
382
- async function observeStreamWorkflowHandler({
383
- mastra,
384
- workflowId,
385
- runId
386
- }) {
387
- return observeStreamVNextWorkflowHandler({ mastra, workflowId, runId });
388
- }
389
- async function streamVNextWorkflowHandler({
390
- mastra,
391
- runtimeContext,
392
- workflowId,
393
- runId,
394
- inputData,
395
- closeOnSuspend,
396
- tracingOptions
397
- }) {
398
- try {
399
- if (!workflowId) {
400
- throw new HTTPException(400, { message: "Workflow ID is required" });
401
- }
402
- if (!runId) {
403
- throw new HTTPException(400, { message: "runId required to stream workflow" });
404
- }
405
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
406
- if (!workflow) {
407
- throw new HTTPException(404, { message: "Workflow not found" });
408
- }
409
- const serverCache = mastra.getServerCache();
410
- const run = await workflow.createRunAsync({ runId });
411
- const result = run.stream({
412
- inputData,
413
- runtimeContext,
414
- closeOnSuspend,
415
- tracingOptions
416
- });
417
- return result.fullStream.pipeThrough(
418
- new TransformStream({
419
- transform(chunk, controller) {
420
- if (serverCache) {
421
- const cacheKey = runId;
422
- serverCache.listPush(cacheKey, chunk).catch(() => {
423
- });
424
- }
425
- controller.enqueue(chunk);
426
- }
427
- })
428
- );
429
- } catch (error) {
430
- return handleError(error, "Error streaming workflow");
431
- }
432
- }
433
- async function observeStreamVNextWorkflowHandler({
434
- mastra,
435
- workflowId,
436
- runId
437
- }) {
438
- try {
439
- if (!workflowId) {
440
- throw new HTTPException(400, { message: "Workflow ID is required" });
441
- }
442
- if (!runId) {
443
- throw new HTTPException(400, { message: "runId required to observe workflow stream" });
444
- }
445
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
446
- if (!workflow) {
447
- throw new HTTPException(404, { message: "Workflow not found" });
448
- }
449
- const run = await workflow.getWorkflowRunById(runId);
450
- if (!run) {
451
- throw new HTTPException(404, { message: "Workflow run not found" });
452
- }
453
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
454
- const serverCache = mastra.getServerCache();
455
- if (!serverCache) {
456
- throw new HTTPException(500, { message: "Server cache not found" });
457
- }
458
- const cachedRunChunks = await serverCache.listFromTo(runId, 0);
459
- const combinedStream = new ReadableStream({
460
- start(controller) {
461
- const emitCachedChunks = async () => {
462
- for (const chunk of cachedRunChunks) {
463
- controller.enqueue(chunk);
464
- }
465
- };
466
- const liveStream = _run.observeStream();
467
- const reader = liveStream.getReader();
468
- const pump = async () => {
469
- try {
470
- while (true) {
471
- const { done, value } = await reader.read();
472
- if (done) {
473
- controller.close();
474
- break;
475
- }
476
- controller.enqueue(value);
477
- }
478
- } catch (error) {
479
- controller.error(error);
480
- } finally {
481
- reader.releaseLock();
482
- }
483
- };
484
- void emitCachedChunks().then(() => {
485
- void pump();
486
- }).catch((error) => {
487
- controller.error(error);
488
- });
489
- }
490
- });
491
- return combinedStream;
492
- } catch (error) {
493
- return handleError(error, "Error observing workflow stream");
494
- }
495
- }
496
- async function resumeAsyncWorkflowHandler({
497
- mastra,
498
- workflowId,
499
- runId,
500
- body,
501
- runtimeContext,
502
- tracingOptions
503
- }) {
504
- try {
505
- if (!workflowId) {
506
- throw new HTTPException(400, { message: "Workflow ID is required" });
507
- }
508
- if (!runId) {
509
- throw new HTTPException(400, { message: "runId required to resume workflow" });
510
- }
511
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
512
- if (!workflow) {
513
- throw new HTTPException(404, { message: "Workflow not found" });
514
- }
515
- const run = await workflow.getWorkflowRunById(runId);
516
- if (!run) {
517
- throw new HTTPException(404, { message: "Workflow run not found" });
518
- }
519
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
520
- const result = await _run.resume({
521
- step: body.step,
522
- resumeData: body.resumeData,
523
- runtimeContext,
524
- tracingOptions
525
- });
526
- return result;
527
- } catch (error) {
528
- return handleError(error, "Error resuming workflow step");
529
- }
530
- }
531
- async function resumeWorkflowHandler({
532
- mastra,
533
- workflowId,
534
- runId,
535
- body,
536
- runtimeContext,
537
- tracingOptions
538
- }) {
539
- try {
540
- if (!workflowId) {
541
- throw new HTTPException(400, { message: "Workflow ID is required" });
542
- }
543
- if (!runId) {
544
- throw new HTTPException(400, { message: "runId required to resume workflow" });
545
- }
546
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
547
- if (!workflow) {
548
- throw new HTTPException(404, { message: "Workflow not found" });
549
- }
550
- const run = await workflow.getWorkflowRunById(runId);
551
- if (!run) {
552
- throw new HTTPException(404, { message: "Workflow run not found" });
553
- }
554
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
555
- void _run.resume({
556
- step: body.step,
557
- resumeData: body.resumeData,
558
- runtimeContext,
559
- tracingOptions
560
- });
561
- return { message: "Workflow run resumed" };
562
- } catch (error) {
563
- return handleError(error, "Error resuming workflow");
564
- }
565
- }
566
- async function resumeStreamWorkflowHandler({
567
- mastra,
568
- workflowId,
569
- runId,
570
- body,
571
- runtimeContext,
572
- tracingOptions
573
- }) {
574
- try {
575
- if (!workflowId) {
576
- throw new HTTPException(400, { message: "Workflow ID is required" });
577
- }
578
- if (!runId) {
579
- throw new HTTPException(400, { message: "runId required to resume workflow" });
580
- }
581
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
582
- if (!workflow) {
583
- throw new HTTPException(404, { message: "Workflow not found" });
584
- }
585
- const run = await workflow.getWorkflowRunById(runId);
586
- if (!run) {
587
- throw new HTTPException(404, { message: "Workflow run not found" });
588
- }
589
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
590
- const serverCache = mastra.getServerCache();
591
- const stream = _run.resumeStream({
592
- step: body.step,
593
- resumeData: body.resumeData,
594
- runtimeContext,
595
- tracingOptions
596
- }).fullStream.pipeThrough(
597
- new TransformStream({
598
- transform(chunk, controller) {
599
- if (serverCache) {
600
- const cacheKey = runId;
601
- serverCache.listPush(cacheKey, chunk).catch(() => {
602
- });
603
- }
604
- controller.enqueue(chunk);
605
- }
606
- })
607
- );
608
- return stream;
609
- } catch (error) {
610
- return handleError(error, "Error resuming workflow");
611
- }
612
- }
613
- async function getWorkflowRunsHandler({
614
- mastra,
615
- workflowId,
616
- fromDate,
617
- toDate,
618
- limit,
619
- offset,
620
- resourceId
621
- }) {
622
- try {
623
- if (!workflowId) {
624
- throw new HTTPException(400, { message: "Workflow ID is required" });
625
- }
626
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
627
- if (!workflow) {
628
- throw new HTTPException(404, { message: "Workflow not found" });
629
- }
630
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
631
- runs: [],
632
- total: 0
633
- };
634
- return workflowRuns;
635
- } catch (error) {
636
- return handleError(error, "Error getting workflow runs");
637
- }
638
- }
639
- async function cancelWorkflowRunHandler({
640
- mastra,
641
- workflowId,
642
- runId
643
- }) {
644
- try {
645
- if (!workflowId) {
646
- throw new HTTPException(400, { message: "Workflow ID is required" });
647
- }
648
- if (!runId) {
649
- throw new HTTPException(400, { message: "runId required to cancel workflow run" });
650
- }
651
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
652
- if (!workflow) {
653
- throw new HTTPException(404, { message: "Workflow not found" });
654
- }
655
- const run = await workflow.getWorkflowRunById(runId);
656
- if (!run) {
657
- throw new HTTPException(404, { message: "Workflow run not found" });
658
- }
659
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
660
- await _run.cancel();
661
- return { message: "Workflow run cancelled" };
662
- } catch (error) {
663
- return handleError(error, "Error canceling workflow run");
664
- }
665
- }
666
- async function sendWorkflowRunEventHandler({
667
- mastra,
668
- workflowId,
669
- runId,
670
- event,
671
- data
672
- }) {
673
- try {
674
- if (!workflowId) {
675
- throw new HTTPException(400, { message: "Workflow ID is required" });
676
- }
677
- if (!runId) {
678
- throw new HTTPException(400, { message: "runId required to send workflow run event" });
679
- }
680
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
681
- if (!workflow) {
682
- throw new HTTPException(404, { message: "Workflow not found" });
683
- }
684
- const run = await workflow.getWorkflowRunById(runId);
685
- if (!run) {
686
- throw new HTTPException(404, { message: "Workflow run not found" });
687
- }
688
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
689
- await _run.sendEvent(event, data);
690
- return { message: "Workflow run event sent" };
691
- } catch (error) {
692
- return handleError(error, "Error sending workflow run event");
693
- }
694
- }
695
-
696
- export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, observeStreamLegacyWorkflowHandler, observeStreamVNextWorkflowHandler, observeStreamWorkflowHandler, resumeAsyncWorkflowHandler, resumeStreamWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamLegacyWorkflowHandler, streamVNextWorkflowHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
697
- //# sourceMappingURL=chunk-4AKQUEI2.js.map
698
- //# sourceMappingURL=chunk-4AKQUEI2.js.map