@mastra/server 0.0.0-cloud-transporter-20250513033346 → 0.0.0-cloud-storage-adapter-20251106204059

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 (273) hide show
  1. package/CHANGELOG.md +4864 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +1 -6
  4. package/dist/chunk-2IS5WICF.js +23036 -0
  5. package/dist/chunk-2IS5WICF.js.map +1 -0
  6. package/dist/chunk-2PLXW4ZX.cjs +2777 -0
  7. package/dist/chunk-2PLXW4ZX.cjs.map +1 -0
  8. package/dist/chunk-2YZH5PH6.cjs +200 -0
  9. package/dist/chunk-2YZH5PH6.cjs.map +1 -0
  10. package/dist/chunk-3AMNUUZF.js +124 -0
  11. package/dist/chunk-3AMNUUZF.js.map +1 -0
  12. package/dist/chunk-3F52QCI4.js +192 -0
  13. package/dist/chunk-3F52QCI4.js.map +1 -0
  14. package/dist/chunk-4JF5WXPL.js +502 -0
  15. package/dist/chunk-4JF5WXPL.js.map +1 -0
  16. package/dist/{chunk-OCWPVYNI.cjs → chunk-64ITUOXI.cjs} +3 -0
  17. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  18. package/dist/{chunk-NYN7KFXL.js → chunk-6QWQZI4Q.js} +3 -0
  19. package/dist/chunk-6QWQZI4Q.js.map +1 -0
  20. package/dist/chunk-73PAWDM5.js +83 -0
  21. package/dist/chunk-73PAWDM5.js.map +1 -0
  22. package/dist/chunk-A24TSVEZ.cjs +130 -0
  23. package/dist/chunk-A24TSVEZ.cjs.map +1 -0
  24. package/dist/chunk-A2NPD5N6.cjs +517 -0
  25. package/dist/chunk-A2NPD5N6.cjs.map +1 -0
  26. package/dist/chunk-B3Z6J745.js +122 -0
  27. package/dist/chunk-B3Z6J745.js.map +1 -0
  28. package/dist/chunk-BTWIR2B7.cjs +28 -0
  29. package/dist/chunk-BTWIR2B7.cjs.map +1 -0
  30. package/dist/chunk-D7T74TVR.js +129 -0
  31. package/dist/chunk-D7T74TVR.js.map +1 -0
  32. package/dist/chunk-EHACNWDL.cjs +681 -0
  33. package/dist/chunk-EHACNWDL.cjs.map +1 -0
  34. package/dist/{chunk-P6SCPDYW.js → chunk-FPBYKMIS.js} +124 -147
  35. package/dist/chunk-FPBYKMIS.js.map +1 -0
  36. package/dist/chunk-GLAZTMX3.cjs +128 -0
  37. package/dist/chunk-GLAZTMX3.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-ID6JYDNL.cjs +23075 -0
  41. package/dist/chunk-ID6JYDNL.cjs.map +1 -0
  42. package/dist/chunk-KF3RI45U.cjs +172 -0
  43. package/dist/chunk-KF3RI45U.cjs.map +1 -0
  44. package/dist/{chunk-5SN4U5AC.cjs → chunk-KJIDZQRA.cjs} +125 -148
  45. package/dist/chunk-KJIDZQRA.cjs.map +1 -0
  46. package/dist/{chunk-IU5VO2I2.js → chunk-KWH5QBXP.js} +7 -5
  47. package/dist/chunk-KWH5QBXP.js.map +1 -0
  48. package/dist/chunk-LF2ZLOFP.js +767 -0
  49. package/dist/chunk-LF2ZLOFP.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-ND5OKOMT.js +165 -0
  53. package/dist/chunk-ND5OKOMT.js.map +1 -0
  54. package/dist/chunk-O7I5CWRX.cjs +44 -0
  55. package/dist/chunk-O7I5CWRX.cjs.map +1 -0
  56. package/dist/chunk-PPMIB3FQ.cjs +88 -0
  57. package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
  58. package/dist/chunk-PR4QN5HX.js +39 -0
  59. package/dist/chunk-PR4QN5HX.js.map +1 -0
  60. package/dist/chunk-QU6N55W6.cjs +256 -0
  61. package/dist/chunk-QU6N55W6.cjs.map +1 -0
  62. package/dist/chunk-RQK4FQUD.js +1012 -0
  63. package/dist/chunk-RQK4FQUD.js.map +1 -0
  64. package/dist/{chunk-4YZ3U35L.cjs → chunk-S54HNARD.cjs} +22 -20
  65. package/dist/chunk-S54HNARD.cjs.map +1 -0
  66. package/dist/chunk-SHWNNZBL.js +254 -0
  67. package/dist/chunk-SHWNNZBL.js.map +1 -0
  68. package/dist/{chunk-H5PTF3Y4.js → chunk-SZIFSF4T.js} +11 -2
  69. package/dist/chunk-SZIFSF4T.js.map +1 -0
  70. package/dist/chunk-TOCYBDP2.js +46 -0
  71. package/dist/chunk-TOCYBDP2.js.map +1 -0
  72. package/dist/chunk-UXGQZUYZ.js +16 -0
  73. package/dist/chunk-UXGQZUYZ.js.map +1 -0
  74. package/dist/chunk-V5WWQN7P.cjs +18 -0
  75. package/dist/chunk-V5WWQN7P.cjs.map +1 -0
  76. package/dist/chunk-W2KMU354.cjs +133 -0
  77. package/dist/chunk-W2KMU354.cjs.map +1 -0
  78. package/dist/chunk-X3MICMI2.cjs +620 -0
  79. package/dist/chunk-X3MICMI2.cjs.map +1 -0
  80. package/dist/chunk-X6C7BUWN.cjs +48 -0
  81. package/dist/chunk-X6C7BUWN.cjs.map +1 -0
  82. package/dist/chunk-Z2O5YVHY.js +661 -0
  83. package/dist/chunk-Z2O5YVHY.js.map +1 -0
  84. package/dist/chunk-ZJ6KEY6H.js +600 -0
  85. package/dist/chunk-ZJ6KEY6H.js.map +1 -0
  86. package/dist/chunk-ZULZ2752.js +2774 -0
  87. package/dist/chunk-ZULZ2752.js.map +1 -0
  88. package/dist/dist-4MVGNSRL.cjs +1150 -0
  89. package/dist/dist-4MVGNSRL.cjs.map +1 -0
  90. package/dist/dist-FZYCV3VB.cjs +940 -0
  91. package/dist/dist-FZYCV3VB.cjs.map +1 -0
  92. package/dist/dist-G2BYZJOC.cjs +928 -0
  93. package/dist/dist-G2BYZJOC.cjs.map +1 -0
  94. package/dist/dist-P4MXBQ3U.cjs +16 -0
  95. package/dist/dist-P4MXBQ3U.cjs.map +1 -0
  96. package/dist/dist-PQZUVLPC.js +937 -0
  97. package/dist/dist-PQZUVLPC.js.map +1 -0
  98. package/dist/dist-R7WYX6LC.js +925 -0
  99. package/dist/dist-R7WYX6LC.js.map +1 -0
  100. package/dist/dist-RFMYFILX.cjs +764 -0
  101. package/dist/dist-RFMYFILX.cjs.map +1 -0
  102. package/dist/dist-X7XR3M3Z.js +1147 -0
  103. package/dist/dist-X7XR3M3Z.js.map +1 -0
  104. package/dist/dist-XVBSOGFK.js +761 -0
  105. package/dist/dist-XVBSOGFK.js.map +1 -0
  106. package/dist/dist-YREX2TJT.js +3 -0
  107. package/dist/dist-YREX2TJT.js.map +1 -0
  108. package/dist/index.cjs +6 -0
  109. package/dist/index.cjs.map +1 -0
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +5 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/server/a2a/protocol.d.ts +8 -0
  115. package/dist/server/a2a/protocol.d.ts.map +1 -0
  116. package/dist/server/a2a/store.cjs +25 -0
  117. package/dist/server/a2a/store.cjs.map +1 -0
  118. package/dist/server/a2a/store.d.ts +14 -0
  119. package/dist/server/a2a/store.d.ts.map +1 -0
  120. package/dist/server/a2a/store.js +23 -0
  121. package/dist/server/a2a/store.js.map +1 -0
  122. package/dist/server/a2a/tasks.d.ts +20 -0
  123. package/dist/server/a2a/tasks.d.ts.map +1 -0
  124. package/dist/server/handlers/a2a.cjs +13 -11
  125. package/dist/server/handlers/a2a.cjs.map +1 -0
  126. package/dist/server/handlers/a2a.d.ts +68 -6
  127. package/dist/server/handlers/a2a.d.ts.map +1 -0
  128. package/dist/server/handlers/a2a.js +3 -1
  129. package/dist/server/handlers/a2a.js.map +1 -0
  130. package/dist/server/handlers/agent-builder.cjs +80 -0
  131. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  132. package/dist/server/handlers/agent-builder.d.ts +85 -0
  133. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  134. package/dist/server/handlers/agent-builder.js +3 -0
  135. package/dist/server/handlers/agent-builder.js.map +1 -0
  136. package/dist/server/handlers/agents.cjs +60 -10
  137. package/dist/server/handlers/agents.cjs.map +1 -0
  138. package/dist/server/handlers/agents.d.ts +194 -6
  139. package/dist/server/handlers/agents.d.ts.map +1 -0
  140. package/dist/server/handlers/agents.js +3 -1
  141. package/dist/server/handlers/agents.js.map +1 -0
  142. package/dist/server/handlers/error.cjs +4 -2
  143. package/dist/server/handlers/error.cjs.map +1 -0
  144. package/dist/server/handlers/error.d.ts +2 -1
  145. package/dist/server/handlers/error.d.ts.map +1 -0
  146. package/dist/server/handlers/error.js +3 -1
  147. package/dist/server/handlers/error.js.map +1 -0
  148. package/dist/server/handlers/logs.cjs +9 -7
  149. package/dist/server/handlers/logs.cjs.map +1 -0
  150. package/dist/server/handlers/logs.d.ts +34 -3
  151. package/dist/server/handlers/logs.d.ts.map +1 -0
  152. package/dist/server/handlers/logs.js +3 -1
  153. package/dist/server/handlers/logs.js.map +1 -0
  154. package/dist/server/handlers/memory.cjs +34 -12
  155. package/dist/server/handlers/memory.cjs.map +1 -0
  156. package/dist/server/handlers/memory.d.ts +112 -8
  157. package/dist/server/handlers/memory.d.ts.map +1 -0
  158. package/dist/server/handlers/memory.js +3 -1
  159. package/dist/server/handlers/memory.js.map +1 -0
  160. package/dist/server/handlers/observability.cjs +24 -0
  161. package/dist/server/handlers/observability.cjs.map +1 -0
  162. package/dist/server/handlers/observability.d.ts +49 -0
  163. package/dist/server/handlers/observability.d.ts.map +1 -0
  164. package/dist/server/handlers/observability.js +3 -0
  165. package/dist/server/handlers/observability.js.map +1 -0
  166. package/dist/server/handlers/scores.cjs +32 -0
  167. package/dist/server/handlers/scores.cjs.map +1 -0
  168. package/dist/server/handlers/scores.d.ts +152 -0
  169. package/dist/server/handlers/scores.d.ts.map +1 -0
  170. package/dist/server/handlers/scores.js +3 -0
  171. package/dist/server/handlers/scores.js.map +1 -0
  172. package/dist/server/handlers/tools.cjs +12 -6
  173. package/dist/server/handlers/tools.cjs.map +1 -0
  174. package/dist/server/handlers/tools.d.ts +25 -4
  175. package/dist/server/handlers/tools.d.ts.map +1 -0
  176. package/dist/server/handlers/tools.js +3 -1
  177. package/dist/server/handlers/tools.js.map +1 -0
  178. package/dist/server/handlers/utils.cjs +8 -2
  179. package/dist/server/handlers/utils.cjs.map +1 -0
  180. package/dist/server/handlers/utils.d.ts +8 -1
  181. package/dist/server/handlers/utils.d.ts.map +1 -0
  182. package/dist/server/handlers/utils.js +3 -1
  183. package/dist/server/handlers/utils.js.map +1 -0
  184. package/dist/server/handlers/vector.cjs +9 -7
  185. package/dist/server/handlers/vector.cjs.map +1 -0
  186. package/dist/server/handlers/vector.d.ts +51 -6
  187. package/dist/server/handlers/vector.d.ts.map +1 -0
  188. package/dist/server/handlers/vector.js +3 -1
  189. package/dist/server/handlers/vector.js.map +1 -0
  190. package/dist/server/handlers/voice.cjs +10 -4
  191. package/dist/server/handlers/voice.cjs.map +1 -0
  192. package/dist/server/handlers/voice.d.ts +41 -3
  193. package/dist/server/handlers/voice.d.ts.map +1 -0
  194. package/dist/server/handlers/voice.js +3 -1
  195. package/dist/server/handlers/voice.js.map +1 -0
  196. package/dist/server/handlers/workflows.cjs +50 -16
  197. package/dist/server/handlers/workflows.cjs.map +1 -0
  198. package/dist/server/handlers/workflows.d.ts +88 -10
  199. package/dist/server/handlers/workflows.d.ts.map +1 -0
  200. package/dist/server/handlers/workflows.js +3 -1
  201. package/dist/server/handlers/workflows.js.map +1 -0
  202. package/dist/server/handlers.cjs +34 -32
  203. package/dist/server/handlers.cjs.map +1 -0
  204. package/dist/server/handlers.d.ts +12 -11
  205. package/dist/server/handlers.d.ts.map +1 -0
  206. package/dist/server/handlers.js +13 -11
  207. package/dist/server/handlers.js.map +1 -0
  208. package/dist/server/http-exception.d.ts +82 -0
  209. package/dist/server/http-exception.d.ts.map +1 -0
  210. package/dist/server/types.d.ts +10 -0
  211. package/dist/server/types.d.ts.map +1 -0
  212. package/dist/server/utils.d.ts +45 -0
  213. package/dist/server/utils.d.ts.map +1 -0
  214. package/dist/token-375W3LEI.cjs +64 -0
  215. package/dist/token-375W3LEI.cjs.map +1 -0
  216. package/dist/token-C3IMNCC4.js +62 -0
  217. package/dist/token-C3IMNCC4.js.map +1 -0
  218. package/dist/token-util-CV3RRG6K.cjs +9 -0
  219. package/dist/token-util-CV3RRG6K.cjs.map +1 -0
  220. package/dist/token-util-E5QO2RCL.js +7 -0
  221. package/dist/token-util-E5QO2RCL.js.map +1 -0
  222. package/package.json +46 -21
  223. package/dist/_tsup-dts-rollup.d.cts +0 -815
  224. package/dist/_tsup-dts-rollup.d.ts +0 -815
  225. package/dist/chunk-57CJTIPW.cjs +0 -18
  226. package/dist/chunk-64U3UDTH.cjs +0 -13
  227. package/dist/chunk-75ZPJI57.cjs +0 -9
  228. package/dist/chunk-C7564HUT.js +0 -142
  229. package/dist/chunk-D4IRYCUI.cjs +0 -235
  230. package/dist/chunk-DJJIUEL2.js +0 -211
  231. package/dist/chunk-EJO45KYT.js +0 -320
  232. package/dist/chunk-HFWCEP5S.js +0 -89
  233. package/dist/chunk-HWZVAG3H.js +0 -49
  234. package/dist/chunk-I2B73Y4I.cjs +0 -332
  235. package/dist/chunk-LIVAK2DM.js +0 -2001
  236. package/dist/chunk-M5ABIP7D.js +0 -11
  237. package/dist/chunk-MHKNLNAN.cjs +0 -142
  238. package/dist/chunk-MIQYDLLM.js +0 -329
  239. package/dist/chunk-MLKGABMK.js +0 -7
  240. package/dist/chunk-OGCNNUHF.cjs +0 -54
  241. package/dist/chunk-OR3CIE2H.js +0 -138
  242. package/dist/chunk-TJKLBTFB.js +0 -132
  243. package/dist/chunk-UCTEMO2Q.cjs +0 -341
  244. package/dist/chunk-VPNDC2DI.cjs +0 -148
  245. package/dist/chunk-WUC6LSTW.js +0 -227
  246. package/dist/chunk-Y7UWRW5X.cjs +0 -221
  247. package/dist/chunk-YBVOQN4M.cjs +0 -94
  248. package/dist/chunk-YWLUOY3D.cjs +0 -2004
  249. package/dist/chunk-ZE5AAC4I.cjs +0 -138
  250. package/dist/index.d.cts +0 -1
  251. package/dist/server/handlers/a2a.d.cts +0 -6
  252. package/dist/server/handlers/agents.d.cts +0 -6
  253. package/dist/server/handlers/error.d.cts +0 -1
  254. package/dist/server/handlers/logs.d.cts +0 -3
  255. package/dist/server/handlers/memory.d.cts +0 -8
  256. package/dist/server/handlers/network.cjs +0 -22
  257. package/dist/server/handlers/network.d.cts +0 -4
  258. package/dist/server/handlers/network.d.ts +0 -4
  259. package/dist/server/handlers/network.js +0 -1
  260. package/dist/server/handlers/telemetry.cjs +0 -14
  261. package/dist/server/handlers/telemetry.d.cts +0 -2
  262. package/dist/server/handlers/telemetry.d.ts +0 -2
  263. package/dist/server/handlers/telemetry.js +0 -1
  264. package/dist/server/handlers/tools.d.cts +0 -4
  265. package/dist/server/handlers/utils.d.cts +0 -1
  266. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  267. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  268. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  269. package/dist/server/handlers/vNextWorkflows.js +0 -1
  270. package/dist/server/handlers/vector.d.cts +0 -6
  271. package/dist/server/handlers/voice.d.cts +0 -3
  272. package/dist/server/handlers/workflows.d.cts +0 -10
  273. package/dist/server/handlers.d.cts +0 -11
