@mastra/server 0.0.1-alpha.5 → 0.10.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 (79) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +305 -52
  4. package/dist/_tsup-dts-rollup.d.ts +305 -52
  5. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  6. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  7. package/dist/chunk-5SN4U5AC.cjs +508 -0
  8. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  9. package/dist/chunk-6B4OMWT6.cjs +343 -0
  10. package/dist/chunk-75ZPJI57.cjs +9 -0
  11. package/dist/{chunk-VB7KH62D.cjs → chunk-7DLZLWJV.cjs} +16 -12
  12. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  13. package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
  14. package/dist/chunk-D4IRYCUI.cjs +235 -0
  15. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  16. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  17. package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-CWSDZEZG.cjs → chunk-MHKNLNAN.cjs} +15 -12
  21. package/dist/chunk-MLKGABMK.js +7 -0
  22. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  23. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  24. package/dist/{chunk-DVPP5S6I.js → chunk-OR3CIE2H.js} +9 -6
  25. package/dist/chunk-P6SCPDYW.js +500 -0
  26. package/dist/chunk-QY36IPTP.js +331 -0
  27. package/dist/{chunk-YNSGUC2O.js → chunk-TJKLBTFB.js} +23 -7
  28. package/dist/chunk-VPNDC2DI.cjs +148 -0
  29. package/dist/{chunk-ILW7XYNJ.js → chunk-W7VCKPAD.js} +84 -60
  30. package/dist/{chunk-2JQC6JWP.js → chunk-WFBJJNCK.js} +10 -6
  31. package/dist/chunk-WUC6LSTW.js +227 -0
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/{chunk-A7DF4ETD.cjs → chunk-YBVOQN4M.cjs} +22 -28
  34. package/dist/chunk-YIOVBYZH.cjs +332 -0
  35. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  36. package/dist/{chunk-4C3EPMMF.cjs → chunk-ZE5AAC4I.cjs} +40 -24
  37. package/dist/server/handlers/a2a.cjs +30 -0
  38. package/dist/server/handlers/a2a.d.cts +6 -0
  39. package/dist/server/handlers/a2a.d.ts +6 -0
  40. package/dist/server/handlers/a2a.js +1 -0
  41. package/dist/server/handlers/agents.cjs +7 -7
  42. package/dist/server/handlers/agents.js +1 -1
  43. package/dist/server/handlers/error.cjs +2 -2
  44. package/dist/server/handlers/error.js +1 -1
  45. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  46. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  48. package/dist/server/handlers/legacyWorkflows.js +1 -0
  49. package/dist/server/handlers/logs.cjs +4 -4
  50. package/dist/server/handlers/logs.js +1 -1
  51. package/dist/server/handlers/memory.cjs +9 -9
  52. package/dist/server/handlers/memory.js +1 -1
  53. package/dist/server/handlers/network.cjs +5 -5
  54. package/dist/server/handlers/network.js +1 -1
  55. package/dist/server/handlers/telemetry.cjs +3 -3
  56. package/dist/server/handlers/telemetry.js +1 -1
  57. package/dist/server/handlers/tools.cjs +5 -5
  58. package/dist/server/handlers/tools.js +1 -1
  59. package/dist/server/handlers/utils.cjs +2 -2
  60. package/dist/server/handlers/utils.js +1 -1
  61. package/dist/server/handlers/vector.cjs +7 -7
  62. package/dist/server/handlers/vector.js +1 -1
  63. package/dist/server/handlers/voice.cjs +4 -4
  64. package/dist/server/handlers/voice.js +1 -1
  65. package/dist/server/handlers/workflows.cjs +13 -13
  66. package/dist/server/handlers/workflows.d.cts +2 -2
  67. package/dist/server/handlers/workflows.d.ts +2 -2
  68. package/dist/server/handlers/workflows.js +1 -1
  69. package/dist/server/handlers.cjs +33 -23
  70. package/dist/server/handlers.d.cts +2 -0
  71. package/dist/server/handlers.d.ts +2 -0
  72. package/dist/server/handlers.js +11 -9
  73. package/package.json +9 -7
  74. package/dist/chunk-5JOF627H.cjs +0 -123
  75. package/dist/chunk-BMA2ORRT.js +0 -152
  76. package/dist/chunk-GV52BII2.cjs +0 -160
  77. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  78. package/dist/chunk-VK6FX47H.js +0 -5576
  79. package/dist/chunk-X37I6GZT.cjs +0 -308
