@mastra/server 0.0.0-separate-trace-data-from-component-20250501042644 → 0.0.0-support-d1-client-20250701191943

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 (91) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +517 -103
  3. package/dist/_tsup-dts-rollup.d.ts +517 -103
  4. package/dist/{chunk-2FJURXCL.cjs → chunk-3DKDT264.cjs} +93 -55
  5. package/dist/{chunk-Y3SV5XK4.js → chunk-4QBIUKVY.js} +105 -16
  6. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  7. package/dist/chunk-7524QH7G.cjs +483 -0
  8. package/dist/chunk-75ZPJI57.cjs +9 -0
  9. package/dist/{chunk-M3YJLWTU.js → chunk-7GQJAMTA.js} +68 -57
  10. package/dist/chunk-BOXE6WSV.js +81 -0
  11. package/dist/{chunk-WTHDCRMY.js → chunk-BP24Z4WG.js} +12 -6
  12. package/dist/chunk-BWHGBV3K.cjs +278 -0
  13. package/dist/chunk-CNVDCLSY.cjs +86 -0
  14. package/dist/{chunk-5JNVY6DU.js → chunk-DFJUGWNU.js} +7 -5
  15. package/dist/{chunk-5YGDYMRB.cjs → chunk-DPRB3R7Y.cjs} +14 -13
  16. package/dist/{chunk-D3G23FP3.cjs → chunk-FGGMQCPP.cjs} +24 -22
  17. package/dist/{chunk-4JINXASC.js → chunk-FVMGZKFD.js} +5 -4
  18. package/dist/{chunk-Q6SHQECN.js → chunk-G37NVEDX.js} +34 -10
  19. package/dist/chunk-GHC4YV6R.js +504 -0
  20. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  21. package/dist/chunk-L3N7ST2Z.cjs +118 -0
  22. package/dist/chunk-LI436ITD.cjs +2042 -0
  23. package/dist/{chunk-RBQASTUP.js → chunk-LTJNMM2Y.js} +63 -25
  24. package/dist/chunk-MEGCYGBU.js +2039 -0
  25. package/dist/chunk-MLKGABMK.js +7 -0
  26. package/dist/{chunk-ZLBRQFDD.cjs → chunk-MTR2B27E.cjs} +3 -2
  27. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  28. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  29. package/dist/{chunk-3AHQ5RGN.js → chunk-QDOJJCS4.js} +3 -2
  30. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  31. package/dist/chunk-TGZIR6AK.cjs +332 -0
  32. package/dist/{chunk-M56ECCHK.cjs → chunk-TVBPFPTN.cjs} +20 -19
  33. package/dist/{chunk-7IWQE76Z.cjs → chunk-ULFULEW4.cjs} +16 -10
  34. package/dist/{chunk-QJ3AHN64.js → chunk-VMXLEF54.js} +4 -3
  35. package/dist/chunk-Z5TH5F35.js +468 -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/vNextNetwork.cjs +218 -0
  61. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  62. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  63. package/dist/server/handlers/vNextNetwork.js +211 -0
  64. package/dist/server/handlers/vector.cjs +7 -7
  65. package/dist/server/handlers/vector.js +1 -1
  66. package/dist/server/handlers/voice.cjs +8 -4
  67. package/dist/server/handlers/voice.d.cts +1 -0
  68. package/dist/server/handlers/voice.d.ts +1 -0
  69. package/dist/server/handlers/voice.js +1 -1
  70. package/dist/server/handlers/workflows.cjs +25 -13
  71. package/dist/server/handlers/workflows.d.cts +5 -2
  72. package/dist/server/handlers/workflows.d.ts +5 -2
  73. package/dist/server/handlers/workflows.js +1 -1
  74. package/dist/server/handlers.cjs +32 -27
  75. package/dist/server/handlers.d.cts +2 -1
  76. package/dist/server/handlers.d.ts +2 -1
  77. package/dist/server/handlers.js +11 -10
  78. package/package.json +14 -13
  79. package/dist/chunk-3EJZQ6TQ.js +0 -49
  80. package/dist/chunk-4BIX6GMY.cjs +0 -189
  81. package/dist/chunk-55HTWX4C.cjs +0 -93
  82. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  83. package/dist/chunk-AELYAUEE.cjs +0 -316
  84. package/dist/chunk-EVCC233P.cjs +0 -321
  85. package/dist/chunk-JPB6RPGB.js +0 -304
  86. package/dist/chunk-OMN3UI6X.js +0 -5576
  87. package/dist/chunk-SKBVVI24.cjs +0 -54
  88. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  89. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  90. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  91. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -0,0 +1,332 @@
1
+ 'use strict';
2
+
3
+ var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
4
+ var chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.cjs');
5
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.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 chunkMTR2B27E_cjs.handleError(error, "error getting workflows");
52
+ }
53
+ }
54
+ async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
55
+ try {
56
+ if (!workflowId) {
57
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
58
+ }
59
+ const workflow = mastra.legacy_getWorkflow(workflowId);
60
+ if (!workflow) {
61
+ throw new chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
96
+ }
97
+ const workflow = mastra.legacy_getWorkflow(workflowId);
98
+ if (!workflow) {
99
+ throw new chunkOCWPVYNI_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 chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
130
+ }
131
+ if (!runId) {
132
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
133
+ }
134
+ const workflow = mastra.legacy_getWorkflow(workflowId);
135
+ if (!workflow) {
136
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
137
+ }
138
+ const run = await workflow.getRun(runId);
139
+ if (!run) {
140
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
141
+ }
142
+ return run;
143
+ } catch (error) {
144
+ return chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
155
+ }
156
+ const workflow = mastra.legacy_getWorkflow(workflowId);
157
+ if (!workflow) {
158
+ throw new chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
176
+ }
177
+ if (!runId) {
178
+ throw new chunkOCWPVYNI_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 chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
202
+ }
203
+ if (!runId) {
204
+ throw new chunkOCWPVYNI_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 chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
250
+ }
251
+ if (!runId) {
252
+ throw new chunkOCWPVYNI_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 chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
279
+ }
280
+ if (!runId) {
281
+ throw new chunkOCWPVYNI_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 chunkOCWPVYNI_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 chunkMTR2B27E_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 chunkOCWPVYNI_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 chunkMTR2B27E_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,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 chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.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 chunkMTR2B27E_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 chunkMTR2B27E_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 chunkMTR2B27E_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 chunkMTR2B27E_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 chunkMTR2B27E_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 chunkMTR2B27E_cjs.handleError(error, "Error deleting index");
119
120
  }
120
121
  }
121
122
 
@@ -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 chunkMTR2B27E_cjs = require('./chunk-MTR2B27E.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 chunkMTR2B27E_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,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-QDOJJCS4.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 = {};