@mastra/server 0.10.9-alpha.0 → 0.10.10-alpha.0

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 (57) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +2 -0
  2. package/dist/_tsup-dts-rollup.d.ts +2 -0
  3. package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
  4. package/dist/{chunk-DPRB3R7Y.cjs → chunk-2SLFAFTR.cjs} +12 -12
  5. package/dist/{chunk-BOXE6WSV.js → chunk-4D66QEKC.js} +2 -2
  6. package/dist/{chunk-7GQJAMTA.js → chunk-5PQQ42EZ.js} +2 -2
  7. package/dist/{chunk-TVBPFPTN.cjs → chunk-7TP2LX5L.cjs} +16 -16
  8. package/dist/{chunk-4QBIUKVY.js → chunk-BK4XT6EG.js} +3 -3
  9. package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  10. package/dist/{chunk-VMXLEF54.js → chunk-CRCR3ZUK.js} +3 -3
  11. package/dist/{chunk-3DKDT264.cjs → chunk-DN7K6FJK.cjs} +34 -34
  12. package/dist/{chunk-FGGMQCPP.cjs → chunk-FRVBFMO2.cjs} +15 -15
  13. package/dist/{chunk-ULFULEW4.cjs → chunk-G7KH752Y.cjs} +5 -5
  14. package/dist/{chunk-Z5TH5F35.js → chunk-I2PBVVNV.js} +2 -2
  15. package/dist/{chunk-TGZIR6AK.cjs → chunk-JMLYCXMK.cjs} +36 -36
  16. package/dist/{chunk-G37NVEDX.js → chunk-KHZKYUNR.js} +3 -3
  17. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  18. package/dist/{chunk-QDOJJCS4.js → chunk-LF7P5PLR.js} +4 -2
  19. package/dist/{chunk-DFJUGWNU.js → chunk-LRCAAFUA.js} +3 -3
  20. package/dist/{chunk-BWHGBV3K.cjs → chunk-LZ3VJXSO.cjs} +14 -14
  21. package/dist/{chunk-LTJNMM2Y.js → chunk-MKLYEKEF.js} +3 -3
  22. package/dist/{chunk-MTR2B27E.cjs → chunk-PZQDCRPV.cjs} +5 -3
  23. package/dist/{chunk-CNVDCLSY.cjs → chunk-QGX47B5D.cjs} +7 -7
  24. package/dist/{chunk-BP24Z4WG.js → chunk-RG473F6Y.js} +2 -2
  25. package/dist/{chunk-L3N7ST2Z.cjs → chunk-RHSWAXKB.cjs} +22 -22
  26. package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
  27. package/dist/{chunk-7524QH7G.cjs → chunk-SAI3WQ7Z.cjs} +58 -58
  28. package/dist/{chunk-FVMGZKFD.js → chunk-WNVFNNWN.js} +2 -2
  29. package/dist/server/handlers/agents.cjs +7 -7
  30. package/dist/server/handlers/agents.js +1 -1
  31. package/dist/server/handlers/error.cjs +2 -2
  32. package/dist/server/handlers/error.js +1 -1
  33. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  34. package/dist/server/handlers/legacyWorkflows.js +1 -1
  35. package/dist/server/handlers/logs.cjs +4 -4
  36. package/dist/server/handlers/logs.js +1 -1
  37. package/dist/server/handlers/memory.cjs +9 -9
  38. package/dist/server/handlers/memory.js +1 -1
  39. package/dist/server/handlers/network.cjs +5 -5
  40. package/dist/server/handlers/network.js +1 -1
  41. package/dist/server/handlers/telemetry.cjs +3 -3
  42. package/dist/server/handlers/telemetry.js +1 -1
  43. package/dist/server/handlers/tools.cjs +5 -5
  44. package/dist/server/handlers/tools.js +1 -1
  45. package/dist/server/handlers/utils.cjs +2 -2
  46. package/dist/server/handlers/utils.js +1 -1
  47. package/dist/server/handlers/vNextNetwork.cjs +18 -18
  48. package/dist/server/handlers/vNextNetwork.js +3 -3
  49. package/dist/server/handlers/vector.cjs +7 -7
  50. package/dist/server/handlers/vector.js +1 -1
  51. package/dist/server/handlers/voice.cjs +5 -5
  52. package/dist/server/handlers/voice.js +1 -1
  53. package/dist/server/handlers/workflows.cjs +14 -14
  54. package/dist/server/handlers/workflows.js +1 -1
  55. package/dist/server/handlers.cjs +20 -20
  56. package/dist/server/handlers.js +10 -10
  57. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
