@mastra/server 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-vector-query-sources-20250516172905

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 (70) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +161 -13
  3. package/dist/_tsup-dts-rollup.d.ts +161 -13
  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-5SN4U5AC.cjs +508 -0
  7. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  8. package/dist/chunk-75ZPJI57.cjs +9 -0
  9. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  10. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  11. package/dist/{chunk-4BIX6GMY.cjs → chunk-D4IRYCUI.cjs} +72 -26
  12. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  13. package/dist/{chunk-3XTEV33Q.js → chunk-EJO45KYT.js} +19 -16
  14. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  15. package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
  16. package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
  17. package/dist/{chunk-CHFORQ7J.cjs → chunk-I2B73Y4I.cjs} +60 -57
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
  21. package/dist/{chunk-OWNA6I2H.js → chunk-MIQYDLLM.js} +28 -11
  22. package/dist/chunk-MLKGABMK.js +7 -0
  23. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  24. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  25. package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
  26. package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
  27. package/dist/chunk-P6SCPDYW.js +500 -0
  28. package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
  29. package/dist/{chunk-M2RXDCPV.cjs → chunk-UCTEMO2Q.cjs} +76 -59
  30. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  31. package/dist/{chunk-Y3SV5XK4.js → chunk-WUC6LSTW.js} +54 -8
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
  34. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  35. package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
  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/logs.cjs +4 -4
  45. package/dist/server/handlers/logs.js +1 -1
  46. package/dist/server/handlers/memory.cjs +9 -9
  47. package/dist/server/handlers/memory.js +1 -1
  48. package/dist/server/handlers/network.cjs +5 -5
  49. package/dist/server/handlers/network.js +1 -1
  50. package/dist/server/handlers/telemetry.cjs +3 -3
  51. package/dist/server/handlers/telemetry.js +1 -1
  52. package/dist/server/handlers/tools.cjs +5 -5
  53. package/dist/server/handlers/tools.js +1 -1
  54. package/dist/server/handlers/utils.cjs +2 -2
  55. package/dist/server/handlers/utils.js +1 -1
  56. package/dist/server/handlers/vNextWorkflows.cjs +11 -11
  57. package/dist/server/handlers/vNextWorkflows.js +1 -1
  58. package/dist/server/handlers/vector.cjs +7 -7
  59. package/dist/server/handlers/vector.js +1 -1
  60. package/dist/server/handlers/voice.cjs +4 -4
  61. package/dist/server/handlers/voice.js +1 -1
  62. package/dist/server/handlers/workflows.cjs +11 -11
  63. package/dist/server/handlers/workflows.js +1 -1
  64. package/dist/server/handlers.cjs +28 -23
  65. package/dist/server/handlers.d.cts +1 -0
  66. package/dist/server/handlers.d.ts +1 -0
  67. package/dist/server/handlers.js +11 -10
  68. package/package.json +7 -5
  69. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  70. package/dist/chunk-OMN3UI6X.js +0 -5576
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
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');
6
7
  var web = require('stream/web');
8
+ var di = require('@mastra/core/di');
7
9
 
8
10
  // src/server/handlers/vNextWorkflows.ts
9
11
  var vNextWorkflows_exports = {};
10
- chunkFV45V6WC_cjs.__export(vNextWorkflows_exports, {
12
+ chunk75ZPJI57_cjs.__export(vNextWorkflows_exports, {
11
13
  createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
12
14
  getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
13
15
  getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
@@ -29,52 +31,52 @@ async function getVNextWorkflowsHandler({ mastra }) {
29
31
  acc2[key2] = {
30
32
  id: step.id,
31
33
  description: step.description,
32
- inputSchema: step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.inputSchema)) : void 0,
33
- outputSchema: step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.outputSchema)) : void 0,
34
- resumeSchema: step.resumeSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.resumeSchema)) : void 0,
35
- suspendSchema: step.suspendSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.suspendSchema)) : void 0
34
+ inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
35
+ outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
36
+ resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
37
+ suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
36
38
  };
37
39
  return acc2;
38
40
  }, {}),
39
41
  stepGraph: workflow.serializedStepGraph,
40
- inputSchema: workflow.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.inputSchema)) : void 0,
41
- outputSchema: workflow.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.outputSchema)) : void 0
42
+ inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
43
+ outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
42
44
  };
