@mastra/server 0.10.12-alpha.1 → 0.10.13

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 (99) hide show
  1. package/package.json +3 -3
  2. package/dist/_tsup-dts-rollup.d.cts +0 -1078
  3. package/dist/_tsup-dts-rollup.d.ts +0 -1078
  4. package/dist/chunk-2KZFMI6P.cjs +0 -37
  5. package/dist/chunk-2SLFAFTR.cjs +0 -148
  6. package/dist/chunk-4D66QEKC.js +0 -81
  7. package/dist/chunk-5PQQ42EZ.js +0 -320
  8. package/dist/chunk-75ZPJI57.cjs +0 -9
  9. package/dist/chunk-7TP2LX5L.cjs +0 -129
  10. package/dist/chunk-B2PAS2IB.cjs +0 -514
  11. package/dist/chunk-BK4XT6EG.js +0 -270
  12. package/dist/chunk-CCGRCYWJ.cjs +0 -18
  13. package/dist/chunk-CRCR3ZUK.js +0 -142
  14. package/dist/chunk-DN7K6FJK.cjs +0 -251
  15. package/dist/chunk-FRVBFMO2.cjs +0 -128
  16. package/dist/chunk-G7KH752Y.cjs +0 -145
  17. package/dist/chunk-GHC4YV6R.js +0 -504
  18. package/dist/chunk-H7DMHBKY.js +0 -498
  19. package/dist/chunk-JMLYCXMK.cjs +0 -332
  20. package/dist/chunk-KHZKYUNR.js +0 -112
  21. package/dist/chunk-LCM566I4.js +0 -35
  22. package/dist/chunk-LF7P5PLR.js +0 -14
  23. package/dist/chunk-LI436ITD.cjs +0 -2042
  24. package/dist/chunk-LRCAAFUA.js +0 -122
  25. package/dist/chunk-LZ3VJXSO.cjs +0 -278
  26. package/dist/chunk-MEGCYGBU.js +0 -2039
  27. package/dist/chunk-MKLYEKEF.js +0 -241
  28. package/dist/chunk-MLKGABMK.js +0 -7
  29. package/dist/chunk-PZQDCRPV.cjs +0 -16
  30. package/dist/chunk-QGX47B5D.cjs +0 -86
  31. package/dist/chunk-RG473F6Y.js +0 -141
  32. package/dist/chunk-RHSWAXKB.cjs +0 -118
  33. package/dist/chunk-RSEO4XPX.js +0 -16
  34. package/dist/chunk-SDPGVWQJ.cjs +0 -512
  35. package/dist/chunk-WNVFNNWN.js +0 -121
  36. package/dist/index.cjs +0 -2
  37. package/dist/index.d.cts +0 -1
  38. package/dist/index.d.ts +0 -1
  39. package/dist/index.js +0 -1
  40. package/dist/server/handlers/a2a.cjs +0 -30
  41. package/dist/server/handlers/a2a.d.cts +0 -6
  42. package/dist/server/handlers/a2a.d.ts +0 -6
  43. package/dist/server/handlers/a2a.js +0 -1
  44. package/dist/server/handlers/agents.cjs +0 -30
  45. package/dist/server/handlers/agents.d.cts +0 -6
  46. package/dist/server/handlers/agents.d.ts +0 -6
  47. package/dist/server/handlers/agents.js +0 -1
  48. package/dist/server/handlers/error.cjs +0 -10
  49. package/dist/server/handlers/error.d.cts +0 -1
  50. package/dist/server/handlers/error.d.ts +0 -1
  51. package/dist/server/handlers/error.js +0 -1
  52. package/dist/server/handlers/legacyWorkflows.cjs +0 -46
  53. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  54. package/dist/server/handlers/legacyWorkflows.d.ts +0 -10
  55. package/dist/server/handlers/legacyWorkflows.js +0 -1
  56. package/dist/server/handlers/logs.cjs +0 -18
  57. package/dist/server/handlers/logs.d.cts +0 -3
  58. package/dist/server/handlers/logs.d.ts +0 -3
  59. package/dist/server/handlers/logs.js +0 -1
  60. package/dist/server/handlers/memory.cjs +0 -38
  61. package/dist/server/handlers/memory.d.cts +0 -8
  62. package/dist/server/handlers/memory.d.ts +0 -8
  63. package/dist/server/handlers/memory.js +0 -1
  64. package/dist/server/handlers/network.cjs +0 -22
  65. package/dist/server/handlers/network.d.cts +0 -4
  66. package/dist/server/handlers/network.d.ts +0 -4
  67. package/dist/server/handlers/network.js +0 -1
  68. package/dist/server/handlers/telemetry.cjs +0 -14
  69. package/dist/server/handlers/telemetry.d.cts +0 -2
  70. package/dist/server/handlers/telemetry.d.ts +0 -2
  71. package/dist/server/handlers/telemetry.js +0 -1
  72. package/dist/server/handlers/tools.cjs +0 -22
  73. package/dist/server/handlers/tools.d.cts +0 -4
  74. package/dist/server/handlers/tools.d.ts +0 -4
  75. package/dist/server/handlers/tools.js +0 -1
  76. package/dist/server/handlers/utils.cjs +0 -10
  77. package/dist/server/handlers/utils.d.cts +0 -1
  78. package/dist/server/handlers/utils.d.ts +0 -1
  79. package/dist/server/handlers/utils.js +0 -1
  80. package/dist/server/handlers/vNextNetwork.cjs +0 -218
  81. package/dist/server/handlers/vNextNetwork.d.cts +0 -6
  82. package/dist/server/handlers/vNextNetwork.d.ts +0 -6
  83. package/dist/server/handlers/vNextNetwork.js +0 -211
  84. package/dist/server/handlers/vector.cjs +0 -30
  85. package/dist/server/handlers/vector.d.cts +0 -6
  86. package/dist/server/handlers/vector.d.ts +0 -6
  87. package/dist/server/handlers/vector.js +0 -1
  88. package/dist/server/handlers/voice.cjs +0 -22
  89. package/dist/server/handlers/voice.d.cts +0 -4
  90. package/dist/server/handlers/voice.d.ts +0 -4
  91. package/dist/server/handlers/voice.js +0 -1
  92. package/dist/server/handlers/workflows.cjs +0 -62
  93. package/dist/server/handlers/workflows.d.cts +0 -14
  94. package/dist/server/handlers/workflows.d.ts +0 -14
  95. package/dist/server/handlers/workflows.js +0 -1
  96. package/dist/server/handlers.cjs +0 -60
  97. package/dist/server/handlers.d.cts +0 -11
  98. package/dist/server/handlers.d.ts +0 -11
  99. package/dist/server/handlers.js +0 -11
