@mastra/server 0.0.0-generate-message-id-20250512171942 → 0.0.0-http-transporter-20250702160118

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 (85) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +394 -128
  2. package/dist/_tsup-dts-rollup.d.ts +394 -128
  3. package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
  4. package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
  5. package/dist/chunk-4D66QEKC.js +81 -0
  6. package/dist/{chunk-EJO45KYT.js → chunk-5PQQ42EZ.js} +43 -43
  7. package/dist/{chunk-4YZ3U35L.cjs → chunk-7TP2LX5L.cjs} +18 -18
  8. package/dist/chunk-B2PAS2IB.cjs +514 -0
  9. package/dist/{chunk-Q6KMBIAN.js → chunk-BK4XT6EG.js} +93 -14
  10. package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  11. package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
  12. package/dist/{chunk-24EGIVT7.cjs → chunk-DN7K6FJK.cjs} +91 -54
  13. package/dist/{chunk-ZE5AAC4I.cjs → chunk-FRVBFMO2.cjs} +26 -36
  14. package/dist/{chunk-MHKNLNAN.cjs → chunk-G7KH752Y.cjs} +10 -7
  15. package/dist/{chunk-P6SCPDYW.js → chunk-GHC4YV6R.js} +5 -1
  16. package/dist/chunk-H7DMHBKY.js +498 -0
  17. package/dist/chunk-JMLYCXMK.cjs +332 -0
  18. package/dist/{chunk-HFWCEP5S.js → chunk-KHZKYUNR.js} +33 -10
  19. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  20. package/dist/chunk-LF7P5PLR.js +14 -0
  21. package/dist/{chunk-YWLUOY3D.cjs → chunk-LI436ITD.cjs} +107 -69
  22. package/dist/{chunk-TJKLBTFB.js → chunk-LRCAAFUA.js} +10 -20
  23. package/dist/{chunk-3HQNCTZ2.cjs → chunk-LZ3VJXSO.cjs} +107 -28
  24. package/dist/{chunk-LIVAK2DM.js → chunk-MEGCYGBU.js} +108 -70
  25. package/dist/{chunk-X3ZDCS52.js → chunk-MKLYEKEF.js} +62 -25
  26. package/dist/chunk-PZQDCRPV.cjs +16 -0
  27. package/dist/chunk-QGX47B5D.cjs +86 -0
  28. package/dist/{chunk-OR3CIE2H.js → chunk-RG473F6Y.js} +7 -4
  29. package/dist/chunk-RHSWAXKB.cjs +118 -0
  30. package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
  31. package/dist/{chunk-5SN4U5AC.cjs → chunk-SDPGVWQJ.cjs} +5 -1
  32. package/dist/{chunk-IU5VO2I2.js → chunk-WNVFNNWN.js} +4 -4
  33. package/dist/server/handlers/a2a.cjs +7 -7
  34. package/dist/server/handlers/a2a.js +1 -1
  35. package/dist/server/handlers/agents.cjs +7 -7
  36. package/dist/server/handlers/agents.js +1 -1
  37. package/dist/server/handlers/error.cjs +2 -2
  38. package/dist/server/handlers/error.js +1 -1
  39. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  40. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  41. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  42. package/dist/server/handlers/legacyWorkflows.js +1 -0
  43. package/dist/server/handlers/logs.cjs +4 -4
  44. package/dist/server/handlers/logs.js +1 -1
  45. package/dist/server/handlers/memory.cjs +9 -9
  46. package/dist/server/handlers/memory.js +1 -1
  47. package/dist/server/handlers/network.cjs +5 -5
  48. package/dist/server/handlers/network.js +1 -1
  49. package/dist/server/handlers/telemetry.cjs +3 -3
  50. package/dist/server/handlers/telemetry.js +1 -1
  51. package/dist/server/handlers/tools.cjs +5 -5
  52. package/dist/server/handlers/tools.js +1 -1
  53. package/dist/server/handlers/utils.cjs +2 -2
  54. package/dist/server/handlers/utils.js +1 -1
  55. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  56. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  57. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  58. package/dist/server/handlers/vNextNetwork.js +211 -0
  59. package/dist/server/handlers/vector.cjs +7 -7
  60. package/dist/server/handlers/vector.js +1 -1
  61. package/dist/server/handlers/voice.cjs +8 -4
  62. package/dist/server/handlers/voice.d.cts +1 -0
  63. package/dist/server/handlers/voice.d.ts +1 -0
  64. package/dist/server/handlers/voice.js +1 -1
  65. package/dist/server/handlers/workflows.cjs +29 -13
  66. package/dist/server/handlers/workflows.d.cts +6 -2
  67. package/dist/server/handlers/workflows.d.ts +6 -2
  68. package/dist/server/handlers/workflows.js +1 -1
  69. package/dist/server/handlers.cjs +28 -28
  70. package/dist/server/handlers.d.cts +1 -1
  71. package/dist/server/handlers.d.ts +1 -1
  72. package/dist/server/handlers.js +11 -11
  73. package/package.json +12 -13
  74. package/dist/chunk-64U3UDTH.cjs +0 -13
  75. package/dist/chunk-HWZVAG3H.js +0 -49
  76. package/dist/chunk-I2B73Y4I.cjs +0 -332
  77. package/dist/chunk-M5ABIP7D.js +0 -11
  78. package/dist/chunk-MIQYDLLM.js +0 -329
  79. package/dist/chunk-OGCNNUHF.cjs +0 -54
  80. package/dist/chunk-UCTEMO2Q.cjs +0 -341
  81. package/dist/chunk-YBVOQN4M.cjs +0 -94
  82. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  83. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  84. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  85. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,341 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.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 web = require('stream/web');
