@mastra/server 0.0.0-playground-studio-cloud-20251031080052 → 0.0.0-playground-studio-again-20251114102707
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/CHANGELOG.md +685 -3
- package/README.md +1 -1
- package/dist/{chunk-7HCPO76Z.js → chunk-2IS5WICF.js} +4505 -1017
- package/dist/chunk-2IS5WICF.js.map +1 -0
- package/dist/{chunk-SPRRK3P7.cjs → chunk-2YZH5PH6.cjs} +47 -47
- package/dist/chunk-2YZH5PH6.cjs.map +1 -0
- package/dist/{chunk-BATEJLED.js → chunk-3AMNUUZF.js} +20 -20
- package/dist/chunk-3AMNUUZF.js.map +1 -0
- package/dist/{chunk-AW5BU3RQ.js → chunk-3F52QCI4.js} +40 -40
- package/dist/chunk-3F52QCI4.js.map +1 -0
- package/dist/{chunk-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
- package/dist/chunk-64ITUOXI.cjs.map +1 -0
- package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
- package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
- package/dist/{chunk-ABRFV4XP.js → chunk-73PAWDM5.js} +13 -13
- package/dist/chunk-73PAWDM5.js.map +1 -0
- package/dist/{chunk-2S4IMB6E.cjs → chunk-A24TSVEZ.cjs} +39 -39
- package/dist/chunk-A24TSVEZ.cjs.map +1 -0
- package/dist/{chunk-QQXMIP6C.js → chunk-B3Z6J745.js} +17 -17
- package/dist/chunk-B3Z6J745.js.map +1 -0
- package/dist/{chunk-G4PUALCE.cjs → chunk-BTWIR2B7.cjs} +4 -4
- package/dist/{chunk-G4PUALCE.cjs.map → chunk-BTWIR2B7.cjs.map} +1 -1
- package/dist/{chunk-KSFLUEWV.js → chunk-D7T74TVR.js} +4 -5
- package/dist/chunk-D7T74TVR.js.map +1 -0
- package/dist/{chunk-YSHNCC6F.cjs → chunk-EHACNWDL.cjs} +169 -201
- package/dist/chunk-EHACNWDL.cjs.map +1 -0
- package/dist/{chunk-MN2TZQ7I.js → chunk-FPBYKMIS.js} +13 -13
- package/dist/chunk-FPBYKMIS.js.map +1 -0
- package/dist/{chunk-3SNGNFUJ.cjs → chunk-GLAZTMX3.cjs} +37 -37
- package/dist/chunk-GLAZTMX3.cjs.map +1 -0
- package/dist/{chunk-KDUHLUK4.cjs → chunk-ID6JYDNL.cjs} +4387 -896
- package/dist/chunk-ID6JYDNL.cjs.map +1 -0
- package/dist/{chunk-TRGAMKHX.cjs → chunk-KF3RI45U.cjs} +46 -41
- package/dist/chunk-KF3RI45U.cjs.map +1 -0
- package/dist/{chunk-K5T5A3AL.cjs → chunk-KJIDZQRA.cjs} +14 -14
- package/dist/chunk-KJIDZQRA.cjs.map +1 -0
- package/dist/{chunk-MYR4PVGN.js → chunk-KWH5QBXP.js} +4 -4
- package/dist/{chunk-MYR4PVGN.js.map → chunk-KWH5QBXP.js.map} +1 -1
- package/dist/{chunk-AHB4JCIQ.js → chunk-ND5OKOMT.js} +31 -26
- package/dist/chunk-ND5OKOMT.js.map +1 -0
- package/dist/{chunk-XN74I6VW.cjs → chunk-PPMIB3FQ.cjs} +20 -20
- package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
- package/dist/{chunk-EP3JQDPD.cjs → chunk-S54HNARD.cjs} +18 -18
- package/dist/{chunk-EP3JQDPD.cjs.map → chunk-S54HNARD.cjs.map} +1 -1
- package/dist/{chunk-4QCXUEAT.js → chunk-SZIFSF4T.js} +3 -3
- package/dist/{chunk-4QCXUEAT.js.map → chunk-SZIFSF4T.js.map} +1 -1
- package/dist/{chunk-Y7SH5ZKM.cjs → chunk-U7GLIXYO.cjs} +157 -172
- package/dist/chunk-U7GLIXYO.cjs.map +1 -0
- package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
- package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
- package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
- package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
- package/dist/{chunk-OGK26QPW.js → chunk-V6JYJS7O.js} +109 -123
- package/dist/chunk-V6JYJS7O.js.map +1 -0
- package/dist/{chunk-CJFKRVED.cjs → chunk-W2KMU354.cjs} +4 -5
- package/dist/chunk-W2KMU354.cjs.map +1 -0
- package/dist/{chunk-B7QWVGQQ.cjs → chunk-X3MICMI2.cjs} +140 -249
- package/dist/chunk-X3MICMI2.cjs.map +1 -0
- package/dist/{chunk-6VPAV4ZV.js → chunk-Z2O5YVHY.js} +134 -165
- package/dist/chunk-Z2O5YVHY.js.map +1 -0
- package/dist/{chunk-ZLBL4NQC.js → chunk-ZJ6KEY6H.js} +67 -174
- package/dist/chunk-ZJ6KEY6H.js.map +1 -0
- package/dist/server/handlers/a2a.cjs +7 -7
- package/dist/server/handlers/a2a.d.ts +10 -10
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +31 -19
- package/dist/server/handlers/agent-builder.d.ts +38 -47
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +25 -29
- package/dist/server/handlers/agents.d.ts +41 -55
- package/dist/server/handlers/agents.d.ts.map +1 -1
- 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/logs.cjs +7 -7
- package/dist/server/handlers/logs.d.ts +3 -3
- package/dist/server/handlers/logs.d.ts.map +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +19 -23
- package/dist/server/handlers/memory.d.ts +30 -35
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +8 -8
- package/dist/server/handlers/observability.d.ts +12 -12
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/scores.cjs +11 -11
- package/dist/server/handlers/scores.d.ts +24 -24
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +7 -7
- package/dist/server/handlers/tools.d.ts +8 -8
- package/dist/server/handlers/tools.d.ts.map +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +3 -3
- 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 +5 -5
- package/dist/server/handlers/voice.d.ts +6 -6
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +21 -29
- package/dist/server/handlers/workflows.d.ts +27 -36
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +23 -28
- package/dist/server/handlers.d.ts +0 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +11 -12
- package/dist/server/http-exception.d.ts +0 -5
- package/dist/server/http-exception.d.ts.map +1 -1
- package/dist/server/utils.d.ts +3 -2
- package/dist/server/utils.d.ts.map +1 -1
- package/package.json +13 -8
- package/dist/chunk-2S4IMB6E.cjs.map +0 -1
- package/dist/chunk-3SNGNFUJ.cjs.map +0 -1
- package/dist/chunk-6VPAV4ZV.js.map +0 -1
- package/dist/chunk-7HCPO76Z.js.map +0 -1
- package/dist/chunk-ABRFV4XP.js.map +0 -1
- package/dist/chunk-AHB4JCIQ.js.map +0 -1
- package/dist/chunk-AW5BU3RQ.js.map +0 -1
- package/dist/chunk-B7QWVGQQ.cjs.map +0 -1
- package/dist/chunk-BATEJLED.js.map +0 -1
- package/dist/chunk-CJFKRVED.cjs.map +0 -1
- package/dist/chunk-I3C4ODGV.cjs +0 -335
- package/dist/chunk-I3C4ODGV.cjs.map +0 -1
- package/dist/chunk-K5T5A3AL.cjs.map +0 -1
- package/dist/chunk-KDUHLUK4.cjs.map +0 -1
- package/dist/chunk-KSFLUEWV.js.map +0 -1
- package/dist/chunk-LLUOPR3J.js +0 -323
- package/dist/chunk-LLUOPR3J.js.map +0 -1
- package/dist/chunk-MMROOK5J.js.map +0 -1
- package/dist/chunk-MN2TZQ7I.js.map +0 -1
- package/dist/chunk-OGK26QPW.js.map +0 -1
- package/dist/chunk-QQXMIP6C.js.map +0 -1
- package/dist/chunk-SPRRK3P7.cjs.map +0 -1
- package/dist/chunk-TRGAMKHX.cjs.map +0 -1
- package/dist/chunk-XN74I6VW.cjs.map +0 -1
- package/dist/chunk-Y7SH5ZKM.cjs.map +0 -1
- package/dist/chunk-YSHNCC6F.cjs.map +0 -1
- package/dist/chunk-ZLBL4NQC.js.map +0 -1
- package/dist/server/handlers/legacyWorkflows.cjs +0 -48
- package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
- package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
- package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
- package/dist/server/handlers/legacyWorkflows.js +0 -3
- package/dist/server/handlers/legacyWorkflows.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkW2KMU354_cjs = require('./chunk-W2KMU354.cjs');
|
|
4
|
+
var chunkV5WWQN7P_cjs = require('./chunk-V5WWQN7P.cjs');
|
|
5
|
+
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
|
|
6
6
|
var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
|
|
7
7
|
var web = require('stream/web');
|
|
8
8
|
|
|
@@ -14,55 +14,53 @@ chunkO7I5CWRX_cjs.__export(workflows_exports, {
|
|
|
14
14
|
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
15
15
|
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
16
16
|
getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
listWorkflowRunsHandler: () => listWorkflowRunsHandler,
|
|
18
|
+
listWorkflowsHandler: () => listWorkflowsHandler,
|
|
19
19
|
observeStreamLegacyWorkflowHandler: () => observeStreamLegacyWorkflowHandler,
|
|
20
20
|
observeStreamVNextWorkflowHandler: () => observeStreamVNextWorkflowHandler,
|
|
21
21
|
observeStreamWorkflowHandler: () => observeStreamWorkflowHandler,
|
|
22
22
|
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
23
23
|
resumeStreamWorkflowHandler: () => resumeStreamWorkflowHandler,
|
|
24
24
|
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
25
|
-
sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
|
|
26
25
|
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
27
26
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
28
27
|
streamLegacyWorkflowHandler: () => streamLegacyWorkflowHandler,
|
|
29
28
|
streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
|
|
30
|
-
streamWorkflowHandler: () => streamWorkflowHandler
|
|
31
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
29
|
+
streamWorkflowHandler: () => streamWorkflowHandler
|
|
32
30
|
});
|
|
33
|
-
async function
|
|
31
|
+
async function listWorkflowsHandler({ mastra }) {
|
|
34
32
|
try {
|
|
35
|
-
const workflows = mastra.
|
|
33
|
+
const workflows = mastra.listWorkflows({ serialized: false });
|
|
36
34
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
37
|
-
acc[key] =
|
|
35
|
+
acc[key] = chunkW2KMU354_cjs.getWorkflowInfo(workflow);
|
|
38
36
|
return acc;
|
|
39
37
|
}, {});
|
|
40
38
|
return _workflows;
|
|
41
39
|
} catch (error) {
|
|
42
|
-
return
|
|
40
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflows");
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
|
-
async function
|
|
43
|
+
async function listWorkflowsFromSystem({ mastra, workflowId }) {
|
|
46
44
|
const logger = mastra.getLogger();
|
|
47
45
|
if (!workflowId) {
|
|
48
|
-
throw new
|
|
46
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
49
47
|
}
|
|
50
48
|
let workflow;
|
|
51
|
-
workflow =
|
|
49
|
+
workflow = chunkW2KMU354_cjs.WorkflowRegistry.getWorkflow(workflowId);
|
|
52
50
|
if (!workflow) {
|
|
53
51
|
try {
|
|
54
|
-
workflow = mastra.
|
|
52
|
+
workflow = mastra.getWorkflowById(workflowId);
|
|
55
53
|
} catch (error) {
|
|
56
54
|
logger.debug("Error getting workflow, searching agents for workflow", error);
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
if (!workflow) {
|
|
60
58
|
logger.debug("Workflow not found, searching agents for workflow", { workflowId });
|
|
61
|
-
const agents = mastra.
|
|
59
|
+
const agents = mastra.listAgents();
|
|
62
60
|
if (Object.keys(agents || {}).length) {
|
|
63
61
|
for (const [_, agent] of Object.entries(agents)) {
|
|
64
62
|
try {
|
|
65
|
-
const workflows = await agent.
|
|
63
|
+
const workflows = await agent.listWorkflows();
|
|
66
64
|
if (workflows[workflowId]) {
|
|
67
65
|
workflow = workflows[workflowId];
|
|
68
66
|
break;
|
|
@@ -75,22 +73,22 @@ async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
if (!workflow) {
|
|
78
|
-
throw new
|
|
76
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
79
77
|
}
|
|
80
78
|
return { workflow };
|
|
81
79
|
}
|
|
82
80
|
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
83
81
|
try {
|
|
84
82
|
if (!workflowId) {
|
|
85
|
-
throw new
|
|
83
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
86
84
|
}
|
|
87
|
-
const { workflow } = await
|
|
85
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
88
86
|
if (!workflow) {
|
|
89
|
-
throw new
|
|
87
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
90
88
|
}
|
|
91
|
-
return
|
|
89
|
+
return chunkW2KMU354_cjs.getWorkflowInfo(workflow);
|
|
92
90
|
} catch (error) {
|
|
93
|
-
return
|
|
91
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow");
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
async function getWorkflowRunByIdHandler({
|
|
@@ -100,22 +98,22 @@ async function getWorkflowRunByIdHandler({
|
|
|
100
98
|
}) {
|
|
101
99
|
try {
|
|
102
100
|
if (!workflowId) {
|
|
103
|
-
throw new
|
|
101
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
104
102
|
}
|
|
105
103
|
if (!runId) {
|
|
106
|
-
throw new
|
|
104
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
107
105
|
}
|
|
108
|
-
const { workflow } = await
|
|
106
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
109
107
|
if (!workflow) {
|
|
110
|
-
throw new
|
|
108
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
111
109
|
}
|
|
112
110
|
const run = await workflow.getWorkflowRunById(runId);
|
|
113
111
|
if (!run) {
|
|
114
|
-
throw new
|
|
112
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
115
113
|
}
|
|
116
114
|
return run;
|
|
117
115
|
} catch (error) {
|
|
118
|
-
return
|
|
116
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run");
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
async function getWorkflowRunExecutionResultHandler({
|
|
@@ -125,22 +123,22 @@ async function getWorkflowRunExecutionResultHandler({
|
|
|
125
123
|
}) {
|
|
126
124
|
try {
|
|
127
125
|
if (!workflowId) {
|
|
128
|
-
throw new
|
|
126
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
129
127
|
}
|
|
130
128
|
if (!runId) {
|
|
131
|
-
throw new
|
|
129
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
132
130
|
}
|
|
133
131
|
const workflow = mastra.getWorkflow(workflowId);
|
|
134
132
|
if (!workflow) {
|
|
135
|
-
throw new
|
|
133
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
136
134
|
}
|
|
137
135
|
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
138
136
|
if (!executionResult) {
|
|
139
|
-
throw new
|
|
137
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
|
|
140
138
|
}
|
|
141
139
|
return executionResult;
|
|
142
140
|
} catch (error) {
|
|
143
|
-
return
|
|
141
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run execution result");
|
|
144
142
|
}
|
|
145
143
|
}
|
|
146
144
|
async function createWorkflowRunHandler({
|
|
@@ -150,21 +148,21 @@ async function createWorkflowRunHandler({
|
|
|
150
148
|
}) {
|
|
151
149
|
try {
|
|
152
150
|
if (!workflowId) {
|
|
153
|
-
throw new
|
|
151
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
154
152
|
}
|
|
155
|
-
const { workflow } = await
|
|
153
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
156
154
|
if (!workflow) {
|
|
157
|
-
throw new
|
|
155
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
158
156
|
}
|
|
159
|
-
const run = await workflow.
|
|
157
|
+
const run = await workflow.createRun({ runId: prevRunId });
|
|
160
158
|
return { runId: run.runId };
|
|
161
159
|
} catch (error) {
|
|
162
|
-
return
|
|
160
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error creating workflow run");
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
163
|
async function startAsyncWorkflowHandler({
|
|
166
164
|
mastra,
|
|
167
|
-
|
|
165
|
+
requestContext,
|
|
168
166
|
workflowId,
|
|
169
167
|
runId,
|
|
170
168
|
inputData,
|
|
@@ -172,26 +170,26 @@ async function startAsyncWorkflowHandler({
|
|
|
172
170
|
}) {
|
|
173
171
|
try {
|
|
174
172
|
if (!workflowId) {
|
|
175
|
-
throw new
|
|
173
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
176
174
|
}
|
|
177
|
-
const { workflow } = await
|
|
175
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
178
176
|
if (!workflow) {
|
|
179
|
-
throw new
|
|
177
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
180
178
|
}
|
|
181
|
-
const _run = await workflow.
|
|
179
|
+
const _run = await workflow.createRun({ runId });
|
|
182
180
|
const result = await _run.start({
|
|
183
181
|
inputData,
|
|
184
|
-
|
|
182
|
+
requestContext,
|
|
185
183
|
tracingOptions
|
|
186
184
|
});
|
|
187
185
|
return result;
|
|
188
186
|
} catch (error) {
|
|
189
|
-
return
|
|
187
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error starting async workflow");
|
|
190
188
|
}
|
|
191
189
|
}
|
|
192
190
|
async function startWorkflowRunHandler({
|
|
193
191
|
mastra,
|
|
194
|
-
|
|
192
|
+
requestContext,
|
|
195
193
|
workflowId,
|
|
196
194
|
runId,
|
|
197
195
|
inputData,
|
|
@@ -199,116 +197,43 @@ async function startWorkflowRunHandler({
|
|
|
199
197
|
}) {
|
|
200
198
|
try {
|
|
201
199
|
if (!workflowId) {
|
|
202
|
-
throw new
|
|
200
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
203
201
|
}
|
|
204
202
|
if (!runId) {
|
|
205
|
-
throw new
|
|
203
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
206
204
|
}
|
|
207
|
-
const { workflow } = await
|
|
205
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
208
206
|
if (!workflow) {
|
|
209
|
-
throw new
|
|
207
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
210
208
|
}
|
|
211
209
|
const run = await workflow.getWorkflowRunById(runId);
|
|
212
210
|
if (!run) {
|
|
213
|
-
throw new
|
|
211
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
214
212
|
}
|
|
215
|
-
const _run = await workflow.
|
|
213
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
216
214
|
void _run.start({
|
|
217
215
|
inputData,
|
|
218
|
-
|
|
216
|
+
requestContext,
|
|
219
217
|
tracingOptions
|
|
220
218
|
});
|
|
221
219
|
return { message: "Workflow run started" };
|
|
222
220
|
} catch (e) {
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
async function watchWorkflowHandler({
|
|
227
|
-
mastra,
|
|
228
|
-
workflowId,
|
|
229
|
-
runId,
|
|
230
|
-
eventType = "watch"
|
|
231
|
-
}) {
|
|
232
|
-
try {
|
|
233
|
-
if (!workflowId) {
|
|
234
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
235
|
-
}
|
|
236
|
-
if (!runId) {
|
|
237
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
238
|
-
}
|
|
239
|
-
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
240
|
-
if (!workflow) {
|
|
241
|
-
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
242
|
-
}
|
|
243
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
244
|
-
if (!run) {
|
|
245
|
-
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
246
|
-
}
|
|
247
|
-
const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
|
|
248
|
-
let unwatch;
|
|
249
|
-
let asyncRef = null;
|
|
250
|
-
const stream = new web.ReadableStream({
|
|
251
|
-
start(controller) {
|
|
252
|
-
if (eventType === "watch") {
|
|
253
|
-
unwatch = _run.watch((event) => {
|
|
254
|
-
const { type, payload, eventTimestamp } = event;
|
|
255
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
256
|
-
if (asyncRef) {
|
|
257
|
-
clearImmediate(asyncRef);
|
|
258
|
-
asyncRef = null;
|
|
259
|
-
}
|
|
260
|
-
asyncRef = setImmediate(async () => {
|
|
261
|
-
const runDone = payload.workflowState?.status !== "running";
|
|
262
|
-
if (runDone) {
|
|
263
|
-
controller.close();
|
|
264
|
-
unwatch?.();
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}, eventType);
|
|
268
|
-
} else {
|
|
269
|
-
unwatch = _run.watch((event) => {
|
|
270
|
-
const { type, payload } = event;
|
|
271
|
-
controller.enqueue(JSON.stringify({ type, payload, runId }));
|
|
272
|
-
if (asyncRef) {
|
|
273
|
-
clearImmediate(asyncRef);
|
|
274
|
-
asyncRef = null;
|
|
275
|
-
}
|
|
276
|
-
asyncRef = setImmediate(async () => {
|
|
277
|
-
const runDone = type === "workflow-finish";
|
|
278
|
-
if (runDone) {
|
|
279
|
-
controller.close();
|
|
280
|
-
unwatch?.();
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}, eventType);
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
cancel() {
|
|
287
|
-
if (asyncRef) {
|
|
288
|
-
clearImmediate(asyncRef);
|
|
289
|
-
asyncRef = null;
|
|
290
|
-
}
|
|
291
|
-
unwatch?.();
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
return stream;
|
|
295
|
-
} catch (error) {
|
|
296
|
-
return chunkRE4RPXT2_cjs.handleError(error, "Error watching workflow");
|
|
221
|
+
return chunkV5WWQN7P_cjs.handleError(e, "Error starting workflow run");
|
|
297
222
|
}
|
|
298
223
|
}
|
|
299
224
|
async function streamWorkflowHandler({
|
|
300
225
|
mastra,
|
|
301
|
-
|
|
226
|
+
requestContext,
|
|
302
227
|
workflowId,
|
|
303
228
|
runId,
|
|
304
229
|
inputData,
|
|
305
230
|
tracingOptions
|
|
306
231
|
}) {
|
|
307
|
-
return streamVNextWorkflowHandler({ mastra, workflowId, runId, inputData,
|
|
232
|
+
return streamVNextWorkflowHandler({ mastra, workflowId, runId, inputData, requestContext, tracingOptions });
|
|
308
233
|
}
|
|
309
234
|
async function streamLegacyWorkflowHandler({
|
|
310
235
|
mastra,
|
|
311
|
-
|
|
236
|
+
requestContext,
|
|
312
237
|
workflowId,
|
|
313
238
|
runId,
|
|
314
239
|
inputData,
|
|
@@ -316,20 +241,20 @@ async function streamLegacyWorkflowHandler({
|
|
|
316
241
|
}) {
|
|
317
242
|
try {
|
|
318
243
|
if (!workflowId) {
|
|
319
|
-
throw new
|
|
244
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
320
245
|
}
|
|
321
246
|
if (!runId) {
|
|
322
|
-
throw new
|
|
247
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
323
248
|
}
|
|
324
|
-
const { workflow } = await
|
|
249
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
325
250
|
if (!workflow) {
|
|
326
|
-
throw new
|
|
251
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
327
252
|
}
|
|
328
253
|
const serverCache = mastra.getServerCache();
|
|
329
|
-
const run = await workflow.
|
|
254
|
+
const run = await workflow.createRun({ runId });
|
|
330
255
|
const result = run.streamLegacy({
|
|
331
256
|
inputData,
|
|
332
|
-
|
|
257
|
+
requestContext,
|
|
333
258
|
onChunk: async (chunk) => {
|
|
334
259
|
if (serverCache) {
|
|
335
260
|
const cacheKey = runId;
|
|
@@ -340,7 +265,7 @@ async function streamLegacyWorkflowHandler({
|
|
|
340
265
|
});
|
|
341
266
|
return result;
|
|
342
267
|
} catch (error) {
|
|
343
|
-
return
|
|
268
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error executing workflow");
|
|
344
269
|
}
|
|
345
270
|
}
|
|
346
271
|
async function observeStreamLegacyWorkflowHandler({
|
|
@@ -350,23 +275,23 @@ async function observeStreamLegacyWorkflowHandler({
|
|
|
350
275
|
}) {
|
|
351
276
|
try {
|
|
352
277
|
if (!workflowId) {
|
|
353
|
-
throw new
|
|
278
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
354
279
|
}
|
|
355
280
|
if (!runId) {
|
|
356
|
-
throw new
|
|
281
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
|
|
357
282
|
}
|
|
358
|
-
const { workflow } = await
|
|
283
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
359
284
|
if (!workflow) {
|
|
360
|
-
throw new
|
|
285
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
361
286
|
}
|
|
362
287
|
const run = await workflow.getWorkflowRunById(runId);
|
|
363
288
|
if (!run) {
|
|
364
|
-
throw new
|
|
289
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
365
290
|
}
|
|
366
|
-
const _run = await workflow.
|
|
291
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
367
292
|
const serverCache = mastra.getServerCache();
|
|
368
293
|
if (!serverCache) {
|
|
369
|
-
throw new
|
|
294
|
+
throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
|
|
370
295
|
}
|
|
371
296
|
const transformStream = new web.TransformStream();
|
|
372
297
|
const writer = transformStream.writable.getWriter();
|
|
@@ -378,7 +303,7 @@ async function observeStreamLegacyWorkflowHandler({
|
|
|
378
303
|
const result = _run.observeStreamLegacy();
|
|
379
304
|
return result.stream?.pipeThrough(transformStream);
|
|
380
305
|
} catch (error) {
|
|
381
|
-
return
|
|
306
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
|
|
382
307
|
}
|
|
383
308
|
}
|
|
384
309
|
async function observeStreamWorkflowHandler({
|
|
@@ -390,7 +315,7 @@ async function observeStreamWorkflowHandler({
|
|
|
390
315
|
}
|
|
391
316
|
async function streamVNextWorkflowHandler({
|
|
392
317
|
mastra,
|
|
393
|
-
|
|
318
|
+
requestContext,
|
|
394
319
|
workflowId,
|
|
395
320
|
runId,
|
|
396
321
|
inputData,
|
|
@@ -399,20 +324,20 @@ async function streamVNextWorkflowHandler({
|
|
|
399
324
|
}) {
|
|
400
325
|
try {
|
|
401
326
|
if (!workflowId) {
|
|
402
|
-
throw new
|
|
327
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
403
328
|
}
|
|
404
329
|
if (!runId) {
|
|
405
|
-
throw new
|
|
330
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to stream workflow" });
|
|
406
331
|
}
|
|
407
|
-
const { workflow } = await
|
|
332
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
408
333
|
if (!workflow) {
|
|
409
|
-
throw new
|
|
334
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
410
335
|
}
|
|
411
336
|
const serverCache = mastra.getServerCache();
|
|
412
|
-
const run = await workflow.
|
|
337
|
+
const run = await workflow.createRun({ runId });
|
|
413
338
|
const result = run.stream({
|
|
414
339
|
inputData,
|
|
415
|
-
|
|
340
|
+
requestContext,
|
|
416
341
|
closeOnSuspend,
|
|
417
342
|
tracingOptions
|
|
418
343
|
});
|
|
@@ -429,7 +354,7 @@ async function streamVNextWorkflowHandler({
|
|
|
429
354
|
})
|
|
430
355
|
);
|
|
431
356
|
} catch (error) {
|
|
432
|
-
return
|
|
357
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error streaming workflow");
|
|
433
358
|
}
|
|
434
359
|
}
|
|
435
360
|
async function observeStreamVNextWorkflowHandler({
|
|
@@ -439,23 +364,23 @@ async function observeStreamVNextWorkflowHandler({
|
|
|
439
364
|
}) {
|
|
440
365
|
try {
|
|
441
366
|
if (!workflowId) {
|
|
442
|
-
throw new
|
|
367
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
443
368
|
}
|
|
444
369
|
if (!runId) {
|
|
445
|
-
throw new
|
|
370
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
|
|
446
371
|
}
|
|
447
|
-
const { workflow } = await
|
|
372
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
448
373
|
if (!workflow) {
|
|
449
|
-
throw new
|
|
374
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
450
375
|
}
|
|
451
376
|
const run = await workflow.getWorkflowRunById(runId);
|
|
452
377
|
if (!run) {
|
|
453
|
-
throw new
|
|
378
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
454
379
|
}
|
|
455
|
-
const _run = await workflow.
|
|
380
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
456
381
|
const serverCache = mastra.getServerCache();
|
|
457
382
|
if (!serverCache) {
|
|
458
|
-
throw new
|
|
383
|
+
throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
|
|
459
384
|
}
|
|
460
385
|
const cachedRunChunks = await serverCache.listFromTo(runId, 0);
|
|
461
386
|
const combinedStream = new web.ReadableStream({
|
|
@@ -492,7 +417,7 @@ async function observeStreamVNextWorkflowHandler({
|
|
|
492
417
|
});
|
|
493
418
|
return combinedStream;
|
|
494
419
|
} catch (error) {
|
|
495
|
-
return
|
|
420
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
|
|
496
421
|
}
|
|
497
422
|
}
|
|
498
423
|
async function resumeAsyncWorkflowHandler({
|
|
@@ -500,37 +425,34 @@ async function resumeAsyncWorkflowHandler({
|
|
|
500
425
|
workflowId,
|
|
501
426
|
runId,
|
|
502
427
|
body,
|
|
503
|
-
|
|
428
|
+
requestContext,
|
|
504
429
|
tracingOptions
|
|
505
430
|
}) {
|
|
506
431
|
try {
|
|
507
432
|
if (!workflowId) {
|
|
508
|
-
throw new
|
|
433
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
509
434
|
}
|
|
510
435
|
if (!runId) {
|
|
511
|
-
throw new
|
|
512
|
-
}
|
|
513
|
-
if (!body.step) {
|
|
514
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
436
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
515
437
|
}
|
|
516
|
-
const { workflow } = await
|
|
438
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
517
439
|
if (!workflow) {
|
|
518
|
-
throw new
|
|
440
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
519
441
|
}
|
|
520
442
|
const run = await workflow.getWorkflowRunById(runId);
|
|
521
443
|
if (!run) {
|
|
522
|
-
throw new
|
|
444
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
523
445
|
}
|
|
524
|
-
const _run = await workflow.
|
|
446
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
525
447
|
const result = await _run.resume({
|
|
526
448
|
step: body.step,
|
|
527
449
|
resumeData: body.resumeData,
|
|
528
|
-
|
|
450
|
+
requestContext,
|
|
529
451
|
tracingOptions
|
|
530
452
|
});
|
|
531
453
|
return result;
|
|
532
454
|
} catch (error) {
|
|
533
|
-
return
|
|
455
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow step");
|
|
534
456
|
}
|
|
535
457
|
}
|
|
536
458
|
async function resumeWorkflowHandler({
|
|
@@ -538,37 +460,34 @@ async function resumeWorkflowHandler({
|
|
|
538
460
|
workflowId,
|
|
539
461
|
runId,
|
|
540
462
|
body,
|
|
541
|
-
|
|
463
|
+
requestContext,
|
|
542
464
|
tracingOptions
|
|
543
465
|
}) {
|
|
544
466
|
try {
|
|
545
467
|
if (!workflowId) {
|
|
546
|
-
throw new
|
|
468
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
547
469
|
}
|
|
548
470
|
if (!runId) {
|
|
549
|
-
throw new
|
|
550
|
-
}
|
|
551
|
-
if (!body.step) {
|
|
552
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
471
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
553
472
|
}
|
|
554
|
-
const { workflow } = await
|
|
473
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
555
474
|
if (!workflow) {
|
|
556
|
-
throw new
|
|
475
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
557
476
|
}
|
|
558
477
|
const run = await workflow.getWorkflowRunById(runId);
|
|
559
478
|
if (!run) {
|
|
560
|
-
throw new
|
|
479
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
561
480
|
}
|
|
562
|
-
const _run = await workflow.
|
|
481
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
563
482
|
void _run.resume({
|
|
564
483
|
step: body.step,
|
|
565
484
|
resumeData: body.resumeData,
|
|
566
|
-
|
|
485
|
+
requestContext,
|
|
567
486
|
tracingOptions
|
|
568
487
|
});
|
|
569
488
|
return { message: "Workflow run resumed" };
|
|
570
489
|
} catch (error) {
|
|
571
|
-
return
|
|
490
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
|
|
572
491
|
}
|
|
573
492
|
}
|
|
574
493
|
async function resumeStreamWorkflowHandler({
|
|
@@ -576,33 +495,30 @@ async function resumeStreamWorkflowHandler({
|
|
|
576
495
|
workflowId,
|
|
577
496
|
runId,
|
|
578
497
|
body,
|
|
579
|
-
|
|
498
|
+
requestContext,
|
|
580
499
|
tracingOptions
|
|
581
500
|
}) {
|
|
582
501
|
try {
|
|
583
502
|
if (!workflowId) {
|
|
584
|
-
throw new
|
|
503
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
585
504
|
}
|
|
586
505
|
if (!runId) {
|
|
587
|
-
throw new
|
|
506
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
588
507
|
}
|
|
589
|
-
|
|
590
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
591
|
-
}
|
|
592
|
-
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
508
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
593
509
|
if (!workflow) {
|
|
594
|
-
throw new
|
|
510
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
595
511
|
}
|
|
596
512
|
const run = await workflow.getWorkflowRunById(runId);
|
|
597
513
|
if (!run) {
|
|
598
|
-
throw new
|
|
514
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
599
515
|
}
|
|
600
|
-
const _run = await workflow.
|
|
516
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
601
517
|
const serverCache = mastra.getServerCache();
|
|
602
518
|
const stream = _run.resumeStream({
|
|
603
519
|
step: body.step,
|
|
604
520
|
resumeData: body.resumeData,
|
|
605
|
-
|
|
521
|
+
requestContext,
|
|
606
522
|
tracingOptions
|
|
607
523
|
}).fullStream.pipeThrough(
|
|
608
524
|
new web.TransformStream({
|
|
@@ -618,33 +534,39 @@ async function resumeStreamWorkflowHandler({
|
|
|
618
534
|
);
|
|
619
535
|
return stream;
|
|
620
536
|
} catch (error) {
|
|
621
|
-
return
|
|
537
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
|
|
622
538
|
}
|
|
623
539
|
}
|
|
624
|
-
async function
|
|
540
|
+
async function listWorkflowRunsHandler({
|
|
625
541
|
mastra,
|
|
626
542
|
workflowId,
|
|
627
543
|
fromDate,
|
|
628
544
|
toDate,
|
|
629
|
-
|
|
630
|
-
|
|
545
|
+
perPage,
|
|
546
|
+
page,
|
|
631
547
|
resourceId
|
|
632
548
|
}) {
|
|
633
549
|
try {
|
|
634
550
|
if (!workflowId) {
|
|
635
|
-
throw new
|
|
551
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
552
|
+
}
|
|
553
|
+
if (perPage !== void 0 && perPage !== false && (!Number.isInteger(perPage) || perPage <= 0)) {
|
|
554
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "perPage must be a positive integer or false" });
|
|
636
555
|
}
|
|
637
|
-
|
|
556
|
+
if (page !== void 0 && (!Number.isInteger(page) || page < 0)) {
|
|
557
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "page must be a non-negative integer" });
|
|
558
|
+
}
|
|
559
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
638
560
|
if (!workflow) {
|
|
639
|
-
throw new
|
|
561
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
640
562
|
}
|
|
641
|
-
const workflowRuns = await workflow.
|
|
563
|
+
const workflowRuns = await workflow.listWorkflowRuns({ fromDate, toDate, perPage, page, resourceId }) || {
|
|
642
564
|
runs: [],
|
|
643
565
|
total: 0
|
|
644
566
|
};
|
|
645
567
|
return workflowRuns;
|
|
646
568
|
} catch (error) {
|
|
647
|
-
return
|
|
569
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow runs");
|
|
648
570
|
}
|
|
649
571
|
}
|
|
650
572
|
async function cancelWorkflowRunHandler({
|
|
@@ -654,53 +576,24 @@ async function cancelWorkflowRunHandler({
|
|
|
654
576
|
}) {
|
|
655
577
|
try {
|
|
656
578
|
if (!workflowId) {
|
|
657
|
-
throw new
|
|
579
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
658
580
|
}
|
|
659
581
|
if (!runId) {
|
|
660
|
-
throw new
|
|
582
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
|
|
661
583
|
}
|
|
662
|
-
const { workflow } = await
|
|
584
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
663
585
|
if (!workflow) {
|
|
664
|
-
throw new
|
|
586
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
665
587
|
}
|
|
666
588
|
const run = await workflow.getWorkflowRunById(runId);
|
|
667
589
|
if (!run) {
|
|
668
|
-
throw new
|
|
590
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
669
591
|
}
|
|
670
|
-
const _run = await workflow.
|
|
592
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
671
593
|
await _run.cancel();
|
|
672
594
|
return { message: "Workflow run cancelled" };
|
|
673
595
|
} catch (error) {
|
|
674
|
-
return
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
async function sendWorkflowRunEventHandler({
|
|
678
|
-
mastra,
|
|
679
|
-
workflowId,
|
|
680
|
-
runId,
|
|
681
|
-
event,
|
|
682
|
-
data
|
|
683
|
-
}) {
|
|
684
|
-
try {
|
|
685
|
-
if (!workflowId) {
|
|
686
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
687
|
-
}
|
|
688
|
-
if (!runId) {
|
|
689
|
-
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
|
|
690
|
-
}
|
|
691
|
-
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
692
|
-
if (!workflow) {
|
|
693
|
-
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
694
|
-
}
|
|
695
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
696
|
-
if (!run) {
|
|
697
|
-
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
698
|
-
}
|
|
699
|
-
const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
|
|
700
|
-
await _run.sendEvent(event, data);
|
|
701
|
-
return { message: "Workflow run event sent" };
|
|
702
|
-
} catch (error) {
|
|
703
|
-
return chunkRE4RPXT2_cjs.handleError(error, "Error sending workflow run event");
|
|
596
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error canceling workflow run");
|
|
704
597
|
}
|
|
705
598
|
}
|
|
706
599
|
|
|
@@ -709,21 +602,19 @@ exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
|
709
602
|
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
710
603
|
exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
|
|
711
604
|
exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
|
|
712
|
-
exports.
|
|
713
|
-
exports.
|
|
605
|
+
exports.listWorkflowRunsHandler = listWorkflowRunsHandler;
|
|
606
|
+
exports.listWorkflowsHandler = listWorkflowsHandler;
|
|
714
607
|
exports.observeStreamLegacyWorkflowHandler = observeStreamLegacyWorkflowHandler;
|
|
715
608
|
exports.observeStreamVNextWorkflowHandler = observeStreamVNextWorkflowHandler;
|
|
716
609
|
exports.observeStreamWorkflowHandler = observeStreamWorkflowHandler;
|
|
717
610
|
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
718
611
|
exports.resumeStreamWorkflowHandler = resumeStreamWorkflowHandler;
|
|
719
612
|
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
720
|
-
exports.sendWorkflowRunEventHandler = sendWorkflowRunEventHandler;
|
|
721
613
|
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
722
614
|
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
723
615
|
exports.streamLegacyWorkflowHandler = streamLegacyWorkflowHandler;
|
|
724
616
|
exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
|
|
725
617
|
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
726
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
727
618
|
exports.workflows_exports = workflows_exports;
|
|
728
|
-
//# sourceMappingURL=chunk-
|
|
729
|
-
//# sourceMappingURL=chunk-
|
|
619
|
+
//# sourceMappingURL=chunk-X3MICMI2.cjs.map
|
|
620
|
+
//# sourceMappingURL=chunk-X3MICMI2.cjs.map
|