@mastra/server 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-tool-call-parts-20250630193309
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/dist/_tsup-dts-rollup.d.cts +252 -35
- package/dist/_tsup-dts-rollup.d.ts +252 -35
- package/dist/{chunk-J3PKLB3A.js → chunk-2BCWG3EZ.js} +52 -13
- package/dist/{chunk-KUNQFY2W.js → chunk-72LOJGUV.js} +106 -50
- package/dist/{chunk-W7VCKPAD.js → chunk-E2LP4J6K.js} +2 -2
- package/dist/{chunk-A3KDUGS7.cjs → chunk-EP3XVEVC.cjs} +56 -17
- package/dist/{chunk-TJKLBTFB.js → chunk-EWLR2PNT.js} +7 -17
- package/dist/{chunk-NEOOQUKW.cjs → chunk-IMBY5XUG.cjs} +36 -4
- package/dist/{chunk-MMO2HDM6.cjs → chunk-L3VURYKY.cjs} +117 -60
- package/dist/{chunk-YWLUOY3D.cjs → chunk-LI436ITD.cjs} +107 -69
- package/dist/{chunk-LIVAK2DM.js → chunk-MEGCYGBU.js} +108 -70
- package/dist/{chunk-YIOVBYZH.cjs → chunk-NGHSYB5B.cjs} +7 -7
- package/dist/{chunk-DQLE3DVM.js → chunk-QLG2PFHE.js} +36 -4
- package/dist/{chunk-CP55EVBK.js → chunk-R5VGYBV6.js} +12 -8
- package/dist/{chunk-Y7UWRW5X.cjs → chunk-RQ2Z56EC.cjs} +51 -21
- package/dist/{chunk-CMMOIUFC.cjs → chunk-WJY57THV.cjs} +12 -8
- package/dist/{chunk-DJJIUEL2.js → chunk-XUIJ7WRT.js} +51 -21
- package/dist/{chunk-ZE5AAC4I.cjs → chunk-Z3PTO2AK.cjs} +11 -21
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- 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/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +16 -12
- package/dist/server/handlers/workflows.d.cts +1 -0
- package/dist/server/handlers/workflows.d.ts +1 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +14 -14
- package/dist/server/handlers.js +7 -7
- package/package.json +12 -13
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
|
|
4
4
|
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
5
|
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
7
|
var web = require('stream/web');
|
|
8
|
-
var di = require('@mastra/core/di');
|
|
9
8
|
|
|
10
9
|
// src/server/handlers/workflows.ts
|
|
11
10
|
var workflows_exports = {};
|
|
@@ -13,6 +12,7 @@ chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
|
13
12
|
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
14
13
|
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
15
14
|
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
15
|
+
getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
|
|
16
16
|
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
17
17
|
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
18
18
|
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
@@ -33,16 +33,16 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
33
33
|
acc2[key2] = {
|
|
34
34
|
id: step.id,
|
|
35
35
|
description: step.description,
|
|
36
|
-
inputSchema: step.inputSchema ?
|
|
37
|
-
outputSchema: step.outputSchema ?
|
|
38
|
-
resumeSchema: step.resumeSchema ?
|
|
39
|
-
suspendSchema: step.suspendSchema ?
|
|
36
|
+
inputSchema: step.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.inputSchema)) : void 0,
|
|
37
|
+
outputSchema: step.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.outputSchema)) : void 0,
|
|
38
|
+
resumeSchema: step.resumeSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
39
|
+
suspendSchema: step.suspendSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.suspendSchema)) : void 0
|
|
40
40
|
};
|
|
41
41
|
return acc2;
|
|
42
42
|
}, {}),
|
|
43
43
|
stepGraph: workflow.serializedStepGraph,
|
|
44
|
-
inputSchema: workflow.inputSchema ?
|
|
45
|
-
outputSchema: workflow.outputSchema ?
|
|
44
|
+
inputSchema: workflow.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
45
|
+
outputSchema: workflow.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
46
46
|
};
|
|
47
47
|
return acc;
|
|
48
48
|
}, {});
|
|
@@ -51,12 +51,46 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
51
51
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
55
|
+
const logger = mastra.getLogger();
|
|
56
|
+
if (!workflowId) {
|
|
57
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
|
+
}
|
|
59
|
+
let workflow;
|
|
60
|
+
try {
|
|
61
|
+
workflow = mastra.getWorkflow(workflowId);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
logger.debug("Error getting workflow, searching agents for workflow", error);
|
|
64
|
+
}
|
|
65
|
+
if (!workflow) {
|
|
66
|
+
logger.debug("Workflow not found, searching agents for workflow", { workflowId });
|
|
67
|
+
const agents = mastra.getAgents();
|
|
68
|
+
if (Object.keys(agents || {}).length) {
|
|
69
|
+
for (const [_, agent] of Object.entries(agents)) {
|
|
70
|
+
try {
|
|
71
|
+
const workflows = await agent.getWorkflows();
|
|
72
|
+
if (workflows[workflowId]) {
|
|
73
|
+
workflow = workflows[workflowId];
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
logger.debug("Error getting workflow from agent", error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!workflow) {
|
|
84
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
85
|
+
}
|
|
86
|
+
return { workflow };
|
|
87
|
+
}
|
|
54
88
|
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
55
89
|
try {
|
|
56
90
|
if (!workflowId) {
|
|
57
91
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
92
|
}
|
|
59
|
-
const workflow = mastra
|
|
93
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
60
94
|
if (!workflow) {
|
|
61
95
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
62
96
|
}
|
|
@@ -65,18 +99,18 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
65
99
|
acc[key] = {
|
|
66
100
|
id: step.id,
|
|
67
101
|
description: step.description,
|
|
68
|
-
inputSchema: step.inputSchema ?
|
|
69
|
-
outputSchema: step.outputSchema ?
|
|
70
|
-
resumeSchema: step.resumeSchema ?
|
|
71
|
-
suspendSchema: step.suspendSchema ?
|
|
102
|
+
inputSchema: step.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.inputSchema)) : void 0,
|
|
103
|
+
outputSchema: step.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.outputSchema)) : void 0,
|
|
104
|
+
resumeSchema: step.resumeSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
105
|
+
suspendSchema: step.suspendSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(step.suspendSchema)) : void 0
|
|
72
106
|
};
|
|
73
107
|
return acc;
|
|
74
108
|
}, {}),
|
|
75
109
|
name: workflow.name,
|
|
76
110
|
description: workflow.description,
|
|
77
111
|
stepGraph: workflow.serializedStepGraph,
|
|
78
|
-
inputSchema: workflow.inputSchema ?
|
|
79
|
-
outputSchema: workflow.outputSchema ?
|
|
112
|
+
inputSchema: workflow.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
113
|
+
outputSchema: workflow.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
80
114
|
};
|
|
81
115
|
} catch (error) {
|
|
82
116
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
@@ -94,7 +128,7 @@ async function getWorkflowRunByIdHandler({
|
|
|
94
128
|
if (!runId) {
|
|
95
129
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
96
130
|
}
|
|
97
|
-
const workflow = mastra
|
|
131
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
98
132
|
if (!workflow) {
|
|
99
133
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
100
134
|
}
|
|
@@ -107,6 +141,33 @@ async function getWorkflowRunByIdHandler({
|
|
|
107
141
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
108
142
|
}
|
|
109
143
|
}
|
|
144
|
+
async function getWorkflowRunExecutionResultHandler({
|
|
145
|
+
mastra,
|
|
146
|
+
workflowId,
|
|
147
|
+
runId
|
|
148
|
+
}) {
|
|
149
|
+
try {
|
|
150
|
+
if (!workflowId) {
|
|
151
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
152
|
+
}
|
|
153
|
+
if (!runId) {
|
|
154
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
155
|
+
}
|
|
156
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
157
|
+
if (!workflow) {
|
|
158
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
159
|
+
}
|
|
160
|
+
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
161
|
+
if (!executionResult) {
|
|
162
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
|
|
163
|
+
}
|
|
164
|
+
return executionResult;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, {
|
|
167
|
+
message: error?.message || "Error getting workflow run execution result"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
110
171
|
async function createWorkflowRunHandler({
|
|
111
172
|
mastra,
|
|
112
173
|
workflowId,
|
|
@@ -116,11 +177,11 @@ async function createWorkflowRunHandler({
|
|
|
116
177
|
if (!workflowId) {
|
|
117
178
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
118
179
|
}
|
|
119
|
-
const workflow = mastra
|
|
180
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
120
181
|
if (!workflow) {
|
|
121
182
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
122
183
|
}
|
|
123
|
-
const run = workflow.
|
|
184
|
+
const run = await workflow.createRunAsync({ runId: prevRunId });
|
|
124
185
|
return { runId: run.runId };
|
|
125
186
|
} catch (error) {
|
|
126
187
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
@@ -131,25 +192,20 @@ async function startAsyncWorkflowHandler({
|
|
|
131
192
|
runtimeContext,
|
|
132
193
|
workflowId,
|
|
133
194
|
runId,
|
|
134
|
-
inputData
|
|
135
|
-
runtimeContextFromRequest
|
|
195
|
+
inputData
|
|
136
196
|
}) {
|
|
137
197
|
try {
|
|
138
198
|
if (!workflowId) {
|
|
139
199
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
140
200
|
}
|
|
141
|
-
const workflow = mastra
|
|
201
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
142
202
|
if (!workflow) {
|
|
143
203
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
144
204
|
}
|
|
145
|
-
const
|
|
146
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
147
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
148
|
-
]);
|
|
149
|
-
const _run = workflow.createRun({ runId });
|
|
205
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
150
206
|
const result = await _run.start({
|
|
151
207
|
inputData,
|
|
152
|
-
runtimeContext
|
|
208
|
+
runtimeContext
|
|
153
209
|
});
|
|
154
210
|
return result;
|
|
155
211
|
} catch (error) {
|
|
@@ -161,8 +217,7 @@ async function startWorkflowRunHandler({
|
|
|
161
217
|
runtimeContext,
|
|
162
218
|
workflowId,
|
|
163
219
|
runId,
|
|
164
|
-
inputData
|
|
165
|
-
runtimeContextFromRequest
|
|
220
|
+
inputData
|
|
166
221
|
}) {
|
|
167
222
|
try {
|
|
168
223
|
if (!workflowId) {
|
|
@@ -171,19 +226,18 @@ async function startWorkflowRunHandler({
|
|
|
171
226
|
if (!runId) {
|
|
172
227
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
173
228
|
}
|
|
174
|
-
const workflow = mastra
|
|
229
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
230
|
+
if (!workflow) {
|
|
231
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
232
|
+
}
|
|
175
233
|
const run = await workflow.getWorkflowRunById(runId);
|
|
176
234
|
if (!run) {
|
|
177
235
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
178
236
|
}
|
|
179
|
-
const
|
|
180
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
181
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
182
|
-
]);
|
|
183
|
-
const _run = workflow.createRun({ runId });
|
|
237
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
184
238
|
void _run.start({
|
|
185
239
|
inputData,
|
|
186
|
-
runtimeContext
|
|
240
|
+
runtimeContext
|
|
187
241
|
});
|
|
188
242
|
return { message: "Workflow run started" };
|
|
189
243
|
} catch (e) {
|
|
@@ -202,12 +256,15 @@ async function watchWorkflowHandler({
|
|
|
202
256
|
if (!runId) {
|
|
203
257
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
204
258
|
}
|
|
205
|
-
const workflow = mastra
|
|
259
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
260
|
+
if (!workflow) {
|
|
261
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
262
|
+
}
|
|
206
263
|
const run = await workflow.getWorkflowRunById(runId);
|
|
207
264
|
if (!run) {
|
|
208
265
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
209
266
|
}
|
|
210
|
-
const _run = workflow.
|
|
267
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
211
268
|
let unwatch;
|
|
212
269
|
let asyncRef = null;
|
|
213
270
|
const stream = new web.ReadableStream({
|
|
@@ -236,13 +293,12 @@ async function watchWorkflowHandler({
|
|
|
236
293
|
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
237
294
|
}
|
|
238
295
|
}
|
|
239
|
-
function streamWorkflowHandler({
|
|
296
|
+
async function streamWorkflowHandler({
|
|
240
297
|
mastra,
|
|
241
298
|
runtimeContext,
|
|
242
299
|
workflowId,
|
|
243
300
|
runId,
|
|
244
|
-
inputData
|
|
245
|
-
runtimeContextFromRequest
|
|
301
|
+
inputData
|
|
246
302
|
}) {
|
|
247
303
|
try {
|
|
248
304
|
if (!workflowId) {
|
|
@@ -251,18 +307,14 @@ function streamWorkflowHandler({
|
|
|
251
307
|
if (!runId) {
|
|
252
308
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
253
309
|
}
|
|
254
|
-
const workflow = mastra
|
|
310
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
255
311
|
if (!workflow) {
|
|
256
312
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
257
313
|
}
|
|
258
|
-
const
|
|
259
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
260
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
261
|
-
]);
|
|
262
|
-
const run = workflow.createRun({ runId });
|
|
314
|
+
const run = await workflow.createRunAsync({ runId });
|
|
263
315
|
const result = run.stream({
|
|
264
316
|
inputData,
|
|
265
|
-
runtimeContext
|
|
317
|
+
runtimeContext
|
|
266
318
|
});
|
|
267
319
|
return result;
|
|
268
320
|
} catch (error) {
|
|
@@ -274,8 +326,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
274
326
|
workflowId,
|
|
275
327
|
runId,
|
|
276
328
|
body,
|
|
277
|
-
runtimeContext
|
|
278
|
-
runtimeContextFromRequest
|
|
329
|
+
runtimeContext
|
|
279
330
|
}) {
|
|
280
331
|
try {
|
|
281
332
|
if (!workflowId) {
|
|
@@ -287,20 +338,19 @@ async function resumeAsyncWorkflowHandler({
|
|
|
287
338
|
if (!body.step) {
|
|
288
339
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
289
340
|
}
|
|
290
|
-
const workflow = mastra
|
|
341
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
342
|
+
if (!workflow) {
|
|
343
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
344
|
+
}
|
|
291
345
|
const run = await workflow.getWorkflowRunById(runId);
|
|
292
346
|
if (!run) {
|
|
293
347
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
294
348
|
}
|
|
295
|
-
const
|
|
296
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
297
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
298
|
-
]);
|
|
299
|
-
const _run = workflow.createRun({ runId });
|
|
349
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
300
350
|
const result = await _run.resume({
|
|
301
351
|
step: body.step,
|
|
302
352
|
resumeData: body.resumeData,
|
|
303
|
-
runtimeContext
|
|
353
|
+
runtimeContext
|
|
304
354
|
});
|
|
305
355
|
return result;
|
|
306
356
|
} catch (error) {
|
|
@@ -324,12 +374,15 @@ async function resumeWorkflowHandler({
|
|
|
324
374
|
if (!body.step) {
|
|
325
375
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
326
376
|
}
|
|
327
|
-
const workflow = mastra
|
|
377
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
378
|
+
if (!workflow) {
|
|
379
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
380
|
+
}
|
|
328
381
|
const run = await workflow.getWorkflowRunById(runId);
|
|
329
382
|
if (!run) {
|
|
330
383
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
331
384
|
}
|
|
332
|
-
const _run = workflow.
|
|
385
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
333
386
|
void _run.resume({
|
|
334
387
|
step: body.step,
|
|
335
388
|
resumeData: body.resumeData,
|
|
@@ -353,7 +406,10 @@ async function getWorkflowRunsHandler({
|
|
|
353
406
|
if (!workflowId) {
|
|
354
407
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
355
408
|
}
|
|
356
|
-
const workflow = mastra
|
|
409
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
410
|
+
if (!workflow) {
|
|
411
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
412
|
+
}
|
|
357
413
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
358
414
|
runs: [],
|
|
359
415
|
total: 0
|
|
@@ -367,6 +423,7 @@ async function getWorkflowRunsHandler({
|
|
|
367
423
|
exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
368
424
|
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
369
425
|
exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
|
|
426
|
+
exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
|
|
370
427
|
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
371
428
|
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
372
429
|
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|