@mastra/server 0.0.0-fix-persist-session-cache-option-mcp-server-20251031182703 → 0.0.0-fix-9244-clickhouse-metadata-20251104213434
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 +176 -3
- package/dist/{chunk-BATEJLED.js → chunk-46Z2KDQL.js} +12 -12
- package/dist/chunk-46Z2KDQL.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-7KNKINQE.js → chunk-73PAWDM5.js} +4 -4
- package/dist/{chunk-7KNKINQE.js.map → chunk-73PAWDM5.js.map} +1 -1
- package/dist/{chunk-PUYDRTPG.cjs → chunk-AEVI2HIU.cjs} +105 -174
- package/dist/chunk-AEVI2HIU.cjs.map +1 -0
- package/dist/{chunk-OEW3R7V4.js → chunk-ALOLTNSO.js} +3 -3
- package/dist/{chunk-OEW3R7V4.js.map → chunk-ALOLTNSO.js.map} +1 -1
- package/dist/{chunk-7YHMDEQ6.cjs → chunk-B6NK4KI5.cjs} +25 -25
- package/dist/{chunk-7YHMDEQ6.cjs.map → chunk-B6NK4KI5.cjs.map} +1 -1
- package/dist/{chunk-6IGZKIRM.cjs → chunk-BANGX6SC.cjs} +28 -28
- package/dist/chunk-BANGX6SC.cjs.map +1 -0
- package/dist/{chunk-BMOVKZO7.cjs → chunk-BHQH5QXD.cjs} +42 -37
- package/dist/chunk-BHQH5QXD.cjs.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-6562SOHJ.js → chunk-DNUO33HF.js} +3 -4
- package/dist/chunk-DNUO33HF.js.map +1 -0
- package/dist/{chunk-CXVOX4WB.js → chunk-FKZVCLOY.js} +49 -30
- package/dist/chunk-FKZVCLOY.js.map +1 -0
- package/dist/{chunk-2S4IMB6E.cjs → chunk-GTZOYEAU.cjs} +31 -31
- package/dist/chunk-GTZOYEAU.cjs.map +1 -0
- package/dist/{chunk-LZKJT7QP.cjs → chunk-GU4EWMZB.cjs} +34 -64
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/{chunk-36CWLQQT.js → chunk-IGOWG5V5.js} +22 -22
- package/dist/chunk-IGOWG5V5.js.map +1 -0
- package/dist/{chunk-4BKR6543.cjs → chunk-JIIVA4BA.cjs} +4571 -988
- package/dist/chunk-JIIVA4BA.cjs.map +1 -0
- package/dist/{chunk-2XD2KQEK.js → chunk-JO2AZFJN.js} +21 -16
- package/dist/chunk-JO2AZFJN.js.map +1 -0
- package/dist/{chunk-HLIRV42R.cjs → chunk-JZ65BJ6H.cjs} +82 -89
- package/dist/chunk-JZ65BJ6H.cjs.map +1 -0
- package/dist/{chunk-4YFT3JFJ.js → chunk-KCP6I5F3.js} +4547 -963
- package/dist/chunk-KCP6I5F3.js.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-GQRJOUV7.js → chunk-LF2ZLOFP.js} +34 -64
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/{chunk-74ZF4DII.js → chunk-LPCK5MAF.js} +5 -5
- package/dist/{chunk-74ZF4DII.js.map → chunk-LPCK5MAF.js.map} +1 -1
- package/dist/{chunk-YNGDJJOH.cjs → chunk-LWLSQ2W4.cjs} +13 -14
- package/dist/chunk-LWLSQ2W4.cjs.map +1 -0
- package/dist/{chunk-WH5RPLO4.cjs → chunk-PPMIB3FQ.cjs} +9 -9
- package/dist/{chunk-WH5RPLO4.cjs.map → chunk-PPMIB3FQ.cjs.map} +1 -1
- package/dist/{chunk-LROVQBIB.cjs → chunk-QFGNUBOA.cjs} +101 -82
- package/dist/chunk-QFGNUBOA.cjs.map +1 -0
- package/dist/{chunk-S4IOWSI3.js → chunk-R6OQFR47.js} +29 -97
- package/dist/chunk-R6OQFR47.js.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-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-7MCHFMDF.js → chunk-VYR3SAFM.js} +40 -47
- package/dist/chunk-VYR3SAFM.js.map +1 -0
- package/dist/{chunk-SED4H2GJ.cjs → chunk-XXGID4PQ.cjs} +4 -4
- package/dist/{chunk-SED4H2GJ.cjs.map → chunk-XXGID4PQ.cjs.map} +1 -1
- package/dist/server/handlers/a2a.cjs +7 -7
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +20 -24
- package/dist/server/handlers/agent-builder.d.ts +23 -42
- 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 +19 -19
- package/dist/server/handlers/agents.d.ts +8 -9
- 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 +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +18 -18
- package/dist/server/handlers/memory.d.ts +17 -16
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +6 -6
- package/dist/server/handlers/observability.d.ts +7 -7
- 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 +16 -16
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- 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.js +1 -1
- package/dist/server/handlers/workflows.cjs +20 -24
- package/dist/server/handlers/workflows.d.ts +9 -12
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +22 -22
- package/dist/server/handlers.js +11 -11
- 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 +1 -1
- package/dist/server/utils.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-2S4IMB6E.cjs.map +0 -1
- package/dist/chunk-2XD2KQEK.js.map +0 -1
- package/dist/chunk-36CWLQQT.js.map +0 -1
- package/dist/chunk-4BKR6543.cjs.map +0 -1
- package/dist/chunk-4YFT3JFJ.js.map +0 -1
- package/dist/chunk-6562SOHJ.js.map +0 -1
- package/dist/chunk-6IGZKIRM.cjs.map +0 -1
- package/dist/chunk-7MCHFMDF.js.map +0 -1
- package/dist/chunk-BATEJLED.js.map +0 -1
- package/dist/chunk-BMOVKZO7.cjs.map +0 -1
- package/dist/chunk-CXVOX4WB.js.map +0 -1
- package/dist/chunk-GQRJOUV7.js.map +0 -1
- package/dist/chunk-HLIRV42R.cjs.map +0 -1
- package/dist/chunk-LROVQBIB.cjs.map +0 -1
- package/dist/chunk-LZKJT7QP.cjs.map +0 -1
- package/dist/chunk-MMROOK5J.js.map +0 -1
- package/dist/chunk-PUYDRTPG.cjs.map +0 -1
- package/dist/chunk-S4IOWSI3.js.map +0 -1
- package/dist/chunk-YNGDJJOH.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkLWLSQ2W4_cjs = require('./chunk-LWLSQ2W4.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
|
|
|
@@ -27,28 +27,27 @@ chunkO7I5CWRX_cjs.__export(workflows_exports, {
|
|
|
27
27
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
28
28
|
streamLegacyWorkflowHandler: () => streamLegacyWorkflowHandler,
|
|
29
29
|
streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
|
|
30
|
-
streamWorkflowHandler: () => streamWorkflowHandler
|
|
31
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
30
|
+
streamWorkflowHandler: () => streamWorkflowHandler
|
|
32
31
|
});
|
|
33
32
|
async function listWorkflowsHandler({ mastra }) {
|
|
34
33
|
try {
|
|
35
34
|
const workflows = mastra.listWorkflows({ serialized: false });
|
|
36
35
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
37
|
-
acc[key] =
|
|
36
|
+
acc[key] = chunkLWLSQ2W4_cjs.getWorkflowInfo(workflow);
|
|
38
37
|
return acc;
|
|
39
38
|
}, {});
|
|
40
39
|
return _workflows;
|
|
41
40
|
} catch (error) {
|
|
42
|
-
return
|
|
41
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflows");
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
async function listWorkflowsFromSystem({ mastra, workflowId }) {
|
|
46
45
|
const logger = mastra.getLogger();
|
|
47
46
|
if (!workflowId) {
|
|
48
|
-
throw new
|
|
47
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
49
48
|
}
|
|
50
49
|
let workflow;
|
|
51
|
-
workflow =
|
|
50
|
+
workflow = chunkLWLSQ2W4_cjs.WorkflowRegistry.getWorkflow(workflowId);
|
|
52
51
|
if (!workflow) {
|
|
53
52
|
try {
|
|
54
53
|
workflow = mastra.getWorkflow(workflowId);
|
|
@@ -75,22 +74,22 @@ async function listWorkflowsFromSystem({ mastra, workflowId }) {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
if (!workflow) {
|
|
78
|
-
throw new
|
|
77
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
79
78
|
}
|
|
80
79
|
return { workflow };
|
|
81
80
|
}
|
|
82
81
|
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
83
82
|
try {
|
|
84
83
|
if (!workflowId) {
|
|
85
|
-
throw new
|
|
84
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
86
85
|
}
|
|
87
86
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
88
87
|
if (!workflow) {
|
|
89
|
-
throw new
|
|
88
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
90
89
|
}
|
|
91
|
-
return
|
|
90
|
+
return chunkLWLSQ2W4_cjs.getWorkflowInfo(workflow);
|
|
92
91
|
} catch (error) {
|
|
93
|
-
return
|
|
92
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow");
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
async function getWorkflowRunByIdHandler({
|
|
@@ -100,22 +99,22 @@ async function getWorkflowRunByIdHandler({
|
|
|
100
99
|
}) {
|
|
101
100
|
try {
|
|
102
101
|
if (!workflowId) {
|
|
103
|
-
throw new
|
|
102
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
104
103
|
}
|
|
105
104
|
if (!runId) {
|
|
106
|
-
throw new
|
|
105
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
107
106
|
}
|
|
108
107
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
109
108
|
if (!workflow) {
|
|
110
|
-
throw new
|
|
109
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
111
110
|
}
|
|
112
111
|
const run = await workflow.getWorkflowRunById(runId);
|
|
113
112
|
if (!run) {
|
|
114
|
-
throw new
|
|
113
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
115
114
|
}
|
|
116
115
|
return run;
|
|
117
116
|
} catch (error) {
|
|
118
|
-
return
|
|
117
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run");
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
async function getWorkflowRunExecutionResultHandler({
|
|
@@ -125,22 +124,22 @@ async function getWorkflowRunExecutionResultHandler({
|
|
|
125
124
|
}) {
|
|
126
125
|
try {
|
|
127
126
|
if (!workflowId) {
|
|
128
|
-
throw new
|
|
127
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
129
128
|
}
|
|
130
129
|
if (!runId) {
|
|
131
|
-
throw new
|
|
130
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
132
131
|
}
|
|
133
132
|
const workflow = mastra.getWorkflow(workflowId);
|
|
134
133
|
if (!workflow) {
|
|
135
|
-
throw new
|
|
134
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
136
135
|
}
|
|
137
136
|
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
138
137
|
if (!executionResult) {
|
|
139
|
-
throw new
|
|
138
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
|
|
140
139
|
}
|
|
141
140
|
return executionResult;
|
|
142
141
|
} catch (error) {
|
|
143
|
-
return
|
|
142
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run execution result");
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
async function createWorkflowRunHandler({
|
|
@@ -150,16 +149,16 @@ async function createWorkflowRunHandler({
|
|
|
150
149
|
}) {
|
|
151
150
|
try {
|
|
152
151
|
if (!workflowId) {
|
|
153
|
-
throw new
|
|
152
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
154
153
|
}
|
|
155
154
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
156
155
|
if (!workflow) {
|
|
157
|
-
throw new
|
|
156
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
158
157
|
}
|
|
159
|
-
const run = await workflow.
|
|
158
|
+
const run = await workflow.createRun({ runId: prevRunId });
|
|
160
159
|
return { runId: run.runId };
|
|
161
160
|
} catch (error) {
|
|
162
|
-
return
|
|
161
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error creating workflow run");
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
async function startAsyncWorkflowHandler({
|
|
@@ -172,13 +171,13 @@ async function startAsyncWorkflowHandler({
|
|
|
172
171
|
}) {
|
|
173
172
|
try {
|
|
174
173
|
if (!workflowId) {
|
|
175
|
-
throw new
|
|
174
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
176
175
|
}
|
|
177
176
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
178
177
|
if (!workflow) {
|
|
179
|
-
throw new
|
|
178
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
180
179
|
}
|
|
181
|
-
const _run = await workflow.
|
|
180
|
+
const _run = await workflow.createRun({ runId });
|
|
182
181
|
const result = await _run.start({
|
|
183
182
|
inputData,
|
|
184
183
|
requestContext,
|
|
@@ -186,7 +185,7 @@ async function startAsyncWorkflowHandler({
|
|
|
186
185
|
});
|
|
187
186
|
return result;
|
|
188
187
|
} catch (error) {
|
|
189
|
-
return
|
|
188
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error starting async workflow");
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
async function startWorkflowRunHandler({
|
|
@@ -199,20 +198,20 @@ async function startWorkflowRunHandler({
|
|
|
199
198
|
}) {
|
|
200
199
|
try {
|
|
201
200
|
if (!workflowId) {
|
|
202
|
-
throw new
|
|
201
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
203
202
|
}
|
|
204
203
|
if (!runId) {
|
|
205
|
-
throw new
|
|
204
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
206
205
|
}
|
|
207
206
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
208
207
|
if (!workflow) {
|
|
209
|
-
throw new
|
|
208
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
210
209
|
}
|
|
211
210
|
const run = await workflow.getWorkflowRunById(runId);
|
|
212
211
|
if (!run) {
|
|
213
|
-
throw new
|
|
212
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
214
213
|
}
|
|
215
|
-
const _run = await workflow.
|
|
214
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
216
215
|
void _run.start({
|
|
217
216
|
inputData,
|
|
218
217
|
requestContext,
|
|
@@ -220,80 +219,7 @@ async function startWorkflowRunHandler({
|
|
|
220
219
|
});
|
|
221
220
|
return { message: "Workflow run started" };
|
|
222
221
|
} 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 listWorkflowsFromSystem({ 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");
|
|
222
|
+
return chunkV5WWQN7P_cjs.handleError(e, "Error starting workflow run");
|
|
297
223
|
}
|
|
298
224
|
}
|
|
299
225
|
async function streamWorkflowHandler({
|
|
@@ -316,17 +242,17 @@ async function streamLegacyWorkflowHandler({
|
|
|
316
242
|
}) {
|
|
317
243
|
try {
|
|
318
244
|
if (!workflowId) {
|
|
319
|
-
throw new
|
|
245
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
320
246
|
}
|
|
321
247
|
if (!runId) {
|
|
322
|
-
throw new
|
|
248
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
323
249
|
}
|
|
324
250
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
325
251
|
if (!workflow) {
|
|
326
|
-
throw new
|
|
252
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
327
253
|
}
|
|
328
254
|
const serverCache = mastra.getServerCache();
|
|
329
|
-
const run = await workflow.
|
|
255
|
+
const run = await workflow.createRun({ runId });
|
|
330
256
|
const result = run.streamLegacy({
|
|
331
257
|
inputData,
|
|
332
258
|
requestContext,
|
|
@@ -340,7 +266,7 @@ async function streamLegacyWorkflowHandler({
|
|
|
340
266
|
});
|
|
341
267
|
return result;
|
|
342
268
|
} catch (error) {
|
|
343
|
-
return
|
|
269
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error executing workflow");
|
|
344
270
|
}
|
|
345
271
|
}
|
|
346
272
|
async function observeStreamLegacyWorkflowHandler({
|
|
@@ -350,23 +276,23 @@ async function observeStreamLegacyWorkflowHandler({
|
|
|
350
276
|
}) {
|
|
351
277
|
try {
|
|
352
278
|
if (!workflowId) {
|
|
353
|
-
throw new
|
|
279
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
354
280
|
}
|
|
355
281
|
if (!runId) {
|
|
356
|
-
throw new
|
|
282
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
|
|
357
283
|
}
|
|
358
284
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
359
285
|
if (!workflow) {
|
|
360
|
-
throw new
|
|
286
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
361
287
|
}
|
|
362
288
|
const run = await workflow.getWorkflowRunById(runId);
|
|
363
289
|
if (!run) {
|
|
364
|
-
throw new
|
|
290
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
365
291
|
}
|
|
366
|
-
const _run = await workflow.
|
|
292
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
367
293
|
const serverCache = mastra.getServerCache();
|
|
368
294
|
if (!serverCache) {
|
|
369
|
-
throw new
|
|
295
|
+
throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
|
|
370
296
|
}
|
|
371
297
|
const transformStream = new web.TransformStream();
|
|
372
298
|
const writer = transformStream.writable.getWriter();
|
|
@@ -378,7 +304,7 @@ async function observeStreamLegacyWorkflowHandler({
|
|
|
378
304
|
const result = _run.observeStreamLegacy();
|
|
379
305
|
return result.stream?.pipeThrough(transformStream);
|
|
380
306
|
} catch (error) {
|
|
381
|
-
return
|
|
307
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
|
|
382
308
|
}
|
|
383
309
|
}
|
|
384
310
|
async function observeStreamWorkflowHandler({
|
|
@@ -399,17 +325,17 @@ async function streamVNextWorkflowHandler({
|
|
|
399
325
|
}) {
|
|
400
326
|
try {
|
|
401
327
|
if (!workflowId) {
|
|
402
|
-
throw new
|
|
328
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
403
329
|
}
|
|
404
330
|
if (!runId) {
|
|
405
|
-
throw new
|
|
331
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to stream workflow" });
|
|
406
332
|
}
|
|
407
333
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
408
334
|
if (!workflow) {
|
|
409
|
-
throw new
|
|
335
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
410
336
|
}
|
|
411
337
|
const serverCache = mastra.getServerCache();
|
|
412
|
-
const run = await workflow.
|
|
338
|
+
const run = await workflow.createRun({ runId });
|
|
413
339
|
const result = run.stream({
|
|
414
340
|
inputData,
|
|
415
341
|
requestContext,
|
|
@@ -429,7 +355,7 @@ async function streamVNextWorkflowHandler({
|
|
|
429
355
|
})
|
|
430
356
|
);
|
|
431
357
|
} catch (error) {
|
|
432
|
-
return
|
|
358
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error streaming workflow");
|
|
433
359
|
}
|
|
434
360
|
}
|
|
435
361
|
async function observeStreamVNextWorkflowHandler({
|
|
@@ -439,23 +365,23 @@ async function observeStreamVNextWorkflowHandler({
|
|
|
439
365
|
}) {
|
|
440
366
|
try {
|
|
441
367
|
if (!workflowId) {
|
|
442
|
-
throw new
|
|
368
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
443
369
|
}
|
|
444
370
|
if (!runId) {
|
|
445
|
-
throw new
|
|
371
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
|
|
446
372
|
}
|
|
447
373
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
448
374
|
if (!workflow) {
|
|
449
|
-
throw new
|
|
375
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
450
376
|
}
|
|
451
377
|
const run = await workflow.getWorkflowRunById(runId);
|
|
452
378
|
if (!run) {
|
|
453
|
-
throw new
|
|
379
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
454
380
|
}
|
|
455
|
-
const _run = await workflow.
|
|
381
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
456
382
|
const serverCache = mastra.getServerCache();
|
|
457
383
|
if (!serverCache) {
|
|
458
|
-
throw new
|
|
384
|
+
throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
|
|
459
385
|
}
|
|
460
386
|
const cachedRunChunks = await serverCache.listFromTo(runId, 0);
|
|
461
387
|
const combinedStream = new web.ReadableStream({
|
|
@@ -492,7 +418,7 @@ async function observeStreamVNextWorkflowHandler({
|
|
|
492
418
|
});
|
|
493
419
|
return combinedStream;
|
|
494
420
|
} catch (error) {
|
|
495
|
-
return
|
|
421
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
|
|
496
422
|
}
|
|
497
423
|
}
|
|
498
424
|
async function resumeAsyncWorkflowHandler({
|
|
@@ -505,20 +431,20 @@ async function resumeAsyncWorkflowHandler({
|
|
|
505
431
|
}) {
|
|
506
432
|
try {
|
|
507
433
|
if (!workflowId) {
|
|
508
|
-
throw new
|
|
434
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
509
435
|
}
|
|
510
436
|
if (!runId) {
|
|
511
|
-
throw new
|
|
437
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
512
438
|
}
|
|
513
439
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
514
440
|
if (!workflow) {
|
|
515
|
-
throw new
|
|
441
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
516
442
|
}
|
|
517
443
|
const run = await workflow.getWorkflowRunById(runId);
|
|
518
444
|
if (!run) {
|
|
519
|
-
throw new
|
|
445
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
520
446
|
}
|
|
521
|
-
const _run = await workflow.
|
|
447
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
522
448
|
const result = await _run.resume({
|
|
523
449
|
step: body.step,
|
|
524
450
|
resumeData: body.resumeData,
|
|
@@ -527,7 +453,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
527
453
|
});
|
|
528
454
|
return result;
|
|
529
455
|
} catch (error) {
|
|
530
|
-
return
|
|
456
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow step");
|
|
531
457
|
}
|
|
532
458
|
}
|
|
533
459
|
async function resumeWorkflowHandler({
|
|
@@ -540,20 +466,20 @@ async function resumeWorkflowHandler({
|
|
|
540
466
|
}) {
|
|
541
467
|
try {
|
|
542
468
|
if (!workflowId) {
|
|
543
|
-
throw new
|
|
469
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
544
470
|
}
|
|
545
471
|
if (!runId) {
|
|
546
|
-
throw new
|
|
472
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
547
473
|
}
|
|
548
474
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
549
475
|
if (!workflow) {
|
|
550
|
-
throw new
|
|
476
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
551
477
|
}
|
|
552
478
|
const run = await workflow.getWorkflowRunById(runId);
|
|
553
479
|
if (!run) {
|
|
554
|
-
throw new
|
|
480
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
555
481
|
}
|
|
556
|
-
const _run = await workflow.
|
|
482
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
557
483
|
void _run.resume({
|
|
558
484
|
step: body.step,
|
|
559
485
|
resumeData: body.resumeData,
|
|
@@ -562,7 +488,7 @@ async function resumeWorkflowHandler({
|
|
|
562
488
|
});
|
|
563
489
|
return { message: "Workflow run resumed" };
|
|
564
490
|
} catch (error) {
|
|
565
|
-
return
|
|
491
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
|
|
566
492
|
}
|
|
567
493
|
}
|
|
568
494
|
async function resumeStreamWorkflowHandler({
|
|
@@ -575,20 +501,20 @@ async function resumeStreamWorkflowHandler({
|
|
|
575
501
|
}) {
|
|
576
502
|
try {
|
|
577
503
|
if (!workflowId) {
|
|
578
|
-
throw new
|
|
504
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
579
505
|
}
|
|
580
506
|
if (!runId) {
|
|
581
|
-
throw new
|
|
507
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
582
508
|
}
|
|
583
509
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
584
510
|
if (!workflow) {
|
|
585
|
-
throw new
|
|
511
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
586
512
|
}
|
|
587
513
|
const run = await workflow.getWorkflowRunById(runId);
|
|
588
514
|
if (!run) {
|
|
589
|
-
throw new
|
|
515
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
590
516
|
}
|
|
591
|
-
const _run = await workflow.
|
|
517
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
592
518
|
const serverCache = mastra.getServerCache();
|
|
593
519
|
const stream = _run.resumeStream({
|
|
594
520
|
step: body.step,
|
|
@@ -609,7 +535,7 @@ async function resumeStreamWorkflowHandler({
|
|
|
609
535
|
);
|
|
610
536
|
return stream;
|
|
611
537
|
} catch (error) {
|
|
612
|
-
return
|
|
538
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
|
|
613
539
|
}
|
|
614
540
|
}
|
|
615
541
|
async function listWorkflowRunsHandler({
|
|
@@ -617,25 +543,31 @@ async function listWorkflowRunsHandler({
|
|
|
617
543
|
workflowId,
|
|
618
544
|
fromDate,
|
|
619
545
|
toDate,
|
|
620
|
-
|
|
621
|
-
|
|
546
|
+
perPage,
|
|
547
|
+
page,
|
|
622
548
|
resourceId
|
|
623
549
|
}) {
|
|
624
550
|
try {
|
|
625
551
|
if (!workflowId) {
|
|
626
|
-
throw new
|
|
552
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
553
|
+
}
|
|
554
|
+
if (perPage !== void 0 && perPage !== false && (!Number.isInteger(perPage) || perPage <= 0)) {
|
|
555
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "perPage must be a positive integer or false" });
|
|
556
|
+
}
|
|
557
|
+
if (page !== void 0 && (!Number.isInteger(page) || page < 0)) {
|
|
558
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "page must be a non-negative integer" });
|
|
627
559
|
}
|
|
628
560
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
629
561
|
if (!workflow) {
|
|
630
|
-
throw new
|
|
562
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
631
563
|
}
|
|
632
|
-
const workflowRuns = await workflow.listWorkflowRuns({ fromDate, toDate,
|
|
564
|
+
const workflowRuns = await workflow.listWorkflowRuns({ fromDate, toDate, perPage, page, resourceId }) || {
|
|
633
565
|
runs: [],
|
|
634
566
|
total: 0
|
|
635
567
|
};
|
|
636
568
|
return workflowRuns;
|
|
637
569
|
} catch (error) {
|
|
638
|
-
return
|
|
570
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow runs");
|
|
639
571
|
}
|
|
640
572
|
}
|
|
641
573
|
async function cancelWorkflowRunHandler({
|
|
@@ -645,24 +577,24 @@ async function cancelWorkflowRunHandler({
|
|
|
645
577
|
}) {
|
|
646
578
|
try {
|
|
647
579
|
if (!workflowId) {
|
|
648
|
-
throw new
|
|
580
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
649
581
|
}
|
|
650
582
|
if (!runId) {
|
|
651
|
-
throw new
|
|
583
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
|
|
652
584
|
}
|
|
653
585
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
654
586
|
if (!workflow) {
|
|
655
|
-
throw new
|
|
587
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
656
588
|
}
|
|
657
589
|
const run = await workflow.getWorkflowRunById(runId);
|
|
658
590
|
if (!run) {
|
|
659
|
-
throw new
|
|
591
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
660
592
|
}
|
|
661
|
-
const _run = await workflow.
|
|
593
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
662
594
|
await _run.cancel();
|
|
663
595
|
return { message: "Workflow run cancelled" };
|
|
664
596
|
} catch (error) {
|
|
665
|
-
return
|
|
597
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error canceling workflow run");
|
|
666
598
|
}
|
|
667
599
|
}
|
|
668
600
|
async function sendWorkflowRunEventHandler({
|
|
@@ -674,24 +606,24 @@ async function sendWorkflowRunEventHandler({
|
|
|
674
606
|
}) {
|
|
675
607
|
try {
|
|
676
608
|
if (!workflowId) {
|
|
677
|
-
throw new
|
|
609
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
678
610
|
}
|
|
679
611
|
if (!runId) {
|
|
680
|
-
throw new
|
|
612
|
+
throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
|
|
681
613
|
}
|
|
682
614
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
683
615
|
if (!workflow) {
|
|
684
|
-
throw new
|
|
616
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
685
617
|
}
|
|
686
618
|
const run = await workflow.getWorkflowRunById(runId);
|
|
687
619
|
if (!run) {
|
|
688
|
-
throw new
|
|
620
|
+
throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
689
621
|
}
|
|
690
|
-
const _run = await workflow.
|
|
622
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
691
623
|
await _run.sendEvent(event, data);
|
|
692
624
|
return { message: "Workflow run event sent" };
|
|
693
625
|
} catch (error) {
|
|
694
|
-
return
|
|
626
|
+
return chunkV5WWQN7P_cjs.handleError(error, "Error sending workflow run event");
|
|
695
627
|
}
|
|
696
628
|
}
|
|
697
629
|
|
|
@@ -714,7 +646,6 @@ exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
|
714
646
|
exports.streamLegacyWorkflowHandler = streamLegacyWorkflowHandler;
|
|
715
647
|
exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
|
|
716
648
|
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
717
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
718
649
|
exports.workflows_exports = workflows_exports;
|
|
719
|
-
//# sourceMappingURL=chunk-
|
|
720
|
-
//# sourceMappingURL=chunk-
|
|
650
|
+
//# sourceMappingURL=chunk-AEVI2HIU.cjs.map
|
|
651
|
+
//# sourceMappingURL=chunk-AEVI2HIU.cjs.map
|