@@ -0,0 +1,343 @@
1
+ 'use strict';
2
+
3
+ var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.cjs');
4
+ var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
5
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
6
+ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
+ var web = require('stream/web');
8
+ var di = require('@mastra/core/di');
9
+
10
+ // src/server/handlers/workflows.ts
11
+ var workflows_exports = {};
12
+ chunk75ZPJI57_cjs.__export(workflows_exports, {
13
+ createWorkflowRunHandler: () => createWorkflowRunHandler,
14
+ getWorkflowByIdHandler: () => getWorkflowByIdHandler,
15
+ getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
16
+ getWorkflowRunsHandler: () => getWorkflowRunsHandler,
17
+ getWorkflowsHandler: () => getWorkflowsHandler,
18
+ resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
19
+ resumeWorkflowHandler: () => resumeWorkflowHandler,
20
+ startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
21
+ startWorkflowRunHandler: () => startWorkflowRunHandler,
22
+ watchWorkflowHandler: () => watchWorkflowHandler
23
+ });
24
+ async function getWorkflowsHandler({ mastra }) {
25
+ try {
26
+ const workflows = mastra.getWorkflows({ serialized: false });
27
+ const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
28
+ acc[key] = {
29
+ name: workflow.name,
30
+ description: workflow.description,
31
+ steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
32
+ acc2[key2] = {
33
+ id: step.id,
34
+ description: step.description,
35
+ inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
36
+ outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
37
+ resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
38
+ suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
39
+ };
40
+ return acc2;
41
+ }, {}),
42
+ stepGraph: workflow.serializedStepGraph,
43
+ inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
44
+ outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
45
+ };
46
+ return acc;
47
+ }, {});
48
+ return _workflows;
49
+ } catch (error) {
50
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
51
+ }
52
+ }
53
+ async function getWorkflowByIdHandler({ mastra, workflowId }) {
54
+ try {
55
+ if (!workflowId) {
56
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
57
+ }
58
+ const workflow = mastra.getWorkflow(workflowId);
59
+ if (!workflow) {
60
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
61
+ }
62
+ return {
63
+ steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
64
+ acc[key] = {
65
+ id: step.id,
66
+ description: step.description,
67
+ inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
68
+ outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
69
+ resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
70
+ suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
71
+ };
72
+ return acc;
73
+ }, {}),
74
+ name: workflow.name,
75
+ description: workflow.description,
76
+ stepGraph: workflow.serializedStepGraph,
77
+ inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
78
+ outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
79
+ };
80
+ } catch (error) {
81
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
82
+ }
83
+ }
84
+ async function getWorkflowRunByIdHandler({
85
+ mastra,
86
+ workflowId,
87
+ runId
88
+ }) {
89
+ try {
90
+ if (!workflowId) {
91
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
92
+ }
93
+ if (!runId) {
94
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
95
+ }
96
+ const workflow = mastra.getWorkflow(workflowId);
97
+ if (!workflow) {
98
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
99
+ }
100
+ const run = await workflow.getWorkflowRunById(runId);
101
+ if (!run) {
102
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
103
+ }
104
+ return run;
105
+ } catch (error) {
106
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
107
+ }
108
+ }
109
+ async function createWorkflowRunHandler({
110
+ mastra,
111
+ workflowId,
112
+ runId: prevRunId
113
+ }) {
114
+ try {
115
+ if (!workflowId) {
116
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
117
+ }
118
+ const workflow = mastra.getWorkflow(workflowId);
119
+ if (!workflow) {
120
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
121
+ }
122
+ const run = workflow.createRun({ runId: prevRunId });
123
+ return { runId: run.runId };
124
+ } catch (error) {
125
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
126
+ }
127
+ }
128
+ async function startAsyncWorkflowHandler({
129
+ mastra,
130
+ runtimeContext,
131
+ workflowId,
132
+ runId,
133
+ inputData,
134
+ runtimeContextFromRequest
135
+ }) {
136
+ try {
137
+ if (!workflowId) {
138
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
139
+ }
140
+ const workflow = mastra.getWorkflow(workflowId);
141
+ if (!workflow) {
142
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
143
+ }
144
+ const finalRuntimeContext = new di.RuntimeContext([
145
+ ...Array.from(runtimeContext?.entries() ?? []),
146
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
147
+ ]);
148
+ const _run = workflow.createRun({ runId });
149
+ const result = await _run.start({
150
+ inputData,
151
+ runtimeContext: finalRuntimeContext
152
+ });
153
+ return result;
154
+ } catch (error) {
155
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
156
+ }
157
+ }
158
+ async function startWorkflowRunHandler({
159
+ mastra,
160
+ runtimeContext,
161
+ workflowId,
162
+ runId,
163
+ inputData,
164
+ runtimeContextFromRequest
165
+ }) {
166
+ try {
167
+ if (!workflowId) {
168
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
169
+ }
170
+ if (!runId) {
171
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
172
+ }
173
+ const workflow = mastra.getWorkflow(workflowId);
174
+ const run = await workflow.getWorkflowRunById(runId);
175
+ if (!run) {
176
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
177
+ }
178
+ const finalRuntimeContext = new di.RuntimeContext([
179
+ ...Array.from(runtimeContext?.entries() ?? []),
180
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
181
+ ]);
182
+ const _run = workflow.createRun({ runId });
183
+ void _run.start({
184
+ inputData,
185
+ runtimeContext: finalRuntimeContext
186
+ });
187
+ return { message: "Workflow run started" };
188
+ } catch (e) {
189
+ return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
190
+ }
191
+ }
192
+ async function watchWorkflowHandler({
193
+ mastra,
194
+ workflowId,
195
+ runId
196
+ }) {
197
+ try {
198
+ if (!workflowId) {
199
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
200
+ }
201
+ if (!runId) {
202
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
203
+ }
204
+ const workflow = mastra.getWorkflow(workflowId);
205
+ const run = await workflow.getWorkflowRunById(runId);
206
+ if (!run) {
207
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
208
+ }
209
+ const _run = workflow.createRun({ runId });
210
+ let unwatch;
211
+ let asyncRef = null;
212
+ const stream = new web.ReadableStream({
213
+ start(controller) {
214
+ unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
215
+ controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
216
+ if (asyncRef) {
217
+ clearImmediate(asyncRef);
218
+ asyncRef = null;
219
+ }
220
+ asyncRef = setImmediate(async () => {
221
+ const runDone = payload.workflowState.status !== "running";
222
+ if (runDone) {
223
+ controller.close();
224
+ unwatch?.();
225
+ }
226
+ });
227
+ });
228
+ },
229
+ cancel() {
230
+ unwatch?.();
231
+ }
232
+ });
233
+ return stream;
234
+ } catch (error) {
235
+ return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
236
+ }
237
+ }
238
+ async function resumeAsyncWorkflowHandler({
239
+ mastra,
240
+ workflowId,
241
+ runId,
242
+ body,
243
+ runtimeContext,
244
+ runtimeContextFromRequest
245
+ }) {
246
+ try {
247
+ if (!workflowId) {
248
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
249
+ }
250
+ if (!runId) {
251
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
252
+ }
253
+ if (!body.step) {
254
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
255
+ }
256
+ const workflow = mastra.getWorkflow(workflowId);
257
+ const run = await workflow.getWorkflowRunById(runId);
258
+ if (!run) {
259
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
260
+ }
261
+ const finalRuntimeContext = new di.RuntimeContext([
262
+ ...Array.from(runtimeContext?.entries() ?? []),
263
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
264
+ ]);
265
+ const _run = workflow.createRun({ runId });
266
+ const result = await _run.resume({
267
+ step: body.step,
268
+ resumeData: body.resumeData,
269
+ runtimeContext: finalRuntimeContext
270
+ });
271
+ return result;
272
+ } catch (error) {
273
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
274
+ }
275
+ }
276
+ async function resumeWorkflowHandler({
277
+ mastra,
278
+ workflowId,
279
+ runId,
280
+ body,
281
+ runtimeContext
282
+ }) {
283
+ try {
284
+ if (!workflowId) {
285
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
286
+ }
287
+ if (!runId) {
288
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
289
+ }
290
+ if (!body.step) {
291
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
292
+ }
293
+ const workflow = mastra.getWorkflow(workflowId);
294
+ const run = await workflow.getWorkflowRunById(runId);
295
+ if (!run) {
296
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
297
+ }
298
+ const _run = workflow.createRun({ runId });
299
+ void _run.resume({
300
+ step: body.step,
301
+ resumeData: body.resumeData,
302
+ runtimeContext
303
+ });
304
+ return { message: "Workflow run resumed" };
305
+ } catch (error) {
306
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
307
+ }
308
+ }
309
+ async function getWorkflowRunsHandler({
310
+ mastra,
311
+ workflowId,
312
+ fromDate,
313
+ toDate,
314
+ limit,
315
+ offset,
316
+ resourceId
317
+ }) {
318
+ try {
319
+ if (!workflowId) {
320
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
321
+ }
322
+ const workflow = mastra.getWorkflow(workflowId);
323
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
324
+ runs: [],
325
+ total: 0
326
+ };
327
+ return workflowRuns;
328
+ } catch (error) {
329
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
330
+ }
331
+ }
332
+
333
+ exports.createWorkflowRunHandler = createWorkflowRunHandler;
334
+ exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
335
+ exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
336
+ exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
337
+ exports.getWorkflowsHandler = getWorkflowsHandler;
338
+ exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
339
+ exports.resumeWorkflowHandler = resumeWorkflowHandler;
340
+ exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
341
+ exports.startWorkflowRunHandler = startWorkflowRunHandler;
342
+ exports.watchWorkflowHandler = watchWorkflowHandler;
343
+ exports.workflows_exports = workflows_exports;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __export = (target, all) => {
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+
9
+ exports.__export = __export;
@@ -1,23 +1,26 @@
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 chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
6
6
 
7
7
  // src/server/handlers/logs.ts
8
8
  var logs_exports = {};
9
- chunkFV45V6WC_cjs.__export(logs_exports, {
9
+ chunk75ZPJI57_cjs.__export(logs_exports, {
10
10
  getLogTransports: () => getLogTransports,
11
11
  getLogsByRunIdHandler: () => getLogsByRunIdHandler,
12
12
  getLogsHandler: () => getLogsHandler
13
13
  });
14
- async function getLogsHandler({ mastra, transportId }) {
14
+ async function getLogsHandler({
15
+ mastra,
16
+ transportId
17
+ }) {
15
18
  try {
16
- chunkQN4KF3BH_cjs.validateBody({ transportId });
19
+ chunk57CJTIPW_cjs.validateBody({ transportId });
17
20
  const logs = await mastra.getLogs(transportId);
18
21
  return logs;
19
22
  } catch (error) {
20
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting logs");
23
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting logs");
21
24
  }
22
25
  }
23
26
  async function getLogsByRunIdHandler({
@@ -26,22 +29,23 @@ async function getLogsByRunIdHandler({
26
29
  transportId
27
30
  }) {
28
31
  try {
29
- chunkQN4KF3BH_cjs.validateBody({ runId, transportId });
32
+ chunk57CJTIPW_cjs.validateBody({ runId, transportId });
30
33
  const logs = await mastra.getLogsByRunId({ runId, transportId });
31
34
  return logs;
32
35
  } catch (error) {
33
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting logs by run ID");
36
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting logs by run ID");
34
37
  }
35
38
  }
36
39
  async function getLogTransports({ mastra }) {
37
40
  try {
38
41
  const logger = mastra.getLogger();
39
- const transports = logger.transports;
42
+ console.log(logger);
43
+ const transports = logger.getTransports();
40
44
  return {
41
- transports: transports ? Object.keys(transports) : []
45
+ transports: transports ? [...transports.keys()] : []
42
46
  };
43
47
  } catch (error) {
44
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting log Transports");
48
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
45
49
  }
46
50
  }
47
51
 
@@ -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