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