43
45
  return acc;
44
46
  }, {});
45
47
  return _workflows;
46
48
  } catch (error) {
47
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
49
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
48
50
  }
49
51
  }
50
52
  async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
51
53
  try {
52
54
  if (!workflowId) {
53
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
55
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
54
56
  }
55
57
  const workflow = mastra.vnext_getWorkflow(workflowId);
56
58
  if (!workflow) {
57
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
59
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
58
60
  }
59
61
  return {
60
62
  steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
61
63
  acc[key] = {
62
64
  id: step.id,
63
65
  description: step.description,
64
- inputSchema: step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.inputSchema)) : void 0,
65
- outputSchema: step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.outputSchema)) : void 0,
66
- resumeSchema: step.resumeSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.resumeSchema)) : void 0,
67
- suspendSchema: step.suspendSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.suspendSchema)) : void 0
66
+ inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
67
+ outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
68
+ resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
69
+ suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
68
70
  };
69
71
  return acc;
70
72
  }, {}),
71
73
  name: workflow.name,
72
74
  stepGraph: workflow.serializedStepGraph,
73
- inputSchema: workflow.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.inputSchema)) : void 0,
74
- outputSchema: workflow.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.outputSchema)) : void 0
75
+ inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
76
+ outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
75
77
  };
76
78
  } catch (error) {
77
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
79
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
78
80
  }
79
81
  }
