@mastra/server 0.0.0-commonjs-20250414101718 → 0.0.0-configure-project-root-for-private-packages-20250919100548

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 (322) hide show
  1. package/CHANGELOG.md +3722 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +45 -137
  4. package/dist/chunk-3THIIWWW.cjs +484 -0
  5. package/dist/chunk-3THIIWWW.cjs.map +1 -0
  6. package/dist/{chunk-L7XE5QTW.js → chunk-4QCXUEAT.js} +11 -2
  7. package/dist/chunk-4QCXUEAT.js.map +1 -0
  8. package/dist/chunk-4RRMWXQ2.js +3522 -0
  9. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  10. package/dist/chunk-5DP5XZH6.cjs +928 -0
  11. package/dist/chunk-5DP5XZH6.cjs.map +1 -0
  12. package/dist/chunk-5QUKZCEF.js +476 -0
  13. package/dist/chunk-5QUKZCEF.js.map +1 -0
  14. package/dist/chunk-66YYHFGF.js +761 -0
  15. package/dist/chunk-66YYHFGF.js.map +1 -0
  16. package/dist/chunk-6GMFZ5LK.js +2774 -0
  17. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  18. package/dist/chunk-743UIDHI.cjs +2013 -0
  19. package/dist/chunk-743UIDHI.cjs.map +1 -0
  20. package/dist/{chunk-FV45V6WC.cjs → chunk-7NADHFD2.cjs} +3 -7
  21. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  22. package/dist/chunk-7QEJ5QG5.js +151 -0
  23. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  24. package/dist/chunk-A3AL7EWJ.js +83 -0
  25. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  26. package/dist/chunk-AK2FXLLB.cjs +849 -0
  27. package/dist/chunk-AK2FXLLB.cjs.map +1 -0
  28. package/dist/chunk-CY4TP3FK.js +16 -0
  29. package/dist/chunk-CY4TP3FK.js.map +1 -0
  30. package/dist/chunk-EMMSS5I5.cjs +37 -0
  31. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  32. package/dist/chunk-EMNGA4R4.js +845 -0
  33. package/dist/chunk-EMNGA4R4.js.map +1 -0
  34. package/dist/chunk-FALVL2VV.cjs +3525 -0
  35. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  36. package/dist/chunk-FQNT7PI4.js +937 -0
  37. package/dist/chunk-FQNT7PI4.js.map +1 -0
  38. package/dist/chunk-G3PMV62Z.js +33 -0
  39. package/dist/chunk-G3PMV62Z.js.map +1 -0
  40. package/dist/chunk-G4PUALCE.cjs +28 -0
  41. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  42. package/dist/chunk-G7PLDFT6.js +15711 -0
  43. package/dist/chunk-G7PLDFT6.js.map +1 -0
  44. package/dist/chunk-GU4EWMZB.cjs +769 -0
  45. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  46. package/dist/chunk-GUI3CROV.cjs +159 -0
  47. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  48. package/dist/chunk-HJ4EQIE6.cjs +15747 -0
  49. package/dist/chunk-HJ4EQIE6.cjs.map +1 -0
  50. package/dist/chunk-HJQKWRKQ.cjs +764 -0
  51. package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
  52. package/dist/chunk-HVBBFCDH.cjs +2321 -0
  53. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  54. package/dist/chunk-HZJRQ5L3.cjs +1411 -0
  55. package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
  56. package/dist/chunk-IGFMAZZ5.cjs +1150 -0
  57. package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
  58. package/dist/chunk-ILESGJ6N.js +524 -0
  59. package/dist/chunk-ILESGJ6N.js.map +1 -0
  60. package/dist/chunk-IOQGI4ML.js +931 -0
  61. package/dist/chunk-IOQGI4ML.js.map +1 -0
  62. package/dist/chunk-J7BPKKOG.cjs +163 -0
  63. package/dist/chunk-J7BPKKOG.cjs.map +1 -0
  64. package/dist/{chunk-3RVHWGWO.js → chunk-JRDEOHAJ.js} +49 -22
  65. package/dist/chunk-JRDEOHAJ.js.map +1 -0
  66. package/dist/chunk-K4GZBPXF.js +676 -0
  67. package/dist/chunk-K4GZBPXF.js.map +1 -0
  68. package/dist/chunk-KNGXRN26.cjs +335 -0
  69. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  70. package/dist/{chunk-DVPP5S6I.js → chunk-KV6VHX4V.js} +35 -10
  71. package/dist/chunk-KV6VHX4V.js.map +1 -0
  72. package/dist/chunk-L265APUD.cjs +69 -0
  73. package/dist/chunk-L265APUD.cjs.map +1 -0
  74. package/dist/chunk-LF2ZLOFP.js +767 -0
  75. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  76. package/dist/chunk-LYPU75T6.js +1147 -0
  77. package/dist/chunk-LYPU75T6.js.map +1 -0
  78. package/dist/{chunk-TRDNDNGQ.js → chunk-MMROOK5J.js} +4 -7
  79. package/dist/chunk-MMROOK5J.js.map +1 -0
  80. package/dist/chunk-N35YCWQ5.cjs +540 -0
  81. package/dist/chunk-N35YCWQ5.cjs.map +1 -0
  82. package/dist/chunk-N7F33WAD.js +2290 -0
  83. package/dist/chunk-N7F33WAD.js.map +1 -0
  84. package/dist/chunk-NG5IVLEZ.js +1012 -0
  85. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  86. package/dist/chunk-NLWACBE7.cjs +128 -0
  87. package/dist/chunk-NLWACBE7.cjs.map +1 -0
  88. package/dist/chunk-NZMDHQVP.cjs +697 -0
  89. package/dist/chunk-NZMDHQVP.cjs.map +1 -0
  90. package/dist/chunk-OGW6HHVI.js +1408 -0
  91. package/dist/chunk-OGW6HHVI.js.map +1 -0
  92. package/dist/chunk-OZLRIVC4.cjs +588 -0
  93. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  94. package/dist/chunk-P7CIEIJ3.js +925 -0
  95. package/dist/chunk-P7CIEIJ3.js.map +1 -0
  96. package/dist/chunk-P7RBMCBE.cjs +934 -0
  97. package/dist/chunk-P7RBMCBE.cjs.map +1 -0
  98. package/dist/chunk-PPYGWINI.cjs +2777 -0
  99. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  100. package/dist/{chunk-CWSDZEZG.cjs → chunk-PWTXZZTR.cjs} +39 -13
  101. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  102. package/dist/chunk-R7NOGUZG.js +65 -0
  103. package/dist/chunk-R7NOGUZG.js.map +1 -0
  104. package/dist/chunk-RCHEPTZZ.js +2006 -0
  105. package/dist/chunk-RCHEPTZZ.js.map +1 -0
  106. package/dist/chunk-RE4RPXT2.cjs +18 -0
  107. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  108. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  109. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  110. package/dist/chunk-SPLSYTYW.cjs +88 -0
  111. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  112. package/dist/chunk-SQY4T6EJ.js +571 -0
  113. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  114. package/dist/{chunk-YNSGUC2O.js → chunk-SYRRSBGL.js} +54 -14
  115. package/dist/chunk-SYRRSBGL.js.map +1 -0
  116. package/dist/{chunk-M56ECCHK.cjs → chunk-T3TIA3O6.cjs} +22 -19
  117. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  118. package/dist/{chunk-OPP7H5TW.js → chunk-TTHEEIZ3.js} +92 -74
  119. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  120. package/dist/chunk-TVSIG4JE.cjs +940 -0
  121. package/dist/chunk-TVSIG4JE.cjs.map +1 -0
  122. package/dist/{chunk-4JINXASC.js → chunk-WHN4VX55.js} +7 -4
  123. package/dist/chunk-WHN4VX55.js.map +1 -0
  124. package/dist/dist-26HWEQY6.js +3 -0
  125. package/dist/dist-26HWEQY6.js.map +1 -0
  126. package/dist/dist-3A5DXB37.cjs +20 -0
  127. package/dist/dist-3A5DXB37.cjs.map +1 -0
  128. package/dist/dist-3SJKQJGY.cjs +16 -0
  129. package/dist/dist-3SJKQJGY.cjs.map +1 -0
  130. package/dist/dist-4ZQSPE5K.js +3 -0
  131. package/dist/dist-4ZQSPE5K.js.map +1 -0
  132. package/dist/dist-5W5QNRTD.js +3 -0
  133. package/dist/dist-5W5QNRTD.js.map +1 -0
  134. package/dist/dist-653SRMPL.js +3 -0
  135. package/dist/dist-653SRMPL.js.map +1 -0
  136. package/dist/dist-6U6EFC5C.cjs +16 -0
  137. package/dist/dist-6U6EFC5C.cjs.map +1 -0
  138. package/dist/dist-7IHNNYMF.cjs +16 -0
  139. package/dist/dist-7IHNNYMF.cjs.map +1 -0
  140. package/dist/dist-B5IPRF6W.js +3 -0
  141. package/dist/dist-B5IPRF6W.js.map +1 -0
  142. package/dist/dist-EOMYFT4Y.cjs +16 -0
  143. package/dist/dist-EOMYFT4Y.cjs.map +1 -0
  144. package/dist/dist-EZZMMMNT.cjs +16 -0
  145. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  146. package/dist/dist-F2ET4MNO.cjs +16 -0
  147. package/dist/dist-F2ET4MNO.cjs.map +1 -0
  148. package/dist/dist-H64VX6DE.js +3 -0
  149. package/dist/dist-H64VX6DE.js.map +1 -0
  150. package/dist/dist-HY7RMLJQ.cjs +16 -0
  151. package/dist/dist-HY7RMLJQ.cjs.map +1 -0
  152. package/dist/dist-M6S4P3FJ.js +3 -0
  153. package/dist/dist-M6S4P3FJ.js.map +1 -0
  154. package/dist/dist-NR7QSCQT.js +3 -0
  155. package/dist/dist-NR7QSCQT.js.map +1 -0
  156. package/dist/dist-QLFMCMCX.js +3 -0
  157. package/dist/dist-QLFMCMCX.js.map +1 -0
  158. package/dist/dist-UY46BFRP.js +3 -0
  159. package/dist/dist-UY46BFRP.js.map +1 -0
  160. package/dist/dist-WCQDRTIV.cjs +16 -0
  161. package/dist/dist-WCQDRTIV.cjs.map +1 -0
  162. package/dist/dist-WKYB3LTJ.cjs +16 -0
  163. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  164. package/dist/index.cjs +6 -0
  165. package/dist/index.cjs.map +1 -0
  166. package/dist/index.d.ts +1 -0
  167. package/dist/index.d.ts.map +1 -0
  168. package/dist/index.js +5 -0
  169. package/dist/index.js.map +1 -0
  170. package/dist/server/a2a/protocol.d.ts +8 -0
  171. package/dist/server/a2a/protocol.d.ts.map +1 -0
  172. package/dist/server/a2a/store.cjs +25 -0
  173. package/dist/server/a2a/store.cjs.map +1 -0
  174. package/dist/server/a2a/store.d.ts +14 -0
  175. package/dist/server/a2a/store.d.ts.map +1 -0
  176. package/dist/server/a2a/store.js +23 -0
  177. package/dist/server/a2a/store.js.map +1 -0
  178. package/dist/server/a2a/tasks.d.ts +20 -0
  179. package/dist/server/a2a/tasks.d.ts.map +1 -0
  180. package/dist/server/handlers/a2a.cjs +32 -0
  181. package/dist/server/handlers/a2a.cjs.map +1 -0
  182. package/dist/server/handlers/a2a.d.ts +68 -0
  183. package/dist/server/handlers/a2a.d.ts.map +1 -0
  184. package/dist/server/handlers/a2a.js +3 -0
  185. package/dist/server/handlers/a2a.js.map +1 -0
  186. package/dist/server/handlers/agent-builder.cjs +68 -0
  187. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  188. package/dist/server/handlers/agent-builder.d.ts +88 -0
  189. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  190. package/dist/server/handlers/agent-builder.js +3 -0
  191. package/dist/server/handlers/agent-builder.js.map +1 -0
  192. package/dist/server/handlers/agents.cjs +41 -7
  193. package/dist/server/handlers/agents.cjs.map +1 -0
  194. package/dist/server/handlers/agents.d.ts +139 -6
  195. package/dist/server/handlers/agents.d.ts.map +1 -0
  196. package/dist/server/handlers/agents.js +3 -1
  197. package/dist/server/handlers/agents.js.map +1 -0
  198. package/dist/server/handlers/error.cjs +4 -2
  199. package/dist/server/handlers/error.cjs.map +1 -0
  200. package/dist/server/handlers/error.d.ts +2 -1
  201. package/dist/server/handlers/error.d.ts.map +1 -0
  202. package/dist/server/handlers/error.js +3 -1
  203. package/dist/server/handlers/error.js.map +1 -0
  204. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  205. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  206. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  207. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  208. package/dist/server/handlers/legacyWorkflows.js +3 -0
  209. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  210. package/dist/server/handlers/logs.cjs +6 -4
  211. package/dist/server/handlers/logs.cjs.map +1 -0
  212. package/dist/server/handlers/logs.d.ts +34 -3
  213. package/dist/server/handlers/logs.d.ts.map +1 -0
  214. package/dist/server/handlers/logs.js +3 -1
  215. package/dist/server/handlers/logs.js.map +1 -0
  216. package/dist/server/handlers/memory.cjs +39 -9
  217. package/dist/server/handlers/memory.cjs.map +1 -0
  218. package/dist/server/handlers/memory.d.ts +118 -8
  219. package/dist/server/handlers/memory.d.ts.map +1 -0
  220. package/dist/server/handlers/memory.js +3 -1
  221. package/dist/server/handlers/memory.js.map +1 -0
  222. package/dist/server/handlers/observability.cjs +16 -0
  223. package/dist/server/handlers/observability.cjs.map +1 -0
  224. package/dist/server/handlers/observability.d.ts +23 -0
  225. package/dist/server/handlers/observability.d.ts.map +1 -0
  226. package/dist/server/handlers/observability.js +3 -0
  227. package/dist/server/handlers/observability.js.map +1 -0
  228. package/dist/server/handlers/scores.cjs +32 -0
  229. package/dist/server/handlers/scores.cjs.map +1 -0
  230. package/dist/server/handlers/scores.d.ts +49 -0
  231. package/dist/server/handlers/scores.d.ts.map +1 -0
  232. package/dist/server/handlers/scores.js +3 -0
  233. package/dist/server/handlers/scores.js.map +1 -0
  234. package/dist/server/handlers/telemetry.cjs +9 -3
  235. package/dist/server/handlers/telemetry.cjs.map +1 -0
  236. package/dist/server/handlers/telemetry.d.ts +33 -2
  237. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  238. package/dist/server/handlers/telemetry.js +3 -1
  239. package/dist/server/handlers/telemetry.js.map +1 -0
  240. package/dist/server/handlers/tools.cjs +11 -5
  241. package/dist/server/handlers/tools.cjs.map +1 -0
  242. package/dist/server/handlers/tools.d.ts +25 -4
  243. package/dist/server/handlers/tools.d.ts.map +1 -0
  244. package/dist/server/handlers/tools.js +3 -1
  245. package/dist/server/handlers/tools.js.map +1 -0
  246. package/dist/server/handlers/utils.cjs +8 -2
  247. package/dist/server/handlers/utils.cjs.map +1 -0
  248. package/dist/server/handlers/utils.d.ts +8 -1
  249. package/dist/server/handlers/utils.d.ts.map +1 -0
  250. package/dist/server/handlers/utils.js +3 -1
  251. package/dist/server/handlers/utils.js.map +1 -0
  252. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  253. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  254. package/dist/server/handlers/vNextNetwork.d.ts +246 -0
  255. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  256. package/dist/server/handlers/vNextNetwork.js +213 -0
  257. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  258. package/dist/server/handlers/vector.cjs +9 -7
  259. package/dist/server/handlers/vector.cjs.map +1 -0
  260. package/dist/server/handlers/vector.d.ts +51 -6
  261. package/dist/server/handlers/vector.d.ts.map +1 -0
  262. package/dist/server/handlers/vector.js +3 -1
  263. package/dist/server/handlers/vector.js.map +1 -0
  264. package/dist/server/handlers/voice.cjs +10 -4
  265. package/dist/server/handlers/voice.cjs.map +1 -0
  266. package/dist/server/handlers/voice.d.ts +41 -3
  267. package/dist/server/handlers/voice.d.ts.map +1 -0
  268. package/dist/server/handlers/voice.js +3 -1
  269. package/dist/server/handlers/voice.js.map +1 -0
  270. package/dist/server/handlers/workflows.cjs +43 -13
  271. package/dist/server/handlers/workflows.cjs.map +1 -0
  272. package/dist/server/handlers/workflows.d.ts +82 -10
  273. package/dist/server/handlers/workflows.d.ts.map +1 -0
  274. package/dist/server/handlers/workflows.js +3 -1
  275. package/dist/server/handlers/workflows.js.map +1 -0
  276. package/dist/server/handlers.cjs +49 -27
  277. package/dist/server/handlers.cjs.map +1 -0
  278. package/dist/server/handlers.d.ts +14 -9
  279. package/dist/server/handlers.d.ts.map +1 -0
  280. package/dist/server/handlers.js +15 -9
  281. package/dist/server/handlers.js.map +1 -0
  282. package/dist/server/http-exception.d.ts +87 -0
  283. package/dist/server/http-exception.d.ts.map +1 -0
  284. package/dist/server/types.d.ts +10 -0
  285. package/dist/server/types.d.ts.map +1 -0
  286. package/dist/server/utils.d.ts +42 -0
  287. package/dist/server/utils.d.ts.map +1 -0
  288. package/package.json +51 -19
  289. package/dist/_tsup-dts-rollup.d.cts +0 -571
  290. package/dist/_tsup-dts-rollup.d.ts +0 -571
  291. package/dist/chunk-2FJURXCL.cjs +0 -213
  292. package/dist/chunk-3AHQ5RGN.js +0 -11
  293. package/dist/chunk-3EJZQ6TQ.js +0 -49
  294. package/dist/chunk-4C3EPMMF.cjs +0 -122
  295. package/dist/chunk-67WTHYAV.js +0 -156
  296. package/dist/chunk-A7DF4ETD.cjs +0 -100
  297. package/dist/chunk-B64YROKU.cjs +0 -317
  298. package/dist/chunk-JLDXUWK7.cjs +0 -126
  299. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  300. package/dist/chunk-QN4KF3BH.cjs +0 -18
  301. package/dist/chunk-RBQASTUP.js +0 -203
  302. package/dist/chunk-SKBVVI24.cjs +0 -54
  303. package/dist/chunk-VK6FX47H.js +0 -5576
  304. package/dist/chunk-YANVFOYA.js +0 -120
  305. package/dist/chunk-Z46X3YCB.cjs +0 -164
  306. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  307. package/dist/index.d.cts +0 -1
  308. package/dist/server/handlers/agents.d.cts +0 -6
  309. package/dist/server/handlers/error.d.cts +0 -1
  310. package/dist/server/handlers/logs.d.cts +0 -3
  311. package/dist/server/handlers/memory.d.cts +0 -8
  312. package/dist/server/handlers/network.cjs +0 -22
  313. package/dist/server/handlers/network.d.cts +0 -4
  314. package/dist/server/handlers/network.d.ts +0 -4
  315. package/dist/server/handlers/network.js +0 -1
  316. package/dist/server/handlers/telemetry.d.cts +0 -2
  317. package/dist/server/handlers/tools.d.cts +0 -4
  318. package/dist/server/handlers/utils.d.cts +0 -1
  319. package/dist/server/handlers/vector.d.cts +0 -6
  320. package/dist/server/handlers/voice.d.cts +0 -3
  321. package/dist/server/handlers/workflows.d.cts +0 -10
  322. package/dist/server/handlers.d.cts +0 -9