@@ -1,320 +0,0 @@
1
- import { stringify, esm_default } from './chunk-LIVAK2DM.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 'node:stream/web';
6
-
7
- // src/server/handlers/workflows.ts
8
- var workflows_exports = {};
9
- __export(workflows_exports, {
10
- createRunHandler: () => createRunHandler,
11
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
12
- getWorkflowRunHandler: () => getWorkflowRunHandler,
13
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
14
- getWorkflowsHandler: () => getWorkflowsHandler,
15
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
16
- resumeWorkflowHandler: () => resumeWorkflowHandler,
17
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
18
- startWorkflowRunHandler: () => startWorkflowRunHandler,
19
- watchWorkflowHandler: () => watchWorkflowHandler
20
- });
21
- async function getWorkflowsHandler({ mastra }) {
22
- try {
23
- const workflows = mastra.getWorkflows({ serialized: false });
24
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
25
- if (workflow.isNested) return acc;
26
- acc[key] = {
27
- stepGraph: workflow.stepGraph,
28
- stepSubscriberGraph: workflow.stepSubscriberGraph,
29
- serializedStepGraph: workflow.serializedStepGraph,
30
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
31
- name: workflow.name,
32
- triggerSchema: workflow.triggerSchema ? stringify(esm_default(workflow.triggerSchema)) : void 0,
33
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
34
- const _step = step;
35
- acc2[key2] = {
36
- id: _step.id,
37
- description: _step.description,
38
- workflowId: _step.workflowId,
39
- inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
40
- outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
41
- };
42
- return acc2;
43
- }, {})
44
- };
45
- return acc;
46
- }, {});
47
- return _workflows;
48
- } catch (error) {
49
- throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
50
- }
51
- }
52
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
53
- try {
54
- if (!workflowId) {
55
- throw new HTTPException(400, { message: "Workflow ID is required" });
56
- }
57
- const workflow = mastra.getWorkflow(workflowId);
58
- if (!workflow) {
59
- throw new HTTPException(404, { message: "Workflow not found" });
60
- }
61
- return {
62
- stepGraph: workflow.stepGraph,
63
- stepSubscriberGraph: workflow.stepSubscriberGraph,
64
- serializedStepGraph: workflow.serializedStepGraph,
65
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
66
- name: workflow.name,
67
- triggerSchema: workflow.triggerSchema ? stringify(esm_default(workflow.triggerSchema)) : void 0,
68
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
69
- const _step = step;
70
- acc[key] = {
71
- id: _step.id,
72
- description: _step.description,
73
- workflowId: _step.workflowId,
74
- inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
75
- outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
76
- };
77
- return acc;
78
- }, {})
79
- };
80
- } catch (error) {
81
- throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
82
- }
83
- }
84
- async function startAsyncWorkflowHandler({
85
- mastra,
86
- runtimeContext,
87
- workflowId,
88
- runId,
89
- triggerData
90
- }) {
91
- try {
92
- if (!workflowId) {
93
- throw new HTTPException(400, { message: "Workflow ID is required" });
94
- }
95
- const workflow = mastra.getWorkflow(workflowId);
96
- if (!workflow) {
97
- throw new HTTPException(404, { message: "Workflow not found" });
98
- }
99
- if (!runId) {
100
- const newRun = workflow.createRun();
101
- const result2 = await newRun.start({
102
- triggerData,
103
- runtimeContext
104
- });
105
- return result2;
106
- }
107
- const run = workflow.getMemoryRun(runId);
108
- if (!run) {
109
- throw new HTTPException(404, { message: "Workflow run not found" });
110
- }
111
- const result = await run.start({
112
- triggerData,
113
- runtimeContext
114
- });
115
- return result;
116
- } catch (error) {
117
- throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
118
- }
119
- }
120
- async function getWorkflowRunHandler({
121
- mastra,
122
- workflowId,
123
- runId
124
- }) {
125
- try {
126
- if (!workflowId) {
127
- throw new HTTPException(400, { message: "Workflow ID is required" });
128
- }
129
- if (!runId) {
130
- throw new HTTPException(400, { message: "Run ID is required" });
131
- }
132
- const workflow = mastra.getWorkflow(workflowId);
133
- if (!workflow) {
134
- throw new HTTPException(404, { message: "Workflow not found" });
135
- }
136
- const run = await workflow.getRun(runId);
137
- if (!run) {
138
- throw new HTTPException(404, { message: "Workflow run not found" });
139
- }
140
- return run;
141
- } catch (error) {
142
- throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
143
- }
144
- }
145
- async function createRunHandler({
146
- mastra,
147
- workflowId,
148
- runId: prevRunId
149
- }) {
150
- try {
151
- if (!workflowId) {
152
- throw new HTTPException(400, { message: "Workflow ID is required" });
153
- }
154
- const workflow = mastra.getWorkflow(workflowId);
155
- if (!workflow) {
156
- throw new HTTPException(404, { message: "Workflow not found" });
157
- }
158
- const newRun = workflow.createRun({ runId: prevRunId });
159
- return { runId: newRun.runId };
160
- } catch (error) {
161
- throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
162
- }
163
- }
164
- async function startWorkflowRunHandler({
165
- mastra,
166
- runtimeContext,
167
- workflowId,
168
- runId,
169
- triggerData
170
- }) {
171
- try {
172
- if (!workflowId) {
173
- throw new HTTPException(400, { message: "Workflow ID is required" });
174
- }
175
- if (!runId) {
176
- throw new HTTPException(400, { message: "runId required to start run" });
177
- }
178
- const workflow = mastra.getWorkflow(workflowId);
179
- const run = workflow.getMemoryRun(runId);
180
- if (!run) {
181
- throw new HTTPException(404, { message: "Workflow run not found" });
182
- }
183
- void run.start({
184
- triggerData,
185
- runtimeContext
186
- });
187
- return { message: "Workflow run started" };
188
- } catch (e) {
189
- return handleError(e, "Error starting workflow run");
190
- }
191
- }
192
- async function watchWorkflowHandler({
193
- mastra,
194
- workflowId,
195
- runId
196
- }) {
197
- try {
198
- if (!workflowId) {
199
- throw new HTTPException(400, { message: "Workflow ID is required" });
200
- }
201
- if (!runId) {
202
- throw new HTTPException(400, { message: "runId required to watch workflow" });
203
- }
204
- const workflow = mastra.getWorkflow(workflowId);
205
- const run = workflow.getMemoryRun(runId);
206
- if (!run) {
207
- throw new HTTPException(404, { message: "Workflow run not found" });
208
- }
209
- let unwatch;
210
- let asyncRef = null;
211
- const stream = new ReadableStream({
212
- start(controller) {
213
- unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
214
- const activePathsObj = Object.fromEntries(activePaths);
215
- controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
216
- if (asyncRef) {
217
- clearImmediate(asyncRef);
218
- asyncRef = null;
219
- }
220
- asyncRef = setImmediate(() => {
221
- const runDone = Object.values(activePathsObj).every((value) => value.status !== "executing");
222
- if (runDone) {
223
- controller.close();
224
- unwatch?.();
225
- }
226
- });
227
- });
228
- },
229
- cancel() {
230
- unwatch?.();
231
- }
232
- });
233
- return stream;
234
- } catch (error) {
235
- return handleError(error, "Error watching workflow");
236
- }
237
- }
238
- async function resumeAsyncWorkflowHandler({
239
- mastra,
240
- workflowId,
241
- runId,
242
- body,
243
- runtimeContext
244
- }) {
245
- try {
246
- if (!workflowId) {
247
- throw new HTTPException(400, { message: "Workflow ID is required" });
248
- }
249
- if (!runId) {
250
- throw new HTTPException(400, { message: "runId required to resume workflow" });
251
- }
252
- const workflow = mastra.getWorkflow(workflowId);
253
- const run = workflow.getMemoryRun(runId);
254
- if (!run) {
255
- throw new HTTPException(404, { message: "Workflow run not found" });
256
- }
257
- const result = await run.resume({
258
- stepId: body.stepId,
259
- context: body.context,
260
- runtimeContext
261
- });
262
- return result;
263
- } catch (error) {
264
- return handleError(error, "Error resuming workflow step");
265
- }
266
- }
267
- async function resumeWorkflowHandler({
268
- mastra,
269
- workflowId,
270
- runId,
271
- body,
272
- runtimeContext
273
- }) {
274
- try {
275
- if (!workflowId) {
276
- throw new HTTPException(400, { message: "Workflow ID is required" });
277
- }
278
- if (!runId) {
279
- throw new HTTPException(400, { message: "runId required to resume workflow" });
280
- }
281
- const workflow = mastra.getWorkflow(workflowId);
282
- const run = workflow.getMemoryRun(runId);
283
- if (!run) {
284
- throw new HTTPException(404, { message: "Workflow run not found" });
285
- }
286
- void run.resume({
287
- stepId: body.stepId,
288
- context: body.context,
289
- runtimeContext
290
- });
291
- return { message: "Workflow run resumed" };
292
- } catch (error) {
293
- return handleError(error, "Error resuming workflow");
294
- }
295
- }
296
- async function getWorkflowRunsHandler({
297
- mastra,
298
- workflowId,
299
- fromDate,
300
- toDate,
301
- limit,
302
- offset,
303
- resourceId
304
- }) {
305
- try {
306
- if (!workflowId) {
307
- throw new HTTPException(400, { message: "Workflow ID is required" });
308
- }
309
- const workflow = mastra.getWorkflow(workflowId);
310
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
311
- runs: [],
312
- total: 0
313
- };
314
- return workflowRuns;
315
- } catch (error) {
316
- return handleError(error, "Error getting workflow runs");
317
- }
318
- }
319
-
320
- export { createRunHandler, getWorkflowByIdHandler, getWorkflowRunHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, workflows_exports };
@@ -1,89 +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
- import { Readable } from 'stream';
6
-
7
- // src/server/handlers/voice.ts
8
- var voice_exports = {};
9
- __export(voice_exports, {
10
- generateSpeechHandler: () => generateSpeechHandler,
11
- getSpeakersHandler: () => getSpeakersHandler,
12
- transcribeSpeechHandler: () => transcribeSpeechHandler
13
- });
14
- async function getSpeakersHandler({ mastra, agentId }) {
15
- try {
16
- if (!agentId) {
17
- throw new HTTPException(400, { message: "Agent ID is required" });
18
- }
19
- const agent = mastra.getAgent(agentId);
20
- if (!agent) {
21
- throw new HTTPException(404, { message: "Agent not found" });
22
- }
23
- if (!agent.voice) {
24
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
25
- }
26
- const speakers = await agent.voice.getSpeakers();
27
- return speakers;
28
- } catch (error) {
29
- return handleError(error, "Error getting speakers");
30
- }
31
- }
32
- async function generateSpeechHandler({
33
- mastra,
34
- agentId,
35
- body
36
- }) {
37
- try {
38
- if (!agentId) {
39
- throw new HTTPException(400, { message: "Agent ID is required" });
40
- }
41
- validateBody({
42
- text: body?.text
43
- });
44
- const agent = mastra.getAgent(agentId);
45
- if (!agent) {
46
- throw new HTTPException(404, { message: "Agent not found" });
47
- }
48
- if (!agent.voice) {
49
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
50
- }
51
- const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
52
- if (!audioStream) {
53
- throw new HTTPException(500, { message: "Failed to generate speech" });
54
- }
55
- return audioStream;
56
- } catch (error) {
57
- return handleError(error, "Error generating speech");
58
- }
59
- }
60
- async function transcribeSpeechHandler({
61
- mastra,
62
- agentId,
63
- body
64
- }) {
65
- try {
66
- if (!agentId) {
67
- throw new HTTPException(400, { message: "Agent ID is required" });
68
- }
69
- if (!body?.audioData) {
70
- throw new HTTPException(400, { message: "Audio data is required" });
71
- }
72
- const agent = mastra.getAgent(agentId);
73
- if (!agent) {
74
- throw new HTTPException(404, { message: "Agent not found" });
75
- }
76
- if (!agent.voice) {
77
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
78
- }
79
- const audioStream = new Readable();
80
- audioStream.push(body.audioData);
81
- audioStream.push(null);
82
- const text = await agent.voice.listen(audioStream, body.options);
83
- return { text };
84
- } catch (error) {
85
- return handleError(error, "Error transcribing speech");
86
- }
87
- }
88
-
89
- export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
@@ -1,49 +0,0 @@
1
- import { validateBody } from './chunk-H5PTF3Y4.js';
2
- import { handleError } from './chunk-M5ABIP7D.js';
3
- import { __export } from './chunk-MLKGABMK.js';
4
-
5
- // src/server/handlers/logs.ts
6
- var logs_exports = {};
7
- __export(logs_exports, {
8
- getLogTransports: () => getLogTransports,
9
- getLogsByRunIdHandler: () => getLogsByRunIdHandler,
10
- getLogsHandler: () => getLogsHandler
11
- });
12
- async function getLogsHandler({
13
- mastra,
14
- transportId
15
- }) {
16
- try {
17
- validateBody({ transportId });
18
- const logs = await mastra.getLogs(transportId);
19
- return logs;
20
- } catch (error) {
21
- return handleError(error, "Error getting logs");
22
- }
23
- }
24
- async function getLogsByRunIdHandler({
25
- mastra,
26
- runId,
27
- transportId
28
- }) {
29
- try {
30
- validateBody({ runId, transportId });
31
- const logs = await mastra.getLogsByRunId({ runId, transportId });
32
- return logs;
33
- } catch (error) {
34
- return handleError(error, "Error getting logs by run ID");
35
- }
36
- }
37
- async function getLogTransports({ mastra }) {
38
- try {
39
- const logger = mastra.getLogger();
40
- const transports = logger.transports;
41
- return {
42
- transports: transports ? Object.keys(transports) : []
43
- };
44
- } catch (error) {
45
- return handleError(error, "Error getting log Transports");
46
- }
47
- }
48
-
49
- export { getLogTransports, getLogsByRunIdHandler, getLogsHandler, logs_exports };