80
82
  async function getVNextWorkflowRunByIdHandler({
@@ -84,22 +86,22 @@ async function getVNextWorkflowRunByIdHandler({
84
86
  }) {
85
87
  try {
86
88
  if (!workflowId) {
87
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
89
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
88
90
  }
89
91
  if (!runId) {
90
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Run ID is required" });
92
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
91
93
  }
92
94
  const workflow = mastra.vnext_getWorkflow(workflowId);
93
95
  if (!workflow) {
94
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
96
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
95
97
  }
96
98
  const run = await workflow.getWorkflowRunById(runId);
97
99
  if (!run) {
98
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
100
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
99
101
  }
100
102
  return run;
101
103
  } catch (error) {
102
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
104
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
103
105
  }
104
106
  }
105
107
  async function createVNextWorkflowRunHandler({
@@ -109,16 +111,16 @@ async function createVNextWorkflowRunHandler({
109
111
  }) {
110
112
  try {
111
113
  if (!workflowId) {
112
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
114
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
113
115
  }
114
116
  const workflow = mastra.vnext_getWorkflow(workflowId);
115
117
  if (!workflow) {
116
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
118
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
117
119
  }
118
120
  const run = workflow.createRun({ runId: prevRunId });
119
121
  return { runId: run.runId };
120
122
  } catch (error) {
121
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
123
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
122
124
  }
123
125
  }
124
126
  async function startAsyncVNextWorkflowHandler({
@@ -126,24 +128,29 @@ async function startAsyncVNextWorkflowHandler({
126
128
  runtimeContext,
127
129
  workflowId,
128
130
  runId,
129
- inputData
131
+ inputData,
132
+ runtimeContextFromRequest
130
133
  }) {
131
134
  try {
132
135
  if (!workflowId) {
133
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
136
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
134
137
  }
135
138
  const workflow = mastra.vnext_getWorkflow(workflowId);
136
139
  if (!workflow) {
137
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
140
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
138
141
  }
142
+ const finalRuntimeContext = new di.RuntimeContext([
143
+ ...Array.from(runtimeContext?.entries() ?? []),
144
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
145
+ ]);
139
146
  const _run = workflow.createRun({ runId });
140
147
  const result = await _run.start({
141
148
  inputData,
142
- runtimeContext
149
+ runtimeContext: finalRuntimeContext
143
150
  });
144
151
  return result;
145
152
  } catch (error) {
146
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
153
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
147
154
  }
148
155
  }
149
156
  async function startVNextWorkflowRunHandler({
@@ -151,28 +158,33 @@ async function startVNextWorkflowRunHandler({
151
158
  runtimeContext,
152
159
  workflowId,
153
160
  runId,
154
- inputData
161
+ inputData,
162
+ runtimeContextFromRequest
155
163
  }) {
156
164
  try {
157
165
  if (!workflowId) {
158
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
166
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
159
167
  }
160
168
  if (!runId) {
161
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to start run" });
169
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
162
170
  }
163
171
  const workflow = mastra.vnext_getWorkflow(workflowId);
164
172
  const run = await workflow.getWorkflowRunById(runId);
165
173
  if (!run) {
166
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
174
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
167
175
  }
176
+ const finalRuntimeContext = new di.RuntimeContext([
177
+ ...Array.from(runtimeContext?.entries() ?? []),
178
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
179
+ ]);
168
180
  const _run = workflow.createRun({ runId });
169
- await _run.start({
181
+ void _run.start({
170
182
  inputData,
171
- runtimeContext
183
+ runtimeContext: finalRuntimeContext
172
184
  });
173
185
  return { message: "Workflow run started" };
174
186
  } catch (e) {
175
- return chunkZLBRQFDD_cjs.handleError(e, "Error starting workflow run");
187
+ return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
176
188
  }
177
189
  }
178
190
  async function watchVNextWorkflowHandler({
@@ -182,15 +194,15 @@ async function watchVNextWorkflowHandler({
182
194
  }) {
183
195
  try {
184
196
  if (!workflowId) {
185
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
197
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
186
198
  }
187
199
  if (!runId) {
188
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to watch workflow" });
200
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
189
201
  }
190
202
  const workflow = mastra.vnext_getWorkflow(workflowId);
191
203
  const run = await workflow.getWorkflowRunById(runId);
192
204
  if (!run) {
193
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
205
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
194
206
  }
195
207
  const _run = workflow.createRun({ runId });
196
208
  let unwatch;
@@ -218,7 +230,7 @@ async function watchVNextWorkflowHandler({
218
230
  });
219
231
  return stream;
220
232
  } catch (error) {
221
- return chunkZLBRQFDD_cjs.handleError(error, "Error watching workflow");
233
+ return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
222
234
  }
223
235
  }
224
236
  async function resumeAsyncVNextWorkflowHandler({
@@ -226,32 +238,37 @@ async function resumeAsyncVNextWorkflowHandler({
226
238
  workflowId,
227
239
  runId,
228
240
  body,
229
- runtimeContext
241
+ runtimeContext,
242
+ runtimeContextFromRequest
230
243
  }) {
231
244
  try {
232
245
  if (!workflowId) {
233
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
246
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
234
247
  }
235
248
  if (!runId) {
236
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
249
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
237
250
  }
238
251
  if (!body.step) {
239
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "step required to resume workflow" });
252
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
240
253
  }
241
254
  const workflow = mastra.vnext_getWorkflow(workflowId);
242
255
  const run = await workflow.getWorkflowRunById(runId);
243
256
  if (!run) {
244
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
257
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
245
258
  }
259
+ const finalRuntimeContext = new di.RuntimeContext([
260
+ ...Array.from(runtimeContext?.entries() ?? []),
261
+ ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
262
+ ]);
246
263
  const _run = workflow.createRun({ runId });
247
264
  const result = await _run.resume({
248
265
  step: body.step,
249
266
  resumeData: body.resumeData,
250
- runtimeContext
267
+ runtimeContext: finalRuntimeContext
251
268
  });
252
269
  return result;
253
270
  } catch (error) {
254
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow step");
271
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
255
272
  }
256
273
  }
257
274
  async function resumeVNextWorkflowHandler({
@@ -263,28 +280,28 @@ async function resumeVNextWorkflowHandler({
263
280
  }) {
264
281
  try {
265
282
  if (!workflowId) {
266
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
283
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
267
284
  }
268
285
  if (!runId) {
269
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
286
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
270
287
  }
271
288
  if (!body.step) {
272
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "step required to resume workflow" });
289
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
273
290
  }
274
291
  const workflow = mastra.vnext_getWorkflow(workflowId);
275
292
  const run = await workflow.getWorkflowRunById(runId);
276
293
  if (!run) {
277
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
294
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
278
295
  }
279
296
  const _run = workflow.createRun({ runId });
280
- await _run.resume({
297
+ void _run.resume({
281
298
  step: body.step,
282
299
  resumeData: body.resumeData,
283
300
  runtimeContext
284
301
  });
285
302
  return { message: "Workflow run resumed" };
286
303
  } catch (error) {
287
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow");
304
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
288
305
  }
289
306
  }
290
307
  async function getVNextWorkflowRunsHandler({
@@ -298,7 +315,7 @@ async function getVNextWorkflowRunsHandler({
298
315
  }) {
299
316
  try {
300
317
  if (!workflowId) {
301
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
318
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
302
319
  }
303
320
  const workflow = mastra.vnext_getWorkflow(workflowId);
304
321
  const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
@@ -307,7 +324,7 @@ async function getVNextWorkflowRunsHandler({
307
324
  };
308
325
  return workflowRuns;
309
326
  } catch (error) {
310
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting workflow runs");
327
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
311
328
  }
312
329
  }
313
330
 
@@ -1,12 +1,13 @@
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
 
7
8
  // src/server/handlers/network.ts
8
9
  var network_exports = {};
9
- chunkFV45V6WC_cjs.__export(network_exports, {
10
+ chunk75ZPJI57_cjs.__export(network_exports, {
10
11
  generateHandler: () => generateHandler,
11
12
  getNetworkByIdHandler: () => getNetworkByIdHandler,
12
13
  getNetworksHandler: () => getNetworksHandler,
@@ -46,7 +47,7 @@ async function getNetworksHandler({
46
47
  );
47
48
  return serializedNetworks;
48
49
  } catch (error) {
49
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting networks");
50
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting networks");
50
51
  }
51
52
  }
52
53
  async function getNetworkByIdHandler({
@@ -61,7 +62,7 @@ async function getNetworkByIdHandler({
61
62
  return network2.formatAgentId(routingAgent2.name) === networkId;
62
63
  });
63
64
  if (!network) {
64
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Network not found" });
65
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
65
66
  }
66
67
  const routingAgent = network.getRoutingAgent();
67
68
  const routingLLM = await routingAgent.getLLM({ runtimeContext });
@@ -87,7 +88,7 @@ async function getNetworkByIdHandler({
87
88
  };
88
89
  return serializedNetwork;
89
90
  } catch (error) {
90
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting network by ID");
91
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting network by ID");
91
92
  }
92
93
  }
93
94
  async function generateHandler({
@@ -99,14 +100,14 @@ async function generateHandler({
99
100
  try {
100
101
  const network = mastra.getNetwork(networkId);
101
102
  if (!network) {
102
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Network not found" });
103
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
103
104
  }
104
- chunkQN4KF3BH_cjs.validateBody({ messages: body.messages });
105
+ chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
105
106
  const { messages, ...rest } = body;
106
107
  const result = await network.generate(messages, { ...rest, runtimeContext });
107
108
  return result;
108
109
  } catch (error) {
109
- return chunkZLBRQFDD_cjs.handleError(error, "Error generating from network");
110
+ return chunk64U3UDTH_cjs.handleError(error, "Error generating from network");
110
111
  }
111
112
  }
112
113
  async function streamGenerateHandler({
@@ -118,9 +119,9 @@ async function streamGenerateHandler({
118
119
  try {
119
120
  const network = mastra.getNetwork(networkId);
120
121
  if (!network) {
121
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Network not found" });
122
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
122
123
  }
123
- chunkQN4KF3BH_cjs.validateBody({ messages: body.messages });
124
+ chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
124
125
  const { messages, output, ...rest } = body;
125
126
  const streamResult = await network.stream(messages, {
126
127
  output,
@@ -136,7 +137,7 @@ async function streamGenerateHandler({
136
137
  });
137
138
  return streamResponse;
138
139
  } catch (error) {
139
- return chunkZLBRQFDD_cjs.handleError(error, "Error streaming from network");
140
+ return chunk64U3UDTH_cjs.handleError(error, "Error streaming from network");
140
141
  }
141
142
  }
142
143
 
@@ -1,7 +1,9 @@
1
- import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
- import { validateBody } from './chunk-L7XE5QTW.js';
3
- import { handleError } from './chunk-3AHQ5RGN.js';
4
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
1
+ import { stringify, esm_default } from './chunk-LIVAK2DM.js';
2
+ import { validateBody } from './chunk-H5PTF3Y4.js';
3
+ import { handleError } from './chunk-M5ABIP7D.js';
4
+ import { HTTPException } from './chunk-NYN7KFXL.js';
5
+ import { __export } from './chunk-MLKGABMK.js';
6
+ import { RuntimeContext } from '@mastra/core/runtime-context';
5
7
 
6
8
  // src/server/handlers/agents.ts
7
9
  var agents_exports = {};
@@ -30,11 +32,29 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
30
32
  };
31
33
  return acc;
32
34
  }, {});
35
+ let serializedAgentWorkflows = {};
36
+ if ("getWorkflows" in agent) {
37
+ const logger = mastra.getLogger();
38
+ try {
39
+ const workflows = await agent.getWorkflows({ runtimeContext });
40
+ serializedAgentWorkflows = Object.entries(workflows || {}).reduce((acc, [key, workflow]) => {
41
+ return {
42
+ ...acc,
43
+ [key]: {
44
+ name: workflow.name
45
+ }
46
+ };
47
+ }, {});
48
+ } catch (error) {
49
+ logger.error("Error getting workflows for agent", { agentName: agent.name, error });
50
+ }
51
+ }
33
52
  return {
34
53
  id,
35
54
  name: agent.name,
36
55
  instructions,
37
56
  tools: serializedAgentTools,
57
+ workflows: serializedAgentWorkflows,
38
58
  provider: llm?.getProvider(),
39
59
  modelId: llm?.getModelId()
40
60
  };
@@ -69,12 +89,30 @@ async function getAgentByIdHandler({
69
89
  };
70
90
  return acc;
71
91
  }, {});
92
+ let serializedAgentWorkflows = {};
93
+ if ("getWorkflows" in agent) {
94
+ const logger = mastra.getLogger();
95
+ try {
96
+ const workflows = await agent.getWorkflows({ runtimeContext });
97
+ serializedAgentWorkflows = Object.entries(workflows || {}).reduce((acc, [key, workflow]) => {
98
+ return {
99
+ ...acc,
100
+ [key]: {
101
+ name: workflow.name
102
+ }
103
+ };
104
+ }, {});
105
+ } catch (error) {
106
+ logger.error("Error getting workflows for agent", { agentName: agent.name, error });
107
+ }
108
+ }
72
109
  const instructions = await agent.getInstructions({ runtimeContext });
73
110
  const llm = await agent.getLLM({ runtimeContext });
74
111
  return {
75
112
  name: agent.name,
76
113
  instructions,
77
114
  tools: serializedAgentTools,
115
+ workflows: serializedAgentWorkflows,
78
116
  provider: llm?.getProvider(),
79
117
  modelId: llm?.getModelId()
80
118
  };
@@ -131,14 +169,18 @@ async function generateHandler({
131
169
  if (!agent) {
132
170
  throw new HTTPException(404, { message: "Agent not found" });
133
171
  }
134
- const { messages, resourceId, resourceid, ...rest } = body;
172
+ const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
135
173
  const finalResourceId = resourceId ?? resourceid;
174
+ const finalRuntimeContext = new RuntimeContext([
175
+ ...Array.from(runtimeContext.entries()),
176
+ ...Array.from(Object.entries(agentRuntimeContext ?? {}))
177
+ ]);
136
178
  validateBody({ messages });
137
179
  const result = await agent.generate(messages, {
138
180
  ...rest,
139
181
  // @ts-expect-error TODO fix types
140
182
  resourceId: finalResourceId,
141
- runtimeContext
183
+ runtimeContext: finalRuntimeContext
142
184
  });
143
185
  return result;
144
186
  } catch (error) {
@@ -156,14 +198,18 @@ async function streamGenerateHandler({
156
198
  if (!agent) {
157
199
  throw new HTTPException(404, { message: "Agent not found" });
158
200
  }
159
- const { messages, resourceId, resourceid, ...rest } = body;
201
+ const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
160
202
  const finalResourceId = resourceId ?? resourceid;
203
+ const finalRuntimeContext = new RuntimeContext([
204
+ ...Array.from(runtimeContext.entries()),
205
+ ...Array.from(Object.entries(agentRuntimeContext ?? {}))
206
+ ]);
161
207
  validateBody({ messages });
162
208
  const streamResult = await agent.stream(messages, {
163
209
  ...rest,
164
210
  // @ts-expect-error TODO fix types
165
211
  resourceId: finalResourceId,
166
- runtimeContext
212
+ runtimeContext: finalRuntimeContext
167
213
  });
168
214
  const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
169
215
  sendUsage: true,