@mastra/server 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloud-deployer-for-core-0.19.1-20251001164939

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 (295) hide show
  1. package/CHANGELOG.md +3867 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +0 -5
  4. package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
  5. package/dist/chunk-4QCXUEAT.js.map +1 -0
  6. package/dist/chunk-4RRMWXQ2.js +3522 -0
  7. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  8. package/dist/chunk-4VJG7FZK.cjs +18023 -0
  9. package/dist/chunk-4VJG7FZK.cjs.map +1 -0
  10. package/dist/chunk-52UP7DFT.cjs +130 -0
  11. package/dist/chunk-52UP7DFT.cjs.map +1 -0
  12. package/dist/chunk-6GMFZ5LK.js +2774 -0
  13. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  14. package/dist/{chunk-GHC4YV6R.js → chunk-6IJWRJZE.js} +109 -136
  15. package/dist/chunk-6IJWRJZE.js.map +1 -0
  16. package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
  17. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  18. package/dist/{chunk-QLG2PFHE.js → chunk-A3AL7EWJ.js} +5 -3
  19. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  20. package/dist/chunk-BKCWZLEL.cjs +197 -0
  21. package/dist/chunk-BKCWZLEL.cjs.map +1 -0
  22. package/dist/chunk-BX5XPVO2.cjs +676 -0
  23. package/dist/chunk-BX5XPVO2.cjs.map +1 -0
  24. package/dist/chunk-CY4TP3FK.js +16 -0
  25. package/dist/chunk-CY4TP3FK.js.map +1 -0
  26. package/dist/chunk-EMMSS5I5.cjs +37 -0
  27. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  28. package/dist/chunk-FALVL2VV.cjs +3525 -0
  29. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  30. package/dist/chunk-G3PMV62Z.js +33 -0
  31. package/dist/chunk-G3PMV62Z.js.map +1 -0
  32. package/dist/chunk-G4PUALCE.cjs +28 -0
  33. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  34. package/dist/chunk-GU4EWMZB.cjs +769 -0
  35. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  36. package/dist/chunk-HCFCPUTA.cjs +601 -0
  37. package/dist/chunk-HCFCPUTA.cjs.map +1 -0
  38. package/dist/chunk-HFEPCQAR.js +655 -0
  39. package/dist/chunk-HFEPCQAR.js.map +1 -0
  40. package/dist/{chunk-XUGQSVZ4.cjs → chunk-HVBBFCDH.cjs} +1110 -793
  41. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  42. package/dist/chunk-JLPZWKPR.js +582 -0
  43. package/dist/chunk-JLPZWKPR.js.map +1 -0
  44. package/dist/{chunk-CP55EVBK.js → chunk-JRDEOHAJ.js} +30 -16
  45. package/dist/chunk-JRDEOHAJ.js.map +1 -0
  46. package/dist/{chunk-HYP7B2TL.js → chunk-KM7EJKXV.js} +50 -12
  47. package/dist/chunk-KM7EJKXV.js.map +1 -0
  48. package/dist/{chunk-UZ7FJ66C.cjs → chunk-KNGXRN26.cjs} +48 -45
  49. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  50. package/dist/{chunk-BFOA2QQY.js → chunk-KV6VHX4V.js} +24 -5
  51. package/dist/chunk-KV6VHX4V.js.map +1 -0
  52. package/dist/chunk-LF2ZLOFP.js +767 -0
  53. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  54. package/dist/chunk-LJFAAEU7.cjs +167 -0
  55. package/dist/chunk-LJFAAEU7.cjs.map +1 -0
  56. package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
  57. package/dist/chunk-MMROOK5J.js.map +1 -0
  58. package/dist/{chunk-WKWHYFX4.js → chunk-N7F33WAD.js} +1083 -794
  59. package/dist/chunk-N7F33WAD.js.map +1 -0
  60. package/dist/chunk-NG5IVLEZ.js +1012 -0
  61. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  62. package/dist/chunk-NLWACBE7.cjs +128 -0
  63. package/dist/chunk-NLWACBE7.cjs.map +1 -0
  64. package/dist/{chunk-SDPGVWQJ.cjs → chunk-OPI3FZYH.cjs} +110 -137
  65. package/dist/chunk-OPI3FZYH.cjs.map +1 -0
  66. package/dist/chunk-OZLRIVC4.cjs +588 -0
  67. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  68. package/dist/chunk-PPYGWINI.cjs +2777 -0
  69. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  70. package/dist/{chunk-B4MQFJ7G.cjs → chunk-PWTXZZTR.cjs} +28 -8
  71. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  72. package/dist/chunk-RE4RPXT2.cjs +18 -0
  73. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  74. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  75. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  76. package/dist/{chunk-IMBY5XUG.cjs → chunk-SPLSYTYW.cjs} +11 -9
  77. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  78. package/dist/chunk-SQY4T6EJ.js +571 -0
  79. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  80. package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
  81. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  82. package/dist/{chunk-TEZOEGR4.js → chunk-TTHEEIZ3.js} +18 -15
  83. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  84. package/dist/chunk-VY4ENABS.cjs +135 -0
  85. package/dist/chunk-VY4ENABS.cjs.map +1 -0
  86. package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
  87. package/dist/chunk-WHN4VX55.js.map +1 -0
  88. package/dist/chunk-WUJLVNLU.js +124 -0
  89. package/dist/chunk-WUJLVNLU.js.map +1 -0
  90. package/dist/chunk-XJOYGRTN.js +189 -0
  91. package/dist/chunk-XJOYGRTN.js.map +1 -0
  92. package/dist/chunk-YGQ5F6E6.js +17987 -0
  93. package/dist/chunk-YGQ5F6E6.js.map +1 -0
  94. package/dist/chunk-YWOK4F5A.js +131 -0
  95. package/dist/chunk-YWOK4F5A.js.map +1 -0
  96. package/dist/dist-26HWEQY6.js +3 -0
  97. package/dist/dist-26HWEQY6.js.map +1 -0
  98. package/dist/dist-3DRD6USP.cjs +1411 -0
  99. package/dist/dist-3DRD6USP.cjs.map +1 -0
  100. package/dist/dist-7GVM5ZCS.js +845 -0
  101. package/dist/dist-7GVM5ZCS.js.map +1 -0
  102. package/dist/dist-CCDXEZDR.js +1408 -0
  103. package/dist/dist-CCDXEZDR.js.map +1 -0
  104. package/dist/dist-COC6WFAX.js +761 -0
  105. package/dist/dist-COC6WFAX.js.map +1 -0
  106. package/dist/dist-EZZMMMNT.cjs +16 -0
  107. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  108. package/dist/dist-H64VX6DE.js +3 -0
  109. package/dist/dist-H64VX6DE.js.map +1 -0
  110. package/dist/dist-H7RR3EXL.js +2006 -0
  111. package/dist/dist-H7RR3EXL.js.map +1 -0
  112. package/dist/dist-JNIWWFE5.js +1147 -0
  113. package/dist/dist-JNIWWFE5.js.map +1 -0
  114. package/dist/dist-L76NFIWM.cjs +934 -0
  115. package/dist/dist-L76NFIWM.cjs.map +1 -0
  116. package/dist/dist-LKU3RRT2.js +937 -0
  117. package/dist/dist-LKU3RRT2.js.map +1 -0
  118. package/dist/dist-MQUZENT7.js +931 -0
  119. package/dist/dist-MQUZENT7.js.map +1 -0
  120. package/dist/dist-N6P7NYGX.cjs +928 -0
  121. package/dist/dist-N6P7NYGX.cjs.map +1 -0
  122. package/dist/dist-OC4J73ML.cjs +940 -0
  123. package/dist/dist-OC4J73ML.cjs.map +1 -0
  124. package/dist/dist-QI7RYOYQ.cjs +764 -0
  125. package/dist/dist-QI7RYOYQ.cjs.map +1 -0
  126. package/dist/dist-R3L5J3LL.cjs +1150 -0
  127. package/dist/dist-R3L5J3LL.cjs.map +1 -0
  128. package/dist/dist-S3ILRJUH.cjs +2013 -0
  129. package/dist/dist-S3ILRJUH.cjs.map +1 -0
  130. package/dist/dist-WKYB3LTJ.cjs +16 -0
  131. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  132. package/dist/dist-WY4WSW7C.cjs +849 -0
  133. package/dist/dist-WY4WSW7C.cjs.map +1 -0
  134. package/dist/dist-ZHCN47XA.js +925 -0
  135. package/dist/dist-ZHCN47XA.js.map +1 -0
  136. package/dist/index.cjs +6 -0
  137. package/dist/index.cjs.map +1 -0
  138. package/dist/index.d.ts +1 -0
  139. package/dist/index.d.ts.map +1 -0
  140. package/dist/index.js +5 -0
  141. package/dist/index.js.map +1 -0
  142. package/dist/server/a2a/protocol.d.ts +8 -0
  143. package/dist/server/a2a/protocol.d.ts.map +1 -0
  144. package/dist/server/a2a/store.cjs +25 -0
  145. package/dist/server/a2a/store.cjs.map +1 -0
  146. package/dist/server/a2a/store.d.ts +14 -0
  147. package/dist/server/a2a/store.d.ts.map +1 -0
  148. package/dist/server/a2a/store.js +23 -0
  149. package/dist/server/a2a/store.js.map +1 -0
  150. package/dist/server/a2a/tasks.d.ts +20 -0
  151. package/dist/server/a2a/tasks.d.ts.map +1 -0
  152. package/dist/server/handlers/a2a.cjs +13 -11
  153. package/dist/server/handlers/a2a.cjs.map +1 -0
  154. package/dist/server/handlers/a2a.d.ts +68 -6
  155. package/dist/server/handlers/a2a.d.ts.map +1 -0
  156. package/dist/server/handlers/a2a.js +3 -1
  157. package/dist/server/handlers/a2a.js.map +1 -0
  158. package/dist/server/handlers/agent-builder.cjs +68 -0
  159. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  160. package/dist/server/handlers/agent-builder.d.ts +94 -0
  161. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  162. package/dist/server/handlers/agent-builder.js +3 -0
  163. package/dist/server/handlers/agent-builder.js.map +1 -0
  164. package/dist/server/handlers/agents.cjs +61 -7
  165. package/dist/server/handlers/agents.cjs.map +1 -0
  166. package/dist/server/handlers/agents.d.ts +216 -6
  167. package/dist/server/handlers/agents.d.ts.map +1 -0
  168. package/dist/server/handlers/agents.js +3 -1
  169. package/dist/server/handlers/agents.js.map +1 -0
  170. package/dist/server/handlers/error.cjs +4 -2
  171. package/dist/server/handlers/error.cjs.map +1 -0
  172. package/dist/server/handlers/error.d.ts +2 -1
  173. package/dist/server/handlers/error.d.ts.map +1 -0
  174. package/dist/server/handlers/error.js +3 -1
  175. package/dist/server/handlers/error.js.map +1 -0
  176. package/dist/server/handlers/legacyWorkflows.cjs +13 -11
  177. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  178. package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
  179. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  180. package/dist/server/handlers/legacyWorkflows.js +3 -1
  181. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  182. package/dist/server/handlers/logs.cjs +6 -4
  183. package/dist/server/handlers/logs.cjs.map +1 -0
  184. package/dist/server/handlers/logs.d.ts +34 -3
  185. package/dist/server/handlers/logs.d.ts.map +1 -0
  186. package/dist/server/handlers/logs.js +3 -1
  187. package/dist/server/handlers/logs.js.map +1 -0
  188. package/dist/server/handlers/memory.cjs +39 -9
  189. package/dist/server/handlers/memory.cjs.map +1 -0
  190. package/dist/server/handlers/memory.d.ts +118 -8
  191. package/dist/server/handlers/memory.d.ts.map +1 -0
  192. package/dist/server/handlers/memory.js +3 -1
  193. package/dist/server/handlers/memory.js.map +1 -0
  194. package/dist/server/handlers/observability.cjs +24 -0
  195. package/dist/server/handlers/observability.cjs.map +1 -0
  196. package/dist/server/handlers/observability.d.ts +49 -0
  197. package/dist/server/handlers/observability.d.ts.map +1 -0
  198. package/dist/server/handlers/observability.js +3 -0
  199. package/dist/server/handlers/observability.js.map +1 -0
  200. package/dist/server/handlers/scores.cjs +32 -0
  201. package/dist/server/handlers/scores.cjs.map +1 -0
  202. package/dist/server/handlers/scores.d.ts +251 -0
  203. package/dist/server/handlers/scores.d.ts.map +1 -0
  204. package/dist/server/handlers/scores.js +3 -0
  205. package/dist/server/handlers/scores.js.map +1 -0
  206. package/dist/server/handlers/telemetry.cjs +9 -3
  207. package/dist/server/handlers/telemetry.cjs.map +1 -0
  208. package/dist/server/handlers/telemetry.d.ts +33 -2
  209. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  210. package/dist/server/handlers/telemetry.js +3 -1
  211. package/dist/server/handlers/telemetry.js.map +1 -0
  212. package/dist/server/handlers/tools.cjs +11 -5
  213. package/dist/server/handlers/tools.cjs.map +1 -0
  214. package/dist/server/handlers/tools.d.ts +25 -4
  215. package/dist/server/handlers/tools.d.ts.map +1 -0
  216. package/dist/server/handlers/tools.js +3 -1
  217. package/dist/server/handlers/tools.js.map +1 -0
  218. package/dist/server/handlers/utils.cjs +8 -2
  219. package/dist/server/handlers/utils.cjs.map +1 -0
  220. package/dist/server/handlers/utils.d.ts +8 -1
  221. package/dist/server/handlers/utils.d.ts.map +1 -0
  222. package/dist/server/handlers/utils.js +3 -1
  223. package/dist/server/handlers/utils.js.map +1 -0
  224. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  225. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  226. package/dist/server/handlers/vNextNetwork.d.ts +246 -0
  227. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  228. package/dist/server/handlers/vNextNetwork.js +213 -0
  229. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  230. package/dist/server/handlers/vector.cjs +9 -7
  231. package/dist/server/handlers/vector.cjs.map +1 -0
  232. package/dist/server/handlers/vector.d.ts +51 -6
  233. package/dist/server/handlers/vector.d.ts.map +1 -0
  234. package/dist/server/handlers/vector.js +3 -1
  235. package/dist/server/handlers/vector.js.map +1 -0
  236. package/dist/server/handlers/voice.cjs +7 -5
  237. package/dist/server/handlers/voice.cjs.map +1 -0
  238. package/dist/server/handlers/voice.d.ts +41 -4
  239. package/dist/server/handlers/voice.d.ts.map +1 -0
  240. package/dist/server/handlers/voice.js +3 -1
  241. package/dist/server/handlers/voice.js.map +1 -0
  242. package/dist/server/handlers/workflows.cjs +38 -12
  243. package/dist/server/handlers/workflows.cjs.map +1 -0
  244. package/dist/server/handlers/workflows.d.ts +90 -11
  245. package/dist/server/handlers/workflows.d.ts.map +1 -0
  246. package/dist/server/handlers/workflows.js +3 -1
  247. package/dist/server/handlers/workflows.js.map +1 -0
  248. package/dist/server/handlers.cjs +44 -32
  249. package/dist/server/handlers.cjs.map +1 -0
  250. package/dist/server/handlers.d.ts +14 -11
  251. package/dist/server/handlers.d.ts.map +1 -0
  252. package/dist/server/handlers.js +15 -11
  253. package/dist/server/handlers.js.map +1 -0
  254. package/dist/server/http-exception.d.ts +87 -0
  255. package/dist/server/http-exception.d.ts.map +1 -0
  256. package/dist/server/types.d.ts +10 -0
  257. package/dist/server/types.d.ts.map +1 -0
  258. package/dist/server/utils.d.ts +44 -0
  259. package/dist/server/utils.d.ts.map +1 -0
  260. package/package.json +41 -19
  261. package/dist/_tsup-dts-rollup.d.cts +0 -860
  262. package/dist/_tsup-dts-rollup.d.ts +0 -860
  263. package/dist/chunk-57CJTIPW.cjs +0 -18
  264. package/dist/chunk-64U3UDTH.cjs +0 -13
  265. package/dist/chunk-6F2H7Y45.js +0 -255
  266. package/dist/chunk-6TJSHFCJ.cjs +0 -221
  267. package/dist/chunk-75ZPJI57.cjs +0 -9
  268. package/dist/chunk-7IBZ4L35.js +0 -344
  269. package/dist/chunk-C7564HUT.js +0 -142
  270. package/dist/chunk-CMMOIUFC.cjs +0 -114
  271. package/dist/chunk-I7KJZNX5.js +0 -211
  272. package/dist/chunk-JEWNMAYQ.cjs +0 -263
  273. package/dist/chunk-JKF6PRPU.cjs +0 -357
  274. package/dist/chunk-M5ABIP7D.js +0 -11
  275. package/dist/chunk-MLKGABMK.js +0 -7
  276. package/dist/chunk-TJO277H7.cjs +0 -128
  277. package/dist/chunk-VPNDC2DI.cjs +0 -148
  278. package/dist/index.d.cts +0 -1
  279. package/dist/server/handlers/a2a.d.cts +0 -6
  280. package/dist/server/handlers/agents.d.cts +0 -6
  281. package/dist/server/handlers/error.d.cts +0 -1
  282. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  283. package/dist/server/handlers/logs.d.cts +0 -3
  284. package/dist/server/handlers/memory.d.cts +0 -8
  285. package/dist/server/handlers/network.cjs +0 -22
  286. package/dist/server/handlers/network.d.cts +0 -4
  287. package/dist/server/handlers/network.d.ts +0 -4
  288. package/dist/server/handlers/network.js +0 -1
  289. package/dist/server/handlers/telemetry.d.cts +0 -2
  290. package/dist/server/handlers/tools.d.cts +0 -4
  291. package/dist/server/handlers/utils.d.cts +0 -1
  292. package/dist/server/handlers/vector.d.cts +0 -6
  293. package/dist/server/handlers/voice.d.cts +0 -4
  294. package/dist/server/handlers/workflows.d.cts +0 -11
  295. package/dist/server/handlers.d.cts +0 -11