4
- var chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.cjs');
5
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
4
+ var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
+ var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
6
6
  var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
7
  var web = require('stream/web');
8
8
 
@@ -48,17 +48,17 @@ async function getLegacyWorkflowsHandler({ mastra }) {
48
48
  }, {});
49
49
  return _workflows;
50
50
  } catch (error) {
51
- return chunkMTR2B27E_cjs.handleError(error, "error getting workflows");
51
+ return chunkPZQDCRPV_cjs.handleError(error, "error getting workflows");
52
52
  }
53
53
  }
54
54
  async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
55
55
  try {
56
56
  if (!workflowId) {
57
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
57
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
58
58
  }
59
59
  const workflow = mastra.legacy_getWorkflow(workflowId);
60
60
  if (!workflow) {
61
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
61
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
62
62
  }
63
63
  return {
64
64
  stepGraph: workflow.stepGraph,
@@ -80,7 +80,7 @@ async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
80
80
  }, {})
81
81
  };
82
82
  } catch (error) {
83
- return chunkMTR2B27E_cjs.handleError(error, "error getting workflow by id");
83
+ return chunkPZQDCRPV_cjs.handleError(error, "error getting workflow by id");
84
84
  }
85
85
  }
86
86
  async function startAsyncLegacyWorkflowHandler({
@@ -92,11 +92,11 @@ async function startAsyncLegacyWorkflowHandler({
92
92
  }) {
93
93
  try {
94
94
  if (!workflowId) {
95
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
95
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
96
96
  }
97
97
  const workflow = mastra.legacy_getWorkflow(workflowId);
98
98
  if (!workflow) {
99
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
99
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
100
100
  }
101
101
  if (!runId) {
102
102
  const newRun = workflow.createRun();
@@ -108,7 +108,7 @@ async function startAsyncLegacyWorkflowHandler({
108
108
  }
109
109
  const run = workflow.getMemoryRun(runId);
110
110
  if (!run) {
111
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
111
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
112
112
  }
113
113
  const result = await run.start({
114
114
  triggerData,
@@ -116,7 +116,7 @@ async function startAsyncLegacyWorkflowHandler({
116
116
  });
117
117
  return result;
118
118
  } catch (error) {
119
- return chunkMTR2B27E_cjs.handleError(error, "error starting workflow");
119
+ return chunkPZQDCRPV_cjs.handleError(error, "error starting workflow");
120
120
  }
121
121
  }
122
122
  async function getLegacyWorkflowRunHandler({
@@ -126,22 +126,22 @@ async function getLegacyWorkflowRunHandler({
126
126
  }) {
127
127
  try {
128
128
  if (!workflowId) {
129
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
129
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
130
130
  }
131
131
  if (!runId) {
132
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
132
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Run ID is required" });
133
133
  }
134
134
  const workflow = mastra.legacy_getWorkflow(workflowId);
135
135
  if (!workflow) {
136
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
136
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
137
137
  }
138
138
  const run = await workflow.getRun(runId);
139
139
  if (!run) {
140
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
140
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
141
141
  }
142
142
  return run;
143
143
  } catch (error) {
144
- return chunkMTR2B27E_cjs.handleError(error, "error getting workflow run");
144
+ return chunkPZQDCRPV_cjs.handleError(error, "error getting workflow run");
145
145
  }
146
146
  }
147
147
  async function createLegacyWorkflowRunHandler({
@@ -151,16 +151,16 @@ async function createLegacyWorkflowRunHandler({
151
151
  }) {
152
152
  try {
153
153
  if (!workflowId) {
154
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
154
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
155
155
  }
156
156
  const workflow = mastra.legacy_getWorkflow(workflowId);
157
157
  if (!workflow) {
158
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
158
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
159
159
  }
160
160
  const newRun = workflow.createRun({ runId: prevRunId });
161
161
  return { runId: newRun.runId };
162
162
  } catch (error) {
163
- return chunkMTR2B27E_cjs.handleError(error, "error creating workflow run");
163
+ return chunkPZQDCRPV_cjs.handleError(error, "error creating workflow run");
164
164
  }
165
165
  }
166
166
  async function startLegacyWorkflowRunHandler({
@@ -172,15 +172,15 @@ async function startLegacyWorkflowRunHandler({
172
172
  }) {
173
173
  try {
174
174
  if (!workflowId) {
175
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
175
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
176
176
  }
177
177
  if (!runId) {
178
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
178
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to start run" });
179
179
  }
180
180
  const workflow = mastra.legacy_getWorkflow(workflowId);
181
181
  const run = workflow.getMemoryRun(runId);
182
182
  if (!run) {
183
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
183
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
184
184
  }
185
185
  void run.start({
186
186
  triggerData,
@@ -188,7 +188,7 @@ async function startLegacyWorkflowRunHandler({
188
188
  });
189
189
  return { message: "Workflow run started" };
190
190
  } catch (e) {
191
- return chunkMTR2B27E_cjs.handleError(e, "Error starting workflow run");
191
+ return chunkPZQDCRPV_cjs.handleError(e, "Error starting workflow run");
192
192
  }
193
193
  }
194
194
  async function watchLegacyWorkflowHandler({
@@ -198,15 +198,15 @@ async function watchLegacyWorkflowHandler({
198
198
  }) {
199
199
  try {
200
200
  if (!workflowId) {
201
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
201
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
202
202
  }
203
203
  if (!runId) {
204
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
204
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to watch workflow" });
205
205
  }
206
206
  const workflow = mastra.legacy_getWorkflow(workflowId);
207
207
  const run = workflow.getMemoryRun(runId);
208
208
  if (!run) {
209
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
209
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
210
210
  }
211
211
  let unwatch;
212
212
  let asyncRef = null;
@@ -234,7 +234,7 @@ async function watchLegacyWorkflowHandler({
234
234
  });
235
235
  return stream;
236
236
  } catch (error) {
237
- return chunkMTR2B27E_cjs.handleError(error, "Error watching workflow");
237
+ return chunkPZQDCRPV_cjs.handleError(error, "Error watching workflow");
238
238
  }
239
239
  }
240
240
  async function resumeAsyncLegacyWorkflowHandler({
@@ -246,15 +246,15 @@ async function resumeAsyncLegacyWorkflowHandler({
246
246
  }) {
247
247
  try {
248
248
  if (!workflowId) {
249
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
249
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
250
250
  }
251
251
  if (!runId) {
252
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
252
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to resume workflow" });
253
253
  }
254
254
  const workflow = mastra.legacy_getWorkflow(workflowId);
255
255
  const run = workflow.getMemoryRun(runId);
256
256
  if (!run) {
257
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
257
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
258
258
  }
259
259
  const result = await run.resume({
260
260
  stepId: body.stepId,
@@ -263,7 +263,7 @@ async function resumeAsyncLegacyWorkflowHandler({
263
263
  });
264
264
  return result;
265
265
  } catch (error) {
266
- return chunkMTR2B27E_cjs.handleError(error, "Error resuming workflow step");
266
+ return chunkPZQDCRPV_cjs.handleError(error, "Error resuming workflow step");
267
267
  }
268
268
  }
269
269
  async function resumeLegacyWorkflowHandler({
@@ -275,15 +275,15 @@ async function resumeLegacyWorkflowHandler({
275
275
  }) {
276
276
  try {
277
277
  if (!workflowId) {
278
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
278
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
279
279
  }
280
280
  if (!runId) {
281
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
281
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to resume workflow" });
282
282
  }
283
283
  const workflow = mastra.legacy_getWorkflow(workflowId);
284
284
  const run = workflow.getMemoryRun(runId);
285
285
  if (!run) {
286
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
286
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
287
287
  }
288
288
  void run.resume({
289
289
  stepId: body.stepId,
@@ -292,7 +292,7 @@ async function resumeLegacyWorkflowHandler({
292
292
  });
293
293
  return { message: "Workflow run resumed" };
294
294
  } catch (error) {
295
- return chunkMTR2B27E_cjs.handleError(error, "Error resuming workflow");
295
+ return chunkPZQDCRPV_cjs.handleError(error, "Error resuming workflow");
296
296
  }
297
297
  }
298
298
  async function getLegacyWorkflowRunsHandler({
@@ -306,7 +306,7 @@ async function getLegacyWorkflowRunsHandler({
306
306
  }) {
307
307
  try {
308
308
  if (!workflowId) {
309
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
309
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
310
310
  }
311
311
  const workflow = mastra.legacy_getWorkflow(workflowId);
312
312
  const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
@@ -315,7 +315,7 @@ async function getLegacyWorkflowRunsHandler({
315
315
  };
316
316
  return workflowRuns;
317
317
  } catch (error) {
318
- return chunkMTR2B27E_cjs.handleError(error, "Error getting workflow runs");
318
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting workflow runs");
319
319
  }
320
320
  }
321
321
 
@@ -1,6 +1,6 @@
1
- import { validateBody } from './chunk-H5PTF3Y4.js';
2
- import { handleError } from './chunk-QDOJJCS4.js';
3
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { validateBody } from './chunk-RSEO4XPX.js';
2
+ import { handleError } from './chunk-LF7P5PLR.js';
3
+ import { HTTPException } from './chunk-LCM566I4.js';
4
4
  import { __export } from './chunk-MLKGABMK.js';
5
5
  import { Readable } from 'stream';
6
6
 
@@ -11,6 +11,7 @@ var HTTPException = class extends Error {
11
11
  super(options?.message, { cause: options?.cause });
12
12
  this.res = options?.res;
13
13
  this.status = status;
14
+ this.stack = options?.stack || this.stack;
14
15
  }
15
16
  /**
16
17
  * Returns the response object associated with the exception.
@@ -1,11 +1,13 @@
1
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { HTTPException } from './chunk-LCM566I4.js';
2
2
 
3
3
  // src/server/handlers/error.ts
4
4
  function handleError(error, defaultMessage) {
5
5
  const apiError = error;
6
6
  const apiErrorStatus = apiError.status || apiError.details?.status || 500;
7
7
  throw new HTTPException(apiErrorStatus, {
8
- message: apiError.message || defaultMessage
8
+ message: apiError.message || defaultMessage,
9
+ stack: apiError.stack,
10
+ cause: apiError.cause
9
11
  });
10
12
  }
11
13
 
@@ -1,7 +1,7 @@
1
1
  import { stringify, esm_default } from './chunk-MEGCYGBU.js';
2
- import { validateBody } from './chunk-H5PTF3Y4.js';
3
- import { handleError } from './chunk-QDOJJCS4.js';
4
- import { HTTPException } from './chunk-NYN7KFXL.js';
2
+ import { validateBody } from './chunk-RSEO4XPX.js';
3
+ import { handleError } from './chunk-LF7P5PLR.js';
4
+ import { HTTPException } from './chunk-LCM566I4.js';
5
5
  import { __export } from './chunk-MLKGABMK.js';
6
6
  import { isVercelTool } from '@mastra/core/tools';
7
7
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
4
- var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
5
- var chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.cjs');
6
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
4
+ var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
5
+ var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
6
+ var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
7
7
  var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
8
8
  var runtimeContext = require('@mastra/core/runtime-context');
9
9
 
@@ -72,7 +72,7 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
72
72
  }, {});
73
73
  return serializedAgents;
74
74
  } catch (error) {
75
- return chunkMTR2B27E_cjs.handleError(error, "Error getting agents");
75
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting agents");
76
76
  }
77
77
  }
78
78
  async function getAgentByIdHandler({
@@ -84,7 +84,7 @@ async function getAgentByIdHandler({
84
84
  try {
85
85
  const agent = mastra.getAgent(agentId);
86
86
  if (!agent) {
87
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
87
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
88
88
  }
89
89
  const tools = await agent.getTools({ runtimeContext });
90
90
  const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
@@ -151,7 +151,7 @@ async function getAgentByIdHandler({
151
151
  defaultStreamOptions
152
152
  };
153
153
  } catch (error) {
154
- return chunkMTR2B27E_cjs.handleError(error, "Error getting agent");
154
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting agent");
155
155
  }
156
156
  }
157
157
  async function getEvalsByAgentIdHandler({
@@ -170,7 +170,7 @@ async function getEvalsByAgentIdHandler({
170
170
  evals
171
171
  };
172
172
  } catch (error) {
173
- return chunkMTR2B27E_cjs.handleError(error, "Error getting test evals");
173
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting test evals");
174
174
  }
175
175
  }
176
176
  async function getLiveEvalsByAgentIdHandler({
@@ -189,7 +189,7 @@ async function getLiveEvalsByAgentIdHandler({
189
189
  evals
190
190
  };
191
191
  } catch (error) {
192
- return chunkMTR2B27E_cjs.handleError(error, "Error getting live evals");
192
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting live evals");
193
193
  }
194
194
  }
195
195
  async function generateHandler({
@@ -202,7 +202,7 @@ async function generateHandler({
202
202
  try {
203
203
  const agent = mastra.getAgent(agentId);
204
204
  if (!agent) {
205
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
205
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
206
206
  }
207
207
  const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
208
208
  const finalResourceId = resourceId ?? resourceid;
@@ -210,7 +210,7 @@ async function generateHandler({
210
210
  ...Array.from(runtimeContext$1.entries()),
211
211
  ...Array.from(Object.entries(agentRuntimeContext ?? {}))
212
212
  ]);
213
- chunk57CJTIPW_cjs.validateBody({ messages });
213
+ chunkCCGRCYWJ_cjs.validateBody({ messages });
214
214
  const result = await agent.generate(messages, {
215
215
  ...rest,
216
216
  // @ts-expect-error TODO fix types
@@ -220,7 +220,7 @@ async function generateHandler({
220
220
  });
221
221
  return result;
222
222
  } catch (error) {
223
- return chunkMTR2B27E_cjs.handleError(error, "Error generating from agent");
223
+ return chunkPZQDCRPV_cjs.handleError(error, "Error generating from agent");
224
224
  }
225
225
  }
226
226
  async function streamGenerateHandler({
@@ -233,7 +233,7 @@ async function streamGenerateHandler({
233
233
  try {
234
234
  const agent = mastra.getAgent(agentId);
235
235
  if (!agent) {
236
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
236
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
237
237
  }
238
238
  const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
239
239
  const finalResourceId = resourceId ?? resourceid;
@@ -241,7 +241,7 @@ async function streamGenerateHandler({
241
241
  ...Array.from(runtimeContext$1.entries()),
242
242
  ...Array.from(Object.entries(agentRuntimeContext ?? {}))
243
243
  ]);
244
- chunk57CJTIPW_cjs.validateBody({ messages });
244
+ chunkCCGRCYWJ_cjs.validateBody({ messages });
245
245
  const streamResult = await agent.stream(messages, {
246
246
  ...rest,
247
247
  // @ts-expect-error TODO fix types
@@ -265,7 +265,7 @@ async function streamGenerateHandler({
265
265
  });
266
266
  return streamResponse;
267
267
  } catch (error) {
268
- return chunkMTR2B27E_cjs.handleError(error, "error streaming agent response");
268
+ return chunkPZQDCRPV_cjs.handleError(error, "error streaming agent response");
269
269
  }
270
270
  }
271
271
 
@@ -1,6 +1,6 @@
1
- import { validateBody } from './chunk-H5PTF3Y4.js';
2
- import { handleError } from './chunk-QDOJJCS4.js';
3
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { validateBody } from './chunk-RSEO4XPX.js';
2
+ import { handleError } from './chunk-LF7P5PLR.js';
3
+ import { HTTPException } from './chunk-LCM566I4.js';
4
4
  import { __export } from './chunk-MLKGABMK.js';
5
5
 
6
6
  // src/server/handlers/memory.ts
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
3
+ var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
4
4
 
5
5
  // src/server/handlers/error.ts
6
6
  function handleError(error, defaultMessage) {
7
7
  const apiError = error;
8
8
  const apiErrorStatus = apiError.status || apiError.details?.status || 500;
9
- throw new chunkOCWPVYNI_cjs.HTTPException(apiErrorStatus, {
10
- message: apiError.message || defaultMessage
9
+ throw new chunk2KZFMI6P_cjs.HTTPException(apiErrorStatus, {
10
+ message: apiError.message || defaultMessage,
11
+ stack: apiError.stack,
12
+ cause: apiError.cause
11
13
  });
12
14
  }
13
15
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
4
- var chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.cjs');
3
+ var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
4
+ var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
5
  var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
6
6
 
7
7
  // src/server/handlers/logs.ts
@@ -17,7 +17,7 @@ async function getLogsHandler({
17
17
  params
18
18
  }) {
19
19
  try {
20
- chunk57CJTIPW_cjs.validateBody({ transportId });
20
+ chunkCCGRCYWJ_cjs.validateBody({ transportId });
21
21
  const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
22
22
  const filters = _filters ? Object.fromEntries(
23
23
  (Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
@@ -35,7 +35,7 @@ async function getLogsHandler({
35
35
  });
36
36
  return logs;
37
37
  } catch (error) {
38
- return chunkMTR2B27E_cjs.handleError(error, "Error getting logs");
38
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting logs");
39
39
  }
40
40
  }
41
41
  async function getLogsByRunIdHandler({
@@ -45,7 +45,7 @@ async function getLogsByRunIdHandler({
45
45
  params
46
46
  }) {
47
47
  try {
48
- chunk57CJTIPW_cjs.validateBody({ runId, transportId });
48
+ chunkCCGRCYWJ_cjs.validateBody({ runId, transportId });
49
49
  const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
50
50
  const filters = _filters ? Object.fromEntries(
51
51
  (Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
@@ -65,7 +65,7 @@ async function getLogsByRunIdHandler({
65
65
  });
66
66
  return logs;
67
67
  } catch (error) {
68
- return chunkMTR2B27E_cjs.handleError(error, "Error getting logs by run ID");
68
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting logs by run ID");
69
69
  }
70
70
  }
71
71
  async function getLogTransports({ mastra }) {
@@ -76,7 +76,7 @@ async function getLogTransports({ mastra }) {
76
76
  transports: transports ? [...transports.keys()] : []
77
77
  };
78
78
  } catch (error) {
79
- return chunkMTR2B27E_cjs.handleError(error, "Error getting log Transports");
79
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting log Transports");
80
80
  }
81
81
  }
82
82
 
@@ -1,5 +1,5 @@
1
- import { handleError } from './chunk-QDOJJCS4.js';
2
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { handleError } from './chunk-LF7P5PLR.js';
2
+ import { HTTPException } from './chunk-LCM566I4.js';
3
3
  import { __export } from './chunk-MLKGABMK.js';
4
4
 
5
5
  // src/server/handlers/telemetry.ts
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
4
- var chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.cjs');
5
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
3
+ var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
4
+ var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
+ var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
6
6
  var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
7
  var stream = require('stream');
8
8
 
@@ -17,20 +17,20 @@ chunk75ZPJI57_cjs.__export(voice_exports, {
17
17
  async function getSpeakersHandler({ mastra, agentId }) {
18
18
  try {
19
19
  if (!agentId) {
20
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
20
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
21
21
  }
22
22
  const agent = mastra.getAgent(agentId);
23
23
  if (!agent) {
24
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
24
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
25
25
  }
26
26
  const voice = await agent.getVoice();
27
27
  if (!voice) {
28
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
28
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
29
29
  }
30
30
  const speakers = await voice.getSpeakers();
31
31
  return speakers;
32
32
  } catch (error) {
33
- return chunkMTR2B27E_cjs.handleError(error, "Error getting speakers");
33
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting speakers");
34
34
  }
35
35
  }
36
36
  async function generateSpeechHandler({
@@ -40,26 +40,26 @@ async function generateSpeechHandler({
40
40
  }) {
41
41
  try {
42
42
  if (!agentId) {
43
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
43
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
44
44
  }
45
- chunk57CJTIPW_cjs.validateBody({
45
+ chunkCCGRCYWJ_cjs.validateBody({
46
46
  text: body?.text
47
47
  });
48
48
  const agent = mastra.getAgent(agentId);
49
49
  if (!agent) {
50
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
50
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
51
51
  }
52
52
  const voice = await agent.getVoice();
53
53
  if (!voice) {
54
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
54
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
55
55
  }
56
56
  const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
57
57
  if (!audioStream) {
58
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
58
+ throw new chunk2KZFMI6P_cjs.HTTPException(500, { message: "Failed to generate speech" });
59
59
  }
60
60
  return audioStream;
61
61
  } catch (error) {
62
- return chunkMTR2B27E_cjs.handleError(error, "Error generating speech");
62
+ return chunkPZQDCRPV_cjs.handleError(error, "Error generating speech");
63
63
  }
64
64
  }
65
65
  async function transcribeSpeechHandler({
@@ -69,18 +69,18 @@ async function transcribeSpeechHandler({
69
69
  }) {
70
70
  try {
71
71
  if (!agentId) {
72
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
72
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
73
73
  }
74
74
  if (!body?.audioData) {
75
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
75
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Audio data is required" });
76
76
  }
77
77
  const agent = mastra.getAgent(agentId);
78
78
  if (!agent) {
79
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
79
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
80
80
  }
81
81
  const voice = await agent.getVoice();
82
82
  if (!voice) {
83
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
83
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
84
84
  }
85
85
  const audioStream = new stream.Readable();
86
86
  audioStream.push(body.audioData);
@@ -88,26 +88,26 @@ async function transcribeSpeechHandler({
88
88
  const text = await voice.listen(audioStream, body.options);
89
89
  return { text };
90
90
  } catch (error) {
91
- return chunkMTR2B27E_cjs.handleError(error, "Error transcribing speech");
91
+ return chunkPZQDCRPV_cjs.handleError(error, "Error transcribing speech");
92
92
  }
93
93
  }
94
94
  async function getListenerHandler({ mastra, agentId }) {
95
95
  try {
96
96
  if (!agentId) {
97
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
97
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
98
98
  }
99
99
  const agent = mastra.getAgent(agentId);
100
100
  if (!agent) {
101
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
101
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
102
102
  }
103
103
  const voice = await agent.getVoice();
104
104
  if (!voice) {
105
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
105
+ throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
106
106
  }
107
107
  const listeners = await voice.getListener();
108
108
  return listeners;
109
109
  } catch (error) {
110
- return chunkMTR2B27E_cjs.handleError(error, "Error getting listeners");
110
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting listeners");
111
111
  }
112
112
  }
113
113
 
@@ -1,4 +1,4 @@
1
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { HTTPException } from './chunk-LCM566I4.js';
2
2
 
3
3
  // src/server/handlers/utils.ts
4
4
  function validateBody(body) {