8
- var di = require('@mastra/core/di');
9
-
10
- // src/server/handlers/vNextWorkflows.ts
11
- var vNextWorkflows_exports = {};
12
- chunk75ZPJI57_cjs.__export(vNextWorkflows_exports, {
13
- createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
14
- getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
15
- getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
16
- getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
17
- getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
18
- resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
19
- resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
20
- startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
21
- startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
22
- watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
23
- });
24
- async function getVNextWorkflowsHandler({ mastra }) {
25
- try {
26
- const workflows = mastra.vnext_getWorkflows({ serialized: false });
27
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
28
- acc[key] = {
29
- name: workflow.name,
30
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
31
- acc2[key2] = {
32
- id: step.id,
33
- description: step.description,
34
- inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
35
- outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
36
- resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
37
- suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
38
- };
39
- return acc2;
40
- }, {}),
41
- stepGraph: workflow.serializedStepGraph,
42
- inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
43
- outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
44
- };
45
- return acc;
46
- }, {});
47
- return _workflows;
48
- } catch (error) {
49
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
50
- }
51
- }
52
- async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
53
- try {
54
- if (!workflowId) {
55
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
56
- }
57
- const workflow = mastra.vnext_getWorkflow(workflowId);
58
- if (!workflow) {
59
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
60
- }
61
- return {
62
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
63
- acc[key] = {
64
- id: step.id,
65
- description: step.description,
66
- inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
67
- outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
68
- resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
69
- suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
70
- };
71
- return acc;
72
- }, {}),
73
- name: workflow.name,
74
- stepGraph: workflow.serializedStepGraph,
75
- inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
76
- outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
77
- };
78
- } catch (error) {
79
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
80
- }
81
- }
82
- async function getVNextWorkflowRunByIdHandler({
83
- mastra,
84
- workflowId,
85
- runId
86
- }) {
87
- try {
88
- if (!workflowId) {
89
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
90
- }
91
- if (!runId) {
92
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
93
- }
94
- const workflow = mastra.vnext_getWorkflow(workflowId);
95
- if (!workflow) {
96
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
97
- }
98
- const run = await workflow.getWorkflowRunById(runId);
99
- if (!run) {
100
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
101
- }
102
- return run;
103
- } catch (error) {
104
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
105
- }
106
- }
107
- async function createVNextWorkflowRunHandler({
108
- mastra,
109
- workflowId,
110
- runId: prevRunId
111
- }) {
112
- try {
113
- if (!workflowId) {
114
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
115
- }
116
- const workflow = mastra.vnext_getWorkflow(workflowId);
117
- if (!workflow) {
118
- throw new chunkOCWPVYNI_cjs.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 chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
124
- }
125
- }
126
- async function startAsyncVNextWorkflowHandler({
127
- mastra,
128
- runtimeContext,
129
- workflowId,
130
- runId,
131
- inputData,
132
- runtimeContextFromRequest
133
- }) {
134
- try {
135
- if (!workflowId) {
136
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
137
- }
138
- const workflow = mastra.vnext_getWorkflow(workflowId);
139
- if (!workflow) {
140
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
141
- }
142
- const finalRuntimeContext = new di.RuntimeContext([
143
- ...Array.from(runtimeContext?.entries() ?? []),
144
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
145
- ]);
146
- const _run = workflow.createRun({ runId });
147
- const result = await _run.start({
148
- inputData,
149
- runtimeContext: finalRuntimeContext
150
- });
151
- return result;
152
- } catch (error) {
153
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
154
- }
155
- }
156
- async function startVNextWorkflowRunHandler({
157
- mastra,
158
- runtimeContext,
159
- workflowId,
160
- runId,
161
- inputData,
162
- runtimeContextFromRequest
163
- }) {
164
- try {
165
- if (!workflowId) {
166
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
167
- }
168
- if (!runId) {
169
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
170
- }
171
- const workflow = mastra.vnext_getWorkflow(workflowId);
172
- const run = await workflow.getWorkflowRunById(runId);
173
- if (!run) {
174
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
175
- }
176
- const finalRuntimeContext = new di.RuntimeContext([
177
- ...Array.from(runtimeContext?.entries() ?? []),
178
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
179
- ]);
180
- const _run = workflow.createRun({ runId });
181
- void _run.start({
182
- inputData,
183
- runtimeContext: finalRuntimeContext
184
- });
185
- return { message: "Workflow run started" };
186
- } catch (e) {
187
- return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
188
- }
189
- }
190
- async function watchVNextWorkflowHandler({
191
- mastra,
192
- workflowId,
193
- runId
194
- }) {
195
- try {
196
- if (!workflowId) {
197
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
198
- }
199
- if (!runId) {
200
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
201
- }
202
- const workflow = mastra.vnext_getWorkflow(workflowId);
203
- const run = await workflow.getWorkflowRunById(runId);
204
- if (!run) {
205
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
206
- }
207
- const _run = workflow.createRun({ runId });
208
- let unwatch;
209
- let asyncRef = null;
210
- const stream = new web.ReadableStream({
211
- start(controller) {
212
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
213
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
214
- if (asyncRef) {
215
- clearImmediate(asyncRef);
216
- asyncRef = null;
217
- }
218
- asyncRef = setImmediate(async () => {
219
- const runDone = payload.workflowState.status !== "running";
220
- if (runDone) {
221
- controller.close();
222
- unwatch?.();
223
- }
224
- });
225
- });
226
- },
227
- cancel() {
228
- unwatch?.();
229
- }
230
- });
231
- return stream;
232
- } catch (error) {
233
- return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
234
- }
235
- }
236
- async function resumeAsyncVNextWorkflowHandler({
237
- mastra,
238
- workflowId,
239
- runId,
240
- body,
241
- runtimeContext,
242
- runtimeContextFromRequest
243
- }) {
244
- try {
245
- if (!workflowId) {
246
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
247
- }
248
- if (!runId) {
249
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
250
- }
251
- if (!body.step) {
252
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
253
- }
254
- const workflow = mastra.vnext_getWorkflow(workflowId);
255
- const run = await workflow.getWorkflowRunById(runId);
256
- if (!run) {
257
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
258
- }
259
- const finalRuntimeContext = new di.RuntimeContext([
260
- ...Array.from(runtimeContext?.entries() ?? []),
261
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
262
- ]);
263
- const _run = workflow.createRun({ runId });
264
- const result = await _run.resume({
265
- step: body.step,
266
- resumeData: body.resumeData,
267
- runtimeContext: finalRuntimeContext
268
- });
269
- return result;
270
- } catch (error) {
271
- return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
272
- }
273
- }
274
- async function resumeVNextWorkflowHandler({
275
- mastra,
276
- workflowId,
277
- runId,
278
- body,
279
- runtimeContext
280
- }) {
281
- try {
282
- if (!workflowId) {
283
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
284
- }
285
- if (!runId) {
286
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
287
- }
288
- if (!body.step) {
289
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
290
- }
291
- const workflow = mastra.vnext_getWorkflow(workflowId);
292
- const run = await workflow.getWorkflowRunById(runId);
293
- if (!run) {
294
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
295
- }
296
- const _run = workflow.createRun({ runId });
297
- void _run.resume({
298
- step: body.step,
299
- resumeData: body.resumeData,
300
- runtimeContext
301
- });
302
- return { message: "Workflow run resumed" };
303
- } catch (error) {
304
- return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
305
- }
306
- }
307
- async function getVNextWorkflowRunsHandler({
308
- mastra,
309
- workflowId,
310
- fromDate,
311
- toDate,
312
- limit,
313
- offset,
314
- resourceId
315
- }) {
316
- try {
317
- if (!workflowId) {
318
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
319
- }
320
- const workflow = mastra.vnext_getWorkflow(workflowId);
321
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
322
- runs: [],
323
- total: 0
324
- };
325
- return workflowRuns;
326
- } catch (error) {
327
- return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
328
- }
329
- }
330
-
331
- exports.createVNextWorkflowRunHandler = createVNextWorkflowRunHandler;
332
- exports.getVNextWorkflowByIdHandler = getVNextWorkflowByIdHandler;
333
- exports.getVNextWorkflowRunByIdHandler = getVNextWorkflowRunByIdHandler;
334
- exports.getVNextWorkflowRunsHandler = getVNextWorkflowRunsHandler;
335
- exports.getVNextWorkflowsHandler = getVNextWorkflowsHandler;
336
- exports.resumeAsyncVNextWorkflowHandler = resumeAsyncVNextWorkflowHandler;
337
- exports.resumeVNextWorkflowHandler = resumeVNextWorkflowHandler;
338
- exports.startAsyncVNextWorkflowHandler = startAsyncVNextWorkflowHandler;
339
- exports.startVNextWorkflowRunHandler = startVNextWorkflowRunHandler;
340
- exports.vNextWorkflows_exports = vNextWorkflows_exports;
341
- exports.watchVNextWorkflowHandler = watchVNextWorkflowHandler;
@@ -1,94 +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
- getSpeakersHandler: () => getSpeakersHandler,
14
- transcribeSpeechHandler: () => transcribeSpeechHandler
15
- });
16
- async function getSpeakersHandler({ mastra, agentId }) {
17
- try {
18
- if (!agentId) {
19
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
20
- }
21
- const agent = mastra.getAgent(agentId);
22
- if (!agent) {
23
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
24
- }
25
- if (!agent.voice) {
26
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
27
- }
28
- const speakers = await agent.voice.getSpeakers();
29
- return speakers;
30
- } catch (error) {
31
- return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
32
- }
33
- }
34
- async function generateSpeechHandler({
35
- mastra,
36
- agentId,
37
- body
38
- }) {
39
- try {
40
- if (!agentId) {
41
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
42
- }
43
- chunk57CJTIPW_cjs.validateBody({
44
- text: body?.text
45
- });
46
- const agent = mastra.getAgent(agentId);
47
- if (!agent) {
48
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
49
- }
50
- if (!agent.voice) {
51
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
52
- }
53
- const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
54
- if (!audioStream) {
55
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
56
- }
57
- return audioStream;
58
- } catch (error) {
59
- return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
60
- }
61
- }
62
- async function transcribeSpeechHandler({
63
- mastra,
64
- agentId,
65
- body
66
- }) {
67
- try {
68
- if (!agentId) {
69
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
70
- }
71
- if (!body?.audioData) {
72
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
73
- }
74
- const agent = mastra.getAgent(agentId);
75
- if (!agent) {
76
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
77
- }
78
- if (!agent.voice) {
79
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
80
- }
81
- const audioStream = new stream.Readable();
82
- audioStream.push(body.audioData);
83
- audioStream.push(null);
84
- const text = await agent.voice.listen(audioStream, body.options);
85
- return { text };
86
- } catch (error) {
87
- return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
88
- }
89
- }
90
-
91
- exports.generateSpeechHandler = generateSpeechHandler;
92
- exports.getSpeakersHandler = getSpeakersHandler;
93
- exports.transcribeSpeechHandler = transcribeSpeechHandler;
94
- exports.voice_exports = voice_exports;
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkUCTEMO2Q_cjs = require('../../chunk-UCTEMO2Q.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "createVNextWorkflowRunHandler", {
8
- enumerable: true,
9
- get: function () { return chunkUCTEMO2Q_cjs.createVNextWorkflowRunHandler; }
10
- });
11
- Object.defineProperty(exports, "getVNextWorkflowByIdHandler", {
12
- enumerable: true,
13
- get: function () { return chunkUCTEMO2Q_cjs.getVNextWorkflowByIdHandler; }
14
- });
15
- Object.defineProperty(exports, "getVNextWorkflowRunByIdHandler", {
16
- enumerable: true,
17
- get: function () { return chunkUCTEMO2Q_cjs.getVNextWorkflowRunByIdHandler; }
18
- });
19
- Object.defineProperty(exports, "getVNextWorkflowRunsHandler", {
20
- enumerable: true,
21
- get: function () { return chunkUCTEMO2Q_cjs.getVNextWorkflowRunsHandler; }
22
- });
23
- Object.defineProperty(exports, "getVNextWorkflowsHandler", {
24
- enumerable: true,
25
- get: function () { return chunkUCTEMO2Q_cjs.getVNextWorkflowsHandler; }
26
- });
27
- Object.defineProperty(exports, "resumeAsyncVNextWorkflowHandler", {
28
- enumerable: true,
29
- get: function () { return chunkUCTEMO2Q_cjs.resumeAsyncVNextWorkflowHandler; }
30
- });
31
- Object.defineProperty(exports, "resumeVNextWorkflowHandler", {
32
- enumerable: true,
33
- get: function () { return chunkUCTEMO2Q_cjs.resumeVNextWorkflowHandler; }
34
- });
35
- Object.defineProperty(exports, "startAsyncVNextWorkflowHandler", {
36
- enumerable: true,
37
- get: function () { return chunkUCTEMO2Q_cjs.startAsyncVNextWorkflowHandler; }
38
- });
39
- Object.defineProperty(exports, "startVNextWorkflowRunHandler", {
40
- enumerable: true,
41
- get: function () { return chunkUCTEMO2Q_cjs.startVNextWorkflowRunHandler; }
42
- });
43
- Object.defineProperty(exports, "watchVNextWorkflowHandler", {
44
- enumerable: true,
45
- get: function () { return chunkUCTEMO2Q_cjs.watchVNextWorkflowHandler; }
46
- });
@@ -1,10 +0,0 @@
1
- export { getVNextWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getVNextWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getVNextWorkflowRunByIdHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { createVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { startAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { startVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
7
- export { watchVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
8
- export { resumeAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
9
- export { resumeVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
10
- export { getVNextWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,10 +0,0 @@
1
- export { getVNextWorkflowsHandler } from '../../_tsup-dts-rollup.js';
2
- export { getVNextWorkflowByIdHandler } from '../../_tsup-dts-rollup.js';
3
- export { getVNextWorkflowRunByIdHandler } from '../../_tsup-dts-rollup.js';
4
- export { createVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
5
- export { startAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.js';
6
- export { startVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
7
- export { watchVNextWorkflowHandler } from '../../_tsup-dts-rollup.js';
8
- export { resumeAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.js';
9
- export { resumeVNextWorkflowHandler } from '../../_tsup-dts-rollup.js';
10
- export { getVNextWorkflowRunsHandler } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunByIdHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, watchVNextWorkflowHandler } from '../../chunk-MIQYDLLM.js';