@mastra/server 0.0.0-agui-20250501191909 → 0.0.0-cli-debug-20250611094457

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/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +297 -91
  3. package/dist/_tsup-dts-rollup.d.ts +297 -91
  4. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  5. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  6. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  7. package/dist/{chunk-Y3SV5XK4.js → chunk-6F2H7Y45.js} +86 -12
  8. package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
  9. package/dist/chunk-75ZPJI57.cjs +9 -0
  10. package/dist/{chunk-JPB6RPGB.js → chunk-7IBZ4L35.js} +86 -46
  11. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  12. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  13. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  14. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  15. package/dist/{chunk-55HTWX4C.cjs → chunk-CMMOIUFC.cjs} +40 -19
  16. package/dist/{chunk-Q6SHQECN.js → chunk-CP55EVBK.js} +24 -4
  17. package/dist/chunk-GHC4YV6R.js +504 -0
  18. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  19. package/dist/{chunk-5JNVY6DU.js → chunk-HYP7B2TL.js} +7 -5
  20. package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
  21. package/dist/chunk-IMBY5XUG.cjs +86 -0
  22. package/dist/chunk-JEWNMAYQ.cjs +263 -0
  23. package/dist/chunk-JKF6PRPU.cjs +357 -0
  24. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  25. package/dist/chunk-MLKGABMK.js +7 -0
  26. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  27. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  28. package/dist/chunk-QLG2PFHE.js +81 -0
  29. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  30. package/dist/{chunk-M3YJLWTU.js → chunk-TEZOEGR4.js} +63 -52
  31. package/dist/{chunk-D3G23FP3.cjs → chunk-TJO277H7.cjs} +24 -22
  32. package/dist/chunk-UZ7FJ66C.cjs +332 -0
  33. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  34. package/dist/chunk-WKWHYFX4.js +2001 -0
  35. package/dist/chunk-XUGQSVZ4.cjs +2004 -0
  36. package/dist/server/handlers/a2a.cjs +30 -0
  37. package/dist/server/handlers/a2a.d.cts +6 -0
  38. package/dist/server/handlers/a2a.d.ts +6 -0
  39. package/dist/server/handlers/a2a.js +1 -0
  40. package/dist/server/handlers/agents.cjs +7 -7
  41. package/dist/server/handlers/agents.js +1 -1
  42. package/dist/server/handlers/error.cjs +2 -2
  43. package/dist/server/handlers/error.js +1 -1
  44. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  45. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  46. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.js +1 -0
  48. package/dist/server/handlers/logs.cjs +4 -4
  49. package/dist/server/handlers/logs.js +1 -1
  50. package/dist/server/handlers/memory.cjs +9 -9
  51. package/dist/server/handlers/memory.js +1 -1
  52. package/dist/server/handlers/network.cjs +5 -5
  53. package/dist/server/handlers/network.js +1 -1
  54. package/dist/server/handlers/telemetry.cjs +3 -3
  55. package/dist/server/handlers/telemetry.js +1 -1
  56. package/dist/server/handlers/tools.cjs +5 -5
  57. package/dist/server/handlers/tools.js +1 -1
  58. package/dist/server/handlers/utils.cjs +2 -2
  59. package/dist/server/handlers/utils.js +1 -1
  60. package/dist/server/handlers/vector.cjs +7 -7
  61. package/dist/server/handlers/vector.js +1 -1
  62. package/dist/server/handlers/voice.cjs +8 -4
  63. package/dist/server/handlers/voice.d.cts +1 -0
  64. package/dist/server/handlers/voice.d.ts +1 -0
  65. package/dist/server/handlers/voice.js +1 -1
  66. package/dist/server/handlers/workflows.cjs +17 -13
  67. package/dist/server/handlers/workflows.d.cts +3 -2
  68. package/dist/server/handlers/workflows.d.ts +3 -2
  69. package/dist/server/handlers/workflows.js +1 -1
  70. package/dist/server/handlers.cjs +32 -27
  71. package/dist/server/handlers.d.cts +2 -1
  72. package/dist/server/handlers.d.ts +2 -1
  73. package/dist/server/handlers.js +11 -10
  74. package/package.json +12 -10
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-4BIX6GMY.cjs +0 -189
  77. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  78. package/dist/chunk-AELYAUEE.cjs +0 -316
  79. package/dist/chunk-EVCC233P.cjs +0 -321
  80. package/dist/chunk-OMN3UI6X.js +0 -5576
  81. package/dist/chunk-SKBVVI24.cjs +0 -54
  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,28 +1,31 @@
