@mastra/server 0.0.0-expose-more-playground-ui-20250502141824 → 0.0.0-extract-tool-ui-inp-playground-ui-20251023135343

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 (282) hide show
  1. package/CHANGELOG.md +4165 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +45 -137
  4. package/dist/chunk-2PLXW4ZX.cjs +2777 -0
  5. package/dist/chunk-2PLXW4ZX.cjs.map +1 -0
  6. package/dist/chunk-2S4IMB6E.cjs +130 -0
  7. package/dist/chunk-2S4IMB6E.cjs.map +1 -0
  8. package/dist/chunk-2V3K6DKN.js +692 -0
  9. package/dist/chunk-2V3K6DKN.js.map +1 -0
  10. package/dist/chunk-3SNGNFUJ.cjs +128 -0
  11. package/dist/chunk-3SNGNFUJ.cjs.map +1 -0
  12. package/dist/{chunk-L7XE5QTW.js → chunk-4QCXUEAT.js} +11 -2
  13. package/dist/chunk-4QCXUEAT.js.map +1 -0
  14. package/dist/chunk-5OR5IUUV.cjs +713 -0
  15. package/dist/chunk-5OR5IUUV.cjs.map +1 -0
  16. package/dist/{chunk-WTHDCRMY.js → chunk-67GYDFSB.js} +33 -8
  17. package/dist/chunk-67GYDFSB.js.map +1 -0
  18. package/dist/{chunk-7IWQE76Z.cjs → chunk-6ZR275MD.cjs} +37 -11
  19. package/dist/chunk-6ZR275MD.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-ABRFV4XP.js +83 -0
  23. package/dist/chunk-ABRFV4XP.js.map +1 -0
  24. package/dist/{chunk-5JNVY6DU.js → chunk-AHB4JCIQ.js} +52 -12
  25. package/dist/chunk-AHB4JCIQ.js.map +1 -0
  26. package/dist/chunk-AW5BU3RQ.js +192 -0
  27. package/dist/chunk-AW5BU3RQ.js.map +1 -0
  28. package/dist/chunk-BATEJLED.js +124 -0
  29. package/dist/chunk-BATEJLED.js.map +1 -0
  30. package/dist/chunk-CVOGYUL7.js +19480 -0
  31. package/dist/chunk-CVOGYUL7.js.map +1 -0
  32. package/dist/chunk-CY4TP3FK.js +16 -0
  33. package/dist/chunk-CY4TP3FK.js.map +1 -0
  34. package/dist/{chunk-M56ECCHK.cjs → chunk-EP3JQDPD.cjs} +22 -19
  35. package/dist/chunk-EP3JQDPD.cjs.map +1 -0
  36. package/dist/chunk-G4PUALCE.cjs +28 -0
  37. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  38. package/dist/chunk-GU4EWMZB.cjs +769 -0
  39. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  40. package/dist/chunk-HPXAM2PG.js +477 -0
  41. package/dist/chunk-HPXAM2PG.js.map +1 -0
  42. package/dist/chunk-I3C4ODGV.cjs +335 -0
  43. package/dist/chunk-I3C4ODGV.cjs.map +1 -0
  44. package/dist/chunk-JTXOSCJQ.cjs +595 -0
  45. package/dist/chunk-JTXOSCJQ.cjs.map +1 -0
  46. package/dist/chunk-LF2ZLOFP.js +767 -0
  47. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  48. package/dist/{chunk-M3YJLWTU.js → chunk-LLUOPR3J.js} +77 -63
  49. package/dist/chunk-LLUOPR3J.js.map +1 -0
  50. package/dist/chunk-LPM6BBAX.cjs +1043 -0
  51. package/dist/chunk-LPM6BBAX.cjs.map +1 -0
  52. package/dist/chunk-MH2EOSRX.js +578 -0
  53. package/dist/chunk-MH2EOSRX.js.map +1 -0
  54. package/dist/{chunk-TRDNDNGQ.js → chunk-MMROOK5J.js} +4 -7
  55. package/dist/chunk-MMROOK5J.js.map +1 -0
  56. package/dist/{chunk-4JINXASC.js → chunk-MYR4PVGN.js} +7 -4
  57. package/dist/chunk-MYR4PVGN.js.map +1 -0
  58. package/dist/chunk-O7I5CWRX.cjs +44 -0
  59. package/dist/chunk-O7I5CWRX.cjs.map +1 -0
  60. package/dist/chunk-PR4QN5HX.js +39 -0
  61. package/dist/chunk-PR4QN5HX.js.map +1 -0
  62. package/dist/{chunk-Q6SHQECN.js → chunk-QQXMIP6C.js} +47 -13
  63. package/dist/chunk-QQXMIP6C.js.map +1 -0
  64. package/dist/chunk-QU6N55W6.cjs +256 -0
  65. package/dist/chunk-QU6N55W6.cjs.map +1 -0
  66. package/dist/chunk-RE4RPXT2.cjs +18 -0
  67. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  68. package/dist/chunk-RJX63KSA.cjs +729 -0
  69. package/dist/chunk-RJX63KSA.cjs.map +1 -0
  70. package/dist/chunk-RQK4FQUD.js +1012 -0
  71. package/dist/chunk-RQK4FQUD.js.map +1 -0
  72. package/dist/chunk-SHWNNZBL.js +254 -0
  73. package/dist/chunk-SHWNNZBL.js.map +1 -0
  74. package/dist/chunk-SPRRK3P7.cjs +200 -0
  75. package/dist/chunk-SPRRK3P7.cjs.map +1 -0
  76. package/dist/chunk-TOCYBDP2.js +46 -0
  77. package/dist/chunk-TOCYBDP2.js.map +1 -0
  78. package/dist/chunk-TOP25AIO.cjs +485 -0
  79. package/dist/chunk-TOP25AIO.cjs.map +1 -0
  80. package/dist/chunk-TRGAMKHX.cjs +167 -0
  81. package/dist/chunk-TRGAMKHX.cjs.map +1 -0
  82. package/dist/chunk-VY4ENABS.cjs +135 -0
  83. package/dist/chunk-VY4ENABS.cjs.map +1 -0
  84. package/dist/chunk-X6C7BUWN.cjs +48 -0
  85. package/dist/chunk-X6C7BUWN.cjs.map +1 -0
  86. package/dist/chunk-XN74I6VW.cjs +88 -0
  87. package/dist/chunk-XN74I6VW.cjs.map +1 -0
  88. package/dist/chunk-XXPCYVTH.js +707 -0
  89. package/dist/chunk-XXPCYVTH.js.map +1 -0
  90. package/dist/chunk-YKENCZQ2.cjs +19516 -0
  91. package/dist/chunk-YKENCZQ2.cjs.map +1 -0
  92. package/dist/chunk-YWOK4F5A.js +131 -0
  93. package/dist/chunk-YWOK4F5A.js.map +1 -0
  94. package/dist/chunk-ZULZ2752.js +2774 -0
  95. package/dist/chunk-ZULZ2752.js.map +1 -0
  96. package/dist/dist-4MVGNSRL.cjs +1150 -0
  97. package/dist/dist-4MVGNSRL.cjs.map +1 -0
  98. package/dist/dist-FZYCV3VB.cjs +940 -0
  99. package/dist/dist-FZYCV3VB.cjs.map +1 -0
  100. package/dist/dist-G2BYZJOC.cjs +928 -0
  101. package/dist/dist-G2BYZJOC.cjs.map +1 -0
  102. package/dist/dist-P4MXBQ3U.cjs +16 -0
  103. package/dist/dist-P4MXBQ3U.cjs.map +1 -0
  104. package/dist/dist-PQZUVLPC.js +937 -0
  105. package/dist/dist-PQZUVLPC.js.map +1 -0
  106. package/dist/dist-R7WYX6LC.js +925 -0
  107. package/dist/dist-R7WYX6LC.js.map +1 -0
  108. package/dist/dist-RFMYFILX.cjs +764 -0
  109. package/dist/dist-RFMYFILX.cjs.map +1 -0
  110. package/dist/dist-X7XR3M3Z.js +1147 -0
  111. package/dist/dist-X7XR3M3Z.js.map +1 -0
  112. package/dist/dist-XVBSOGFK.js +761 -0
  113. package/dist/dist-XVBSOGFK.js.map +1 -0
  114. package/dist/dist-YREX2TJT.js +3 -0
  115. package/dist/dist-YREX2TJT.js.map +1 -0
  116. package/dist/index.cjs +6 -0
  117. package/dist/index.cjs.map +1 -0
  118. package/dist/index.d.ts +1 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +5 -0
  121. package/dist/index.js.map +1 -0
  122. package/dist/server/a2a/protocol.d.ts +8 -0
  123. package/dist/server/a2a/protocol.d.ts.map +1 -0
  124. package/dist/server/a2a/store.cjs +25 -0
  125. package/dist/server/a2a/store.cjs.map +1 -0
  126. package/dist/server/a2a/store.d.ts +14 -0
  127. package/dist/server/a2a/store.d.ts.map +1 -0
  128. package/dist/server/a2a/store.js +23 -0
  129. package/dist/server/a2a/store.js.map +1 -0
  130. package/dist/server/a2a/tasks.d.ts +20 -0
  131. package/dist/server/a2a/tasks.d.ts.map +1 -0
  132. package/dist/server/handlers/a2a.cjs +32 -0
  133. package/dist/server/handlers/a2a.cjs.map +1 -0
  134. package/dist/server/handlers/a2a.d.ts +68 -0
  135. package/dist/server/handlers/a2a.d.ts.map +1 -0
  136. package/dist/server/handlers/a2a.js +3 -0
  137. package/dist/server/handlers/a2a.js.map +1 -0
  138. package/dist/server/handlers/agent-builder.cjs +68 -0
  139. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  140. package/dist/server/handlers/agent-builder.d.ts +94 -0
  141. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  142. package/dist/server/handlers/agent-builder.js +3 -0
  143. package/dist/server/handlers/agent-builder.js.map +1 -0
  144. package/dist/server/handlers/agents.cjs +61 -7
  145. package/dist/server/handlers/agents.cjs.map +1 -0
  146. package/dist/server/handlers/agents.d.ts +208 -6
  147. package/dist/server/handlers/agents.d.ts.map +1 -0
  148. package/dist/server/handlers/agents.js +3 -1
  149. package/dist/server/handlers/agents.js.map +1 -0
  150. package/dist/server/handlers/error.cjs +4 -2
  151. package/dist/server/handlers/error.cjs.map +1 -0
  152. package/dist/server/handlers/error.d.ts +2 -1
  153. package/dist/server/handlers/error.d.ts.map +1 -0
  154. package/dist/server/handlers/error.js +3 -1
  155. package/dist/server/handlers/error.js.map +1 -0
  156. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  157. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  158. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  159. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  160. package/dist/server/handlers/legacyWorkflows.js +3 -0
  161. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  162. package/dist/server/handlers/logs.cjs +6 -4
  163. package/dist/server/handlers/logs.cjs.map +1 -0
  164. package/dist/server/handlers/logs.d.ts +34 -3
  165. package/dist/server/handlers/logs.d.ts.map +1 -0
  166. package/dist/server/handlers/logs.js +3 -1
  167. package/dist/server/handlers/logs.js.map +1 -0
  168. package/dist/server/handlers/memory.cjs +39 -9
  169. package/dist/server/handlers/memory.cjs.map +1 -0
  170. package/dist/server/handlers/memory.d.ts +118 -8
  171. package/dist/server/handlers/memory.d.ts.map +1 -0
  172. package/dist/server/handlers/memory.js +3 -1
  173. package/dist/server/handlers/memory.js.map +1 -0
  174. package/dist/server/handlers/observability.cjs +24 -0
  175. package/dist/server/handlers/observability.cjs.map +1 -0
  176. package/dist/server/handlers/observability.d.ts +49 -0
  177. package/dist/server/handlers/observability.d.ts.map +1 -0
  178. package/dist/server/handlers/observability.js +3 -0
  179. package/dist/server/handlers/observability.js.map +1 -0
  180. package/dist/server/handlers/scores.cjs +32 -0
  181. package/dist/server/handlers/scores.cjs.map +1 -0
  182. package/dist/server/handlers/scores.d.ts +152 -0
  183. package/dist/server/handlers/scores.d.ts.map +1 -0
  184. package/dist/server/handlers/scores.js +3 -0
  185. package/dist/server/handlers/scores.js.map +1 -0
  186. package/dist/server/handlers/telemetry.cjs +9 -3
  187. package/dist/server/handlers/telemetry.cjs.map +1 -0
  188. package/dist/server/handlers/telemetry.d.ts +33 -2
  189. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  190. package/dist/server/handlers/telemetry.js +3 -1
  191. package/dist/server/handlers/telemetry.js.map +1 -0
  192. package/dist/server/handlers/tools.cjs +11 -5
  193. package/dist/server/handlers/tools.cjs.map +1 -0
  194. package/dist/server/handlers/tools.d.ts +25 -4
  195. package/dist/server/handlers/tools.d.ts.map +1 -0
  196. package/dist/server/handlers/tools.js +3 -1
  197. package/dist/server/handlers/tools.js.map +1 -0
  198. package/dist/server/handlers/utils.cjs +8 -2
  199. package/dist/server/handlers/utils.cjs.map +1 -0
  200. package/dist/server/handlers/utils.d.ts +8 -1
  201. package/dist/server/handlers/utils.d.ts.map +1 -0
  202. package/dist/server/handlers/utils.js +3 -1
  203. package/dist/server/handlers/utils.js.map +1 -0
  204. package/dist/server/handlers/vector.cjs +9 -7
  205. package/dist/server/handlers/vector.cjs.map +1 -0
  206. package/dist/server/handlers/vector.d.ts +51 -6
  207. package/dist/server/handlers/vector.d.ts.map +1 -0
  208. package/dist/server/handlers/vector.js +3 -1
  209. package/dist/server/handlers/vector.js.map +1 -0
  210. package/dist/server/handlers/voice.cjs +10 -4
  211. package/dist/server/handlers/voice.cjs.map +1 -0
  212. package/dist/server/handlers/voice.d.ts +41 -3
  213. package/dist/server/handlers/voice.d.ts.map +1 -0
  214. package/dist/server/handlers/voice.js +3 -1
  215. package/dist/server/handlers/voice.js.map +1 -0
  216. package/dist/server/handlers/workflows.cjs +55 -13
  217. package/dist/server/handlers/workflows.cjs.map +1 -0
  218. package/dist/server/handlers/workflows.d.ts +97 -10
  219. package/dist/server/handlers/workflows.d.ts.map +1 -0
  220. package/dist/server/handlers/workflows.js +3 -1
  221. package/dist/server/handlers/workflows.js.map +1 -0
  222. package/dist/server/handlers.cjs +47 -30
  223. package/dist/server/handlers.cjs.map +1 -0
  224. package/dist/server/handlers.d.ts +14 -10
  225. package/dist/server/handlers.d.ts.map +1 -0
  226. package/dist/server/handlers.js +15 -10
  227. package/dist/server/handlers.js.map +1 -0
  228. package/dist/server/http-exception.d.ts +87 -0
  229. package/dist/server/http-exception.d.ts.map +1 -0
  230. package/dist/server/types.d.ts +10 -0
  231. package/dist/server/types.d.ts.map +1 -0
  232. package/dist/server/utils.d.ts +44 -0
  233. package/dist/server/utils.d.ts.map +1 -0
  234. package/dist/token-375W3LEI.cjs +64 -0
  235. package/dist/token-375W3LEI.cjs.map +1 -0
  236. package/dist/token-C3IMNCC4.js +62 -0
  237. package/dist/token-C3IMNCC4.js.map +1 -0
  238. package/dist/token-util-CV3RRG6K.cjs +9 -0
  239. package/dist/token-util-CV3RRG6K.cjs.map +1 -0
  240. package/dist/token-util-E5QO2RCL.js +7 -0
  241. package/dist/token-util-E5QO2RCL.js.map +1 -0
  242. package/package.json +43 -19
  243. package/dist/_tsup-dts-rollup.d.cts +0 -654
  244. package/dist/_tsup-dts-rollup.d.ts +0 -654
  245. package/dist/chunk-2FJURXCL.cjs +0 -213
  246. package/dist/chunk-3AHQ5RGN.js +0 -11
  247. package/dist/chunk-3EJZQ6TQ.js +0 -49
  248. package/dist/chunk-4BIX6GMY.cjs +0 -189
  249. package/dist/chunk-55HTWX4C.cjs +0 -93
  250. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  251. package/dist/chunk-5YGDYMRB.cjs +0 -147
  252. package/dist/chunk-AELYAUEE.cjs +0 -316
  253. package/dist/chunk-D3G23FP3.cjs +0 -126
  254. package/dist/chunk-EVCC233P.cjs +0 -321
  255. package/dist/chunk-JPB6RPGB.js +0 -304
  256. package/dist/chunk-OMN3UI6X.js +0 -5576
  257. package/dist/chunk-QJ3AHN64.js +0 -141
  258. package/dist/chunk-QN4KF3BH.cjs +0 -18
  259. package/dist/chunk-RBQASTUP.js +0 -203
  260. package/dist/chunk-SKBVVI24.cjs +0 -54
  261. package/dist/chunk-Y3SV5XK4.js +0 -181
  262. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  263. package/dist/index.d.cts +0 -1
  264. package/dist/server/handlers/agents.d.cts +0 -6
  265. package/dist/server/handlers/error.d.cts +0 -1
  266. package/dist/server/handlers/logs.d.cts +0 -3
  267. package/dist/server/handlers/memory.d.cts +0 -8
  268. package/dist/server/handlers/network.cjs +0 -22
  269. package/dist/server/handlers/network.d.cts +0 -4
  270. package/dist/server/handlers/network.d.ts +0 -4
  271. package/dist/server/handlers/network.js +0 -1
  272. package/dist/server/handlers/telemetry.d.cts +0 -2
  273. package/dist/server/handlers/tools.d.cts +0 -4
  274. package/dist/server/handlers/utils.d.cts +0 -1
  275. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  276. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  277. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  278. package/dist/server/handlers/vNextWorkflows.js +0 -1
  279. package/dist/server/handlers/vector.d.cts +0 -6
  280. package/dist/server/handlers/voice.d.cts +0 -3
  281. package/dist/server/handlers/workflows.d.cts +0 -10
  282. package/dist/server/handlers.d.cts +0 -10