@@ -1,332 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
4
- var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
- var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
6
- var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
- var web = require('stream/web');
8
-
9
- // src/server/handlers/legacyWorkflows.ts
10
- var legacyWorkflows_exports = {};
11
- chunk75ZPJI57_cjs.__export(legacyWorkflows_exports, {
12
- createLegacyWorkflowRunHandler: () => createLegacyWorkflowRunHandler,
13
- getLegacyWorkflowByIdHandler: () => getLegacyWorkflowByIdHandler,
14
- getLegacyWorkflowRunHandler: () => getLegacyWorkflowRunHandler,
15
- getLegacyWorkflowRunsHandler: () => getLegacyWorkflowRunsHandler,
16
- getLegacyWorkflowsHandler: () => getLegacyWorkflowsHandler,
17
- resumeAsyncLegacyWorkflowHandler: () => resumeAsyncLegacyWorkflowHandler,
18
- resumeLegacyWorkflowHandler: () => resumeLegacyWorkflowHandler,
19
- startAsyncLegacyWorkflowHandler: () => startAsyncLegacyWorkflowHandler,
20
- startLegacyWorkflowRunHandler: () => startLegacyWorkflowRunHandler,
21
- watchLegacyWorkflowHandler: () => watchLegacyWorkflowHandler
22
- });
23
- async function getLegacyWorkflowsHandler({ mastra }) {
24
- try {
25
- const workflows = mastra.legacy_getWorkflows({ serialized: false });
26
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
27
- if (workflow.isNested) return acc;
28
- acc[key] = {
29
- stepGraph: workflow.stepGraph,
30
- stepSubscriberGraph: workflow.stepSubscriberGraph,
31
- serializedStepGraph: workflow.serializedStepGraph,
32
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
33
- name: workflow.name,
34
- triggerSchema: workflow.triggerSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.triggerSchema)) : void 0,
35
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
36
- const _step = step;
37
- acc2[key2] = {
38
- id: _step.id,
39
- description: _step.description,
40
- workflowId: _step.workflowId,
41
- inputSchema: _step.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_step.inputSchema)) : void 0,
42
- outputSchema: _step.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_step.outputSchema)) : void 0
43
- };
44
- return acc2;
45
- }, {})
46
- };
47
- return acc;
48
- }, {});
49
- return _workflows;
50
- } catch (error) {
51
- return chunkPZQDCRPV_cjs.handleError(error, "error getting workflows");
52
- }
53
- }
54
- async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
55
- try {
56
- if (!workflowId) {
57
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
58
- }
59
- const workflow = mastra.legacy_getWorkflow(workflowId);
60
- if (!workflow) {
61
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
62
- }
63
- return {
64
- stepGraph: workflow.stepGraph,
65
- stepSubscriberGraph: workflow.stepSubscriberGraph,
66
- serializedStepGraph: workflow.serializedStepGraph,
67
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
68
- name: workflow.name,
69
- triggerSchema: workflow.triggerSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.triggerSchema)) : void 0,
70
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
71
- const _step = step;
72
- acc[key] = {
73
- id: _step.id,
74
- description: _step.description,
75
- workflowId: _step.workflowId,
76
- inputSchema: _step.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_step.inputSchema)) : void 0,
77
- outputSchema: _step.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_step.outputSchema)) : void 0
78
- };
79
- return acc;
80
- }, {})
81
- };
82
- } catch (error) {
83
- return chunkPZQDCRPV_cjs.handleError(error, "error getting workflow by id");
84
- }
85
- }
86
- async function startAsyncLegacyWorkflowHandler({
87
- mastra,
88
- runtimeContext,
89
- workflowId,
90
- runId,
91
- triggerData
92
- }) {
93
- try {
94
- if (!workflowId) {
95
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
96
- }
97
- const workflow = mastra.legacy_getWorkflow(workflowId);
98
- if (!workflow) {
99
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
100
- }
101
- if (!runId) {
102
- const newRun = workflow.createRun();
103
- const result2 = await newRun.start({
104
- triggerData,
105
- runtimeContext
106
- });
107
- return result2;
108
- }
109
- const run = workflow.getMemoryRun(runId);
110
- if (!run) {
111
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
112
- }
113
- const result = await run.start({
114
- triggerData,
115
- runtimeContext
116
- });
117
- return result;
118
- } catch (error) {
119
- return chunkPZQDCRPV_cjs.handleError(error, "error starting workflow");
120
- }
121
- }
122
- async function getLegacyWorkflowRunHandler({
123
- mastra,
124
- workflowId,
125
- runId
126
- }) {
127
- try {
128
- if (!workflowId) {
129
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
130
- }
131
- if (!runId) {
132
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Run ID is required" });
133
- }
134
- const workflow = mastra.legacy_getWorkflow(workflowId);
135
- if (!workflow) {
136
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
137
- }
138
- const run = await workflow.getRun(runId);
139
- if (!run) {
140
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
141
- }
142
- return run;
143
- } catch (error) {
144
- return chunkPZQDCRPV_cjs.handleError(error, "error getting workflow run");
145
- }
146
- }
147
- async function createLegacyWorkflowRunHandler({
148
- mastra,
149
- workflowId,
150
- runId: prevRunId
151
- }) {
152
- try {
153
- if (!workflowId) {
154
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
155
- }
156
- const workflow = mastra.legacy_getWorkflow(workflowId);
157
- if (!workflow) {
158
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
159
- }
160
- const newRun = workflow.createRun({ runId: prevRunId });
161
- return { runId: newRun.runId };
162
- } catch (error) {
163
- return chunkPZQDCRPV_cjs.handleError(error, "error creating workflow run");
164
- }
165
- }
166
- async function startLegacyWorkflowRunHandler({
167
- mastra,
168
- runtimeContext,
169
- workflowId,
170
- runId,
171
- triggerData
172
- }) {
173
- try {
174
- if (!workflowId) {
175
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
176
- }
177
- if (!runId) {
178
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to start run" });
179
- }
180
- const workflow = mastra.legacy_getWorkflow(workflowId);
181
- const run = workflow.getMemoryRun(runId);
182
- if (!run) {
183
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
184
- }
185
- void run.start({
186
- triggerData,
187
- runtimeContext
188
- });
189
- return { message: "Workflow run started" };
190
- } catch (e) {
191
- return chunkPZQDCRPV_cjs.handleError(e, "Error starting workflow run");
192
- }
193
- }
194
- async function watchLegacyWorkflowHandler({
195
- mastra,
196
- workflowId,
197
- runId
198
- }) {
199
- try {
200
- if (!workflowId) {
201
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
202
- }
203
- if (!runId) {
204
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to watch workflow" });
205
- }
206
- const workflow = mastra.legacy_getWorkflow(workflowId);
207
- const run = workflow.getMemoryRun(runId);
208
- if (!run) {
209
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
210
- }
211
- let unwatch;
212
- let asyncRef = null;
213
- const stream = new web.ReadableStream({
214
- start(controller) {
215
- unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
216
- const activePathsObj = Object.fromEntries(activePaths);
217
- controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
218
- if (asyncRef) {
219
- clearImmediate(asyncRef);
220
- asyncRef = null;
221
- }
222
- asyncRef = setImmediate(() => {
223
- const runDone = Object.values(activePathsObj).every((value) => value.status !== "executing");
224
- if (runDone) {
225
- controller.close();
226
- unwatch?.();
227
- }
228
- });
229
- });
230
- },
231
- cancel() {
232
- unwatch?.();
233
- }
234
- });
235
- return stream;
236
- } catch (error) {
237
- return chunkPZQDCRPV_cjs.handleError(error, "Error watching workflow");
238
- }
239
- }
240
- async function resumeAsyncLegacyWorkflowHandler({
241
- mastra,
242
- workflowId,
243
- runId,
244
- body,
245
- runtimeContext
246
- }) {
247
- try {
248
- if (!workflowId) {
249
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
250
- }
251
- if (!runId) {
252
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to resume workflow" });
253
- }
254
- const workflow = mastra.legacy_getWorkflow(workflowId);
255
- const run = workflow.getMemoryRun(runId);
256
- if (!run) {
257
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
258
- }
259
- const result = await run.resume({
260
- stepId: body.stepId,
261
- context: body.context,
262
- runtimeContext
263
- });
264
- return result;
265
- } catch (error) {
266
- return chunkPZQDCRPV_cjs.handleError(error, "Error resuming workflow step");
267
- }
268
- }
269
- async function resumeLegacyWorkflowHandler({
270
- mastra,
271
- workflowId,
272
- runId,
273
- body,
274
- runtimeContext
275
- }) {
276
- try {
277
- if (!workflowId) {
278
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
279
- }
280
- if (!runId) {
281
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to resume workflow" });
282
- }
283
- const workflow = mastra.legacy_getWorkflow(workflowId);
284
- const run = workflow.getMemoryRun(runId);
285
- if (!run) {
286
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
287
- }
288
- void run.resume({
289
- stepId: body.stepId,
290
- context: body.context,
291
- runtimeContext
292
- });
293
- return { message: "Workflow run resumed" };
294
- } catch (error) {
295
- return chunkPZQDCRPV_cjs.handleError(error, "Error resuming workflow");
296
- }
297
- }
298
- async function getLegacyWorkflowRunsHandler({
299
- mastra,
300
- workflowId,
301
- fromDate,
302
- toDate,
303
- limit,
304
- offset,
305
- resourceId
306
- }) {
307
- try {
308
- if (!workflowId) {
309
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
310
- }
311
- const workflow = mastra.legacy_getWorkflow(workflowId);
312
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
313
- runs: [],
314
- total: 0
315
- };
316
- return workflowRuns;
317
- } catch (error) {
318
- return chunkPZQDCRPV_cjs.handleError(error, "Error getting workflow runs");
319
- }
320
- }
321
-
322
- exports.createLegacyWorkflowRunHandler = createLegacyWorkflowRunHandler;
323
- exports.getLegacyWorkflowByIdHandler = getLegacyWorkflowByIdHandler;
324
- exports.getLegacyWorkflowRunHandler = getLegacyWorkflowRunHandler;
325
- exports.getLegacyWorkflowRunsHandler = getLegacyWorkflowRunsHandler;
326
- exports.getLegacyWorkflowsHandler = getLegacyWorkflowsHandler;
327
- exports.legacyWorkflows_exports = legacyWorkflows_exports;
328
- exports.resumeAsyncLegacyWorkflowHandler = resumeAsyncLegacyWorkflowHandler;
329
- exports.resumeLegacyWorkflowHandler = resumeLegacyWorkflowHandler;
330
- exports.startAsyncLegacyWorkflowHandler = startAsyncLegacyWorkflowHandler;
331
- exports.startLegacyWorkflowRunHandler = startLegacyWorkflowRunHandler;
332
- exports.watchLegacyWorkflowHandler = watchLegacyWorkflowHandler;
@@ -1,112 +0,0 @@
1
- import { validateBody } from './chunk-RSEO4XPX.js';
2
- import { handleError } from './chunk-LF7P5PLR.js';
3
- import { HTTPException } from './chunk-LCM566I4.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
- getListenerHandler: () => getListenerHandler,
12
- getSpeakersHandler: () => getSpeakersHandler,
13
- transcribeSpeechHandler: () => transcribeSpeechHandler
14
- });
15
- async function getSpeakersHandler({ mastra, agentId }) {
16
- try {
17
- if (!agentId) {
18
- throw new HTTPException(400, { message: "Agent ID is required" });
19
- }
20
- const agent = mastra.getAgent(agentId);
21
- if (!agent) {
22
- throw new HTTPException(404, { message: "Agent not found" });
23
- }
24
- const voice = await agent.getVoice();
25
- if (!voice) {
26
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
27
- }
28
- const speakers = await voice.getSpeakers();
29
- return speakers;
30
- } catch (error) {
31
- return 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 HTTPException(400, { message: "Agent ID is required" });
42
- }
43
- validateBody({
44
- text: body?.text
45
- });
46
- const agent = mastra.getAgent(agentId);
47
- if (!agent) {
48
- throw new HTTPException(404, { message: "Agent not found" });
49
- }
50
- const voice = await agent.getVoice();
51
- if (!voice) {
52
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
53
- }
54
- const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
55
- if (!audioStream) {
56
- throw new HTTPException(500, { message: "Failed to generate speech" });
57
- }
58
- return audioStream;
59
- } catch (error) {
60
- return 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 HTTPException(400, { message: "Agent ID is required" });
71
- }
72
- if (!body?.audioData) {
73
- throw new HTTPException(400, { message: "Audio data is required" });
74
- }
75
- const agent = mastra.getAgent(agentId);
76
- if (!agent) {
77
- throw new HTTPException(404, { message: "Agent not found" });
78
- }
79
- const voice = await agent.getVoice();
80
- if (!voice) {
81
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
82
- }
83
- const audioStream = new Readable();
84
- audioStream.push(body.audioData);
85
- audioStream.push(null);
86
- const text = await voice.listen(audioStream, body.options);
87
- return { text };
88
- } catch (error) {
89
- return handleError(error, "Error transcribing speech");
90
- }
91
- }
92
- async function getListenerHandler({ mastra, agentId }) {
93
- try {
94
- if (!agentId) {
95
- throw new HTTPException(400, { message: "Agent ID is required" });
96
- }
97
- const agent = mastra.getAgent(agentId);
98
- if (!agent) {
99
- throw new HTTPException(404, { message: "Agent not found" });
100
- }
101
- const voice = await agent.getVoice();
102
- if (!voice) {
103
- throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
104
- }
105
- const listeners = await voice.getListener();
106
- return listeners;
107
- } catch (error) {
108
- return handleError(error, "Error getting listeners");
109
- }
110
- }
111
-
112
- export { generateSpeechHandler, getListenerHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
@@ -1,35 +0,0 @@
1
- // src/server/http-exception.ts
2
- var HTTPException = class extends Error {
3
- res;
4
- status;
5
- /**
6
- * Creates an instance of `HTTPException`.
7
- * @param status - HTTP status code for the exception. Defaults to 500.
8
- * @param options - Additional options for the exception.
9
- */
10
- constructor(status = 500, options) {
11
- super(options?.message, { cause: options?.cause });
12
- this.res = options?.res;
13
- this.status = status;
14
- this.stack = options?.stack || this.stack;
15
- }
16
- /**
17
- * Returns the response object associated with the exception.
18
- * If a response object is not provided, a new response is created with the error message and status code.
19
- * @returns The response object.
20
- */
21
- getResponse() {
22
- if (this.res) {
23
- const newResponse = new Response(this.res.body, {
24
- status: this.status,
25
- headers: this.res.headers
26
- });
27
- return newResponse;
28
- }
29
- return new Response(this.message, {
30
- status: this.status
31
- });
32
- }
33
- };
34
-
35
- export { HTTPException };
@@ -1,14 +0,0 @@
1
- import { HTTPException } from './chunk-LCM566I4.js';
2
-
3
- // src/server/handlers/error.ts
4
- function handleError(error, defaultMessage) {
5
- const apiError = error;
6
- const apiErrorStatus = apiError.status || apiError.details?.status || 500;
7
- throw new HTTPException(apiErrorStatus, {
8
- message: apiError.message || defaultMessage,
9
- stack: apiError.stack,
10
- cause: apiError.cause
11
- });
12
- }
13
-
14
- export { handleError };