@mastra/server 0.0.0-new-scorer-api-20250801075530 → 0.0.0-new-button-export-20251219130424

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 (402) hide show
  1. package/CHANGELOG.md +5548 -0
  2. package/README.md +2 -7
  3. package/dist/chunk-3BXS37TQ.js +1105 -0
  4. package/dist/chunk-3BXS37TQ.js.map +1 -0
  5. package/dist/chunk-3SFLFUKY.js +116 -0
  6. package/dist/chunk-3SFLFUKY.js.map +1 -0
  7. package/dist/chunk-3XI22UQR.cjs +148 -0
  8. package/dist/chunk-3XI22UQR.cjs.map +1 -0
  9. package/dist/chunk-5W4RPVTK.cjs +49 -0
  10. package/dist/chunk-5W4RPVTK.cjs.map +1 -0
  11. package/dist/{chunk-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
  12. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  13. package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
  14. package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
  15. package/dist/chunk-6V57U52D.js +196 -0
  16. package/dist/chunk-6V57U52D.js.map +1 -0
  17. package/dist/chunk-7KOS32XA.cjs +928 -0
  18. package/dist/chunk-7KOS32XA.cjs.map +1 -0
  19. package/dist/chunk-AZIH2QEC.js +83 -0
  20. package/dist/chunk-AZIH2QEC.js.map +1 -0
  21. package/dist/chunk-BMLUV4BH.cjs +992 -0
  22. package/dist/chunk-BMLUV4BH.cjs.map +1 -0
  23. package/dist/chunk-BMYZ4DO6.cjs +269 -0
  24. package/dist/chunk-BMYZ4DO6.cjs.map +1 -0
  25. package/dist/chunk-BNGT3NIC.cjs +211 -0
  26. package/dist/chunk-BNGT3NIC.cjs.map +1 -0
  27. package/dist/chunk-C3UIIRAT.cjs +920 -0
  28. package/dist/chunk-C3UIIRAT.cjs.map +1 -0
  29. package/dist/chunk-DRUNNM4C.js +328 -0
  30. package/dist/chunk-DRUNNM4C.js.map +1 -0
  31. package/dist/chunk-DVSCJECS.js +250 -0
  32. package/dist/chunk-DVSCJECS.js.map +1 -0
  33. package/dist/chunk-DW3WE4M4.js +250 -0
  34. package/dist/chunk-DW3WE4M4.js.map +1 -0
  35. package/dist/chunk-E646Y4FQ.js +970 -0
  36. package/dist/chunk-E646Y4FQ.js.map +1 -0
  37. package/dist/chunk-EUBTCHQC.js +83 -0
  38. package/dist/chunk-EUBTCHQC.js.map +1 -0
  39. package/dist/chunk-FWSKVWS7.cjs +88 -0
  40. package/dist/chunk-FWSKVWS7.cjs.map +1 -0
  41. package/dist/chunk-FYY54HZC.js +310 -0
  42. package/dist/chunk-FYY54HZC.js.map +1 -0
  43. package/dist/chunk-GFF2I6UD.js +354 -0
  44. package/dist/chunk-GFF2I6UD.js.map +1 -0
  45. package/dist/chunk-GU4EWMZB.cjs +769 -0
  46. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  47. package/dist/chunk-H2RMXG2Q.cjs +167 -0
  48. package/dist/chunk-H2RMXG2Q.cjs.map +1 -0
  49. package/dist/chunk-HAJOEDNB.js +274 -0
  50. package/dist/chunk-HAJOEDNB.js.map +1 -0
  51. package/dist/chunk-HT4LP3BO.js +75 -0
  52. package/dist/chunk-HT4LP3BO.js.map +1 -0
  53. package/dist/chunk-I6LR6CPC.cjs +125 -0
  54. package/dist/chunk-I6LR6CPC.cjs.map +1 -0
  55. package/dist/chunk-IEYXQTUW.cjs +284 -0
  56. package/dist/chunk-IEYXQTUW.cjs.map +1 -0
  57. package/dist/chunk-JUYWLFVT.cjs +689 -0
  58. package/dist/chunk-JUYWLFVT.cjs.map +1 -0
  59. package/dist/chunk-K73YS7YB.cjs +2777 -0
  60. package/dist/chunk-K73YS7YB.cjs.map +1 -0
  61. package/dist/chunk-KPSSRYGH.js +234 -0
  62. package/dist/chunk-KPSSRYGH.js.map +1 -0
  63. package/dist/chunk-LF2ZLOFP.js +767 -0
  64. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  65. package/dist/chunk-LH722MPX.cjs +27569 -0
  66. package/dist/chunk-LH722MPX.cjs.map +1 -0
  67. package/dist/chunk-LKTCAPBD.cjs +252 -0
  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-MCYD5LW7.cjs +90 -0
  72. package/dist/chunk-MCYD5LW7.cjs.map +1 -0
  73. package/dist/chunk-MQLS6Z7A.js +891 -0
  74. package/dist/chunk-MQLS6Z7A.js.map +1 -0
  75. package/dist/chunk-O7I5CWRX.cjs +44 -0
  76. package/dist/{chunk-Q7SFCCGT.cjs.map → chunk-O7I5CWRX.cjs.map} +1 -1
  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-PR4QN5HX.js +39 -0
  82. package/dist/{chunk-PZ5AY32C.js.map → chunk-PR4QN5HX.js.map} +1 -1
  83. package/dist/chunk-PUFCKXFW.cjs +312 -0
  84. package/dist/chunk-PUFCKXFW.cjs.map +1 -0
  85. package/dist/chunk-Q7NPRJRV.cjs +88 -0
  86. package/dist/chunk-Q7NPRJRV.cjs.map +1 -0
  87. package/dist/chunk-S3TIWWQL.cjs +322 -0
  88. package/dist/chunk-S3TIWWQL.cjs.map +1 -0
  89. package/dist/chunk-S5XBFHJL.js +675 -0
  90. package/dist/chunk-S5XBFHJL.js.map +1 -0
  91. package/dist/chunk-SRQY5IWD.js +204 -0
  92. package/dist/chunk-SRQY5IWD.js.map +1 -0
  93. package/dist/chunk-SV4AUWGY.js +2774 -0
  94. package/dist/chunk-SV4AUWGY.js.map +1 -0
  95. package/dist/chunk-SXVANU23.js +164 -0
  96. package/dist/chunk-SXVANU23.js.map +1 -0
  97. package/dist/chunk-TYZ6ZISQ.cjs +368 -0
  98. package/dist/chunk-TYZ6ZISQ.cjs.map +1 -0
  99. package/dist/chunk-UWRAKVAJ.js +903 -0
  100. package/dist/chunk-UWRAKVAJ.js.map +1 -0
  101. package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
  102. package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
  103. package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
  104. package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
  105. package/dist/chunk-WBLT2HL3.js +144 -0
  106. package/dist/chunk-WBLT2HL3.js.map +1 -0
  107. package/dist/chunk-X43DWDXB.cjs +346 -0
  108. package/dist/chunk-X43DWDXB.cjs.map +1 -0
  109. package/dist/chunk-XW2HXQDO.js +302 -0
  110. package/dist/chunk-XW2HXQDO.js.map +1 -0
  111. package/dist/chunk-XWGAT2DA.js +44 -0
  112. package/dist/chunk-XWGAT2DA.js.map +1 -0
  113. package/dist/chunk-ZSD2NWTP.js +27527 -0
  114. package/dist/chunk-ZSD2NWTP.js.map +1 -0
  115. package/dist/dist-2J26LQO2.cjs +16 -0
  116. package/dist/dist-2J26LQO2.cjs.map +1 -0
  117. package/dist/dist-4CMHRWC4.js +1147 -0
  118. package/dist/dist-4CMHRWC4.js.map +1 -0
  119. package/dist/dist-AEJONJSS.js +937 -0
  120. package/dist/dist-AEJONJSS.js.map +1 -0
  121. package/dist/dist-AF7EUPXA.cjs +928 -0
  122. package/dist/dist-AF7EUPXA.cjs.map +1 -0
  123. package/dist/dist-MEN73GGI.js +3 -0
  124. package/dist/dist-MEN73GGI.js.map +1 -0
  125. package/dist/dist-NVXXJWBO.cjs +940 -0
  126. package/dist/dist-NVXXJWBO.cjs.map +1 -0
  127. package/dist/dist-Q2ST4SUQ.cjs +764 -0
  128. package/dist/dist-Q2ST4SUQ.cjs.map +1 -0
  129. package/dist/dist-TE7XRSWH.js +761 -0
  130. package/dist/dist-TE7XRSWH.js.map +1 -0
  131. package/dist/dist-VPYZNWNG.js +925 -0
  132. package/dist/dist-VPYZNWNG.js.map +1 -0
  133. package/dist/dist-Y5SYUVLY.cjs +1150 -0
  134. package/dist/dist-Y5SYUVLY.cjs.map +1 -0
  135. package/dist/index.cjs +4 -0
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.js +3 -0
  138. package/dist/index.js.map +1 -1
  139. package/dist/server/a2a/store.cjs +25 -0
  140. package/dist/server/a2a/store.cjs.map +1 -0
  141. package/dist/server/a2a/store.d.ts +3 -3
  142. package/dist/server/a2a/store.d.ts.map +1 -1
  143. package/dist/server/a2a/store.js +23 -0
  144. package/dist/server/a2a/store.js.map +1 -0
  145. package/dist/server/a2a/tasks.d.ts +7 -7
  146. package/dist/server/a2a/tasks.d.ts.map +1 -1
  147. package/dist/server/auth/defaults.d.ts +3 -0
  148. package/dist/server/auth/defaults.d.ts.map +1 -0
  149. package/dist/server/auth/helpers.d.ts +14 -0
  150. package/dist/server/auth/helpers.d.ts.map +1 -0
  151. package/dist/server/auth/index.cjs +137 -0
  152. package/dist/server/auth/index.cjs.map +1 -0
  153. package/dist/server/auth/index.d.ts +3 -0
  154. package/dist/server/auth/index.d.ts.map +1 -0
  155. package/dist/server/auth/index.js +127 -0
  156. package/dist/server/auth/index.js.map +1 -0
  157. package/dist/server/handlers/a2a.cjs +19 -11
  158. package/dist/server/handlers/a2a.d.ts +507 -23
  159. package/dist/server/handlers/a2a.d.ts.map +1 -1
  160. package/dist/server/handlers/a2a.js +1 -1
  161. package/dist/server/handlers/agent-builder.cjs +80 -0
  162. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  163. package/dist/server/handlers/agent-builder.d.ts +642 -0
  164. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  165. package/dist/server/handlers/agent-builder.js +3 -0
  166. package/dist/server/handlers/agent-builder.js.map +1 -0
  167. package/dist/server/handlers/agents.cjs +79 -15
  168. package/dist/server/handlers/agents.d.ts +3350 -72
  169. package/dist/server/handlers/agents.d.ts.map +1 -1
  170. package/dist/server/handlers/agents.js +1 -1
  171. package/dist/server/handlers/error.cjs +2 -2
  172. package/dist/server/handlers/error.js +1 -1
  173. package/dist/server/handlers/logs.cjs +7 -7
  174. package/dist/server/handlers/logs.d.ts +135 -27
  175. package/dist/server/handlers/logs.d.ts.map +1 -1
  176. package/dist/server/handlers/logs.js +1 -1
  177. package/dist/server/handlers/mcp.cjs +40 -0
  178. package/dist/server/handlers/mcp.cjs.map +1 -0
  179. package/dist/server/handlers/mcp.d.ts +110 -0
  180. package/dist/server/handlers/mcp.d.ts.map +1 -0
  181. package/dist/server/handlers/mcp.js +3 -0
  182. package/dist/server/handlers/mcp.js.map +1 -0
  183. package/dist/server/handlers/memory.cjs +65 -29
  184. package/dist/server/handlers/memory.d.ts +935 -99
  185. package/dist/server/handlers/memory.d.ts.map +1 -1
  186. package/dist/server/handlers/memory.js +1 -1
  187. package/dist/server/handlers/observability.cjs +40 -0
  188. package/dist/server/handlers/observability.cjs.map +1 -0
  189. package/dist/server/handlers/observability.d.ts +156 -0
  190. package/dist/server/handlers/observability.d.ts.map +1 -0
  191. package/dist/server/handlers/observability.js +3 -0
  192. package/dist/server/handlers/observability.js.map +1 -0
  193. package/dist/server/handlers/scores.cjs +13 -13
  194. package/dist/server/handlers/scores.d.ts +112 -40
  195. package/dist/server/handlers/scores.d.ts.map +1 -1
  196. package/dist/server/handlers/scores.js +1 -1
  197. package/dist/server/handlers/stored-agents.cjs +28 -0
  198. package/dist/server/handlers/stored-agents.cjs.map +1 -0
  199. package/dist/server/handlers/stored-agents.d.ts +289 -0
  200. package/dist/server/handlers/stored-agents.d.ts.map +1 -0
  201. package/dist/server/handlers/stored-agents.js +3 -0
  202. package/dist/server/handlers/stored-agents.js.map +1 -0
  203. package/dist/server/handlers/test-utils.cjs +15 -0
  204. package/dist/server/handlers/test-utils.cjs.map +1 -0
  205. package/dist/server/handlers/test-utils.d.ts +6 -0
  206. package/dist/server/handlers/test-utils.d.ts.map +1 -0
  207. package/dist/server/handlers/test-utils.js +13 -0
  208. package/dist/server/handlers/test-utils.js.map +1 -0
  209. package/dist/server/handlers/tools.cjs +13 -9
  210. package/dist/server/handlers/tools.d.ts +69 -19
  211. package/dist/server/handlers/tools.d.ts.map +1 -1
  212. package/dist/server/handlers/tools.js +1 -1
  213. package/dist/server/handlers/utils.cjs +14 -2
  214. package/dist/server/handlers/utils.d.ts +11 -0
  215. package/dist/server/handlers/utils.d.ts.map +1 -1
  216. package/dist/server/handlers/utils.js +1 -1
  217. package/dist/server/handlers/vector.cjs +31 -7
  218. package/dist/server/handlers/vector.d.ts +94 -10
  219. package/dist/server/handlers/vector.d.ts.map +1 -1
  220. package/dist/server/handlers/vector.js +1 -1
  221. package/dist/server/handlers/voice.cjs +21 -9
  222. package/dist/server/handlers/voice.d.ts +81 -38
  223. package/dist/server/handlers/voice.d.ts.map +1 -1
  224. package/dist/server/handlers/voice.js +1 -1
  225. package/dist/server/handlers/workflows.cjs +75 -31
  226. package/dist/server/handlers/workflows.d.ts +1000 -80
  227. package/dist/server/handlers/workflows.d.ts.map +1 -1
  228. package/dist/server/handlers/workflows.js +1 -1
  229. package/dist/server/handlers.cjs +36 -36
  230. package/dist/server/handlers.d.ts +12 -12
  231. package/dist/server/handlers.d.ts.map +1 -1
  232. package/dist/server/handlers.js +12 -12
  233. package/dist/server/http-exception.d.ts +0 -5
  234. package/dist/server/http-exception.d.ts.map +1 -1
  235. package/dist/server/schemas/a2a.d.ts +786 -0
  236. package/dist/server/schemas/a2a.d.ts.map +1 -0
  237. package/dist/server/schemas/agent-builder.d.ts +213 -0
  238. package/dist/server/schemas/agent-builder.d.ts.map +1 -0
  239. package/dist/server/schemas/agents.d.ts +1401 -0
  240. package/dist/server/schemas/agents.d.ts.map +1 -0
  241. package/dist/server/schemas/common.d.ts +179 -0
  242. package/dist/server/schemas/common.d.ts.map +1 -0
  243. package/dist/server/schemas/logs.d.ts +124 -0
  244. package/dist/server/schemas/logs.d.ts.map +1 -0
  245. package/dist/server/schemas/mcp.d.ts +299 -0
  246. package/dist/server/schemas/mcp.d.ts.map +1 -0
  247. package/dist/server/schemas/memory.d.ts +998 -0
  248. package/dist/server/schemas/memory.d.ts.map +1 -0
  249. package/dist/server/schemas/observability.d.ts +402 -0
  250. package/dist/server/schemas/observability.d.ts.map +1 -0
  251. package/dist/server/schemas/scores.d.ts +259 -0
  252. package/dist/server/schemas/scores.d.ts.map +1 -0
  253. package/dist/server/schemas/stored-agents.d.ts +792 -0
  254. package/dist/server/schemas/stored-agents.d.ts.map +1 -0
  255. package/dist/server/schemas/vectors.d.ts +107 -0
  256. package/dist/server/schemas/vectors.d.ts.map +1 -0
  257. package/dist/server/schemas/workflows.d.ts +668 -0
  258. package/dist/server/schemas/workflows.d.ts.map +1 -0
  259. package/dist/server/server-adapter/index.cjs +485 -0
  260. package/dist/server/server-adapter/index.cjs.map +1 -0
  261. package/dist/server/server-adapter/index.d.ts +91 -0
  262. package/dist/server/server-adapter/index.d.ts.map +1 -0
  263. package/dist/server/server-adapter/index.js +470 -0
  264. package/dist/server/server-adapter/index.js.map +1 -0
  265. package/dist/server/server-adapter/openapi-utils.d.ts +59 -0
  266. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -0
  267. package/dist/server/server-adapter/redact.d.ts +26 -0
  268. package/dist/server/server-adapter/redact.d.ts.map +1 -0
  269. package/dist/server/server-adapter/routes/a2a.d.ts +3 -0
  270. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -0
  271. package/dist/server/server-adapter/routes/agent-builder.d.ts +3 -0
  272. package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -0
  273. package/dist/server/server-adapter/routes/agents.d.ts +3 -0
  274. package/dist/server/server-adapter/routes/agents.d.ts.map +1 -0
  275. package/dist/server/server-adapter/routes/index.d.ts +50 -0
  276. package/dist/server/server-adapter/routes/index.d.ts.map +1 -0
  277. package/dist/server/server-adapter/routes/legacy.d.ts +7 -0
  278. package/dist/server/server-adapter/routes/legacy.d.ts.map +1 -0
  279. package/dist/server/server-adapter/routes/logs.d.ts +3 -0
  280. package/dist/server/server-adapter/routes/logs.d.ts.map +1 -0
  281. package/dist/server/server-adapter/routes/mcp.d.ts +9 -0
  282. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -0
  283. package/dist/server/server-adapter/routes/memory.d.ts +3 -0
  284. package/dist/server/server-adapter/routes/memory.d.ts.map +1 -0
  285. package/dist/server/server-adapter/routes/observability.d.ts +3 -0
  286. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -0
  287. package/dist/server/server-adapter/routes/route-builder.d.ts +52 -0
  288. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -0
  289. package/dist/server/server-adapter/routes/scorers.d.ts +3 -0
  290. package/dist/server/server-adapter/routes/scorers.d.ts.map +1 -0
  291. package/dist/server/server-adapter/routes/stored-agents.d.ts +8 -0
  292. package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -0
  293. package/dist/server/server-adapter/routes/stream-types.d.ts +10 -0
  294. package/dist/server/server-adapter/routes/stream-types.d.ts.map +1 -0
  295. package/dist/server/server-adapter/routes/tools.d.ts +3 -0
  296. package/dist/server/server-adapter/routes/tools.d.ts.map +1 -0
  297. package/dist/server/server-adapter/routes/vectors.d.ts +3 -0
  298. package/dist/server/server-adapter/routes/vectors.d.ts.map +1 -0
  299. package/dist/server/server-adapter/routes/workflows.d.ts +3 -0
  300. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -0
  301. package/dist/server/utils.d.ts +45 -0
  302. package/dist/server/utils.d.ts.map +1 -0
  303. package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs +63 -0
  304. package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +1 -0
  305. package/dist/token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js +61 -0
  306. package/dist/token-6GSAFR2W-KVDFAJ2M-LNX5VF3I.js.map +1 -0
  307. package/dist/token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs +63 -0
  308. package/dist/token-6GSAFR2W-KVDFAJ2M-SDYXODLX.cjs.map +1 -0
  309. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js +61 -0
  310. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +1 -0
  311. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +10 -0
  312. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map +1 -0
  313. package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js +8 -0
  314. package/dist/token-util-NEHG7TUY-DJYRKLRD-BSQMRUEW.js.map +1 -0
  315. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +8 -0
  316. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map +1 -0
  317. package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs +10 -0
  318. package/dist/token-util-NEHG7TUY-DJYRKLRD-MFJRDVVF.cjs.map +1 -0
  319. package/package.json +66 -17
  320. package/dist/chunk-2XIJW7SV.cjs +0 -310
  321. package/dist/chunk-2XIJW7SV.cjs.map +0 -1
  322. package/dist/chunk-4CEZIJWJ.cjs +0 -150
  323. package/dist/chunk-4CEZIJWJ.cjs.map +0 -1
  324. package/dist/chunk-4MQU6AJN.js +0 -83
  325. package/dist/chunk-4MQU6AJN.js.map +0 -1
  326. package/dist/chunk-4QSNRCOT.cjs +0 -20
  327. package/dist/chunk-4QSNRCOT.cjs.map +0 -1
  328. package/dist/chunk-4US5W7PH.cjs +0 -120
  329. package/dist/chunk-4US5W7PH.cjs.map +0 -1
  330. package/dist/chunk-7FHF55WA.js +0 -2041
  331. package/dist/chunk-7FHF55WA.js.map +0 -1
  332. package/dist/chunk-BED2O446.cjs +0 -88
  333. package/dist/chunk-BED2O446.cjs.map +0 -1
  334. package/dist/chunk-BUOJL3MN.js +0 -529
  335. package/dist/chunk-BUOJL3MN.js.map +0 -1
  336. package/dist/chunk-G7NVCO5M.js +0 -123
  337. package/dist/chunk-G7NVCO5M.js.map +0 -1
  338. package/dist/chunk-GASWM5HJ.cjs +0 -514
  339. package/dist/chunk-GASWM5HJ.cjs.map +0 -1
  340. package/dist/chunk-HWHKM67I.js +0 -114
  341. package/dist/chunk-HWHKM67I.js.map +0 -1
  342. package/dist/chunk-HXIOPAHT.js +0 -541
  343. package/dist/chunk-HXIOPAHT.js.map +0 -1
  344. package/dist/chunk-ILCWPBYQ.cjs +0 -147
  345. package/dist/chunk-ILCWPBYQ.cjs.map +0 -1
  346. package/dist/chunk-JGVY3KWV.cjs +0 -334
  347. package/dist/chunk-JGVY3KWV.cjs.map +0 -1
  348. package/dist/chunk-LRUH33B4.cjs +0 -2044
  349. package/dist/chunk-LRUH33B4.cjs.map +0 -1
  350. package/dist/chunk-MMROOK5J.js.map +0 -1
  351. package/dist/chunk-NCS2OXX6.cjs +0 -131
  352. package/dist/chunk-NCS2OXX6.cjs.map +0 -1
  353. package/dist/chunk-O4I563YW.cjs +0 -130
  354. package/dist/chunk-O4I563YW.cjs.map +0 -1
  355. package/dist/chunk-OW4FX5TS.js +0 -18
  356. package/dist/chunk-OW4FX5TS.js.map +0 -1
  357. package/dist/chunk-PZ5AY32C.js +0 -9
  358. package/dist/chunk-Q7SFCCGT.cjs +0 -11
  359. package/dist/chunk-S37KCGOR.cjs +0 -546
  360. package/dist/chunk-S37KCGOR.cjs.map +0 -1
  361. package/dist/chunk-SQ7KKIH3.js +0 -143
  362. package/dist/chunk-SQ7KKIH3.js.map +0 -1
  363. package/dist/chunk-TRWPUPGD.js +0 -506
  364. package/dist/chunk-TRWPUPGD.js.map +0 -1
  365. package/dist/chunk-TXAQU2XN.js +0 -151
  366. package/dist/chunk-TXAQU2XN.js.map +0 -1
  367. package/dist/chunk-UVOSITKU.js +0 -322
  368. package/dist/chunk-UVOSITKU.js.map +0 -1
  369. package/dist/chunk-VIGPWTDA.cjs +0 -159
  370. package/dist/chunk-VIGPWTDA.cjs.map +0 -1
  371. package/dist/chunk-VOY6MGKA.js +0 -301
  372. package/dist/chunk-VOY6MGKA.js.map +0 -1
  373. package/dist/chunk-X5SDJOY6.cjs +0 -557
  374. package/dist/chunk-X5SDJOY6.cjs.map +0 -1
  375. package/dist/chunk-Y3J45CVZ.js +0 -144
  376. package/dist/chunk-Y3J45CVZ.js.map +0 -1
  377. package/dist/chunk-YS66MFDY.js +0 -124
  378. package/dist/chunk-YS66MFDY.js.map +0 -1
  379. package/dist/server/handlers/legacyWorkflows.cjs +0 -48
  380. package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
  381. package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
  382. package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
  383. package/dist/server/handlers/legacyWorkflows.js +0 -3
  384. package/dist/server/handlers/legacyWorkflows.js.map +0 -1
  385. package/dist/server/handlers/network.cjs +0 -24
  386. package/dist/server/handlers/network.cjs.map +0 -1
  387. package/dist/server/handlers/network.d.ts +0 -50
  388. package/dist/server/handlers/network.d.ts.map +0 -1
  389. package/dist/server/handlers/network.js +0 -3
  390. package/dist/server/handlers/network.js.map +0 -1
  391. package/dist/server/handlers/telemetry.cjs +0 -16
  392. package/dist/server/handlers/telemetry.cjs.map +0 -1
  393. package/dist/server/handlers/telemetry.d.ts +0 -32
  394. package/dist/server/handlers/telemetry.d.ts.map +0 -1
  395. package/dist/server/handlers/telemetry.js +0 -3
  396. package/dist/server/handlers/telemetry.js.map +0 -1
  397. package/dist/server/handlers/vNextNetwork.cjs +0 -220
  398. package/dist/server/handlers/vNextNetwork.cjs.map +0 -1
  399. package/dist/server/handlers/vNextNetwork.d.ts +0 -179
  400. package/dist/server/handlers/vNextNetwork.d.ts.map +0 -1
  401. package/dist/server/handlers/vNextNetwork.js +0 -213
  402. package/dist/server/handlers/vNextNetwork.js.map +0 -1
@@ -0,0 +1,1149 @@
1
+ 'use strict';
2
+
3
+ var chunk3XI22UQR_cjs = require('./chunk-3XI22UQR.cjs');
4
+ var chunkBMYZ4DO6_cjs = require('./chunk-BMYZ4DO6.cjs');
5
+ var chunkMCYD5LW7_cjs = require('./chunk-MCYD5LW7.cjs');
6
+ var chunkH2RMXG2Q_cjs = require('./chunk-H2RMXG2Q.cjs');
7
+ var chunkV5WWQN7P_cjs = require('./chunk-V5WWQN7P.cjs');
8
+ var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
9
+ var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
10
+ var web = require('stream/web');
11
+ var z = require('zod');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ var z__default = /*#__PURE__*/_interopDefault(z);
16
+
17
+ // src/server/handlers/workflows.ts
18
+ var workflows_exports = {};
19
+ chunkO7I5CWRX_cjs.__export(workflows_exports, {
20
+ CANCEL_WORKFLOW_RUN_ROUTE: () => CANCEL_WORKFLOW_RUN_ROUTE,
21
+ CREATE_WORKFLOW_RUN_ROUTE: () => CREATE_WORKFLOW_RUN_ROUTE,
22
+ DELETE_WORKFLOW_RUN_BY_ID_ROUTE: () => DELETE_WORKFLOW_RUN_BY_ID_ROUTE,
23
+ GET_WORKFLOW_BY_ID_ROUTE: () => GET_WORKFLOW_BY_ID_ROUTE,
24
+ GET_WORKFLOW_RUN_BY_ID_ROUTE: () => GET_WORKFLOW_RUN_BY_ID_ROUTE,
25
+ GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE: () => GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE,
26
+ LIST_WORKFLOWS_ROUTE: () => LIST_WORKFLOWS_ROUTE,
27
+ LIST_WORKFLOW_RUNS_ROUTE: () => LIST_WORKFLOW_RUNS_ROUTE,
28
+ OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE: () => OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE,
29
+ OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE: () => OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE,
30
+ OBSERVE_STREAM_WORKFLOW_ROUTE: () => OBSERVE_STREAM_WORKFLOW_ROUTE,
31
+ RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE: () => RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE,
32
+ RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE: () => RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE,
33
+ RESTART_ASYNC_WORKFLOW_ROUTE: () => RESTART_ASYNC_WORKFLOW_ROUTE,
34
+ RESTART_WORKFLOW_ROUTE: () => RESTART_WORKFLOW_ROUTE,
35
+ RESUME_ASYNC_WORKFLOW_ROUTE: () => RESUME_ASYNC_WORKFLOW_ROUTE,
36
+ RESUME_STREAM_WORKFLOW_ROUTE: () => RESUME_STREAM_WORKFLOW_ROUTE,
37
+ RESUME_WORKFLOW_ROUTE: () => RESUME_WORKFLOW_ROUTE,
38
+ START_ASYNC_WORKFLOW_ROUTE: () => START_ASYNC_WORKFLOW_ROUTE,
39
+ START_WORKFLOW_RUN_ROUTE: () => START_WORKFLOW_RUN_ROUTE,
40
+ STREAM_LEGACY_WORKFLOW_ROUTE: () => STREAM_LEGACY_WORKFLOW_ROUTE,
41
+ STREAM_VNEXT_WORKFLOW_ROUTE: () => STREAM_VNEXT_WORKFLOW_ROUTE,
42
+ STREAM_WORKFLOW_ROUTE: () => STREAM_WORKFLOW_ROUTE,
43
+ TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE: () => TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE,
44
+ TIME_TRAVEL_STREAM_WORKFLOW_ROUTE: () => TIME_TRAVEL_STREAM_WORKFLOW_ROUTE,
45
+ TIME_TRAVEL_WORKFLOW_ROUTE: () => TIME_TRAVEL_WORKFLOW_ROUTE
46
+ });
47
+ var workflowRunStatusSchema = z__default.default.enum([
48
+ "running",
49
+ "waiting",
50
+ "suspended",
51
+ "success",
52
+ "failed",
53
+ "canceled",
54
+ "pending",
55
+ "bailed",
56
+ "tripwire"
57
+ ]);
58
+ var workflowIdPathParams = z__default.default.object({
59
+ workflowId: z__default.default.string().describe("Unique identifier for the workflow")
60
+ });
61
+ var workflowRunPathParams = workflowIdPathParams.extend({
62
+ runId: z__default.default.string().describe("Unique identifier for the workflow run")
63
+ });
64
+ var serializedStepSchema = z__default.default.object({
65
+ id: z__default.default.string(),
66
+ description: z__default.default.string().optional()
67
+ });
68
+ var serializedStepFlowEntrySchema = z__default.default.object({
69
+ type: z__default.default.enum(["step", "sleep", "sleepUntil", "waitForEvent", "parallel", "conditional", "loop", "foreach"])
70
+ });
71
+ var workflowInfoSchema = z__default.default.object({
72
+ steps: z__default.default.record(z__default.default.string(), serializedStepSchema),
73
+ allSteps: z__default.default.record(z__default.default.string(), serializedStepSchema),
74
+ name: z__default.default.string().optional(),
75
+ description: z__default.default.string().optional(),
76
+ stepGraph: z__default.default.array(serializedStepFlowEntrySchema),
77
+ inputSchema: z__default.default.string().optional(),
78
+ outputSchema: z__default.default.string().optional(),
79
+ options: z__default.default.object({}).optional(),
80
+ isProcessorWorkflow: z__default.default.boolean().optional()
81
+ });
82
+ var listWorkflowsResponseSchema = z__default.default.record(z__default.default.string(), workflowInfoSchema);
83
+ var workflowRunSchema = z__default.default.object({
84
+ workflowName: z__default.default.string(),
85
+ runId: z__default.default.string(),
86
+ snapshot: z__default.default.union([z__default.default.object({}), z__default.default.string()]),
87
+ createdAt: z__default.default.date(),
88
+ updatedAt: z__default.default.date(),
89
+ resourceId: z__default.default.string().optional()
90
+ });
91
+ var workflowRunsResponseSchema = z__default.default.object({
92
+ runs: z__default.default.array(workflowRunSchema),
93
+ total: z__default.default.number()
94
+ });
95
+ var workflowRunResponseSchema = workflowRunSchema;
96
+ var listWorkflowRunsQuerySchema = chunkMCYD5LW7_cjs.createCombinedPaginationSchema().extend({
97
+ fromDate: z__default.default.coerce.date().optional(),
98
+ toDate: z__default.default.coerce.date().optional(),
99
+ resourceId: z__default.default.string().optional(),
100
+ status: workflowRunStatusSchema.optional()
101
+ });
102
+ var workflowExecutionBodySchema = z__default.default.object({
103
+ resourceId: z__default.default.string().optional(),
104
+ inputData: z__default.default.unknown().optional(),
105
+ initialState: z__default.default.unknown().optional(),
106
+ requestContext: z__default.default.record(z__default.default.string(), z__default.default.unknown()).optional(),
107
+ tracingOptions: chunkMCYD5LW7_cjs.tracingOptionsSchema.optional()
108
+ });
109
+ var streamLegacyWorkflowBodySchema = workflowExecutionBodySchema;
110
+ var streamWorkflowBodySchema = workflowExecutionBodySchema.extend({
111
+ closeOnSuspend: z__default.default.boolean().optional()
112
+ });
113
+ var resumeBodySchema = z__default.default.object({
114
+ step: z__default.default.union([z__default.default.string(), z__default.default.array(z__default.default.string())]).optional(),
115
+ // Optional - workflow can auto-resume all suspended steps
116
+ resumeData: z__default.default.unknown().optional(),
117
+ requestContext: z__default.default.record(z__default.default.string(), z__default.default.unknown()).optional(),
118
+ tracingOptions: chunkMCYD5LW7_cjs.tracingOptionsSchema.optional()
119
+ });
120
+ var restartBodySchema = z__default.default.object({
121
+ requestContext: z__default.default.record(z__default.default.string(), z__default.default.unknown()).optional(),
122
+ tracingOptions: chunkMCYD5LW7_cjs.tracingOptionsSchema.optional()
123
+ });
124
+ var timeTravelBodySchema = z__default.default.object({
125
+ inputData: z__default.default.unknown().optional(),
126
+ resumeData: z__default.default.unknown().optional(),
127
+ initialState: z__default.default.unknown().optional(),
128
+ step: z__default.default.union([z__default.default.string(), z__default.default.array(z__default.default.string())]),
129
+ context: z__default.default.record(z__default.default.string(), z__default.default.any()).optional(),
130
+ nestedStepsContext: z__default.default.record(z__default.default.string(), z__default.default.record(z__default.default.string(), z__default.default.any())).optional(),
131
+ requestContext: z__default.default.record(z__default.default.string(), z__default.default.unknown()).optional(),
132
+ tracingOptions: chunkMCYD5LW7_cjs.tracingOptionsSchema.optional()
133
+ });
134
+ var startAsyncWorkflowBodySchema = workflowExecutionBodySchema;
135
+ z__default.default.object({
136
+ event: z__default.default.string(),
137
+ data: z__default.default.unknown()
138
+ });
139
+ var workflowExecutionResultQuerySchema = z__default.default.object({
140
+ fields: z__default.default.string().optional().refine(
141
+ (value) => {
142
+ if (!value) return true;
143
+ const validFields = /* @__PURE__ */ new Set([
144
+ "status",
145
+ "result",
146
+ "error",
147
+ "payload",
148
+ "steps",
149
+ "activeStepsPath",
150
+ "serializedStepGraph"
151
+ ]);
152
+ const requestedFields = value.split(",").map((f) => f.trim());
153
+ return requestedFields.every((field) => validFields.has(field));
154
+ },
155
+ {
156
+ message: "Invalid field name. Available fields: status, result, error, payload, steps, activeStepsPath, serializedStepGraph"
157
+ }
158
+ ).describe(
159
+ "Comma-separated list of fields to return. Available fields: status, result, error, payload, steps, activeStepsPath, serializedStepGraph. If not provided, returns all fields."
160
+ ),
161
+ withNestedWorkflows: z__default.default.enum(["true", "false"]).optional().describe(
162
+ "Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance."
163
+ )
164
+ });
165
+ var workflowExecutionResultSchema = z__default.default.object({
166
+ status: workflowRunStatusSchema.optional(),
167
+ result: z__default.default.unknown().optional(),
168
+ error: z__default.default.unknown().optional(),
169
+ payload: z__default.default.unknown().optional(),
170
+ steps: z__default.default.record(z__default.default.string(), z__default.default.any()).optional(),
171
+ activeStepsPath: z__default.default.record(z__default.default.string(), z__default.default.array(z__default.default.number())).optional(),
172
+ serializedStepGraph: z__default.default.array(serializedStepFlowEntrySchema).optional()
173
+ });
174
+ var workflowControlResponseSchema = chunkMCYD5LW7_cjs.messageResponseSchema;
175
+ var createWorkflowRunResponseSchema = z__default.default.object({
176
+ runId: z__default.default.string()
177
+ });
178
+ var createWorkflowRunBodySchema = z__default.default.object({
179
+ resourceId: z__default.default.string().optional(),
180
+ disableScorers: z__default.default.boolean().optional()
181
+ });
182
+
183
+ // src/server/handlers/workflows.ts
184
+ async function listWorkflowsFromSystem({ mastra, workflowId }) {
185
+ const logger = mastra.getLogger();
186
+ if (!workflowId) {
187
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
188
+ }
189
+ let workflow;
190
+ workflow = chunk3XI22UQR_cjs.WorkflowRegistry.getWorkflow(workflowId);
191
+ if (!workflow) {
192
+ try {
193
+ workflow = mastra.getWorkflowById(workflowId);
194
+ } catch (error) {
195
+ logger.debug("Error getting workflow, searching agents for workflow", error);
196
+ }
197
+ }
198
+ if (!workflow) {
199
+ logger.debug("Workflow not found, searching agents for workflow", { workflowId });
200
+ const agents = mastra.listAgents();
201
+ if (Object.keys(agents || {}).length) {
202
+ for (const [_, agent] of Object.entries(agents)) {
203
+ try {
204
+ const workflows = await agent.listWorkflows();
205
+ if (workflows[workflowId]) {
206
+ workflow = workflows[workflowId];
207
+ break;
208
+ }
209
+ break;
210
+ } catch (error) {
211
+ logger.debug("Error getting workflow from agent", error);
212
+ }
213
+ }
214
+ }
215
+ }
216
+ if (!workflow) {
217
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
218
+ }
219
+ return { workflow };
220
+ }
221
+ var LIST_WORKFLOWS_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
222
+ method: "GET",
223
+ path: "/api/workflows",
224
+ responseType: "json",
225
+ queryParamSchema: z.z.object({
226
+ partial: z.z.string().optional()
227
+ }),
228
+ responseSchema: listWorkflowsResponseSchema,
229
+ summary: "List all workflows",
230
+ description: "Returns a list of all available workflows in the system",
231
+ tags: ["Workflows"],
232
+ handler: async ({ mastra, partial }) => {
233
+ try {
234
+ const workflows = mastra.listWorkflows({ serialized: false });
235
+ const isPartial = partial === "true";
236
+ const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
237
+ acc[key] = chunk3XI22UQR_cjs.getWorkflowInfo(workflow, isPartial);
238
+ return acc;
239
+ }, {});
240
+ return _workflows;
241
+ } catch (error) {
242
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflows");
243
+ }
244
+ }
245
+ });
246
+ var GET_WORKFLOW_BY_ID_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
247
+ method: "GET",
248
+ path: "/api/workflows/:workflowId",
249
+ responseType: "json",
250
+ pathParamSchema: workflowIdPathParams,
251
+ responseSchema: workflowInfoSchema,
252
+ summary: "Get workflow by ID",
253
+ description: "Returns details for a specific workflow",
254
+ tags: ["Workflows"],
255
+ handler: async ({ mastra, workflowId }) => {
256
+ try {
257
+ if (!workflowId) {
258
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
259
+ }
260
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
261
+ return chunk3XI22UQR_cjs.getWorkflowInfo(workflow);
262
+ } catch (error) {
263
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow");
264
+ }
265
+ }
266
+ });
267
+ var LIST_WORKFLOW_RUNS_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
268
+ method: "GET",
269
+ path: "/api/workflows/:workflowId/runs",
270
+ responseType: "json",
271
+ pathParamSchema: workflowIdPathParams,
272
+ queryParamSchema: listWorkflowRunsQuerySchema,
273
+ responseSchema: workflowRunsResponseSchema,
274
+ summary: "List workflow runs",
275
+ description: "Returns a paginated list of execution runs for the specified workflow",
276
+ tags: ["Workflows"],
277
+ handler: async ({ mastra, workflowId, fromDate, toDate, page, perPage, limit, offset, resourceId, status }) => {
278
+ try {
279
+ if (!workflowId) {
280
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
281
+ }
282
+ let finalPage = page;
283
+ let finalPerPage = perPage;
284
+ if (finalPerPage === void 0 && limit !== void 0) {
285
+ finalPerPage = limit;
286
+ }
287
+ if (finalPage === void 0 && offset !== void 0 && finalPerPage !== void 0 && finalPerPage > 0) {
288
+ finalPage = Math.floor(offset / finalPerPage);
289
+ }
290
+ if (finalPerPage !== void 0 && (typeof finalPerPage !== "number" || !Number.isInteger(finalPerPage) || finalPerPage <= 0)) {
291
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "perPage must be a positive integer" });
292
+ }
293
+ if (finalPage !== void 0 && (!Number.isInteger(finalPage) || finalPage < 0)) {
294
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "page must be a non-negative integer" });
295
+ }
296
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
297
+ if (!workflow) {
298
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
299
+ }
300
+ const workflowRuns = await workflow.listWorkflowRuns({
301
+ fromDate: fromDate ? typeof fromDate === "string" ? new Date(fromDate) : fromDate : void 0,
302
+ toDate: toDate ? typeof toDate === "string" ? new Date(toDate) : toDate : void 0,
303
+ perPage: finalPerPage,
304
+ page: finalPage,
305
+ resourceId,
306
+ status
307
+ }) || {
308
+ runs: [],
309
+ total: 0
310
+ };
311
+ return workflowRuns;
312
+ } catch (error) {
313
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow runs");
314
+ }
315
+ }
316
+ });
317
+ var GET_WORKFLOW_RUN_BY_ID_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
318
+ method: "GET",
319
+ path: "/api/workflows/:workflowId/runs/:runId",
320
+ responseType: "json",
321
+ pathParamSchema: workflowRunPathParams,
322
+ responseSchema: workflowRunResponseSchema,
323
+ summary: "Get workflow run by ID",
324
+ description: "Returns details for a specific workflow run",
325
+ tags: ["Workflows"],
326
+ handler: async ({ mastra, workflowId, runId }) => {
327
+ try {
328
+ if (!workflowId) {
329
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
330
+ }
331
+ if (!runId) {
332
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
333
+ }
334
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
335
+ if (!workflow) {
336
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
337
+ }
338
+ const run = await workflow.getWorkflowRunById(runId);
339
+ if (!run) {
340
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
341
+ }
342
+ return run;
343
+ } catch (error) {
344
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run");
345
+ }
346
+ }
347
+ });
348
+ var DELETE_WORKFLOW_RUN_BY_ID_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
349
+ method: "DELETE",
350
+ path: "/api/workflows/:workflowId/runs/:runId",
351
+ responseType: "json",
352
+ pathParamSchema: workflowRunPathParams,
353
+ responseSchema: workflowControlResponseSchema,
354
+ summary: "Delete workflow run by ID",
355
+ description: "Deletes a specific workflow run by ID",
356
+ tags: ["Workflows"],
357
+ handler: async ({ mastra, workflowId, runId }) => {
358
+ try {
359
+ if (!workflowId) {
360
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
361
+ }
362
+ if (!runId) {
363
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
364
+ }
365
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
366
+ if (!workflow) {
367
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
368
+ }
369
+ await workflow.deleteWorkflowRunById(runId);
370
+ return { message: "Workflow run deleted" };
371
+ } catch (error) {
372
+ return chunkV5WWQN7P_cjs.handleError(error, "Error deleting workflow run");
373
+ }
374
+ }
375
+ });
376
+ var CREATE_WORKFLOW_RUN_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
377
+ method: "POST",
378
+ path: "/api/workflows/:workflowId/create-run",
379
+ responseType: "json",
380
+ pathParamSchema: workflowIdPathParams,
381
+ queryParamSchema: chunkMCYD5LW7_cjs.optionalRunIdSchema,
382
+ bodySchema: createWorkflowRunBodySchema,
383
+ responseSchema: createWorkflowRunResponseSchema,
384
+ summary: "Create workflow run",
385
+ description: "Creates a new workflow execution instance with an optional custom run ID",
386
+ tags: ["Workflows"],
387
+ handler: async ({ mastra, workflowId, runId, resourceId, disableScorers }) => {
388
+ try {
389
+ if (!workflowId) {
390
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
391
+ }
392
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
393
+ if (!workflow) {
394
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
395
+ }
396
+ const run = await workflow.createRun({ runId, resourceId, disableScorers });
397
+ return { runId: run.runId };
398
+ } catch (error) {
399
+ return chunkV5WWQN7P_cjs.handleError(error, "Error creating workflow run");
400
+ }
401
+ }
402
+ });
403
+ var STREAM_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
404
+ method: "POST",
405
+ path: "/api/workflows/:workflowId/stream",
406
+ responseType: "stream",
407
+ pathParamSchema: workflowIdPathParams,
408
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
409
+ bodySchema: streamWorkflowBodySchema,
410
+ summary: "Stream workflow execution",
411
+ description: "Executes a workflow and streams the results in real-time",
412
+ tags: ["Workflows"],
413
+ handler: async ({ mastra, workflowId, runId, resourceId, ...params }) => {
414
+ try {
415
+ if (!workflowId) {
416
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
417
+ }
418
+ if (!runId) {
419
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to stream workflow" });
420
+ }
421
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
422
+ if (!workflow) {
423
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
424
+ }
425
+ const serverCache = mastra.getServerCache();
426
+ const run = await workflow.createRun({ runId, resourceId });
427
+ const result = run.stream(params);
428
+ return result.fullStream.pipeThrough(
429
+ new web.TransformStream({
430
+ transform(chunk, controller) {
431
+ if (serverCache) {
432
+ const cacheKey = runId;
433
+ serverCache.listPush(cacheKey, chunk).catch(() => {
434
+ });
435
+ }
436
+ controller.enqueue(chunk);
437
+ }
438
+ })
439
+ );
440
+ } catch (error) {
441
+ return chunkV5WWQN7P_cjs.handleError(error, "Error streaming workflow");
442
+ }
443
+ }
444
+ });
445
+ var STREAM_VNEXT_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
446
+ method: "POST",
447
+ path: "/api/workflows/:workflowId/streamVNext",
448
+ responseType: "stream",
449
+ pathParamSchema: workflowIdPathParams,
450
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
451
+ bodySchema: streamWorkflowBodySchema,
452
+ summary: "Stream workflow execution (v2)",
453
+ description: "Executes a workflow using the v2 streaming API and streams the results in real-time",
454
+ tags: ["Workflows"],
455
+ handler: STREAM_WORKFLOW_ROUTE.handler
456
+ });
457
+ var RESUME_STREAM_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
458
+ method: "POST",
459
+ path: "/api/workflows/:workflowId/resume-stream",
460
+ responseType: "stream",
461
+ pathParamSchema: workflowIdPathParams,
462
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
463
+ bodySchema: resumeBodySchema,
464
+ responseSchema: chunkBMYZ4DO6_cjs.streamResponseSchema,
465
+ summary: "Resume workflow stream",
466
+ description: "Resumes a suspended workflow execution and continues streaming results",
467
+ tags: ["Workflows"],
468
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
469
+ try {
470
+ if (!workflowId) {
471
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
472
+ }
473
+ if (!runId) {
474
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
475
+ }
476
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
477
+ if (!workflow) {
478
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
479
+ }
480
+ const run = await workflow.getWorkflowRunById(runId);
481
+ if (!run) {
482
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
483
+ }
484
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
485
+ const serverCache = mastra.getServerCache();
486
+ const stream = _run.resumeStream(params).fullStream.pipeThrough(
487
+ new web.TransformStream({
488
+ transform(chunk, controller) {
489
+ if (serverCache) {
490
+ const cacheKey = runId;
491
+ serverCache.listPush(cacheKey, chunk).catch(() => {
492
+ });
493
+ }
494
+ controller.enqueue(chunk);
495
+ }
496
+ })
497
+ );
498
+ return stream;
499
+ } catch (error) {
500
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
501
+ }
502
+ }
503
+ });
504
+ var GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
505
+ method: "GET",
506
+ path: "/api/workflows/:workflowId/runs/:runId/execution-result",
507
+ responseType: "json",
508
+ pathParamSchema: workflowRunPathParams,
509
+ queryParamSchema: workflowExecutionResultQuerySchema,
510
+ responseSchema: workflowExecutionResultSchema,
511
+ summary: "Get workflow execution result",
512
+ description: "Returns the final execution result of a completed workflow run. Use the fields query parameter to reduce payload size by requesting only specific fields (e.g., ?fields=status,result)",
513
+ tags: ["Workflows"],
514
+ handler: async ({ mastra, workflowId, runId, fields, withNestedWorkflows }) => {
515
+ try {
516
+ if (!workflowId) {
517
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
518
+ }
519
+ if (!runId) {
520
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
521
+ }
522
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
523
+ if (!workflow) {
524
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
525
+ }
526
+ const fieldList = fields ? fields.split(",").map((f) => f.trim()) : void 0;
527
+ const executionResult = await workflow.getWorkflowRunExecutionResult(runId, {
528
+ withNestedWorkflows: withNestedWorkflows !== "false",
529
+ // Default to true unless explicitly 'false'
530
+ fields: fieldList
531
+ });
532
+ if (!executionResult) {
533
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
534
+ }
535
+ return executionResult;
536
+ } catch (error) {
537
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run execution result");
538
+ }
539
+ }
540
+ });
541
+ var START_ASYNC_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
542
+ method: "POST",
543
+ path: "/api/workflows/:workflowId/start-async",
544
+ responseType: "json",
545
+ pathParamSchema: workflowIdPathParams,
546
+ queryParamSchema: chunkMCYD5LW7_cjs.optionalRunIdSchema,
547
+ bodySchema: startAsyncWorkflowBodySchema,
548
+ responseSchema: workflowExecutionResultSchema,
549
+ summary: "Start workflow asynchronously",
550
+ description: "Starts a workflow execution asynchronously without streaming results",
551
+ tags: ["Workflows"],
552
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
553
+ try {
554
+ if (!workflowId) {
555
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
556
+ }
557
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
558
+ if (!workflow) {
559
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
560
+ }
561
+ const _run = await workflow.createRun({ runId });
562
+ const result = await _run.start(params);
563
+ return result;
564
+ } catch (error) {
565
+ return chunkV5WWQN7P_cjs.handleError(error, "Error starting async workflow");
566
+ }
567
+ }
568
+ });
569
+ var START_WORKFLOW_RUN_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
570
+ method: "POST",
571
+ path: "/api/workflows/:workflowId/start",
572
+ responseType: "json",
573
+ pathParamSchema: workflowIdPathParams,
574
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
575
+ bodySchema: startAsyncWorkflowBodySchema,
576
+ responseSchema: workflowControlResponseSchema,
577
+ summary: "Start specific workflow run",
578
+ description: "Starts execution of a specific workflow run by ID",
579
+ tags: ["Workflows"],
580
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
581
+ try {
582
+ if (!workflowId) {
583
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
584
+ }
585
+ if (!runId) {
586
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to start run" });
587
+ }
588
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
589
+ if (!workflow) {
590
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
591
+ }
592
+ const run = await workflow.getWorkflowRunById(runId);
593
+ if (!run) {
594
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
595
+ }
596
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
597
+ void _run.start({
598
+ ...params
599
+ });
600
+ return { message: "Workflow run started" };
601
+ } catch (e) {
602
+ return chunkV5WWQN7P_cjs.handleError(e, "Error starting workflow run");
603
+ }
604
+ }
605
+ });
606
+ var OBSERVE_STREAM_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
607
+ method: "POST",
608
+ path: "/api/workflows/:workflowId/observe",
609
+ responseType: "stream",
610
+ pathParamSchema: workflowIdPathParams,
611
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
612
+ responseSchema: chunkBMYZ4DO6_cjs.streamResponseSchema,
613
+ summary: "Observe workflow stream",
614
+ description: "Observes and streams updates from an already running workflow execution",
615
+ tags: ["Workflows"],
616
+ handler: async ({ mastra, workflowId, runId }) => {
617
+ try {
618
+ if (!workflowId) {
619
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
620
+ }
621
+ if (!runId) {
622
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
623
+ }
624
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
625
+ if (!workflow) {
626
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
627
+ }
628
+ const run = await workflow.getWorkflowRunById(runId);
629
+ if (!run) {
630
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
631
+ }
632
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
633
+ const serverCache = mastra.getServerCache();
634
+ if (!serverCache) {
635
+ throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
636
+ }
637
+ const cachedRunChunks = await serverCache.listFromTo(runId, 0);
638
+ const combinedStream = new web.ReadableStream({
639
+ start(controller) {
640
+ const emitCachedChunks = async () => {
641
+ for (const chunk of cachedRunChunks) {
642
+ controller.enqueue(chunk);
643
+ }
644
+ };
645
+ const liveStream = _run.observeStream();
646
+ const reader = liveStream.getReader();
647
+ const pump = async () => {
648
+ try {
649
+ while (true) {
650
+ const { done, value } = await reader.read();
651
+ if (done) {
652
+ controller.close();
653
+ break;
654
+ }
655
+ controller.enqueue(value);
656
+ }
657
+ } catch (error) {
658
+ controller.error(error);
659
+ } finally {
660
+ reader.releaseLock();
661
+ }
662
+ };
663
+ void emitCachedChunks().then(() => {
664
+ void pump();
665
+ }).catch((error) => {
666
+ controller.error(error);
667
+ });
668
+ }
669
+ });
670
+ return combinedStream;
671
+ } catch (error) {
672
+ return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
673
+ }
674
+ }
675
+ });
676
+ var OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
677
+ method: "POST",
678
+ path: "/api/workflows/:workflowId/observe-streamVNext",
679
+ responseType: "stream",
680
+ pathParamSchema: workflowIdPathParams,
681
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
682
+ responseSchema: chunkBMYZ4DO6_cjs.streamResponseSchema,
683
+ summary: "Observe workflow stream (v2)",
684
+ description: "Observes and streams updates from an already running workflow execution using v2 streaming API",
685
+ tags: ["Workflows"],
686
+ handler: OBSERVE_STREAM_WORKFLOW_ROUTE.handler
687
+ });
688
+ var RESUME_ASYNC_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
689
+ method: "POST",
690
+ path: "/api/workflows/:workflowId/resume-async",
691
+ responseType: "json",
692
+ pathParamSchema: workflowIdPathParams,
693
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
694
+ bodySchema: resumeBodySchema,
695
+ responseSchema: workflowExecutionResultSchema,
696
+ summary: "Resume workflow asynchronously",
697
+ description: "Resumes a suspended workflow execution asynchronously without streaming",
698
+ tags: ["Workflows"],
699
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
700
+ try {
701
+ if (!workflowId) {
702
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
703
+ }
704
+ if (!runId) {
705
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
706
+ }
707
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
708
+ if (!workflow) {
709
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
710
+ }
711
+ const run = await workflow.getWorkflowRunById(runId);
712
+ if (!run) {
713
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
714
+ }
715
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
716
+ const result = await _run.resume(params);
717
+ return result;
718
+ } catch (error) {
719
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow step");
720
+ }
721
+ }
722
+ });
723
+ var RESUME_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
724
+ method: "POST",
725
+ path: "/api/workflows/:workflowId/resume",
726
+ responseType: "json",
727
+ pathParamSchema: workflowIdPathParams,
728
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
729
+ bodySchema: resumeBodySchema,
730
+ responseSchema: workflowControlResponseSchema,
731
+ summary: "Resume workflow",
732
+ description: "Resumes a suspended workflow execution from a specific step",
733
+ tags: ["Workflows"],
734
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
735
+ try {
736
+ if (!workflowId) {
737
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
738
+ }
739
+ if (!runId) {
740
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
741
+ }
742
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
743
+ if (!workflow) {
744
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
745
+ }
746
+ const run = await workflow.getWorkflowRunById(runId);
747
+ if (!run) {
748
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
749
+ }
750
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
751
+ void _run.resume(params);
752
+ return { message: "Workflow run resumed" };
753
+ } catch (error) {
754
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
755
+ }
756
+ }
757
+ });
758
+ var RESTART_ASYNC_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
759
+ method: "POST",
760
+ path: "/api/workflows/:workflowId/restart-async",
761
+ responseType: "json",
762
+ pathParamSchema: workflowIdPathParams,
763
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
764
+ bodySchema: restartBodySchema,
765
+ responseSchema: workflowExecutionResultSchema,
766
+ summary: "Restart workflow asynchronously",
767
+ description: "Restarts an active workflow execution asynchronously",
768
+ tags: ["Workflows"],
769
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
770
+ try {
771
+ if (!workflowId) {
772
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
773
+ }
774
+ if (!runId) {
775
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to restart workflow" });
776
+ }
777
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
778
+ if (!workflow) {
779
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
780
+ }
781
+ const run = await workflow.getWorkflowRunById(runId);
782
+ if (!run) {
783
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
784
+ }
785
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
786
+ const result = await _run.restart(params);
787
+ return result;
788
+ } catch (error) {
789
+ return chunkV5WWQN7P_cjs.handleError(error, "Error restarting workflow");
790
+ }
791
+ }
792
+ });
793
+ var RESTART_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
794
+ method: "POST",
795
+ path: "/api/workflows/:workflowId/restart",
796
+ responseType: "json",
797
+ pathParamSchema: workflowIdPathParams,
798
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
799
+ bodySchema: restartBodySchema,
800
+ responseSchema: workflowControlResponseSchema,
801
+ summary: "Restart workflow",
802
+ description: "Restarts an active workflow execution",
803
+ tags: ["Workflows"],
804
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
805
+ try {
806
+ if (!workflowId) {
807
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
808
+ }
809
+ if (!runId) {
810
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to restart workflow" });
811
+ }
812
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
813
+ if (!workflow) {
814
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
815
+ }
816
+ const run = await workflow.getWorkflowRunById(runId);
817
+ if (!run) {
818
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
819
+ }
820
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
821
+ void _run.restart(params);
822
+ return { message: "Workflow run restarted" };
823
+ } catch (error) {
824
+ return chunkV5WWQN7P_cjs.handleError(error, "Error restarting workflow");
825
+ }
826
+ }
827
+ });
828
+ var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
829
+ method: "POST",
830
+ path: "/api/workflows/:workflowId/restart-all-active-workflow-runs-async",
831
+ responseType: "json",
832
+ pathParamSchema: workflowIdPathParams,
833
+ responseSchema: workflowControlResponseSchema,
834
+ summary: "Restart all active workflow runs asynchronously",
835
+ description: "Restarts all active workflow runs asynchronously",
836
+ tags: ["Workflows"],
837
+ handler: async ({ mastra, workflowId }) => {
838
+ try {
839
+ if (!workflowId) {
840
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
841
+ }
842
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
843
+ if (!workflow) {
844
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
845
+ }
846
+ await workflow.restartAllActiveWorkflowRuns();
847
+ return { message: "All active workflow runs restarted" };
848
+ } catch (error) {
849
+ return chunkV5WWQN7P_cjs.handleError(error, "Error restarting workflow");
850
+ }
851
+ }
852
+ });
853
+ var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
854
+ method: "POST",
855
+ path: "/api/workflows/:workflowId/restart-all-active-workflow-runs",
856
+ responseType: "json",
857
+ pathParamSchema: workflowIdPathParams,
858
+ responseSchema: workflowControlResponseSchema,
859
+ summary: "Restart all active workflow runs",
860
+ description: "Restarts all active workflow runs",
861
+ tags: ["Workflows"],
862
+ handler: async ({ mastra, workflowId }) => {
863
+ try {
864
+ if (!workflowId) {
865
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
866
+ }
867
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
868
+ if (!workflow) {
869
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
870
+ }
871
+ void workflow.restartAllActiveWorkflowRuns();
872
+ return { message: "All active workflow runs restarted" };
873
+ } catch (error) {
874
+ return chunkV5WWQN7P_cjs.handleError(error, "Error restarting workflow");
875
+ }
876
+ }
877
+ });
878
+ var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
879
+ method: "POST",
880
+ path: "/api/workflows/:workflowId/time-travel-async",
881
+ responseType: "json",
882
+ pathParamSchema: workflowIdPathParams,
883
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
884
+ bodySchema: timeTravelBodySchema,
885
+ responseSchema: workflowExecutionResultSchema,
886
+ summary: "Time travel workflow asynchronously",
887
+ description: "Time travels a workflow run asynchronously without streaming",
888
+ tags: ["Workflows"],
889
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
890
+ try {
891
+ if (!workflowId) {
892
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
893
+ }
894
+ if (!runId) {
895
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to time travel workflow" });
896
+ }
897
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
898
+ if (!workflow) {
899
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
900
+ }
901
+ const run = await workflow.getWorkflowRunById(runId);
902
+ if (!run) {
903
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
904
+ }
905
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
906
+ const result = await _run.timeTravel(params);
907
+ return result;
908
+ } catch (error) {
909
+ return chunkV5WWQN7P_cjs.handleError(error, "Error time traveling workflow");
910
+ }
911
+ }
912
+ });
913
+ var TIME_TRAVEL_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
914
+ method: "POST",
915
+ path: "/api/workflows/:workflowId/time-travel",
916
+ responseType: "json",
917
+ pathParamSchema: workflowIdPathParams,
918
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
919
+ bodySchema: timeTravelBodySchema,
920
+ responseSchema: workflowControlResponseSchema,
921
+ summary: "Time travel workflow",
922
+ description: "Time travels a workflow run, starting from a specific step",
923
+ tags: ["Workflows"],
924
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
925
+ try {
926
+ if (!workflowId) {
927
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
928
+ }
929
+ if (!runId) {
930
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to time travel workflow" });
931
+ }
932
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
933
+ if (!workflow) {
934
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
935
+ }
936
+ const run = await workflow.getWorkflowRunById(runId);
937
+ if (!run) {
938
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
939
+ }
940
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
941
+ void _run.timeTravel(params);
942
+ return { message: "Workflow run time travel started" };
943
+ } catch (error) {
944
+ return chunkV5WWQN7P_cjs.handleError(error, "Error time traveling workflow");
945
+ }
946
+ }
947
+ });
948
+ var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
949
+ method: "POST",
950
+ path: "/api/workflows/:workflowId/time-travel-stream",
951
+ responseType: "stream",
952
+ pathParamSchema: workflowIdPathParams,
953
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
954
+ bodySchema: timeTravelBodySchema,
955
+ summary: "Time travel workflow stream",
956
+ description: "Time travels a workflow run, starting from a specific step, and streams the results in real-time",
957
+ tags: ["Workflows"],
958
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
959
+ try {
960
+ if (!workflowId) {
961
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
962
+ }
963
+ if (!runId) {
964
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to time travel workflow stream" });
965
+ }
966
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
967
+ if (!workflow) {
968
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
969
+ }
970
+ const serverCache = mastra.getServerCache();
971
+ const run = await workflow.createRun({ runId });
972
+ const result = run.timeTravelStream(params);
973
+ return result.fullStream.pipeThrough(
974
+ new web.TransformStream({
975
+ transform(chunk, controller) {
976
+ if (serverCache) {
977
+ const cacheKey = runId;
978
+ serverCache.listPush(cacheKey, chunk).catch(() => {
979
+ });
980
+ }
981
+ controller.enqueue(chunk);
982
+ }
983
+ })
984
+ );
985
+ } catch (error) {
986
+ return chunkV5WWQN7P_cjs.handleError(error, "Error time traveling workflow stream");
987
+ }
988
+ }
989
+ });
990
+ var CANCEL_WORKFLOW_RUN_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
991
+ method: "POST",
992
+ path: "/api/workflows/:workflowId/runs/:runId/cancel",
993
+ responseType: "json",
994
+ pathParamSchema: workflowRunPathParams,
995
+ responseSchema: workflowControlResponseSchema,
996
+ summary: "Cancel workflow run",
997
+ description: "Cancels an in-progress workflow execution",
998
+ tags: ["Workflows"],
999
+ handler: async ({ mastra, workflowId, runId }) => {
1000
+ try {
1001
+ if (!workflowId) {
1002
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
1003
+ }
1004
+ if (!runId) {
1005
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
1006
+ }
1007
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
1008
+ if (!workflow) {
1009
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
1010
+ }
1011
+ const run = await workflow.getWorkflowRunById(runId);
1012
+ if (!run) {
1013
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
1014
+ }
1015
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
1016
+ await _run.cancel();
1017
+ return { message: "Workflow run cancelled" };
1018
+ } catch (error) {
1019
+ return chunkV5WWQN7P_cjs.handleError(error, "Error canceling workflow run");
1020
+ }
1021
+ }
1022
+ });
1023
+ var STREAM_LEGACY_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
1024
+ method: "POST",
1025
+ path: "/api/workflows/:workflowId/stream-legacy",
1026
+ responseType: "stream",
1027
+ pathParamSchema: workflowIdPathParams,
1028
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
1029
+ bodySchema: streamWorkflowBodySchema,
1030
+ responseSchema: chunkBMYZ4DO6_cjs.streamResponseSchema,
1031
+ summary: "[DEPRECATED] Stream workflow with legacy format",
1032
+ description: "Legacy endpoint for streaming workflow execution. Use /api/workflows/:workflowId/stream instead.",
1033
+ tags: ["Workflows", "Legacy"],
1034
+ handler: async ({ mastra, workflowId, runId, ...params }) => {
1035
+ try {
1036
+ if (!workflowId) {
1037
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
1038
+ }
1039
+ if (!runId) {
1040
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
1041
+ }
1042
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
1043
+ if (!workflow) {
1044
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
1045
+ }
1046
+ const serverCache = mastra.getServerCache();
1047
+ const run = await workflow.createRun({ runId });
1048
+ const result = run.streamLegacy({
1049
+ ...params,
1050
+ onChunk: async (chunk) => {
1051
+ if (serverCache) {
1052
+ const cacheKey = runId;
1053
+ await serverCache.listPush(cacheKey, chunk);
1054
+ }
1055
+ }
1056
+ });
1057
+ return result.stream;
1058
+ } catch (error) {
1059
+ return chunkV5WWQN7P_cjs.handleError(error, "Error executing workflow");
1060
+ }
1061
+ }
1062
+ });
1063
+ var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = chunkH2RMXG2Q_cjs.createRoute({
1064
+ method: "POST",
1065
+ path: "/api/workflows/:workflowId/observe-stream-legacy",
1066
+ responseType: "stream",
1067
+ pathParamSchema: workflowIdPathParams,
1068
+ queryParamSchema: chunkMCYD5LW7_cjs.runIdSchema,
1069
+ responseSchema: chunkBMYZ4DO6_cjs.streamResponseSchema,
1070
+ summary: "[DEPRECATED] Observe workflow stream with legacy format",
1071
+ description: "Legacy endpoint for observing workflow stream. Use /api/workflows/:workflowId/observe instead.",
1072
+ tags: ["Workflows", "Legacy"],
1073
+ handler: async ({ mastra, workflowId, runId }) => {
1074
+ try {
1075
+ if (!workflowId) {
1076
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
1077
+ }
1078
+ if (!runId) {
1079
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
1080
+ }
1081
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
1082
+ if (!workflow) {
1083
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
1084
+ }
1085
+ const run = await workflow.getWorkflowRunById(runId);
1086
+ if (!run) {
1087
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
1088
+ }
1089
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
1090
+ const serverCache = mastra.getServerCache();
1091
+ if (!serverCache) {
1092
+ throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
1093
+ }
1094
+ const transformStream = new web.TransformStream();
1095
+ const writer = transformStream.writable.getWriter();
1096
+ const cachedRunChunks = await serverCache.listFromTo(runId, 0);
1097
+ for (const chunk of cachedRunChunks) {
1098
+ await writer.write(chunk);
1099
+ }
1100
+ writer.releaseLock();
1101
+ const result = _run.observeStreamLegacy();
1102
+ return result.stream?.pipeThrough(transformStream);
1103
+ } catch (error) {
1104
+ return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
1105
+ }
1106
+ }
1107
+ });
1108
+
1109
+ exports.CANCEL_WORKFLOW_RUN_ROUTE = CANCEL_WORKFLOW_RUN_ROUTE;
1110
+ exports.CREATE_WORKFLOW_RUN_ROUTE = CREATE_WORKFLOW_RUN_ROUTE;
1111
+ exports.DELETE_WORKFLOW_RUN_BY_ID_ROUTE = DELETE_WORKFLOW_RUN_BY_ID_ROUTE;
1112
+ exports.GET_WORKFLOW_BY_ID_ROUTE = GET_WORKFLOW_BY_ID_ROUTE;
1113
+ exports.GET_WORKFLOW_RUN_BY_ID_ROUTE = GET_WORKFLOW_RUN_BY_ID_ROUTE;
1114
+ exports.GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE = GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE;
1115
+ exports.LIST_WORKFLOWS_ROUTE = LIST_WORKFLOWS_ROUTE;
1116
+ exports.LIST_WORKFLOW_RUNS_ROUTE = LIST_WORKFLOW_RUNS_ROUTE;
1117
+ exports.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE;
1118
+ exports.OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE = OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE;
1119
+ exports.OBSERVE_STREAM_WORKFLOW_ROUTE = OBSERVE_STREAM_WORKFLOW_ROUTE;
1120
+ exports.RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE = RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE;
1121
+ exports.RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE = RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE;
1122
+ exports.RESTART_ASYNC_WORKFLOW_ROUTE = RESTART_ASYNC_WORKFLOW_ROUTE;
1123
+ exports.RESTART_WORKFLOW_ROUTE = RESTART_WORKFLOW_ROUTE;
1124
+ exports.RESUME_ASYNC_WORKFLOW_ROUTE = RESUME_ASYNC_WORKFLOW_ROUTE;
1125
+ exports.RESUME_STREAM_WORKFLOW_ROUTE = RESUME_STREAM_WORKFLOW_ROUTE;
1126
+ exports.RESUME_WORKFLOW_ROUTE = RESUME_WORKFLOW_ROUTE;
1127
+ exports.START_ASYNC_WORKFLOW_ROUTE = START_ASYNC_WORKFLOW_ROUTE;
1128
+ exports.START_WORKFLOW_RUN_ROUTE = START_WORKFLOW_RUN_ROUTE;
1129
+ exports.STREAM_LEGACY_WORKFLOW_ROUTE = STREAM_LEGACY_WORKFLOW_ROUTE;
1130
+ exports.STREAM_VNEXT_WORKFLOW_ROUTE = STREAM_VNEXT_WORKFLOW_ROUTE;
1131
+ exports.STREAM_WORKFLOW_ROUTE = STREAM_WORKFLOW_ROUTE;
1132
+ exports.TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE;
1133
+ exports.TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = TIME_TRAVEL_STREAM_WORKFLOW_ROUTE;
1134
+ exports.TIME_TRAVEL_WORKFLOW_ROUTE = TIME_TRAVEL_WORKFLOW_ROUTE;
1135
+ exports.createWorkflowRunResponseSchema = createWorkflowRunResponseSchema;
1136
+ exports.listWorkflowRunsQuerySchema = listWorkflowRunsQuerySchema;
1137
+ exports.listWorkflowsResponseSchema = listWorkflowsResponseSchema;
1138
+ exports.resumeBodySchema = resumeBodySchema;
1139
+ exports.startAsyncWorkflowBodySchema = startAsyncWorkflowBodySchema;
1140
+ exports.streamLegacyWorkflowBodySchema = streamLegacyWorkflowBodySchema;
1141
+ exports.streamWorkflowBodySchema = streamWorkflowBodySchema;
1142
+ exports.workflowControlResponseSchema = workflowControlResponseSchema;
1143
+ exports.workflowExecutionResultSchema = workflowExecutionResultSchema;
1144
+ exports.workflowInfoSchema = workflowInfoSchema;
1145
+ exports.workflowRunResponseSchema = workflowRunResponseSchema;
1146
+ exports.workflowRunsResponseSchema = workflowRunsResponseSchema;
1147
+ exports.workflows_exports = workflows_exports;
1148
+ //# sourceMappingURL=chunk-P6S2HIVE.cjs.map
1149
+ //# sourceMappingURL=chunk-P6S2HIVE.cjs.map