@@ -1,321 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
6
- var web = require('stream/web');
7
-
8
- // src/server/handlers/workflows.ts
9
- var workflows_exports = {};
10
- chunkFV45V6WC_cjs.__export(workflows_exports, {
11
- createRunHandler: () => createRunHandler,
12
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
13
- getWorkflowRunHandler: () => getWorkflowRunHandler,
14
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
15
- getWorkflowsHandler: () => getWorkflowsHandler,
16
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
17
- resumeWorkflowHandler: () => resumeWorkflowHandler,
18
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
19
- startWorkflowRunHandler: () => startWorkflowRunHandler,
20
- watchWorkflowHandler: () => watchWorkflowHandler
21
- });
22
- async function getWorkflowsHandler({ mastra }) {
23
- try {
24
- const workflows = mastra.getWorkflows({ serialized: false });
25
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
26
- if (workflow.isNested) return acc;
27
- acc[key] = {
28
- stepGraph: workflow.stepGraph,
29
- stepSubscriberGraph: workflow.stepSubscriberGraph,
30
- serializedStepGraph: workflow.serializedStepGraph,
31
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
32
- name: workflow.name,
33
- triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
34
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
35
- const _step = step;
36
- acc2[key2] = {
37
- id: _step.id,
38
- description: _step.description,
39
- workflowId: _step.workflowId,
40
- inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
41
- outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
42
- };
43
- return acc2;
44
- }, {})
45
- };
46
- return acc;
47
- }, {});
48
- return _workflows;
49
- } catch (error) {
50
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
51
- }
52
- }
53
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
54
- try {
55
- if (!workflowId) {
56
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
57
- }
58
- const workflow = mastra.getWorkflow(workflowId);
59
- if (!workflow) {
60
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
61
- }
62
- return {
63
- stepGraph: workflow.stepGraph,
64
- stepSubscriberGraph: workflow.stepSubscriberGraph,
65
- serializedStepGraph: workflow.serializedStepGraph,
66
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
67
- name: workflow.name,
68
- triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
69
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
70
- const _step = step;
71
- acc[key] = {
72
- id: _step.id,
73
- description: _step.description,
74
- workflowId: _step.workflowId,
75
- inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
76
- outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
77
- };
78
- return acc;
79
- }, {})
80
- };
81
- } catch (error) {
82
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
83
- }
84
- }
85
- async function startAsyncWorkflowHandler({
86
- mastra,
87
- runtimeContext,
88
- workflowId,
89
- runId,
90
- triggerData
91
- }) {
92
- try {
93
- if (!workflowId) {
94
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
95
- }
96
- const workflow = mastra.getWorkflow(workflowId);
97
- if (!workflow) {
98
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
99
- }
100
- if (!runId) {
101
- const { start } = workflow.createRun();
102
- const result2 = await start({
103
- triggerData,
104
- runtimeContext
105
- });
106
- return result2;
107
- }
108
- const run = workflow.getRun(runId);
109
- if (!run) {
110
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
111
- }
112
- const result = await run.start({
113
- triggerData,
114
- runtimeContext
115
- });
116
- return result;
117
- } catch (error) {
118
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
119
- }
120
- }
121
- async function getWorkflowRunHandler({
122
- mastra,
123
- workflowId,
124
- runId
125
- }) {
126
- try {
127
- if (!workflowId) {
128
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
129
- }
130
- if (!runId) {
131
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Run ID is required" });
132
- }
133
- const workflow = mastra.getWorkflow(workflowId);
134
- if (!workflow) {
135
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
136
- }
137
- const run = workflow.getRun(runId);
138
- if (!run) {
139
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
140
- }
141
- return run;
142
- } catch (error) {
143
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
144
- }
145
- }
146
- async function createRunHandler({
147
- mastra,
148
- workflowId,
149
- runId: prevRunId
150
- }) {
151
- try {
152
- if (!workflowId) {
153
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
154
- }
155
- const workflow = mastra.getWorkflow(workflowId);
156
- if (!workflow) {
157
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
158
- }
159
- const { runId } = workflow.createRun({ runId: prevRunId });
160
- return { runId };
161
- } catch (error) {
162
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
163
- }
164
- }
165
- async function startWorkflowRunHandler({
166
- mastra,
167
- runtimeContext,
168
- workflowId,
169
- runId,
170
- triggerData
171
- }) {
172
- try {
173
- if (!workflowId) {
174
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
175
- }
176
- if (!runId) {
177
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to start run" });
178
- }
179
- const workflow = mastra.getWorkflow(workflowId);
180
- const run = workflow.getRun(runId);
181
- if (!run) {
182
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
183
- }
184
- await run.start({
185
- triggerData,
186
- runtimeContext
187
- });
188
- return { message: "Workflow run started" };
189
- } catch (e) {
190
- return chunkZLBRQFDD_cjs.handleError(e, "Error starting workflow run");
191
- }
192
- }
193
- async function watchWorkflowHandler({
194
- mastra,
195
- workflowId,
196
- runId
197
- }) {
198
- try {
199
- if (!workflowId) {
200
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
201
- }
202
- if (!runId) {
203
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to watch workflow" });
204
- }
205
- const workflow = mastra.getWorkflow(workflowId);
206
- const run = workflow.getRun(runId);
207
- if (!run) {
208
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
209
- }
210
- let unwatch;
211
- let asyncRef = null;
212
- const stream = new web.ReadableStream({
213
- start(controller) {
214
- unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
215
- const activePathsObj = Object.fromEntries(activePaths);
216
- controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
217
- if (asyncRef) {
218
- clearImmediate(asyncRef);
219
- asyncRef = null;
220
- }
221
- asyncRef = setImmediate(() => {
222
- if (!workflow.getRun(runId2)) {
223
- controller.close();
224
- }
225
- });
226
- });
227
- },
228
- cancel() {
229
- unwatch?.();
230
- }
231
- });
232
- return stream;
233
- } catch (error) {
234
- return chunkZLBRQFDD_cjs.handleError(error, "Error watching workflow");
235
- }
236
- }
237
- async function resumeAsyncWorkflowHandler({
238
- mastra,
239
- workflowId,
240
- runId,
241
- body,
242
- runtimeContext
243
- }) {
244
- try {
245
- if (!workflowId) {
246
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
247
- }
248
- if (!runId) {
249
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
250
- }
251
- const workflow = mastra.getWorkflow(workflowId);
252
- const run = workflow.getRun(runId);
253
- if (!run) {
254
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
255
- }
256
- const result = await run.resume({
257
- stepId: body.stepId,
258
- context: body.context,
259
- runtimeContext
260
- });
261
- return result;
262
- } catch (error) {
263
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow step");
264
- }
265
- }
266
- async function resumeWorkflowHandler({
267
- mastra,
268
- workflowId,
269
- runId,
270
- body,
271
- runtimeContext
272
- }) {
273
- try {
274
- if (!workflowId) {
275
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
276
- }
277
- if (!runId) {
278
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
279
- }
280
- const workflow = mastra.getWorkflow(workflowId);
281
- const run = workflow.getRun(runId);
282
- if (!run) {
283
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
284
- }
285
- await run.resume({
286
- stepId: body.stepId,
287
- context: body.context,
288
- runtimeContext
289
- });
290
- return { message: "Workflow run resumed" };
291
- } catch (error) {
292
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow");
293
- }
294
- }
295
- async function getWorkflowRunsHandler({ mastra, workflowId }) {
296
- try {
297
- if (!workflowId) {
298
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
299
- }
300
- const workflow = mastra.getWorkflow(workflowId);
301
- const workflowRuns = await workflow.getWorkflowRuns() || {
302
- runs: [],
303
- total: 0
304
- };
305
- return workflowRuns;
306
- } catch (error) {
307
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting workflow runs");
308
- }
309
- }
310
-
311
- exports.createRunHandler = createRunHandler;
312
- exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
313
- exports.getWorkflowRunHandler = getWorkflowRunHandler;
314
- exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
315
- exports.getWorkflowsHandler = getWorkflowsHandler;
316
- exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
317
- exports.resumeWorkflowHandler = resumeWorkflowHandler;
318
- exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
319
- exports.startWorkflowRunHandler = startWorkflowRunHandler;
320
- exports.watchWorkflowHandler = watchWorkflowHandler;
321
- exports.workflows_exports = workflows_exports;
@@ -1,304 +0,0 @@
1
- import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
- import { handleError } from './chunk-3AHQ5RGN.js';
3
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
4
- import { ReadableStream } from 'node:stream/web';
5
-
6
- // src/server/handlers/vNextWorkflows.ts
7
- var vNextWorkflows_exports = {};
8
- __export(vNextWorkflows_exports, {
9
- createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
10
- getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
11
- getVNextWorkflowRunHandler: () => getVNextWorkflowRunHandler,
12
- getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
13
- getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
14
- resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
15
- resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
16
- startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
17
- startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
18
- watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
19
- });
20
- async function getVNextWorkflowsHandler({ mastra }) {
21
- try {
22
- const workflows = mastra.vnext_getWorkflows({ serialized: false });
23
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
24
- acc[key] = {
25
- name: workflow.name,
26
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
27
- acc2[key2] = {
28
- id: step.id,
29
- description: step.description,
30
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
31
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
32
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
33
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
34
- };
35
- return acc2;
36
- }, {}),
37
- stepGraph: workflow.serializedStepGraph,
38
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
39
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
40
- };
41
- return acc;
42
- }, {});
43
- return _workflows;
44
- } catch (error) {
45
- throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
46
- }
47
- }
48
- async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
49
- try {
50
- if (!workflowId) {
51
- throw new HTTPException(400, { message: "Workflow ID is required" });
52
- }
53
- const workflow = mastra.vnext_getWorkflow(workflowId);
54
- if (!workflow) {
55
- throw new HTTPException(404, { message: "Workflow not found" });
56
- }
57
- return {
58
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
59
- acc[key] = {
60
- id: step.id,
61
- description: step.description,
62
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
63
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
64
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
65
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
66
- };
67
- return acc;
68
- }, {}),
69
- name: workflow.name,
70
- stepGraph: workflow.serializedStepGraph,
71
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
72
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
73
- };
74
- } catch (error) {
75
- throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
76
- }
77
- }
78
- async function getVNextWorkflowRunHandler({
79
- mastra,
80
- workflowId,
81
- runId
82
- }) {
83
- try {
84
- if (!workflowId) {
85
- throw new HTTPException(400, { message: "Workflow ID is required" });
86
- }
87
- if (!runId) {
88
- throw new HTTPException(400, { message: "Run ID is required" });
89
- }
90
- const workflow = mastra.vnext_getWorkflow(workflowId);
91
- if (!workflow) {
92
- throw new HTTPException(404, { message: "Workflow not found" });
93
- }
94
- const run = await workflow.getWorkflowRun(runId);
95
- if (!run) {
96
- throw new HTTPException(404, { message: "Workflow run not found" });
97
- }
98
- return run;
99
- } catch (error) {
100
- throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
101
- }
102
- }
103
- async function createVNextWorkflowRunHandler({
104
- mastra,
105
- workflowId,
106
- runId: prevRunId
107
- }) {
108
- try {
109
- if (!workflowId) {
110
- throw new HTTPException(400, { message: "Workflow ID is required" });
111
- }
112
- const workflow = mastra.vnext_getWorkflow(workflowId);
113
- if (!workflow) {
114
- throw new HTTPException(404, { message: "Workflow not found" });
115
- }
116
- const run = workflow.createRun({ runId: prevRunId });
117
- return { runId: run.runId };
118
- } catch (error) {
119
- throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
120
- }
121
- }
122
- async function startAsyncVNextWorkflowHandler({
123
- mastra,
124
- runtimeContext,
125
- workflowId,
126
- runId,
127
- inputData
128
- }) {
129
- try {
130
- if (!workflowId) {
131
- throw new HTTPException(400, { message: "Workflow ID is required" });
132
- }
133
- const workflow = mastra.vnext_getWorkflow(workflowId);
134
- if (!workflow) {
135
- throw new HTTPException(404, { message: "Workflow not found" });
136
- }
137
- const _run = workflow.createRun({ runId });
138
- const result = await _run.start({
139
- inputData,
140
- runtimeContext
141
- });
142
- return result;
143
- } catch (error) {
144
- throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
145
- }
146
- }
147
- async function startVNextWorkflowRunHandler({
148
- mastra,
149
- runtimeContext,
150
- workflowId,
151
- runId,
152
- inputData
153
- }) {
154
- try {
155
- if (!workflowId) {
156
- throw new HTTPException(400, { message: "Workflow ID is required" });
157
- }
158
- if (!runId) {
159
- throw new HTTPException(400, { message: "runId required to start run" });
160
- }
161
- const workflow = mastra.vnext_getWorkflow(workflowId);
162
- const run = await workflow.getWorkflowRun(runId);
163
- if (!run) {
164
- throw new HTTPException(404, { message: "Workflow run not found" });
165
- }
166
- const _run = workflow.createRun({ runId });
167
- await _run.start({
168
- inputData,
169
- runtimeContext
170
- });
171
- return { message: "Workflow run started" };
172
- } catch (e) {
173
- return handleError(e, "Error starting workflow run");
174
- }
175
- }
176
- async function watchVNextWorkflowHandler({
177
- mastra,
178
- workflowId,
179
- runId
180
- }) {
181
- try {
182
- if (!workflowId) {
183
- throw new HTTPException(400, { message: "Workflow ID is required" });
184
- }
185
- if (!runId) {
186
- throw new HTTPException(400, { message: "runId required to watch workflow" });
187
- }
188
- const workflow = mastra.vnext_getWorkflow(workflowId);
189
- const run = await workflow.getWorkflowRun(runId);
190
- if (!run) {
191
- throw new HTTPException(404, { message: "Workflow run not found" });
192
- }
193
- const _run = workflow.createRun({ runId });
194
- let unwatch;
195
- let asyncRef = null;
196
- const stream = new ReadableStream({
197
- start(controller) {
198
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
199
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
200
- if (asyncRef) {
201
- clearImmediate(asyncRef);
202
- asyncRef = null;
203
- }
204
- asyncRef = setImmediate(async () => {
205
- const runDone = payload.workflowState.status !== "running";
206
- if (runDone) {
207
- controller.close();
208
- unwatch?.();
209
- }
210
- });
211
- });
212
- },
213
- cancel() {
214
- unwatch?.();
215
- }
216
- });
217
- return stream;
218
- } catch (error) {
219
- return handleError(error, "Error watching workflow");
220
- }
221
- }
222
- async function resumeAsyncVNextWorkflowHandler({
223
- mastra,
224
- workflowId,
225
- runId,
226
- body,
227
- runtimeContext
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: "runId required to resume workflow" });
235
- }
236
- if (!body.step) {
237
- throw new HTTPException(400, { message: "step required to resume workflow" });
238
- }
239
- const workflow = mastra.vnext_getWorkflow(workflowId);
240
- const run = await workflow.getWorkflowRun(runId);
241
- if (!run) {
242
- throw new HTTPException(404, { message: "Workflow run not found" });
243
- }
244
- const _run = workflow.createRun({ runId });
245
- const result = await _run.resume({
246
- step: body.step,
247
- resumeData: body.resumeData,
248
- runtimeContext
249
- });
250
- return result;
251
- } catch (error) {
252
- return handleError(error, "Error resuming workflow step");
253
- }
254
- }
255
- async function resumeVNextWorkflowHandler({
256
- mastra,
257
- workflowId,
258
- runId,
259
- body,
260
- runtimeContext
261
- }) {
262
- try {
263
- if (!workflowId) {
264
- throw new HTTPException(400, { message: "Workflow ID is required" });
265
- }
266
- if (!runId) {
267
- throw new HTTPException(400, { message: "runId required to resume workflow" });
268
- }
269
- if (!body.step) {
270
- throw new HTTPException(400, { message: "step required to resume workflow" });
271
- }
272
- const workflow = mastra.vnext_getWorkflow(workflowId);
273
- const run = await workflow.getWorkflowRun(runId);
274
- if (!run) {
275
- throw new HTTPException(404, { message: "Workflow run not found" });
276
- }
277
- const _run = workflow.createRun({ runId });
278
- await _run.resume({
279
- step: body.step,
280
- resumeData: body.resumeData,
281
- runtimeContext
282
- });
283
- return { message: "Workflow run resumed" };
284
- } catch (error) {
285
- return handleError(error, "Error resuming workflow");
286
- }
287
- }
288
- async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
289
- try {
290
- if (!workflowId) {
291
- throw new HTTPException(400, { message: "Workflow ID is required" });
292
- }
293
- const workflow = mastra.vnext_getWorkflow(workflowId);
294
- const workflowRuns = await workflow.getWorkflowRuns() || {
295
- runs: [],
296
- total: 0
297
- };
298
- return workflowRuns;
299
- } catch (error) {
300
- return handleError(error, "Error getting workflow runs");
301
- }
302
- }
303
-
304
- export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };