@mastra/server 2.0.3 → 2.0.4-alpha.0
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 +152 -10
- package/dist/_tsup-dts-rollup.d.ts +152 -10
- package/dist/{chunk-2FJURXCL.cjs → chunk-24EGIVT7.cjs} +34 -33
- package/dist/{chunk-3XTEV33Q.js → chunk-2KIW6AJK.js} +4 -3
- package/dist/{chunk-6Q7UXAYJ.cjs → chunk-3HQNCTZ2.cjs} +21 -20
- package/dist/{chunk-M56ECCHK.cjs → chunk-4YZ3U35L.cjs} +18 -17
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/chunk-5SN4U5AC.cjs +508 -0
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
- package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
- package/dist/{chunk-4JINXASC.js → chunk-IU5VO2I2.js} +3 -2
- package/dist/chunk-LIVAK2DM.js +2001 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
- package/dist/{chunk-M2RXDCPV.cjs → chunk-OHKAN72U.cjs} +76 -57
- package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-GVBJ5I2S.js → chunk-Q6KMBIAN.js} +5 -4
- package/dist/{chunk-CHFORQ7J.cjs → chunk-RYUN5DF4.cjs} +45 -44
- package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
- package/dist/{chunk-OWNA6I2H.js → chunk-WVDUW4GI.js} +28 -9
- package/dist/{chunk-RBQASTUP.js → chunk-X3ZDCS52.js} +4 -3
- package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
- package/dist/chunk-YWLUOY3D.cjs +2004 -0
- package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextWorkflows.cjs +11 -11
- package/dist/server/handlers/vNextWorkflows.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 +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -23
- package/dist/server/handlers.d.cts +1 -0
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.js +11 -10
- package/package.json +6 -4
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-OMN3UI6X.js +0 -5576
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
4
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/telemetry.ts
|
|
7
8
|
var telemetry_exports = {};
|
|
8
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(telemetry_exports, {
|
|
9
10
|
getTelemetryHandler: () => getTelemetryHandler,
|
|
10
11
|
storeTelemetryHandler: () => storeTelemetryHandler
|
|
11
12
|
});
|
|
@@ -14,13 +15,13 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
14
15
|
const telemetry = mastra.getTelemetry();
|
|
15
16
|
const storage = mastra.getStorage();
|
|
16
17
|
if (!telemetry) {
|
|
17
|
-
throw new
|
|
18
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
|
|
18
19
|
}
|
|
19
20
|
if (!storage) {
|
|
20
|
-
throw new
|
|
21
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Storage is not initialized" });
|
|
21
22
|
}
|
|
22
23
|
if (!body) {
|
|
23
|
-
throw new
|
|
24
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
|
|
24
25
|
}
|
|
25
26
|
const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
|
|
26
27
|
const attributes = attribute ? Object.fromEntries(
|
|
@@ -40,7 +41,7 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
40
41
|
});
|
|
41
42
|
return traces;
|
|
42
43
|
} catch (error2) {
|
|
43
|
-
return
|
|
44
|
+
return chunk64U3UDTH_cjs.handleError(error2, "Error getting telemetry");
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
async function storeTelemetryHandler({ mastra, body }) {
|
|
@@ -48,7 +49,7 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
48
49
|
const storage = mastra.getStorage();
|
|
49
50
|
const logger = mastra.getLogger();
|
|
50
51
|
if (!storage) {
|
|
51
|
-
throw new
|
|
52
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Storage is not initialized" });
|
|
52
53
|
}
|
|
53
54
|
const now = /* @__PURE__ */ new Date();
|
|
54
55
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
// src/server/http-exception.ts
|
|
8
2
|
var HTTPException = class extends Error {
|
|
9
3
|
res;
|
|
@@ -37,4 +31,4 @@ var HTTPException = class extends Error {
|
|
|
37
31
|
}
|
|
38
32
|
};
|
|
39
33
|
|
|
40
|
-
export { HTTPException
|
|
34
|
+
export { HTTPException };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __export = (target, all) => {
|
|
5
|
-
for (var name in all)
|
|
6
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
-
};
|
|
8
|
-
|
|
9
3
|
// src/server/http-exception.ts
|
|
10
4
|
var HTTPException = class extends Error {
|
|
11
5
|
res;
|
|
@@ -40,4 +34,3 @@ var HTTPException = class extends Error {
|
|
|
40
34
|
};
|
|
41
35
|
|
|
42
36
|
exports.HTTPException = HTTPException;
|
|
43
|
-
exports.__export = __export;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/logs.ts
|
|
8
8
|
var logs_exports = {};
|
|
9
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(logs_exports, {
|
|
10
10
|
getLogTransports: () => getLogTransports,
|
|
11
11
|
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
12
12
|
getLogsHandler: () => getLogsHandler
|
|
@@ -16,11 +16,11 @@ async function getLogsHandler({
|
|
|
16
16
|
transportId
|
|
17
17
|
}) {
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
chunk57CJTIPW_cjs.validateBody({ transportId });
|
|
20
20
|
const logs = await mastra.getLogs(transportId);
|
|
21
21
|
return logs;
|
|
22
22
|
} catch (error) {
|
|
23
|
-
return
|
|
23
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs");
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
async function getLogsByRunIdHandler({
|
|
@@ -29,11 +29,11 @@ async function getLogsByRunIdHandler({
|
|
|
29
29
|
transportId
|
|
30
30
|
}) {
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
chunk57CJTIPW_cjs.validateBody({ runId, transportId });
|
|
33
33
|
const logs = await mastra.getLogsByRunId({ runId, transportId });
|
|
34
34
|
return logs;
|
|
35
35
|
} catch (error) {
|
|
36
|
-
return
|
|
36
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs by run ID");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async function getLogTransports({ mastra }) {
|
|
@@ -44,7 +44,7 @@ async function getLogTransports({ mastra }) {
|
|
|
44
44
|
transports: transports ? Object.keys(transports) : []
|
|
45
45
|
};
|
|
46
46
|
} catch (error) {
|
|
47
|
-
return
|
|
47
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.cjs');
|
|
4
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
7
|
var web = require('stream/web');
|
|
8
|
+
var di = require('@mastra/core/di');
|
|
7
9
|
|
|
8
10
|
// src/server/handlers/vNextWorkflows.ts
|
|
9
11
|
var vNextWorkflows_exports = {};
|
|
10
|
-
|
|
12
|
+
chunk75ZPJI57_cjs.__export(vNextWorkflows_exports, {
|
|
11
13
|
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
12
14
|
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
13
15
|
getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
|
|
@@ -29,52 +31,54 @@ async function getVNextWorkflowsHandler({ mastra }) {
|
|
|
29
31
|
acc2[key2] = {
|
|
30
32
|
id: step.id,
|
|
31
33
|
description: step.description,
|
|
32
|
-
inputSchema: step.inputSchema ?
|
|
33
|
-
outputSchema: step.outputSchema ?
|
|
34
|
-
resumeSchema: step.resumeSchema ?
|
|
35
|
-
suspendSchema: step.suspendSchema ?
|
|
34
|
+
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
35
|
+
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
36
|
+
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
37
|
+
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
36
38
|
};
|
|
37
39
|
return acc2;
|
|
38
40
|
}, {}),
|
|
39
41
|
stepGraph: workflow.serializedStepGraph,
|
|
40
|
-
inputSchema: workflow.inputSchema ?
|
|
41
|
-
outputSchema: workflow.outputSchema ?
|
|
42
|
+
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
43
|
+
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
42
44
|
};
|
|
43
45
|
return acc;
|
|
44
46
|
}, {});
|
|
45
47
|
return _workflows;
|
|
46
48
|
} catch (error) {
|
|
47
|
-
throw new
|
|
49
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
51
53
|
try {
|
|
52
54
|
if (!workflowId) {
|
|
53
|
-
throw new
|
|
55
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
54
56
|
}
|
|
55
57
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
56
58
|
if (!workflow) {
|
|
57
|
-
throw new
|
|
59
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
58
60
|
}
|
|
59
61
|
return {
|
|
60
62
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
61
63
|
acc[key] = {
|
|
62
64
|
id: step.id,
|
|
63
65
|
description: step.description,
|
|
64
|
-
inputSchema: step.inputSchema ?
|
|
65
|
-
outputSchema: step.outputSchema ?
|
|
66
|
-
resumeSchema: step.resumeSchema ?
|
|
67
|
-
suspendSchema: step.suspendSchema ?
|
|
66
|
+
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
67
|
+
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
68
|
+
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
69
|
+
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
68
70
|
};
|
|
69
71
|
return acc;
|
|
70
72
|
}, {}),
|
|
71
73
|
name: workflow.name,
|
|
72
74
|
stepGraph: workflow.serializedStepGraph,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
// @ts-ignore - ignore infinite recursion
|
|
76
|
+
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
77
|
+
// @ts-ignore - ignore infinite recursion
|
|
78
|
+
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
75
79
|
};
|
|
76
80
|
} catch (error) {
|
|
77
|
-
throw new
|
|
81
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
async function getVNextWorkflowRunByIdHandler({
|
|
@@ -84,22 +88,22 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
84
88
|
}) {
|
|
85
89
|
try {
|
|
86
90
|
if (!workflowId) {
|
|
87
|
-
throw new
|
|
91
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
88
92
|
}
|
|
89
93
|
if (!runId) {
|
|
90
|
-
throw new
|
|
94
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
91
95
|
}
|
|
92
96
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
93
97
|
if (!workflow) {
|
|
94
|
-
throw new
|
|
98
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
95
99
|
}
|
|
96
100
|
const run = await workflow.getWorkflowRunById(runId);
|
|
97
101
|
if (!run) {
|
|
98
|
-
throw new
|
|
102
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
99
103
|
}
|
|
100
104
|
return run;
|
|
101
105
|
} catch (error) {
|
|
102
|
-
throw new
|
|
106
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
async function createVNextWorkflowRunHandler({
|
|
@@ -109,16 +113,16 @@ async function createVNextWorkflowRunHandler({
|
|
|
109
113
|
}) {
|
|
110
114
|
try {
|
|
111
115
|
if (!workflowId) {
|
|
112
|
-
throw new
|
|
116
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
113
117
|
}
|
|
114
118
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
115
119
|
if (!workflow) {
|
|
116
|
-
throw new
|
|
120
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
117
121
|
}
|
|
118
122
|
const run = workflow.createRun({ runId: prevRunId });
|
|
119
123
|
return { runId: run.runId };
|
|
120
124
|
} catch (error) {
|
|
121
|
-
throw new
|
|
125
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
128
|
async function startAsyncVNextWorkflowHandler({
|
|
@@ -126,24 +130,29 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
126
130
|
runtimeContext,
|
|
127
131
|
workflowId,
|
|
128
132
|
runId,
|
|
129
|
-
inputData
|
|
133
|
+
inputData,
|
|
134
|
+
runtimeContextFromRequest
|
|
130
135
|
}) {
|
|
131
136
|
try {
|
|
132
137
|
if (!workflowId) {
|
|
133
|
-
throw new
|
|
138
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
134
139
|
}
|
|
135
140
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
136
141
|
if (!workflow) {
|
|
137
|
-
throw new
|
|
142
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
138
143
|
}
|
|
144
|
+
const finalRuntimeContext = new di.RuntimeContext([
|
|
145
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
146
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
147
|
+
]);
|
|
139
148
|
const _run = workflow.createRun({ runId });
|
|
140
149
|
const result = await _run.start({
|
|
141
150
|
inputData,
|
|
142
|
-
runtimeContext
|
|
151
|
+
runtimeContext: finalRuntimeContext
|
|
143
152
|
});
|
|
144
153
|
return result;
|
|
145
154
|
} catch (error) {
|
|
146
|
-
throw new
|
|
155
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
158
|
async function startVNextWorkflowRunHandler({
|
|
@@ -151,28 +160,33 @@ async function startVNextWorkflowRunHandler({
|
|
|
151
160
|
runtimeContext,
|
|
152
161
|
workflowId,
|
|
153
162
|
runId,
|
|
154
|
-
inputData
|
|
163
|
+
inputData,
|
|
164
|
+
runtimeContextFromRequest
|
|
155
165
|
}) {
|
|
156
166
|
try {
|
|
157
167
|
if (!workflowId) {
|
|
158
|
-
throw new
|
|
168
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
159
169
|
}
|
|
160
170
|
if (!runId) {
|
|
161
|
-
throw new
|
|
171
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
162
172
|
}
|
|
163
173
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
164
174
|
const run = await workflow.getWorkflowRunById(runId);
|
|
165
175
|
if (!run) {
|
|
166
|
-
throw new
|
|
176
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
167
177
|
}
|
|
178
|
+
const finalRuntimeContext = new di.RuntimeContext([
|
|
179
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
180
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
181
|
+
]);
|
|
168
182
|
const _run = workflow.createRun({ runId });
|
|
169
183
|
await _run.start({
|
|
170
184
|
inputData,
|
|
171
|
-
runtimeContext
|
|
185
|
+
runtimeContext: finalRuntimeContext
|
|
172
186
|
});
|
|
173
187
|
return { message: "Workflow run started" };
|
|
174
188
|
} catch (e) {
|
|
175
|
-
return
|
|
189
|
+
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
async function watchVNextWorkflowHandler({
|
|
@@ -182,15 +196,15 @@ async function watchVNextWorkflowHandler({
|
|
|
182
196
|
}) {
|
|
183
197
|
try {
|
|
184
198
|
if (!workflowId) {
|
|
185
|
-
throw new
|
|
199
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
186
200
|
}
|
|
187
201
|
if (!runId) {
|
|
188
|
-
throw new
|
|
202
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
189
203
|
}
|
|
190
204
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
191
205
|
const run = await workflow.getWorkflowRunById(runId);
|
|
192
206
|
if (!run) {
|
|
193
|
-
throw new
|
|
207
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
194
208
|
}
|
|
195
209
|
const _run = workflow.createRun({ runId });
|
|
196
210
|
let unwatch;
|
|
@@ -218,7 +232,7 @@ async function watchVNextWorkflowHandler({
|
|
|
218
232
|
});
|
|
219
233
|
return stream;
|
|
220
234
|
} catch (error) {
|
|
221
|
-
return
|
|
235
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
222
236
|
}
|
|
223
237
|
}
|
|
224
238
|
async function resumeAsyncVNextWorkflowHandler({
|
|
@@ -226,32 +240,37 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
226
240
|
workflowId,
|
|
227
241
|
runId,
|
|
228
242
|
body,
|
|
229
|
-
runtimeContext
|
|
243
|
+
runtimeContext,
|
|
244
|
+
runtimeContextFromRequest
|
|
230
245
|
}) {
|
|
231
246
|
try {
|
|
232
247
|
if (!workflowId) {
|
|
233
|
-
throw new
|
|
248
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
234
249
|
}
|
|
235
250
|
if (!runId) {
|
|
236
|
-
throw new
|
|
251
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
237
252
|
}
|
|
238
253
|
if (!body.step) {
|
|
239
|
-
throw new
|
|
254
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
240
255
|
}
|
|
241
256
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
242
257
|
const run = await workflow.getWorkflowRunById(runId);
|
|
243
258
|
if (!run) {
|
|
244
|
-
throw new
|
|
259
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
245
260
|
}
|
|
261
|
+
const finalRuntimeContext = new di.RuntimeContext([
|
|
262
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
263
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
264
|
+
]);
|
|
246
265
|
const _run = workflow.createRun({ runId });
|
|
247
266
|
const result = await _run.resume({
|
|
248
267
|
step: body.step,
|
|
249
268
|
resumeData: body.resumeData,
|
|
250
|
-
runtimeContext
|
|
269
|
+
runtimeContext: finalRuntimeContext
|
|
251
270
|
});
|
|
252
271
|
return result;
|
|
253
272
|
} catch (error) {
|
|
254
|
-
return
|
|
273
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
255
274
|
}
|
|
256
275
|
}
|
|
257
276
|
async function resumeVNextWorkflowHandler({
|
|
@@ -263,18 +282,18 @@ async function resumeVNextWorkflowHandler({
|
|
|
263
282
|
}) {
|
|
264
283
|
try {
|
|
265
284
|
if (!workflowId) {
|
|
266
|
-
throw new
|
|
285
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
267
286
|
}
|
|
268
287
|
if (!runId) {
|
|
269
|
-
throw new
|
|
288
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
270
289
|
}
|
|
271
290
|
if (!body.step) {
|
|
272
|
-
throw new
|
|
291
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
273
292
|
}
|
|
274
293
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
275
294
|
const run = await workflow.getWorkflowRunById(runId);
|
|
276
295
|
if (!run) {
|
|
277
|
-
throw new
|
|
296
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
278
297
|
}
|
|
279
298
|
const _run = workflow.createRun({ runId });
|
|
280
299
|
await _run.resume({
|
|
@@ -284,7 +303,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
284
303
|
});
|
|
285
304
|
return { message: "Workflow run resumed" };
|
|
286
305
|
} catch (error) {
|
|
287
|
-
return
|
|
306
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
288
307
|
}
|
|
289
308
|
}
|
|
290
309
|
async function getVNextWorkflowRunsHandler({
|
|
@@ -298,7 +317,7 @@ async function getVNextWorkflowRunsHandler({
|
|
|
298
317
|
}) {
|
|
299
318
|
try {
|
|
300
319
|
if (!workflowId) {
|
|
301
|
-
throw new
|
|
320
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
302
321
|
}
|
|
303
322
|
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
304
323
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
@@ -307,7 +326,7 @@ async function getVNextWorkflowRunsHandler({
|
|
|
307
326
|
};
|
|
308
327
|
return workflowRuns;
|
|
309
328
|
} catch (error) {
|
|
310
|
-
return
|
|
329
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
311
330
|
}
|
|
312
331
|
}
|
|
313
332
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { handleError } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
2
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
3
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
3
4
|
|
|
4
5
|
// src/server/handlers/telemetry.ts
|
|
5
6
|
var telemetry_exports = {};
|