@@ -0,0 +1,697 @@
1
+ 'use strict';
2
+
3
+ var chunkGU4EWMZB_cjs = require('./chunk-GU4EWMZB.cjs');
4
+ var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
5
+ var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
6
+ var chunkEMMSS5I5_cjs = require('./chunk-EMMSS5I5.cjs');
7
+ var web = require('stream/web');
8
+ var zodToJson = require('@mastra/core/utils/zod-to-json');
9
+
10
+ // src/server/handlers/workflows.ts
11
+ var workflows_exports = {};
12
+ chunkEMMSS5I5_cjs.__export(workflows_exports, {
13
+ cancelWorkflowRunHandler: () => cancelWorkflowRunHandler,
14
+ createWorkflowRunHandler: () => createWorkflowRunHandler,
15
+ getWorkflowByIdHandler: () => getWorkflowByIdHandler,
16
+ getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
17
+ getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
18
+ getWorkflowRunsHandler: () => getWorkflowRunsHandler,
19
+ getWorkflowsHandler: () => getWorkflowsHandler,
20
+ observeStreamWorkflowHandler: () => observeStreamWorkflowHandler,
21
+ resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
22
+ resumeStreamWorkflowHandler: () => resumeStreamWorkflowHandler,
23
+ resumeWorkflowHandler: () => resumeWorkflowHandler,
24
+ sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
25
+ startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
26
+ startWorkflowRunHandler: () => startWorkflowRunHandler,
27
+ streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
28
+ streamWorkflowHandler: () => streamWorkflowHandler,
29
+ watchWorkflowHandler: () => watchWorkflowHandler
30
+ });
31
+ function getSteps(steps, path) {
32
+ return Object.entries(steps).reduce((acc, [key, step]) => {
33
+ const fullKey = path ? `${path}.${key}` : key;
34
+ acc[fullKey] = {
35
+ id: step.id,
36
+ description: step.description,
37
+ inputSchema: step.inputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.inputSchema)) : void 0,
38
+ outputSchema: step.outputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.outputSchema)) : void 0,
39
+ resumeSchema: step.resumeSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.resumeSchema)) : void 0,
40
+ suspendSchema: step.suspendSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.suspendSchema)) : void 0,
41
+ isWorkflow: step.component === "WORKFLOW"
42
+ };
43
+ if (step.component === "WORKFLOW" && step.steps) {
44
+ const nestedSteps = getSteps(step.steps, fullKey) || {};
45
+ acc = { ...acc, ...nestedSteps };
46
+ }
47
+ return acc;
48
+ }, {});
49
+ }
50
+ function getWorkflowInfo(workflow) {
51
+ return {
52
+ name: workflow.name,
53
+ description: workflow.description,
54
+ steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
55
+ acc[key] = {
56
+ id: step.id,
57
+ description: step.description,
58
+ inputSchema: step.inputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.inputSchema)) : void 0,
59
+ outputSchema: step.outputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.outputSchema)) : void 0,
60
+ resumeSchema: step.resumeSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.resumeSchema)) : void 0,
61
+ suspendSchema: step.suspendSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(step.suspendSchema)) : void 0
62
+ };
63
+ return acc;
64
+ }, {}),
65
+ allSteps: getSteps(workflow.steps) || {},
66
+ stepGraph: workflow.serializedStepGraph,
67
+ inputSchema: workflow.inputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(workflow.inputSchema)) : void 0,
68
+ outputSchema: workflow.outputSchema ? chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(workflow.outputSchema)) : void 0
69
+ };
70
+ }
71
+ var WorkflowRegistry = class {
72
+ static additionalWorkflows = {};
73
+ /**
74
+ * Register a workflow temporarily
75
+ */
76
+ static registerTemporaryWorkflow(id, workflow) {
77
+ this.additionalWorkflows[id] = workflow;
78
+ }
79
+ /**
80
+ * Register all workflows from map
81
+ */
82
+ static registerTemporaryWorkflows(workflows, mastra) {
83
+ for (const [id, workflow] of Object.entries(workflows)) {
84
+ if (mastra) {
85
+ workflow.__registerMastra(mastra);
86
+ workflow.__registerPrimitives({
87
+ logger: mastra.getLogger(),
88
+ telemetry: mastra.getTelemetry(),
89
+ storage: mastra.getStorage(),
90
+ memory: mastra.getMemory(),
91
+ agents: mastra.getAgents(),
92
+ tts: mastra.getTTS(),
93
+ vectors: mastra.getVectors()
94
+ });
95
+ }
96
+ this.additionalWorkflows[id] = workflow;
97
+ }
98
+ }
99
+ /**
100
+ * Get a workflow by ID from the registry (returns undefined if not found)
101
+ */
102
+ static getWorkflow(workflowId) {
103
+ return this.additionalWorkflows[workflowId];
104
+ }
105
+ /**
106
+ * Get all workflows from the registry
107
+ */
108
+ static getAllWorkflows() {
109
+ return { ...this.additionalWorkflows };
110
+ }
111
+ /**
112
+ * Clean up a temporary workflow
113
+ */
114
+ static cleanupTemporaryWorkflow(workflowId) {
115
+ delete this.additionalWorkflows[workflowId];
116
+ }
117
+ /**
118
+ * Clean up all registered workflows
119
+ */
120
+ static cleanup() {
121
+ this.additionalWorkflows = {};
122
+ }
123
+ /**
124
+ * Check if a workflow ID is a valid agent-builder workflow
125
+ */
126
+ static isAgentBuilderWorkflow(workflowId) {
127
+ return workflowId in this.additionalWorkflows;
128
+ }
129
+ /**
130
+ * Get all registered temporary workflow IDs (for debugging)
131
+ */
132
+ static getRegisteredWorkflowIds() {
133
+ return Object.keys(this.additionalWorkflows);
134
+ }
135
+ };
136
+
137
+ // src/server/handlers/workflows.ts
138
+ async function getWorkflowsHandler({ mastra }) {
139
+ try {
140
+ const workflows = mastra.getWorkflows({ serialized: false });
141
+ const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
142
+ acc[key] = getWorkflowInfo(workflow);
143
+ return acc;
144
+ }, {});
145
+ return _workflows;
146
+ } catch (error) {
147
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflows");
148
+ }
149
+ }
150
+ async function getWorkflowsFromSystem({ mastra, workflowId }) {
151
+ const logger = mastra.getLogger();
152
+ if (!workflowId) {
153
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
154
+ }
155
+ let workflow;
156
+ workflow = WorkflowRegistry.getWorkflow(workflowId);
157
+ if (!workflow) {
158
+ try {
159
+ workflow = mastra.getWorkflow(workflowId);
160
+ } catch (error) {
161
+ logger.debug("Error getting workflow, searching agents for workflow", error);
162
+ }
163
+ }
164
+ if (!workflow) {
165
+ logger.debug("Workflow not found, searching agents for workflow", { workflowId });
166
+ const agents = mastra.getAgents();
167
+ if (Object.keys(agents || {}).length) {
168
+ for (const [_, agent] of Object.entries(agents)) {
169
+ try {
170
+ const workflows = await agent.getWorkflows();
171
+ if (workflows[workflowId]) {
172
+ workflow = workflows[workflowId];
173
+ break;
174
+ }
175
+ break;
176
+ } catch (error) {
177
+ logger.debug("Error getting workflow from agent", error);
178
+ }
179
+ }
180
+ }
181
+ }
182
+ if (!workflow) {
183
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
184
+ }
185
+ return { workflow };
186
+ }
187
+ async function getWorkflowByIdHandler({ mastra, workflowId }) {
188
+ try {
189
+ if (!workflowId) {
190
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
191
+ }
192
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
193
+ if (!workflow) {
194
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
195
+ }
196
+ return getWorkflowInfo(workflow);
197
+ } catch (error) {
198
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow");
199
+ }
200
+ }
201
+ async function getWorkflowRunByIdHandler({
202
+ mastra,
203
+ workflowId,
204
+ runId
205
+ }) {
206
+ try {
207
+ if (!workflowId) {
208
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
209
+ }
210
+ if (!runId) {
211
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
212
+ }
213
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
214
+ if (!workflow) {
215
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
216
+ }
217
+ const run = await workflow.getWorkflowRunById(runId);
218
+ if (!run) {
219
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
220
+ }
221
+ return run;
222
+ } catch (error) {
223
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run");
224
+ }
225
+ }
226
+ async function getWorkflowRunExecutionResultHandler({
227
+ mastra,
228
+ workflowId,
229
+ runId
230
+ }) {
231
+ try {
232
+ if (!workflowId) {
233
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
234
+ }
235
+ if (!runId) {
236
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
237
+ }
238
+ const workflow = mastra.getWorkflow(workflowId);
239
+ if (!workflow) {
240
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
241
+ }
242
+ const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
243
+ if (!executionResult) {
244
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
245
+ }
246
+ return executionResult;
247
+ } catch (error) {
248
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run execution result");
249
+ }
250
+ }
251
+ async function createWorkflowRunHandler({
252
+ mastra,
253
+ workflowId,
254
+ runId: prevRunId
255
+ }) {
256
+ try {
257
+ if (!workflowId) {
258
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
259
+ }
260
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
261
+ if (!workflow) {
262
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
263
+ }
264
+ const run = await workflow.createRunAsync({ runId: prevRunId });
265
+ return { runId: run.runId };
266
+ } catch (error) {
267
+ return chunkRE4RPXT2_cjs.handleError(error, "Error creating workflow run");
268
+ }
269
+ }
270
+ async function startAsyncWorkflowHandler({
271
+ mastra,
272
+ runtimeContext,
273
+ workflowId,
274
+ runId,
275
+ inputData
276
+ }) {
277
+ try {
278
+ if (!workflowId) {
279
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
280
+ }
281
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
282
+ if (!workflow) {
283
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
284
+ }
285
+ const _run = await workflow.createRunAsync({ runId });
286
+ const result = await _run.start({
287
+ inputData,
288
+ runtimeContext
289
+ });
290
+ return result;
291
+ } catch (error) {
292
+ return chunkRE4RPXT2_cjs.handleError(error, "Error starting async workflow");
293
+ }
294
+ }
295
+ async function startWorkflowRunHandler({
296
+ mastra,
297
+ runtimeContext,
298
+ workflowId,
299
+ runId,
300
+ inputData
301
+ }) {
302
+ try {
303
+ if (!workflowId) {
304
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
305
+ }
306
+ if (!runId) {
307
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to start run" });
308
+ }
309
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
310
+ if (!workflow) {
311
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
312
+ }
313
+ const run = await workflow.getWorkflowRunById(runId);
314
+ if (!run) {
315
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
316
+ }
317
+ const _run = await workflow.createRunAsync({ runId });
318
+ void _run.start({
319
+ inputData,
320
+ runtimeContext
321
+ });
322
+ return { message: "Workflow run started" };
323
+ } catch (e) {
324
+ return chunkRE4RPXT2_cjs.handleError(e, "Error starting workflow run");
325
+ }
326
+ }
327
+ async function watchWorkflowHandler({
328
+ mastra,
329
+ workflowId,
330
+ runId,
331
+ eventType = "watch"
332
+ }) {
333
+ try {
334
+ if (!workflowId) {
335
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
336
+ }
337
+ if (!runId) {
338
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to watch workflow" });
339
+ }
340
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
341
+ if (!workflow) {
342
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
343
+ }
344
+ const run = await workflow.getWorkflowRunById(runId);
345
+ if (!run) {
346
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
347
+ }
348
+ const _run = await workflow.createRunAsync({ runId });
349
+ let unwatch;
350
+ let asyncRef = null;
351
+ const stream = new web.ReadableStream({
352
+ start(controller) {
353
+ unwatch = _run.watch((event) => {
354
+ const { type, payload, eventTimestamp } = event;
355
+ controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
356
+ if (asyncRef) {
357
+ clearImmediate(asyncRef);
358
+ asyncRef = null;
359
+ }
360
+ asyncRef = setImmediate(async () => {
361
+ const runDone = eventType === "watch" ? payload.workflowState.status !== "running" : type === "finish";
362
+ if (runDone) {
363
+ controller.close();
364
+ unwatch?.();
365
+ }
366
+ });
367
+ }, eventType);
368
+ },
369
+ cancel() {
370
+ if (asyncRef) {
371
+ clearImmediate(asyncRef);
372
+ asyncRef = null;
373
+ }
374
+ unwatch?.();
375
+ }
376
+ });
377
+ return stream;
378
+ } catch (error) {
379
+ return chunkRE4RPXT2_cjs.handleError(error, "Error watching workflow");
380
+ }
381
+ }
382
+ async function streamWorkflowHandler({
383
+ mastra,
384
+ runtimeContext,
385
+ workflowId,
386
+ runId,
387
+ inputData
388
+ }) {
389
+ try {
390
+ if (!workflowId) {
391
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
392
+ }
393
+ if (!runId) {
394
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
395
+ }
396
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
397
+ if (!workflow) {
398
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
399
+ }
400
+ const serverCache = mastra.getServerCache();
401
+ const run = await workflow.createRunAsync({ runId });
402
+ const result = run.stream({
403
+ inputData,
404
+ runtimeContext,
405
+ onChunk: async (chunk) => {
406
+ if (serverCache) {
407
+ const cacheKey = runId;
408
+ await serverCache.listPush(cacheKey, chunk);
409
+ }
410
+ }
411
+ });
412
+ return result;
413
+ } catch (error) {
414
+ return chunkRE4RPXT2_cjs.handleError(error, "Error executing workflow");
415
+ }
416
+ }
417
+ async function observeStreamWorkflowHandler({
418
+ mastra,
419
+ workflowId,
420
+ runId
421
+ }) {
422
+ try {
423
+ if (!workflowId) {
424
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
425
+ }
426
+ if (!runId) {
427
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
428
+ }
429
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
430
+ if (!workflow) {
431
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
432
+ }
433
+ const run = await workflow.getWorkflowRunById(runId);
434
+ if (!run) {
435
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
436
+ }
437
+ const _run = await workflow.createRunAsync({ runId });
438
+ const serverCache = mastra.getServerCache();
439
+ if (!serverCache) {
440
+ throw new chunk7NADHFD2_cjs.HTTPException(500, { message: "Server cache not found" });
441
+ }
442
+ const transformStream = new web.TransformStream();
443
+ const writer = transformStream.writable.getWriter();
444
+ const cachedRunChunks = await serverCache.listFromTo(runId, 0);
445
+ for (const chunk of cachedRunChunks) {
446
+ await writer.write(chunk);
447
+ }
448
+ writer.releaseLock();
449
+ const result = _run.observeStream();
450
+ return result.stream?.pipeThrough(transformStream);
451
+ } catch (error) {
452
+ return chunkRE4RPXT2_cjs.handleError(error, "Error observing workflow stream");
453
+ }
454
+ }
455
+ async function streamVNextWorkflowHandler({
456
+ mastra,
457
+ runtimeContext,
458
+ workflowId,
459
+ runId,
460
+ inputData,
461
+ closeOnSuspend
462
+ }) {
463
+ try {
464
+ if (!workflowId) {
465
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
466
+ }
467
+ if (!runId) {
468
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to stream workflow" });
469
+ }
470
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
471
+ if (!workflow) {
472
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
473
+ }
474
+ const run = await workflow.createRunAsync({ runId });
475
+ const result = run.streamVNext({
476
+ inputData,
477
+ runtimeContext,
478
+ closeOnSuspend
479
+ });
480
+ return result;
481
+ } catch (error) {
482
+ return chunkRE4RPXT2_cjs.handleError(error, "Error streaming workflow");
483
+ }
484
+ }
485
+ async function resumeAsyncWorkflowHandler({
486
+ mastra,
487
+ workflowId,
488
+ runId,
489
+ body,
490
+ runtimeContext
491
+ }) {
492
+ try {
493
+ if (!workflowId) {
494
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
495
+ }
496
+ if (!runId) {
497
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
498
+ }
499
+ if (!body.step) {
500
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
501
+ }
502
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
503
+ if (!workflow) {
504
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
505
+ }
506
+ const run = await workflow.getWorkflowRunById(runId);
507
+ if (!run) {
508
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
509
+ }
510
+ const _run = await workflow.createRunAsync({ runId });
511
+ const result = await _run.resume({
512
+ step: body.step,
513
+ resumeData: body.resumeData,
514
+ runtimeContext
515
+ });
516
+ return result;
517
+ } catch (error) {
518
+ return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow step");
519
+ }
520
+ }
521
+ async function resumeWorkflowHandler({
522
+ mastra,
523
+ workflowId,
524
+ runId,
525
+ body,
526
+ runtimeContext
527
+ }) {
528
+ try {
529
+ if (!workflowId) {
530
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
531
+ }
532
+ if (!runId) {
533
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
534
+ }
535
+ if (!body.step) {
536
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
537
+ }
538
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
539
+ if (!workflow) {
540
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
541
+ }
542
+ const run = await workflow.getWorkflowRunById(runId);
543
+ if (!run) {
544
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
545
+ }
546
+ const _run = await workflow.createRunAsync({ runId });
547
+ void _run.resume({
548
+ step: body.step,
549
+ resumeData: body.resumeData,
550
+ runtimeContext
551
+ });
552
+ return { message: "Workflow run resumed" };
553
+ } catch (error) {
554
+ return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
555
+ }
556
+ }
557
+ async function resumeStreamWorkflowHandler({
558
+ mastra,
559
+ workflowId,
560
+ runId,
561
+ body,
562
+ runtimeContext
563
+ }) {
564
+ try {
565
+ if (!workflowId) {
566
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
567
+ }
568
+ if (!runId) {
569
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
570
+ }
571
+ if (!body.step) {
572
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
573
+ }
574
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
575
+ if (!workflow) {
576
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
577
+ }
578
+ const run = await workflow.getWorkflowRunById(runId);
579
+ if (!run) {
580
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
581
+ }
582
+ const _run = await workflow.createRunAsync({ runId });
583
+ const stream = await _run.resumeStreamVNext({
584
+ step: body.step,
585
+ resumeData: body.resumeData,
586
+ runtimeContext
587
+ });
588
+ return stream;
589
+ } catch (error) {
590
+ return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
591
+ }
592
+ }
593
+ async function getWorkflowRunsHandler({
594
+ mastra,
595
+ workflowId,
596
+ fromDate,
597
+ toDate,
598
+ limit,
599
+ offset,
600
+ resourceId
601
+ }) {
602
+ try {
603
+ if (!workflowId) {
604
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
605
+ }
606
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
607
+ if (!workflow) {
608
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
609
+ }
610
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
611
+ runs: [],
612
+ total: 0
613
+ };
614
+ return workflowRuns;
615
+ } catch (error) {
616
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow runs");
617
+ }
618
+ }
619
+ async function cancelWorkflowRunHandler({
620
+ mastra,
621
+ workflowId,
622
+ runId
623
+ }) {
624
+ try {
625
+ if (!workflowId) {
626
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
627
+ }
628
+ if (!runId) {
629
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
630
+ }
631
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
632
+ if (!workflow) {
633
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
634
+ }
635
+ const run = await workflow.getWorkflowRunById(runId);
636
+ if (!run) {
637
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
638
+ }
639
+ const _run = await workflow.createRunAsync({ runId });
640
+ await _run.cancel();
641
+ return { message: "Workflow run cancelled" };
642
+ } catch (error) {
643
+ return chunkRE4RPXT2_cjs.handleError(error, "Error canceling workflow run");
644
+ }
645
+ }
646
+ async function sendWorkflowRunEventHandler({
647
+ mastra,
648
+ workflowId,
649
+ runId,
650
+ event,
651
+ data
652
+ }) {
653
+ try {
654
+ if (!workflowId) {
655
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
656
+ }
657
+ if (!runId) {
658
+ throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
659
+ }
660
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
661
+ if (!workflow) {
662
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
663
+ }
664
+ const run = await workflow.getWorkflowRunById(runId);
665
+ if (!run) {
666
+ throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
667
+ }
668
+ const _run = await workflow.createRunAsync({ runId });
669
+ await _run.sendEvent(event, data);
670
+ return { message: "Workflow run event sent" };
671
+ } catch (error) {
672
+ return chunkRE4RPXT2_cjs.handleError(error, "Error sending workflow run event");
673
+ }
674
+ }
675
+
676
+ exports.WorkflowRegistry = WorkflowRegistry;
677
+ exports.cancelWorkflowRunHandler = cancelWorkflowRunHandler;
678
+ exports.createWorkflowRunHandler = createWorkflowRunHandler;
679
+ exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
680
+ exports.getWorkflowInfo = getWorkflowInfo;
681
+ exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
682
+ exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
683
+ exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
684
+ exports.getWorkflowsHandler = getWorkflowsHandler;
685
+ exports.observeStreamWorkflowHandler = observeStreamWorkflowHandler;
686
+ exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
687
+ exports.resumeStreamWorkflowHandler = resumeStreamWorkflowHandler;
688
+ exports.resumeWorkflowHandler = resumeWorkflowHandler;
689
+ exports.sendWorkflowRunEventHandler = sendWorkflowRunEventHandler;
690
+ exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
691
+ exports.startWorkflowRunHandler = startWorkflowRunHandler;
692
+ exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
693
+ exports.streamWorkflowHandler = streamWorkflowHandler;
694
+ exports.watchWorkflowHandler = watchWorkflowHandler;
695
+ exports.workflows_exports = workflows_exports;
696
+ //# sourceMappingURL=chunk-NZMDHQVP.cjs.map
697
+ //# sourceMappingURL=chunk-NZMDHQVP.cjs.map