1
- import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
- import { handleError } from './chunk-3AHQ5RGN.js';
3
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
4
- import { ReadableStream } from 'node:stream/web';
1
+ import { stringify, esm_default } from './chunk-WKWHYFX4.js';
2
+ import { handleError } from './chunk-M5ABIP7D.js';
3
+ import { HTTPException } from './chunk-NYN7KFXL.js';
4
+ import { __export } from './chunk-MLKGABMK.js';
5
+ import { ReadableStream } from 'stream/web';
5
6
 
6
- // src/server/handlers/vNextWorkflows.ts
7
- var vNextWorkflows_exports = {};
8
- __export(vNextWorkflows_exports, {
9
- createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
10
- getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
11
- getVNextWorkflowRunHandler: () => getVNextWorkflowRunHandler,
12
- getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
13
- getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
14
- resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
15
- resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
16
- startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
17
- startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
18
- watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
7
+ // src/server/handlers/workflows.ts
8
+ var workflows_exports = {};
9
+ __export(workflows_exports, {
10
+ createWorkflowRunHandler: () => createWorkflowRunHandler,
11
+ getWorkflowByIdHandler: () => getWorkflowByIdHandler,
12
+ getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
13
+ getWorkflowRunsHandler: () => getWorkflowRunsHandler,
14
+ getWorkflowsHandler: () => getWorkflowsHandler,
15
+ resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
16
+ resumeWorkflowHandler: () => resumeWorkflowHandler,
17
+ startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
18
+ startWorkflowRunHandler: () => startWorkflowRunHandler,
19
+ streamWorkflowHandler: () => streamWorkflowHandler,
20
+ watchWorkflowHandler: () => watchWorkflowHandler
19
21
  });
20
- async function getVNextWorkflowsHandler({ mastra }) {
22
+ async function getWorkflowsHandler({ mastra }) {
21
23
  try {
22
- const workflows = mastra.vnext_getWorkflows({ serialized: false });
24
+ const workflows = mastra.getWorkflows({ serialized: false });
23
25
  const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
24
26
  acc[key] = {
25
27
  name: workflow.name,
28
+ description: workflow.description,
26
29
  steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
27
30
  acc2[key2] = {
28
31
  id: step.id,
@@ -45,12 +48,12 @@ async function getVNextWorkflowsHandler({ mastra }) {
45
48
  throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
46
49
  }
47
50
  }
48
- async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
51
+ async function getWorkflowByIdHandler({ mastra, workflowId }) {
49
52
  try {
50
53
  if (!workflowId) {
51
54
  throw new HTTPException(400, { message: "Workflow ID is required" });
52
55
  }
53
- const workflow = mastra.vnext_getWorkflow(workflowId);
56
+ const workflow = mastra.getWorkflow(workflowId);
54
57
  if (!workflow) {
55
58
  throw new HTTPException(404, { message: "Workflow not found" });
56
59
  }
@@ -67,6 +70,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
67
70
  return acc;
68
71
  }, {}),
69
72
  name: workflow.name,
73
+ description: workflow.description,
70
74
  stepGraph: workflow.serializedStepGraph,
71
75
  inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
72
76
  outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
@@ -75,7 +79,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
75
79
  throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
76
80
  }
77
81
  }
78
- async function getVNextWorkflowRunHandler({
82
+ async function getWorkflowRunByIdHandler({
79
83
  mastra,
80
84
  workflowId,
81
85
  runId
@@ -87,11 +91,11 @@ async function getVNextWorkflowRunHandler({
87
91
  if (!runId) {
88
92
  throw new HTTPException(400, { message: "Run ID is required" });
89
93
  }
90
- const workflow = mastra.vnext_getWorkflow(workflowId);
94
+ const workflow = mastra.getWorkflow(workflowId);
91
95
  if (!workflow) {
92
96
  throw new HTTPException(404, { message: "Workflow not found" });
93
97
  }
94
- const run = await workflow.getWorkflowRun(runId);
98
+ const run = await workflow.getWorkflowRunById(runId);
95
99
  if (!run) {
96
100
  throw new HTTPException(404, { message: "Workflow run not found" });
97
101
  }
@@ -100,7 +104,7 @@ async function getVNextWorkflowRunHandler({
100
104
  throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
101
105
  }
102
106
  }
103
- async function createVNextWorkflowRunHandler({
107
+ async function createWorkflowRunHandler({
104
108
  mastra,
105
109
  workflowId,
106
110
  runId: prevRunId
@@ -109,7 +113,7 @@ async function createVNextWorkflowRunHandler({
109
113
  if (!workflowId) {
110
114
  throw new HTTPException(400, { message: "Workflow ID is required" });
111
115
  }
112
- const workflow = mastra.vnext_getWorkflow(workflowId);
116
+ const workflow = mastra.getWorkflow(workflowId);
113
117
  if (!workflow) {
114
118
  throw new HTTPException(404, { message: "Workflow not found" });
115
119
  }
@@ -119,7 +123,7 @@ async function createVNextWorkflowRunHandler({
119
123
  throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
120
124
  }
121
125
  }
122
- async function startAsyncVNextWorkflowHandler({
126
+ async function startAsyncWorkflowHandler({
123
127
  mastra,
124
128
  runtimeContext,
125
129
  workflowId,
@@ -130,7 +134,7 @@ async function startAsyncVNextWorkflowHandler({
130
134
  if (!workflowId) {
131
135
  throw new HTTPException(400, { message: "Workflow ID is required" });
132
136
  }
133
- const workflow = mastra.vnext_getWorkflow(workflowId);
137
+ const workflow = mastra.getWorkflow(workflowId);
134
138
  if (!workflow) {
135
139
  throw new HTTPException(404, { message: "Workflow not found" });
136
140
  }
@@ -144,7 +148,7 @@ async function startAsyncVNextWorkflowHandler({
144
148
  throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
145
149
  }
146
150
  }
147
- async function startVNextWorkflowRunHandler({
151
+ async function startWorkflowRunHandler({
148
152
  mastra,
149
153
  runtimeContext,
150
154
  workflowId,
@@ -158,13 +162,13 @@ async function startVNextWorkflowRunHandler({
158
162
  if (!runId) {
159
163
  throw new HTTPException(400, { message: "runId required to start run" });
160
164
  }
161
- const workflow = mastra.vnext_getWorkflow(workflowId);
162
- const run = await workflow.getWorkflowRun(runId);
165
+ const workflow = mastra.getWorkflow(workflowId);
166
+ const run = await workflow.getWorkflowRunById(runId);
163
167
  if (!run) {
164
168
  throw new HTTPException(404, { message: "Workflow run not found" });
165
169
  }
166
170
  const _run = workflow.createRun({ runId });
167
- await _run.start({
171
+ void _run.start({
168
172
  inputData,
169
173
  runtimeContext
170
174
  });
@@ -173,7 +177,7 @@ async function startVNextWorkflowRunHandler({
173
177
  return handleError(e, "Error starting workflow run");
174
178
  }
175
179
  }
176
- async function watchVNextWorkflowHandler({
180
+ async function watchWorkflowHandler({
177
181
  mastra,
178
182
  workflowId,
179
183
  runId
@@ -185,8 +189,8 @@ async function watchVNextWorkflowHandler({
185
189
  if (!runId) {
186
190
  throw new HTTPException(400, { message: "runId required to watch workflow" });
187
191
  }
188
- const workflow = mastra.vnext_getWorkflow(workflowId);
189
- const run = await workflow.getWorkflowRun(runId);
192
+ const workflow = mastra.getWorkflow(workflowId);
193
+ const run = await workflow.getWorkflowRunById(runId);
190
194
  if (!run) {
191
195
  throw new HTTPException(404, { message: "Workflow run not found" });
192
196
  }
@@ -219,7 +223,35 @@ async function watchVNextWorkflowHandler({
219
223
  return handleError(error, "Error watching workflow");
220
224
  }
221
225
  }
222
- async function resumeAsyncVNextWorkflowHandler({
226
+ function streamWorkflowHandler({
227
+ mastra,
228
+ runtimeContext,
229
+ workflowId,
230
+ runId,
231
+ inputData
232
+ }) {
233
+ try {
234
+ if (!workflowId) {
235
+ throw new HTTPException(400, { message: "Workflow ID is required" });
236
+ }
237
+ if (!runId) {
238
+ throw new HTTPException(400, { message: "runId required to resume workflow" });
239
+ }
240
+ const workflow = mastra.getWorkflow(workflowId);
241
+ if (!workflow) {
242
+ throw new HTTPException(404, { message: "Workflow not found" });
243
+ }
244
+ const run = workflow.createRun({ runId });
245
+ const result = run.stream({
246
+ inputData,
247
+ runtimeContext
248
+ });
249
+ return result;
250
+ } catch (error) {
251
+ return handleError(error, "Error executing workflow");
252
+ }
253
+ }
254
+ async function resumeAsyncWorkflowHandler({
223
255
  mastra,
224
256
  workflowId,
225
257
  runId,
@@ -236,8 +268,8 @@ async function resumeAsyncVNextWorkflowHandler({
236
268
  if (!body.step) {
237
269
  throw new HTTPException(400, { message: "step required to resume workflow" });
238
270
  }
239
- const workflow = mastra.vnext_getWorkflow(workflowId);
240
- const run = await workflow.getWorkflowRun(runId);
271
+ const workflow = mastra.getWorkflow(workflowId);
272
+ const run = await workflow.getWorkflowRunById(runId);
241
273
  if (!run) {
242
274
  throw new HTTPException(404, { message: "Workflow run not found" });
243
275
  }
@@ -252,7 +284,7 @@ async function resumeAsyncVNextWorkflowHandler({
252
284
  return handleError(error, "Error resuming workflow step");
253
285
  }
254
286
  }
255
- async function resumeVNextWorkflowHandler({
287
+ async function resumeWorkflowHandler({
256
288
  mastra,
257
289
  workflowId,
258
290
  runId,
@@ -269,13 +301,13 @@ async function resumeVNextWorkflowHandler({
269
301
  if (!body.step) {
270
302
  throw new HTTPException(400, { message: "step required to resume workflow" });
271
303
  }
272
- const workflow = mastra.vnext_getWorkflow(workflowId);
273
- const run = await workflow.getWorkflowRun(runId);
304
+ const workflow = mastra.getWorkflow(workflowId);
305
+ const run = await workflow.getWorkflowRunById(runId);
274
306
  if (!run) {
275
307
  throw new HTTPException(404, { message: "Workflow run not found" });
276
308
  }
277
309
  const _run = workflow.createRun({ runId });
278
- await _run.resume({
310
+ void _run.resume({
279
311
  step: body.step,
280
312
  resumeData: body.resumeData,
281
313
  runtimeContext
@@ -285,13 +317,21 @@ async function resumeVNextWorkflowHandler({
285
317
  return handleError(error, "Error resuming workflow");
286
318
  }
287
319
  }
288
- async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
320
+ async function getWorkflowRunsHandler({
321
+ mastra,
322
+ workflowId,
323
+ fromDate,
324
+ toDate,
325
+ limit,
326
+ offset,
327
+ resourceId
328
+ }) {
289
329
  try {
290
330
  if (!workflowId) {
291
331
  throw new HTTPException(400, { message: "Workflow ID is required" });
292
332
  }
293
- const workflow = mastra.vnext_getWorkflow(workflowId);
294
- const workflowRuns = await workflow.getWorkflowRuns() || {
333
+ const workflow = mastra.getWorkflow(workflowId);
334
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
295
335
  runs: [],
296
336
  total: 0
297
337
  };
@@ -301,4 +341,4 @@ async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
301
341
  }
302
342
  }
303
343
 
304
- export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };
344
+ export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
4
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
3
+ var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
4
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
5
+ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
5
6
 
6
7
  // src/server/handlers/telemetry.ts
7
8
  var telemetry_exports = {};
8
- chunkFV45V6WC_cjs.__export(telemetry_exports, {
9
+ chunk75ZPJI57_cjs.__export(telemetry_exports, {
9
10
  getTelemetryHandler: () => getTelemetryHandler,
10
11
  storeTelemetryHandler: () => storeTelemetryHandler
11
12
  });
@@ -14,15 +15,15 @@ async function getTelemetryHandler({ mastra, body }) {
14
15
  const telemetry = mastra.getTelemetry();
15
16
  const storage = mastra.getStorage();
16
17
  if (!telemetry) {
17
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
18
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
18
19
  }
19
20
  if (!storage) {
20
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Storage is not initialized" });
21
+ return [];
21
22
  }
22
23
  if (!body) {
23
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Body is required" });
24
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
24
25
  }
25
- const { name, scope, page, perPage, attribute } = body;
26
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
26
27
  const attributes = attribute ? Object.fromEntries(
27
28
  (Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
28
29
  const [key, value] = attr.split(":");
@@ -34,11 +35,13 @@ async function getTelemetryHandler({ mastra, body }) {
34
35
  scope,
35
36
  page: Number(page ?? 0),
36
37
  perPage: Number(perPage ?? 100),
37
- attributes
38
+ attributes,
39
+ fromDate: fromDate ? new Date(fromDate) : void 0,
40
+ toDate: toDate ? new Date(toDate) : void 0
38
41
  });
39
42
  return traces;
40
43
  } catch (error2) {
41
- return chunkZLBRQFDD_cjs.handleError(error2, "Error getting telemetry");
44
+ return chunk64U3UDTH_cjs.handleError(error2, "Error getting telemetry");
42
45
  }
43
46
  }
44
47
  async function storeTelemetryHandler({ mastra, body }) {
@@ -46,7 +49,10 @@ async function storeTelemetryHandler({ mastra, body }) {
46
49
  const storage = mastra.getStorage();
47
50
  const logger = mastra.getLogger();
48
51
  if (!storage) {
49
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Storage is not initialized" });
52
+ return {
53
+ status: "error",
54
+ message: "Storage is not initialized"
55
+ };
50
56
  }
51
57
  const now = /* @__PURE__ */ new Date();
52
58
  const items = body?.resourceSpans?.[0]?.scopeSpans;
@@ -1,5 +1,6 @@
1
- import { handleError } from './chunk-3AHQ5RGN.js';
2
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
1
+ import { handleError } from './chunk-M5ABIP7D.js';
2
+ import { HTTPException } from './chunk-NYN7KFXL.js';
3
+ import { __export } from './chunk-MLKGABMK.js';
3
4
 
4
5
  // src/server/handlers/telemetry.ts
5
6
  var telemetry_exports = {};
@@ -15,12 +16,12 @@ async function getTelemetryHandler({ mastra, body }) {
15
16
  throw new HTTPException(400, { message: "Telemetry is not initialized" });
16
17
  }
17
18
  if (!storage) {
18
- throw new HTTPException(400, { message: "Storage is not initialized" });
19
+ return [];
19
20
  }
20
21
  if (!body) {
21
22
  throw new HTTPException(400, { message: "Body is required" });
22
23
  }
23
- const { name, scope, page, perPage, attribute } = body;
24
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
24
25
  const attributes = attribute ? Object.fromEntries(
25
26
  (Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
26
27
  const [key, value] = attr.split(":");
@@ -32,7 +33,9 @@ async function getTelemetryHandler({ mastra, body }) {
32
33
  scope,
33
34
  page: Number(page ?? 0),
34
35
  perPage: Number(perPage ?? 100),
35
- attributes
36
+ attributes,
37
+ fromDate: fromDate ? new Date(fromDate) : void 0,
38
+ toDate: toDate ? new Date(toDate) : void 0
36
39
  });
37
40
  return traces;
38
41
  } catch (error2) {
@@ -44,7 +47,10 @@ async function storeTelemetryHandler({ mastra, body }) {
44
47
  const storage = mastra.getStorage();
45
48
  const logger = mastra.getLogger();
46
49
  if (!storage) {
47
- throw new HTTPException(400, { message: "Storage is not initialized" });
50
+ return {
51
+ status: "error",
52
+ message: "Storage is not initialized"
53
+ };
48
54
  }
49
55
  const now = /* @__PURE__ */ new Date();
50
56
  const items = body?.resourceSpans?.[0]?.scopeSpans;
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
4
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
3
+ var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
4
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
5
+ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
5
6
 
6
7
  // src/server/handlers/vector.ts
7
8
  var vector_exports = {};
8
- chunkFV45V6WC_cjs.__export(vector_exports, {
9
+ chunk75ZPJI57_cjs.__export(vector_exports, {
9
10
  createIndex: () => createIndex,
10
11
  deleteIndex: () => deleteIndex,
11
12
  describeIndex: () => describeIndex,
@@ -15,24 +16,24 @@ chunkFV45V6WC_cjs.__export(vector_exports, {
15
16
  });
16
17
  function getVector(mastra, vectorName) {
17
18
  if (!vectorName) {
18
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Vector name is required" });
19
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Vector name is required" });
19
20
  }
20
21
  const vector = mastra.getVector(vectorName);
21
22
  if (!vector) {
22
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: `Vector store ${vectorName} not found` });
23
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: `Vector store ${vectorName} not found` });
23
24
  }
24
25
  return vector;
25
26
  }
26
27
  async function upsertVectors({ mastra, vectorName, index }) {
27
28
  try {
28
29
  if (!index?.indexName || !index?.vectors || !Array.isArray(index.vectors)) {
29
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Invalid request index. indexName and vectors array are required." });
30
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid request index. indexName and vectors array are required." });
30
31
  }
31
32
  const vector = getVector(mastra, vectorName);
32
33
  const result = await vector.upsert(index);
33
34
  return { ids: result };
34
35
  } catch (error) {
35
- return chunkZLBRQFDD_cjs.handleError(error, "Error upserting vectors");
36
+ return chunk64U3UDTH_cjs.handleError(error, "Error upserting vectors");
36
37
  }
37
38
  }
38
39
  async function createIndex({
@@ -43,18 +44,18 @@ async function createIndex({
43
44
  try {
44
45
  const { indexName, dimension, metric } = index;
45
46
  if (!indexName || typeof dimension !== "number" || dimension <= 0) {
46
- throw new chunkFV45V6WC_cjs.HTTPException(400, {
47
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, {
47
48
  message: "Invalid request index, indexName and positive dimension number are required."
48
49
  });
49
50
  }
50
51
  if (metric && !["cosine", "euclidean", "dotproduct"].includes(metric)) {
51
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Invalid metric. Must be one of: cosine, euclidean, dotproduct" });
52
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid metric. Must be one of: cosine, euclidean, dotproduct" });
52
53
  }
53
54
  const vector = getVector(mastra, vectorName);
54
55
  await vector.createIndex({ indexName, dimension, metric });
55
56
  return { success: true };
56
57
  } catch (error) {
57
- return chunkZLBRQFDD_cjs.handleError(error, "Error creating index");
58
+ return chunk64U3UDTH_cjs.handleError(error, "Error creating index");
58
59
  }
59
60
  }
60
61
  async function queryVectors({
@@ -64,13 +65,13 @@ async function queryVectors({
64
65
  }) {
65
66
  try {
66
67
  if (!query?.indexName || !query?.queryVector || !Array.isArray(query.queryVector)) {
67
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Invalid request query. indexName and queryVector array are required." });
68
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid request query. indexName and queryVector array are required." });
68
69
  }
69
70
  const vector = getVector(mastra, vectorName);
70
71
  const results = await vector.query(query);
71
72
  return results;
72
73
  } catch (error) {
73
- return chunkZLBRQFDD_cjs.handleError(error, "Error querying vectors");
74
+ return chunk64U3UDTH_cjs.handleError(error, "Error querying vectors");
74
75
  }
75
76
  }
76
77
  async function listIndexes({ mastra, vectorName }) {
@@ -79,7 +80,7 @@ async function listIndexes({ mastra, vectorName }) {
79
80
  const indexes = await vector.listIndexes();
80
81
  return indexes.filter(Boolean);
81
82
  } catch (error) {
82
- return chunkZLBRQFDD_cjs.handleError(error, "Error listing indexes");
83
+ return chunk64U3UDTH_cjs.handleError(error, "Error listing indexes");
83
84
  }
84
85
  }
85
86
  async function describeIndex({
@@ -89,17 +90,17 @@ async function describeIndex({
89
90
  }) {
90
91
  try {
91
92
  if (!indexName) {
92
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Index name is required" });
93
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
93
94
  }
94
95
  const vector = getVector(mastra, vectorName);
95
- const stats = await vector.describeIndex(indexName);
96
+ const stats = await vector.describeIndex({ indexName });
96
97
  return {
97
98
  dimension: stats.dimension,
98
99
  count: stats.count,
99
100
  metric: stats.metric?.toLowerCase()
100
101
  };
101
102
  } catch (error) {
102
- return chunkZLBRQFDD_cjs.handleError(error, "Error describing index");
103
+ return chunk64U3UDTH_cjs.handleError(error, "Error describing index");
103
104
  }
104
105
  }
105
106
  async function deleteIndex({
@@ -109,13 +110,13 @@ async function deleteIndex({
109
110
  }) {
110
111
  try {
111
112
  if (!indexName) {
112
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Index name is required" });
113
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
113
114
  }
114
115
  const vector = getVector(mastra, vectorName);
115
- await vector.deleteIndex(indexName);
116
+ await vector.deleteIndex({ indexName });
116
117
  return { success: true };
117
118
  } catch (error) {
118
- return chunkZLBRQFDD_cjs.handleError(error, "Error deleting index");
119
+ return chunk64U3UDTH_cjs.handleError(error, "Error deleting index");
119
120
  }
120
121
  }
121
122
 
@@ -1,6 +1,7 @@
1
- import { validateBody } from './chunk-L7XE5QTW.js';
2
- import { handleError } from './chunk-3AHQ5RGN.js';
3
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
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';
4
5
 
5
6
  // src/server/handlers/network.ts
6
7
  var network_exports = {};
@@ -1,33 +1,35 @@
1
1
  'use strict';
2
2
 
3
- var chunkQN4KF3BH_cjs = require('./chunk-QN4KF3BH.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
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');
6
7
  var stream = require('stream');
7
8
 
8
9
  // src/server/handlers/voice.ts
9
10
  var voice_exports = {};
10
- chunkFV45V6WC_cjs.__export(voice_exports, {
11
+ chunk75ZPJI57_cjs.__export(voice_exports, {
11
12
  generateSpeechHandler: () => generateSpeechHandler,
13
+ getListenerHandler: () => getListenerHandler,
12
14
  getSpeakersHandler: () => getSpeakersHandler,
13
15
  transcribeSpeechHandler: () => transcribeSpeechHandler
14
16
  });
15
17
  async function getSpeakersHandler({ mastra, agentId }) {
16
18
  try {
17
19
  if (!agentId) {
18
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
20
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
19
21
  }
20
22
  const agent = mastra.getAgent(agentId);
21
23
  if (!agent) {
22
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
24
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
23
25
  }
24
26
  if (!agent.voice) {
25
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
27
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
26
28
  }
27
29
  const speakers = await agent.voice.getSpeakers();
28
30
  return speakers;
29
31
  } catch (error) {
30
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting speakers");
32
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
31
33
  }
32
34
  }
33
35
  async function generateSpeechHandler({
@@ -37,25 +39,25 @@ async function generateSpeechHandler({
37
39
  }) {
38
40
  try {
39
41
  if (!agentId) {
40
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
42
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
41
43
  }
42
- chunkQN4KF3BH_cjs.validateBody({
44
+ chunk57CJTIPW_cjs.validateBody({
43
45
  text: body?.text
44
46
  });
45
47
  const agent = mastra.getAgent(agentId);
46
48
  if (!agent) {
47
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
49
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
48
50
  }
49
51
  if (!agent.voice) {
50
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
52
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
51
53
  }
52
54
  const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
53
55
  if (!audioStream) {
54
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: "Failed to generate speech" });
56
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
55
57
  }
56
58
  return audioStream;
57
59
  } catch (error) {
58
- return chunkZLBRQFDD_cjs.handleError(error, "Error generating speech");
60
+ return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
59
61
  }
60
62
  }
61
63
  async function transcribeSpeechHandler({
@@ -65,17 +67,17 @@ async function transcribeSpeechHandler({
65
67
  }) {
66
68
  try {
67
69
  if (!agentId) {
68
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
70
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
69
71
  }
70
72
  if (!body?.audioData) {
71
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Audio data is required" });
73
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
72
74
  }
73
75
  const agent = mastra.getAgent(agentId);
74
76
  if (!agent) {
75
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
77
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
76
78
  }
77
79
  if (!agent.voice) {
78
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
80
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
79
81
  }
80
82
  const audioStream = new stream.Readable();
81
83
  audioStream.push(body.audioData);
@@ -83,11 +85,30 @@ async function transcribeSpeechHandler({
83
85
  const text = await agent.voice.listen(audioStream, body.options);
84
86
  return { text };
85
87
  } catch (error) {
86
- return chunkZLBRQFDD_cjs.handleError(error, "Error transcribing speech");
88
+ return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
89
+ }
90
+ }
91
+ async function getListenerHandler({ mastra, agentId }) {
92
+ try {
93
+ if (!agentId) {
94
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
95
+ }
96
+ const agent = mastra.getAgent(agentId);
97
+ if (!agent) {
98
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
99
+ }
100
+ if (!agent.voice) {
101
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
102
+ }
103
+ const listeners = await agent.voice.getListener();
104
+ return listeners;
105
+ } catch (error) {
106
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
87
107
  }
88
108
  }
89
109
 
90
110
  exports.generateSpeechHandler = generateSpeechHandler;
111
+ exports.getListenerHandler = getListenerHandler;
91
112
  exports.getSpeakersHandler = getSpeakersHandler;
92
113
  exports.transcribeSpeechHandler = transcribeSpeechHandler;
93
114
  exports.voice_exports = voice_exports;