@mastra/server 0.0.0-agui-20250501191909 → 0.0.0-ai-v5-20250625173645
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.
- package/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +303 -94
- package/dist/_tsup-dts-rollup.d.ts +303 -94
- package/dist/{chunk-5JNVY6DU.js → chunk-2HXKRRNS.js} +7 -5
- package/dist/{chunk-JPB6RPGB.js → chunk-3CSC35VL.js} +163 -46
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-ASKESBJW.cjs +2004 -0
- package/dist/chunk-B36R2PHA.js +504 -0
- package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
- package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-M3YJLWTU.js → chunk-CLYX4KLH.js} +63 -52
- package/dist/{chunk-RBQASTUP.js → chunk-EKDOJJMG.js} +26 -6
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/chunk-IMBY5XUG.cjs +86 -0
- package/dist/chunk-LFA7KZS6.cjs +276 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-2FJURXCL.cjs → chunk-NDAWJCUJ.cjs} +56 -36
- package/dist/{chunk-D3G23FP3.cjs → chunk-NGURCFEJ.cjs} +24 -22
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/chunk-QLG2PFHE.js +81 -0
- package/dist/{chunk-5YGDYMRB.cjs → chunk-QOHBG2JI.cjs} +22 -19
- package/dist/{chunk-Q6SHQECN.js → chunk-R5VGYBV6.js} +34 -10
- package/dist/{chunk-QJ3AHN64.js → chunk-SAR3AYOK.js} +12 -9
- package/dist/chunk-T7WA465P.cjs +512 -0
- package/dist/chunk-TGJMNUYJ.js +2001 -0
- package/dist/{chunk-Y3SV5XK4.js → chunk-WC7U7A6Y.js} +104 -17
- package/dist/chunk-WE32JG64.cjs +332 -0
- package/dist/chunk-WJY57THV.cjs +118 -0
- package/dist/chunk-XUTX4CAB.cjs +435 -0
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +21 -13
- package/dist/server/handlers/workflows.d.cts +4 -2
- package/dist/server/handlers/workflows.d.ts +4 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +32 -27
- package/dist/server/handlers.d.cts +2 -1
- package/dist/server/handlers.d.ts +2 -1
- package/dist/server/handlers.js +11 -10
- package/package.json +13 -12
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-4BIX6GMY.cjs +0 -189
- package/dist/chunk-55HTWX4C.cjs +0 -93
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-AELYAUEE.cjs +0 -316
- package/dist/chunk-EVCC233P.cjs +0 -321
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { stringify, esm_default } from './chunk-TGJMNUYJ.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/
|
|
7
|
-
var
|
|
8
|
-
__export(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
// src/server/handlers/workflows.ts
|
|
8
|
+
var workflows_exports = {};
|
|
9
|
+
__export(workflows_exports, {
|
|
10
|
+
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
11
|
+
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
12
|
+
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
13
|
+
getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
|
|
14
|
+
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
15
|
+
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
16
|
+
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
17
|
+
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
18
|
+
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
19
|
+
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
20
|
+
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
21
|
+
watchWorkflowHandler: () => watchWorkflowHandler
|
|
19
22
|
});
|
|
20
|
-
async function
|
|
23
|
+
async function getWorkflowsHandler({ mastra }) {
|
|
21
24
|
try {
|
|
22
|
-
const workflows = mastra.
|
|
25
|
+
const workflows = mastra.getWorkflows({ serialized: false });
|
|
23
26
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
24
27
|
acc[key] = {
|
|
25
28
|
name: workflow.name,
|
|
29
|
+
description: workflow.description,
|
|
26
30
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
27
31
|
acc2[key2] = {
|
|
28
32
|
id: step.id,
|
|
@@ -45,12 +49,46 @@ async function getVNextWorkflowsHandler({ mastra }) {
|
|
|
45
49
|
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
async function
|
|
52
|
+
async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
53
|
+
const logger = mastra.getLogger();
|
|
54
|
+
if (!workflowId) {
|
|
55
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
56
|
+
}
|
|
57
|
+
let workflow;
|
|
58
|
+
try {
|
|
59
|
+
workflow = mastra.getWorkflow(workflowId);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
logger.debug("Error getting workflow, searching agents for workflow", error);
|
|
62
|
+
}
|
|
63
|
+
if (!workflow) {
|
|
64
|
+
logger.debug("Workflow not found, searching agents for workflow", { workflowId });
|
|
65
|
+
const agents = mastra.getAgents();
|
|
66
|
+
if (Object.keys(agents || {}).length) {
|
|
67
|
+
for (const [_, agent] of Object.entries(agents)) {
|
|
68
|
+
try {
|
|
69
|
+
const workflows = await agent.getWorkflows();
|
|
70
|
+
if (workflows[workflowId]) {
|
|
71
|
+
workflow = workflows[workflowId];
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
logger.debug("Error getting workflow from agent", error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!workflow) {
|
|
82
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
83
|
+
}
|
|
84
|
+
return { workflow };
|
|
85
|
+
}
|
|
86
|
+
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
49
87
|
try {
|
|
50
88
|
if (!workflowId) {
|
|
51
89
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
52
90
|
}
|
|
53
|
-
const workflow = mastra
|
|
91
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
54
92
|
if (!workflow) {
|
|
55
93
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
56
94
|
}
|
|
@@ -67,6 +105,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
67
105
|
return acc;
|
|
68
106
|
}, {}),
|
|
69
107
|
name: workflow.name,
|
|
108
|
+
description: workflow.description,
|
|
70
109
|
stepGraph: workflow.serializedStepGraph,
|
|
71
110
|
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
72
111
|
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
@@ -75,7 +114,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
75
114
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
76
115
|
}
|
|
77
116
|
}
|
|
78
|
-
async function
|
|
117
|
+
async function getWorkflowRunByIdHandler({
|
|
79
118
|
mastra,
|
|
80
119
|
workflowId,
|
|
81
120
|
runId
|
|
@@ -87,11 +126,11 @@ async function getVNextWorkflowRunHandler({
|
|
|
87
126
|
if (!runId) {
|
|
88
127
|
throw new HTTPException(400, { message: "Run ID is required" });
|
|
89
128
|
}
|
|
90
|
-
const workflow = mastra
|
|
129
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
91
130
|
if (!workflow) {
|
|
92
131
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
93
132
|
}
|
|
94
|
-
const run = await workflow.
|
|
133
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
95
134
|
if (!run) {
|
|
96
135
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
97
136
|
}
|
|
@@ -100,7 +139,34 @@ async function getVNextWorkflowRunHandler({
|
|
|
100
139
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
101
140
|
}
|
|
102
141
|
}
|
|
103
|
-
async function
|
|
142
|
+
async function getWorkflowRunExecutionResultHandler({
|
|
143
|
+
mastra,
|
|
144
|
+
workflowId,
|
|
145
|
+
runId
|
|
146
|
+
}) {
|
|
147
|
+
try {
|
|
148
|
+
if (!workflowId) {
|
|
149
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
150
|
+
}
|
|
151
|
+
if (!runId) {
|
|
152
|
+
throw new HTTPException(400, { message: "Run ID is required" });
|
|
153
|
+
}
|
|
154
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
155
|
+
if (!workflow) {
|
|
156
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
157
|
+
}
|
|
158
|
+
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
159
|
+
if (!executionResult) {
|
|
160
|
+
throw new HTTPException(404, { message: "Workflow run execution result not found" });
|
|
161
|
+
}
|
|
162
|
+
return executionResult;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
throw new HTTPException(500, {
|
|
165
|
+
message: error?.message || "Error getting workflow run execution result"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function createWorkflowRunHandler({
|
|
104
170
|
mastra,
|
|
105
171
|
workflowId,
|
|
106
172
|
runId: prevRunId
|
|
@@ -109,7 +175,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
109
175
|
if (!workflowId) {
|
|
110
176
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
111
177
|
}
|
|
112
|
-
const workflow = mastra
|
|
178
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
113
179
|
if (!workflow) {
|
|
114
180
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
115
181
|
}
|
|
@@ -119,7 +185,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
119
185
|
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
120
186
|
}
|
|
121
187
|
}
|
|
122
|
-
async function
|
|
188
|
+
async function startAsyncWorkflowHandler({
|
|
123
189
|
mastra,
|
|
124
190
|
runtimeContext,
|
|
125
191
|
workflowId,
|
|
@@ -130,7 +196,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
130
196
|
if (!workflowId) {
|
|
131
197
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
132
198
|
}
|
|
133
|
-
const workflow = mastra
|
|
199
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
134
200
|
if (!workflow) {
|
|
135
201
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
136
202
|
}
|
|
@@ -144,7 +210,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
144
210
|
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
145
211
|
}
|
|
146
212
|
}
|
|
147
|
-
async function
|
|
213
|
+
async function startWorkflowRunHandler({
|
|
148
214
|
mastra,
|
|
149
215
|
runtimeContext,
|
|
150
216
|
workflowId,
|
|
@@ -158,13 +224,16 @@ async function startVNextWorkflowRunHandler({
|
|
|
158
224
|
if (!runId) {
|
|
159
225
|
throw new HTTPException(400, { message: "runId required to start run" });
|
|
160
226
|
}
|
|
161
|
-
const workflow = mastra
|
|
162
|
-
|
|
227
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
228
|
+
if (!workflow) {
|
|
229
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
230
|
+
}
|
|
231
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
163
232
|
if (!run) {
|
|
164
233
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
165
234
|
}
|
|
166
235
|
const _run = workflow.createRun({ runId });
|
|
167
|
-
|
|
236
|
+
void _run.start({
|
|
168
237
|
inputData,
|
|
169
238
|
runtimeContext
|
|
170
239
|
});
|
|
@@ -173,7 +242,7 @@ async function startVNextWorkflowRunHandler({
|
|
|
173
242
|
return handleError(e, "Error starting workflow run");
|
|
174
243
|
}
|
|
175
244
|
}
|
|
176
|
-
async function
|
|
245
|
+
async function watchWorkflowHandler({
|
|
177
246
|
mastra,
|
|
178
247
|
workflowId,
|
|
179
248
|
runId
|
|
@@ -185,8 +254,11 @@ async function watchVNextWorkflowHandler({
|
|
|
185
254
|
if (!runId) {
|
|
186
255
|
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
187
256
|
}
|
|
188
|
-
const workflow = mastra
|
|
189
|
-
|
|
257
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
258
|
+
if (!workflow) {
|
|
259
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
260
|
+
}
|
|
261
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
190
262
|
if (!run) {
|
|
191
263
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
192
264
|
}
|
|
@@ -219,7 +291,35 @@ async function watchVNextWorkflowHandler({
|
|
|
219
291
|
return handleError(error, "Error watching workflow");
|
|
220
292
|
}
|
|
221
293
|
}
|
|
222
|
-
async function
|
|
294
|
+
async function streamWorkflowHandler({
|
|
295
|
+
mastra,
|
|
296
|
+
runtimeContext,
|
|
297
|
+
workflowId,
|
|
298
|
+
runId,
|
|
299
|
+
inputData
|
|
300
|
+
}) {
|
|
301
|
+
try {
|
|
302
|
+
if (!workflowId) {
|
|
303
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
304
|
+
}
|
|
305
|
+
if (!runId) {
|
|
306
|
+
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
307
|
+
}
|
|
308
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
309
|
+
if (!workflow) {
|
|
310
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
311
|
+
}
|
|
312
|
+
const run = workflow.createRun({ runId });
|
|
313
|
+
const result = run.stream({
|
|
314
|
+
inputData,
|
|
315
|
+
runtimeContext
|
|
316
|
+
});
|
|
317
|
+
return result;
|
|
318
|
+
} catch (error) {
|
|
319
|
+
return handleError(error, "Error executing workflow");
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async function resumeAsyncWorkflowHandler({
|
|
223
323
|
mastra,
|
|
224
324
|
workflowId,
|
|
225
325
|
runId,
|
|
@@ -236,8 +336,11 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
236
336
|
if (!body.step) {
|
|
237
337
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
238
338
|
}
|
|
239
|
-
const workflow = mastra
|
|
240
|
-
|
|
339
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
340
|
+
if (!workflow) {
|
|
341
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
342
|
+
}
|
|
343
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
241
344
|
if (!run) {
|
|
242
345
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
243
346
|
}
|
|
@@ -252,7 +355,7 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
252
355
|
return handleError(error, "Error resuming workflow step");
|
|
253
356
|
}
|
|
254
357
|
}
|
|
255
|
-
async function
|
|
358
|
+
async function resumeWorkflowHandler({
|
|
256
359
|
mastra,
|
|
257
360
|
workflowId,
|
|
258
361
|
runId,
|
|
@@ -269,13 +372,16 @@ async function resumeVNextWorkflowHandler({
|
|
|
269
372
|
if (!body.step) {
|
|
270
373
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
271
374
|
}
|
|
272
|
-
const workflow = mastra
|
|
273
|
-
|
|
375
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
376
|
+
if (!workflow) {
|
|
377
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
378
|
+
}
|
|
379
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
274
380
|
if (!run) {
|
|
275
381
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
276
382
|
}
|
|
277
383
|
const _run = workflow.createRun({ runId });
|
|
278
|
-
|
|
384
|
+
void _run.resume({
|
|
279
385
|
step: body.step,
|
|
280
386
|
resumeData: body.resumeData,
|
|
281
387
|
runtimeContext
|
|
@@ -285,13 +391,24 @@ async function resumeVNextWorkflowHandler({
|
|
|
285
391
|
return handleError(error, "Error resuming workflow");
|
|
286
392
|
}
|
|
287
393
|
}
|
|
288
|
-
async function
|
|
394
|
+
async function getWorkflowRunsHandler({
|
|
395
|
+
mastra,
|
|
396
|
+
workflowId,
|
|
397
|
+
fromDate,
|
|
398
|
+
toDate,
|
|
399
|
+
limit,
|
|
400
|
+
offset,
|
|
401
|
+
resourceId
|
|
402
|
+
}) {
|
|
289
403
|
try {
|
|
290
404
|
if (!workflowId) {
|
|
291
405
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
292
406
|
}
|
|
293
|
-
const workflow = mastra
|
|
294
|
-
|
|
407
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
408
|
+
if (!workflow) {
|
|
409
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
410
|
+
}
|
|
411
|
+
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
295
412
|
runs: [],
|
|
296
413
|
total: 0
|
|
297
414
|
};
|
|
@@ -301,4 +418,4 @@ async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
|
|
|
301
418
|
}
|
|
302
419
|
}
|
|
303
420
|
|
|
304
|
-
export {
|
|
421
|
+
export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { handleError } from './chunk-
|
|
2
|
-
import {
|
|
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/vector.ts
|
|
5
6
|
var vector_exports = {};
|
|
@@ -90,7 +91,7 @@ async function describeIndex({
|
|
|
90
91
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
91
92
|
}
|
|
92
93
|
const vector = getVector(mastra, vectorName);
|
|
93
|
-
const stats = await vector.describeIndex(indexName);
|
|
94
|
+
const stats = await vector.describeIndex({ indexName });
|
|
94
95
|
return {
|
|
95
96
|
dimension: stats.dimension,
|
|
96
97
|
count: stats.count,
|
|
@@ -110,7 +111,7 @@ async function deleteIndex({
|
|
|
110
111
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
111
112
|
}
|
|
112
113
|
const vector = getVector(mastra, vectorName);
|
|
113
|
-
await vector.deleteIndex(indexName);
|
|
114
|
+
await vector.deleteIndex({ indexName });
|
|
114
115
|
return { success: true };
|
|
115
116
|
} catch (error) {
|
|
116
117
|
return handleError(error, "Error deleting index");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server/handlers/utils.ts
|
|
6
6
|
function validateBody(body) {
|
|
@@ -11,7 +11,7 @@ function validateBody(body) {
|
|
|
11
11
|
return acc;
|
|
12
12
|
}, {});
|
|
13
13
|
if (Object.keys(errorResponse).length > 0) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server/handlers/error.ts
|
|
6
6
|
function handleError(error, defaultMessage) {
|
|
7
7
|
const apiError = error;
|
|
8
|
-
throw new
|
|
8
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(apiError.status || 500, {
|
|
9
9
|
message: apiError.message || defaultMessage
|
|
10
10
|
});
|
|
11
11
|
}
|