@@ -1,344 +0,0 @@
1
- import { stringify, esm_default } from './chunk-WKWHYFX4.js';
2
- import { handleError } from './chunk-M5ABIP7D.js';
3
- import { HTTPException } from './chunk-NYN7KFXL.js';
4
- import { __export } from './chunk-MLKGABMK.js';
5
- import { ReadableStream } from 'stream/web';
6
-
7
- // src/server/handlers/workflows.ts
8
- var workflows_exports = {};
9
- __export(workflows_exports, {
10
- createWorkflowRunHandler: () => createWorkflowRunHandler,
11
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
12
- getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
13
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
14
- getWorkflowsHandler: () => getWorkflowsHandler,
15
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
16
- resumeWorkflowHandler: () => resumeWorkflowHandler,
17
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
18
- startWorkflowRunHandler: () => startWorkflowRunHandler,
19
- streamWorkflowHandler: () => streamWorkflowHandler,
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
- acc[key] = {
27
- name: workflow.name,
28
- description: workflow.description,
29
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
30
- acc2[key2] = {
31
- id: step.id,
32
- description: step.description,
33
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
34
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
35
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
36
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
37
- };
38
- return acc2;
39
- }, {}),
40
- stepGraph: workflow.serializedStepGraph,
41
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
42
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
43
- };
44
- return acc;
45
- }, {});
46
- return _workflows;
47
- } catch (error) {
48
- throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
49
- }
50
- }
51
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
52
- try {
53
- if (!workflowId) {
54
- throw new HTTPException(400, { message: "Workflow ID is required" });
55
- }
56
- const workflow = mastra.getWorkflow(workflowId);
57
- if (!workflow) {
58
- throw new HTTPException(404, { message: "Workflow not found" });
59
- }
60
- return {
61
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
62
- acc[key] = {
63
- id: step.id,
64
- description: step.description,
65
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
66
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
67
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
68
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
69
- };
70
- return acc;
71
- }, {}),
72
- name: workflow.name,
73
- description: workflow.description,
74
- stepGraph: workflow.serializedStepGraph,
75
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
76
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
77
- };
78
- } catch (error) {
79
- throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
80
- }
81
- }
82
- async function getWorkflowRunByIdHandler({
83
- mastra,
84
- workflowId,
85
- runId
86
- }) {
87
- try {
88
- if (!workflowId) {
89
- throw new HTTPException(400, { message: "Workflow ID is required" });
90
- }
91
- if (!runId) {
92
- throw new HTTPException(400, { message: "Run ID is required" });
93
- }
94
- const workflow = mastra.getWorkflow(workflowId);
95
- if (!workflow) {
96
- throw new HTTPException(404, { message: "Workflow not found" });
97
- }
98
- const run = await workflow.getWorkflowRunById(runId);
99
- if (!run) {
100
- throw new HTTPException(404, { message: "Workflow run not found" });
101
- }
102
- return run;
103
- } catch (error) {
104
- throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
105
- }
106
- }
107
- async function createWorkflowRunHandler({
108
- mastra,
109
- workflowId,
110
- runId: prevRunId
111
- }) {
112
- try {
113
- if (!workflowId) {
114
- throw new HTTPException(400, { message: "Workflow ID is required" });
115
- }
116
- const workflow = mastra.getWorkflow(workflowId);
117
- if (!workflow) {
118
- throw new HTTPException(404, { message: "Workflow not found" });
119
- }
120
- const run = workflow.createRun({ runId: prevRunId });
121
- return { runId: run.runId };
122
- } catch (error) {
123
- throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
124
- }
125
- }
126
- async function startAsyncWorkflowHandler({
127
- mastra,
128
- runtimeContext,
129
- workflowId,
130
- runId,
131
- inputData
132
- }) {
133
- try {
134
- if (!workflowId) {
135
- throw new HTTPException(400, { message: "Workflow ID is required" });
136
- }
137
- const workflow = mastra.getWorkflow(workflowId);
138
- if (!workflow) {
139
- throw new HTTPException(404, { message: "Workflow not found" });
140
- }
141
- const _run = workflow.createRun({ runId });
142
- const result = await _run.start({
143
- inputData,
144
- runtimeContext
145
- });
146
- return result;
147
- } catch (error) {
148
- throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
149
- }
150
- }
151
- async function startWorkflowRunHandler({
152
- mastra,
153
- runtimeContext,
154
- workflowId,
155
- runId,
156
- inputData
157
- }) {
158
- try {
159
- if (!workflowId) {
160
- throw new HTTPException(400, { message: "Workflow ID is required" });
161
- }
162
- if (!runId) {
163
- throw new HTTPException(400, { message: "runId required to start run" });
164
- }
165
- const workflow = mastra.getWorkflow(workflowId);
166
- const run = await workflow.getWorkflowRunById(runId);
167
- if (!run) {
168
- throw new HTTPException(404, { message: "Workflow run not found" });
169
- }
170
- const _run = workflow.createRun({ runId });
171
- void _run.start({
172
- inputData,
173
- runtimeContext
174
- });
175
- return { message: "Workflow run started" };
176
- } catch (e) {
177
- return handleError(e, "Error starting workflow run");
178
- }
179
- }
180
- async function watchWorkflowHandler({
181
- mastra,
182
- workflowId,
183
- runId
184
- }) {
185
- try {
186
- if (!workflowId) {
187
- throw new HTTPException(400, { message: "Workflow ID is required" });
188
- }
189
- if (!runId) {
190
- throw new HTTPException(400, { message: "runId required to watch workflow" });
191
- }
192
- const workflow = mastra.getWorkflow(workflowId);
193
- const run = await workflow.getWorkflowRunById(runId);
194
- if (!run) {
195
- throw new HTTPException(404, { message: "Workflow run not found" });
196
- }
197
- const _run = workflow.createRun({ runId });
198
- let unwatch;
199
- let asyncRef = null;
200
- const stream = new ReadableStream({
201
- start(controller) {
202
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
203
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
204
- if (asyncRef) {
205
- clearImmediate(asyncRef);
206
- asyncRef = null;
207
- }
208
- asyncRef = setImmediate(async () => {
209
- const runDone = payload.workflowState.status !== "running";
210
- if (runDone) {
211
- controller.close();
212
- unwatch?.();
213
- }
214
- });
215
- });
216
- },
217
- cancel() {
218
- unwatch?.();
219
- }
220
- });
221
- return stream;
222
- } catch (error) {
223
- return handleError(error, "Error watching workflow");
224
- }
225
- }
226
- function streamWorkflowHandler({
227
- mastra,
228
- runtimeContext,
229
- workflowId,
230
- runId,
231
- inputData
232
- }) {
233
- try {
234
- if (!workflowId) {
235
- throw new HTTPException(400, { message: "Workflow ID is required" });
236
- }
237
- if (!runId) {
238
- throw new HTTPException(400, { message: "runId required to resume workflow" });
239
- }
240
- const workflow = mastra.getWorkflow(workflowId);
241
- if (!workflow) {
242
- throw new HTTPException(404, { message: "Workflow not found" });
243
- }
244
- const run = workflow.createRun({ runId });
245
- const result = run.stream({
246
- inputData,
247
- runtimeContext
248
- });
249
- return result;
250
- } catch (error) {
251
- return handleError(error, "Error executing workflow");
252
- }
253
- }
254
- async function resumeAsyncWorkflowHandler({
255
- mastra,
256
- workflowId,
257
- runId,
258
- body,
259
- runtimeContext
260
- }) {
261
- try {
262
- if (!workflowId) {
263
- throw new HTTPException(400, { message: "Workflow ID is required" });
264
- }
265
- if (!runId) {
266
- throw new HTTPException(400, { message: "runId required to resume workflow" });
267
- }
268
- if (!body.step) {
269
- throw new HTTPException(400, { message: "step required to resume workflow" });
270
- }
271
- const workflow = mastra.getWorkflow(workflowId);
272
- const run = await workflow.getWorkflowRunById(runId);
273
- if (!run) {
274
- throw new HTTPException(404, { message: "Workflow run not found" });
275
- }
276
- const _run = workflow.createRun({ runId });
277
- const result = await _run.resume({
278
- step: body.step,
279
- resumeData: body.resumeData,
280
- runtimeContext
281
- });
282
- return result;
283
- } catch (error) {
284
- return handleError(error, "Error resuming workflow step");
285
- }
286
- }
287
- async function resumeWorkflowHandler({
288
- mastra,
289
- workflowId,
290
- runId,
291
- body,
292
- runtimeContext
293
- }) {
294
- try {
295
- if (!workflowId) {
296
- throw new HTTPException(400, { message: "Workflow ID is required" });
297
- }
298
- if (!runId) {
299
- throw new HTTPException(400, { message: "runId required to resume workflow" });
300
- }
301
- if (!body.step) {
302
- throw new HTTPException(400, { message: "step required to resume workflow" });
303
- }
304
- const workflow = mastra.getWorkflow(workflowId);
305
- const run = await workflow.getWorkflowRunById(runId);
306
- if (!run) {
307
- throw new HTTPException(404, { message: "Workflow run not found" });
308
- }
309
- const _run = workflow.createRun({ runId });
310
- void _run.resume({
311
- step: body.step,
312
- resumeData: body.resumeData,
313
- runtimeContext
314
- });
315
- return { message: "Workflow run resumed" };
316
- } catch (error) {
317
- return handleError(error, "Error resuming workflow");
318
- }
319
- }
320
- async function getWorkflowRunsHandler({
321
- mastra,
322
- workflowId,
323
- fromDate,
324
- toDate,
325
- limit,
326
- offset,
327
- resourceId
328
- }) {
329
- try {
330
- if (!workflowId) {
331
- throw new HTTPException(400, { message: "Workflow ID is required" });
332
- }
333
- const workflow = mastra.getWorkflow(workflowId);
334
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
335
- runs: [],
336
- total: 0
337
- };
338
- return workflowRuns;
339
- } catch (error) {
340
- return handleError(error, "Error getting workflow runs");
341
- }
342
- }
343
-
344
- export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
@@ -1,142 +0,0 @@
1
- import { validateBody } from './chunk-H5PTF3Y4.js';
2
- import { handleError } from './chunk-M5ABIP7D.js';
3
- import { HTTPException } from './chunk-NYN7KFXL.js';
4
- import { __export } from './chunk-MLKGABMK.js';
5
-
6
- // src/server/handlers/network.ts
7
- var network_exports = {};
8
- __export(network_exports, {
9
- generateHandler: () => generateHandler,
10
- getNetworkByIdHandler: () => getNetworkByIdHandler,
11
- getNetworksHandler: () => getNetworksHandler,
12
- streamGenerateHandler: () => streamGenerateHandler
13
- });
14
- async function getNetworksHandler({
15
- mastra,
16
- runtimeContext
17
- }) {
18
- try {
19
- const networks = mastra.getNetworks();
20
- const serializedNetworks = await Promise.all(
21
- networks.map(async (network) => {
22
- const routingAgent = network.getRoutingAgent();
23
- const routingLLM = await routingAgent.getLLM({ runtimeContext });
24
- const agents = network.getAgents();
25
- return {
26
- id: network.formatAgentId(routingAgent.name),
27
- name: routingAgent.name,
28
- instructions: routingAgent.instructions,
29
- agents: await Promise.all(
30
- agents.map(async (agent) => {
31
- const llm = await agent.getLLM({ runtimeContext });
32
- return {
33
- name: agent.name,
34
- provider: llm?.getProvider(),
35
- modelId: llm?.getModelId()
36
- };
37
- })
38
- ),
39
- routingModel: {
40
- provider: routingLLM?.getProvider(),
41
- modelId: routingLLM?.getModelId()
42
- }
43
- };
44
- })
45
- );
46
- return serializedNetworks;
47
- } catch (error) {
48
- return handleError(error, "Error getting networks");
49
- }
50
- }
51
- async function getNetworkByIdHandler({
52
- mastra,
53
- networkId,
54
- runtimeContext
55
- }) {
56
- try {
57
- const networks = mastra.getNetworks();
58
- const network = networks.find((network2) => {
59
- const routingAgent2 = network2.getRoutingAgent();
60
- return network2.formatAgentId(routingAgent2.name) === networkId;
61
- });
62
- if (!network) {
63
- throw new HTTPException(404, { message: "Network not found" });
64
- }
65
- const routingAgent = network.getRoutingAgent();
66
- const routingLLM = await routingAgent.getLLM({ runtimeContext });
67
- const agents = network.getAgents();
68
- const serializedNetwork = {
69
- id: network.formatAgentId(routingAgent.name),
70
- name: routingAgent.name,
71
- instructions: routingAgent.instructions,
72
- agents: await Promise.all(
73
- agents.map(async (agent) => {
74
- const llm = await agent.getLLM({ runtimeContext });
75
- return {
76
- name: agent.name,
77
- provider: llm?.getProvider(),
78
- modelId: llm?.getModelId()
79
- };
80
- })
81
- ),
82
- routingModel: {
83
- provider: routingLLM?.getProvider(),
84
- modelId: routingLLM?.getModelId()
85
- }
86
- };
87
- return serializedNetwork;
88
- } catch (error) {
89
- return handleError(error, "Error getting network by ID");
90
- }
91
- }
92
- async function generateHandler({
93
- mastra,
94
- runtimeContext,
95
- networkId,
96
- body
97
- }) {
98
- try {
99
- const network = mastra.getNetwork(networkId);
100
- if (!network) {
101
- throw new HTTPException(404, { message: "Network not found" });
102
- }
103
- validateBody({ messages: body.messages });
104
- const { messages, ...rest } = body;
105
- const result = await network.generate(messages, { ...rest, runtimeContext });
106
- return result;
107
- } catch (error) {
108
- return handleError(error, "Error generating from network");
109
- }
110
- }
111
- async function streamGenerateHandler({
112
- mastra,
113
- networkId,
114
- body,
115
- runtimeContext
116
- }) {
117
- try {
118
- const network = mastra.getNetwork(networkId);
119
- if (!network) {
120
- throw new HTTPException(404, { message: "Network not found" });
121
- }
122
- validateBody({ messages: body.messages });
123
- const { messages, output, ...rest } = body;
124
- const streamResult = await network.stream(messages, {
125
- output,
126
- ...rest,
127
- runtimeContext
128
- });
129
- const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
130
- sendUsage: true,
131
- sendReasoning: true,
132
- getErrorMessage: (error) => {
133
- return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
134
- }
135
- });
136
- return streamResponse;
137
- } catch (error) {
138
- return handleError(error, "Error streaming from network");
139
- }
140
- }
141
-
142
- export { generateHandler, getNetworkByIdHandler, getNetworksHandler, network_exports, streamGenerateHandler };
@@ -1,114 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
4
- var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
5
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
6
- var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
- var stream = require('stream');
8
-
9
- // src/server/handlers/voice.ts
10
- var voice_exports = {};
11
- chunk75ZPJI57_cjs.__export(voice_exports, {
12
- generateSpeechHandler: () => generateSpeechHandler,
13
- getListenerHandler: () => getListenerHandler,
14
- getSpeakersHandler: () => getSpeakersHandler,
15
- transcribeSpeechHandler: () => transcribeSpeechHandler
16
- });
17
- async function getSpeakersHandler({ mastra, agentId }) {
18
- try {
19
- if (!agentId) {
20
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
21
- }
22
- const agent = mastra.getAgent(agentId);
23
- if (!agent) {
24
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
25
- }
26
- if (!agent.voice) {
27
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
28
- }
29
- const speakers = await agent.voice.getSpeakers();
30
- return speakers;
31
- } catch (error) {
32
- return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
33
- }
34
- }
35
- async function generateSpeechHandler({
36
- mastra,
37
- agentId,
38
- body
39
- }) {
40
- try {
41
- if (!agentId) {
42
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
43
- }
44
- chunk57CJTIPW_cjs.validateBody({
45
- text: body?.text
46
- });
47
- const agent = mastra.getAgent(agentId);
48
- if (!agent) {
49
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
50
- }
51
- if (!agent.voice) {
52
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
53
- }
54
- const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
55
- if (!audioStream) {
56
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
57
- }
58
- return audioStream;
59
- } catch (error) {
60
- return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
61
- }
62
- }
63
- async function transcribeSpeechHandler({
64
- mastra,
65
- agentId,
66
- body
67
- }) {
68
- try {
69
- if (!agentId) {
70
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
71
- }
72
- if (!body?.audioData) {
73
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
74
- }
75
- const agent = mastra.getAgent(agentId);
76
- if (!agent) {
77
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
78
- }
79
- if (!agent.voice) {
80
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
81
- }
82
- const audioStream = new stream.Readable();
83
- audioStream.push(body.audioData);
84
- audioStream.push(null);
85
- const text = await agent.voice.listen(audioStream, body.options);
86
- return { text };
87
- } catch (error) {
88
- return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
89
- }
90
- }
91
- async function getListenerHandler({ mastra, agentId }) {
92
- try {
93
- if (!agentId) {
94
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
95
- }
96
- const agent = mastra.getAgent(agentId);
97
- if (!agent) {
98
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
99
- }
100
- if (!agent.voice) {
101
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
102
- }
103
- const listeners = await agent.voice.getListener();
104
- return listeners;
105
- } catch (error) {
106
- return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
107
- }
108
- }
109
-
110
- exports.generateSpeechHandler = generateSpeechHandler;
111
- exports.getListenerHandler = getListenerHandler;
112
- exports.getSpeakersHandler = getSpeakersHandler;
113
- exports.transcribeSpeechHandler = transcribeSpeechHandler;
114
- exports.voice_exports = voice_exports;